emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* undo-tree and org-visibility (was: Re:  whether in drawer?)
@ 2016-04-28 19:47 Samuel Wales
  0 siblings, 0 replies; only message in thread
From: Samuel Wales @ 2016-04-28 19:47 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-orgmode

just changing the subject header.

On 4/28/16, Samuel Wales <samologist@gmail.com> wrote:
> On 4/28/16, Adam Porter <adam@alphapapa.net> wrote:
>> Do you have any other posts talking about this?  I'm interested in
>> fixing this too.  I've run into situations occasionally where undo-tree
>> seems to try to operate on a region or a hidden/folded area, and it just
>> kind of goes bonkers, and I end up having to revert the buffer.  It
>> would be nice to fix this.
>
> i proposed org visibility to the author of undo-tree, who
> did not use org at the time (but might be on this list).
>
> one suggestion i made was that undo-tree could undo and redo
> visibility changes as it goes about its normal operation.
> he thought this would require an emacs change.
>
> we cross-posted it.  stefan said it wouldn't require an
> emacs change, but org could put visibility state information
> into the undo list.
>
> this is intriguing.  dunno if it is feasible.
>
> ===
>
> an alternative is to do what i did, kludge
> undo-tree with hideous, grotesque, misshapen defadvice that
> looks like something your cat dragged in.
>
> the following is unsightly, horror-filled code written over many years
> a few minutes at a time, which works for most cases.
>
> undo-tree still shows too much and confuses me after sorting, and
> closes drawers when undoing, and sometimes does not show the change if
> you do an undo and then a redo (it is supposed to because it is
> supposed to be asymmetric in point placement).
>
> btw, possibly outside the scope of undo-tree and org visibility, org
> has a few glitches where no change shows up as a change.  there are
> also a few slightly disconcerting but pretty harmless cases where
> undo-boundary is set for compound operations like checkbox cookie
> updating.
>
> again probably in org, but maybe in undo-tree, and probably outside
> the scope of visibility, there are also cases, at least with logbook
> entries, in which you can make two separate changes to separate tasks,
> and cannot undo only one of them because there is no undo boundary
> between them.  this violates the hoary old principle of "user
> expectation that you can undo what you did without undoing anything
> else".  i have turned off agenda undo features, so i think it occurs
> with normal operation in org.  perhaps logbook updating has
> post-command-hook fanciness that changes undo behavior?  just a guess.
>
> those i did not attempt to fix.  i am not capable of it.
>
> i include the following monstrous insult to programmer-kind (i am a
> mere user, as if /that's/ an excuse) with glorious comments for your
> amusement.
>
> (defadvice undo-tree-undo (after org-undo-reveal activate compile)
>   "Make point and context visible after an undo command in org-mode."
>   (alpha-org-reveal-for-undo))
> ;; ;; ;;might be nec, perhaps because undo tree moves point to
> ;; ;; ;;other change
> (defadvice undo-tree-redo (after org-redo-reveal activate compile)
>   "Make point and context visible after an undo command in org-mode."
>   (alpha-org-reveal-for-undo))
> (defun alpha-org-reveal-for-undo ()
>   ;; maybe we want seiza canonical if on header, else canonical
>   (save-excursion
>     (when (eq major-mode 'org-mode)
>       (unless (eq last-command this-command)
>         ;; '(undo-tree-undo
>         ;;   undo-tree-redo
>         ;;   ;; self-insert-command
>         ;;   ;; org-self-insert-command
>         ;;   ;; org-shiftmetadown
>         ;;   ;; org-shiftmetaup
>         ;;   ))
>
>         (unless (or (org-at-heading-p)
>                     ;; in drawer
>                     )
>           (alpha-hide-parent))
>         ;; (org-show-entry)
>
>         ;; (org-overview)
>         ;; (recenter)
>         ;; (if (org-at-heading-p)
>         ;;     (save-excursion
>         ;;       (forward-line 1)
>         ;;       (org-show-set-visibility 'canonical))
>         ;;   ;; this creates ellipsis if on headline
>         (org-show-set-visibility 'canonical)
>         ;; (when (org-in-drawer-p) org-flag-drawer nil
>         ;; get rid of that !@#$!@#$ ellipsis at top of window
>         ;;   fixme still need to do this after org-cycle
>         (scroll-lock-previous-line)
>         (scroll-lock-next-line)
>         ))
>     (when (org-truely-invisible-p)
>       (org-show-set-visibility 'canonical))
>     ;; notwork
>     ;; (save-excursion
>     ;;   (move-to-window-line 1)
>     ;;   (redisplay))
>     ))
> ;; (when (org-at-heading-p)
> ;;   ;; (when (outline-invisible-p)
> ;;   '(org-reveal t)
> ;;   (org-show-set-visibility 'canonical))
> ;;   ;; (when (eq last-command 'alpha-org-sort-siblings)
> ;;   (alpha-org-show-children-and-entry))))
> ;;(ad-unadvise 'undo)
> ;; elsewhere (setq org-self-insert-cluster-for-undo nil)
>


-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-04-28 19:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28 19:47 undo-tree and org-visibility (was: Re: whether in drawer?) Samuel Wales

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