Start working on the help section with the shortdoc library

This commit is contained in:
Gerard Vermeulen 2022-04-17 17:45:42 +02:00
parent a9e1ed2ec1
commit ec0210d63f
1 changed files with 74 additions and 18 deletions

View File

@ -548,9 +548,62 @@ the contents of packages and allows to update packages to the latest version.
(package-install-selected-packages))
#+end_src
* [[info:dir#Top][Info documentation]]
* [[info:emacs#Help][Help (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:info-documentation
:CUSTOM_ID: sec:help
:END:
Table [[tab:help-key-bindings]] lists a number of key bindings to start playing with
the help facilities of Emacs.
#+attr_latex: :booktabs yes :float table
#+caption[Help key bindings]:
#+caption: Help key bindings.
#+name: tab:help-key-bindings
|--------------------------------+------------------+------------|
| command | keys | key map |
|--------------------------------+------------------+------------|
| =Info-goto-emacs-command-node= | {{{kbd(C-h F)}}} | =help-map= |
| =describe-function= | {{{kbd(C-h f)}}} | =help-map= |
| =describe-key= | {{{kbd(C-h k)}}} | =help-map= |
| =describe-symbol= | {{{kbd(C-h o)}}} | =help-map= |
| =describe-variable= | {{{kbd(C-h v)}}} | =help-map= |
| =info= | {{{kbd(C-h i)}}} | =help-map= |
|--------------------------------+------------------+------------|
** [[info:emacs#Name Help][Shortdoc-display-group (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:shortdoc-display-group
:END:
Listing [[lst:configure-shortdoc]] binds {{{kbd(C-h y)}}} to
=short-doc-display-group= and defines a short documentation group for functions
defined in this Org file.
#+caption[Configure =shortdoc=]:
#+caption: Configure =shortdoc=.
#+name: lst:configure-shortdoc
#+begin_src emacs-lisp
(when (fboundp 'shortdoc-display-group)
(define-key help-map (kbd "y") #'shortdoc-display-group)
(with-eval-after-load 'shortdoc
;; Ensure defining the functions before documenting them.
(define-short-documentation-group init
"Face"
(invert-default-face
:no-manual t)
(set-default-face-height
:no-manual t)
"Org"
(org-electric-dollar
:no-manual t)
(org-syntax-convert-keyword-case-to-lower
:no-manual t))))
#+end_src
** [[info:info#Top][Info (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:help
:END:
Listing [[lst:configure-info]] adds a path in my home directory to the places where
@ -572,9 +625,9 @@ Listing [[lst:configure-info]] adds a path in my home directory to the places wh
:END:
#+attr_latex: :booktabs yes :float table
#+caption[Basic Emacs key bindings]:
#+caption: Basic Emacs key-bindings.
#+name: tab:basic-emacs-key-bindings
#+caption[Basic key bindings]:
#+caption: Basic key bindings.
#+name: tab:basic-key-bindings
|----------------------+------------------------+--------------|
| command | keys | key map |
|----------------------+------------------------+--------------|
@ -1392,7 +1445,7 @@ backward compatibility. See table [[tab:org-latex-class-tag-placeholder]] and ty
#+caption: Configure =org-mode-map=.
#+name: lst:configure-org-mode-map
#+begin_src emacs-lisp
(with-eval-after-load 'org
(with-eval-after-load 'emacs
;; From: "Nicolas Richard" <theonewiththeevillook@yahoo.fr>
;; Date: Fri, 08 Mar 2013 16:23:02 +0100 [thread overview]
;; Message-ID: <87vc913oh5.fsf@yahoo.fr> (raw)
@ -1407,8 +1460,9 @@ backward compatibility. See table [[tab:org-latex-class-tag-placeholder]] and ty
(insert "\\(\\)")
(backward-char 2)))
(define-key org-mode-map (kbd "$") #'org-electric-dollar)
(define-key org-mode-map (kbd "M-q") #'org-fill-paragraph))
(with-eval-after-load 'org
(define-key org-mode-map (kbd "$") #'org-electric-dollar)
(define-key org-mode-map (kbd "M-q") #'org-fill-paragraph)))
#+end_src
#+caption[Customize =org-export=]:
@ -1734,19 +1788,21 @@ variables in order to export the =info-org-link= types in this document to
#+caption: Convert upper to lower case keywords.
#+name: lst:convert-upper-to-lower-case-keywords
#+begin_src emacs-lisp
(with-eval-after-load 'org
(with-eval-after-load 'emacs
;; https://tecosaur.github.io/emacs-config/#translate-capital-keywords
(defun org-syntax-convert-keyword-case-to-lower ()
"Convert all #+KEYWORDS to #+keywords."
(interactive)
(save-excursion
(goto-char (point-min))
(let ((count 0)
(case-fold-search nil))
(while (re-search-forward "^[ \t]*#\\+[A-Z_]+" nil t)
(unless (s-matches-p "RESULTS" (match-string 0))
(replace-match (downcase (match-string 0)) t)
(setq count (1+ count))))
(message "Replaced %d keywords" count)))))
(when (derived-mode-p 'org-mode)
(save-excursion
(goto-char (point-min))
(let ((count 0)
(case-fold-search nil))
(while (re-search-forward "^[ \t]*#\\+[A-Z_]+" nil t)
(unless (s-matches-p "RESULTS" (match-string 0))
(replace-match (downcase (match-string 0)) t)
(setq count (1+ count))))
(message "Replaced %d keywords" count))))))
#+end_src
*** [[https://lists.gnu.org/archive/html/emacs-orgmode/2016-07/msg00394.html][Evaluate specific source blocks at load-time]]