emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-orgmode@gnu.org
Subject: Re: How to do proper folding and semantic markup
Date: Tue, 5 Apr 2016 23:56:16 +0000 (UTC)	[thread overview]
Message-ID: <loom.20160406T013429-866@post.gmane.org> (raw)
In-Reply-To: 871t6j69gf.fsf@mercovich.net

Eduardo Mercovich <eduardo <at> mercovich.net> writes:

> Excuse me if this sounds almost philosophical, but in which situation an
> indirect buffer may be better that just focusing on the same (original)
> buffer? For example, when you are toying with potentially big
> modifications and don't want to replace the original? Is it like opening
> a parallel path to try things without worries?
> 
> I know it's far from the original question, but it seems interesting to
> understand the possibilities. :)

An excellent question.  :)  I've been thinking about writing an article or
something about this, but I'll give a quick explanation here.

For years I've used Evernote on an irregular basis (they have been steadily
regressing the UI across all platforms), and one of the things I do like
about it is that each note is independent of the other notes in the
database.  When I'm editing one note, I only see that note, and I can only
change that note.  

In Org, since I keep my notes in a few large files, it means that when I
jump to a heading, I also see all the surrounding headings.  Sometimes
that's what I want, like if I'm editing a document, but when I jump to a
random entry in my inbox.org file, the headings surrounding it are
completely unrelated to the one I'm looking at, and they get in the way.

So by jumping to an entry in an indirect buffer, I see only that entry, and
I can't modify any other nodes.  It means I can treat each entry
independently, view and edit them separately, etc.

In this way it resembles the way Evernote presents notes independently, but
with all the power and flexibility of Org and Emacs.

I put functions in org-bookmark-heading and helm-org-rifle to jump to
entries in indirect buffers by pressing <C-return> (by default), but I also
do this in Agenda views with this code:

  (defun ap/org-agenda-goto-heading-in-indirect-buffer (&optional switch-to)
    "Go to the current agenda headline in an indirect buffer. If SWITCH-TO
is non-nil, close the org-agenda window."
    (interactive)
    (if switch-to
        (org-agenda-switch-to)
      (org-agenda-goto))
    (org-tree-to-indirect-buffer)
  
    ;; Put the non-indirect buffer at the bottom of the prev-buffers
    ;; list so it won't be selected when the indirect buffer is killed
    (set-window-prev-buffers nil (append (cdr (window-prev-buffers))
                                         (car (window-prev-buffers)))))
  
  (defun ap/org-agenda-switch-to-heading-in-indirect-buffer ()
    (interactive)

To me this is a very powerful and flexible way of working with Org files,
one that I think deserves wider exposure.  Org files can be thought of not
only as outlined documents but as collections of individual, unrelated
entries that can be viewed and edited independently.

(I also confess that it gives me some peace of mind, because a few times I
have accidentally hit the wrong keys and deleted parts of an Org file that I
didn't mean to.  Most of the time I immediately undo it and no harm is done,
but one time I didn't realize it until days or weeks later, and I had to
pull it out of an earlier commit in my org directory's git repo.)

Hope this helps!  Let me know if you have any other questions or ideas.  :)

  parent reply	other threads:[~2016-04-05 23:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 20:44 How to do proper folding and semantic markup Eduardo Mercovich
2016-03-30 21:52 ` Thomas S. Dye
2016-04-01  0:11   ` Eduardo Mercovich
2016-03-31  8:10 ` Christian Moe
2016-04-01  0:39   ` Eduardo Mercovich
2016-04-01  7:48     ` Eric S Fraga
2016-04-01 12:33       ` Eduardo Mercovich
2016-04-04  5:21 ` Adam Porter
2016-04-04 15:01   ` Eduardo Mercovich
2016-04-05  4:19     ` Adam Porter
2016-04-05 21:18       ` Eduardo Mercovich
2016-04-05 22:04         ` Nick Dokos
2016-04-06 12:59           ` Eduardo Mercovich
2016-04-05 23:56         ` Adam Porter [this message]
2016-04-06 12:58           ` Eduardo Mercovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20160406T013429-866@post.gmane.org \
    --to=adam@alphapapa.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).