org,org-agenda: New: open info depending on context

* lisp/org.el (org-info-find-node): Function to jump to info depending
  on context.  For an org file the context is the element type at point.
This commit is contained in:
Marco Wahl 2018-10-01 22:47:33 +02:00
parent 3be2260806
commit b19e7737dd
4 changed files with 78 additions and 2 deletions

View File

@ -18962,6 +18962,22 @@ further based on their usage needs. For example, the normal
| {{{kbd(C-S-LEFT)}}} | {{{kbd(C-c C-x LEFT)}}} | | |
| {{{kbd(C-S-RIGHT)}}} | {{{kbd(C-c C-x RIGHT)}}} | | |
** Context Dependent Documentation
:PROPERTIES:
:DESCRIPTION: Get Documentation for Context.
:ALT_TITLE: Documentation
:END:
#+cindex: documentation
#+cindex: Info
#+findex: org-info-find-node
{{{kbd(C-c C-x C-i)}}} tries to open a suitable section of the Org
info documentation depending on the Org element at point. For example
on a headline the info documentation about the Org document structure
appears.
{{{kbd(q)}}} closes the info window.
** Interaction with Other Packages
:PROPERTIES:
:DESCRIPTION: With other Emacs packages.

View File

@ -91,7 +91,7 @@ changed. This is an excerpt of the new docstring:
: When set to default, bind the function to c, but only if it is
: available in the Calendar keymap. This is the default choice because
: c can then be used to switch back and forth between agenda and calendar.
:
:
: When nil, org-calendar-goto-agenda is not bound to any key.
Check the full docstring for more.
@ -101,7 +101,7 @@ Check the full docstring for more.
Here is the new docstring:
: (org-set-effort &optional INCREMENT VALUE)
:
:
: Set the effort property of the current entry.
: If INCREMENT is non-nil, set the property to the next allowed
: value. Otherwise, if optional argument VALUE is provided, use
@ -345,6 +345,13 @@ about the last major release.
There is a new menu entry for this in the "Documentation" menu item.
*** ~org-info-find-node~
From an Org file or an agenda switch to a suitable info page depending
on the context.
The function is bound to =C-c C-x I=.
** Removed commands and functions
*** ~org-outline-overlay-data~
Use ~org-save-outline-visibility~ instead.

View File

@ -2395,6 +2395,7 @@ The following commands are available:
(define-key org-agenda-mode-map "?" 'org-agenda-show-the-flagging-note)
(org-defkey org-agenda-mode-map "\C-c\C-x\C-mg" 'org-mobile-pull)
(org-defkey org-agenda-mode-map "\C-c\C-x\C-mp" 'org-mobile-push)
(org-defkey org-agenda-mode-map "\C-c\C-xI" 'org-info-find-node)
(org-defkey org-agenda-mode-map [mouse-2] 'org-agenda-goto-mouse)
(org-defkey org-agenda-mode-map [mouse-3] 'org-agenda-show-mouse)

View File

@ -19105,6 +19105,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
(org-defkey org-mode-map (kbd "C-c C-x _") #'org-timer-stop)
(org-defkey org-mode-map (kbd "C-c C-x ;") #'org-timer-set-timer)
(org-defkey org-mode-map (kbd "C-c C-x ,") #'org-timer-pause-or-continue)
(org-defkey org-mode-map (kbd "C-c C-x I") #'org-info-find-node)
(define-key org-mode-map (kbd "C-c C-x C-c") #'org-columns)
@ -23660,6 +23661,57 @@ when non-nil, is a regexp matching keywords names."
(and extra (concat (and kwds "\\|") extra))
"\\):[ \t]*\\(.*\\)"))
;;; Conveniently switch to Info nodes
(defun org-info-find-node (&optional nodename)
"Find Info documentation NODENAME or Org documentation according context.
Started from `gnus-info-find-node'."
(interactive)
(Info-goto-node
(or nodename
(let ((default-org-info-node "(org) Top"))
(cond
((eq 'org-agenda-mode major-mode) "(org) Agenda Views")
((eq 'org-mode major-mode)
(let* ((context (org-element-at-point))
(element-info-nodes ; compare to `org-element-all-elements'.
`(
(babel-call . "(org) Evaluating Code Blocks")
(center-block . "(org) Paragraphs")
(clock . ,default-org-info-node)
(comment . "(org) Comment Lines")
(comment-block . "(org) Comment Lines")
(diary-sexp . ,default-org-info-node)
(drawer . "(org) Drawers")
(dynamic-block . "(org) Dynamic Blocks")
(example-block . "(org) Literal Examples")
(export-block . "(org) ASCII/Latin-1/UTF-8 export")
(fixed-width . ,default-org-info-node)
(footnote-definition . "(org) Creating Footnotes")
(headline . "(org) Document Structure")
(horizontal-rule . "(org) Built-in Table Editor")
(inlinetask . ,default-org-info-node)
(item . "(org) Plain Lists")
(keyword . "(org) Per-file keywords")
(latex-environment . "(org) LaTeX Export")
(node-property . "(org) Properties and Columns")
(paragraph . "(org) Paragraphs")
(plain-list . "(org) Plain Lists")
(planning . "(org) Deadlines and Scheduling")
(property-drawer . "(org) Properties and Columns")
(quote-block . "(org) Paragraphs")
(section . ,default-org-info-node)
(special-block . ,default-org-info-node)
(src-block . "(org) Working with Source Code")
(table . "(org) Tables")
(table-row . "(org) Tables")
(verse-block . "(org) Paragraphs")
)))
(or (cdr (assoc (car context) element-info-nodes))
default-org-info-node)))
(t default-org-info-node))))))
;;; Finish up