Re: [O] edit-src on read-only files
Hi Bastien, thanks again for implementing this! Bastien writes: > Hi Andreas, > > Andreas Leha writes: > >> thanks for taking this up! But I am not sure, whether I like the >> current implementation too much. Instead of saving the org-file itself, >> I'd prefer the org-file to be auto-saved. > > You can use auto-save-mode then. > I changed the `buffer-auto-save-file-name' so that > it's unique and shows the date of the auto-save. This is very nice! I've actually meant to have the parent org-buffer auto-saved including the changes in any open source buffer. But this is really good as well. And a much simpler solution. > > I also deactivated the timer for auto-saving into > the buffer where the source code lives, as it is > a bit too intrusive IMO. I agree. I've also disabled this and -- given the better auto-saving mechanism (which gets disabled by saving) -- won't use any more. Thanks again, Andreas
Re: [O] edit-src on read-only files
Hi Bastien, thanks again for implementing this! Bastien writes: > Hi Andreas, > > Andreas Leha writes: > >> thanks for taking this up! But I am not sure, whether I like the >> current implementation too much. Instead of saving the org-file itself, >> I'd prefer the org-file to be auto-saved. > > You can use auto-save-mode then. > I changed the `buffer-auto-save-file-name' so that > it's unique and shows the date of the auto-save. This is very nice! I've actually meant to have the parent org-buffer auto-saved including the changes in any open source buffer. But this is really good as well. And a much simpler solution. > > I also deactivated the timer for auto-saving into > the buffer where the source code lives, as it is > a bit too intrusive IMO. I agree. I've also disabled this and -- given the better auto-saving mechanism (which gets disabled by saving) -- won't use any more. Thanks again, Andreas
Re: [O] edit-src on read-only files
Hi Andreas, Andreas Leha writes: > thanks for taking this up! But I am not sure, whether I like the > current implementation too much. Instead of saving the org-file itself, > I'd prefer the org-file to be auto-saved. You can use auto-save-mode then. I changed the `buffer-auto-save-file-name' so that it's unique and shows the date of the auto-save. I also deactivated the timer for auto-saving into the buffer where the source code lives, as it is a bit too intrusive IMO. Thanks! -- Bastien
Re: [O] edit-src on read-only files
Hi Bastien, Bastien writes: > Hi Andreas, > > Andreas Leha writes: > >> On a related note: I'd also love to see the changes in the >> source code buffers be autosaved in the org file. I've lost some big >> edits already due to power loss on my (old) laptop. > > There is now `org-edit-src-auto-save-idle-delay' which you can > set to >0 so that the edit src buffer will be saved after N secs > of idle time. > > Thanks for suggesting this, thanks for taking this up! But I am not sure, whether I like the current implementation too much. Instead of saving the org-file itself, I'd prefer the org-file to be auto-saved. More importantly, the current implementation prevents me from discarding the edit with the new C-c C-k (org-edit-src-abort). I am not sure how to overcome those limitations (especially the second one), though. So I fear, I won't be able to provide a patch implementing my preferred behaviour. Regards, Andreas
Re: [O] edit-src on read-only files
Hi Andreas, Andreas Leha writes: > On a related note: I'd also love to see the changes in the > source code buffers be autosaved in the org file. I've lost some big > edits already due to power loss on my (old) laptop. There is now `org-edit-src-auto-save-idle-delay' which you can set to >0 so that the edit src buffer will be saved after N secs of idle time. Thanks for suggesting this, -- Bastien
Re: [O] edit-src on read-only files
>> it seems like org-mode should prevent that. >Yes, this is now the case in master. Thanks! great -- thank you!!
Re: [O] edit-src on read-only files
Hi Greg, Greg Minshall writes: > hi. i use RCS on my .org files. it's happened to me more than once (>1 > ==> "shame on me") that i've entered "C-c '" on a read-only .org file, > spent some time editing the source code fragment, then done "C-c '", > only to lose my edits, as the original buffer was read-only. > > it seems like org-mode should prevent that. Yes, this is now the case in master. Thanks! -- Bastien
Re: [O] edit-src on read-only files
Hi all, Eric S Fraga writes: > Greg Minshall writes: > >> hi. i use RCS on my .org files. it's happened to me more than once (>1 >> ==> "shame on me") that i've entered "C-c '" on a read-only .org file, >> spent some time editing the source code fragment, then done "C-c '", >> only to lose my edits, as the original buffer was read-only. > > Yes, I share your shame... this has happened to me more than once as > well. Thank you for the simple solution which I have installed! > I have installed that as well. Very nice thanks. > But you are correct that org should check for this case. Or at least > provide a mechanism for saving the source code block elsewhere... Seconded. On a related note: I'd also love to see the changes in the source code buffers be autosaved in the org file. I've lost some big edits already due to power loss on my (old) laptop. Cheers, Andreas
Re: [O] edit-src on read-only files
Greg Minshall writes: > hi. i use RCS on my .org files. it's happened to me more than once (>1 > ==> "shame on me") that i've entered "C-c '" on a read-only .org file, > spent some time editing the source code fragment, then done "C-c '", > only to lose my edits, as the original buffer was read-only. Yes, I share your shame... this has happened to me more than once as well. Thank you for the simple solution which I have installed! But you are correct that org should check for this case. Or at least provide a mechanism for saving the source code block elsewhere... eric -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org 7.9.3e-904-g338046
[O] edit-src on read-only files
hi. i use RCS on my .org files. it's happened to me more than once (>1 ==> "shame on me") that i've entered "C-c '" on a read-only .org file, spent some time editing the source code fragment, then done "C-c '", only to lose my edits, as the original buffer was read-only. it seems like org-mode should prevent that. but, in the meantime, i've put the following in my .emacs, which seems to prevent this. note that this *also* prevents "C-c '" in cases where it isn't harmful: looking at included files, following links, etc. (i.e., functions that don't -- as far as i know -- modify the file whence they were invoked.) i tried putting the advice around the main culprits (org-table-edit-formulas, org-edit-src-code, and org-edit-fixed-width-region), but 1) i don't know how to "loop" in elisp 'special' mode (so i didn't have to repeat the same lines three times); 2) for some reason (wasn't loaded?), org-table-edit-formulas wasn't taking the advice; 3) i don't use those other functions. anyway, fwiw, here's this: ;; in org-mode, make sure we don't edit-special a read-only file... (defadvice org-edit-special (around make-sure-writable) "make sure the source buffer is writable before allowing src-edit" (if buffer-read-only (display-warning :error "attempting to src-edit a read-only file...") ad-do-it)) (ad-activate 'org-edit-special)