5

I sometimes edit org files in non-org-mode. (e.g artist mode).

Upon returning to org-mode, it will mess with the fold/collapse state. E.g it will collapse all headers so that I loose my current spot and have to find it again.

I tried editing org-startup-folded and tried all the 4 options, but all of these mess with the collapse state in some way or another. I cannot find an option to leave expanded state as is when loading org-mode.

Is this possible?

  • 2
    You may wish to consider using an indirect buffer for artist mode stuff, which will permit you to have different modes in each buffer. You may also be interested in the function show-all. – lawlist Jun 8 '15 at 15:53
  • Thank you for the tip about the indirect buffer. That actually works rather well. There hasn't been a reply on this and I don't think there seems to be away either. If you post an answer I'll accept it as the solution. – Leo Ufimtsev Jun 15 '15 at 18:32
3

The following snippet shows (in part) what happens when org-mode is enabled: . . . (unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility)) . . . The variable org-inhibit-startup-visibility-stuff is undocumented (i.e., there is no doc-string) and it has an initial default value of nil. The original poster may wish to try globally setting this variable to t as follows:

(setq org-inhibit-startup-visibility-stuff t)

The following should also work by setting org-inhibit-startup-visibility-stuff to t on a let-bound -- temporary -- basis:

(defun enable-org-mode ()
"Turn on org-mode with `org-inhibit-startup-visibility-stuff' set to `t` on
a let-bound -- i.e., temporary -- basis."
(interactive)
  (let ((org-inhibit-startup-visibility-stuff t))
    (org-mode)))

If the original poster prefers not using the undocumented variable org-inhibit-startup-visibility-stuff, an alternative solution would be to use an indirect-buffer when working in artist-mode:

M-x make-indirect-buffer RET base-buffer RET indirect-name RET

The link to the manual that describes indirect-buffer is as follows: http://www.gnu.org/software/emacs/manual/html_node/emacs/Indirect-Buffers.html


It may behoove someone to send an email to the org-mode team suggesting that they document the variable org-inhibit-startup-visibility-stuff.

  • Unfortunatley the org-inhibit-startup-visibility-stuff didn't have an impact, but I hacked myself something together with the indirect buffer suggestion that kinda works. – Leo Ufimtsev Jun 18 '15 at 17:42
0

Instead of org-startup-folded, use an equivalent in-buffer setting to force org-mode to one of the four states. For example, insert this line at the top of the org file:

#+STARTUP: showeverything

and you will be able to open the org file fully expanded. As long as you don't edit that line while in artist mode, you'll get the behavior as specified in startup directive.

  • The issue here is that it changes the current fold state. showeverything expands everything. I would like org-mode not to change the exapand state when it re-loads or get's activated from antother mod like artist mod. – Leo Ufimtsev Jun 15 '15 at 18:30
  • @LeoUfimtsev, what you describe is the default behavior. That means you have to unset the org-startup-folded state in your current org-mode setup. You may also have to look into anything else changing that var (for example through your init file). Apologies if I've misunderstood your problem. – Emacs User Jun 15 '15 at 18:55
  • In the sense that either one of the 4 options for #+STARTUP: will change the fold state in some way or another. I'm looking for a way for it to leave the buffer 'as is' when re-loading org-mode. – Leo Ufimtsev Jun 15 '15 at 19:07
  • Then don't use any #+STARTUP or init or customization settings to alter that behavior. By default org-mode leaves everything 'as is.' Those settings are used when you do not want 'as is'. Hope this clarifies. – Emacs User Jun 15 '15 at 19:21
  • 1
    Actually, the default behavior that occurs when enabling org-mode is as follows: . . . (unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility)) . . . For more details on what is actually happening when enabling org-mode, type M-x find-function RET org-mode RET and also type M-x find-function RET org-set-startup-visibility RET and review the source code. – lawlist Jun 15 '15 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.