From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Scatter-gather idea Date: Thu, 06 Apr 2017 15:40:40 -0400 Message-ID: References: <87o9wgf376.fsf@bobnewell.net> <87d1cvga4r.fsf@bobnewell.net> <87shlqgldv.fsf@bobnewell.net> <87mvburi99.fsf@alphaville.usersys.redhat.com> <87a87tgzlj.fsf@bobnewell.net> <87a87tqr87.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwDGz-0004bA-9C for emacs-orgmode@gnu.org; Thu, 06 Apr 2017 15:40:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwDGu-0005gG-B7 for emacs-orgmode@gnu.org; Thu, 06 Apr 2017 15:40:49 -0400 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]:34551) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwDGu-0005fm-3d for emacs-orgmode@gnu.org; Thu, 06 Apr 2017 15:40:44 -0400 Received: by mail-qk0-x22b.google.com with SMTP id p68so21283839qke.1 for ; Thu, 06 Apr 2017 12:40:43 -0700 (PDT) In-reply-to: <87a87tqr87.fsf@alphaville.usersys.redhat.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nick Dokos Cc: emacs-orgmode@gnu.org 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 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