summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Gratz <Stromeko@Stromeko.DE>2012-12-20 10:18:02 +0100
committerAchim Gratz <Stromeko@Stromeko.DE>2012-12-20 12:57:52 +0100
commitb508943d329fed2af457c50afd5f63938b23c58c (patch)
tree78418e687895260610754234ca28e06e9325f8c3
parentdfa3c74e34ee115dcb6095f88db86b144ae7b70b (diff)
downloadorg-mode-b508943d329fed2af457c50afd5f63938b23c58c.tar.gz
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.
-rw-r--r--lisp/org-compat.el10
-rw-r--r--lisp/org.el86
2 files changed, 51 insertions, 45 deletions
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 1f330b1..022f85e 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -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)
diff --git a/lisp/org.el b/lisp/org.el
index 32b333f..d351323 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6840,48 +6840,45 @@ 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."
- (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))
- (save-excursion
- (save-window-excursion
- (delete-other-windows)
- (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
- (org-pop-to-buffer-same-window
- (condition-case nil
- (make-indirect-buffer (current-buffer) "*org-goto*")
- (error (make-indirect-buffer (current-buffer) "*org-goto*"))))
- (with-output-to-temp-buffer "*Help*"
- (princ help))
- (org-fit-window-to-buffer (get-buffer-window "*Help*"))
- (setq buffer-read-only nil)
- (let ((org-startup-truncated t)
- (org-startup-folded nil)
- (org-startup-align-all-tables nil))
- (org-mode)
- (org-overview))
- (setq buffer-read-only t)
- (if (and (boundp 'org-goto-start-pos)
- (integer-or-marker-p org-goto-start-pos))
- (let ((org-show-hierarchy-above t)
- (org-show-siblings t)
- (org-show-following-heading t))
- (goto-char org-goto-start-pos)
- (and (outline-invisible-p) (org-show-context)))
- (goto-char (point-min)))
- (let (org-special-ctrl-a/e) (org-beginning-of-line))
- (message "Select location and press RET")
- (use-local-map org-goto-map)
- (recursive-edit)
- ))
- (kill-buffer "*org-goto*")
- (cons org-goto-selected-point org-goto-exit-command)))
+ (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))
+ (save-excursion
+ (save-window-excursion
+ (delete-other-windows)
+ (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
+ (org-pop-to-buffer-same-window
+ (condition-case nil
+ (make-indirect-buffer (current-buffer) "*org-goto*")
+ (error (make-indirect-buffer (current-buffer) "*org-goto*"))))
+ (with-output-to-temp-buffer "*Help*"
+ (princ help))
+ (org-fit-window-to-buffer (get-buffer-window "*Help*"))
+ (setq buffer-read-only nil)
+ (let ((org-startup-truncated t)
+ (org-startup-folded nil)
+ (org-startup-align-all-tables nil))
+ (org-mode)
+ (org-overview))
+ (setq buffer-read-only t)
+ (if (and (boundp 'org-goto-start-pos)
+ (integer-or-marker-p org-goto-start-pos))
+ (let ((org-show-hierarchy-above t)
+ (org-show-siblings t)
+ (org-show-following-heading t))
+ (goto-char org-goto-start-pos)
+ (and (outline-invisible-p) (org-show-context)))
+ (goto-char (point-min)))
+ (let (org-special-ctrl-a/e) (org-beginning-of-line))
+ (message "Select location and press RET")
+ (use-local-map org-goto-map)
+ (recursive-edit)
+ ))
+ (kill-buffer "*org-goto*")
+ (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,9 +20598,8 @@ 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)
- (apply 'switch-to-buffer-other-window args)))
+ (org-no-popups
+ (apply 'switch-to-buffer-other-window args)))
(defun org-combine-plists (&rest plists)
"Create a single property list from all plists in PLISTS.