diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8684e9eb4..c70a15dfd 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,13 @@ 2009-02-20 Carsten Dominik + * 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 diff --git a/lisp/org-compat.el b/lisp/org-compat.el index a8b741380..fd28624c2 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -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) diff --git a/lisp/org-list.el b/lisp/org-list.el index 8b41391e7..a6ee352d9 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -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) diff --git a/lisp/org.el b/lisp/org.el index 55bc1c582..08502778d 100644 --- a/lisp/org.el +++ b/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)