summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2024-02-12 10:58:34 +0800
committerJSDurand <mmemmew@gmail.com>2024-02-12 10:58:34 +0800
commitd1c8f871bf5c52839d555ac03269891dced661a9 (patch)
tree8efffc8156cebd8389b6f24d5ebfd5f3b4ace233
parent09e511ee73a65ee9fcfca32c4ecdc6ec91da123c (diff)
common: Avoid manual byte codes
* common.el (durand-display-in-one-window): I defined the function by use of manual byte codes, which is not a good idea: Emacs can very well change the meanings of the byte codes without announcements, and then I would have to change the code anyways.
-rw-r--r--common.el36
1 files changed, 25 insertions, 11 deletions
diff --git a/common.el b/common.el
index 550f16c..95ac933 100644
--- a/common.el
+++ b/common.el
@@ -192,23 +192,37 @@ ARG means do this command ARG times."
;; This can be optimized by not duplicating an element on the stack.
-;;;###autoload
-(defalias 'durand-display-in-one-window
- (make-byte-code
- #x202
- (unibyte-string 192 193 194 32 33 33 195 1 4 34 136 196 1 33 136 197 32 136 135)
- (vector 'split-window 'frame-root-window 'selected-frame
- 'set-window-buffer 'select-window 'delete-other-windows)
- 9
- "Display BUFFER in one window.
+(defun durand-display-in-one-window (buffer _alist)
+ "Display BUFFER in one window.
ALIST is an association list of action symbols and values. See
Info node `(elisp) Buffer Display Action Alists' for details of
-such alists.
+such alists.
This function pops up a new window and then deletes all other
windows. And ALIST is completely ignored.
-\(fn BUFFER ALIST)"))
+\(fn BUFFER ALIST)"
+ (let ((window (split-window (frame-root-window (selected-frame)))))
+ (set-window-buffer window buffer)
+ (select-window window)
+ (delete-other-windows window)))
+
+;; (defalias 'durand-display-in-one-window
+;; (make-byte-code
+;; #x202
+;; (unibyte-string 192 193 194 32 33 33 195 1 4 34 136 196 1 33 136 197 32 136 135)
+;; (vector 'split-window 'frame-root-window 'selected-frame
+;; 'set-window-buffer 'select-window 'delete-other-windows)
+;; 9
+;; "Display BUFFER in one window.
+;; ALIST is an association list of action symbols and values. See
+;; Info node `(elisp) Buffer Display Action Alists' for details of
+;; such alists.
+
+;; This function pops up a new window and then deletes all other
+;; windows. And ALIST is completely ignored.
+
+;; \(fn BUFFER ALIST)"))
;;;###autoload
(defvar durand-window-max-height 0.3