emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [WORG] How to ediff folded Org files?
@ 2013-04-06  9:47 Thorsten Jolitz
  2013-04-06 20:20 ` Marc-Oliver Ihm
  2013-07-31 23:19 ` Ratish Punnoose
  0 siblings, 2 replies; 12+ messages in thread
From: Thorsten Jolitz @ 2013-04-06  9:47 UTC (permalink / raw)
  To: emacs-orgmode


Hi List, 

many files on Worg have this startup option:

,--------------------------
| +STARTUP:    ... fold ...
`--------------------------

what leads to trouble when there is a merge-conflict in (Ma)git to be
resolved manually with e(diff), because the different versions of the
Org-file are then presented in folded state in the ediff session, so the
diffs are invisible.

But when I call 'show-all' or so on them, it breaks the ediff session. 
Is there a simple trick to avoid this problem?

PS 
I don't recieve any new messages from my gmane groups any more since
yesterday - am I the only one?

-- 
cheers,
Thorsten

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

* Re: [WORG] How to ediff folded Org files?
  2013-04-06  9:47 [WORG] How to ediff folded Org files? Thorsten Jolitz
@ 2013-04-06 20:20 ` Marc-Oliver Ihm
  2013-04-06 21:32   ` Thorsten Jolitz
  2013-07-31 23:19 ` Ratish Punnoose
  1 sibling, 1 reply; 12+ messages in thread
From: Marc-Oliver Ihm @ 2013-04-06 20:20 UTC (permalink / raw)
  To: Thorsten Jolitz, emacs-orgmode

Hi,

if I need to ediff two org-files, I just switch their buffers back to fundamental mode temporarily.
Not elegant, but works.

regards, Marc


Am 06.04.2013 11:47, schrieb Thorsten Jolitz:
>
> Hi List,
>
> many files on Worg have this startup option:
>
> ,--------------------------
> | +STARTUP:    ... fold ...
> `--------------------------
>
> what leads to trouble when there is a merge-conflict in (Ma)git to be
> resolved manually with e(diff), because the different versions of the
> Org-file are then presented in folded state in the ediff session, so the
> diffs are invisible.
>
> But when I call 'show-all' or so on them, it breaks the ediff session.
> Is there a simple trick to avoid this problem?
>
> PS
> I don't recieve any new messages from my gmane groups any more since
> yesterday - am I the only one?
>

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

* Re: [WORG] How to ediff folded Org files?
  2013-04-06 20:20 ` Marc-Oliver Ihm
@ 2013-04-06 21:32   ` Thorsten Jolitz
  2013-04-06 22:24     ` Michael Brand
  0 siblings, 1 reply; 12+ messages in thread
From: Thorsten Jolitz @ 2013-04-06 21:32 UTC (permalink / raw)
  To: emacs-orgmode

Marc-Oliver Ihm <marc@ihm.name> writes:

Hi,

> if I need to ediff two org-files, I just switch their buffers back to
> fundamental mode temporarily. Not elegant, but works.

the problem is, if I call e (ediff) from Magit and want to merge (e.g.)
my branch with the master branch, I don't really have access to both
versions - only to the version from the checked out branch.

ediff then gives me both versions in an ediff session (folded), but if I
try to change major-mode to fundamental I break the ediff session. 

> Am 06.04.2013 11:47, schrieb Thorsten Jolitz:
>>
>> Hi List,
>>
>> many files on Worg have this startup option:
>>
>> ,--------------------------
>> | +STARTUP:    ... fold ...
>> `--------------------------
>>
>> what leads to trouble when there is a merge-conflict in (Ma)git to be
>> resolved manually with e(diff), because the different versions of the
>> Org-file are then presented in folded state in the ediff session, so the
>> diffs are invisible.
>>
>> But when I call 'show-all' or so on them, it breaks the ediff session.
>> Is there a simple trick to avoid this problem?
>>
>> PS
>> I don't recieve any new messages from my gmane groups any more since
>> yesterday - am I the only one?

-- 
cheers,
Thorsten

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

* Re: [WORG] How to ediff folded Org files?
  2013-04-06 21:32   ` Thorsten Jolitz
@ 2013-04-06 22:24     ` Michael Brand
  2013-04-06 22:40       ` Thorsten Jolitz
                         ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Michael Brand @ 2013-04-06 22:24 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: Org Mode

Hi Thorsten

On Sat, Apr 6, 2013 at 11:32 PM, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> the problem is, if I call e (ediff) from Magit and want to merge (e.g.)
> my branch with the master branch, I don't really have access to both
> versions - only to the version from the checked out branch.
>
> ediff then gives me both versions in an ediff session (folded), but if I
> try to change major-mode to fundamental I break the ediff session.

You should be able to refresh the ediff session with "!".

But instead of the above I use this for ediff generally, it persists
in Org mode:

#+BEGIN_SRC emacs-lisp
  (add-hook 'ediff-prepare-buffer-hook 'f-ediff-prepare-buffer-hook-setup)
  (defun f-ediff-prepare-buffer-hook-setup ()
    ;; specific modes
    (cond ((eq major-mode 'org-mode)
           (f-org-vis-mod-maximum))
          ;; room for more modes
          )
    ;; all modes
    (setq truncate-lines nil))
  (defun f-org-vis-mod-maximum ()
    "Visibility: Show the most possible."
    (cond
     ((eq major-mode 'org-mode)
      (visible-mode 1)  ; default 0
      (setq truncate-lines nil)  ; no `org-startup-truncated' in hook
      (setq org-hide-leading-stars t))  ; default nil
     (t
      (message "ERR: not in Org mode")
      (ding))))
#+END_SRC

Michael

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

* Re: [WORG] How to ediff folded Org files?
  2013-04-06 22:24     ` Michael Brand
@ 2013-04-06 22:40       ` Thorsten Jolitz
  2013-04-06 23:01       ` Bill White
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Thorsten Jolitz @ 2013-04-06 22:40 UTC (permalink / raw)
  To: emacs-orgmode

Michael Brand <michael.ch.brand@gmail.com> writes:

Hi Michael,

> On Sat, Apr 6, 2013 at 11:32 PM, Thorsten Jolitz <tjolitz@gmail.com> wrote:
>> the problem is, if I call e (ediff) from Magit and want to merge (e.g.)
>> my branch with the master branch, I don't really have access to both
>> versions - only to the version from the checked out branch.
>>
>> ediff then gives me both versions in an ediff session (folded), but if I
>> try to change major-mode to fundamental I break the ediff session.
>
> You should be able to refresh the ediff session with "!".

I'll try that ...

> But instead of the above I use this for ediff generally, it persists
> in Org mode:
>
> #+BEGIN_SRC emacs-lisp
>   (add-hook 'ediff-prepare-buffer-hook 'f-ediff-prepare-buffer-hook-setup)
>   (defun f-ediff-prepare-buffer-hook-setup ()
>     ;; specific modes
>     (cond ((eq major-mode 'org-mode)
>            (f-org-vis-mod-maximum))
>           ;; room for more modes
>           )
>     ;; all modes
>     (setq truncate-lines nil))
>   (defun f-org-vis-mod-maximum ()
>     "Visibility: Show the most possible."
>     (cond
>      ((eq major-mode 'org-mode)
>       (visible-mode 1)  ; default 0
>       (setq truncate-lines nil)  ; no `org-startup-truncated' in hook
>       (setq org-hide-leading-stars t))  ; default nil
>      (t
>       (message "ERR: not in Org mode")
>       (ding))))
> #+END_SRC

very useful, thanks, I already put this into my .emacs. 

-- 
cheers,
Thorsten

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

* Re: [WORG] How to ediff folded Org files?
  2013-04-06 22:24     ` Michael Brand
  2013-04-06 22:40       ` Thorsten Jolitz
@ 2013-04-06 23:01       ` Bill White
  2013-04-09  7:29       ` Christian Egli
  2013-12-19 19:00       ` Michael Brand
  3 siblings, 0 replies; 12+ messages in thread
From: Bill White @ 2013-04-06 23:01 UTC (permalink / raw)
  To: emacs-orgmode

On Sat Apr 06 2013 at 17:24, Michael Brand <michael.ch.brand@gmail.com> wrote:

> But instead of the above I use this for ediff generally, it persists
> in Org mode:

You just solved the most annoying little usage problem I've had -
thanks!

Cheers -

bw
-- 
Bill White . billw@wolfram.com
"No ma'am, we're musicians."

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

* Re: [WORG] How to ediff folded Org files?
  2013-04-06 22:24     ` Michael Brand
  2013-04-06 22:40       ` Thorsten Jolitz
  2013-04-06 23:01       ` Bill White
@ 2013-04-09  7:29       ` Christian Egli
  2013-12-19 19:00       ` Michael Brand
  3 siblings, 0 replies; 12+ messages in thread
From: Christian Egli @ 2013-04-09  7:29 UTC (permalink / raw)
  To: emacs-orgmode

Michael Brand <michael.ch.brand@gmail.com> writes:

> But instead of the above I use this for ediff generally, it persists
> in Org mode:
>
> #+BEGIN_SRC emacs-lisp
>   (add-hook 'ediff-prepare-buffer-hook 'f-ediff-prepare-buffer-hook-setup)
>   (defun f-ediff-prepare-buffer-hook-setup ()
>     ;; specific modes
>     (cond ((eq major-mode 'org-mode)
>            (f-org-vis-mod-maximum))
>           ;; room for more modes
>           )
>     ;; all modes
>     (setq truncate-lines nil))
>   (defun f-org-vis-mod-maximum ()
>     "Visibility: Show the most possible."
>     (cond
>      ((eq major-mode 'org-mode)
>       (visible-mode 1)  ; default 0
>       (setq truncate-lines nil)  ; no `org-startup-truncated' in hook
>       (setq org-hide-leading-stars t))  ; default nil
>      (t
>       (message "ERR: not in Org mode")
>       (ding))))
> > #+END_SRC

I condensed this to the following since I don't use truncate-lines and
org-hide-leading-stars

;; ediff for org-mode files
(add-hook 'ediff-prepare-buffer-hook 
	  (lambda () 
	    (cond ((eq major-mode 'org-mode)
		   (visible-mode 1)))))

But now the problem now is that the visible-mode persists even when I
quit ediff. I tried to find a hook which lets me undo the visible-mode
but I couldn't find an obvious one. There is ediff-quit-hook but this is
done in the ediff-control-buffer.

Maybe after all it might be better to use ediff-select-hook and
ediff-unselect-hook.

Thanks
Christian
-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

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

* Re: [WORG] How to ediff folded Org files?
  2013-04-06  9:47 [WORG] How to ediff folded Org files? Thorsten Jolitz
  2013-04-06 20:20 ` Marc-Oliver Ihm
@ 2013-07-31 23:19 ` Ratish Punnoose
  2013-08-01 14:44   ` Thorsten Jolitz
  2013-08-01 15:09   ` Rémi Vanicat
  1 sibling, 2 replies; 12+ messages in thread
From: Ratish Punnoose @ 2013-07-31 23:19 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz <at> gmail.com> writes:

> Hi List, 
> 
> many files on Worg have this startup option:
> 
> ,--------------------------
> | +STARTUP:    ... fold ...
> `--------------------------
> 
> what leads to trouble when there is a merge-conflict in (Ma)git to be
> resolved manually with e(diff), because the different versions of the
> Org-file are then presented in folded state in the ediff session, so the
> diffs are invisible.
> 
> But when I call 'show-all' or so on them, it breaks the ediff session. 
> Is there a simple trick to avoid this problem?
> 

I was searching for a similar issue and came upon this list. I have a 
slightly different solution from the ones posted so far.

When doing a diff, each org-mode buffer is fully folded.
For each diff selection, that portion of the tree for each buffer is 
expanded.
When moving to a new diff, the previous portion of the tree is collapsed and 
the area surrounding the new diff location is expanded.

Acknowledgment: Michael Brand's solution was my starting inspiration.

#+BEGIN_SRC emacs-lisp
  ;; diff hooks for org mode
  (add-hook 'ediff-select-hook 'f-ediff-org-unfold-tree-element)
  (add-hook 'ediff-unselect-hook 'f-ediff-org-fold-tree)
  ;; Check for org mode and existence of buffer
  (defun f-ediff-org-showhide(buf command &rest cmdargs)
    "If buffer exists and is orgmode then execute command"
    (if buf
        (if (eq (buffer-local-value 'major-mode (get-buffer buf)) 'org-mode)
            (save-excursion (set-buffer buf) (apply command cmdargs)))
      )
    )
    
  (defun f-ediff-org-unfold-tree-element ()
    "Unfold tree at diff location"
    (f-ediff-org-showhide ediff-buffer-A 'org-reveal)  
    (f-ediff-org-showhide ediff-buffer-B 'org-reveal)  
    (f-ediff-org-showhide ediff-buffer-C 'org-reveal)  
    )
  ;;
  (defun f-ediff-org-fold-tree ()
    "Fold tree back to top level"
    (f-ediff-org-showhide ediff-buffer-A 'hide-sublevels 1)  
    (f-ediff-org-showhide ediff-buffer-B 'hide-sublevels 1)  
    (f-ediff-org-showhide ediff-buffer-C 'hide-sublevels 1)  
    )
#+END_SRC

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

* Re: [WORG] How to ediff folded Org files?
  2013-07-31 23:19 ` Ratish Punnoose
@ 2013-08-01 14:44   ` Thorsten Jolitz
  2013-08-01 15:09   ` Rémi Vanicat
  1 sibling, 0 replies; 12+ messages in thread
From: Thorsten Jolitz @ 2013-08-01 14:44 UTC (permalink / raw)
  To: emacs-orgmode

Ratish Punnoose <ratish@gmail.com> writes:

> Thorsten Jolitz <tjolitz <at> gmail.com> writes:
>
>> Hi List, 
>> 
>> many files on Worg have this startup option:
>> 
>> ,--------------------------
>> | +STARTUP:    ... fold ...
>> `--------------------------
>> 
>> what leads to trouble when there is a merge-conflict in (Ma)git to be
>> resolved manually with e(diff), because the different versions of the
>> Org-file are then presented in folded state in the ediff session, so the
>> diffs are invisible.
>> 
>> But when I call 'show-all' or so on them, it breaks the ediff session. 
>> Is there a simple trick to avoid this problem?
>
> I was searching for a similar issue and came upon this list. I have a 
> slightly different solution from the ones posted so far.

[...]

Thanks for sharing, I will try this out next time I need to use ediff on
Org files. 

-- 
cheers,
Thorsten

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

* Re: [WORG] How to ediff folded Org files?
  2013-07-31 23:19 ` Ratish Punnoose
  2013-08-01 14:44   ` Thorsten Jolitz
@ 2013-08-01 15:09   ` Rémi Vanicat
  2013-08-02 12:22     ` Suvayu Ali
  1 sibling, 1 reply; 12+ messages in thread
From: Rémi Vanicat @ 2013-08-01 15:09 UTC (permalink / raw)
  To: emacs-orgmode

Ratish Punnoose <ratish@gmail.com> writes:

> Thorsten Jolitz <tjolitz <at> gmail.com> writes:
>

[...]

> #+BEGIN_SRC emacs-lisp
>   ;; diff hooks for org mode
>   (add-hook 'ediff-select-hook 'f-ediff-org-unfold-tree-element)
>   (add-hook 'ediff-unselect-hook 'f-ediff-org-fold-tree)
>   ;; Check for org mode and existence of buffer
>   (defun f-ediff-org-showhide(buf command &rest cmdargs)
>     "If buffer exists and is orgmode then execute command"
>     (if buf
>         (if (eq (buffer-local-value 'major-mode (get-buffer buf)) 'org-mode)
>             (save-excursion (set-buffer buf) (apply command cmdargs)))
>       )
>     )
>     
>   (defun f-ediff-org-unfold-tree-element ()
>     "Unfold tree at diff location"
>     (f-ediff-org-showhide ediff-buffer-A 'org-reveal)  
>     (f-ediff-org-showhide ediff-buffer-B 'org-reveal)  
>     (f-ediff-org-showhide ediff-buffer-C 'org-reveal)  
>     )
>   ;;
>   (defun f-ediff-org-fold-tree ()
>     "Fold tree back to top level"
>     (f-ediff-org-showhide ediff-buffer-A 'hide-sublevels 1)  
>     (f-ediff-org-showhide ediff-buffer-B 'hide-sublevels 1)  
>     (f-ediff-org-showhide ediff-buffer-C 'hide-sublevels 1)  
>     )
> #+END_SRC

Thanks for sharing.

Adding this to org-mode (at least in contrib, or worg) would be really cool.
-- 
Rémi Vanicat

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

* Re: [WORG] How to ediff folded Org files?
  2013-08-01 15:09   ` Rémi Vanicat
@ 2013-08-02 12:22     ` Suvayu Ali
  0 siblings, 0 replies; 12+ messages in thread
From: Suvayu Ali @ 2013-08-02 12:22 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Aug 01, 2013 at 05:09:19PM +0200, Rémi Vanicat wrote:
> Ratish Punnoose <ratish@gmail.com> writes:

 [...chomp...chomp...chomp...]

> 
> Adding this to org-mode (at least in contrib, or worg) would be really cool.

Done!

<http://orgmode.org/w/worg.git?p=worg.git;a=blobdiff;f=org-hacks.org;h=26e8ab26ed0b7752a6cbee8665a64da5781f163b;hp=52a359044d98686be0ada42e0653e2a6d0993fcb;hb=09e38b9d38fc48571ec64a16e38291cd0a7a48ef;hpb=a776e543d87c14b4712a3decd359bdd4a971da38>

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: [WORG] How to ediff folded Org files?
  2013-04-06 22:24     ` Michael Brand
                         ` (2 preceding siblings ...)
  2013-04-09  7:29       ` Christian Egli
@ 2013-12-19 19:00       ` Michael Brand
  3 siblings, 0 replies; 12+ messages in thread
From: Michael Brand @ 2013-12-19 19:00 UTC (permalink / raw)
  To: Org Mode

Hi all

An update for this thread from April:

On Sun, Apr 7, 2013 at 12:24 AM, Michael Brand
<michael.ch.brand@gmail.com> wrote:
> #+BEGIN_SRC emacs-lisp
>   (add-hook 'ediff-prepare-buffer-hook 'f-ediff-prepare-buffer-hook-setup)
>   (defun f-ediff-prepare-buffer-hook-setup ()
>     ;; specific modes
>     (cond ((eq major-mode 'org-mode)
>            (f-org-vis-mod-maximum))
>           ;; room for more modes
>           )
>     ;; all modes
>     (setq truncate-lines nil))
>   (defun f-org-vis-mod-maximum ()
[...]
> #+END_SRC

To get the "=>" in narrowed columns of aligned tables out of the way I
changed f-org-vis-mod-maximum in the meantime:

#+BEGIN_SRC emacs-lisp
  (defun f-org-vis-mod-maximum ()
    "Org visibility: Modify settings to show maximum.
  Useful for e. g. `ediff-prepare-buffer-hook' in Org buffer."
    (interactive)
    (cond
     ((eq major-mode 'org-mode)
      (setq truncate-lines nil)
      (visible-mode 1)
      ;; Get the "=>" in narrowed columns of aligned tables out of the way.
      ;; - It is important to also remove the text property "invisible" for
      ;;   the case that the Visible mode is turned off after the removed "=>"
      ;;   does not indicate invisible content anymore.
      ;; - Negative site effect to put up with: When the Visible mode is
      ;;   turned off again it will show some parts that were invisible before
      (with-silent-modifications
        (remove-text-properties
         (point-min) (point-max)
         (list 'invisible 'dummy-prop-or-val  ; e. g. truncated table field
               'display   'dummy-prop-or-val))))  ; e. g. the "=>" in a table
     (t
      (message "ERR: not in Org mode")
      (ding))))
#+END_SRC

Michael

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

end of thread, other threads:[~2013-12-19 19:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-06  9:47 [WORG] How to ediff folded Org files? Thorsten Jolitz
2013-04-06 20:20 ` Marc-Oliver Ihm
2013-04-06 21:32   ` Thorsten Jolitz
2013-04-06 22:24     ` Michael Brand
2013-04-06 22:40       ` Thorsten Jolitz
2013-04-06 23:01       ` Bill White
2013-04-09  7:29       ` Christian Egli
2013-12-19 19:00       ` Michael Brand
2013-07-31 23:19 ` Ratish Punnoose
2013-08-01 14:44   ` Thorsten Jolitz
2013-08-01 15:09   ` Rémi Vanicat
2013-08-02 12:22     ` Suvayu Ali

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