Add `org-ctags-disable' function to undo calling `org-ctags-enable'

This commit is contained in:
Gerard Vermeulen 2024-02-03 14:20:11 +01:00
parent f940a92572
commit afa5e0470c
1 changed files with 27 additions and 15 deletions

View File

@ -181,9 +181,6 @@ Try to load [[https://github.com/emacscollective/no-littering][no-littering]] as
(require 'no-littering nil 'noerror)
;; Else: Add `(tags-file-name nil)' to outermost `let*' in `org-return'.
(setq org-modules nil)
(provide 'early-init)
;; Emacs looks for "Local variables:" after the last "?\n?\f".
@ -2283,8 +2280,8 @@ of the [[info:org#Top][Org (info)]] manual.
I have split the initial [[https://orgmode.org/][Org-mode]] setup over several listings. Here, follows a
list detailing and motivating each listing:
1. Listing [[lst:set-org-options]] handles basic [[https://orgmode.org/][Org-mode]] options.
2. Listing [[lst:kill-org-ctags]] tries to disable ~org-ctags~ functionality without
side-effects.
2. Listing [[lst:undo-org-ctags]] undoes ~org-ctags~. See [[https://list.orgmode.org/87mt43agk6.fsf@localhost/][org-ctags land grab]] for
more information.
3. Listing [[lst:setup-org-babel]] sets ~ob-core~, ~ob-latex~, and ~ob-lisp~ options.
See [[info:org#Working with Source Code][working with source code (info)]] for Org Babel information.
4. Listing [[lst:fake-org-babel-functions]] adds =org-babel-execute:<LANGUAGE>=
@ -2350,9 +2347,6 @@ list detailing and motivating each listing:
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.pdf\\'" . emacs))
;; Up to here `org-modules' is nil thanks to my `early-init.el'.
;; If not `org-ctags' gets loaded, which does not work on my system
;; and confuses `org-return'.
org-modules '(ol-bibtex
ol-doi
ol-eww
@ -2363,15 +2357,33 @@ list detailing and motivating each listing:
org-use-property-inheritance t))
#+end_src
#+caption[Kill =org-ctags=]:
#+caption: Kill =org-ctags=.
#+name: lst:kill-org-ctags
#+caption[Undo calling =org-ctags-enable= ]:
#+caption: Undo calling =org-ctags-enable=.
#+name: lst:undo-org-ctags
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'org-ctags
;; This is not enough, since `org-execute-file-search-in-bibtex'
;; may be a member of `org-execute-file-search-function'.
;; Does this trigger `org-ctags'? Why? How to fix this?
(setq org-execute-file-search-functions nil))
;; See also `org-link-search-must-match-exact-headline' for link searches.
;; Undo calling `org-ctags-enable'. For what may cause `org-ctags'
;; loading, see: https://list.orgmode.org/87mt43agk6.fsf@localhost/
(defun org-ctags-disable ()
"Undo calling `org-ctags-enable'."
(put 'org-mode 'find-tag-default-function nil)
(setq org-ctags-enabled-p nil)
;; Use the `:options' list from the `org-ctags-open-link-functions' code.
(let ((options '(org-ctags-find-tag
org-ctags-ask-rebuild-tags-file-then-find-tag
org-ctags-rebuild-tags-file-then-find-tag
org-ctags-ask-append-topic
org-ctags-append-topic
org-ctags-ask-visit-buffer-or-file
org-ctags-visit-buffer-or-file
org-ctags-fail-silently))
(fns org-open-link-functions))
(dolist (fn options)
(setq fns (delq fn fns)))
;; Reset `org-open-link-functions' after removal of prepended functions.
(setq org-open-link-functions fns)))
(org-ctags-disable))
#+end_src
#+caption[Set =org-babel= options]: