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
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?
>
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
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
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
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."
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
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
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
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
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.
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