Compare commits

...

3 Commits

View File

@ -962,6 +962,31 @@ Listing [[lst:setup-shortdoc]] binds {{{kbd(C-h y)}}} to =shortdoc-display-group
(keymap-set help-map "y" #'shortdoc-display-group)) (keymap-set help-map "y" #'shortdoc-display-group))
#+end_src #+end_src
** [[info:emacs#Disabling][Disabling Commands (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:enable-disabled-commands
:END:
Execute src_emacs-lisp[:results none]{(find-library "novice")} to see how Emacs
prevents new users from shooting themselves in the feet. Listing
[[lst:configure-disabled-command-function]] enables [[https://www.emacswiki.org/emacs/DisabledCommands][disabled commands on the fly]].
#+caption[Configure the =disabled-command-function=]:
#+caption: Configure the =disabled-command-function=.
#+name: lst:configure-disabled-command-function
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(setq disabled-command-function
(defun enable-this-command (&rest _args)
"Called when executing a disabled command.
Enable it and re-execute it."
(put this-command 'disabled nil)
(message "You typed %s. Emacs enabled %s."
(key-description (this-command-keys)) this-command)
(sit-for 0)
(call-interactively this-command))))
#+end_src
** [[info:info#Top][Info (info)]] ** [[info:info#Top][Info (info)]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:info :CUSTOM_ID: sec:info
@ -995,47 +1020,29 @@ looks for files.
:CUSTOM_ID: sec:key-bindings :CUSTOM_ID: sec:key-bindings
:END: :END:
Table [[tab:basic-key-bindings]] lists basic key bindings. Enabling
=which-key-mode= is another way of associating key bindings with commands.
Execute src_emacs-lisp[:results none]{(find-library "which-key")} to check
whether this library is builtin. This setup does not enable =which-key-mode=
because of rare interference with for instance a process that the =compile=
command launches.
#+attr_latex: :booktabs yes :float table #+attr_latex: :booktabs yes :float table
#+caption[Basic key bindings]: #+caption[Basic key bindings]:
#+caption: Basic key bindings. #+caption: Basic key bindings.
#+name: tab:basic-key-bindings #+name: tab:basic-key-bindings
|--------------------+------------+------------------------| |----------------------+------------+------------------------|
| command | key map | keys | | command | key map | keys |
|--------------------+------------+------------------------| |----------------------+------------+------------------------|
| undo | global-map | {{{kbd(s-z)}}} | | *undo* | global-map | {{{kbd(s-z)}}} |
| backward-kill-word | global-map | {{{kbd(C-backspace)}}} | | *backward-kill-word* | global-map | {{{kbd(C-backspace)}}} |
| backward-char | global-map | {{{kbd(C-b)}}} | | **backward-char* | global-map | {{{kbd(C-b)}}} |
| forward-char | global-map | {{{kbd(C-f)}}} | | *forward-char* | global-map | {{{kbd(C-f)}}} |
| backward-word | global-map | {{{kbd(M-b)}}} | | *backward-word* | global-map | {{{kbd(M-b)}}} |
| forward-word | global-map | {{{kbd(M-f)}}} | | *forward-word* | global-map | {{{kbd(M-f)}}} |
| backward-sentence | global-map | {{{kbd(M-a)}}} | | *backward-sentence* | global-map | {{{kbd(M-a)}}} |
| forward-sentence | global-map | {{{kbd(M-e)}}} | | *forward-sentence* | global-map | {{{kbd(M-e)}}} |
|--------------------+------------+------------------------| |----------------------+------------+------------------------|
** [[info:emacs#Disabling][Disabling Commands (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:enable-disabled-commands
:END:
Execute src_emacs-lisp[:results none]{(find-library "novice")} to see how Emacs
prevents new users from shooting themselves in the feet. Listing
[[lst:configure-disabled-command-function]] enables [[https://www.emacswiki.org/emacs/DisabledCommands][disabled commands on the fly]].
#+caption[Configure the =disabled-command-function=]:
#+caption: Configure the =disabled-command-function=.
#+name: lst:configure-disabled-command-function
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(setq disabled-command-function
(defun enable-this-command (&rest _args)
"Called when executing a disabled command.
Enable it and re-execute it."
(put this-command 'disabled nil)
(message "You typed %s. Emacs enabled %s."
(key-description (this-command-keys)) this-command)
(sit-for 0)
(call-interactively this-command))))
#+end_src
** [[https://github.com/michael-heerdegen/interaction-log.el#readme][Interaction-log]] ** [[https://github.com/michael-heerdegen/interaction-log.el#readme][Interaction-log]]
:PROPERTIES: :PROPERTIES:
@ -1066,14 +1073,15 @@ Enable it and re-execute it."
:CUSTOM_ID: sec:keycast :CUSTOM_ID: sec:keycast
:END: :END:
Listing [[lst:configure-keycast]] configures =keycast=. Listing [[lst:setup-keycast]] sets up =keycast= so that =keycast-log-mode= uses a
buffer similar to what calling =ediff-setup-windows-plain= returns.
#+caption[Configure =keycast=]: #+caption[Setup =keycast=]:
#+caption: Configure =keycast=. #+caption: setup =keycast=.
#+name: lst:configure-keycast #+name: lst:setup-keycast
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
;; Make `keycast-log-update-buffer' use a buffer similar to the ;; Make `keycast-log-update-buffer' use a buffer similar to what
;; control buffer `ediff-setup-windows-plain' returns. ;; calling `ediff-setup-windows-plain' returns.
(when (ensure-package-installation 'keycast) (when (ensure-package-installation 'keycast)
(setopt keycast-log-newest-first t (setopt keycast-log-newest-first t
keycast-mode-line-window-predicate #'keycast-bottom-right-window-p) keycast-mode-line-window-predicate #'keycast-bottom-right-window-p)