Fix remaining Emacs 30 bugs and issues.
This commit is contained in:
parent
6a28307eca
commit
ac4d2cbc0b
4 changed files with 69 additions and 84 deletions
|
@ -43,6 +43,7 @@ Best success comes from using the [[https://github.com/d12frosted/homebrew-emacs
|
||||||
|
|
||||||
I find that I need to … at least, on my work computer, install two different versions of Emacs that I use to distinguish one for “work” and the other for other activities, like IRC and [[file:ha-feed-reader.org][elfeed]]. To that end, I run the following command to install Emacs:
|
I find that I need to … at least, on my work computer, install two different versions of Emacs that I use to distinguish one for “work” and the other for other activities, like IRC and [[file:ha-feed-reader.org][elfeed]]. To that end, I run the following command to install Emacs:
|
||||||
#+begin_src sh
|
#+begin_src sh
|
||||||
|
brew reinstall $(brew deps emacs-plus@30)
|
||||||
brew install emacs-plus@30 --with-native-comp --with-mailutils --with-imagemagick --with-savchenkovaleriy-big-sur-icon --with-no-frame-refocus --debug
|
brew install emacs-plus@30 --with-native-comp --with-mailutils --with-imagemagick --with-savchenkovaleriy-big-sur-icon --with-no-frame-refocus --debug
|
||||||
#+end_src
|
#+end_src
|
||||||
And if it fails, choose =shell= and type:
|
And if it fails, choose =shell= and type:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"A WAV or AU file used at the completion of a function.")
|
"A WAV or AU file used at the completion of a function.")
|
||||||
|
|
||||||
;; My replacement in case we can't play internal sounds:
|
;; My replacement in case we can't play internal sounds:
|
||||||
(defun beep--beep ()
|
(defun beep-beep ()
|
||||||
"Play a default notification sound file.
|
"Play a default notification sound file.
|
||||||
Customize the variable, `beep-alert-sound-file' to adjust the sound."
|
Customize the variable, `beep-alert-sound-file' to adjust the sound."
|
||||||
(if (fboundp 'play-sound-internal)
|
(if (fboundp 'play-sound-internal)
|
||||||
|
@ -29,12 +29,12 @@ Customize the variable, `beep-alert-sound-file' to adjust the sound."
|
||||||
(defvar beep-speech-executable "say %s"
|
(defvar beep-speech-executable "say %s"
|
||||||
"An OS-dependent shell string to speak. Replaces `%s' with a phrase.")
|
"An OS-dependent shell string to speak. Replaces `%s' with a phrase.")
|
||||||
|
|
||||||
(defun beep--speak (phrase)
|
(defun beep-speak (phrase)
|
||||||
"Call a program to speak the string, PHRASE.
|
"Call a program to speak the string, PHRASE.
|
||||||
Customize the variable, `beep-speech-executable'."
|
Customize the variable, `beep-speech-executable'."
|
||||||
(let ((command (format beep-speech-executable phrase)))
|
(let ((command (format beep-speech-executable phrase)))
|
||||||
(save-window-excursion
|
(ignore-errors
|
||||||
(async-shell-command command))))
|
(call-process-shell-command command))))
|
||||||
|
|
||||||
(defun beep-when-finished (phrase &optional to-speak)
|
(defun beep-when-finished (phrase &optional to-speak)
|
||||||
"Notify us with string, PHRASE, to grab our attention.
|
"Notify us with string, PHRASE, to grab our attention.
|
||||||
|
@ -42,8 +42,8 @@ Useful after a long process has completed, but use sparingly,
|
||||||
as this can be pretty distracting."
|
as this can be pretty distracting."
|
||||||
(when (functionp 'alert)
|
(when (functionp 'alert)
|
||||||
(alert phrase :title "Completed"))
|
(alert phrase :title "Completed"))
|
||||||
(beep--beep)
|
(beep-beep)
|
||||||
(beep--speak (or to-speak phrase))
|
(beep-speak (or to-speak phrase))
|
||||||
(message phrase))
|
(message phrase))
|
||||||
|
|
||||||
(defun compile-and-notify ()
|
(defun compile-and-notify ()
|
||||||
|
@ -57,31 +57,12 @@ See `beep-when-finished' for details."
|
||||||
(defvar beep-func-too-long-time 5
|
(defvar beep-func-too-long-time 5
|
||||||
"The number of seconds a function runs before it is considered taking too much time, and needing to be alerted when it has finished.")
|
"The number of seconds a function runs before it is considered taking too much time, and needing to be alerted when it has finished.")
|
||||||
|
|
||||||
(defun beep--after-function (func)
|
|
||||||
"Call the function, FUNC, interactively, and notify us when completed."
|
|
||||||
(let ((start-time (current-time))
|
|
||||||
duration)
|
|
||||||
(call-interactively func)
|
|
||||||
(setq duration (thread-first
|
|
||||||
(current-time)
|
|
||||||
(time-subtract start-time)
|
|
||||||
decode-time
|
|
||||||
first))
|
|
||||||
(when (> duration beep-func-too-long-time)
|
|
||||||
(beep-when-finished (format "The function, %s, has finished." func)))))
|
|
||||||
|
|
||||||
(defun recompile-and-notify ()
|
|
||||||
"Call `recompile' and notify us when finished.
|
|
||||||
See `beep-when-finished' for details."
|
|
||||||
(interactive)
|
|
||||||
(beep--after-function 'recompile))
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-c c") 'recompile-and-notify)
|
(global-set-key (kbd "C-c c") 'recompile-and-notify)
|
||||||
(global-set-key (kbd "C-c C") 'compile-and-notify)
|
(global-set-key (kbd "C-c C") 'compile-and-notify)
|
||||||
|
|
||||||
(defun beep-when-runs-too-long (orig-function &rest args)
|
(defun beep-when-runs-too-long (orig-function &rest args)
|
||||||
"Notifies us about the completion of ORIG-FUNCTION.
|
"Notifies us about the completion of ORIG-FUNCTION.
|
||||||
Useful as after advice to long-running functions, for instance:
|
Useful as after advice to long-running functions, for instance:
|
||||||
|
|
||||||
(advice-add 'org-publish :around #'beep-when-runs-too-long)"
|
(advice-add 'org-publish :around #'beep-when-runs-too-long)"
|
||||||
(let ((start-time (current-time))
|
(let ((start-time (current-time))
|
||||||
|
|
|
@ -29,6 +29,10 @@ A literate programming file for configuring Emacs.
|
||||||
;; loading sequence.
|
;; loading sequence.
|
||||||
;;
|
;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
;; Used functions defined elsewhere:
|
||||||
|
(defun font-icons (collection label &rest args)
|
||||||
|
(or (plist-get args :title) label))
|
||||||
#+end_src
|
#+end_src
|
||||||
* Basic Configuration
|
* Basic Configuration
|
||||||
I begin configuration of Emacs that isn’t /package-specific/.
|
I begin configuration of Emacs that isn’t /package-specific/.
|
||||||
|
@ -779,43 +783,43 @@ Magnar Sveen's [[https://github.com/magnars/expand-region.el][expand-region]] pr
|
||||||
The built-in =isearch= is fantastically simple and useful, bound to ~C-s~, but why not bind searching for the current symbol?
|
The built-in =isearch= is fantastically simple and useful, bound to ~C-s~, but why not bind searching for the current symbol?
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(global-set-key (kbd "m-s m-s") 'isearch-forward-thing-at-point)
|
(global-set-key (kbd "M-s M-s") 'isearch-forward-thing-at-point)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
I like Charles Choi’s [[https://github.com/kickingvegas/casual][Casual Suite]], and his original [[https://github.com/kickingvegas/cc-isearch-menu][cc-isearch-menu]] was great at seeing the /buried/ features. I’ve duplicated the features using [[https://github.com/jerrypnz/major-mode-hydra.el][pretty-hydra]]. In the middle of a search, type ~⌘-s~ (Command-s), and menu of options I don’t remember appear.
|
I like Charles Choi’s [[https://github.com/kickingvegas/casual][Casual Suite]], and his original [[https://github.com/kickingvegas/cc-isearch-menu][cc-isearch-menu]] was great at seeing the /buried/ features. I’ve duplicated the features using [[https://github.com/jerrypnz/major-mode-hydra.el][pretty-hydra]]. In the middle of a search, type ~⌘-s~ (Command-s), and menu of options I don’t remember appear.
|
||||||
|
|
||||||
#+begin_src emacs-lisp :tangle no
|
#+begin_src emacs-lisp :tangle no
|
||||||
(defvar ha-isearch--title (font-icons 'faicon "magnifying_glass"
|
(defvar ha-isearch--title (font-icons 'faicon "magnifying_glass"
|
||||||
:title "Search Options"))
|
:title "Search Options"))
|
||||||
|
|
||||||
(pretty-hydra-define isearch-mode
|
(pretty-hydra-define isearch-mode
|
||||||
(:color amaranth :quit-key "C-s" :title ha-isearch--title)
|
(:color amaranth :quit-key "C-s" :title ha-isearch--title)
|
||||||
("Movement"
|
("Movement"
|
||||||
(("n" isearch-repeat-forward "Forward")
|
(("n" isearch-repeat-forward "Forward")
|
||||||
("p" isearch-repeat-backward "Backward")
|
("p" isearch-repeat-backward "Backward")
|
||||||
("j" avy-isearch "Jump" :color blue))
|
("j" avy-isearch "Jump" :color blue))
|
||||||
"Expand"
|
"Expand"
|
||||||
((">" isearch-yank-symbol-or-char "Full symbol")
|
((">" isearch-yank-symbol-or-char "Full symbol")
|
||||||
("z" isearch-yank-until-char "Until char")
|
("z" isearch-yank-until-char "Until char")
|
||||||
("$" isearch-yank-line "Full line"))
|
("$" isearch-yank-line "Full line"))
|
||||||
"Replace"
|
"Replace"
|
||||||
(("R" isearch-query-replace "Literal")
|
(("R" isearch-query-replace "Literal")
|
||||||
("Q" isearch-query-replace-regexp "Regexp")
|
("Q" isearch-query-replace-regexp "Regexp")
|
||||||
("<return>" isearch-exit "Stay" :color blue))
|
("<return>" isearch-exit "Stay" :color blue))
|
||||||
"Toggles"
|
"Toggles"
|
||||||
(("w" isearch-toggle-word "Word only" :toggle t)
|
(("w" isearch-toggle-word "Word only" :toggle t)
|
||||||
("s" isearch-toggle-symbol "Full symbol" :toggle t)
|
("s" isearch-toggle-symbol "Full symbol" :toggle t)
|
||||||
("r" isearch-toggle-regexp "Regexp" :toggle t)
|
("r" isearch-toggle-regexp "Regexp" :toggle t)
|
||||||
("c" isearch-toggle-case-fold "Case Sensitive" :toggle t))
|
("c" isearch-toggle-case-fold "Case Sensitive" :toggle t))
|
||||||
"Highlight"
|
"Highlight"
|
||||||
(("H" isearch-highlight-regexp "Matches" :color blue)
|
(("H" isearch-highlight-regexp "Matches" :color blue)
|
||||||
("L" isearch-highlight-lines-matching-regexp "Lines" :color blue))
|
("L" isearch-highlight-lines-matching-regexp "Lines" :color blue))
|
||||||
"Other"
|
"Other"
|
||||||
(("e" isearch-edit-string "Edit")
|
(("e" isearch-edit-string "Edit")
|
||||||
("o" isearch-occur "Occur" :color blue)
|
("o" isearch-occur "Occur" :color blue)
|
||||||
("C-g" isearch-abort "Abort" :color blue))))
|
("C-g" isearch-abort "Abort" :color blue))))
|
||||||
|
|
||||||
(define-key isearch-mode-map (kbd "s-s") 'isearch-mode/body)
|
(define-key isearch-mode-map (kbd "s-s") 'isearch-mode/body)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Pressing ~C-g~ aborts, and ~Return~ exits leaving the point in place. Typing ~C-s~ in the menu stops the menu to continue searching.
|
Pressing ~C-g~ aborts, and ~Return~ exits leaving the point in place. Typing ~C-s~ in the menu stops the menu to continue searching.
|
||||||
|
|
|
@ -381,8 +381,7 @@ This project replaces [[https://github.com/domtronn/all-the-icons.el][all-the-ic
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package nerd-icons
|
(use-package nerd-icons
|
||||||
:straight (nerd-icons :type git :host github :repo "rainstormstudio/nerd-icons.el"
|
:straight (nerd-icons :type git :host github :repo "rainstormstudio/nerd-icons.el")
|
||||||
:files (:defaults "data"))
|
|
||||||
:custom
|
:custom
|
||||||
;; The Nerd Font you want to use in GUI defaults to fixed-font:
|
;; The Nerd Font you want to use in GUI defaults to fixed-font:
|
||||||
(nerd-icons-font-family ha-fixed-font))
|
(nerd-icons-font-family ha-fixed-font))
|
||||||
|
@ -392,39 +391,39 @@ The way we access the /font icons/ has always been … odd; needing to specify t
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun font-icons (collection label &rest args)
|
(defun font-icons (collection label &rest args)
|
||||||
"Abstraction over `nerd-icons' project.
|
"Abstraction over `nerd-icons' project.
|
||||||
LABEL is a short icon description merged with COLLECTION to
|
LABEL is a short icon description merged with COLLECTION to identify an
|
||||||
identify an icon to use. For instance, 'faicon or 'octicon.
|
icon to use. For instance, 'faicon or 'octicon.
|
||||||
|
|
||||||
ARGS, a plist, contain the title, sizing and other information.
|
ARGS, a plist, contain the title, sizing and other information.
|
||||||
|
|
||||||
For instance:
|
For instance:
|
||||||
(font-icons 'faicon \"file\" :title \"File Management\")
|
(font-icons 'faicon \"file\" :title \"File Management\")
|
||||||
|
|
||||||
The goal is to take:
|
The goal is to take:
|
||||||
(all-the-icons-octicon \"git-branch\")
|
(all-the-icons-octicon \"git-branch\")
|
||||||
And reformat to:
|
And reformat to:
|
||||||
(font-icons 'octicon \"git-branch\")"
|
(font-icons 'octicon \"git-branch\")"
|
||||||
(let* ((func (intern (format "nerd-icons-%s" collection)))
|
(let* ((func (intern (format "nerd-icons-%s" collection)))
|
||||||
(short (cl-case collection
|
(short (cl-case collection
|
||||||
('octicon "oct")
|
('octicon "oct")
|
||||||
('faicon "fa")
|
('faicon "fa")
|
||||||
('mdicon "md")
|
('mdicon "md")
|
||||||
('codicon "cod")
|
('codicon "cod")
|
||||||
('sucicon "custom")
|
('sucicon "custom")
|
||||||
('devicon "dev")
|
('devicon "dev")
|
||||||
(t collection)))
|
(t collection)))
|
||||||
(title (plist-get args :title))
|
(title (plist-get args :title))
|
||||||
(space (plist-get args :space))
|
(space (plist-get args :space))
|
||||||
(icon (format "nf-%s-%s" short
|
(icon (format "nf-%s-%s" short
|
||||||
(string-replace "-" "_" label))))
|
(string-replace "-" "_" label))))
|
||||||
|
|
||||||
;; With the appropriate nerd-icons function name,
|
;; With the appropriate nerd-icons function name,
|
||||||
;; an expanded icon name, we get the icon string:
|
;; an expanded icon name, we get the icon string:
|
||||||
(concat (apply func (cons icon args))
|
(concat (apply func (cons icon args))
|
||||||
(cond
|
(cond
|
||||||
((and title space) (concat (s-repeat space " ") title))
|
((and title space) (concat (s-repeat space " ") title))
|
||||||
(title (concat " " title))))))
|
(title (concat " " title))))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
This replaces the /title generator/ for [[file:ha-config.org::*Leader Sequences][major-mode-hydra]] project to include a nice looking icon:
|
This replaces the /title generator/ for [[file:ha-config.org::*Leader Sequences][major-mode-hydra]] project to include a nice looking icon:
|
||||||
|
|
Loading…
Reference in a new issue