emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to do proper folding and semantic markup


From: Adam Porter
Subject: Re: [O] How to do proper folding and semantic markup
Date: Tue, 5 Apr 2016 04:19:43 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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

> Also less known that it deserves, for focusing I do use narrowing a lot:

Yeah, that's basically what tree-to-indirect does, it makes an indirect
buffer and then narrows it.  So you can widen the indirect buffer and get
another view of the whole buffer.  

I also use this advice to rename the indirect buffer to the name of the
heading, that way you don't end up with "file.org<1>"-style buffers:

(defun ap/org-rename-tree-to-indirect-buffer (&rest args)
    "Rename the new buffer to the current org heading after using
org-tree-to-indirect-buffer."
    (with-current-buffer (car (buffer-list (car (frame-list))))
      (save-excursion
        (let* ((heading (nth 4 (org-heading-components)))
               (name (if (string-match org-bracket-link-regexp heading)
                         ;; Heading is an org link; use link name
                         ;; TODO: but what if only part of the heading is?
                         (match-string 3 heading)
                       ;; Not a link; use whole heading
                       heading)))
          (rename-buffer name) t))))
  (advice-add 'org-tree-to-indirect-buffer :after
'ap/org-rename-tree-to-indirect-buffer)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]