Re: [Orgmode] [Bug?] Mark subtrees and inline tasks
Hello, Sébastien Vauban writes: To select this subtree, I use =C-c @=. It does its job, except that it never selects the last line. OK; just C-x C-x, add a line, and that's it. Feature? Bug? Feature. If you want to grab the last line too, use (org-end-of-subtree nil t) Same problem, though more problematic IMHO, with the inline tasks. *** Check how the selection works I'd expect the END line to be selected as well. It's not. *** END Here is a suggestion of patch creating a new function org-mark-subtree (and not using the outline one). Tell me if it works for you. Regards, -- Nicolas From b2267d2e4ef40a0d0d6e8c9a789e835b5cde6036 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou n.goaz...@gmail.com Date: Sat, 6 Nov 2010 10:10:22 +0100 Subject: [PATCH] Handle inline tasks when marking a subtree * org-inlinetask.el (org-inlinetask-goto-beginning): new function * org-inlinetask.el (org-inlinetask-goto-end): new function * org.el (org-mark-subtree): new command * org.el (org-speed-commands-default, org-mode-map): make use of new command --- lisp/org-inlinetask.el | 24 lisp/org.el| 25 - 2 files changed, 48 insertions(+), 1 deletions(-) diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el index c000999..fc0d932 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -147,6 +147,30 @@ If prefix arg NO-STATE is set, ignore `org-inlinetask-default-state'. (and (re-search-forward ^\\*+[ \t]+ nil t) (progn (beginning-of-line) (looking-at task-end-re))) +(defun org-inlinetask-goto-beginning () + Go to the beginning of the inline task at point. + (end-of-line) + (re-search-backward (format ^\\*\\{%d,\\} org-inlinetask-min-level) nil t) + (when (org-looking-at-p (format ^\\*\\{%d,\\} END org-inlinetask-min-level)) +(re-search-backward + (format ^\\*\\{%d,\\} org-inlinetask-min-level) nil t))) + +(defun org-inlinetask-goto-end () + Go to the end of the inline task at point. + (cond + ((org-looking-at-p (format ^\\*\\{%d,\\} END org-inlinetask-min-level)) +(forward-line 1)) + ((org-looking-at-p (format ^\\*\\{%d,\\} org-inlinetask-min-level)) +(forward-line 1) +(when (org-inlinetask-in-task-p) + (re-search-forward + (format ^\\*\\{%d,\\} END org-inlinetask-min-level) nil t) + (forward-line 1))) + (t +(re-search-forward + (format ^\\*\\{%d,\\} END org-inlinetask-min-level) nil t) +(forward-line 1 + (defvar htmlp) ; dynamically scoped into the next function (defvar latexp) ; dynamically scoped into the next function (defun org-inlinetask-export-handler () diff --git a/lisp/org.el b/lisp/org.el index 201dd87..905fabc 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16433,6 +16433,7 @@ BEG and END default to the buffer boundaries. (org-defkey org-mode-map \C-c\C-xf'org-footnote-action) (org-defkey org-mode-map \C-c\C-x\C-mg'org-mobile-pull) (org-defkey org-mode-map \C-c\C-x\C-mp'org-mobile-push) +(org-defkey org-mode-map \C-c@ 'org-mark-subtree) (org-defkey org-mode-map [?\C-c (control ?*)] 'org-list-make-subtree) ;;(org-defkey org-mode-map [?\C-c (control ?-)] 'org-list-make-list-from-subtree) @@ -16506,7 +16507,7 @@ BEG and END default to the buffer boundaries. (^ . org-sort) (w . org-refile) (a . org-archive-subtree-default-with-confirmation) -(. . outline-mark-subtree) +(. . org-mark-subtree) (Clock Commands) (I . org-clock-in) (O . org-clock-out) @@ -18653,6 +18654,28 @@ which make use of the date at the cursor. (message Entry marked for action; press `k' at desired date in agenda or calendar)) +(defun org-mark-subtree () + Mark the current subtree. +This puts point at the start of the current subtree, and mark at the end. + +If point is in an inline task, mark that task instead. + (interactive) + (let ((inline-task-p +(and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p))) + (beg)) +(cond + (inline-task-p (org-inlinetask-goto-beginning)) + ((org-at-heading-p) (beginning-of-line)) + ;; else go back to previous heading + (t (outline-previous-visible-heading 1))) +(setq beg (point)) +(ifinline-task-p + (org-inlinetask-goto-end) + (org-end-of-subtree)) +(push-mark (point) nil t) +(goto-char beg))) + ;;; Paragraph filling stuff. ;; We want this to be just right, so use the full arsenal. -- 1.7.3.2 ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [Bug?] Mark subtrees and inline tasks
Well, use this version instead. It will avoid compilation problems. Sébastien Vauban writes: To select this subtree, I use =C-c @=. It does its job, except that it never selects the last line. OK; just C-x C-x, add a line, and that's it. Feature? Bug? Feature. If you want to grab the last line too, use (org-end-of-subtree nil t) Same problem, though more problematic IMHO, with the inline tasks. *** Check how the selection works I'd expect the END line to be selected as well. It's not. *** END Here is a suggestion of patch creating a new function org-mark-subtree (and not using the outline one). Tell me if it works for you. Regards, -- Nicolas From 8fcf73648f722e2aa8c539bdda433daab1edce6e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou n.goaz...@gmail.com Date: Sat, 6 Nov 2010 10:10:22 +0100 Subject: [PATCH] Handle inline tasks when marking a subtree * org-inlinetask.el (org-inlinetask-goto-beginning): new function * org-inlinetask.el (org-inlinetask-goto-end): new function * org.el (org-mark-subtree): new command * org.el (org-speed-commands-default, org-mode-map): make use of new command --- lisp/org-inlinetask.el | 24 lisp/org.el| 29 - 2 files changed, 52 insertions(+), 1 deletions(-) diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el index c000999..fc0d932 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -147,6 +147,30 @@ If prefix arg NO-STATE is set, ignore `org-inlinetask-default-state'. (and (re-search-forward ^\\*+[ \t]+ nil t) (progn (beginning-of-line) (looking-at task-end-re))) +(defun org-inlinetask-goto-beginning () + Go to the beginning of the inline task at point. + (end-of-line) + (re-search-backward (format ^\\*\\{%d,\\} org-inlinetask-min-level) nil t) + (when (org-looking-at-p (format ^\\*\\{%d,\\} END org-inlinetask-min-level)) +(re-search-backward + (format ^\\*\\{%d,\\} org-inlinetask-min-level) nil t))) + +(defun org-inlinetask-goto-end () + Go to the end of the inline task at point. + (cond + ((org-looking-at-p (format ^\\*\\{%d,\\} END org-inlinetask-min-level)) +(forward-line 1)) + ((org-looking-at-p (format ^\\*\\{%d,\\} org-inlinetask-min-level)) +(forward-line 1) +(when (org-inlinetask-in-task-p) + (re-search-forward + (format ^\\*\\{%d,\\} END org-inlinetask-min-level) nil t) + (forward-line 1))) + (t +(re-search-forward + (format ^\\*\\{%d,\\} END org-inlinetask-min-level) nil t) +(forward-line 1 + (defvar htmlp) ; dynamically scoped into the next function (defvar latexp) ; dynamically scoped into the next function (defun org-inlinetask-export-handler () diff --git a/lisp/org.el b/lisp/org.el index 201dd87..515764a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3555,6 +3555,8 @@ Normal means no org-mode-specific context. org-agenda (optional end)) (declare-function org-inlinetask-remove-END-maybe org-inlinetask ()) (declare-function org-inlinetask-in-task-p org-inlinetask ()) +(declare-function org-inlinetask-goto-beginning org-inlinetask ()) +(declare-function org-inlinetask-goto-end org-inlinetask ()) (declare-function org-indent-mode org-indent (optional arg)) (declare-function parse-time-string parse-time (string)) (declare-function org-attach-reveal org-attach (optional if-exists)) @@ -16433,6 +16435,7 @@ BEG and END default to the buffer boundaries. (org-defkey org-mode-map \C-c\C-xf'org-footnote-action) (org-defkey org-mode-map \C-c\C-x\C-mg'org-mobile-pull) (org-defkey org-mode-map \C-c\C-x\C-mp'org-mobile-push) +(org-defkey org-mode-map \C-c@ 'org-mark-subtree) (org-defkey org-mode-map [?\C-c (control ?*)] 'org-list-make-subtree) ;;(org-defkey org-mode-map [?\C-c (control ?-)] 'org-list-make-list-from-subtree) @@ -16506,7 +16509,7 @@ BEG and END default to the buffer boundaries. (^ . org-sort) (w . org-refile) (a . org-archive-subtree-default-with-confirmation) -(. . outline-mark-subtree) +(. . org-mark-subtree) (Clock Commands) (I . org-clock-in) (O . org-clock-out) @@ -18653,6 +18656,30 @@ which make use of the date at the cursor. (message Entry marked for action; press `k' at desired date in agenda or calendar)) +(defun org-mark-subtree () + Mark the current subtree. +This puts point at the start of the current subtree, and mark at the end. + +If point is in an inline task, mark that task instead. + (interactive) + (let ((inline-task-p +(and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p))) + (beg)) +;; Get beginning of subtree +(cond + (inline-task-p (org-inlinetask-goto-beginning)) + ((org-at-heading-p) (beginning-of-line)) + (t (outline-previous-visible-heading 1))) +(setq beg (point)) +;; Get end of it +(ifinline-task-p +
[Orgmode] [Bug?] Mark subtrees and inline tasks
#+TITLE: Mark subtree forgets about last line #+AUTHOR:Seb Vauban #+LANGUAGE: en_US * Selecting this subtree To select this subtree, I use =C-c @=. It does its job, except that it never selects the last line. OK; just C-x C-x, add a line, and that's it. Feature? Bug? * The next headline Same problem, though more problematic IMHO, with the inline tasks. *** Check how the selection works I'd expect the END line to be selected as well. It's not. *** END Best regards, Seb -- Sébastien Vauban ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode