This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; region-markdown-to-org.el --- Emacs: Convert selected Markdown text to Org format using Pandoc -*- lexical-binding: t; -*- | |
;; Gits URL: | |
;; License: MIT | |
;; Author: James Cherti | |
(defun my-markdown-to-org (beg end) | |
"Convert selected Markdown text to Org format using Pandoc | |
BEG and END are the beginning and end of the selection." | |
(interactive "r") | |
(if (use-region-p) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; auto-scroll-message-buffer.el --- Auto scroll the *Messages* buffer -*- lexical-binding: t; -*- | |
;; Gits URL: | |
;; License: MIT | |
;; Author: James Cherti | |
(defun my-auto-scroll-message-advice (&rest _) | |
"Go to point-max after a message in *Messages* buffer." | |
(walk-windows | |
(lambda (window) | |
(let ((window-buffer (window-buffer window))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; clone-indirect-buffer-current-window.el --- Create an indirect buffer and switch to it.. -*- lexical-binding: t; -*- | |
;; Gits URL: https://gist.github.com/jamescherti/686d8cb3d636614cefe76c6fc7b76e55 | |
;; License: MIT | |
;; Author: James Cherti | |
(defun my-clone-indirect-buffer-current-window (&optional newname norecord) | |
"Create an indirect buffer and switch to it. | |
Creates a new indirect buffer with the same content as the current buffer, | |
preserving point position, window start, and horizontal scroll position. The | |
original buffer remains unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; disable-truncation-arrow.el --- Disable the truncation arrow. -*- lexical-binding: t; -*- | |
;; Gits URL: https://gist.github.com/jamescherti/45c7f70d316c5d707910cbd1fdb676cb | |
;; License: MIT | |
;; Author: James Cherti | |
(defun my-disable-fringe-truncation-arrow () | |
"Disable the truncation arrow." | |
(unless (boundp 'fringe-indicator-alist) | |
(error "The fringe-indicator-alist was not declared")) | |
(setq fringe-indicator-alist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; delete-before-cursor-except-asterisks.el --- Emacs Evil Org-mode: Delete everything before the cursor except the first '*' and space. -*- lexical-binding: t; -*- | |
;; Gits URL: https://gist.github.com/jamescherti/15168bb060d79a5c57215e62dd9bfa55 | |
;; License: MIT | |
;; Author: James Cherti | |
(with-eval-after-load "org" | |
(with-eval-after-load "evil" | |
(defun my-evil-delete-to-heading-star () | |
"Delete everything before the cursor except the first '*' and space. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; save-marker-and-window.el --- Emacs: Save point as a marker, window start/hscroll, restoring them after BODY. -*- lexical-binding: t; -*- | |
;; Gits URL: https://gist.github.com/jamescherti/8921b341b628599ca8c7ff7f173a435a | |
;; Usage: (my-save-marker-and-window (progn (your-code argument))) | |
;; License: MIT | |
;; Author: James Cherti | |
(defmacro my-save-marker-and-window (&rest body) | |
"Save point as a marker, window start/hscroll, restoring them after BODY." | |
`(let ((point-marker (copy-marker (point))) | |
(window-start-marker (copy-marker (window-start))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; shell-command-first-line-to-string.el --- Return the first line of output from executing COMMAND. -*- lexical-binding: t; -*- | |
;; Return the first line of output from executing COMMAND. | |
;; If the command fails or produces no output, return nil. | |
;; | |
;; This function is superior to `shell-command-to-string` because it allows | |
;; for the detection of command execution failures by examining the exit status. | |
;; While `shell-command-to-string` only returns the output as a string, | |
;; it does not provide information about whether the command succeeded or failed. | |
;; By using `call-process-shell-command`, this function can capture both | |
;; the output and the exit status, enabling better error handling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; describe-symbol-at-point.el --- Describe variable or function at point -*- lexical-binding: t; -*- | |
;; Description: Clear the contents of the *Messages* buffer if it is the current buffer. | |
;; Gits URL: https://gist.github.com/jamescherti/abb288cb98f5f9f08431cc29225273fe | |
;; License: MIT | |
;; Author: James Cherti | |
(defun my-describe-elisp-symbol-at-point () | |
"Describe the symbol at point as either a variable or a function. | |
This function determines whether the symbol at point is a variable or a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Description: Clear the contents of the *Messages* buffer if it is the current buffer. | |
;; Gits URL: https://gist.github.com/jamescherti/52e8fe8700ab394163bb99f2b8d456fd | |
;; License: MIT | |
;; Author: James Cherti | |
(defun my-clear-messages-buffer () | |
"Clear the contents of the *Messages* buffer if it is the current buffer." | |
(when (string= (buffer-name) "*Messages*") | |
(let ((was-read-only buffer-read-only)) | |
(when was-read-only |
NewerOlder