emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Note buffer killed unexpectedly
       [not found] <201102241702.p1OH2PKN013160@hormel9.ieee.org>
@ 2011-02-24 21:10 ` Raymond Zeitler
  2011-02-24 23:05   ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Raymond Zeitler @ 2011-02-24 21:10 UTC (permalink / raw)
  To: emacs-orgmode

After typing a note, I pressed C-u C-c C-c and unintentionally killed the
buffer without saving the note.  I should've pressed C-c C-c, but I'm so
used to pressing C-u C-c C-c to refile each new task, that I used that key
combination instead.

Why would adding a prefix argument to C-c C-c kill *Org Note*?

In general I'm nervous about using scratch buffers such as *Org Note* for
anything I wish to save.  Is there an option to auto-save its contents to a
visited file called something like ~/#Org Note#?  Or can I add a
confirmation before I close the buffer?  Perhaps if I modified
org-add-log-note to somehow change the call to
(org-switch-to-buffer-other-window "Org Note")...?

BTW, org-version is set to "TAG=7.01g" -- I haven't upgraded in a few
months.

FWIW, my customizations are on emacswiki:

http://www.emacswiki.org/emacs/RaymondZeitler

TIA for any helpful advice you can give on the matter.

--
Raymond Zeitler <r.zeitler@ieee.org> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Note buffer killed unexpectedly
  2011-02-24 21:10 ` Note buffer killed unexpectedly Raymond Zeitler
@ 2011-02-24 23:05   ` Nick Dokos
  2011-03-03 16:27     ` Raymond Zeitler
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2011-02-24 23:05 UTC (permalink / raw)
  To: Raymond Zeitler; +Cc: nicholas.dokos, emacs-orgmode

Raymond Zeitler <r.zeitler@ieee.org> wrote:

> After typing a note, I pressed C-u C-c C-c and unintentionally killed the
> buffer without saving the note.  I should've pressed C-c C-c, but I'm so
> used to pressing C-u C-c C-c to refile each new task, that I used that key
> combination instead.
> 
> Why would adding a prefix argument to C-c C-c kill *Org Note*?
> 

It seems it's by design: org-store-log-note() contains the following code:

    ...
    (when (or current-prefix-arg org-note-abort)
      (when org-log-into-drawer
	(org-remove-empty-drawer-at
	 (if (stringp org-log-into-drawer) org-log-into-drawer "LOGBOOK")
	 org-log-note-marker))
      (setq lines nil))

so current-prefix-arg causes lines to be set to nil, and the note is just thrown away.

> In general I'm nervous about using scratch buffers such as *Org Note* for
> anything I wish to save.  Is there an option to auto-save its contents to a
> visited file called something like ~/#Org Note#?  Or can I add a
> confirmation before I close the buffer?  Perhaps if I modified
> org-add-log-note to somehow change the call to
> (org-switch-to-buffer-other-window "Org Note")...?
> 

You can try getting rid of the current-prefix-arg and see if you get
into other problems, but only Carsten can say why it is that way to
begin with.

Nick

PS. I did some git archaelogy:

commit 3d2e1c0f04c4bb3eaeb2627d00c8cba6e376f8eb modified things a bit in
this part of the code, but the current-prefix-arg behavior predated
it. The earliest commits I found were commit
2b3fe71634d8afb7e5e6da7606223e82481f0fa8 which added the capability to
add a note interactively and also remotely from the agenda, and commit
fe939ecb95d36377162bf1cb9ce63c2b6047612b which was a massive structure
cleanup/reorg with no substantive code changes, but I think the
org-store-log-note() function existed before the git era.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Note buffer killed unexpectedly
  2011-02-24 23:05   ` Nick Dokos
@ 2011-03-03 16:27     ` Raymond Zeitler
  0 siblings, 0 replies; 3+ messages in thread
From: Raymond Zeitler @ 2011-03-03 16:27 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, r.zeitler

Thank you so much for responding.  This is very helpful!

First I tried getting rid of just current-prefix-arg in that section of
code.  When I byte compiled I got the message "the function `org-note-abort'
is not known to be defined."  And C-u C-c C-c resulted in an error:

Debugger entered--Lisp error: (void-function org-note-abort)
  org-note-abort()
  org-store-log-note()
  org-ctrl-c-ctrl-c(nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)

The buffer was killed and I lost the note.


When I commented out that entire "when" statement that you quoted, C-u C-c
C-c appeared to do the same as C-c C-c, which is good.  I did *not* get 4
identical notes.  Of course, C-c C-k does not kill the note, but I can
always press C-x C-k and achieve the same result.

So for me, note taking is a bit safer with the code removed.  Still the
buffer is only temporary, so any notes must be brief things that can be
executed between interruptions.

I know so little about Org that I daren't issue any sort of change request
to remove the code.  I'd prefer to leave that to someone who's very
knowledgeable about the project.

All the best!

- Ray

PS: Subject changed to replace [Orgmode] with [O] per new convention.

--
Raymond Zeitler <r.zeitler@ieee.org> 



-----Original Message-----
From: nicholas.dokos@hp.com [mailto:nicholas.dokos@hp.com] 
Sent: Thursday, February 24, 2011 6:06 PM
To: Raymond Zeitler
Cc: emacs-orgmode@gnu.org; nicholas.dokos@hp.com
Subject: [education] Re: [Orgmode] Note buffer killed unexpectedly

Raymond Zeitler <r.zeitler@ieee.org> wrote:

> After typing a note, I pressed C-u C-c C-c and unintentionally killed the
> buffer without saving the note.  I should've pressed C-c C-c, but I'm so
> used to pressing C-u C-c C-c to refile each new task, that I used that key
> combination instead.
> 
> Why would adding a prefix argument to C-c C-c kill *Org Note*?
> 

It seems it's by design: org-store-log-note() contains the following code:

    ...
    (when (or current-prefix-arg org-note-abort)
      (when org-log-into-drawer
	(org-remove-empty-drawer-at
	 (if (stringp org-log-into-drawer) org-log-into-drawer "LOGBOOK")
	 org-log-note-marker))
      (setq lines nil))

so current-prefix-arg causes lines to be set to nil, and the note is just
thrown away.

> In general I'm nervous about using scratch buffers such as *Org Note* for
> anything I wish to save.  Is there an option to auto-save its contents to
a
> visited file called something like ~/#Org Note#?  Or can I add a
> confirmation before I close the buffer?  Perhaps if I modified
> org-add-log-note to somehow change the call to
> (org-switch-to-buffer-other-window "Org Note")...?
> 

You can try getting rid of the current-prefix-arg and see if you get
into other problems, but only Carsten can say why it is that way to
begin with.

Nick

PS. I did some git archaelogy:

commit 3d2e1c0f04c4bb3eaeb2627d00c8cba6e376f8eb modified things a bit in
this part of the code, but the current-prefix-arg behavior predated
it. The earliest commits I found were commit
2b3fe71634d8afb7e5e6da7606223e82481f0fa8 which added the capability to
add a note interactively and also remotely from the agenda, and commit
fe939ecb95d36377162bf1cb9ce63c2b6047612b which was a massive structure
cleanup/reorg with no substantive code changes, but I think the
org-store-log-note() function existed before the git era.


-- 
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-03 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <201102241702.p1OH2PKN013160@hormel9.ieee.org>
2011-02-24 21:10 ` Note buffer killed unexpectedly Raymond Zeitler
2011-02-24 23:05   ` Nick Dokos
2011-03-03 16:27     ` Raymond Zeitler

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).