forked from mirrors/org-mode
Lists: Make promotion and demotion work on regions.
This commit is contained in:
parent
82f2fca21e
commit
01a061c2fa
|
@ -1,5 +1,13 @@
|
|||
2009-02-20 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org-list.el (org-indent-item): Allow point to be at the end of
|
||||
the region.
|
||||
|
||||
* org.el (org-metaleft, org-metaright): Be more accurate about
|
||||
detecting a region where commands apply.
|
||||
|
||||
* org-compat.el (org-cursor-to-region-beginning): New function.
|
||||
|
||||
* org.el (org-priority): Also find invisible heading.
|
||||
|
||||
* org-colview-xemacs.el (org-columns-edit-value): No special
|
||||
|
|
|
@ -185,6 +185,11 @@ Works on both Emacs and XEmacs."
|
|||
(use-region-p)
|
||||
(and transient-mark-mode mark-active))))) ; Emacs 22 and before
|
||||
|
||||
(defun org-cursor-to-region-beginning ()
|
||||
(when (and (org-region-active-p)
|
||||
(> (point) (region-beginning)))
|
||||
(exchange-point-and-mark)))
|
||||
|
||||
;; Invisibility compatibility
|
||||
|
||||
(defun org-add-to-invisibility-spec (arg)
|
||||
|
|
|
@ -872,17 +872,19 @@ I.e. to the text after the last item."
|
|||
(defun org-indent-item (arg)
|
||||
"Indent a local list item."
|
||||
(interactive "p")
|
||||
(and (org-region-active-p) (org-cursor-to-region-beginning))
|
||||
(unless (org-at-item-p)
|
||||
(error "Not on an item"))
|
||||
(save-excursion
|
||||
(let (beg end ind ind1 tmp delta ind-down ind-up)
|
||||
(setq end (and (org-region-active-p) (region-end)))
|
||||
(if (memq last-command '(org-shiftmetaright org-shiftmetaleft))
|
||||
(setq beg org-last-indent-begin-marker
|
||||
end org-last-indent-end-marker)
|
||||
(org-beginning-of-item)
|
||||
(setq beg (move-marker org-last-indent-begin-marker (point)))
|
||||
(org-end-of-item)
|
||||
(setq end (move-marker org-last-indent-end-marker (point))))
|
||||
(setq end (move-marker org-last-indent-end-marker (or end (point)))))
|
||||
(goto-char beg)
|
||||
(setq tmp (org-item-indent-positions)
|
||||
ind (car tmp)
|
||||
|
|
30
lisp/org.el
30
lisp/org.el
|
@ -1328,9 +1328,9 @@ Possible values for the command are:
|
|||
does define this command, but you can overrule/replace it
|
||||
here.
|
||||
string A command to be executed by a shell; %s will be replaced
|
||||
by the path to the file.
|
||||
by the path to the file.
|
||||
sexp A Lisp form which will be evaluated. The file path will
|
||||
be available in the Lisp variable `file'.
|
||||
be available in the Lisp variable `file'.
|
||||
For more examples, see the system specific constants
|
||||
`org-file-apps-defaults-macosx'
|
||||
`org-file-apps-defaults-windowsnt'
|
||||
|
@ -13458,9 +13458,18 @@ See the individual commands for more information."
|
|||
(cond
|
||||
((run-hook-with-args-until-success 'org-metaleft-hook))
|
||||
((org-at-table-p) (org-call-with-arg 'org-table-move-column 'left))
|
||||
((or (org-on-heading-p) (org-region-active-p))
|
||||
((or (org-on-heading-p)
|
||||
(and (org-region-active-p)
|
||||
(save-excursion
|
||||
(goto-char (region-beginning))
|
||||
(org-on-heading-p))))
|
||||
(call-interactively 'org-do-promote))
|
||||
((org-at-item-p) (call-interactively 'org-outdent-item))
|
||||
((or (org-at-item-p)
|
||||
(and (org-region-active-p)
|
||||
(save-excursion
|
||||
(goto-char (region-beginning))
|
||||
(org-at-item-p))))
|
||||
(call-interactively 'org-outdent-item))
|
||||
(t (call-interactively 'backward-word))))
|
||||
|
||||
(defun org-metaright (&optional arg)
|
||||
|
@ -13472,9 +13481,18 @@ See the individual commands for more information."
|
|||
(cond
|
||||
((run-hook-with-args-until-success 'org-metaright-hook))
|
||||
((org-at-table-p) (call-interactively 'org-table-move-column))
|
||||
((or (org-on-heading-p) (org-region-active-p))
|
||||
((or (org-on-heading-p)
|
||||
(and (org-region-active-p)
|
||||
(save-excursion
|
||||
(goto-char (region-beginning))
|
||||
(org-on-heading-p))))
|
||||
(call-interactively 'org-do-demote))
|
||||
((org-at-item-p) (call-interactively 'org-indent-item))
|
||||
((or (org-at-item-p)
|
||||
(and (org-region-active-p)
|
||||
(save-excursion
|
||||
(goto-char (region-beginning))
|
||||
(org-at-item-p))))
|
||||
(call-interactively 'org-indent-item))
|
||||
(t (call-interactively 'forward-word))))
|
||||
|
||||
(defun org-metaup (&optional arg)
|
||||
|
|
Loading…
Reference in New Issue