* doing `M-x org-mode' loses point
@ 2006-06-16 14:41 Eduardo Ochs
2006-06-16 19:17 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: Eduardo Ochs @ 2006-06-16 14:41 UTC (permalink / raw)
To: emacs-orgmode
Hello list,
Suppose that I have a file with a structure like this:
* an org header
(some elisp code)
* another org header
(more elisp code)
* another org header
(more elisp code)
In a file like that it would be natural to switch between org-mode and
emacs-lisp-mode; M-x emacs-lisp-mode works as expected, but when I do
M-x org-mode the point moves to the first header line, and that
doesn't look like the right thing...
One solution that just occurred to me is to have a line like this in
each elisp block:
;; (progn (save-excursion (org-mode)) (reveal-post-command))
by executing it with C-x C-e (*) I can switch back to org-mode without
losing point... the next obvious steps - binding that to a key,
patching org-mode, etc, are not relevant here, so I won't talk about
them...
So, is this org-mode-jumps-to-the-first-header-line a bug or a
feature? Is there a standard workaround?
Thanks in advance, cheers,
Eduardo Ochs
http://angg.twu.net/
eduardoochs@gmail.com
(*): We need this: (autoload 'reveal-post-command "reveal"))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: doing `M-x org-mode' loses point
2006-06-16 14:41 doing `M-x org-mode' loses point Eduardo Ochs
@ 2006-06-16 19:17 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2006-06-16 19:17 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: emacs-orgmode
On Jun 16, 2006, at 16:41, Eduardo Ochs wrote:
>
> So, is this org-mode-jumps-to-the-first-header-line a bug or a
> feature? Is there a standard workaround?
Org-mode repositions the curser when it changes the visibility in a
buffer, to make sure that the screen is used when you switch to
overview mode, for example.
The change you see is because when switching to org-mode, the default
setting is to hide everything except for top-level headlines. So
visibility is changed when you enter org-mode, and consequently the
cursor moves.
In your case, changeing the visibility is as unwanted as moving the
cursor. You can turn this off globally with
(setq org-startup-folded nil)
Or turn it off for just this buffer by adding this line to the file:
#+STARTUP: showall
If you generally dislike the cursor motion after visibility change, you
can also do
(setq org-cycle-hook nil)
Hope this helps.
- Carsten
--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-16 19:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-16 14:41 doing `M-x org-mode' loses point Eduardo Ochs
2006-06-16 19:17 ` Carsten Dominik
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).