From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Using Org for browsing and managing buffers Date: Fri, 16 Apr 2010 10:22:18 -0400 Message-ID: <87wrw7pjdx.fsf@stats.ox.ac.uk> References: <87aatda0gv.fsf@stats.ox.ac.uk> <877ho8tnru.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O2mRK-0002ci-3w for emacs-orgmode@gnu.org; Fri, 16 Apr 2010 10:22:38 -0400 Received: from [140.186.70.92] (port=45135 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2mRH-0002b9-7b for emacs-orgmode@gnu.org; Fri, 16 Apr 2010 10:22:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O2mRC-0008JK-Ct for emacs-orgmode@gnu.org; Fri, 16 Apr 2010 10:22:34 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:64177) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O2mR7-0008IH-Hj for emacs-orgmode@gnu.org; Fri, 16 Apr 2010 10:22:30 -0400 In-Reply-To: (Livin Stephen Sharma's message of "Fri, 16 Apr 2010 12:41:08 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Livin Stephen Sharma Cc: emacs-org-mode-help gnu Livin Stephen Sharma writes: > yep, now it works! > Thanks > > About moving up/down: > =C2=A0I was a bit surprised that 'p' was not a counterpart of 'n' (the la= tter works > exactly like 'n' in Org-Agenda) > > Then I saw that in my setup (*no* customizations), there is some duplicat= ion in > the functions mapped to 'p' and 'P': Hi, I've been working on improving the key bindings, in discussion with Eric Fraga. It looks like you have loaded the new code into a system already running the old code, and the keymap has ended up as a hybrid between the two. The simplest thing would be to restart emacs. I don't know of another way to reliably make sure that all the necessary variables get reset. With the new bindings you will have p and n for movement as well as a bunch of other bindings from `org-speed-commands-default'. Thanks for trying it out! Dan > > > > > key =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 binding > > --- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ------- > > > > SPC org-buffers-display-buffer > > . org-buffers-switch-to-buffer > > ? org-buffers-help > > B org-buffers-list:by > > H org-buffers-toggle-headings > > P org-buffers-toggle-properties > > T org-buffers-columns-view > > b org-buffers-list:by > > c org-buffers-columns-view > > d org-buffers-tag-for-deletion > > g org-buffers-list:refresh > > h org-buffers-toggle-headings > > o org-buffers-switch-to-buffer-other-window > > p org-buffers-toggle-properties > > q bury-buffer > > u org-buffers-remove-tags > > x org-buffers-execute-pending-operations > > org-buffers-follow-link > > > > > On 16 April 2010 02:51, Dan Davison wrote: > > Livin Stephen Sharma writes: > > > Am I the only one encountering: > > > > =C2=A0 =C2=A0 org-buffers-list: Invalid function: org-buffers-state= -get > > I haven't seen that error, but I may have been doing something incorr= ect > (with macros). I've got rid of them now; let me know if you still get > the error. > > Code file: http://github.com/dandavison/org-buffers/raw/master/ > org-buffers.el > Git repo: =C2=A0http://github.com/dandavison/org-buffers > > Thanks, > > Dan > > > > > > > > > > I do see many people are using this successfully > > :) > > > > Livin Stephen > > > > > > > > On Apr 09, 2010, at 06:47:20 , Dan Davison wrote: > > > > > > =C2=A0 =C2=A0 I've been working on an Org tool to browse Emacs buff= ers. Emacs has > the > > =C2=A0 =C2=A0 function list-buffers (C-x C-b), where you can view a= list of > buffers, > > =C2=A0 =C2=A0 delete buffers, etc. This is intended to be a replace= ment for > > =C2=A0 =C2=A0 list-buffers, implemented in Org-mode. > > > > =C2=A0 =C2=A0 The code is attached, and there's a git repo at > > =C2=A0 =C2=A0 http://github.com/dandavison/org-buffers > > > > =C2=A0 =C2=A0 After putting the code in your load-path and doing > > =C2=A0 =C2=A0 (require 'org-buffers), use the function `org-buffers= -list' to create > > =C2=A0 =C2=A0 the listing buffer. This is a read-only Org-mode buff= er populated > with > > =C2=A0 =C2=A0 links to open buffers. Information is stored for each= buffer using > > =C2=A0 =C2=A0 properties. By default, the buffers are grouped by ma= jor mode. Here's > a > > =C2=A0 =C2=A0 screenshot. > > > > =C2=A0 =C2=A0 http://www.princeton.edu/~ddavison/org-buffers/by-maj= or-mode.png > > > > =C2=A0 =C2=A0 The buffer has some special key-bindings: > > > > =C2=A0 =C2=A0 +----------------------------------------------------= ----------+ > > =C2=A0 =C2=A0 | ? =C2=A0 | Show all keybindings =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 | > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | g =C2=A0 | Update buffer (prefix arg does hard rese= t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | b =C2=A0 | Select a different property to group by = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | RET | follow link to buffer on this line =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | d =C2=A0 | Mark buffer for deletion =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 | > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | u =C2=A0 | Remove mark =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | x =C2=A0 | Delete marked buffers =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0| > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | o =C2=A0 | Like RET (see variable org-buffers-follo= w-link-method) | > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | . =C2=A0 | Like RET but switch to buffer in same wi= ndow =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | h =C2=A0 | toggle between headings and plain entrie= s for buffers =C2=A0| > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | p =C2=A0 | toggle in-buffer properties on/off =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | > > =C2=A0 =C2=A0 |-----+----------------------------------------------= ----------| > > =C2=A0 =C2=A0 | c =C2=A0 | Switch to column-view =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0| > > =C2=A0 =C2=A0 +----------------------------------------------------= ----------+ > > > > =C2=A0 =C2=A0 If there's an active region, d and u operate on all b= uffers in the > > =C2=A0 =C2=A0 region. > > > > =C2=A0 =C2=A0 Some variables that can be configured: > > =C2=A0 =C2=A0 - org-buffers-buffer-properties > > =C2=A0 =C2=A0 - org-buffers-excluded-modes > > =C2=A0 =C2=A0 - org-buffers-excluded-buffers > > =C2=A0 =C2=A0 - org-buffers-follow-link-method > > =C2=A0 =C2=A0 - org-buffers-mode-hook > > =C2=A0 =C2=A0 - org-buffers-buffer-name > > > > =C2=A0 =C2=A0 Some possible extensions: > > =C2=A0 =C2=A0 - Browse recent files using recentf > > =C2=A0 =C2=A0 - Allow several buffers to be marked for side-by-side= display > > =C2=A0 =C2=A0 - Maintain folding configuration across buffer updates > > =C2=A0 =C2=A0 - Make faster > > > > =C2=A0 =C2=A0 As always, any feedback, suggestions and patches will= be very > welcome! > > > > =C2=A0 =C2=A0 Dan > > > > =C2=A0 =C2=A0 p.s. The column-view mode works for following links, = but does need > > =C2=A0 =C2=A0 further attention. > > > > =C2=A0 =C2=A0 ;;; org-buffers.el --- An Org-mode tool for buffer ma= nagement > > > > =C2=A0 =C2=A0 ;; Copyright (C) 2010 =C2=A0Dan Davison > > > > =C2=A0 =C2=A0 ;; Author: Dan Davison > > =C2=A0 =C2=A0 ;; Keywords: outlines, hypermedia, calendar, wp > > =C2=A0 =C2=A0 ;; Homepage: http://orgmode.org > > > > =C2=A0 =C2=A0 ;;; License: > > > > =C2=A0 =C2=A0 ;; This program is free software; you can redistribut= e it and/or > modify > > =C2=A0 =C2=A0 ;; it under the terms of the GNU General Public Licen= se as published > by > > =C2=A0 =C2=A0 ;; the Free Software Foundation; either version 3, or= (at your > option) > > =C2=A0 =C2=A0 ;; any later version. > > =C2=A0 =C2=A0 ;; > > =C2=A0 =C2=A0 ;; This program is distributed in the hope that it wi= ll be useful, > > =C2=A0 =C2=A0 ;; but WITHOUT ANY WARRANTY; without even the implied= warranty of > > =C2=A0 =C2=A0 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOS= E. =C2=A0See the > > =C2=A0 =C2=A0 ;; GNU General Public License for more details. > > =C2=A0 =C2=A0 ;; > > =C2=A0 =C2=A0 ;; You should have received a copy of the GNU General= Public License > > =C2=A0 =C2=A0 ;; along with GNU Emacs; see the file COPYING. =C2=A0= If not, write to the > > =C2=A0 =C2=A0 ;; Free Software Foundation, Inc., 51 Franklin Street= , Fifth Floor, > > =C2=A0 =C2=A0 ;; Boston, MA 02110-1301, USA. > > > > =C2=A0 =C2=A0 ;;; Commentary: > > > > =C2=A0 =C2=A0 ;;; Code: > > > > =C2=A0 =C2=A0 (require 'org) > > =C2=A0 =C2=A0 (require 'cl) > > > > =C2=A0 =C2=A0 ;;; Variables > > =C2=A0 =C2=A0 (defvar org-buffers-buffer-name > > =C2=A0 =C2=A0 =C2=A0"*Buffers*" > > =C2=A0 =C2=A0 =C2=A0"Name of buffer in which buffer list is display= ed") > > > > =C2=A0 =C2=A0 (defvar org-buffers-state > > =C2=A0 =C2=A0 =C2=A0'((:by . "major-mode") (:atom . heading) (:prop= erties . nil)) > > =C2=A0 =C2=A0 =C2=A0"Association list specifiying the current state= of org-buffers.") > > > > =C2=A0 =C2=A0 (defvar org-buffers-follow-link-method 'org-open-at-p= oint > > =C2=A0 =C2=A0 =C2=A0"Method used to follow link with RET. Must be o= ne of > > > > =C2=A0 =C2=A0 'org-open-at-point :: use `org-open-at-point' to foll= ow link. > > =C2=A0 =C2=A0 'current-window =C2=A0 =C2=A0:: use switch-to-buffer > > =C2=A0 =C2=A0 'other-window =C2=A0 =C2=A0 =C2=A0:: use switch-to-bu= ffer-other-window > > > > =C2=A0 =C2=A0 Setting this variable to 'current-window makes the be= haviour more > > =C2=A0 =C2=A0 consistent with that of `Buffer-menu-mode' and `dired= -mode'") > > > > =C2=A0 =C2=A0 (defvar org-buffers-buffer-properties > > =C2=A0 =C2=A0 =C2=A0'(("buffer-name" . (buffer-name)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0("major-mode" . (let ((mode (symbol-name= major-mode))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (string-match "-mode$" mode) > > =C2=A0 =C2=A0 =C2=A0(replace-match "" nil t mode) mode))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0("buffer-file-name" . (buffer-file-name)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0("default-directory" . default-directory) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0("buffer-modified-p" . (format "%s" (buf= fer-modified-p)))) > > =C2=A0 =C2=A0 =C2=A0"Association list specifying properties to be s= tored for each > > =C2=A0 =C2=A0 buffer. The car of each element is the name of the pr= operty, and > > =C2=A0 =C2=A0 the cdr is an expression which, when evaluated in the= buffer, > > =C2=A0 =C2=A0 yields the property value.") > > > > =C2=A0 =C2=A0 (defcustom org-buffers-excluded-buffers > > =C2=A0 =C2=A0 =C2=A0`("*Completions*" ,org-buffers-buffer-name) > > =C2=A0 =C2=A0 =C2=A0"List of names of buffers that should not be li= sted by > > =C2=A0 =C2=A0 =C2=A0org-buffers-list." > > =C2=A0 =C2=A0 =C2=A0:group 'org-buffers) > > > > =C2=A0 =C2=A0 (defcustom org-buffers-excluded-modes nil > > =C2=A0 =C2=A0 =C2=A0"List of names of major-modes (strings) that sh= ould not be listed > > =C2=A0 =C2=A0 =C2=A0by org-buffers-list." > > =C2=A0 =C2=A0 =C2=A0:group 'org-buffers) > > > > =C2=A0 =C2=A0 ;;; Mode > > =C2=A0 =C2=A0 (defvar org-buffers-mode-map (make-sparse-keymap)) > > > > =C2=A0 =C2=A0 (defvar org-buffers-mode-hook nil > > =C2=A0 =C2=A0 =C2=A0"Hook for functions to be called after buffer l= isting is > > =C2=A0 =C2=A0 =C2=A0created. Note that the buffer is read-only, so = if the hook > > =C2=A0 =C2=A0 =C2=A0function is to modify the buffer it should use = a let binding to > > =C2=A0 =C2=A0 =C2=A0temporarily bind buffer-read-only to nil.") > > > > =C2=A0 =C2=A0 (define-minor-mode org-buffers-mode > > =C2=A0 =C2=A0 =C2=A0"An Org-mode tool for buffer management. > > =C2=A0 =C2=A0 \\{org-buffers-mode-map}" > > =C2=A0 =C2=A0 =C2=A0nil " buffers" nil > > =C2=A0 =C2=A0 =C2=A0(org-set-local 'org-tag-alist '(("delete" . ?d)= )) > > =C2=A0 =C2=A0 =C2=A0(org-set-local'org-tags-column -50) > > =C2=A0 =C2=A0 =C2=A0(org-set-local 'org-columns-default-format "%25= buffer-name(Buffer) > > =C2=A0 =C2=A0 %25major-mode(Mode) %25default-directory(Dir) %5buffe= r-modified-p > (Modified) > > =C2=A0 =C2=A0 ") > > =C2=A0 =C2=A0 =C2=A0(add-hook 'kill-buffer-hook 'org-buffers-reset-= state nil 'local)) > > > > =C2=A0 =C2=A0 (defun org-buffers-help () > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(describe-function 'org-buffers-mode)) > > > > =C2=A0 =C2=A0 ;;; Keys > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map [(return)] 'org-buff= ers-follow-link) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "b" 'org-buffers-lis= t:by) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "c" 'org-buffers-col= umns-view) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "d" 'org-buffers-tag= -for-deletion) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "g" 'org-buffers-lis= t:refresh) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "." 'org-buffers-swi= tch-to-buffer) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "h" 'org-buffers-tog= gle-headings) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "o" > > =C2=A0 =C2=A0 'org-buffers-switch-to-buffer-other-window) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "p" 'org-buffers-tog= gle-properties) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "u" 'org-buffers-rem= ove-tags) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "x" > > =C2=A0 =C2=A0 'org-buffers-execute-pending-operations) > > =C2=A0 =C2=A0 (define-key org-buffers-mode-map "?" 'org-buffers-hel= p) > > =C2=A0 =C2=A0 ;;; Listing and view cycling > > > > =C2=A0 =C2=A0 (defun org-buffers-list (&optional refresh frame) > > =C2=A0 =C2=A0 =C2=A0"Create an Org-mode listing of Emacs buffers. > > =C2=A0 =C2=A0 By default, buffers are grouped by major mode. Option= al > > =C2=A0 =C2=A0 argument FRAME specifies the frame whose buffers shou= ld be > > =C2=A0 =C2=A0 listed." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(pop-to-buffer > > =C2=A0 =C2=A0 =C2=A0 (or > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(and (not refresh) (get-buffer org-buffe= rs-buffer-name)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((org-buffers-p (equal (buffer-name) > org-buffers-buffer-name)) > > =C2=A0 =C2=A0 =C2=A0(by (or (org-buffers-state-get :by) "major-mode= ")) > > =C2=A0 =C2=A0 =C2=A0(atom (org-buffers-state-get :atom)) target) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when org-buffers-p > > =C2=A0 =C2=A0 (if (and (org-before-first-heading-p) (not (org-on-he= ading-p))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(outline-next-heading)) > > =C2=A0 =C2=A0 (setq target > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(condition-case nil (org-make-org= -heading-search-string) (error > > =C2=A0 =C2=A0 nil)))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(with-current-buffer (get-buffer-= create org-buffers-buffer-name) > > =C2=A0 =C2=A0 (setq buffer-read-only nil) > > =C2=A0 =C2=A0 (erase-buffer) > > =C2=A0 =C2=A0 (org-mode) > > =C2=A0 =C2=A0 (dolist > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(buffer > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (sort (remove-if 'org-buffers-exclude-p > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar 'buffer-name (buffer-list= frame))) 'string<)) > > =C2=A0 =C2=A0 =C2=A0(org-insert-heading t) > > =C2=A0 =C2=A0 =C2=A0(insert > > =C2=A0 =C2=A0 =C2=A0 (org-make-link-string (concat "buffer:" buffer= ) buffer) "\n") > > =C2=A0 =C2=A0 =C2=A0(dolist (pair (org-buffers-get-buffer-props buf= fer)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-set-property (car pair) (cdr pair))= )) > > =C2=A0 =C2=A0 (org-buffers-set-state '((:atom . heading))) > > =C2=A0 =C2=A0 (goto-char (point-min)) > > =C2=A0 =C2=A0 (unless (equal by "NONE") (org-buffers-group-by by)) > > =C2=A0 =C2=A0 (if target (condition-case nil (org-link-search targe= t) (error nil))) > > =C2=A0 =C2=A0 (beginning-of-line) > > =C2=A0 =C2=A0 (if (equal by "NONE") > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-overview) > > =C2=A0 =C2=A0 =C2=A0(case atom > > =C2=A0 =C2=A0 =C2=A0 =C2=A0('heading (progn (org-overview) (org-con= tent))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0('line (progn (show-all) (org-buffers-to= ggle-headings))))) > > =C2=A0 =C2=A0 (save-excursion > > =C2=A0 =C2=A0 =C2=A0(mark-whole-buffer) > > =C2=A0 =C2=A0 =C2=A0(indent-region (point-min) (point-max))) > > =C2=A0 =C2=A0 (org-buffers-mode) > > =C2=A0 =C2=A0 (setq buffer-read-only t) > > =C2=A0 =C2=A0 (current-buffer)))))) > > > > =C2=A0 =C2=A0 (defun org-buffers-list:refresh (&optional arg) > > =C2=A0 =C2=A0 =C2=A0"Refresh org-buffers listing." > > =C2=A0 =C2=A0 =C2=A0(interactive "P") > > =C2=A0 =C2=A0 =C2=A0(if arg (org-buffers-reset-state)) > > =C2=A0 =C2=A0 =C2=A0(org-buffers-list 'refresh)) > > > > =C2=A0 =C2=A0 (defun org-buffers-list:by (&optional prop) > > =C2=A0 =C2=A0 =C2=A0"Group buffers according to value of property P= ROP." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(let ((buffer-read-only nil) > > =C2=A0 =C2=A0 (headings-p (org-buffers-state-eq :atom 'heading))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless (org-buffers-state-get :properti= es) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-toggle-properties)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-set-state > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 `((:by . > > =C2=A0 =C2=A0 =C2=A0 =C2=A0,(or prop > > =C2=A0 =C2=A0 (org-completing-read > > =C2=A0 =C2=A0 =C2=A0"Property to group by: " > > =C2=A0 =C2=A0 =C2=A0(cons "NONE" (mapcar 'car org-buffers-buffer-pr= operties))))))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-list 'refresh) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless headings-p (org-buffers-toggle-h= eadings)))) > > > > =C2=A0 =C2=A0 (defun org-buffers-toggle-properties () > > =C2=A0 =C2=A0 =C2=A0"Toggle entry properties in org-buffers listing= buffer. > > =C2=A0 =C2=A0 Removing properties may provide a less cluttered appe= arance for > > =C2=A0 =C2=A0 browsing. However, in-buffer properties will be resto= red during > > =C2=A0 =C2=A0 certain operations, such as `org-buffers-list:by'." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(if (org-buffers-state-get :properties) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(progn (org-buffers-delete-proper= ties) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (show-all) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-buffers-set-state '((:properties .= nil)))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-set-state > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 '((:atom . heading) (:properties . t))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-list 'refresh))) > > > > =C2=A0 =C2=A0 (defun org-buffers-toggle-headings () > > =C2=A0 =C2=A0 =C2=A0"Toggle viewing of buffers as org headings. > > =C2=A0 =C2=A0 Headings will be automatically restored during certain > > =C2=A0 =C2=A0 operations, such as setting deletion tags." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(let ((buffer-read-only nil) > > =C2=A0 =C2=A0 (headings-p (org-buffers-state-eq :atom 'heading)) > > =C2=A0 =C2=A0 (flat-p (org-buffers-state-eq :by "NONE"))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (and headings-p (org-buffers-state-g= et :properties)) > > =C2=A0 =C2=A0 (org-buffers-toggle-properties)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char (point-min)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (and (or headings-p (not flat= -p)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (not (outline-on-heading-p))) > > =C2=A0 =C2=A0 =C2=A0(outline-next-heading)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if flat-p > > =C2=A0 =C2=A0 =C2=A0(progn > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(push-mark (point) 'nomsg 'activate) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(end-of-buffer) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-ctrl-c-star) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(pop-mark)) > > =C2=A0 =C2=A0 (while (not (eobp)) > > =C2=A0 =C2=A0 =C2=A0(push-mark > > =C2=A0 =C2=A0 =C2=A0 (save-excursion (forward-line 1) (point)) 'nom= sg 'activate) > > =C2=A0 =C2=A0 =C2=A0(org-forward-same-level 1) > > =C2=A0 =C2=A0 =C2=A0(org-ctrl-c-star) > > =C2=A0 =C2=A0 =C2=A0(pop-mark))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mark-whole-buffer) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(indent-region (point-min) (point= -max))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-set-state > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 `((:atom . ,(if headings-p 'line 'headi= ng)))))) > > > > =C2=A0 =C2=A0 (defun org-buffers-delete-properties () > > =C2=A0 =C2=A0 =C2=A0(let ((buffer-read-only nil)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char (point-min)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-delete-regions > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (nreverse > > =C2=A0 =C2=A0 (org-buffers-map-entries 'org-buffers-get-property-bl= ock)))))) > > > > =C2=A0 =C2=A0 (defun org-buffers-get-property-block () > > =C2=A0 =C2=A0 =C2=A0"Return the (beg . end) range of the property d= rawer. > > =C2=A0 =C2=A0 Unlike the org version the limits include the keyword= s delimiting > > =C2=A0 =C2=A0 the drawer." > > =C2=A0 =C2=A0 =C2=A0(let ((beg (point)) > > =C2=A0 =C2=A0 (end (progn (outline-next-heading) (point)))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char beg) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (re-search-forward org-property-draw= er-re end t) > > =C2=A0 =C2=A0 (cons (match-beginning 1) (match-end 0))))) > > > > =C2=A0 =C2=A0 (defun org-buffers-group-by (property) > > =C2=A0 =C2=A0 =C2=A0"Group top level headings according to the valu= e of PROPERTY." > > =C2=A0 =C2=A0 =C2=A0(let ((atom (org-buffers-state-get :atom))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char (point-min)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapc (lambda (subtree) ;; Create= subtree for each value of > `property' > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-insert-heading t) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (> (org-buffers-outline-level= ) 1) > > =C2=A0 =C2=A0 =C2=A0(org-promote)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(insert (car subtree) "\n") > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-insert-subheading t) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapc 'org-buffers-insert-parsed-= entry (cdr subtree))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(prog1 > > =C2=A0 =C2=A0 (mapcar (lambda (val) ;; Form list of parsed entries = for each unique > value > > =C2=A0 =C2=A0 of `property' > > =C2=A0 =C2=A0 =C2=A0(cons val (org-buffers-parse-selected-entries p= roperty val))) > > =C2=A0 =C2=A0 (sort > > =C2=A0 =C2=A0 (delete-dups (org-buffers-map-entries (lambda () (org= -entry-get nil > > =C2=A0 =C2=A0 property nil)))) > > =C2=A0 =C2=A0 'string<)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(erase-buffer)))))) > > > > =C2=A0 =C2=A0 (defun org-buffers-exclude-p (buffer) > > =C2=A0 =C2=A0 =C2=A0"Return non-nil if BUFFER should not be listed." > > =C2=A0 =C2=A0 =C2=A0(or (member (with-current-buffer buffer major-m= ode) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0org-buffers-excluded-modes) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(member buffer org-buffers-exclud= ed-buffers) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(string=3D (substring buffer 0 1)= " "))) > > > > =C2=A0 =C2=A0 (defun org-buffers-reset-state () > > =C2=A0 =C2=A0 =C2=A0(org-buffers-set-state > > =C2=A0 =C2=A0 =C2=A0 '((:by . "major-mode") (:atom . heading) (:pro= perties . nil)))) > > > > =C2=A0 =C2=A0 (defun org-buffers-columns-view () > > =C2=A0 =C2=A0 =C2=A0"View buffers in Org-mode columns view. > > =C2=A0 =C2=A0 This is currently experimental. RET can be used to fo= llow links > > =C2=A0 =C2=A0 in the first column, but certain other org-buffers ke= ys conflict > > =C2=A0 =C2=A0 with column-view or otherwise do not work correctly." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(let ((by (org-buffers-state-get :by)) > > =C2=A0 =C2=A0 (buffer-read-only nil)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless (equal by "NONE") (org-buffers-l= ist:by "NONE")) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless (org-buffers-state-get :properti= es) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-toggle-properties)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless (equal by "NONE") > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char (point-min)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-sort-entries-or-items nil ?r= nil nil by) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-overview)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(mark-whole-buffer) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-columns))) > > > > =C2=A0 =C2=A0 ;;; Parsing and inserting entries > > =C2=A0 =C2=A0 (defun org-buffers-parse-selected-entries (prop val) > > =C2=A0 =C2=A0 =C2=A0"Parse all entries with property PROP value VAL= ." > > =C2=A0 =C2=A0 =C2=A0(delq nil > > =C2=A0 =C2=A0 (org-buffers-map-entries > > =C2=A0 =C2=A0 (lambda () (when (equal (org-entry-get nil prop) val) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cons (org-get-heading) (org-get-= entry))))))) > > > > =C2=A0 =C2=A0 (defun org-buffers-insert-parsed-entry (entry) > > =C2=A0 =C2=A0 =C2=A0"Insert a parsed entry" > > =C2=A0 =C2=A0 =C2=A0(unless (org-at-heading-p) (org-insert-heading)) > > =C2=A0 =C2=A0 =C2=A0(insert (car entry) "\n") > > =C2=A0 =C2=A0 =C2=A0(if (org-buffers-state-get :properties) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(insert (cdr entry)))) > > > > =C2=A0 =C2=A0 (defun org-buffers-get-buffer-props (buffer) > > =C2=A0 =C2=A0 =C2=A0"Create alist of properties of BUFFER, as strin= gs." > > =C2=A0 =C2=A0 =C2=A0(with-current-buffer buffer > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda (pair) (cons (car pair) (eval (= cdr pair)))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 org-buffers-buffer-properties))) > > > > =C2=A0 =C2=A0 ;;; Follow-link behaviour > > > > =C2=A0 =C2=A0 (defun org-buffers-follow-link () > > =C2=A0 =C2=A0 =C2=A0"Follow link to buffer on this line. > > =C2=A0 =C2=A0 The buffer-switching behaviour of this function is de= termined by > > =C2=A0 =C2=A0 the variable `org-buffers-follow-link-method'. See al= so > > =C2=A0 =C2=A0 `org-buffers-switch-to-buffer' and > > =C2=A0 =C2=A0 `org-buffers-switch-to-buffer-other-window', whose be= haviour is > > =C2=A0 =C2=A0 hard-wired." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(org-buffers-switch-to-buffer-generic > org-buffers-follow-link-method)) > > > > =C2=A0 =C2=A0 (defun org-buffers-switch-to-buffer () > > =C2=A0 =C2=A0 "Switch to this entry's buffer in current window." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(org-buffers-switch-to-buffer-generic 'current-= window)) > > > > =C2=A0 =C2=A0 (defun org-buffers-switch-to-buffer-other-window () > > =C2=A0 =C2=A0 =C2=A0"Switch to this entry's buffer in other window." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(org-buffers-switch-to-buffer-generic 'other-wi= ndow)) > > > > =C2=A0 =C2=A0 (defun org-buffers-switch-to-buffer-generic (method) > > =C2=A0 =C2=A0 =C2=A0(save-excursion > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((atom (org-buffers-state-get :atom= )) buffer) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cond > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((eq atom 'heading) (org-back-to= -heading)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (t (beginning-of-line))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq buffer (org-buffers-get-buf= fer-name)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (get-buffer buffer) > > =C2=A0 =C2=A0 =C2=A0(case method > > =C2=A0 =C2=A0 =C2=A0 =C2=A0('org-open-at-point (org-open-at-point)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0('current-window (switch-to-buffer buffe= r)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0('other-window (switch-to-buffer-other-w= indow buffer))) > > =C2=A0 =C2=A0 (error "No such buffer: %s" buffer))))) > > > > =C2=A0 =C2=A0 (defun org-buffers-get-buffer-name () > > =C2=A0 =C2=A0 =C2=A0"Get buffer-name for current entry." > > =C2=A0 =C2=A0 =C2=A0(let ((headings-p (org-buffers-state-eq :atom '= heading))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(or (and headings-p (org-entry-get nil "= buffer-name")) > > =C2=A0 =C2=A0 (and (save-excursion > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if headings-p (org-back-to-head= ing)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (re-search-forward "\\[\\[buffer= :\\([^\]]*\\)" (point-at-eol) > t)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-link-unescape (match-string 1)))))) > > > > =C2=A0 =C2=A0 ;;; Setting tags and executing operations > > > > =C2=A0 =C2=A0 (defun org-buffers-tag-for-deletion () > > =C2=A0 =C2=A0 =C2=A0"Mark buffer for deletion. > > =C2=A0 =C2=A0 If a region is selected, all buffers in the region ar= e marked for > > =C2=A0 =C2=A0 deletion. Buffers marked for deletion can be deleted = using > > =C2=A0 =C2=A0 `org-buffers-execute-pending-operations'." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(org-buffers-set-tags '("delete"))) > > > > =C2=A0 =C2=A0 (defun org-buffers-remove-tags () > > =C2=A0 =C2=A0 =C2=A0"Remove deletion marks from buffers. > > =C2=A0 =C2=A0 If a region is selected, marks are removed from all b= uffers in > > =C2=A0 =C2=A0 the region." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(org-buffers-set-tags nil)) > > > > =C2=A0 =C2=A0 (defun org-buffers-set-tags (data) > > =C2=A0 =C2=A0 =C2=A0"Set tags to DATA at all non top-level headings= in region. > > =C2=A0 =C2=A0 DATA should be a list of strings. If DATA is nil, rem= ove all tags > > =C2=A0 =C2=A0 at such headings." > > =C2=A0 =C2=A0 =C2=A0(let* ((buffer-read-only nil) > > =C2=A0 =C2=A0 (region-p (org-region-active-p)) > > =C2=A0 =C2=A0 (beg (if region-p (region-beginning) (point))) > > =C2=A0 =C2=A0 (end (if region-p (region-end) (point))) > > =C2=A0 =C2=A0 (headings-p (org-buffers-state-eq :atom 'heading))beg= -line end-line) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq beg-line (progn (goto-char = beg) (org-current-line)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0end-line (progn (goto-char end) (org-cur= rent-line))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if headings-p > > =C2=A0 =C2=A0 =C2=A0(setq > > =C2=A0 =C2=A0 =C2=A0 end (if (and region-p (not (eq end-line beg-li= ne)) (not (eobp))) > > =C2=A0 =C2=A0 =C2=A0 (progn (goto-char end) (org-back-to-heading) (= point)) > > =C2=A0 =C2=A0 (progn (outline-end-of-heading) (point))) > > =C2=A0 =C2=A0 =C2=A0 beg (progn (goto-char beg) (point-at-bol))) > > =C2=A0 =C2=A0 (org-buffers-toggle-headings) ;; doesn't alter line n= umbers > > =C2=A0 =C2=A0 (setq beg (progn (org-goto-line beg-line) (point-at-b= ol)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end (if (eq end-line beg-line) (p= oint-at-eol) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(progn (org-goto-line end-line) (point-a= t-bol))))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(narrow-to-region beg end) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char (point-min)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-map-entries > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda () > > =C2=A0 =C2=A0 (when (or (org-buffers-state-eq :by "NONE") > > =C2=A0 =C2=A0 =C2=A0 (> (org-outline-level) 1)) > > =C2=A0 =C2=A0 =C2=A0 (org-set-tags-to > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(if data (delete-duplicates (append data= (org-get-tags)) :test > > =C2=A0 =C2=A0 'string-equal)))))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(widen) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-content)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless region-p > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(outline-next-heading) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless (or (> (org-outline-level= ) 1) (org-buffers-state-eq :by > > =C2=A0 =C2=A0 "NONE")) > > =C2=A0 =C2=A0 (outline-next-heading))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless headings-p (org-bu= ffers-toggle-headings)))) > > > > =C2=A0 =C2=A0 (defun org-buffers-execute-pending-operations () > > =C2=A0 =C2=A0 =C2=A0"Execute all pending operations. > > =C2=A0 =C2=A0 Currently the only type of operation supported is > > =C2=A0 =C2=A0 deletion. Buffers are tagged for deletion using > > =C2=A0 =C2=A0 `org-buffers-tag-for-deletion'. Remove such tags from= buffers > > =C2=A0 =C2=A0 using `org-buffers-remove-tags'." > > =C2=A0 =C2=A0 =C2=A0(interactive) > > =C2=A0 =C2=A0 =C2=A0(let ((buffer-read-only nil) > > =C2=A0 =C2=A0 (headings-p (org-buffers-state-eq :atom 'heading)) bu= ffer) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless headings-p (org-buffers-toggle-h= eadings)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-delete-regions > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (nreverse > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-buffers-map-entries > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda () > > =C2=A0 =C2=A0 (if (setq buffer (org-buffers-get-buffer-name)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (not (kill-buffer buffer)) > > =C2=A0 =C2=A0 (error "Failed to kill buffer %s" buffer) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (and (org-first-sibling-p) > > =C2=A0 =C2=A0 (not (save-excursion (org-goto-sibling)))) > > =C2=A0 =C2=A0 =C2=A0 (org-up-heading-safe)) ;; Only child so delete= parent also > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cons (point) (1+ (org-end-of-su= btree)))))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "+delete"))) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless headings-p (org-buffers-toggle-h= eadings)))) > > > > =C2=A0 =C2=A0 ;;; Utilities > > > > =C2=A0 =C2=A0 (defun org-buffers-map-entries (func &optional match) > > =C2=A0 =C2=A0 =C2=A0(org-scan-tags > > =C2=A0 =C2=A0 =C2=A0 func (if match (cdr (org-make-tags-matcher mat= ch)) t))) > > > > =C2=A0 =C2=A0 (defun org-buffers-set-state (state) > > =C2=A0 =C2=A0 =C2=A0"Add STATE to global state list. > > =C2=A0 =C2=A0 New settings have precedence over existing ones." > > =C2=A0 =C2=A0 =C2=A0(mapc > > =C2=A0 =C2=A0 =C2=A0 (lambda (pair) (unless (assoc (car pair) state) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(add-to-list 'state pair))) > > =C2=A0 =C2=A0 =C2=A0 org-buffers-state) > > =C2=A0 =C2=A0 =C2=A0(setq org-buffers-state state)) > > > > =C2=A0 =C2=A0 (defmacro org-buffers-delete-regions (regions) > > =C2=A0 =C2=A0 =C2=A0"Delete regions in list. > > =C2=A0 =C2=A0 REGIONS is a list of (beg . end) cons cells specifyin= g buffer > > =C2=A0 =C2=A0 regions." > > =C2=A0 =C2=A0 =C2=A0`(mapc (lambda (pair) (if pair (delete-region (= car pair) (cdr > pair)))) > > =C2=A0 =C2=A0 ,regions)) > > > > =C2=A0 =C2=A0 (defmacro org-buffers-state-get (key) > > =C2=A0 =C2=A0 =C2=A0`(cdr (assoc ,key org-buffers-state))) > > > > =C2=A0 =C2=A0 (defmacro org-buffers-state-eq (key val) > > =C2=A0 =C2=A0 =C2=A0`(equal (org-buffers-state-get ,key) ,val)) > > > > =C2=A0 =C2=A0 (defmacro org-buffers-outline-level () > > =C2=A0 =C2=A0 =C2=A0'(save-excursion (beginning-of-line) (org-outli= ne-level))) > > > > =C2=A0 =C2=A0 ;;; Links to buffers > > > > =C2=A0 =C2=A0 (org-add-link-type "buffer" 'display-buffer) > > =C2=A0 =C2=A0 (add-hook 'org-store-link-functions 'org-buffers-stor= e-link) > > > > =C2=A0 =C2=A0 (defun org-buffers-store-link (&optional force) > > =C2=A0 =C2=A0 =C2=A0"Store a link to an Emacs buffer. > > =C2=A0 =C2=A0 Returns nil by default, to avoid hijacking other link= types." > > =C2=A0 =C2=A0 =C2=A0(if force > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let* ((target (buffer-name)) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (desc target) link) > > =C2=A0 =C2=A0 (org-store-link-props :type "buffer") > > =C2=A0 =C2=A0 (setq link (org-make-link "buffer:" target)) > > =C2=A0 =C2=A0 (org-add-link-props :link link :description desc) > > =C2=A0 =C2=A0 link))) > > > > =C2=A0 =C2=A0 (provide 'org-buffers) > > =C2=A0 =C2=A0 ;;; org-buffers.el ends here > > =C2=A0 =C2=A0 _______________________________________________ > > =C2=A0 =C2=A0 Emacs-orgmode mailing list > > =C2=A0 =C2=A0 Please use `Reply All' to send replies to the list. > > =C2=A0 =C2=A0 Emacs-orgmode@gnu.org > > =C2=A0 =C2=A0 http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > > > > _______________________________________________ > > 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 > > > _______________________________________________ > 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