[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Org-edit-special and C-x C-s strange behavior
From: |
Leo Alekseyev |
Subject: |
Re: [O] Org-edit-special and C-x C-s strange behavior |
Date: |
Wed, 11 Jan 2012 22:56:42 -0600 |
On Wed, Jan 11, 2012 at 7:40 PM, Leo Alekseyev <address@hidden> wrote:
>> Eric S Fraga <address@hidden> writes:
>>>
>>> What version of org are you using? I ask because I used to experience
>>> the annoyance you describe a while back; more recently (since at least a
>>> few months ago), hitting C-x C-s no longer has any negative impact: it
>>> saves the file, or at least appears to.
>>>
>>> You still have to C-c ' to get back to the full buffer, mind you, but
>>> that's better, IMO, than changing the behaviour of such a fundamental
>>> key binding as C-x C-s.
>
> It appears that this bug is Emacs-version dependent: it functions as
> you describe with 23.2, but the buffer gets buried (with an error
> message "basic-save-buffer: Wrong type argument: stringp, nil") in
> 24.0.92. Org mode is the current git HEAD. I tried to step through
> basic-save-buffer in edebug, but I couldn't catch the error (I'm not
> very experienced with edebug). Can someone test this on Emacs 24 and
> confirm what I'm seeing?
I've done some more digging into why this is broken. I see a few
issues, but no clear indication of where the problem is. This,
however, should be fixed: pressing C-x C-s should not break window
configuration.
On Emacs 24, with latest Org:
1. Somehow, (org-edit-src-save) screws up the window configuration and
buries the source edit buffer. It appears that save-window-excursion
is not restoring windows correctly. What's going on exactly is
unclear: in the process of getting saved, the source edit buffer is
killed and subsequently restored with (org-src-switch-to-buffer
buffer 'edit). Maybe this doesn't play well with
save-window-excursion in Emacs 24?
I stepped through the calls in Emacs 23 and 24, and it all looks
identical -- except for in 24, the call to save-window-excursion does
not in fact restore windows.
2. In file.el:4435 (basic-save-buffer)
(nthcdr 10 (file-attributes buffer-file-name)) often leads to
wrong-type-argument error. The reason for this is that
buffer-file-name sometimes corresponds to the "base" .org buffer (no
error in this case), sometimes it corresponds to the name of the
src-edit buffer and sometimes it's nil (leads to wrong-type-argument
error). By this point, the file should have been written using
'write-contents-functions that is set to (org-edit-src-save), so I
don't know if this error is important (nonetheless, buffer-file-name
should probably be valid).
3. Related, in the same function:
(if (or (buffer-modified-p)
;; handle the case when no modification has been made but
;; the file disappeared since visited
(and buffer-file-name
(not (file-exists-p buffer-file-name))))
This if statement is always triggered, because buffer-file-name is not
nil, and because the buffer doesn't correspond to the file. (Note
that in Emacs 23 this was just (if (buffer-modified-p)...). This is
not be the appropriate behavior, but it persists because
buffer-file-name is not nil (which it probably should be).
--l
- [O] Org-edit-special and C-x C-s strange behavior, Leo Alekseyev, 2012/01/11
- Re: [O] Org-edit-special and C-x C-s strange behavior, Eric S Fraga, 2012/01/11
- Re: [O] Org-edit-special and C-x C-s strange behavior, Andreas Leha, 2012/01/11
- Re: [O] Org-edit-special and C-x C-s strange behavior, Leo Alekseyev, 2012/01/11
- Re: [O] Org-edit-special and C-x C-s strange behavior,
Leo Alekseyev <=
- Re: [O] Org-edit-special and C-x C-s strange behavior, Eric S Fraga, 2012/01/12
- Re: [O] Org-edit-special and C-x C-s strange behavior, Andreas Leha, 2012/01/12
- Re: [O] Org-edit-special and C-x C-s strange behavior, Leo Alekseyev, 2012/01/12
- Message not available
- Re: [O] Org-edit-special and C-x C-s strange behavior, Leo Alekseyev, 2012/01/13
- Re: [O] Org-edit-special and C-x C-s strange behavior, Bastien, 2012/01/24