org-compat: new macro org-no-popups
* lisp/org-compat.el (org-no-popups): New wrapper macro which let-binds the correct variables to suppress popup windows depending on the Emacs version in use. This is a compile-time decision when byte-compiling. * lisp/org.el (org-get-location, org-switch-to-buffer-other-window): Use the wrapper `org-no-popups´ to let-bind the correct variables for suppression of popup windows.
This commit is contained in:
parent
dfa3c74e34
commit
b508943d32
|
@ -375,6 +375,16 @@ TIME defaults to the current time."
|
||||||
(unless (fboundp 'user-error)
|
(unless (fboundp 'user-error)
|
||||||
(defalias 'user-error 'error))
|
(defalias 'user-error 'error))
|
||||||
|
|
||||||
|
(defmacro org-no-popups (&rest body)
|
||||||
|
"Suppress popup windows.
|
||||||
|
Let-bind some variables to nil around BODY to achieve the desired
|
||||||
|
effect, which variables to use depends on the Emacs version."
|
||||||
|
(if (org-version-check "24.2.50" "" :predicate)
|
||||||
|
`(let (pop-up-frames display-buffer-alist)
|
||||||
|
,@body)
|
||||||
|
`(let (pop-up-frames special-display-buffer-names special-display-regexps special-display-function)
|
||||||
|
,@body)))
|
||||||
|
|
||||||
(if (fboundp 'string-match-p)
|
(if (fboundp 'string-match-p)
|
||||||
(defalias 'org-string-match-p 'string-match-p)
|
(defalias 'org-string-match-p 'string-match-p)
|
||||||
(defun org-string-match-p (regexp string &optional start)
|
(defun org-string-match-p (regexp string &optional start)
|
||||||
|
|
12
lisp/org.el
12
lisp/org.el
|
@ -6840,15 +6840,12 @@ With a prefix argument, use the alternative interface: e.g. if
|
||||||
"Let the user select a location in the Org-mode buffer BUF.
|
"Let the user select a location in the Org-mode buffer BUF.
|
||||||
This function uses a recursive edit. It returns the selected position
|
This function uses a recursive edit. It returns the selected position
|
||||||
or nil."
|
or nil."
|
||||||
|
(org-no-popups
|
||||||
(let ((isearch-mode-map org-goto-local-auto-isearch-map)
|
(let ((isearch-mode-map org-goto-local-auto-isearch-map)
|
||||||
(isearch-hide-immediately nil)
|
(isearch-hide-immediately nil)
|
||||||
(isearch-search-fun-function
|
(isearch-search-fun-function
|
||||||
(lambda () 'org-goto-local-search-headings))
|
(lambda () 'org-goto-local-search-headings))
|
||||||
(org-goto-selected-point org-goto-exit-command)
|
(org-goto-selected-point org-goto-exit-command))
|
||||||
(pop-up-frames nil)
|
|
||||||
(special-display-buffer-names nil)
|
|
||||||
(special-display-regexps nil)
|
|
||||||
(special-display-function nil))
|
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-window-excursion
|
(save-window-excursion
|
||||||
(delete-other-windows)
|
(delete-other-windows)
|
||||||
|
@ -6881,7 +6878,7 @@ or nil."
|
||||||
(recursive-edit)
|
(recursive-edit)
|
||||||
))
|
))
|
||||||
(kill-buffer "*org-goto*")
|
(kill-buffer "*org-goto*")
|
||||||
(cons org-goto-selected-point org-goto-exit-command)))
|
(cons org-goto-selected-point org-goto-exit-command))))
|
||||||
|
|
||||||
(defvar org-goto-local-auto-isearch-map (make-sparse-keymap))
|
(defvar org-goto-local-auto-isearch-map (make-sparse-keymap))
|
||||||
(set-keymap-parent org-goto-local-auto-isearch-map isearch-mode-map)
|
(set-keymap-parent org-goto-local-auto-isearch-map isearch-mode-map)
|
||||||
|
@ -20601,8 +20598,7 @@ return nil."
|
||||||
"Switch to buffer in a second window on the current frame.
|
"Switch to buffer in a second window on the current frame.
|
||||||
In particular, do not allow pop-up frames.
|
In particular, do not allow pop-up frames.
|
||||||
Returns the newly created buffer."
|
Returns the newly created buffer."
|
||||||
(let (pop-up-frames special-display-buffer-names special-display-regexps
|
(org-no-popups
|
||||||
special-display-function)
|
|
||||||
(apply 'switch-to-buffer-other-window args)))
|
(apply 'switch-to-buffer-other-window args)))
|
||||||
|
|
||||||
(defun org-combine-plists (&rest plists)
|
(defun org-combine-plists (&rest plists)
|
||||||
|
|
Loading…
Reference in New Issue