From d1c8f871bf5c52839d555ac03269891dced661a9 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Mon, 12 Feb 2024 10:58:34 +0800 Subject: 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. --- common.el | 36 +++++++++++++++++++++++++----------- 1 file 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 -- cgit v1.2.3-18-g5258