* point-min and 1 [not found] <E1Macea-0002f3-HQ@monty-python.gnu.org> @ 2009-08-11 3:07 ` Eli Zaretskii 2009-08-11 9:18 ` martin rudalics 2009-08-11 15:13 ` Stefan Monnier 0 siblings, 2 replies; 28+ messages in thread From: Eli Zaretskii @ 2009-08-11 3:07 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel > Date: Mon, 10 Aug 2009 17:42:50 -0400 > From: emacs-diffs-request@gnu.org > > ;; Move to the specified line number in that buffer. > (save-restriction > (widen) > - (goto-char 1) > + (goto-char (point-min)) Can `(goto-char (point-min))' be different from `(goto-char 1)' after a call to `widen'? ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-11 3:07 ` point-min and 1 Eli Zaretskii @ 2009-08-11 9:18 ` martin rudalics 2009-08-11 18:22 ` Eli Zaretskii 2009-08-11 15:13 ` Stefan Monnier 1 sibling, 1 reply; 28+ messages in thread From: martin rudalics @ 2009-08-11 9:18 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Stefan Monnier, emacs-devel > Can `(goto-char (point-min))' be different from `(goto-char 1)' after > a call to `widen'? simple.el should not promote bad programming style ;-) martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-11 9:18 ` martin rudalics @ 2009-08-11 18:22 ` Eli Zaretskii 2009-08-12 8:55 ` martin rudalics 0 siblings, 1 reply; 28+ messages in thread From: Eli Zaretskii @ 2009-08-11 18:22 UTC (permalink / raw) To: martin rudalics; +Cc: monnier, emacs-devel > Date: Tue, 11 Aug 2009 11:18:44 +0200 > From: martin rudalics <rudalics@gmx.at> > CC: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org > > > Can `(goto-char (point-min))' be different from `(goto-char 1)' after > > a call to `widen'? > > simple.el should not promote bad programming style ;-) What's bad about it? ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-11 18:22 ` Eli Zaretskii @ 2009-08-12 8:55 ` martin rudalics 2009-08-12 17:39 ` Eli Zaretskii 0 siblings, 1 reply; 28+ messages in thread From: martin rudalics @ 2009-08-12 8:55 UTC (permalink / raw) To: Eli Zaretskii; +Cc: monnier, emacs-devel >> > Can `(goto-char (point-min))' be different from `(goto-char 1)' after >> > a call to `widen'? >> >> simple.el should not promote bad programming style ;-) > > What's bad about it? The call to `widen' is of no importance here. As a matter of fact, `(goto-char (point-min))' and `(goto-char 1)' are operationally equivalent - they "always" move point to the same buffer position regardless of whether the buffer was narrowed or not. IMHO writing `(goto-char 1)' is bad style because it exhibits a low level detail of Elisp implementation, namely that it sees buffer positions as numbers counted from 1. I think Elisp code - and in particular code in simple.el which might be used as some kind of reference code for people starting to speak Elisp - should hide such details wherever it can. martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-12 8:55 ` martin rudalics @ 2009-08-12 17:39 ` Eli Zaretskii 2009-08-12 23:03 ` Miles Bader ` (2 more replies) 0 siblings, 3 replies; 28+ messages in thread From: Eli Zaretskii @ 2009-08-12 17:39 UTC (permalink / raw) To: martin rudalics; +Cc: emacs-devel > Date: Wed, 12 Aug 2009 10:55:58 +0200 > From: martin rudalics <rudalics@gmx.at> > CC: monnier@iro.umontreal.ca, emacs-devel@gnu.org > > IMHO writing `(goto-char 1)' is bad style because it exhibits a low > level detail of Elisp implementation, namely that it sees buffer > positions as numbers counted from 1. ELisp code is full of such exposure, and not only in buffer positioning. Trying to change this is tantamount to fighting Quixotic wars, IMO. OTOH, replacing a constant with a function call might make a difference. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-12 17:39 ` Eli Zaretskii @ 2009-08-12 23:03 ` Miles Bader 2009-08-13 0:13 ` Daniel Colascione 2009-08-13 9:52 ` martin rudalics 2 siblings, 0 replies; 28+ messages in thread From: Miles Bader @ 2009-08-12 23:03 UTC (permalink / raw) To: Eli Zaretskii; +Cc: martin rudalics, emacs-devel Eli Zaretskii <eliz@gnu.org> writes: >> IMHO writing `(goto-char 1)' is bad style because it exhibits a low >> level detail of Elisp implementation, namely that it sees buffer >> positions as numbers counted from 1. > > OTOH, replacing a constant with a function call might make a > difference. (point-min) has its own byte-code, so it's essentially the same speed as a constant. -miles -- Any man who is a triangle, has thee right, when in Cartesian Space, to have angles, which when summed, come to know more, nor no less, than nine score degrees, should he so wish. [TEMPLE OV THEE LEMUR] ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-12 17:39 ` Eli Zaretskii 2009-08-12 23:03 ` Miles Bader @ 2009-08-13 0:13 ` Daniel Colascione 2009-08-13 9:52 ` martin rudalics 2 siblings, 0 replies; 28+ messages in thread From: Daniel Colascione @ 2009-08-13 0:13 UTC (permalink / raw) To: emacs-devel, Eli Zaretskii; +Cc: martin rudalics On Wednesday 12 August 2009, Eli Zaretskii wrote: > > From: martin rudalics <rudalics@gmx.at> > > IMHO writing `(goto-char 1)' is bad style because it exhibits a low > OTOH, replacing a constant with a function call might make a > difference. point-min has its own bytecode instruction, so it's not quite that bad. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-12 17:39 ` Eli Zaretskii 2009-08-12 23:03 ` Miles Bader 2009-08-13 0:13 ` Daniel Colascione @ 2009-08-13 9:52 ` martin rudalics 2009-08-13 16:49 ` Stefan Monnier 2 siblings, 1 reply; 28+ messages in thread From: martin rudalics @ 2009-08-13 9:52 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel > ELisp code is full of such exposure, and not only in buffer > positioning. Trying to change this is tantamount to fighting Quixotic > wars, IMO. But we could try to not encourage people to introduce such exposure in the future. > OTOH, replacing a constant with a function call might make a > difference. We have some 1000 occurrences of `(goto-char (point-min))' in current Emacs. If this really made a difference, we should replace them. martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 9:52 ` martin rudalics @ 2009-08-13 16:49 ` Stefan Monnier 2009-08-13 18:08 ` martin rudalics 0 siblings, 1 reply; 28+ messages in thread From: Stefan Monnier @ 2009-08-13 16:49 UTC (permalink / raw) To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel > We have some 1000 occurrences of `(goto-char (point-min))' in current > Emacs. If this really made a difference, we should replace them. I'd rather change the byte-compiler to change it for us if we really find it to be necessary. Stefan ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 16:49 ` Stefan Monnier @ 2009-08-13 18:08 ` martin rudalics 2009-08-13 21:28 ` Chong Yidong ` (2 more replies) 0 siblings, 3 replies; 28+ messages in thread From: martin rudalics @ 2009-08-13 18:08 UTC (permalink / raw) To: Stefan Monnier; +Cc: Eli Zaretskii, emacs-devel >> We have some 1000 occurrences of `(goto-char (point-min))' in current >> Emacs. If this really made a difference, we should replace them. > > I'd rather change the byte-compiler to change it for us if we really > find it to be necessary. I'd opt for two new primitives `goto-point-min' and `goto-point-max'. martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 18:08 ` martin rudalics @ 2009-08-13 21:28 ` Chong Yidong 2009-08-13 23:21 ` Juri Linkov 2009-08-14 1:29 ` Stefan Monnier 2 siblings, 0 replies; 28+ messages in thread From: Chong Yidong @ 2009-08-13 21:28 UTC (permalink / raw) To: martin rudalics; +Cc: Eli Zaretskii, Stefan Monnier, emacs-devel martin rudalics <rudalics@gmx.at> writes: >>> We have some 1000 occurrences of `(goto-char (point-min))' in current >>> Emacs. If this really made a difference, we should replace them. >> >> I'd rather change the byte-compiler to change it for us if we really >> find it to be necessary. > > I'd opt for two new primitives `goto-point-min' and `goto-point-max'. I seriously doubt that this forms any kind of performance bottleneck, but if anyone would like to try and measure it, please go ahead. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 18:08 ` martin rudalics 2009-08-13 21:28 ` Chong Yidong @ 2009-08-13 23:21 ` Juri Linkov 2009-08-14 7:16 ` martin rudalics 2009-08-14 1:29 ` Stefan Monnier 2 siblings, 1 reply; 28+ messages in thread From: Juri Linkov @ 2009-08-13 23:21 UTC (permalink / raw) To: martin rudalics; +Cc: Eli Zaretskii, Stefan Monnier, emacs-devel >>> We have some 1000 occurrences of `(goto-char (point-min))' in current >>> Emacs. If this really made a difference, we should replace them. >> >> I'd rather change the byte-compiler to change it for us if we really >> find it to be necessary. > > I'd opt for two new primitives `goto-point-min' and `goto-point-max'. And `goto-line-noninteractively' ;) -- Juri Linkov http://www.jurta.org/emacs/ ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 23:21 ` Juri Linkov @ 2009-08-14 7:16 ` martin rudalics 2009-08-14 9:30 ` David Kastrup 0 siblings, 1 reply; 28+ messages in thread From: martin rudalics @ 2009-08-14 7:16 UTC (permalink / raw) To: Juri Linkov; +Cc: Eli Zaretskii, Stefan Monnier, emacs-devel >> I'd opt for two new primitives `goto-point-min' and `goto-point-max'. > > And `goto-line-noninteractively' ;) Hmmm.... Every second use of `point-min' is within the idiom (goto-char (point-min)). So I think I have a point here. `forward-line' is mostly used for going to the next or previous line, IIUC. martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-14 7:16 ` martin rudalics @ 2009-08-14 9:30 ` David Kastrup 2009-08-14 9:50 ` martin rudalics 2009-08-14 9:55 ` Miles Bader 0 siblings, 2 replies; 28+ messages in thread From: David Kastrup @ 2009-08-14 9:30 UTC (permalink / raw) To: emacs-devel martin rudalics <rudalics@gmx.at> writes: >>> I'd opt for two new primitives `goto-point-min' and `goto-point-max'. >> >> And `goto-line-noninteractively' ;) > > Hmmm.... Every second use of `point-min' is within the idiom (goto-char > (point-min)). So I think I have a point here. That's exactly why you don't have a point. Every second use of "think" is within the idiom "I think", and yet we don't use a separate word for it. Because we don't need a separate word for a common simple idiom comprised of elementary parts. -- David Kastrup ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-14 9:30 ` David Kastrup @ 2009-08-14 9:50 ` martin rudalics 2009-08-14 9:55 ` Miles Bader 1 sibling, 0 replies; 28+ messages in thread From: martin rudalics @ 2009-08-14 9:50 UTC (permalink / raw) To: David Kastrup; +Cc: emacs-devel > That's exactly why you don't have a point. Every second use of "think" > is within the idiom "I think", and yet we don't use a separate word for > it. Because we don't need a separate word for a common simple idiom > comprised of elementary parts. If every second use of "think" were within the idiom "I, David Kastrup, think" we probably would have a spearate word for it ... martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-14 9:30 ` David Kastrup 2009-08-14 9:50 ` martin rudalics @ 2009-08-14 9:55 ` Miles Bader 1 sibling, 0 replies; 28+ messages in thread From: Miles Bader @ 2009-08-14 9:55 UTC (permalink / raw) To: David Kastrup; +Cc: emacs-devel This thread ceased to have a point a long time ago... -Miles -- Idiot, n. A member of a large and powerful tribe whose influence in human affairs has always been dominant and controlling. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 18:08 ` martin rudalics 2009-08-13 21:28 ` Chong Yidong 2009-08-13 23:21 ` Juri Linkov @ 2009-08-14 1:29 ` Stefan Monnier 2009-08-14 7:15 ` martin rudalics 2 siblings, 1 reply; 28+ messages in thread From: Stefan Monnier @ 2009-08-14 1:29 UTC (permalink / raw) To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel >>> We have some 1000 occurrences of `(goto-char (point-min))' in current >>> Emacs. If this really made a difference, we should replace them. >> I'd rather change the byte-compiler to change it for us if we really >> find it to be necessary. > I'd opt for two new primitives `goto-point-min' and `goto-point-max'. What for? Stefan ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-14 1:29 ` Stefan Monnier @ 2009-08-14 7:15 ` martin rudalics 2009-08-14 8:44 ` David Kastrup 0 siblings, 1 reply; 28+ messages in thread From: martin rudalics @ 2009-08-14 7:15 UTC (permalink / raw) To: Stefan Monnier; +Cc: Eli Zaretskii, emacs-devel >> I'd opt for two new primitives `goto-point-min' and `goto-point-max'. > > What for? To simplify typing. And dicussions like the present one ;-) martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-14 7:15 ` martin rudalics @ 2009-08-14 8:44 ` David Kastrup 2009-08-14 9:50 ` martin rudalics 0 siblings, 1 reply; 28+ messages in thread From: David Kastrup @ 2009-08-14 8:44 UTC (permalink / raw) To: emacs-devel martin rudalics <rudalics@gmx.at> writes: >>> I'd opt for two new primitives `goto-point-min' and `goto-point-max'. >> >> What for? > > To simplify typing. And dicussions like the present one ;-) I don't see how this "discussion" would be implified, typing is simplified only marginally, and understanding is usually affected negatively when simple, logical language idioms are replaced by functions with a separate name. If performance were an issue, it would perfectly well be addressed by the byte compiler. -- David Kastrup ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-14 8:44 ` David Kastrup @ 2009-08-14 9:50 ` martin rudalics 0 siblings, 0 replies; 28+ messages in thread From: martin rudalics @ 2009-08-14 9:50 UTC (permalink / raw) To: David Kastrup; +Cc: emacs-devel > I don't see how this "discussion" would be implified, It wouldn't have taken place in the first place. > typing is > simplified only marginally, Indeed. `goto-bob' and `goto-eob' would simplify completion. > and understanding is usually affected > negatively when simple, logical language idioms are replaced by > functions with a separate name. Not in this case: Instances of (goto-char 1) like those in reftex-* or `edit-tab-stops-note-changes' could have been avoided so understanding these would have been affected positively. > If performance were an issue, it would perfectly well be addressed by > the byte compiler. Not in people's .emacs. martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-11 3:07 ` point-min and 1 Eli Zaretskii 2009-08-11 9:18 ` martin rudalics @ 2009-08-11 15:13 ` Stefan Monnier 2009-08-11 18:32 ` Eli Zaretskii 1 sibling, 1 reply; 28+ messages in thread From: Stefan Monnier @ 2009-08-11 15:13 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel >> ;; Move to the specified line number in that buffer. >> (save-restriction >> (widen) >> - (goto-char 1) >> + (goto-char (point-min)) > Can `(goto-char (point-min))' be different from `(goto-char 1)' after > a call to `widen'? No, indeed it can't in Emacs, which is why the change is guaranteed to be correct. Stefan ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-11 15:13 ` Stefan Monnier @ 2009-08-11 18:32 ` Eli Zaretskii 2009-08-13 2:22 ` Stefan Monnier 0 siblings, 1 reply; 28+ messages in thread From: Eli Zaretskii @ 2009-08-11 18:32 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel > From: Stefan Monnier <monnier@IRO.UMontreal.CA> > Cc: emacs-devel@gnu.org > Date: Tue, 11 Aug 2009 11:13:55 -0400 > > >> ;; Move to the specified line number in that buffer. > >> (save-restriction > >> (widen) > >> - (goto-char 1) > >> + (goto-char (point-min)) > > > Can `(goto-char (point-min))' be different from `(goto-char 1)' after > > a call to `widen'? > > No, indeed it can't in Emacs, which is why the change is guaranteed to > be correct. I asked a serious question. Would you please humor me with a serious answer? ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-11 18:32 ` Eli Zaretskii @ 2009-08-13 2:22 ` Stefan Monnier 2009-08-13 4:38 ` Eli Zaretskii 2009-08-13 9:53 ` martin rudalics 0 siblings, 2 replies; 28+ messages in thread From: Stefan Monnier @ 2009-08-13 2:22 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel > I asked a serious question. Would you please humor me with a serious > answer? Just the same old general programming principle that says that you should avoid using integer constants and prefer to give them names, so the intention is clear. In the case of "1", there might be many different kinds of "1", it can be "1" the size of chars in a buffer, or "1" the position of the second char in a string, or ... As a general rule, using 1 rather than (point-min) tends to also introduce bugs where code only works when the buffer is widened, so it's good practice to prefer (point-min) over 1. Stefan ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 2:22 ` Stefan Monnier @ 2009-08-13 4:38 ` Eli Zaretskii 2009-08-13 9:53 ` martin rudalics 1 sibling, 0 replies; 28+ messages in thread From: Eli Zaretskii @ 2009-08-13 4:38 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel > From: Stefan Monnier <monnier@iro.umontreal.ca> > Cc: emacs-devel@gnu.org > Date: Wed, 12 Aug 2009 22:22:30 -0400 > > Just the same old general programming principle that says that you > should avoid using integer constants and prefer to give them names, so > the intention is clear. In the case of "1", there might be many > different kinds of "1", it can be "1" the size of chars in a buffer, or > "1" the position of the second char in a string, or ... > As a general rule, using 1 rather than (point-min) tends to also > introduce bugs where code only works when the buffer is widened, so it's > good practice to prefer (point-min) over 1. Thanks. I don't necessarily agree with the reasoning, but at least I understand the reasons for the change now. If we want this to be a general style convention, perhaps we should say something about it in the ELisp manual. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 2:22 ` Stefan Monnier 2009-08-13 4:38 ` Eli Zaretskii @ 2009-08-13 9:53 ` martin rudalics 2009-08-13 12:38 ` David Kastrup 2009-08-13 16:48 ` Stefan Monnier 1 sibling, 2 replies; 28+ messages in thread From: martin rudalics @ 2009-08-13 9:53 UTC (permalink / raw) To: Stefan Monnier; +Cc: Eli Zaretskii, emacs-devel > As a general rule, using 1 rather than (point-min) tends to also > introduce bugs where code only works when the buffer is widened, What sort of bugs? I suppose for every buffer 1 <= (point-min) holds invariantly. If the buffer is narrowed, clip_to_bounds asserts that (goto-char 1) goes to (goto-char (point-min)) so these two idioms are semantically equivalent regardless of whether a buffer is narrowed or not. Or what am I missing? > so it's > good practice to prefer (point-min) over 1. martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 9:53 ` martin rudalics @ 2009-08-13 12:38 ` David Kastrup 2009-08-13 14:40 ` martin rudalics 2009-08-13 16:48 ` Stefan Monnier 1 sibling, 1 reply; 28+ messages in thread From: David Kastrup @ 2009-08-13 12:38 UTC (permalink / raw) To: emacs-devel martin rudalics <rudalics@gmx.at> writes: >> As a general rule, using 1 rather than (point-min) tends to also >> introduce bugs where code only works when the buffer is widened, > > What sort of bugs? I suppose for every buffer > > 1 <= (point-min) > > holds invariantly. If the buffer is narrowed, clip_to_bounds asserts > that (goto-char 1) goes to (goto-char (point-min)) so these two idioms > are semantically equivalent regardless of whether a buffer is narrowed > or not. Or what am I missing? We have goto-char is an interactive built-in function in `C source code'. It is bound to <menu-bar> <edit> <goto> <go-to-pos>. (goto-char POSITION) Set point to POSITION, a number or marker. Beginning of buffer is position (point-min), end is (point-max). The return value is POSITION. [back] Can you guess from that what is done and returned when the buffer is narrowed and you call (cons (goto-char 1) (point))? From the DOC string, you could get an error thrown, or point is put outside of the narrowed region and a number of different things. It is not at all clear that you get no error, and something like (1 . 90) is returned. In order to find that out, you have not only to read the doc string, but the actual source code. Whether or not the actual result turns out what it is, it is a lousy idea to have to dig through the source code and all intricacies before being able to tell what some code does. The less information and detail you need to access before figuring out the function of some code, the better. Not least of all because you don't have dozens of accidental dependencies if at one point of time some of the incidental semantics are chosen to change. -- David Kastrup ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 12:38 ` David Kastrup @ 2009-08-13 14:40 ` martin rudalics 0 siblings, 0 replies; 28+ messages in thread From: martin rudalics @ 2009-08-13 14:40 UTC (permalink / raw) To: David Kastrup; +Cc: emacs-devel > goto-char is an interactive built-in function in `C source code'. > > It is bound to <menu-bar> <edit> <goto> <go-to-pos>. > > (goto-char POSITION) > > Set point to POSITION, a number or marker. > Beginning of buffer is position (point-min), end is (point-max). > > The return value is POSITION. > > [back] > > Can you guess from that what is done and returned when the buffer is > narrowed and you call (cons (goto-char 1) (point))? No. The doc-string is incomplete in this regard. But a similar thing happens when I want to go to a marker and that marker's position is not within the accessible portion of the buffer. (And no, I see no need to enhance the doc-string. It's all in the Elisp manual.) >>From the DOC string, you could get an error thrown, or point is put > outside of the narrowed region and a number of different things. It is > not at all clear that you get no error, and something like (1 . 90) is > returned. > > In order to find that out, you have not only to read the doc string, but > the actual source code. > > Whether or not the actual result turns out what it is, it is a lousy > idea to have to dig through the source code and all intricacies before > being able to tell what some code does. > > The less information and detail you need to access before figuring out > the function of some code, the better. > > Not least of all because you don't have dozens of accidental > dependencies if at one point of time some of the incidental semantics > are chosen to change. I hope you don't expect me to dispute anything you say here ;-) But all these arguments apply as well when you call (goto-char 1) in a widened buffer. One case against I could come up with is, that in a narrowed buffer referential transparency is lost because (goto-char (+ 1 1)) is not equivalent to (goto-char (+ (point-min) 1)) but I've been told once that referential transparency does not have very high priority within the development of Emacs. martin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: point-min and 1 2009-08-13 9:53 ` martin rudalics 2009-08-13 12:38 ` David Kastrup @ 2009-08-13 16:48 ` Stefan Monnier 1 sibling, 0 replies; 28+ messages in thread From: Stefan Monnier @ 2009-08-13 16:48 UTC (permalink / raw) To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel >> As a general rule, using 1 rather than (point-min) tends to also >> introduce bugs where code only works when the buffer is widened, > What sort of bugs? All kinds, really. Note that I'm talking about the use of 1 i.s.o point-min in general, not specifically in calls to goto-char. For many other functions (e.g. put-text-property), using 1 rather than (point-min) can result in signalling an error when the buffer is narrowed. Stefan ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2009-08-14 9:55 UTC | newest] Thread overview: 28+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <E1Macea-0002f3-HQ@monty-python.gnu.org> 2009-08-11 3:07 ` point-min and 1 Eli Zaretskii 2009-08-11 9:18 ` martin rudalics 2009-08-11 18:22 ` Eli Zaretskii 2009-08-12 8:55 ` martin rudalics 2009-08-12 17:39 ` Eli Zaretskii 2009-08-12 23:03 ` Miles Bader 2009-08-13 0:13 ` Daniel Colascione 2009-08-13 9:52 ` martin rudalics 2009-08-13 16:49 ` Stefan Monnier 2009-08-13 18:08 ` martin rudalics 2009-08-13 21:28 ` Chong Yidong 2009-08-13 23:21 ` Juri Linkov 2009-08-14 7:16 ` martin rudalics 2009-08-14 9:30 ` David Kastrup 2009-08-14 9:50 ` martin rudalics 2009-08-14 9:55 ` Miles Bader 2009-08-14 1:29 ` Stefan Monnier 2009-08-14 7:15 ` martin rudalics 2009-08-14 8:44 ` David Kastrup 2009-08-14 9:50 ` martin rudalics 2009-08-11 15:13 ` Stefan Monnier 2009-08-11 18:32 ` Eli Zaretskii 2009-08-13 2:22 ` Stefan Monnier 2009-08-13 4:38 ` Eli Zaretskii 2009-08-13 9:53 ` martin rudalics 2009-08-13 12:38 ` David Kastrup 2009-08-13 14:40 ` martin rudalics 2009-08-13 16:48 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.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).