emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Preventing (or mitigating) accidental deletion in org-mode
@ 2009-08-23 10:58 Nick Bell
  2009-08-23 12:04 ` Leo
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Nick Bell @ 2009-08-23 10:58 UTC (permalink / raw)
  To: emacs-orgmode

Dear List,

Org-mode is great and I'd like to commit to it. However, I'm held back
by the  apparent fragility of  data stored in org-files.  For example,
it's easy to delete entire folded  trees of data with just a couple of
keystrokes or a mouse click.

It there any way I can confirm all deletions of significant amounts of
data?

I've  tried wimpy-del.el <http://www.emacswiki.org/emacs/wimpy-del.el>
but,  although  it  seems  to  work when  called  directly  (e.g.  M-x
kill-region-wimpy)  it  doesn't intercept  all  other functions  which
might cause data deletion.

I'd appreciate people's thoughts

Nick

-- 
Nick Bell

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

* Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 10:58 Preventing (or mitigating) accidental deletion in org-mode Nick Bell
@ 2009-08-23 12:04 ` Leo
  2009-08-23 12:30   ` Andrew Stribblehill
  2009-08-23 12:20 ` PT
  2009-08-23 14:39 ` Sebastian Rose
  2 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2009-08-23 12:04 UTC (permalink / raw)
  To: emacs-orgmode

On 2009-08-23 11:58 +0100, Nick Bell wrote:
> Org-mode is great and I'd like to commit to it. However, I'm held back
> by the apparent fragility of data stored in org-files. For example,
> it's easy to delete entire folded trees of data with just a couple of
> keystrokes or a mouse click.

This should not be a problem as long as you know how the undo in Emacs
works. You can even use browse-kill-ring¹ to see what you have deleted in
Emacs.

Footnotes: 
¹  http://www.emacswiki.org/emacs/BrowseKillRing
-- 
Emacs uptime: 5 days, 21 hours, 45 minutes, 22 seconds

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

* Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 10:58 Preventing (or mitigating) accidental deletion in org-mode Nick Bell
  2009-08-23 12:04 ` Leo
@ 2009-08-23 12:20 ` PT
  2009-08-23 12:27   ` Nick Bell
  2009-08-23 14:39 ` Sebastian Rose
  2 siblings, 1 reply; 10+ messages in thread
From: PT @ 2009-08-23 12:20 UTC (permalink / raw)
  To: emacs-orgmode

Nick Bell <mail <at> nickbell.org> writes:

> 
> Dear List,
> 
> Org-mode is great and I'd like to commit to it. However, I'm held back
> by the  apparent fragility of  data stored in org-files.  For example,
> it's easy to delete entire folded  trees of data with just a couple of
> keystrokes or a mouse click.
> 

This shouldn't be a big problem, because you have automatic
backup of your org and other files, right?

Combining this with the builtin undo and setting up Emacs' own
backup properly (http://www.emacswiki.org/emacs/ForceBackups)
makes any recent or older version of your org files easily
retrievable, so no information can be lost.

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

* Re: Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 12:20 ` PT
@ 2009-08-23 12:27   ` Nick Bell
  2009-08-23 12:39     ` Leo
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Bell @ 2009-08-23 12:27 UTC (permalink / raw)
  To: PT; +Cc: emacs-orgmode

PT wrote:
> Nick Bell <mail <at> nickbell.org> writes:
>> Org-mode is great and I'd like to commit to it. However, I'm held back
>> by the  apparent fragility of  data stored in org-files.  For example,
>> it's easy to delete entire folded  trees of data with just a couple of
>> keystrokes or a mouse click.
> This shouldn't be a big problem, because you have automatic
> backup of your org and other files, right?

Yes, I have, but I'd like something a bit better.

I'm trying to write a little function using before-save-hook to compare 
the current buffer to the saved version and output the result of 
diffstat, asking the user whether they want to go ahead with the save or 
view the full diff. Or has someone done something like this before?

I suppose one could do this with some kind of before-change- type 
function if feeling particularly paranoid.

-- 
Nick Bell

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

* Re: Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 12:04 ` Leo
@ 2009-08-23 12:30   ` Andrew Stribblehill
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Stribblehill @ 2009-08-23 12:30 UTC (permalink / raw)
  To: Leo; +Cc: emacs-orgmode

2009/8/23 Leo <sdl.web@gmail.com>:
> On 2009-08-23 11:58 +0100, Nick Bell wrote:
>> Org-mode is great and I'd like to commit to it. However, I'm held back
>> by the apparent fragility of data stored in org-files. For example,
>> it's easy to delete entire folded trees of data with just a couple of
>> keystrokes or a mouse click.
>
> This should not be a problem as long as you know how the undo in Emacs
> works. You can even use browse-kill-ring¹ to see what you have deleted in
> Emacs.

...Provided you know that you killed something you didn't intend to.
However, it's easy to kill a tree without noticing it had content.

Maybe we could augment org-kill-line with some optional facility that
checks that it doesn't encompass a collapsed section -- or less
intrusively, emits a message saying it's killed a collapsed section.
I'm having a hard time seeing how to code it though.

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

* Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 12:27   ` Nick Bell
@ 2009-08-23 12:39     ` Leo
  2009-08-23 12:59       ` Nick Bell
  0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2009-08-23 12:39 UTC (permalink / raw)
  To: emacs-orgmode

On 2009-08-23 13:27 +0100, Nick Bell wrote:
> I'm trying to write a little function using before-save-hook to
> compare the current buffer to the saved version and output the result
> of diffstat, asking the user whether they want to go ahead with the
> save or view the full diff. Or has someone done something like this
> before?

See diff-buffer-with-file.

-- 
Emacs uptime: 5 days, 22 hours, 23 minutes, 6 seconds

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

* Re: Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 12:39     ` Leo
@ 2009-08-23 12:59       ` Nick Bell
  0 siblings, 0 replies; 10+ messages in thread
From: Nick Bell @ 2009-08-23 12:59 UTC (permalink / raw)
  To: Leo; +Cc: emacs-orgmode

Leo wrote:
> On 2009-08-23 13:27 +0100, Nick Bell wrote:
>> I'm trying to write a little function using before-save-hook to
>> compare the current buffer to the saved version and output the result
>> of diffstat, asking the user whether they want to go ahead with the
>> save or view the full diff. Or has someone done something like this
>> before?
> 
> See diff-buffer-with-file.

Yes, that was the idea. I was going to hook a function into 
before-save-hook which does pipe diff -u $1 $2 | diffstat and  show the 
result in some kind of minibuffer. Not sure how to set $1 and $2 (in 
fact, I've never written any elisp at all). I don't suppose anyone could 
whip up the code in a moment or two? ;-)

Nick

-- 
Nick Bell

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

* Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 10:58 Preventing (or mitigating) accidental deletion in org-mode Nick Bell
  2009-08-23 12:04 ` Leo
  2009-08-23 12:20 ` PT
@ 2009-08-23 14:39 ` Sebastian Rose
  2009-08-23 18:39   ` Russell Adams
  2 siblings, 1 reply; 10+ messages in thread
From: Sebastian Rose @ 2009-08-23 14:39 UTC (permalink / raw)
  To: Nick Bell; +Cc: emacs-orgmode

Nick Bell <mail@nickbell.org> writes:
> It there any way I can confirm all deletions of significant amounts of
> data?
>
> I've  tried wimpy-del.el <http://www.emacswiki.org/emacs/wimpy-del.el>
> but,  although  it  seems  to  work when  called  directly  (e.g.  M-x
> kill-region-wimpy)  it  doesn't intercept  all  other functions  which
> might cause data deletion.

Re-bind keys like C-w et al in org-mode-hook?


Untested:


(defun org/wimpy-kill-setup ()
  "Re-bind keys, that remove a significant amount of data."
  (define-key org-mode-map [(control ?w)] 'kill-region-wimpy)
  ;; ...
)

(add-hook 'org-mode-hook 'org-/wimpy-kill-setup)



  Sebastian

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

* Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 14:39 ` Sebastian Rose
@ 2009-08-23 18:39   ` Russell Adams
  2009-08-23 18:45     ` Nick Bell
  0 siblings, 1 reply; 10+ messages in thread
From: Russell Adams @ 2009-08-23 18:39 UTC (permalink / raw)
  To: emacs-orgmode

You're recreating what version control is for.

I have my org-files setup in a Bazaar repo, and if any changes were
made it auto-commits hourly via cron. I can also manually commit.

Prior to committing, I can press C-x v = to see a diff of what has
changes, and the Bazaar tools make it easy to step backward through
the history to see changes.

Version control is your backup and your protection against data loss.

On Sun, Aug 23, 2009 at 04:39:16PM +0200, Sebastian Rose wrote:
> Nick Bell <mail@nickbell.org> writes:
> > It there any way I can confirm all deletions of significant amounts of
> > data?
> >
> > I've  tried wimpy-del.el <http://www.emacswiki.org/emacs/wimpy-del.el>
> > but,  although  it  seems  to  work when  called  directly  (e.g.  M-x
> > kill-region-wimpy)  it  doesn't intercept  all  other functions  which
> > might cause data deletion.
> 
> Re-bind keys like C-w et al in org-mode-hook?
> 
> 
> Untested:
> 
> 
> (defun org/wimpy-kill-setup ()
>   "Re-bind keys, that remove a significant amount of data."
>   (define-key org-mode-map [(control ?w)] 'kill-region-wimpy)
>   ;; ...
> )
> 
> (add-hook 'org-mode-hook 'org-/wimpy-kill-setup)
> 
> 
> 
>   Sebastian
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 


------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

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

* Re: Preventing (or mitigating) accidental deletion in org-mode
  2009-08-23 18:39   ` Russell Adams
@ 2009-08-23 18:45     ` Nick Bell
  0 siblings, 0 replies; 10+ messages in thread
From: Nick Bell @ 2009-08-23 18:45 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams wrote:
> You're recreating what version control is for.

I don't need all the functionality of version control, just a check 
against the last saved version to make sure I haven't inadvertently 
deleted too much.

I've used Hg and bzr in the past and they work fine but I don't think I 
need them for this.

> Version control is your backup and your protection against data loss.

It's *a* form of backup. Another might be more appropriate.

Thanks for the input

Nick

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

end of thread, other threads:[~2009-08-23 18:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-23 10:58 Preventing (or mitigating) accidental deletion in org-mode Nick Bell
2009-08-23 12:04 ` Leo
2009-08-23 12:30   ` Andrew Stribblehill
2009-08-23 12:20 ` PT
2009-08-23 12:27   ` Nick Bell
2009-08-23 12:39     ` Leo
2009-08-23 12:59       ` Nick Bell
2009-08-23 14:39 ` Sebastian Rose
2009-08-23 18:39   ` Russell Adams
2009-08-23 18:45     ` Nick Bell

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