Skip to content

Instantly share code, notes, and snippets.

View jamescherti's full-sized avatar

James Cherti jamescherti

View GitHub Profile
;; Gits URL: https://gist.github.com/jamescherti/095812fefed49894cde5e5945ce5d63a
;; License: MIT
;; Author: James Cherti
;;
;; Description:
;; ------------
;; Make the built-in (save-some-buffers) function automatically save
;; buffers that are visiting existing files, without prompting the
;; user for confirmation.
;; URL: https://gist.github.com/jamescherti/d4179eeece026081ac5d10d9eb1b25cf
;; License: MIT
;; Author: James Cherti
;;
;; Description:
;; Preserving Info-history-list across sessions using savehist or desktop.el
;; allows users to save and restore the links marked as "read" within the Info
;; system, providing a visual cue of which nodes have been visited.
;;
;; Info-history-list in Emacs is a variable that stores a list of previously
@jamescherti
jamescherti / fix-electric-pair-C-h.el
Last active May 26, 2024 13:34
Fix Electric Pair delete adjacent pair when C-h is pressed
;; Gits URL: https://gist.github.com/jamescherti/8a7c6e926fcb6a16251bc24b1fe06bcf
;; License: MIT
;; Author: James Cherti
;;
;; Description:
;; ------------
;; When the C-h key is pressed in Emacs Evil mode, and
;; electric-pair-delete-adjacent-pairs is set to true, Electric Pair should
;; delete an adjacent pair of characters, similar to the behavior of the
;; Backspace key. Currently, this functionality only works with the Backspace
@jamescherti
jamescherti / .wcalcrc
Created May 21, 2024 18:20
wcalc configuration file ~/.wcalcrc
# Description: wcalc configuration file ~/.wcalcrc
# Gits URL: https://gist.github.com/jamescherti/ca94710ab7b473ca2e5118519fb06672
# License: MIT
# Author: James Cherti
precision=2
show_equals=false
save_errors=true
history_limit=2000
color=true
@jamescherti
jamescherti / switch-project-find-file.el
Last active May 3, 2024 15:13
Emacs: Switch to another project using (find-file)
;; Description:
;; Emacs: Switch to another project using (find-file)
;; Gits URL: https://gist.github.com/jamescherti/bf74fb911d17583e7f4b57946f1ea775
;; License: MIT
;; Author: James Cherti
(defun my-project-prompt-project-dir ()
"Prompt the user for a directory that is one of the known project roots."
(project--ensure-read-project-list)
(setq pr-dir (completing-read "Select project: " project--list nil t)))
;; Description:
;; Prevent 'evil-paste-after' and 'evil-paste-before' from failing when the
;; paste ring (akin to the clipboard) is empty.
;;
;; Gits URL:
;; License: MIT
;; Author: James Cherti
(defun ignore-empty-ring-errors (orig-func &rest args)
"Ignore errors related to the empty ring when calling ORIG-FUNC with ARGS."
@jamescherti
jamescherti / emacs-org-move-subtree.el
Last active April 6, 2024 23:10
Emacs Evil: Move Org subtrees up or down while preserving the cursor's column
;; Description:
;; Emacs Evil: Move Org subtrees up or down while preserving the cursor's
;; column. Unlike the default behavior in Emacs Org, which moves the cursor to
;; the beginning of the line, this approach maintains the cursor's current
;; column position, avoiding undesirable cursor movement.
;;
;; URL: https://gist.github.com/jamescherti/35475b05a45482f4bde325895073aa3e
;; License: MIT
;; Author: James Cherti
@jamescherti
jamescherti / emacs-org-strike-done.el
Last active April 6, 2024 16:04
Strike through DONE tasks in the Emacs Org Mode
;; Strike through DONE tasks in the Emacs Org Mode
;; URL: https://gist.github.com/jamescherti/e12d494296643e67d6e9a8150b14c4cb
;; License: MIT
;; Author: James Cherti
;; Enable the fontification of headlines for tasks that have been marked as
;; completed. This means that the entire headline, not just the TODO keyword,
;; will visually change to reflect the task's completion status.
(setq org-fontify-done-headline t)
@jamescherti
jamescherti / compile-emacs.sh
Last active May 28, 2024 21:38
Compile Emacs: My parameters to compile Emacs
#!/usr/bin/env sh
# Description:
# The parameters I use to compile Emacs >=29 to my specific needs and preferences.
#
# Gits URL: https://gist.github.com/jamescherti/62c993aa71630abfd2a436e3028171ce
# License: MIT
# Author: James Cherti
#
DEST_PATH="/usr/local"
@jamescherti
jamescherti / emacs-org-mode-replace-hyphen-bullet.el
Last active March 20, 2024 12:28
Emacs org mode: Replace list hyphen with bullet
;; Emacs org mode: Replace list hyphen "-" with bullet
;; URL: https://gist.github.com/jamescherti/61ebd7ff293d989a385d2e73fa0b45b4
(font-lock-add-keywords
'org-mode '(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1)
(match-end 1)
"\u2022"))))))