[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master 75d9a55: Fix bug 32543
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] master 75d9a55: Fix bug 32543 |
Date: |
Tue, 18 Sep 2018 17:11:24 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>> - why store this info in text-properties rather than in
>> buffer-local variables?
> I realized the buffer was already saved there with property
> `occur-title'; I didn't wanted to scatter around related info.
Hmmm... do you happen to have some intuition about why the buffer was
saved in a text-property rather than in a buffer-local var?
It's a really odd choice (less efficient, more work for the coder, with
various side-problems like "on which char should I put it", etc...).
[ Also, why is it saved under a name like `occur-title` rather
than, say `occur-buffer`? ]
>>> + (with-current-buffer buffer
>>> + (when (wholenump orig-line)
>>> + (goto-char 1)
>>
>> I'd recommend `point-min` instead of 1 here.
> OK. I always remember the discussion at
> https://lists.gnu.org/archive/html/emacs-devel/2009-08/msg00520.html
> but I forgot which was the encouraged practice there: in these cases
> I follow the 50% rule to reject 0% success ratio (I know, it brings
> 50% failure ratio: life is full of injustice).
I just always recommend `point-min`. Hard-coded constants are always
weird in source code, whereas `point-min` clearly says what this
constant is (and in terms of efficiency, it's a wash, or `point-min`
might even be marginally more efficient).
Stefan