From 20f73b0beebc71466b7be0dea537ab05e8f7be5c Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 26 Dec 2021 14:47:32 +0800 Subject: Use defalias rather than fset * common.el (durand-display-in-one-window) (durand-completion-scroll-up-or-go-to-minibuffer) (intentionally-disabled-bind): * completion-conf.el (durand-completion-toggle-display): * eww-conf.el (global-map): defalias has the advantage that one can find the file of the definition from the help buffer while fset cannot. --- common.el | 46 +++++++++++++++++++++++----------------------- completion-conf.el | 34 +++++++++++++++++----------------- eww-conf.el | 2 +- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/common.el b/common.el index 0b3df31..35e16f2 100644 --- a/common.el +++ b/common.el @@ -159,14 +159,14 @@ ARG means do this command ARG times." ;; This can be optimized by not duplicating an element on the stack. ;;;###autoload -(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. +(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. @@ -209,15 +209,15 @@ the window to the function with max-height equal to ;; This short function is a suitable function for byte codes. ;;;###autoload -(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. +(defalias '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." - "p")) + "p")) ;; (defun durand-completion-scroll-up-or-go-to-minibuffer (&optional arg) ;; "Scroll up; if this is not feasible, go to the mini-buffer. @@ -298,13 +298,13 @@ mark at the end for the first yank." ;; Using byte-code is fun. ;;;###autoload -(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)) +(defalias '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." diff --git a/completion-conf.el b/completion-conf.el index e4190d3..1ed310a 100644 --- a/completion-conf.el +++ b/completion-conf.el @@ -131,25 +131,25 @@ minibuffer as usual." ;; nil)) ;;;###autoload -(fset - 'durand-completion-toggle-display - (make-byte-code - 0 - (unibyte-string 192 9 62 ; determine if it is a member - 131 14 0 - ;; memq - 194 193 192 196 35 130 20 0 - ;; not memq - 195 193 192 197 196 36 - 135) - (vector #'durand-completion-display-after-change - 'after-change-functions - 'remove-hook 'add-hook t nil) - 6 - "Toggle to display the list of completions after each input. +(defalias + 'durand-completion-toggle-display + (make-byte-code + 0 + (unibyte-string 192 9 62 ; determine if it is a member + 131 14 0 + ;; memq + 194 193 192 196 35 130 20 0 + ;; not memq + 195 193 192 197 196 36 + 135) + (vector #'durand-completion-display-after-change + 'after-change-functions + 'remove-hook 'add-hook t nil) + 6 + "Toggle to display the list of completions after each input. \(fn)" - nil)) + nil)) ;; (defun durand-completion-toggle-display () ;; "Toggle to display the list of completions after each input." diff --git a/eww-conf.el b/eww-conf.el index 23619e4..284f2b7 100644 --- a/eww-conf.el +++ b/eww-conf.el @@ -46,7 +46,7 @@ If ARG is nil, open in EWW. Otherwise, open in an external browser." ;; key-bindings -(define-key global-map (vector ?\s-w) #'durand-eww-map) +(define-key global-map (vector ?\s-w) 'durand-eww-map) ;;;###autoload (fset 'durand-eww-map -- cgit v1.2.3-18-g5258