* ediff refinement issues @ 2011-11-26 17:15 ` Samuel Wales 2011-11-26 17:51 ` Drew Adams 2011-11-26 20:28 ` Peter Münster 0 siblings, 2 replies; 14+ messages in thread From: Samuel Wales @ 2011-11-26 17:15 UTC (permalink / raw) To: help-gnu-emacs Ediff lets you show individual words that are different, and it also shows you when there are only whitespace differences in paragraphs. I am having issues with each of these two related features. 1) When there are only whitespace differences in normal paragraphs, such as by refilling, ediff works well. It says there are only whitespace differences and does not highlight any words. However, if the paragraphs are commented (for example, with ;;; in elisp or # in shell), it highlights the ;;; or the #. it also sometimes highlights words as a side effect. I want ediff to show refilled commented paragraphs as only having whitespace differences. 2) When I change a date like 2011-01-01, ediff highlights the entire date even if I only changed one part of it. For example, if I change 01 to 02, it will still highlight the entire date. I want it to show only the part I changed. There are variables ediff-word-1 ediff-word-2 ediff-word-3 ediff-word-4 that are supposed to customize this. I tried them in various ways and they didn't produce the results I wanted. How do you use those variables to do this? Thanks. ^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: ediff refinement issues 2011-11-26 17:15 ` ediff refinement issues Samuel Wales @ 2011-11-26 17:51 ` Drew Adams 2011-11-26 18:20 ` Samuel Wales ` (2 more replies) 2011-11-26 20:28 ` Peter Münster 1 sibling, 3 replies; 14+ messages in thread From: Drew Adams @ 2011-11-26 17:51 UTC (permalink / raw) To: 'Samuel Wales', help-gnu-emacs > 1) When there are only whitespace differences in normal > paragraphs, such as by refilling, ediff works well. It > says there are only whitespace differences and does not > highlight any words. > > However, if the paragraphs are commented (for example, > with ;;; in elisp or # in shell), it highlights the ;;; > or the #. it also sometimes highlights words as a side > effect. I don't see that. Maybe give a concrete example. What I see is that whitespace is either ignored everywhere or it is not ignored at all (toggle this with `##'). > I want ediff to show refilled commented paragraphs as > only having whitespace differences. Are you sure that the paragraphs themselves have only whitespace differences? You say that `;;;' is highlighted as different. Do you mean that the `;;;' is highlighted in both of these identical lines? ;;; commented line ;;; commented line > 2) When I change a date like 2011-01-01, ediff highlights > the entire date even if I only changed one part of it. > For example, if I change 01 to 02, it will still > highlight the entire date. > I want it to show only the part I changed. > > There are variables ediff-word-1 ediff-word-2 ediff-word-3 > ediff-word-4 that are supposed to customize this. I tried > them in various ways and they didn't produce the results I > wanted. How do you use those variables to do this? I've never played with that, and I don't know of any command or option that helps here, but maybe someone else can help. Looking in the code a bit, I see this: 1. Those are defvars, not defcustoms. 2. They are buffer-local. So I tried this in each of two buffers that had only this, respectively: "2011-01-01" and "2011-01-02": `M-: (setq ediff-word-1 "[:word]")'. Then, hitting `!' showed a refinement that distinguished "2011" from the rest. I would have expected the "01" / "02" difference to be distinguished. Maybe you can play around a little more this way to get what you want. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2011-11-26 17:51 ` Drew Adams @ 2011-11-26 18:20 ` Samuel Wales 2011-11-26 18:38 ` Drew Adams 2021-03-29 4:46 ` Samuel Wales 2021-03-30 23:26 ` Michael Heerdegen 2 siblings, 1 reply; 14+ messages in thread From: Samuel Wales @ 2011-11-26 18:20 UTC (permalink / raw) To: Drew Adams; +Cc: help-gnu-emacs On 2011-11-26, Drew Adams <drew.adams@oracle.com> wrote: > Are you sure that the paragraphs themselves have only whitespace > differences? Yes of course. I want ^;;; or ^# to act as whitespace in this case. It is possible that those variables (which are in the Customization section of the ediff manual) are insufficient to do what I want here. It is possible that I need a new ediff-forward-word-function (which is also in that section). One issue is that I want only ^;;; or ^# to be treated as whitespace. Not ;;; or # in the middle of text. It is really simple. I don't see why I should have to look at highlighted spurious things when all I did was fill a paragraph. > You say that `;;;' is highlighted as different. Do you mean that the `;;;' > is > highlighted in both of these identical lines? > > ;;; commented line > > ;;; commented line No, because they are identical. But if you had an unfilled paragraph there instead of a single line, and ediffed the filled and unfilled versions, you might understand. > 2. They are buffer-local. What ediff hook works best here? ^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: ediff refinement issues 2011-11-26 18:20 ` Samuel Wales @ 2011-11-26 18:38 ` Drew Adams 2011-11-29 10:54 ` Thien-Thi Nguyen 0 siblings, 1 reply; 14+ messages in thread From: Drew Adams @ 2011-11-26 18:38 UTC (permalink / raw) To: 'Samuel Wales'; +Cc: help-gnu-emacs > Yes of course. I want ^;;; or ^# to act as whitespace in this case. AFAIK, there is no way to tell ediff to ignore differences in text that matches an arbitrary regexp. IOW, it ignores only whitespace when you tell it to ignore whitespace. ;-) Ignoring whitespace is a built-in feature of ediff. IIUC, what you are asking for is not a feature provided by ediff. I have long wanted the ability to tell ediff to ignore (i.e., consider as the same) all matches for a given pattern. AFAIK, that feature is waiting to be implemented. ;-) > One issue is that I want only ^;;; or ^# to be treated as whitespace. > Not ;;; or # in the middle of text. Neither case will ever be treated as whitespace. Such patterns do not represent whitespace. > It is really simple. I don't see why I should have to look at > highlighted spurious things when all I did was fill a paragraph. Filling a paragraph typically changes more than whitespace. ;;; aaa bbb ccc ddd ;;; eee and ;;; aaa bbb ccc ;;; ddd eee wrt more than whitespace. Ediff shows you the difference. `;;;' is not whitespace. > But if you had an unfilled paragraph... and ediffed the > filled and unfilled versions, you might understand. They differ wrt non-whitespace text, namely, the comment chars. AFAICT, in what you describe: 1. Ediff is acting as advertised. 2. There is no option/command to have ediff ignore differences in text that matches a pattern other than whitespace. Again, maybe someone else can help more. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2011-11-26 18:38 ` Drew Adams @ 2011-11-29 10:54 ` Thien-Thi Nguyen 2011-11-29 17:27 ` Samuel Wales 0 siblings, 1 reply; 14+ messages in thread From: Thien-Thi Nguyen @ 2011-11-29 10:54 UTC (permalink / raw) To: help-gnu-emacs () "Drew Adams" <drew.adams@oracle.com> () Sat, 26 Nov 2011 10:38:28 -0800 2. There is no option/command to have ediff ignore differences in text that matches a pattern other than whitespace. If Ediff usees GNU diff, perhaps there is a way to specify ‘-I REGEXP’. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2011-11-29 10:54 ` Thien-Thi Nguyen @ 2011-11-29 17:27 ` Samuel Wales 2011-12-06 14:16 ` Thien-Thi Nguyen 0 siblings, 1 reply; 14+ messages in thread From: Samuel Wales @ 2011-11-29 17:27 UTC (permalink / raw) To: Thien-Thi Nguyen; +Cc: help-gnu-emacs On 2011-11-29, Thien-Thi Nguyen <ttn@gnuvola.org> wrote: > 2. There is no option/command to have ediff ignore differences in > text that matches a pattern other than whitespace. > > If Ediff usees GNU diff, perhaps there is a way to specify ‘-I REGEXP’. Hi TTN, I think that would ignore comments entirely, instead of ignoring formatting in comments. No? Samuel ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2011-11-29 17:27 ` Samuel Wales @ 2011-12-06 14:16 ` Thien-Thi Nguyen 0 siblings, 0 replies; 14+ messages in thread From: Thien-Thi Nguyen @ 2011-12-06 14:16 UTC (permalink / raw) To: Samuel Wales; +Cc: help-gnu-emacs () Samuel Wales <samologist@gmail.com> () Tue, 29 Nov 2011 10:27:54 -0700 On 2011-11-29, Thien-Thi Nguyen <ttn@gnuvola.org> wrote: > 2. There is no option/command to have ediff ignore differences in > text that matches a pattern other than whitespace. > > If Ediff usees GNU diff, perhaps there is a way to specify ‘-I REGEXP’. I think that would ignore comments entirely, instead of ignoring formatting in comments. No? You are right. It looks like ‘-I REGEXP’ is not what you seek. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2011-11-26 17:51 ` Drew Adams 2011-11-26 18:20 ` Samuel Wales @ 2021-03-29 4:46 ` Samuel Wales 2021-03-29 4:48 ` Samuel Wales 2021-03-31 2:56 ` Stefan Monnier 2021-03-30 23:26 ` Michael Heerdegen 2 siblings, 2 replies; 14+ messages in thread From: Samuel Wales @ 2021-03-29 4:46 UTC (permalink / raw) To: Drew Adams; +Cc: help-gnu-emacs On 11/26/11, Drew Adams <drew.adams@oracle.com> wrote: >> 1) When there are only whitespace differences in normal >> paragraphs, such as by refilling, ediff works well. It >> says there are only whitespace differences and does not >> highlight any words. >> >> However, if the paragraphs are commented (for example, >> with ;;; in elisp or # in shell), it highlights the ;;; >> or the #. it also sometimes highlights words as a side >> effect. > > I don't see that. Maybe give a concrete example. What I see is that > whitespace > is either ignored everywhere or it is not ignored at all (toggle this with > `##'). you are confusing different features. take a commented paragraph with a few long lines, save it to a. fill it. save it to b. now do diff mode on it and also ediff on it. you should notice that diff mode correctly notices tht the only non-whitgespaceish ifference is the comment prefix. ediff thinks words changed. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2021-03-29 4:46 ` Samuel Wales @ 2021-03-29 4:48 ` Samuel Wales 2021-03-29 5:27 ` Eli Zaretskii 2021-03-31 2:56 ` Stefan Monnier 1 sibling, 1 reply; 14+ messages in thread From: Samuel Wales @ 2021-03-29 4:48 UTC (permalink / raw) To: Drew Adams; +Cc: help-gnu-emacs for purpoes of the test do something like this: # asdfjkansdkljfan ksd fnak nsdflkadsnfkansdkfnakdsnf # aklsfdnakljfnsdkasdnfja sdn fkljad nsfkj ansdkfn aksdjfna # ksjfndk ajdnsf kajsndkfjansdkfjn ja nsdkjfn askdj fnakjs fdnakj # nsdfkaj dns then fill to a narrow fill column. On 3/28/21, Samuel Wales <samologist@gmail.com> wrote: > On 11/26/11, Drew Adams <drew.adams@oracle.com> wrote: >>> 1) When there are only whitespace differences in normal >>> paragraphs, such as by refilling, ediff works well. It >>> says there are only whitespace differences and does not >>> highlight any words. >>> >>> However, if the paragraphs are commented (for example, >>> with ;;; in elisp or # in shell), it highlights the ;;; >>> or the #. it also sometimes highlights words as a side >>> effect. >> >> I don't see that. Maybe give a concrete example. What I see is that >> whitespace >> is either ignored everywhere or it is not ignored at all (toggle this >> with >> `##'). > > you are confusing different features. take a commented paragraph with > a few long lines, save it to a. fill it. save it to b. now do diff > mode on it and also ediff on it. > > you should notice that diff mode correctly notices tht the only > non-whitgespaceish ifference is the comment prefix. ediff thinks > words changed. > -- The Kafka Pandemic Please learn what misopathy is. https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2021-03-29 4:48 ` Samuel Wales @ 2021-03-29 5:27 ` Eli Zaretskii 2021-03-30 22:04 ` Samuel Wales 0 siblings, 1 reply; 14+ messages in thread From: Eli Zaretskii @ 2021-03-29 5:27 UTC (permalink / raw) To: help-gnu-emacs > From: Samuel Wales <samologist@gmail.com> > Date: Sun, 28 Mar 2021 21:48:18 -0700 > Cc: help-gnu-emacs@gnu.org > > for purpoes of the test do something like this: > > # asdfjkansdkljfan ksd fnak nsdflkadsnfkansdkfnakdsnf > # aklsfdnakljfnsdkasdnfja sdn fkljad nsfkj ansdkfn aksdjfna > # ksjfndk ajdnsf kajsndkfjansdkfjn ja nsdkjfn askdj fnakjs fdnakj > # nsdfkaj dns > > then fill to a narrow fill column. Please submit a full bug report with the details, TIA. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2021-03-29 5:27 ` Eli Zaretskii @ 2021-03-30 22:04 ` Samuel Wales 0 siblings, 0 replies; 14+ messages in thread From: Samuel Wales @ 2021-03-30 22:04 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs done [as best as poss], thanks. On 3/28/21, Eli Zaretskii <eliz@gnu.org> wrote: > Please submit a full bug report with the details, TIA. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2021-03-29 4:46 ` Samuel Wales 2021-03-29 4:48 ` Samuel Wales @ 2021-03-31 2:56 ` Stefan Monnier 1 sibling, 0 replies; 14+ messages in thread From: Stefan Monnier @ 2021-03-31 2:56 UTC (permalink / raw) To: help-gnu-emacs >>> However, if the paragraphs are commented (for example, >>> with ;;; in elisp or # in shell), it highlights the ;;; >>> or the #. it also sometimes highlights words as a side >>> effect. FWIW, this is largely unavoidable. Refilling has an effect similar to replacing foo bar ;; baz with foo ;; bar baz So the "fine" diff indicates that semi colons were removed at one place and inserted at the other. In order to "abstract away" semi-colons which are placed at the beginning of all lines, it would take extra work and neither ediff nor smerge does that. I haven't thought about how easy/hard it might be to implement such a thing (but at first glance, I'd say it's probably not trivial). As for why ediff sometimes highlights words and not smerge, I suspect it's mostly an accident (linked to the details of how the fine-diffs are defined in the two cases). E.g. in the above example you could also say that what happened is that "bar" was removed at one place and inserted at another. That's also valid, tho less good. Maybe Ediff gets it "less good" more often than Smerge because it doesn't have the equivalent of `smerge-refine-weight-hack` which marks "move ;;" as less costly than "move bar" in the above example? Stefan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2011-11-26 17:51 ` Drew Adams 2011-11-26 18:20 ` Samuel Wales 2021-03-29 4:46 ` Samuel Wales @ 2021-03-30 23:26 ` Michael Heerdegen 2 siblings, 0 replies; 14+ messages in thread From: Michael Heerdegen @ 2021-03-30 23:26 UTC (permalink / raw) To: Drew Adams; +Cc: help-gnu-emacs "Drew Adams" <drew.adams@oracle.com> writes: > > There are variables ediff-word-1 ediff-word-2 ediff-word-3 > > ediff-word-4 that are supposed to customize this. I tried > > them in various ways and they didn't produce the results I > > wanted. How do you use those variables to do this? > > I've never played with that, and I don't know of any command or option > that helps here, but maybe someone else can help. Looking in the code > a bit, I see this: > > 1. Those are defvars, not defcustoms. > 2. They are buffer-local. > > So I tried this in each of two buffers that had only this, respectively: > "2011-01-01" and "2011-01-02": `M-: (setq ediff-word-1 "[:word]")'. Yes. And I think one should better add the hyphen character back to one of the other word class characters. > Then, hitting `!' showed a refinement that distinguished "2011" from > the rest. I would have expected the "01" / "02" difference to be > distinguished. That can happen when diff or word counting is wrong. As you said: these variables are buffer local, and Ediff uses a separate buffer to "wordify" for the fine diffs, and in that buffer the original bindings of ediff-word-* are visible, so you get an inconsistency in the definition of word classes. In summary, this should work ok: ;; e-w-1 minus _ and - (setq-default ediff-word-1 "[:word:]") ;; e-w-3 plus _ and - (setq-default ediff-word-3 "`'?!:;\"{}[]()_-") Michael. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ediff refinement issues 2011-11-26 17:15 ` ediff refinement issues Samuel Wales 2011-11-26 17:51 ` Drew Adams @ 2011-11-26 20:28 ` Peter Münster 1 sibling, 0 replies; 14+ messages in thread From: Peter Münster @ 2011-11-26 20:28 UTC (permalink / raw) To: help-gnu-emacs On Sat, Nov 26 2011, Samuel Wales wrote: > I want ediff to show refilled commented paragraphs as > only having whitespace differences. You could implement this feature. But then, be careful with commented code: file A: shell-command file B: # shell-command "^#" should not be ignored here. -- Peter ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2021-03-31 2:56 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <AcysXwOm6vNJt6yHT5KpcypPYeDckQAAVtPw> 2011-11-26 17:15 ` ediff refinement issues Samuel Wales 2011-11-26 17:51 ` Drew Adams 2011-11-26 18:20 ` Samuel Wales 2011-11-26 18:38 ` Drew Adams 2011-11-29 10:54 ` Thien-Thi Nguyen 2011-11-29 17:27 ` Samuel Wales 2011-12-06 14:16 ` Thien-Thi Nguyen 2021-03-29 4:46 ` Samuel Wales 2021-03-29 4:48 ` Samuel Wales 2021-03-29 5:27 ` Eli Zaretskii 2021-03-30 22:04 ` Samuel Wales 2021-03-31 2:56 ` Stefan Monnier 2021-03-30 23:26 ` Michael Heerdegen 2011-11-26 20:28 ` Peter Münster
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).