Reduce the number of flymake errors in init.el

This commit is contained in:
Gerard Vermeulen 2024-04-18 17:03:25 +02:00
parent be280ee7ee
commit 9d7269a5c6
1 changed files with 193 additions and 174 deletions

View File

@ -322,6 +322,8 @@ of [[info:emacs#Saving Customizations][saving customizations (info)]].
;; Enable `package-install-upgrade-built-in' to upgrade Org and transient. ;; Enable `package-install-upgrade-built-in' to upgrade Org and transient.
;; Caveat: works with `list-packages' but not with `package-upgrade-all'. ;; Caveat: works with `list-packages' but not with `package-upgrade-all'.
;; Disable upgrading other packages by pinning them to "nongnu". ;; Disable upgrading other packages by pinning them to "nongnu".
(defvar package-pinned-packages)
(setopt package-install-upgrade-built-in t (setopt package-install-upgrade-built-in t
package-pinned-packages package-pinned-packages
(cl-union '((bind-key . "nongnu") (cl-union '((bind-key . "nongnu")
@ -392,6 +394,8 @@ version.
#+caption: Install the selected packages. #+caption: Install the selected packages.
#+name: lst:install-selected-packages #+name: lst:install-selected-packages
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(defvar package-selected-packages)
(unless noninteractive (unless noninteractive
(unless (require 'no-littering nil 'noerror) (unless (require 'no-littering nil 'noerror)
(unless (bound-and-true-p package-archive-contents) (unless (bound-and-true-p package-archive-contents)
@ -679,8 +683,8 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations.
(defun make-display-buffer-matcher-function (major-modes) (defun make-display-buffer-matcher-function (major-modes)
"Return a lambda function to match a list of MAJOR-MODES." "Return a lambda function to match a list of MAJOR-MODES."
(lambda (buffer-name action) (lambda (buf-name _action)
(with-current-buffer buffer-name (apply #'derived-mode-p major-modes)))) (with-current-buffer buf-name (apply #'derived-mode-p major-modes))))
(keymap-global-set "M-o" #'other-window)) (keymap-global-set "M-o" #'other-window))
#+end_src #+end_src
@ -1434,12 +1438,16 @@ histories.
(setopt savehist-additional-variables '(kill-ring search-ring)) (setopt savehist-additional-variables '(kill-ring search-ring))
(savehist-mode +1)) (savehist-mode +1))
(when (and (ensure-package-installation 'vertico) (when (and (ensure-package-installation 'vertico)
(fboundp 'vertico-mode)) (fboundp 'vertico-directory-delete-char)
(vertico-mode +1)) (fboundp 'vertico-directory-delete-word)
(with-eval-after-load 'vertico (fboundp 'vertico-mode)
(keymap-set vertico-map "RET" #'vertico-directory-enter) (fboundp 'vertico-directory-enter))
(vertico-mode +1)
(with-eval-after-load 'vertico
(defvar vertico-map)
(keymap-set vertico-map "DEL" #'vertico-directory-delete-char) (keymap-set vertico-map "DEL" #'vertico-directory-delete-char)
(keymap-set vertico-map "M-DEL" #'vertico-directory-delete-word)) (keymap-set vertico-map "M-DEL" #'vertico-directory-delete-word)
(keymap-set vertico-map "RET" #'vertico-directory-enter)))
#+end_src #+end_src
#+attr_latex: :booktabs yes :float table #+attr_latex: :booktabs yes :float table
@ -1649,13 +1657,17 @@ Consult usage tips are:
#+caption: Implement =find-file= with previewing before selection. #+caption: Implement =find-file= with previewing before selection.
#+name: lst:find-file-preview #+name: lst:find-file-preview
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(defun consult-find-file-preview(cue &optional dir default mustmatch init pred) (defun consult-find-file-preview
(prompt &optional dir _default mustmatch initial predicate)
"Helper to implement previewing when calling `find-file'.
See `read-file-name' for the meaning of PROMPT, DIR, MUSTMATCH, INITIAL,
and PREDICATE."
(interactive) (interactive)
(let ((default-directory (or dir default-directory)) (let ((default-directory (or dir default-directory))
(minibuffer-completing-file-name t)) (minibuffer-completing-file-name t))
(consult--read #'read-file-name-internal :state (consult--file-preview) (consult--read #'read-file-name-internal :state (consult--file-preview)
:prompt cue :initial init :prompt prompt :initial initial
:require-match mustmatch :predicate pred))) :require-match mustmatch :predicate predicate)))
(defun toggle-find-file-preview () (defun toggle-find-file-preview ()
"Toggle previewing when calling `find-file'." "Toggle previewing when calling `find-file'."
@ -1680,7 +1692,8 @@ configures =company= after ensuring the =company= installation.
#+caption: Setup =company=. #+caption: Setup =company=.
#+name: lst:setup-company #+name: lst:setup-company
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'company) (when (and (ensure-package-installation 'company)
(fboundp 'company-mode))
;; https://github.com/purcell/emacs.d/issues/778 ;; https://github.com/purcell/emacs.d/issues/778
(setopt company-transformers '(company-sort-by-occurrence)) (setopt company-transformers '(company-sort-by-occurrence))
(dolist (symbol '(LaTeX-mode-hook (dolist (symbol '(LaTeX-mode-hook
@ -1864,7 +1877,7 @@ regexp strings.
#+caption: Ensure =xr= installation. #+caption: Ensure =xr= installation.
#+name: lst:ensure-xr-installation #+name: lst:ensure-xr-installation
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'xr)) (when (ensure-package-installation 'xr) t)
#+end_src #+end_src
* [[info:emacs#Version Control][Version Control (info)]] * [[info:emacs#Version Control][Version Control (info)]]
@ -1887,17 +1900,17 @@ single frame and to make all text visible prior to ediffing Org buffers.
#+caption: Setup =ediff=. #+caption: Setup =ediff=.
#+name: lst:setup-ediff #+name: lst:setup-ediff
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs (with-eval-after-load 'ediff-wind
(when (fboundp 'ediff-setup-windows-plain)
(setopt ediff-merge-split-window-function #'split-window-horizontally (setopt ediff-merge-split-window-function #'split-window-horizontally
ediff-split-window-function #'split-window-horizontally ediff-split-window-function #'split-window-horizontally
ediff-window-setup-function #'ediff-setup-windows-plain)) ediff-window-setup-function #'ediff-setup-windows-plain)))
(with-eval-after-load 'org (with-eval-after-load 'org
;; https://github.com/oantolin/emacs-config#readme ;; https://github.com/oantolin/emacs-config#readme
(add-hook 'org-mode-hook
(defun ediff-with-org-show-all () (defun ediff-with-org-show-all ()
"Expand all headings prior to ediffing org buffers." "Expand all headings prior to ediffing org buffers."
(add-hook 'ediff-prepare-buffer-hook #'org-fold-show-all nil t)) (add-hook 'ediff-prepare-buffer-hook #'org-fold-show-all nil t))))
(add-hook 'org-mode-hook #'ediff-with-org-show-all))
#+end_src #+end_src
** [[https://git-scm.com/book/en/v2][Git]] ** [[https://git-scm.com/book/en/v2][Git]]
@ -2105,7 +2118,6 @@ configuration objectives:
TeX-engine 'luatex TeX-engine 'luatex
TeX-indent-close-delimiters "]" TeX-indent-close-delimiters "]"
TeX-indent-open-delimiters "[" TeX-indent-open-delimiters "["
TeX-install-font-lock #'font-latex-setup
TeX-parse-self t TeX-parse-self t
;; Disable `TeX-electric-math' to prevent collisions with `smartparens'. ;; Disable `TeX-electric-math' to prevent collisions with `smartparens'.
TeX-electric-math nil))) TeX-electric-math nil)))
@ -2165,7 +2177,7 @@ configuration objectives:
#+caption: Configure =markdown-mode=. #+caption: Configure =markdown-mode=.
#+name: lst:configure-markdown-mode #+name: lst:configure-markdown-mode
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'markdown-mode)) (when (ensure-package-installation 'markdown-mode) t)
#+end_src #+end_src
** Writing [[info:org#Top][Org (info)]] files and [[info:org#Activation][Org activation (info)]] ** Writing [[info:org#Top][Org (info)]] files and [[info:org#Activation][Org activation (info)]]
@ -2333,7 +2345,8 @@ Watch out for completion `visit-tags-table' prompts."
(with-eval-after-load 'ob-lisp (with-eval-after-load 'ob-lisp
;; Default to `sly-eval' whenever feasible: ;; Default to `sly-eval' whenever feasible:
(when (package-installed-p 'sly) (when (and (package-installed-p 'sly)
(fboundp 'sly-eval))
(setopt org-babel-lisp-eval-fn #'sly-eval))) (setopt org-babel-lisp-eval-fn #'sly-eval)))
#+end_src #+end_src
@ -2341,10 +2354,10 @@ Watch out for completion `visit-tags-table' prompts."
#+caption: Unevaluable source blocks. #+caption: Unevaluable source blocks.
#+name: lst:no-org-babel-eval #+name: lst:no-org-babel-eval
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(setq org-babel-default-header-args:conf '((:eval . "no"))) (defvar org-babel-default-header-args:conf '((:eval . "no")))
(setq org-babel-default-header-args:diff '((:eval . "no"))) (defvar org-babel-default-header-args:diff '((:eval . "no")))
(setq org-babel-default-header-args:text '((:eval . "no"))) (defvar org-babel-default-header-args:text '((:eval . "no")))
(setq org-babel-default-header-args:toml '((:eval . "no"))) (defvar org-babel-default-header-args:toml '((:eval . "no")))
;;; Kludges to silence `org-lint' warnings: ;;; Kludges to silence `org-lint' warnings:
(defun org-babel-execute:conf (_body _params) (defun org-babel-execute:conf (_body _params)
@ -2390,11 +2403,10 @@ Undo this by means of `org-delete-property-globally'."
#+caption: Setup =org-mode-map= 1. #+caption: Setup =org-mode-map= 1.
#+name: lst:setup-org-mode-map-1 #+name: lst:setup-org-mode-map-1
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs ;; From: "Nicolas Richard" <theonewiththeevillook@yahoo.fr>
;; From: "Nicolas Richard" <theonewiththeevillook@yahoo.fr> ;; Date: Fri, 08 Mar 2013 16:23:02 +0100 [thread overview]
;; Date: Fri, 08 Mar 2013 16:23:02 +0100 [thread overview] ;; Message-ID: <87vc913oh5.fsf@yahoo.fr> (raw)
;; Message-ID: <87vc913oh5.fsf@yahoo.fr> (raw) (defun org-electric-dollar ()
(defun org-electric-dollar ()
"When called once, insert \\(\\) and leave point in between. "When called once, insert \\(\\) and leave point in between.
When called twice, replace the previously inserted \\(\\) by one $." When called twice, replace the previously inserted \\(\\) by one $."
(interactive) (interactive)
@ -2405,7 +2417,7 @@ When called twice, replace the previously inserted \\(\\) by one $."
(insert "\\(\\)") (insert "\\(\\)")
(backward-char 2))) (backward-char 2)))
(defun org-active-current-time-stamp () (defun org-active-current-time-stamp ()
"Insert an active date-time stamp of the current time." "Insert an active date-time stamp of the current time."
(interactive) (interactive)
(if (fboundp 'org-insert-time-stamp) (if (fboundp 'org-insert-time-stamp)
@ -2414,7 +2426,7 @@ When called twice, replace the previously inserted \\(\\) by one $."
(insert stamp) (insert stamp)
stamp))) stamp)))
(defun org-inactive-current-time-stamp () (defun org-inactive-current-time-stamp ()
"Insert an inactive date-time stamp of the current time." "Insert an inactive date-time stamp of the current time."
(interactive) (interactive)
(if (fboundp 'org-insert-time-stamp) (if (fboundp 'org-insert-time-stamp)
@ -2423,22 +2435,21 @@ When called twice, replace the previously inserted \\(\\) by one $."
(insert stamp) (insert stamp)
stamp))) stamp)))
(with-eval-after-load 'org (with-eval-after-load 'org
(setopt org-return-follows-link t) (setopt org-return-follows-link t)
(keymap-set org-mode-map "C-c <SPC>" #'org-inactive-current-time-stamp) (keymap-set org-mode-map "C-c <SPC>" #'org-inactive-current-time-stamp)
(keymap-set org-mode-map "C-c C-<SPC>" #'org-active-current-time-stamp) (keymap-set org-mode-map "C-c C-<SPC>" #'org-active-current-time-stamp)
(keymap-set org-mode-map "$" #'org-electric-dollar) (keymap-set org-mode-map "$" #'org-electric-dollar)
(keymap-set org-mode-map "M-q" #'org-fill-paragraph))) (keymap-set org-mode-map "M-q" #'org-fill-paragraph))
#+end_src #+end_src
#+caption[Setup =org-mode-map= 2]: #+caption[Setup =org-mode-map= 2]:
#+caption: Setup =org-mode-map= 2. #+caption: Setup =org-mode-map= 2.
#+name: lst:setup-org-mode-map-2 #+name: lst:setup-org-mode-map-2
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs ;; Stolen from `org-insert-structure-template'.
;; Stolen from `org-insert-structure-template'. ;; Note: `org-tempo' does not require `tempo' at all.
;; Note: `org-tempo' does not require `tempo' at all. (defcustom org-insert-source-block-defaults
(defcustom org-insert-source-block-defaults
'("calc -n :results silent" '("calc -n :results silent"
"emacs-lisp -n :results silent" "emacs-lisp -n :results silent"
"julia -n :results silent" "julia -n :results silent"
@ -2447,9 +2458,10 @@ When called twice, replace the previously inserted \\(\\) by one $."
"org -n" "org -n"
"python -i -n :results silent") "python -i -n :results silent")
"Default values for `org-insert-source-block'." "Default values for `org-insert-source-block'."
:group 'org) :group 'org
:type '(repeat string))
(defun org-insert-source-block () (defun org-insert-source-block ()
"Insert a source block #+begin_src/SPEC/BODY/#+end_src. "Insert a source block #+begin_src/SPEC/BODY/#+end_src.
Prompt for the source block SPEC. With an active region, the Prompt for the source block SPEC. With an active region, the
region becomes the block BODY. Otherwise, insert an empty block." region becomes the block BODY. Otherwise, insert an empty block."
@ -2477,7 +2489,7 @@ region becomes the block BODY. Otherwise, insert an empty block."
(insert "#+end_src") (insert "#+end_src")
(if (looking-at "[ \t]*$") (replace-match "") (insert "\n")) (if (looking-at "[ \t]*$") (replace-match "") (insert "\n"))
(when (and (eobp) (not (bolp))) (insert "\n"))) (when (and (eobp) (not (bolp))) (insert "\n")))
(end-of-line))))) (end-of-line))))
(with-eval-after-load 'org (with-eval-after-load 'org
(keymap-set org-mode-map "C-c C-;" #'org-insert-source-block)) (keymap-set org-mode-map "C-c C-;" #'org-insert-source-block))
@ -3433,17 +3445,11 @@ The listings below implement or reimplement three groups of =org-link= types:
#+caption: Define an =org-link= type for =pdf-tools=. #+caption: Define an =org-link= type for =pdf-tools=.
#+name: lst:define-org-pdfview-link-type #+name: lst:define-org-pdfview-link-type
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ol (declare-function pdf-view-current-page "pdf-macs" (&optional window))
(autoload 'pdf-view-goto-page (declare-function pdf-view-goto-page "pdf-view" (page &optional window))
"Go to PAGE in PDF with optional WINDOW to go to PAGE in all windows."
nil t)
(org-link-set-parameters "pdfview"
:follow #'org-pdfview-open
:export #'org-pdfview-export
:store #'org-pdfview-store-link)
(defun org-pdfview-export (link description backend _) (defun org-pdfview-export (link description backend _)
"Export a \"pdfview\" type link. "Export LINK as a \"pdfview\" type link using DESCRIPTION and export BACKEND.
The paths of the links export as file relative paths in order to The paths of the links export as file relative paths in order to
facilate moving single directories or whole directory trees." facilate moving single directories or whole directory trees."
(let ((path (if (string-match "\\(.+\\)::.+" link) (let ((path (if (string-match "\\(.+\\)::.+" link)
@ -3458,8 +3464,8 @@ facilate moving single directories or whole directory trees."
(`ascii (format "%s (%s)" desc path)) (`ascii (format "%s (%s)" desc path))
(_ path))))) (_ path)))))
(defun org-pdfview-open (link _) (defun org-pdfview-open (link _)
"Open a \"pdfview\" type link." "Open LINK as a \"pdfview\" type link."
(string-match "\\(.*?\\)\\(?:::\\([0-9]+\\)\\)?$" link) (string-match "\\(.*?\\)\\(?:::\\([0-9]+\\)\\)?$" link)
(let ((path (match-string 1 link)) (let ((path (match-string 1 link))
(page (and (match-beginning 2) (page (and (match-beginning 2)
@ -3468,7 +3474,7 @@ facilate moving single directories or whole directory trees."
(org-open-file path 1) (org-open-file path 1)
(when page (pdf-view-goto-page page)))) (when page (pdf-view-goto-page page))))
(defun org-pdfview-store-link () (defun org-pdfview-store-link ()
"Store a \"pdfview\" type link." "Store a \"pdfview\" type link."
(when (eq major-mode 'pdf-view-mode) (when (eq major-mode 'pdf-view-mode)
(let* ((path buffer-file-name) (let* ((path buffer-file-name)
@ -3477,13 +3483,22 @@ facilate moving single directories or whole directory trees."
(org-link-store-props (org-link-store-props
:type "pdfview" :type "pdfview"
:link link :link link
:description path))))) :description path))))
(with-eval-after-load 'ol
(org-link-set-parameters "pdfview"
:follow #'org-pdfview-open
:export #'org-pdfview-export
:store #'org-pdfview-store-link))
#+end_src #+end_src
#+caption[Patch =ol-info=]: #+caption[Patch =ol-info=]:
#+caption: Patch =ol-info=. #+caption: Patch =ol-info=.
#+name: lst:patch-org-info-link-type #+name: lst:patch-org-info-link-type
#+begin_src emacs-lisp -n :exports code :results silent #+begin_src emacs-lisp -n :exports code :results silent
(declare-function org-info-map-html-url "ol-info" (filename))
(declare-function org-info--expand-node-name "ol-info" (node))
(with-eval-after-load 'ol-info (with-eval-after-load 'ol-info
(defun org-info-export (path desc format) (defun org-info-export (path desc format)
"Export an info link. "Export an info link.
@ -3553,6 +3568,11 @@ The following posts provide programming information:
#+name: lst:define-org-yt-link-type #+name: lst:define-org-yt-link-type
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
;; https://bitspook.in/blog/extending-org-mode-to-handle-youtube-paths/ ;; https://bitspook.in/blog/extending-org-mode-to-handle-youtube-paths/
(declare-function emms-add-url "emms-source-file" (url))
(declare-function emms-playlist-last "emms" ())
(declare-function emms-playlist-mode-play-current-track "emms-playlist-mode" ())
(declare-function with-current-emms-playlist "emms" (&rest body))
(defun org-yt-emms-open (path) (defun org-yt-emms-open (path)
"Open an \"YouTube\" PATH link with `emms' using \"mpv\"." "Open an \"YouTube\" PATH link with `emms' using \"mpv\"."
(let ((url (format "https://www.youtube.com/watch?v=%s" path))) (let ((url (format "https://www.youtube.com/watch?v=%s" path)))
@ -4425,16 +4445,11 @@ it for this buffer is by typing {{{kbd(C-c C-e t U)}}} to export the it to a
(when (and (ensure-package-installation 'writegood-mode) (when (and (ensure-package-installation 'writegood-mode)
(fboundp 'writegood-mode)) (fboundp 'writegood-mode))
(defcustom writegood-mode-for '(org-mode text-mode)
"List of modes for which to enable `writegood-mode'."
:group 'writegood
:type '(repeat symbol))
(add-hook 'after-init-hook (add-hook 'after-init-hook
(defun on-after-change-mode-hook-enable-writegood-mode () (defun on-after-change-mode-hook-enable-writegood-mode ()
(add-hook 'after-change-major-mode-hook (add-hook 'after-change-major-mode-hook
(defun enable-writegood-mode () (defun enable-writegood-mode ()
(when (derived-mode-p writegood-mode-for) (when (derived-mode-p '(org-mode text-mode))
(writegood-mode +1))))) (writegood-mode +1)))))
'depth) 'depth)
@ -4462,8 +4477,8 @@ true in case document headlines contain links. The code in listing
(setopt which-func-modes (setopt which-func-modes
'(emacs-lisp-mode org-mode pdf-view-mode))) '(emacs-lisp-mode org-mode pdf-view-mode)))
;; It looks like `python-mode' does nothing when they it is an element ;; It looks like `python-mode' does nothing when it is an element of
;; of `which-func-modes'. ;; `which-func-modes'.
;; (setopt which-func-modes t) ;; (setopt which-func-modes t)
@ -4475,6 +4490,8 @@ true in case document headlines contain links. The code in listing
#+name: lst:define-for-which-func-functions #+name: lst:define-for-which-func-functions
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
;; https://emacs.stackexchange.com/questions/30894/ ;; https://emacs.stackexchange.com/questions/30894/
(declare-function pdf-info-outline "pdf-info" (&optional file-or-buffer))
(declare-function org-element-type-p "org-element-ast" (node types))
(defvar which-func-functions nil) (defvar which-func-functions nil)
(defun which-func-org-function () (defun which-func-org-function ()
@ -4496,7 +4513,6 @@ Return the document title when point is above the first headline."
(count (length chain))) (count (length chain)))
(setq text (format "%s|%s" count (nth (1- count) chain))))) (setq text (format "%s|%s" count (nth (1- count) chain)))))
text))) text)))
(add-to-list 'which-func-functions 'which-func-org-function) (add-to-list 'which-func-functions 'which-func-org-function)
(defun which-func-pdf-view-function () (defun which-func-pdf-view-function ()
@ -4519,7 +4535,6 @@ Return \"Front Matter\" when current page is above the first headline."
(setq new-title (alist-get 'title (nth hl-index outline))) (setq new-title (alist-get 'title (nth hl-index outline)))
(cl-incf hl-index)) (cl-incf hl-index))
(if (< current-page hl-page) old-title new-title)))) (if (< current-page hl-page) old-title new-title))))
(add-to-list 'which-func-functions 'which-func-pdf-view-function) (add-to-list 'which-func-functions 'which-func-pdf-view-function)
#+end_src #+end_src
@ -4617,6 +4632,7 @@ julia --project=eglot-jl-20240318.1159/ eglot-jl-20240318.1159/eglot-jl.jl
#+name: lst:eglot-maybe-ensure #+name: lst:eglot-maybe-ensure
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(defun eglot-maybe-ensure () (defun eglot-maybe-ensure ()
"Call `eglot-ensure' under favorable conditions."
(when (and (apply #'derived-mode-p '(python-mode)) (when (and (apply #'derived-mode-p '(python-mode))
(assoc 'eglot-workspace-configuration dir-local-variables-alist)) (assoc 'eglot-workspace-configuration dir-local-variables-alist))
(eglot-ensure))) (eglot-ensure)))
@ -6501,7 +6517,7 @@ setup and requires no configuration.
#+name: lst:configure-ws-butler #+name: lst:configure-ws-butler
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'ws-butler) (when (and (ensure-package-installation 'ws-butler)
(require 'ws-butler nil 'noerror)) (fboundp 'ws-butler-mode))
(setopt ws-butler-keep-whitespace-before-point nil) (setopt ws-butler-keep-whitespace-before-point nil)
(add-hook 'prog-mode-hook #'ws-butler-mode) (add-hook 'prog-mode-hook #'ws-butler-mode)
(add-hook 'text-mode-hook #'ws-butler-mode)) (add-hook 'text-mode-hook #'ws-butler-mode))
@ -6568,9 +6584,11 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][
("C-M-(" . sp-backward-barf-sexp) ("C-M-(" . sp-backward-barf-sexp)
("C-M-)" . sp-forward-barf-sexp))) ("C-M-)" . sp-forward-barf-sexp)))
(when (fboundp 'smartparens-mode)
(dolist (symbol '(conf-toml-mode-hook prog-mode-hook text-mode-hook)) (dolist (symbol '(conf-toml-mode-hook prog-mode-hook text-mode-hook))
(add-hook symbol #'smartparens-mode)) (add-hook symbol #'smartparens-mode)))
(when (fboundp 'smartparens-strict-mode)
(dolist (symbol '(emacs-lisp-mode-hook (dolist (symbol '(emacs-lisp-mode-hook
go-ts-mode-hook go-ts-mode-hook
ielm-mode-hook ielm-mode-hook
@ -6579,7 +6597,7 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][
lisp-mode-hook lisp-mode-hook
python-mode-hook python-mode-hook
sly-mrepl-mode-hook)) sly-mrepl-mode-hook))
(add-hook symbol #'smartparens-strict-mode)) (add-hook symbol #'smartparens-strict-mode)))
(when (fboundp 'go-ts-mode) (when (fboundp 'go-ts-mode)
;; Stolen from `smartparens-go': ;; Stolen from `smartparens-go':
@ -6672,11 +6690,12 @@ formatter for Python]].
(when (ensure-package-installation 'yasnippet) (when (ensure-package-installation 'yasnippet)
;; Set `yas-alias-to-yas/prefix-p' before loading `yasnippet'. ;; Set `yas-alias-to-yas/prefix-p' before loading `yasnippet'.
(setopt yas-alias-to-yas/prefix-p nil) (setopt yas-alias-to-yas/prefix-p nil)
(when (fboundp 'yas-minor-mode)
(dolist (symbol '(LaTeX-mode-hook (dolist (symbol '(LaTeX-mode-hook
org-mode-hook org-mode-hook
python-mode-hook python-mode-hook
python-ts-mode-hook)) python-ts-mode-hook))
(add-hook symbol #'yas-minor-mode))) (add-hook symbol #'yas-minor-mode))))
#+end_src #+end_src
* [[info:emacs#Display][Display (info)]] * [[info:emacs#Display][Display (info)]]
@ -6719,8 +6738,8 @@ applies first. Narrowing to org-src-block actually calls
With prefix P, don't widen, just narrow even if buffer is already With prefix P, don't widen, just narrow even if buffer is already
narrowed." narrowed."
(declare (interactive-only t))
(interactive "P") (interactive "P")
(declare (interactive-only))
(cond ((and (buffer-narrowed-p) (not p)) (cond ((and (buffer-narrowed-p) (not p))
(widen)) (widen))
((and (bound-and-true-p org-src-mode) (not p)) ((and (bound-and-true-p org-src-mode) (not p))