diff options
author | JSDurand <mmemmew@gmail.com> | 2021-03-16 13:37:27 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-03-16 13:37:27 +0800 |
commit | 41b25d2c2b622f8559436f59690c9bbf56c00613 (patch) | |
tree | 89ac48f9379f61b1187063a4892f1fa725b54e01 | |
parent | 577a13180a8bff2ad53066fa8b148212add35d21 (diff) |
Byte-compiling two functions
* common.el (durand-display-in-one-window):
(durand-completion-scroll-up-or-go-to-minibuffer):
(intentionally-disabled-bind): Byte-compiling these functions.
-rw-r--r-- | common.el | 76 |
1 files changed, 59 insertions, 17 deletions
@@ -131,27 +131,58 @@ ARG means do this command ARG times." ((< arg 0) (goto-char (point-max)))))))) +;; This can be optimized by not duplicating an element on the stack. + ;;;###autoload -(defun durand-display-in-one-window (buffer _alist) - "Display BUFFER in one window. +(fset '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." - (let ((window (split-window (frame-root-window (selected-frame))))) - (set-window-buffer window buffer) - (select-window window) - (delete-other-windows) - window)) +windows. And ALIST is completely ignored. + +\(fn BUFFER ALIST)")) + +;; (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. + +;; This function pops up a new window and then deletes all other +;; windows. And ALIST is completely ignored." +;; (let ((window (split-window (frame-root-window (selected-frame))))) +;; (set-window-buffer window buffer) +;; (select-window window) +;; (delete-other-windows) +;; window)) + +;; This short function is a suitable function for byte codes. ;;;###autoload -(defun durand-completion-scroll-up-or-go-to-minibuffer (&optional arg) - "Scroll up; if this is not feasible, go to the mini-buffer. +(fset 'durand-completion-scroll-up-or-go-to-minibuffer + (make-byte-code + #x100 + (unibyte-string 137 132 7 0 192 178 1 193 1 91 33 135) + (vector 1 #'durand-completion-scroll-down-or-go-to-minibuffer) + 5 + "Scroll up; if this is not feasible, go to the mini-buffer. ARG means do this command ARG times." - (interactive "p") - (durand-completion-scroll-down-or-go-to-minibuffer (- arg))) + "p")) + +;; (defun durand-completion-scroll-up-or-go-to-minibuffer (&optional arg) +;; "Scroll up; if this is not feasible, go to the mini-buffer. +;; ARG means do this command ARG times." +;; (interactive "p") +;; (durand-completion-scroll-down-or-go-to-minibuffer (- arg))) ;;; Use completion to select text that was killed before. @@ -223,12 +254,23 @@ mark at the end for the first yank." ;;; Intentionally disable some key-bindings. +;; Using byte-code is fun. + ;;;###autoload -(defun intentionally-disabled-bind () - "Warn the user that this key-binding is intentionally disabled." - (interactive) - (user-error "You pressed an intentionally disabled key-binding: %s" - (key-description (this-command-keys-vector)))) +(fset 'intentionally-disabled-bind + (make-byte-code + 0 (unibyte-string 194 195 193 192 32 33 34 135) + (vector 'this-command-keys-vector 'key-description 'user-error + "You pressend an intentionally disabled key-binding: %s") + 4 "Warn the user that this key-binding is intentionally disabled." + nil)) + +;; (defun intentionally-disabled-bind (arg) +;; "Warn the user that this key-binding is intentionally disabled." +;; (interactive) +;; (user-error "You pressed an intentionally disabled key-binding: %s, %s" +;; (key-description (this-command-keys-vector)) +;; arg)) ;;; Hide some minor mode from the mode line display. |