Compare commits

...

4 Commits

View File

@ -228,9 +228,9 @@ of [[info:emacs#Saving Customizations][saving customizations (info)]].
recentf-max-saved-items 100
recentf-mode t
save-place-mode t
savehist-mode t
scroll-bar-mode nil
tab-always-indent 'complete
tab-width 8
tool-bar-mode nil
tooltip-mode nil
url-cookie-trusted-urls nil
@ -978,9 +978,11 @@ Emacs. Try {{{kbd(C-h o)}}} instead of {{{kbd(C-h f)}}} or {{{kbd(C-h v)}}}.
(with-eval-after-load 'help-fns
;; ChatGPT recommends to require `shortdoc' contrary to the
;; `shortdoc-help-fns-examples-function' documentation string.
(require 'shortdoc)
;; BUG#71537: "emacs -Q" does not need the `add-hook' form. Note:
;; `add-hook' should append `shortdoc-help-fns-examples-function' to
;; `help-fns-describe-function-functions'.
(add-hook 'help-fns-describe-function-functions
#'shortdoc-help-fns-examples-function)
#'shortdoc-help-fns-examples-function 'append)
(setopt help-enable-symbol-autoload t))
#+end_src
@ -1352,10 +1354,11 @@ completion in any buffer.
:END:
Listing [[lst:enable-vertico-mode]] configures and enables =savehist-mode= and
enables =vertico-mode=. The documentation src_emacs-lisp{(describe-function
'savehist-mode)} why it is best to turn on =savehist-mode= in the Emacs init
file. BUG: Adding ~eww-history~, ~register-alist~, ~regexp-search-string~, or
~search-string~ to ~savehist-additional-variables~ fails to save the relevant
enables =vertico-mode=. The src_emacs-lisp{(describe-function 'savehist-mode)}
documentation explains why it is best to turn on =savehist-mode= in the
=user-init-file=. Listing [[lst:prune-file-name-history]] allows to prune
non-existing files from the file name history. BUG: Adding ~eww-history~ or
~register-alist~ to ~savehist-additional-variables~ fails to save the relevant
histories.
#+caption[Enable =savehist-mode= and =vertico-mode=]:
@ -1363,8 +1366,8 @@ histories.
#+name: lst:enable-vertico-mode
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'savehist
(setopt savehist-additional-variables '(kill-ring search-ring))
(savehist-mode +1))
(setopt savehist-additional-variables
'(command-history kill-ring regexp-search-ring search-ring)))
(when (and (ensure-package-installation 'vertico)
(fboundp 'vertico-directory-delete-char)
(fboundp 'vertico-directory-delete-word)
@ -1378,6 +1381,22 @@ histories.
(keymap-set vertico-map "RET" #'vertico-directory-enter)))
#+end_src
#+caption[Prune non-existing files from =file-name-history=]:
#+caption: Prune non-existing files from =file-name-history=.
#+name: lst:prune-file-name-history
#+begin_src emacs-lisp -n :results silent
(defun prune-file-name-history ()
"Prune non-existing files from `file-name-history'."
(interactive)
(let ((old (length file-name-history)) ok)
(dolist (name file-name-history)
(when (file-exists-p name)
(push name ok)))
(setq file-name-history (nreverse ok))
(message "Pruned `file-name-history' from `%S' to `%S' files"
old (length file-name-history))))
#+end_src
#+attr_latex: :booktabs yes :float table
#+caption[Vertico key map bindings]:
#+caption: Vertico key map bindings.
@ -4962,7 +4981,8 @@ Listing [[lst:bug-reference-mode]] configures ~bug-reference-mode~ for use with
(ensure-package-installation 'debbugs)
(defvar bug-reference-url-format
"https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s"
"Setting this as a file local variable enables `bug-reference-mode'")
"Format to use `gnu-debbugs' URL.")
(put 'bug-reference-mode 'safe-local-variable 'booleanp))
#+end_src
*** [[info:elisp#Debugging][Debugging Emacs Lisp (info)]]
@ -5937,14 +5957,13 @@ point movements visually.
#+begin_src emacs-lisp -n :results silent
;; https://karthinks.com/software/batteries-included-with-emacs/
;; https://github.com/karthink/.emacs.d/blob/master/init.el#L2077
(require 'pulse) ; since `pulse' does not autoload `pulse-delay' and
; `pulse-iterations'.
(defun flash-line-around-point (&rest _)
"Flash the line around point."
(let ((pulse-iterations 16)
(pulse-delay 0.1))
(pulse-momentary-highlight-one-line (point))))
;; BUG#71537: I cannot use `let' here without requiring `pulse', but
;; `setq' has side effects.
(setq pulse-iterations 16
pulse-delay 0.1)
(pulse-momentary-highlight-one-line (point)))
(dolist (command '(scroll-up-command
scroll-down-command
@ -6403,7 +6422,7 @@ Only the [[info:org#Top][Org]] source file shows the local variables footer.
# Emacs looks for "Local variables:" after the last "newline-formfeed".
# Local Variables:
# bug-reference-url-format: "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s"
# bug-reference-mode: t
# compile-command: "latexmk -interaction=nonstopmode -lualatex -pvc -shell-escape README.tex"
# fill-column: 80
# org-edit-src-content-indentation: 0