[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Scatter-gather idea
From: |
John Kitchin |
Subject: |
Re: [O] Scatter-gather idea |
Date: |
Thu, 06 Apr 2017 15:40:40 -0400 |
User-agent: |
mu4e 0.9.19; emacs 25.1.1 |
I am sympathetic to not wanting to use tags here. It would be tedious to
tag them all, and then remove them (my opinion of course;). Here is some
code that you can "mark" headlines with a speed command (M on a headline
start) or interactively. This just stores a marker to the headline in a
global variable. Then, use M-x scatter-gather to put them all into one
temporary buffer. From there you can manipulate them any way you want,
and save the result anyway you want. You could modify scatter-gather to
either copy or move the headlines.
You could also use overlays to indicate a headline had been marked, and
make some convenience functions to remove headlines from the list, but I
leave those for exercises ;)
This code is lightly tested.
#+BEGIN_SRC emacs-lisp
(defvar scatter-gather-markers '()
"List of markers where headlines are for gathering.")
(defun scatter-gather-mark-heading ()
"Add the current headline to `scatter-gather-markers'."
(interactive)
(unless (org-at-heading-p)
(outline-previous-heading))
(add-to-list 'scatter-gather-markers (point-marker)))
(defun scatter-gather ()
"Gather marked headlines into a temporary buffer"
(interactive)
(when scatter-gather-markers
(switch-to-buffer-other-window (get-buffer-create "*scatter-gather*"))
(loop for marker in (reverse scatter-gather-markers)
do
(insert (with-current-buffer (marker-buffer marker)
(save-excursion
(goto-char (marker-position marker))
(org-mark-subtree)
(buffer-substring (point) (mark))))))
(setq scatter-gather-markers '())))
(add-to-list 'org-speed-commands-user (cons "M" 'scatter-gather-mark-heading))
#+END_SRC
Nick Dokos writes:
> Bob Newell <address@hidden> writes:
>
>>>> mark them with tags, and do org-tags-view. Or, you can use regex or other
>>>> criteria if you like.
>>>>
>>>
>>> That was my first thought too: I didn't think any extra functionality is
>>> needed.
>>
>> I looked into this earlier but agenda bulk marking doesn't seem to work
>> in an arbitrary org-mode buffer; it must be an agenda buffer, and you
>> can only mark certain entries.
>>
>> The tag idea may be the best way. Thanks to all for the replies.
>
> Yes, sorry: I was talking about tags, not about agenda bulk-marking. Although
> you
> can add an arbitrary org file to the agend with `C-c [', do what you need to
> do,
> and then remove it with `C-c ]'.
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
- [O] Bug: Can't execute C code block from remote directory [9.0.5 (release_9.0.5-401-g86ff11 @ /Users/xcy/src/org-mode/lisp/)], Chunyang Xu, 2017/04/01
- [O] Scatter-gather idea, Bob Newell, 2017/04/01
- Re: [O] Scatter-gather idea, John Kitchin, 2017/04/01
- Re: [O] Scatter-gather idea, Bob Newell, 2017/04/01
- Re: [O] Scatter-gather idea, Samuel Wales, 2017/04/02
- Re: [O] Scatter-gather idea, Bob Newell, 2017/04/03
- Re: [O] Scatter-gather idea, Yasushi SHOJI, 2017/04/05
- Re: [O] Scatter-gather idea, Nick Dokos, 2017/04/05
- Re: [O] Scatter-gather idea, Bob Newell, 2017/04/06
- Re: [O] Scatter-gather idea, Nick Dokos, 2017/04/06
- Re: [O] Scatter-gather idea,
John Kitchin <=
- Re: [O] Scatter-gather idea, Daniel Clemente, 2017/04/10
Re: [O] Scatter-gather idea, Bingo, 2017/04/01
Re: [O] Bug: Can't execute C code block from remote directory [9.0.5 (release_9.0.5-401-g86ff11 @ /Users/xcy/src/org-mode/lisp/)], Chunyang Xu, 2017/04/03