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:
Achim Gratz 2012-12-20 10:18:02 +01:00
parent dfa3c74e34
commit b508943d32
2 changed files with 51 additions and 45 deletions

View File

@ -375,6 +375,16 @@ TIME defaults to the current time."
(unless (fboundp 'user-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)
(defalias 'org-string-match-p 'string-match-p)
(defun org-string-match-p (regexp string &optional start)

View File

@ -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.
This function uses a recursive edit. It returns the selected position
or nil."
(org-no-popups
(let ((isearch-mode-map org-goto-local-auto-isearch-map)
(isearch-hide-immediately nil)
(isearch-search-fun-function
(lambda () 'org-goto-local-search-headings))
(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))
(org-goto-selected-point org-goto-exit-command))
(save-excursion
(save-window-excursion
(delete-other-windows)
@ -6881,7 +6878,7 @@ or nil."
(recursive-edit)
))
(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))
(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.
In particular, do not allow pop-up frames.
Returns the newly created buffer."
(let (pop-up-frames special-display-buffer-names special-display-regexps
special-display-function)
(org-no-popups
(apply 'switch-to-buffer-other-window args)))
(defun org-combine-plists (&rest plists)