all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: point-min and 1
Date: Thu, 13 Aug 2009 16:40:31 +0200	[thread overview]
Message-ID: <4A8425DF.3050201@gmx.at> (raw)
In-Reply-To: <87ws57nb2q.fsf@lola.goethe.zz>

 > 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




  reply	other threads:[~2009-08-13 14:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2009-08-13 16:48           ` 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=4A8425DF.3050201@gmx.at \
    --to=rudalics@gmx.at \
    --cc=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.