Backport commit 99483e214 from Emacs
Set org-macro-templates more lazily 99483e214fdafa76e8001c7009dff13a76c33f32 Stefan Monnier Sun Mar 3 16:57:56 2024 -0500
This commit is contained in:
parent
338ff105c5
commit
fb4d2b96dc
|
@ -78,12 +78,14 @@
|
||||||
|
|
||||||
;;; Variables
|
;;; Variables
|
||||||
|
|
||||||
(defvar-local org-macro-templates nil
|
(defvar-local org-macro-templates t
|
||||||
"Alist containing all macro templates in current buffer.
|
"Alist containing all macro templates in current buffer.
|
||||||
Associations are in the shape of (NAME . TEMPLATE) where NAME
|
Associations are in the shape of (NAME . TEMPLATE) where NAME
|
||||||
stands for macro's name and template for its replacement value,
|
stands for macro's name and template for its replacement value,
|
||||||
both as strings. This is an internal variable. Do not set it
|
both as strings.
|
||||||
directly, use instead:
|
`t' means that it has not yet been initialized.
|
||||||
|
|
||||||
|
This is an internal variable. Do not set it directly, use instead:
|
||||||
|
|
||||||
#+MACRO: name template")
|
#+MACRO: name template")
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,8 @@ Version mismatch is commonly encountered in the following situations:
|
||||||
|
|
||||||
;; Use `with-silent-modifications' to ignore cosmetic changes and
|
;; Use `with-silent-modifications' to ignore cosmetic changes and
|
||||||
;; `org-unmodified' to ignore real text modifications.
|
;; `org-unmodified' to ignore real text modifications.
|
||||||
|
;; FIXME: Won't "real text modifications" break the undo data if
|
||||||
|
;; `buffer-undo-list' is let-bound to t?
|
||||||
(defmacro org-unmodified (&rest body)
|
(defmacro org-unmodified (&rest body)
|
||||||
"Run BODY while preserving the buffer's `buffer-modified-p' state."
|
"Run BODY while preserving the buffer's `buffer-modified-p' state."
|
||||||
(declare (debug (body)))
|
(declare (debug (body)))
|
||||||
|
@ -141,7 +143,7 @@ Version mismatch is commonly encountered in the following situations:
|
||||||
(let ((buffer-undo-list t)
|
(let ((buffer-undo-list t)
|
||||||
(inhibit-modification-hooks t))
|
(inhibit-modification-hooks t))
|
||||||
,@body)
|
,@body)
|
||||||
(set-buffer-modified-p ,was-modified)))))
|
(restore-buffer-modified-p ,was-modified)))))
|
||||||
|
|
||||||
(defmacro org-with-base-buffer (buffer &rest body)
|
(defmacro org-with-base-buffer (buffer &rest body)
|
||||||
"Run BODY in base buffer for BUFFER.
|
"Run BODY in base buffer for BUFFER.
|
||||||
|
|
21
lisp/org.el
21
lisp/org.el
|
@ -716,8 +716,9 @@ defined in org-duration.el.")
|
||||||
"Load all extensions listed in `org-modules'."
|
"Load all extensions listed in `org-modules'."
|
||||||
(when (or force (not org-modules-loaded))
|
(when (or force (not org-modules-loaded))
|
||||||
(dolist (ext org-modules)
|
(dolist (ext org-modules)
|
||||||
(condition-case nil (require ext)
|
(condition-case err (require ext)
|
||||||
(error (message "Problems while trying to load feature `%s'" ext))))
|
(error (message "Problems while trying to load feature `%s':\n%S"
|
||||||
|
ext err))))
|
||||||
(setq org-modules-loaded t)))
|
(setq org-modules-loaded t)))
|
||||||
|
|
||||||
(defun org-set-modules (var value)
|
(defun org-set-modules (var value)
|
||||||
|
@ -855,7 +856,7 @@ depends on, if any."
|
||||||
:group 'org-export
|
:group 'org-export
|
||||||
:version "26.1"
|
:version "26.1"
|
||||||
:package-version '(Org . "9.0")
|
:package-version '(Org . "9.0")
|
||||||
:initialize 'custom-initialize-set
|
:initialize #'custom-initialize-set
|
||||||
:set (lambda (var val)
|
:set (lambda (var val)
|
||||||
(if (not (featurep 'ox)) (set-default-toplevel-value var val)
|
(if (not (featurep 'ox)) (set-default-toplevel-value var val)
|
||||||
;; Any back-end not required anymore (not present in VAL and not
|
;; Any back-end not required anymore (not present in VAL and not
|
||||||
|
@ -905,9 +906,9 @@ depends on, if any."
|
||||||
|
|
||||||
(eval-after-load 'ox
|
(eval-after-load 'ox
|
||||||
'(dolist (backend org-export-backends)
|
'(dolist (backend org-export-backends)
|
||||||
(condition-case nil (require (intern (format "ox-%s" backend)))
|
(condition-case err (require (intern (format "ox-%s" backend)))
|
||||||
(error (message "Problems while trying to load export back-end `%s'"
|
(error (message "Problems while trying to load export back-end `%s':\n%S"
|
||||||
backend)))))
|
backend err)))))
|
||||||
|
|
||||||
(defcustom org-support-shift-select nil
|
(defcustom org-support-shift-select nil
|
||||||
"Non-nil means make shift-cursor commands select text when possible.
|
"Non-nil means make shift-cursor commands select text when possible.
|
||||||
|
@ -4772,7 +4773,7 @@ This is for getting out of special buffers like capture.")
|
||||||
(require 'org-pcomplete)
|
(require 'org-pcomplete)
|
||||||
(require 'org-src)
|
(require 'org-src)
|
||||||
(require 'org-footnote)
|
(require 'org-footnote)
|
||||||
(require 'org-macro)
|
;; (require 'org-macro)
|
||||||
|
|
||||||
;; babel
|
;; babel
|
||||||
(require 'ob)
|
(require 'ob)
|
||||||
|
@ -4852,8 +4853,6 @@ The following commands are available:
|
||||||
(when (and org-element-cache-persistent
|
(when (and org-element-cache-persistent
|
||||||
org-element-use-cache)
|
org-element-use-cache)
|
||||||
(org-persist-load 'org-element--cache (current-buffer) t))
|
(org-persist-load 'org-element--cache (current-buffer) t))
|
||||||
;; Initialize macros templates.
|
|
||||||
(org-macro-initialize-templates)
|
|
||||||
;; Initialize radio targets.
|
;; Initialize radio targets.
|
||||||
(org-update-radio-target-regexp)
|
(org-update-radio-target-regexp)
|
||||||
;; Indentation.
|
;; Indentation.
|
||||||
|
@ -10459,7 +10458,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
|
||||||
org-log-note-this-command this-command
|
org-log-note-this-command this-command
|
||||||
org-log-note-recursion-depth (recursion-depth)
|
org-log-note-recursion-depth (recursion-depth)
|
||||||
org-log-setup t)
|
org-log-setup t)
|
||||||
(add-hook 'post-command-hook 'org-add-log-note 'append))
|
(add-hook 'post-command-hook #'org-add-log-note 'append))
|
||||||
|
|
||||||
(defun org-skip-over-state-notes ()
|
(defun org-skip-over-state-notes ()
|
||||||
"Skip past the list of State notes in an entry."
|
"Skip past the list of State notes in an entry."
|
||||||
|
@ -10488,7 +10487,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
|
||||||
"Pop up a window for taking a note, and add this note later."
|
"Pop up a window for taking a note, and add this note later."
|
||||||
(when (and (equal org-log-note-this-command this-command)
|
(when (and (equal org-log-note-this-command this-command)
|
||||||
(= org-log-note-recursion-depth (recursion-depth)))
|
(= org-log-note-recursion-depth (recursion-depth)))
|
||||||
(remove-hook 'post-command-hook 'org-add-log-note)
|
(remove-hook 'post-command-hook #'org-add-log-note)
|
||||||
(setq org-log-setup nil)
|
(setq org-log-setup nil)
|
||||||
(setq org-log-note-window-configuration (current-window-configuration))
|
(setq org-log-note-window-configuration (current-window-configuration))
|
||||||
(delete-other-windows)
|
(delete-other-windows)
|
||||||
|
|
Loading…
Reference in New Issue