all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 75d9a55: Fix bug 32543
Date: Tue, 18 Sep 2018 17:11:24 -0400	[thread overview]
Message-ID: <jwvtvmma536.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <87bm8u906v.fsf@calancha-pc.dy.bbexcite.jp> (Tino Calancha's message of "Wed, 19 Sep 2018 02:37:12 +0900")

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



  reply	other threads:[~2018-09-18 21:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180918123203.24597.514@vcs0.savannah.gnu.org>
     [not found] ` <20180918123205.8BE9B204DF@vcs0.savannah.gnu.org>
2018-09-18 12:56   ` [Emacs-diffs] master 75d9a55: Fix bug 32543 Stefan Monnier
2018-09-18 17:37     ` Tino Calancha
2018-09-18 21:11       ` Stefan Monnier [this message]
2018-09-18 22:03         ` Tino Calancha
2018-09-19 13:34           ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvtvmma536.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=tino.calancha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.