From afa5e0470c4346dbc8609de5ed51440ffb09ef36 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Sat, 3 Feb 2024 14:20:11 +0100 Subject: [PATCH] Add `org-ctags-disable' function to undo calling `org-ctags-enable' --- README.org | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/README.org b/README.org index 8a5634f..f9944a3 100644 --- a/README.org +++ b/README.org @@ -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:= @@ -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]: