Add more functions to the init short documentation group

This commit is contained in:
Gerard Vermeulen 2022-04-18 12:33:52 +02:00
parent b0918996a1
commit d706bf7b29

View File

@ -601,7 +601,11 @@ defined in this Org file.
(org-eval-emacs-lisp-setup-blocks :no-manual t)
(org-eval-python-setup-blocks :no-manual t)
(org-eval-infixed-blocks :no-manual t)
(org-syntax-convert-keyword-case-to-lower :no-manual t))))
(org-syntax-convert-keyword-case-to-lower :no-manual t)
"Wizard"
(enable-this-command :no-manual t)
(narrow-or-widen-dwim :no-manual t)
(org-narrow-to-table :no-manual t))))
#+end_src
** [[info:info#Top][Info (info)]]
@ -659,7 +663,7 @@ users from shooting themselves in the feet. Listing
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
(setq disabled-command-function
(defun my-enable-this-command (&rest _args)
(defun enable-this-command (&rest _args)
"Called when a disabled command is executed.
Enable it and re-execute it."
(put this-command 'disabled nil)
@ -3197,40 +3201,43 @@ on tables by means of =org-narrow-to-table=.
#+caption: Configure =narrow-or-widen-dwim=.
#+name: lst:configure-narrow-or-widen-dwim
#+begin_src emacs-lisp
(defun org-narrow-to-table ()
"Narrow buffer to current table."
(interactive)
(if (org-table-p)
(narrow-to-region (org-table-begin) (org-table-end))
(user-error "Not in a table")))
(with-eval-after-load 'emacs
(autoload 'org-at-table "org-table")
(defun narrow-or-widen-dwim (p)
"Widen if buffer is narrowed, narrow-dwim otherwise.
Dwim means: region, org-src-block, org-subtree, or defun,
whichever applies first. Narrowing to org-src-block actually
calls `org-edit-src-code'.
With prefix P, don't widen, just narrow even if buffer is
already narrowed."
(interactive "P")
(declare (interactive-only))
(cond ((and (buffer-narrowed-p) (not p)) (widen))
((and (bound-and-true-p org-src-mode) (not p))
(org-edit-src-exit))
((region-active-p)
(narrow-to-region (region-beginning) (region-end)))
((derived-mode-p 'org-mode)
(or (ignore-errors (org-edit-src-code))
(ignore-errors (org-narrow-to-block))
(ignore-errors (org-narrow-to-table))
(org-narrow-to-subtree)))
((derived-mode-p 'latex-mode)
(LaTeX-narrow-to-environment))
((derived-mode-p 'tex-mode)
(TeX-narrow-to-group))
(t (narrow-to-defun))))
(defun org-narrow-to-table ()
"Narrow buffer to current table."
(interactive)
(if (org-at-table-p)
(narrow-to-region (org-table-begin) (org-table-end))
(user-error "Not in a table")))
(define-key ctl-x-map (kbd "n t") #'org-narrow-to-table)
(define-key ctl-x-map (kbd "C-n") #'narrow-or-widen-dwim)
(defun narrow-or-widen-dwim (p)
"Widen if buffer is narrowed, narrow-dwim otherwise.
Dwim means: region, org-src-block, org-table, org-subtree, LaTeX
environment, TeX group, or defun, whichever applies first.
Narrowing to org-src-block actually calls `org-edit-src-code'.
With prefix P, don't widen, just narrow even if buffer is already
narrowed."
(interactive "P")
(declare (interactive-only))
(cond ((and (buffer-narrowed-p) (not p)) (widen))
((and (bound-and-true-p org-src-mode) (not p))
(org-edit-src-exit))
((region-active-p)
(narrow-to-region (region-beginning) (region-end)))
((derived-mode-p 'org-mode)
(or (ignore-errors (org-edit-src-code))
(ignore-errors (org-narrow-to-block))
(ignore-errors (org-narrow-to-table))
(org-narrow-to-subtree)))
((derived-mode-p 'latex-mode)
(LaTeX-narrow-to-environment))
((derived-mode-p 'tex-mode)
(TeX-narrow-to-group))
(t (narrow-to-defun))))
(define-key ctl-x-map (kbd "n t") #'org-narrow-to-table)
(define-key ctl-x-map (kbd "C-n") #'narrow-or-widen-dwim))
#+end_src
** [[info:emacs#Faces][Text faces or styles (info)]]