Add more functions to the init short documentation group
This commit is contained in:
parent
b0918996a1
commit
d706bf7b29
75
README.org
75
README.org
@ -601,7 +601,11 @@ defined in this Org file.
|
|||||||
(org-eval-emacs-lisp-setup-blocks :no-manual t)
|
(org-eval-emacs-lisp-setup-blocks :no-manual t)
|
||||||
(org-eval-python-setup-blocks :no-manual t)
|
(org-eval-python-setup-blocks :no-manual t)
|
||||||
(org-eval-infixed-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
|
#+end_src
|
||||||
|
|
||||||
** [[info:info#Top][Info (info)]]
|
** [[info:info#Top][Info (info)]]
|
||||||
@ -659,7 +663,7 @@ users from shooting themselves in the feet. Listing
|
|||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(with-eval-after-load 'emacs
|
(with-eval-after-load 'emacs
|
||||||
(setq disabled-command-function
|
(setq disabled-command-function
|
||||||
(defun my-enable-this-command (&rest _args)
|
(defun enable-this-command (&rest _args)
|
||||||
"Called when a disabled command is executed.
|
"Called when a disabled command is executed.
|
||||||
Enable it and re-execute it."
|
Enable it and re-execute it."
|
||||||
(put this-command 'disabled nil)
|
(put this-command 'disabled nil)
|
||||||
@ -3197,40 +3201,43 @@ on tables by means of =org-narrow-to-table=.
|
|||||||
#+caption: Configure =narrow-or-widen-dwim=.
|
#+caption: Configure =narrow-or-widen-dwim=.
|
||||||
#+name: lst:configure-narrow-or-widen-dwim
|
#+name: lst:configure-narrow-or-widen-dwim
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun org-narrow-to-table ()
|
(with-eval-after-load 'emacs
|
||||||
"Narrow buffer to current table."
|
(autoload 'org-at-table "org-table")
|
||||||
(interactive)
|
|
||||||
(if (org-table-p)
|
|
||||||
(narrow-to-region (org-table-begin) (org-table-end))
|
|
||||||
(user-error "Not in a table")))
|
|
||||||
|
|
||||||
(defun narrow-or-widen-dwim (p)
|
(defun org-narrow-to-table ()
|
||||||
"Widen if buffer is narrowed, narrow-dwim otherwise.
|
"Narrow buffer to current table."
|
||||||
Dwim means: region, org-src-block, org-subtree, or defun,
|
(interactive)
|
||||||
whichever applies first. Narrowing to org-src-block actually
|
(if (org-at-table-p)
|
||||||
calls `org-edit-src-code'.
|
(narrow-to-region (org-table-begin) (org-table-end))
|
||||||
With prefix P, don't widen, just narrow even if buffer is
|
(user-error "Not in a table")))
|
||||||
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)
|
(defun narrow-or-widen-dwim (p)
|
||||||
(define-key ctl-x-map (kbd "C-n") #'narrow-or-widen-dwim)
|
"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
|
#+end_src
|
||||||
|
|
||||||
** [[info:emacs#Faces][Text faces or styles (info)]]
|
** [[info:emacs#Faces][Text faces or styles (info)]]
|
||||||
|
Loading…
Reference in New Issue
Block a user