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))
#+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)]]
:PROPERTIES:
:CUSTOM_ID: sec:info
@ -995,47 +1020,29 @@ looks for files.
:CUSTOM_ID: sec:key-bindings
: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
#+caption[Basic key bindings]:
#+caption: Basic key bindings.
#+name: tab:basic-key-bindings
|--------------------+------------+------------------------|
|----------------------+------------+------------------------|
| command | key map | keys |
|--------------------+------------+------------------------|
| undo | global-map | {{{kbd(s-z)}}} |
| backward-kill-word | global-map | {{{kbd(C-backspace)}}} |
| backward-char | global-map | {{{kbd(C-b)}}} |
| forward-char | global-map | {{{kbd(C-f)}}} |
| backward-word | global-map | {{{kbd(M-b)}}} |
| forward-word | global-map | {{{kbd(M-f)}}} |
| backward-sentence | global-map | {{{kbd(M-a)}}} |
| 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
|----------------------+------------+------------------------|
| *undo* | global-map | {{{kbd(s-z)}}} |
| *backward-kill-word* | global-map | {{{kbd(C-backspace)}}} |
| **backward-char* | global-map | {{{kbd(C-b)}}} |
| *forward-char* | global-map | {{{kbd(C-f)}}} |
| *backward-word* | global-map | {{{kbd(M-b)}}} |
| *forward-word* | global-map | {{{kbd(M-f)}}} |
| *backward-sentence* | global-map | {{{kbd(M-a)}}} |
| *forward-sentence* | global-map | {{{kbd(M-e)}}} |
|----------------------+------------+------------------------|
** [[https://github.com/michael-heerdegen/interaction-log.el#readme][Interaction-log]]
:PROPERTIES:
@ -1066,14 +1073,15 @@ Enable it and re-execute it."
:CUSTOM_ID: sec:keycast
: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: Configure =keycast=.
#+name: lst:configure-keycast
#+caption[Setup =keycast=]:
#+caption: setup =keycast=.
#+name: lst:setup-keycast
#+begin_src emacs-lisp -n :results silent
;; Make `keycast-log-update-buffer' use a buffer similar to the
;; control buffer `ediff-setup-windows-plain' returns.
;; Make `keycast-log-update-buffer' use a buffer similar to what
;; calling `ediff-setup-windows-plain' returns.
(when (ensure-package-installation 'keycast)
(setopt keycast-log-newest-first t
keycast-mode-line-window-predicate #'keycast-bottom-right-window-p)