orgstruct++-mode: Make more visible in docs, parse item body
orgstruct++-mode is an enhanced version of orgstruct mode that also imports all indentation and paragraph settings into the major mode. Furthermore, it now allows to use M-RET and M-S-RET in items after the first line. The latter change was a request by Austin Frank.
This commit is contained in:
parent
94ec7c98b1
commit
9989e5f030
|
@ -1,3 +1,8 @@
|
|||
2009-02-22 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.texi (Orgstruct mode): Describe `orgstruct++-mode'.
|
||||
(Drawers): Mention the LOGBOOK drawer.
|
||||
|
||||
2009-02-20 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.texi (Export options, Sectioning structure): Document the
|
||||
|
|
26
doc/org.texi
26
doc/org.texi
|
@ -372,7 +372,7 @@ Interaction with other packages
|
|||
|
||||
Hacking
|
||||
|
||||
* Hooks:: Who to reach into Org's internals
|
||||
* Hooks:: How to reach into Org's internals
|
||||
* Add-on packages:: Available extensions
|
||||
* Adding hyperlink types:: New custom link types
|
||||
* Context-sensitive commands:: How to add functioality to such commands
|
||||
|
@ -1505,22 +1505,24 @@ you can use the usual commands to follow these links.
|
|||
@cindex minor mode for structure editing
|
||||
|
||||
If you like the intuitive way the Org mode structure editing and list
|
||||
formatting works, you might want to use these commands in other modes
|
||||
like Text mode or Mail mode as well. The minor mode Orgstruct mode
|
||||
makes this possible. You can always toggle the mode with @kbd{M-x
|
||||
orgstruct-mode}. To turn it on by default, for example in Mail mode,
|
||||
use
|
||||
formatting works, you might want to use these commands in other modes like
|
||||
Text mode or Mail mode as well. The minor mode @code{orgstruct-mode} makes
|
||||
this possible. Toggle the mode with @kbd{M-x orgstruct-mode}, or
|
||||
turn it on by default, for example in Mail mode, with one of:
|
||||
|
||||
@lisp
|
||||
(add-hook 'mail-mode-hook 'turn-on-orgstruct)
|
||||
(add-hook 'mail-mode-hook 'turn-on-orgstruct++)
|
||||
@end lisp
|
||||
|
||||
When this mode is active and the cursor is on a line that looks to
|
||||
Org like a headline of the first line of a list item, most
|
||||
structure editing commands will work, even if the same keys normally
|
||||
have different functionality in the major mode you are using. If the
|
||||
cursor is not in one of those special lines, Orgstruct mode lurks
|
||||
silently in the shadow.
|
||||
When this mode is active and the cursor is on a line that looks to Org like a
|
||||
headline of the first line of a list item, most structure editing commands
|
||||
will work, even if the same keys normally have different functionality in the
|
||||
major mode you are using. If the cursor is not in one of those special
|
||||
lines, Orgstruct mode lurks silently in the shadow. When you use
|
||||
@code{orgstruct++-mode}, Org will also export indentation and autofill
|
||||
settings into that mode, and detect item context after the first line of an
|
||||
item.
|
||||
|
||||
@node Tables, Hyperlinks, Document Structure, Top
|
||||
@chapter Tables
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
2009-02-22 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.el (orgstruct++-mode): New function.
|
||||
(turn-on-orgstruct++): Call `orgstruct++-mode'.
|
||||
(org-context-p): Allow detecting item context after the first line
|
||||
of an item.
|
||||
(orgstruct-make-binding): Detect if item-body context should be
|
||||
seen.
|
||||
(orgstruct-is-++): New variable.
|
||||
|
||||
2009-02-21 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.el (org-reload): New command.
|
||||
|
|
53
lisp/org.el
53
lisp/org.el
|
@ -6267,22 +6267,38 @@ C-c C-c Set tags / toggle checkbox"
|
|||
"Unconditionally turn on `orgstruct-mode'."
|
||||
(orgstruct-mode 1))
|
||||
|
||||
(defun orgstruct++-mode (&optional arg)
|
||||
"Toggle `orgstruct-mode', the enhanced version of it.
|
||||
In addition to setting orgstruct-mode, this also exports all indentation and
|
||||
autofilling variables from org-mode into the buffer. It will also
|
||||
recognize item context in multiline items.
|
||||
Note that turning off orgstruct-mode will *not* remove the
|
||||
indentation/paragraph settings. This can only be done by refreshing the
|
||||
major mode, for example with \[normal-mode]."
|
||||
(interactive "P")
|
||||
(setq arg (prefix-numeric-value (or arg (if orgstruct-mode -1 1))))
|
||||
(if (< arg 1)
|
||||
(orgstruct-mode -1)
|
||||
(orgstruct-mode 1)
|
||||
(let (var val)
|
||||
(mapc
|
||||
(lambda (x)
|
||||
(when (string-match
|
||||
"^\\(paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)"
|
||||
(symbol-name (car x)))
|
||||
(setq var (car x) val (nth 1 x))
|
||||
(org-set-local var (if (eq (car-safe val) 'quote) (nth 1 val) val))))
|
||||
org-local-vars)
|
||||
(org-set-local 'orgstruct-is-++ t))))
|
||||
|
||||
(defvar orgstruct-is-++ nil
|
||||
"Is orgstruct-mode in ++ version in the current-buffer?")
|
||||
(make-variable-buffer-local 'orgstruct-is-++)
|
||||
|
||||
;;;###autoload
|
||||
(defun turn-on-orgstruct++ ()
|
||||
"Unconditionally turn on `orgstruct-mode', and force org-mode indentations.
|
||||
In addition to setting orgstruct-mode, this also exports all indentation and
|
||||
autofilling variables from org-mode into the buffer. Note that turning
|
||||
off orgstruct-mode will *not* remove these additional settings."
|
||||
(orgstruct-mode 1)
|
||||
(let (var val)
|
||||
(mapc
|
||||
(lambda (x)
|
||||
(when (string-match
|
||||
"^\\(paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)"
|
||||
(symbol-name (car x)))
|
||||
(setq var (car x) val (nth 1 x))
|
||||
(org-set-local var (if (eq (car-safe val) 'quote) (nth 1 val) val))))
|
||||
org-local-vars)))
|
||||
"Unconditionally turn on `orgstruct++-mode'."
|
||||
(orgstruct++-mode 1))
|
||||
|
||||
(defun orgstruct-error ()
|
||||
"Error when there is no default binding for a structure key."
|
||||
|
@ -6355,7 +6371,10 @@ to execute outside of tables."
|
|||
"'.")
|
||||
'(interactive "p")
|
||||
(list 'if
|
||||
'(org-context-p 'headline 'item)
|
||||
`(org-context-p 'headline 'item
|
||||
(and orgstruct-is-++
|
||||
,(and (memq fun '(org-insert-heading org-insert-todo-heading)) t)
|
||||
'item-body))
|
||||
(list 'org-run-like-in-org-mode (list 'quote fun))
|
||||
(list 'let '(orgstruct-mode)
|
||||
(list 'call-interactively
|
||||
|
@ -6376,7 +6395,9 @@ Possible values in the list of contexts are `table', `headline', and `item'."
|
|||
;;????????? (looking-at "\\*+"))
|
||||
(looking-at outline-regexp))
|
||||
(and (memq 'item contexts)
|
||||
(looking-at "[ \t]*\\([-+*] \\|[0-9]+[.)] \\)")))
|
||||
(looking-at "[ \t]*\\([-+*] \\|[0-9]+[.)] \\)"))
|
||||
(and (memq 'item-body contexts)
|
||||
(org-in-item-p)))
|
||||
(goto-char pos))))
|
||||
|
||||
(defun org-get-local-variables ()
|
||||
|
|
Loading…
Reference in New Issue