GNU bug report logs -
#17809
24.4.50; Completions display
Previous Next
Reported by: Juri Linkov <juri <at> jurta.org>
Date: Thu, 19 Jun 2014 07:12:03 UTC
Severity: wishlist
Tags: patch
Merged with 12618
Found in version 24.2.50
Fixed in version 24.4.50
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> That looks right, except it means that `quit-function' is
> evaluated before `buffer-or-name', which is contrary to the expectation
> that arguments are usually evaluated left-to-right.
I believe all your concerns are addressed in this patch
unless I have more misunderstandings.
=== modified file 'lisp/window.el'
--- lisp/window.el 2014-06-18 07:57:27 +0000
+++ lisp/window.el 2014-07-07 06:49:07 +0000
@@ -185,16 +185,19 @@ (defmacro with-temp-buffer-window (buffe
(let ((buffer (make-symbol "buffer"))
(window (make-symbol "window"))
(value (make-symbol "value")))
- `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name))
+ (macroexp-let2 nil vbuffer-or-name buffer-or-name
+ (macroexp-let2 nil vaction action
+ (macroexp-let2 nil vquit-function quit-function
+ `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
(standard-output ,buffer)
,window ,value)
(setq ,value (progn ,@body))
(with-current-buffer ,buffer
- (setq ,window (temp-buffer-window-show ,buffer ,action)))
+ (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
- (if (functionp ,quit-function)
- (funcall ,quit-function ,window ,value)
- ,value))))
+ (if (functionp ,vquit-function)
+ (funcall ,vquit-function ,window ,value)
+ ,value)))))))
(defmacro with-current-buffer-window (buffer-or-name action quit-function &rest body)
"Evaluate BODY with a buffer BUFFER-OR-NAME current and show that buffer.
@@ -205,16 +208,51 @@ (defmacro with-current-buffer-window (bu
(let ((buffer (make-symbol "buffer"))
(window (make-symbol "window"))
(value (make-symbol "value")))
- `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name))
+ (macroexp-let2 nil vbuffer-or-name buffer-or-name
+ (macroexp-let2 nil vaction action
+ (macroexp-let2 nil vquit-function quit-function
+ `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
(standard-output ,buffer)
,window ,value)
(with-current-buffer ,buffer
(setq ,value (progn ,@body))
- (setq ,window (temp-buffer-window-show ,buffer ,action)))
+ (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
- (if (functionp ,quit-function)
- (funcall ,quit-function ,window ,value)
- ,value))))
+ (if (functionp ,vquit-function)
+ (funcall ,vquit-function ,window ,value)
+ ,value)))))))
+
+(defmacro with-displayed-buffer-window (buffer-or-name action quit-function &rest body)
+ "Show a buffer BUFFER-OR-NAME and evaluate BODY in that buffer.
+This construct is like `with-current-buffer-window' but unlike that
+displays the buffer specified by BUFFER-OR-NAME before running BODY."
+ (declare (debug t))
+ (let ((buffer (make-symbol "buffer"))
+ (window (make-symbol "window"))
+ (value (make-symbol "value")))
+ (macroexp-let2 nil vbuffer-or-name buffer-or-name
+ (macroexp-let2 nil vaction action
+ (macroexp-let2 nil vquit-function quit-function
+ `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
+ (standard-output ,buffer)
+ ,window ,value)
+ (with-current-buffer ,buffer
+ (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
+
+ (let ((inhibit-read-only t)
+ (inhibit-modification-hooks t))
+ (setq ,value (progn ,@body)))
+
+ (with-selected-window ,window
+ (goto-char (point-min)))
+
+ (when (functionp (cdr (assq 'window-height (cdr ,vaction))))
+ (ignore-errors
+ (funcall (cdr (assq 'window-height (cdr ,vaction))) ,window)))
+
+ (if (functionp ,vquit-function)
+ (funcall ,vquit-function ,window ,value)
+ ,value)))))))
;; The following two functions are like `window-next-sibling' and
;; `window-prev-sibling' but the WINDOW argument is _not_ optional (so
This bug report was last modified 10 years and 229 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.