GNU bug report logs - #24021
FEATURE ADDITION: 25.0.94: goto-marker, jumps to a marker potentially in a different buffer

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: rswgnu@HIDDEN; dated Mon, 18 Jul 2016 16:24:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 24021 <at> debbugs.gnu.org:


Received: (at 24021) by debbugs.gnu.org; 20 Jul 2016 01:55:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 19 21:55:37 2016
Received: from localhost ([127.0.0.1]:57747 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bPgjZ-0003dm-80
	for submit <at> debbugs.gnu.org; Tue, 19 Jul 2016 21:55:37 -0400
Received: from mail-it0-f50.google.com ([209.85.214.50]:36285)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1bPgjY-0003db-1Y
 for 24021 <at> debbugs.gnu.org; Tue, 19 Jul 2016 21:55:36 -0400
Received: by mail-it0-f50.google.com with SMTP id f6so105153071ith.1
 for <24021 <at> debbugs.gnu.org>; Tue, 19 Jul 2016 18:55:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date
 :message-id:mime-version;
 bh=1nGVB4NoeCj4ZQ5odYjQkPxDPBHOCa1gslHdMYLcto4=;
 b=T0Vk2QhDlubz4EDfwwHim450S+RUzR7lTgGVnNciFoTEBPcrgQ4a5tVv3S4j5kaQdX
 v/qv/j7tueIFBNP5VTSxEJ5wdjaaH1Jw1MKpOx6NJ0zk0VxKxOF4Mol+Pb4dkoxa4W9j
 nbbmzP+SC068NxoZDHnTnQ7Lr5KnhqY7SS6LDqgSSVkKOk+82lnOvzndTpiIG0/6cY2z
 skk0n6u/2vVJYgB7vMMH/9WONOPa4BM7H0i++u7Yqq0xeSNFrs+MwvYezASnmMeT1uzl
 pZpdBzns4auzh5aR1CToylE1HhidGWZyS/cuNA4bU3SzPTzJOtTqeD7wfZsM73nDDU2R
 sklw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references
 :user-agent:date:message-id:mime-version;
 bh=1nGVB4NoeCj4ZQ5odYjQkPxDPBHOCa1gslHdMYLcto4=;
 b=f1dSdQQDFeLSpvS55mzmS6wiDMspnI/AX2p735IiSJpdPpZd8Q/Z1GQv2vcUiIHGbv
 6C3G9ScXQe+hunA+M/vPE5OgqhUxlfPn0Cx52A+NbbHulBhcbZ3F5cwivdHSpjYzqr0W
 ovvdAhaS8xvzgZSI0UyFf0Bao01S4s1ZhsC2OFXguCW9t0jq1Oa15RiSh9V7oaGbbNM5
 k7jP+fUzhGFScY21DjOxI/WvK/adeQPbtkMaqjFnqIj6VdS4ett0tUtsLR1wS1n0Cmfw
 Tec8tvKOIqkAGMFOreOzHjN5Hin1s6fTAY2pk3v+9Re4aXzYehDUUXpa3VGNAYir8D1j
 gyBg==
X-Gm-Message-State: ALyK8tJxt7Sb+BH32WVDXTW7z+tty7OCZwLDn0/nU7H4l9/x2QlKYo/ekPX7Ebwy0wXLpA==
X-Received: by 10.36.29.5 with SMTP id 5mr6893667itj.97.1468979730456;
 Tue, 19 Jul 2016 18:55:30 -0700 (PDT)
Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44])
 by smtp.googlemail.com with ESMTPSA id f9sm349059ioi.2.2016.07.19.18.55.29
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 19 Jul 2016 18:55:29 -0700 (PDT)
From: npostavs@HIDDEN
To: Robert Weiner <rsw@HIDDEN>
Subject: Re: bug#24021: FEATURE ADDITION: 25.0.94: goto-marker,
 jumps to a marker potentially in a different buffer
In-Reply-To: <CA+OMD9gETavHsLaoQ2s=P=f280VhM6+CoUv2Bm+v4FjD4ETAqg@HIDDEN>
 (Robert Weiner's message of "Tue, 19 Jul 2016 09:15:49 -0400")
References: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@HIDDEN>
 <87oa5ucx1a.fsf@HIDDEN>
 <CA+OMD9gETavHsLaoQ2s=P=f280VhM6+CoUv2Bm+v4FjD4ETAqg@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux)
Date: Tue, 19 Jul 2016 21:55:30 -0400
Message-ID: <87fur5cbu5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 24021
Cc: rswgnu@HIDDEN, 24021 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Robert Weiner <rsw@HIDDEN> writes:

>
> I like these checks as they make the specific error very
> clear. set-buffer will trigger a type error when given a nil buffer
> but neither marker-buffer nor marker-position signal an error when
> given a marker that doesn't point anywhere, so the checks prior to
> calling those functions are relevant.

Fair enough, I would suggest using (unless ... (error ...)) to avoid
having the error checking add nesting depth to the main code.

>>
>> If this is just a "simple function" (not an interactive command), it
>> shouldn't widen, or call switch-to-buffer.
>>
>> 
>>
>> save-excursion or save-current-buffer don't counteract
>> switch-to-buffer, because it affects the UI selected buffer.
>
> You are right that save-excursion and save-restriction won't
> counteract the effects of this function, so its purpose must be to put
> the selected window's point at the location of the marker. Possibly, a
> macro called with-marker-location could be useful when one needs to
> temporarily set buffer and point from a marker and evaluate some forms
> but not affect the display.

It really just makes more sense to let the caller do (switch-to-buffer
(current-buffer)) if needed.  Or display-buffer, or pop-to-buffer.  Not
hard coding the switch-to-buffer call makes the function more flexible
and usable in more situations.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24021; Package emacs. Full text available.

Message received at 24021 <at> debbugs.gnu.org:


Received: (at 24021) by debbugs.gnu.org; 19 Jul 2016 13:16:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 19 09:16:41 2016
Received: from localhost ([127.0.0.1]:56611 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bPUt2-0006wU-D4
	for submit <at> debbugs.gnu.org; Tue, 19 Jul 2016 09:16:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58186)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rsw@HIDDEN>) id 1bPUsv-0006w8-PM
 for 24021 <at> debbugs.gnu.org; Tue, 19 Jul 2016 09:16:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rsw@HIDDEN>) id 1bPUsn-0000eH-5h
 for 24021 <at> debbugs.gnu.org; Tue, 19 Jul 2016 09:16:24 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 RP_MATCHES_RCVD autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45006)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bPUsn-0000e4-28
 for 24021 <at> debbugs.gnu.org; Tue, 19 Jul 2016 09:16:21 -0400
Received: from mail-oi0-f54.google.com ([209.85.218.54]:36099)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <rsw@HIDDEN>) id 1bPUsl-0002mS-EQ
 for 24021 <at> debbugs.gnu.org; Tue, 19 Jul 2016 09:16:19 -0400
Received: by mail-oi0-f54.google.com with SMTP id w18so24522462oiw.3
 for <24021 <at> debbugs.gnu.org>; Tue, 19 Jul 2016 06:16:19 -0700 (PDT)
X-Gm-Message-State: ALyK8tKtcGCR39eYeMKkRhKx+xVqTgNvKCxRHf9PFamjN3aV6O/KMZv4nJoaN5c+d9sgOf+zjA5j6cpwgP83dA==
X-Received: by 10.157.10.16 with SMTP id 16mr24388958otg.131.1468934178685;
 Tue, 19 Jul 2016 06:16:18 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.199.143 with HTTP; Tue, 19 Jul 2016 06:15:49 -0700 (PDT)
In-Reply-To: <87oa5ucx1a.fsf@HIDDEN>
References: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@HIDDEN>
 <87oa5ucx1a.fsf@HIDDEN>
From: Robert Weiner <rsw@HIDDEN>
Date: Tue, 19 Jul 2016 09:15:49 -0400
X-Gmail-Original-Message-ID: <CA+OMD9gETavHsLaoQ2s=P=f280VhM6+CoUv2Bm+v4FjD4ETAqg@HIDDEN>
Message-ID: <CA+OMD9gETavHsLaoQ2s=P=f280VhM6+CoUv2Bm+v4FjD4ETAqg@HIDDEN>
Subject: Re: bug#24021: FEATURE ADDITION: 25.0.94: goto-marker, jumps to a
 marker potentially in a different buffer
To: Noam Postavsky <npostavs@HIDDEN>
Content-Type: multipart/alternative; boundary=001a113bfd0ceb4b750537fce393
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -3.8 (---)
X-Debbugs-Envelope-To: 24021
Cc: 24021 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: rswgnu@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.3 (------)

--001a113bfd0ceb4b750537fce393
Content-Type: text/plain; charset=UTF-8

Slightly revised version of the function below.

On Mon, Jul 18, 2016 at 8:05 PM, <npostavs@HIDDEN> wrote:
>
>
> > (defun goto-marker (marker)
> >   "Make MARKER's buffer and position current."
> >   (interactive)
>
> The interactive spec doesn't match the parameter list.  I'm not sure if
> it makes sense for this to be interactive (how would the user enter a
> marker?).


The interactive spec has been removed.

>
>
> >   (cond ((not (markerp marker))
> >          (error "Invalid marker: %s" marker))
> >         ((not (marker-buffer marker))
> >          (error "Invalid marker buffer: %s" marker))
>
> I think these checks are redundant, you'll get the same errors when you
> call marker-buffer and set-buffer, below.

I like these checks as they make the specific error very clear.  set-buffer
will trigger a type error when given a nil buffer but neither marker-buffer
nor marker-position signal an error when given a marker that doesn't point
anywhere, so the checks prior to calling those functions are relevant.

>
> >         (t (let* ((buffer (marker-buffer marker))
> >                   (position (marker-position marker)))
> >              (set-buffer buffer)
> >              (or (and (>= position (point-min))
> >                       (<= position (point-max)))
> >                  (if widen-automatically
> >                      (widen)
> >                    (error "Marker position is outside accessible part
of buffer: %s" marker)))
> >              (goto-char position)
> >              (switch-to-buffer buffer)))))
>
> If this is just a "simple function" (not an interactive command), it
> shouldn't widen, or call switch-to-buffer.
>
>
>
> save-excursion or save-current-buffer don't counteract
>
> switch-to-buffer, because it affects the UI selected buffer. You might
>
> be right about the widen part, not sure.


You are right that save-excursion and save-restriction won't counteract the
effects of this function, so its purpose must be to put the selected
window's point at the location of the marker.  Possibly, a macro called
with-marker-location could be useful when one needs to temporarily set
buffer and point from a marker and evaluate some forms

but not affect the display.

Here is the slightly revised function.  -- Bob

(defun hypb:goto-marker (marker)
  "Make MARKER's buffer and position current.
If MARKER is invalid signal an error."
  (cond ((not (markerp marker))
(error "Invalid marker: %s" marker))
((not (marker-buffer marker))
(error "Invalid marker buffer: %s" marker))
(t (let* ((buffer (marker-buffer marker))
 (position (marker-position marker)))
    (set-buffer buffer)
    (unless (and (>= position (point-min))
 (<= position (point-max)))
      (if widen-automatically
  (widen)
(error "Marker position is outside accessible part of buffer: %s" marker)))
    (goto-char position)
    (switch-to-buffer buffer)))))

--001a113bfd0ceb4b750537fce393
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><font face=3D"monospace, monospace">Slightly revised versi=
on of the function below.<br><br>On Mon, Jul 18, 2016 at 8:05 PM, &lt;<a hr=
ef=3D"mailto:npostavs@HIDDEN">npostavs@HIDDEN=
</a>&gt; wrote:<br>&gt;<br>&gt;<br>&gt; &gt; (defun goto-marker (marker)<br=
>&gt; &gt; =C2=A0 &quot;Make MARKER&#39;s buffer and position current.&quot=
;<br>&gt; &gt; =C2=A0 (interactive)<br>&gt;<br>&gt; The interactive spec do=
esn&#39;t match the parameter list.=C2=A0 I&#39;m not sure if<br>&gt; it ma=
kes sense for this to be interactive (how would the user enter a<br>&gt; ma=
rker?).<br><br><br>The interactive spec has been removed.<br>=C2=A0<br>&gt;=
<br>&gt;<br>&gt; &gt; =C2=A0 (cond ((not (markerp marker))<br>&gt; &gt; =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(error &quot;Invalid marker: %s&quot; marker=
))<br>&gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((not (marker-buffer marker))<b=
r>&gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(error &quot;Invalid marker b=
uffer: %s&quot; marker))<br>&gt;<br>&gt; I think these checks are redundant=
, you&#39;ll get the same errors when you<br>&gt; call marker-buffer and se=
t-buffer, below.<br><br>I like these checks as they make the specific error=
 very clear. =C2=A0set-buffer will trigger a type error when given a nil bu=
ffer but neither marker-buffer nor marker-position signal an error when giv=
en a marker that doesn&#39;t point anywhere, so the checks prior to calling=
 those functions are relevant.<br><br>&gt;<br>&gt; &gt; =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 (t (let* ((buffer (marker-buffer marker))<br>&gt; &gt; =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (position (marker-p=
osition marker)))<br>&gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0(set-buffer buffer)<br>&gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0(or (and (&gt;=3D position (point-min))<br>&gt; &gt; =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (&lt;=
=3D position (point-max)))<br>&gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0(if widen-automatically<br>&gt; &gt; =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(widen)<b=
r>&gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0(error &quot;Marker position is outside accessible part of buffer: %s=
&quot; marker)))<br>&gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0(goto-char position)<br>&gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0(switch-to-buffer buffer)))))<br>&gt;<br>&gt; If this is just a &=
quot;simple function&quot; (not an interactive command), it<br>&gt; shouldn=
&#39;t widen, or call switch-to-buffer.<br>&gt;<br>&gt; =C2=A0<br>&gt;<br>&=
gt; save-excursion or save-current-buffer don&#39;t counteract<br>&gt;<br>&=
gt; switch-to-buffer, because it affects the UI selected buffer. You might<=
br>&gt;<br>&gt; be right about the widen part, not sure.<br><br><br>You are=
 right that save-excursion and save-restriction won&#39;t counteract the ef=
fects of this function, so its purpose must be to put the selected window&#=
39;s point at the location of the marker.=C2=A0 Possibly, a macro called wi=
th-marker-location could be useful when one needs to temporarily set buffer=
 and point from a marker and evaluate some forms<br>=C2=A0<br>but not affec=
t the display.<br><br>Here is the slightly revised function. =C2=A0-- Bob</=
font><div><font face=3D"monospace, monospace"><br></font><div><font face=3D=
"monospace, monospace">(defun hypb:goto-marker (marker)</font></div><div><f=
ont face=3D"monospace, monospace">=C2=A0 &quot;Make MARKER&#39;s buffer and=
 position current.</font></div><div><font face=3D"monospace, monospace">If =
MARKER is invalid signal an error.&quot;</font></div><div><font face=3D"mon=
ospace, monospace">=C2=A0 (cond ((not (markerp marker))</font></div><div><f=
ont face=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre=
">	</span> (error &quot;Invalid marker: %s&quot; marker))</font></div><div>=
<font face=3D"monospace, monospace"><span class=3D"" style=3D"white-space:p=
re">	</span>((not (marker-buffer marker))</font></div><div><font face=3D"mo=
nospace, monospace"><span class=3D"" style=3D"white-space:pre">	</span> (er=
ror &quot;Invalid marker buffer: %s&quot; marker))</font></div><div><font f=
ace=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre">	</=
span>(t (let* ((buffer (marker-buffer marker))</font></div><div><font face=
=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre">		</sp=
an> =C2=A0(position (marker-position marker)))</font></div><div><font face=
=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre">	</spa=
n> =C2=A0 =C2=A0 (set-buffer buffer)</font></div><div><font face=3D"monospa=
ce, monospace"><span class=3D"" style=3D"white-space:pre">	</span> =C2=A0 =
=C2=A0 (unless (and (&gt;=3D position (point-min))</font></div><div><font f=
ace=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre">			=
</span> =C2=A0(&lt;=3D position (point-max)))</font></div><div><font face=
=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre">	</spa=
n> =C2=A0 =C2=A0 =C2=A0 (if widen-automatically</font></div><div><font face=
=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre">		</sp=
an> =C2=A0 (widen)</font></div><div><font face=3D"monospace, monospace"><sp=
an class=3D"" style=3D"white-space:pre">		</span> (error &quot;Marker posit=
ion is outside accessible part of buffer: %s&quot; marker)))</font></div><d=
iv><font face=3D"monospace, monospace"><span class=3D"" style=3D"white-spac=
e:pre">	</span> =C2=A0 =C2=A0 (goto-char position)</font></div><div><font f=
ace=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre">	</=
span> =C2=A0 =C2=A0 (switch-to-buffer buffer)))))</font></div><div><br></di=
v></div></div>

--001a113bfd0ceb4b750537fce393--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24021; Package emacs. Full text available.

Message received at 24021 <at> debbugs.gnu.org:


Received: (at 24021) by debbugs.gnu.org; 19 Jul 2016 02:20:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 18 22:20:28 2016
Received: from localhost ([127.0.0.1]:56139 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bPKe4-0003Ac-01
	for submit <at> debbugs.gnu.org; Mon, 18 Jul 2016 22:20:28 -0400
Received: from mail-oi0-f44.google.com ([209.85.218.44]:34508)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1bPKe2-0003AO-Pw
 for 24021 <at> debbugs.gnu.org; Mon, 18 Jul 2016 22:20:27 -0400
Received: by mail-oi0-f44.google.com with SMTP id l65so6822140oib.1
 for <24021 <at> debbugs.gnu.org>; Mon, 18 Jul 2016 19:20:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:in-reply-to:references:from:date:message-id
 :subject:to:cc:content-transfer-encoding;
 bh=NAN3sAeeVeiyUbyR+AnGK9RpDTyySm1UsKGyGjJuGb4=;
 b=ZKi1xiFrQ9sPa/ruGt2u2bK+0xLPkVYmQzeVsBiB5al3ahUnukqwS774KZo+xgCyPB
 WbiqNSQhVKFye2b+MHoeefkZc37evtworYcrIZ83P3pevo9cdvCbuRQsoI515wNE2sKR
 bL/AqMWm2fnFDpNAS/y8VT0gx8d02AO287ONgkq/BjgB1PxelUY0Mm5edY+p6hrFuCTe
 CcJ/zLx7x7Mi9HTWWyXwxIPvJhrH6k3AQufNZlDyEwJHcN7sH3oBv3vlPLPWOqMkQ4/M
 YnmbTgJoJscz9zoLVCMnL639LSW0LBnA3naRPSK8F3dCVPUvQYBa0TARRyLOMXGtCDkt
 h73g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
 :date:message-id:subject:to:cc:content-transfer-encoding;
 bh=NAN3sAeeVeiyUbyR+AnGK9RpDTyySm1UsKGyGjJuGb4=;
 b=JKojkE02p5B89yD7CPmJC3yJegHjNLx5lWqggUgjv/DKK0btzOYKRNO0YOPXoNPa0B
 8XVjIzvuXLIQ35B/qGrjHTDd363WV8mbjRXM5C7PIfPzP8N8NiDt9nkxEzFAtyFF3Wco
 1C98ViRvICmaz3W6zJTS1W0ufCI+jNulDUiJNKYLD+dTZyvKZbisXyoBF+g/xzKPigI9
 yne4U4Hjxb1IXmMJvBBOOkoBXjHgKqOPE3E8EdVgJ0xgR1+aQ2L8mZbKT/ALp5Jmhr/P
 mnudtqH2HyefUWbDNuuAvQ8/6RN6LW9kb7j8uhMo4BzisXvGe3WfEfLYhOtbHgvBmS9M
 eNjQ==
X-Gm-Message-State: ALyK8tJ+OQBJhhyohcoio3GFPAc3sjgBENZiPHxrYgSanvQ7f/qbxTBvVSyJ28m6gwZ4/VrTuxPZ1sSv8xkFMQ==
X-Received: by 10.202.72.70 with SMTP id v67mr14918000oia.143.1468894821302;
 Mon, 18 Jul 2016 19:20:21 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.157.7.161 with HTTP; Mon, 18 Jul 2016 19:20:20 -0700 (PDT)
In-Reply-To: <46351974-097B-48D3-8A60-7881CA9A2553@HIDDEN>
References: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@HIDDEN>
 <87oa5ucx1a.fsf@HIDDEN>
 <46351974-097B-48D3-8A60-7881CA9A2553@HIDDEN>
From: Noam Postavsky <npostavs@HIDDEN>
Date: Mon, 18 Jul 2016 22:20:20 -0400
X-Google-Sender-Auth: jvDHRapwmYSn25ZE8zplDEyaCiE
Message-ID: <CAM-tV-88ZnqRgOMLPUaxrXHw217ROouqg5T5tF7cjZoArngAug@HIDDEN>
Subject: Re: bug#24021: FEATURE ADDITION: 25.0.94: goto-marker, jumps to a
 marker potentially in a different buffer
To: Robert Weiner <rswgnu@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 24021
Cc: 24021 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

On Mon, Jul 18, 2016 at 10:05 PM, Robert Weiner <rswgnu@HIDDEN> wrote:
>>
>> If this is just a "simple function" (not an interactive command), it
>> shouldn't widen, or call switch-to-buffer.
>
> But it does need to do these things to leave the selected buffer and poin=
t where the marker points.  It only widens if the marker position is outsid=
e the restricted range.  It can be wrapped in save-restriction and save-exc=
ursion for times when it is used for temporary effect, e.g. to find the col=
umn of the marker position.

save-excursion or save-current-buffer don't counteract
switch-to-buffer, because it affects the UI selected buffer. You might
be right about the widen part, not sure.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24021; Package emacs. Full text available.

Message received at 24021 <at> debbugs.gnu.org:


Received: (at 24021) by debbugs.gnu.org; 19 Jul 2016 02:05:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 18 22:05:43 2016
Received: from localhost ([127.0.0.1]:56135 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bPKPn-0002q2-Kw
	for submit <at> debbugs.gnu.org; Mon, 18 Jul 2016 22:05:43 -0400
Received: from mail-io0-f171.google.com ([209.85.223.171]:36650)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rswgnu@HIDDEN>) id 1bPKPl-0002pm-Ox
 for 24021 <at> debbugs.gnu.org; Mon, 18 Jul 2016 22:05:42 -0400
Received: by mail-io0-f171.google.com with SMTP id b62so7012170iod.3
 for <24021 <at> debbugs.gnu.org>; Mon, 18 Jul 2016 19:05:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=kCy5G/rW5Lgnk6yRwyazX9fk2NhT3RM0XS/cj3V9ukQ=;
 b=cBhqJ74YrROrbBhO0pEb/sw/kxAwjeUkdPtwX+G+qyisTk/HYd82jyxr+v+UPjSp0r
 1iOKjqw8IWB6gwDUokeHWfJLe+qho15vKLVyxWNA3xXky/pbVLaO4CSR0t9s2fUBf1O1
 68XejVwQ15e3WQpLen3lM20RBrcBNPlVZ3Xzcn/isCdvA5ik0PdO1D7k+fDhrI/SxcfJ
 0dBsApP2HI83HJg3A3LdWVZ3B/x1DURFwMGRhfT1JxOBPETDHJKhlQ8/JwubhIBkp5rY
 JyGU9TshyZw5nqyx09t7IGc1tUQAvoxMBY+/ydjsy8JRBzwNDRuNpW06q8KU6xYuIiuf
 cweg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=kCy5G/rW5Lgnk6yRwyazX9fk2NhT3RM0XS/cj3V9ukQ=;
 b=U0dpYerKg4YYkuDxouii5TbWr7MdNZInYbB3peTjl+4ruUSuQjSwcghbR3zOIDgZy4
 yNyVn5QB9sxYujB3hjI4uwQ64GmTOxPnlJPA9spTftHYqSgXW1bEjoDQtwVrBDrDoo6m
 Wa8eHkERVcHJEvDUc4SHFjio5okjw7nCoZ6Hf9RivVLFVUA4KGCT7jnyvne06+2mPt4I
 NmMvj5WkpKIxcSv28YnNURXfH/DqnrDA2lD/vStyovlwLZ8+tOHfuoU+R9DrVTY4I+UT
 15A077VjuxNkohIOEU0g6BpA573B2NFabsNFvteEaJ7//SR3yT1JvPl7SPBTPjhgzyEK
 PkaQ==
X-Gm-Message-State: ALyK8tIlFF767NzHm1FV4tceO4XtrYUMXaG3KSw3QWYClwCriXwaZzIFyyWOqGN3RzUTpA==
X-Received: by 10.107.7.231 with SMTP id g100mr35734592ioi.64.1468893936067;
 Mon, 18 Jul 2016 19:05:36 -0700 (PDT)
Received: from ?IPv6:2600:1017:b825:16f:3c8d:5c66:68af:47a0?
 ([2600:1017:b825:16f:3c8d:5c66:68af:47a0])
 by smtp.gmail.com with ESMTPSA id r8sm5842086itb.5.2016.07.18.19.05.35
 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Mon, 18 Jul 2016 19:05:35 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (1.0)
Subject: Re: bug#24021: FEATURE ADDITION: 25.0.94: goto-marker,
 jumps to a marker potentially in a different buffer
From: Robert Weiner <rswgnu@HIDDEN>
X-Mailer: iPhone Mail (13F69)
In-Reply-To: <87oa5ucx1a.fsf@HIDDEN>
Date: Mon, 18 Jul 2016 22:05:33 -0400
Content-Transfer-Encoding: quoted-printable
Message-Id: <46351974-097B-48D3-8A60-7881CA9A2553@HIDDEN>
References: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@HIDDEN>
 <87oa5ucx1a.fsf@HIDDEN>
To: npostavs@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 24021
Cc: 24021 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Thanks for the feedback.  I will work on an update.

-- Bob

> On Jul 18, 2016, at 8:05 PM, npostavs@HIDDEN wrote:
>>=20
>> (defun goto-marker (marker)
>>  "Make MARKER's buffer and position current."
>>  (interactive)
>=20
> The interactive spec doesn't match the parameter list.  I'm not sure if
> it makes sense for this to be interactive (how would the user enter a
> marker?).

That interactive spec should not be in there.
>=20
>>  (cond ((not (markerp marker))
>>         (error "Invalid marker: %s" marker))
>>        ((not (marker-buffer marker))
>>         (error "Invalid marker buffer: %s" marker))
>=20
> I think these checks are redundant, you'll get the same errors when you
> call marker-buffer and set-buffer, below.

I will take a look.
>=20
>>        (t (let* ((buffer (marker-buffer marker))
>>                  (position (marker-position marker)))
>>             (set-buffer buffer)
>>             (or (and (>=3D position (point-min))
>>                      (<=3D position (point-max)))
>>                 (if widen-automatically
>>                     (widen)
>>                   (error "Marker position is outside accessible part of b=
uffer: %s" marker)))
>>             (goto-char position)
>>             (switch-to-buffer buffer)))))
>=20
> If this is just a "simple function" (not an interactive command), it
> shouldn't widen, or call switch-to-buffer.

But it does need to do these things to leave the selected buffer and point w=
here the marker points.  It only widens if the marker position is outside th=
e restricted range.  It can be wrapped in save-restriction and save-excursio=
n for times when it is used for temporary effect, e.g. to find the column of=
 the marker position.

Bob=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24021; Package emacs. Full text available.

Message received at 24021 <at> debbugs.gnu.org:


Received: (at 24021) by debbugs.gnu.org; 19 Jul 2016 00:05:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 18 20:05:29 2016
Received: from localhost ([127.0.0.1]:56105 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bPIXR-0006bC-53
	for submit <at> debbugs.gnu.org; Mon, 18 Jul 2016 20:05:29 -0400
Received: from mail-io0-f179.google.com ([209.85.223.179]:32888)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>)
 id 1bPIXO-0006at-DM; Mon, 18 Jul 2016 20:05:27 -0400
Received: by mail-io0-f179.google.com with SMTP id 38so5365863iol.0;
 Mon, 18 Jul 2016 17:05:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=rpdw8HDoeyWp33JA7mOjX3M1g6/f5CR3u0y2f2CwZ7s=;
 b=JO+8BlUsLbsomC3w8eHxHJFDAWuNP1biJeU74gr8sOWCqx7Lb1aiudv15OJsO0sxJz
 2fSvFDEJTwdODXxuWn+IpZusCPw+yV0gG2tZ5vpk7KT2gJdoTtYDtqdpNPhdNVaj7FCG
 TLZUGQt1h3N9eY/4AKUDNp02r2FqNkRzIkebDvgyrVHAclVKgsXmjjJEB8LrfC4513li
 GbHYDeSKl+XnrLnHe/iwRyJGTbAVxTIfIhPkb0Vosssirfv3rQIy96POHBTGhfv2qWmL
 3ZQNbIfaEP9CL99s99Xk70uLnmpv1ieadMw9S0yfnMKrbGFWdTNfLHB9vQ7H4QGghJgb
 /3Ag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=rpdw8HDoeyWp33JA7mOjX3M1g6/f5CR3u0y2f2CwZ7s=;
 b=bhYo/E8fjxY7rPJz0JxonpNvvmVFNsZSAazL71z/S+wAQJsyiW6C9CKRgYxQCFE9s2
 8m9z2qSZzT8ncaycSlOhWEic9JGZGmmP26eZmiocqST0STSLod5bP25wEJvcuQ0NBME8
 K0UNdQR/VRlFNod8UolXTmpMP3FpPvbF2kUuEdv7M9OddFFR/nkKa2GAFPEA6YEidbit
 5xifGeJ2B6viu72muXlovicb8YyGr53arrY5FDdVWXd7z4uDgWSP8E/890BUBRuPuJ30
 VNXXMlsvx5ftcr+R9IKBXzvvX2qglK5wtCamye+aqmDMJoZOzPhnWHfwZ7zXlqvjibVu
 XH0Q==
X-Gm-Message-State: ALyK8tJTlA4UDw9vLv+TVPNtqNfgcdxFnJAgE99UuAHTe8OPfKx1hh520WiQSahQ73vMCg==
X-Received: by 10.107.182.8 with SMTP id g8mr26318727iof.53.1468886720908;
 Mon, 18 Jul 2016 17:05:20 -0700 (PDT)
Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44])
 by smtp.googlemail.com with ESMTPSA id p63sm5629243itg.9.2016.07.18.17.05.20
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 18 Jul 2016 17:05:20 -0700 (PDT)
From: npostavs@HIDDEN
To: Robert Weiner <rsw@HIDDEN>
Subject: Re: bug#24021: FEATURE ADDITION: 25.0.94: goto-marker,
 jumps to a marker potentially in a different buffer
References: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@HIDDEN>
Date: Mon, 18 Jul 2016 20:05:21 -0400
In-Reply-To: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@HIDDEN>
 (Robert Weiner's message of "Mon, 18 Jul 2016 12:23:02 -0400")
Message-ID: <87oa5ucx1a.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 24021
Cc: rswgnu@HIDDEN, 24021 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

severity 24021 wishlist
quit

Robert Weiner <rsw@HIDDEN> writes:

> Since goto-char signals an error when given a marker pointing to a
> buffer other than the current one (probably to prevent programming
> errors) and pop-global-mark only works on the global-mark-ring, there
> is a need for a simple function that jumps to the location of an
> arbitrary marker. The following function does that and is based on
> pop-global-mark. Please consider adding it to simple.el.
>
> Bob
>
> (defun goto-marker (marker)
>   "Make MARKER's buffer and position current."
>   (interactive)

The interactive spec doesn't match the parameter list.  I'm not sure if
it makes sense for this to be interactive (how would the user enter a
marker?).

>   (cond ((not (markerp marker))
>          (error "Invalid marker: %s" marker))
>         ((not (marker-buffer marker))
>          (error "Invalid marker buffer: %s" marker))

I think these checks are redundant, you'll get the same errors when you
call marker-buffer and set-buffer, below.

>         (t (let* ((buffer (marker-buffer marker))
>                   (position (marker-position marker)))
>              (set-buffer buffer)
>              (or (and (>= position (point-min))
>                       (<= position (point-max)))
>                  (if widen-automatically
>                      (widen)
>                    (error "Marker position is outside accessible part of buffer: %s" marker)))
>              (goto-char position)
>              (switch-to-buffer buffer)))))

If this is just a "simple function" (not an interactive command), it
shouldn't widen, or call switch-to-buffer.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24021; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Jul 2016 16:23:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 18 12:23:49 2016
Received: from localhost ([127.0.0.1]:55914 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bPBKe-0002Bp-Of
	for submit <at> debbugs.gnu.org; Mon, 18 Jul 2016 12:23:48 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37829)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rsw@HIDDEN>) id 1bPBKd-0002Bc-2o
 for submit <at> debbugs.gnu.org; Mon, 18 Jul 2016 12:23:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rsw@HIDDEN>) id 1bPBKX-0001ga-0k
 for submit <at> debbugs.gnu.org; Mon, 18 Jul 2016 12:23:41 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 RP_MATCHES_RCVD autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:43833)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bPBKW-0001gS-Ta
 for submit <at> debbugs.gnu.org; Mon, 18 Jul 2016 12:23:40 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57024)
 by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bPBKU-0006SU-PH
 for bug-gnu-emacs@HIDDEN; Mon, 18 Jul 2016 12:23:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rsw@HIDDEN>) id 1bPBKQ-0001fb-Kj
 for bug-gnu-emacs@HIDDEN; Mon, 18 Jul 2016 12:23:38 -0400
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55523)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bPBKQ-0001f6-Gq
 for bug-gnu-emacs@HIDDEN; Mon, 18 Jul 2016 12:23:34 -0400
Received: from mail-oi0-f51.google.com ([209.85.218.51]:36670)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <rsw@HIDDEN>) id 1bPBKP-0004lB-0r
 for bug-gnu-emacs@HIDDEN; Mon, 18 Jul 2016 12:23:33 -0400
Received: by mail-oi0-f51.google.com with SMTP id w18so259668035oiw.3
 for <bug-gnu-emacs@HIDDEN>; Mon, 18 Jul 2016 09:23:32 -0700 (PDT)
X-Gm-Message-State: ALyK8tJKO9HOe0KCFKm1dJZgacZ8nL/HonIBjM/7UhlxAfoHL57DXPKgzEtKe62Oih5MsRUYxghVWBmEPwkWRw==
X-Received: by 10.202.173.212 with SMTP id w203mr17196750oie.119.1468859012282; 
 Mon, 18 Jul 2016 09:23:32 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.199.143 with HTTP; Mon, 18 Jul 2016 09:23:02 -0700 (PDT)
From: Robert Weiner <rsw@HIDDEN>
Date: Mon, 18 Jul 2016 12:23:02 -0400
X-Gmail-Original-Message-ID: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@HIDDEN>
Message-ID: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@HIDDEN>
Subject: FEATURE ADDITION: 25.0.94: goto-marker, jumps to a marker potentially
 in a different buffer
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary=001a113ce4dca709090537eb631b
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.8 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: rswgnu@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.3 (------)

--001a113ce4dca709090537eb631b
Content-Type: text/plain; charset=UTF-8

Since goto-char signals an error when given a marker pointing to a buffer
other than the current one (probably to prevent programming errors) and
pop-global-mark only works on the global-mark-ring, there is a need for a
simple function that jumps to the location of an arbitrary marker.  The
following function does that and is based on pop-global-mark.  Please
consider adding it to simple.el.

Bob

(defun goto-marker (marker)
  "Make MARKER's buffer and position current."
  (interactive)
  (cond ((not (markerp marker))
(error "Invalid marker: %s" marker))
((not (marker-buffer marker))
(error "Invalid marker buffer: %s" marker))
(t (let* ((buffer (marker-buffer marker))
 (position (marker-position marker)))
    (set-buffer buffer)
    (or (and (>= position (point-min))
     (<= position (point-max)))
(if widen-automatically
    (widen)
  (error "Marker position is outside accessible part of buffer: %s"
marker)))
    (goto-char position)
    (switch-to-buffer buffer)))))

--001a113ce4dca709090537eb631b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default"><font face=3D"monospace, mono=
space">Since goto-char signals an error when given a marker pointing to a b=
uffer other than the current one (probably to prevent programming errors) a=
nd pop-global-mark only works on the global-mark-ring, there is a need for =
a simple function that jumps to the location of an arbitrary marker.=C2=A0 =
The following function does that and is based on pop-global-mark.=C2=A0 Ple=
ase consider adding it to simple.el.</font></div><div class=3D"gmail_defaul=
t"><font face=3D"monospace, monospace"><br></font></div><div class=3D"gmail=
_default"><font face=3D"monospace, monospace">Bob</font></div><div class=3D=
"gmail_default"><font face=3D"monospace, monospace"><br></font></div><div c=
lass=3D"gmail_default" style=3D""><div class=3D"gmail_default"><font face=
=3D"monospace, monospace">(defun goto-marker (marker)</font></div><div clas=
s=3D"gmail_default"><font face=3D"monospace, monospace">=C2=A0 &quot;Make M=
ARKER&#39;s buffer and position current.&quot;</font></div><div class=3D"gm=
ail_default"><font face=3D"monospace, monospace">=C2=A0 (interactive)</font=
></div><div class=3D"gmail_default"><font face=3D"monospace, monospace">=C2=
=A0 (cond ((not (markerp marker))</font></div><div class=3D"gmail_default">=
<font face=3D"monospace, monospace"><span class=3D"" style=3D"white-space:p=
re">	</span> (error &quot;Invalid marker: %s&quot; marker))</font></div><di=
v class=3D"gmail_default"><font face=3D"monospace, monospace"><span class=
=3D"" style=3D"white-space:pre">	</span>((not (marker-buffer marker))</font=
></div><div class=3D"gmail_default"><font face=3D"monospace, monospace"><sp=
an class=3D"" style=3D"white-space:pre">	</span> (error &quot;Invalid marke=
r buffer: %s&quot; marker))</font></div><div class=3D"gmail_default"><font =
face=3D"monospace, monospace"><span class=3D"" style=3D"white-space:pre">	<=
/span>(t (let* ((buffer (marker-buffer marker))</font></div><div class=3D"g=
mail_default"><font face=3D"monospace, monospace"><span class=3D"" style=3D=
"white-space:pre">		</span> =C2=A0(position (marker-position marker)))</fon=
t></div><div class=3D"gmail_default"><font face=3D"monospace, monospace"><s=
pan class=3D"" style=3D"white-space:pre">	</span> =C2=A0 =C2=A0 (set-buffer=
 buffer)</font></div><div class=3D"gmail_default"><font face=3D"monospace, =
monospace"><span class=3D"" style=3D"white-space:pre">	</span> =C2=A0 =C2=
=A0 (or (and (&gt;=3D position (point-min))</font></div><div class=3D"gmail=
_default"><font face=3D"monospace, monospace"><span class=3D"" style=3D"whi=
te-space:pre">		</span> =C2=A0 =C2=A0 =C2=A0(&lt;=3D position (point-max)))=
</font></div><div class=3D"gmail_default"><font face=3D"monospace, monospac=
e"><span class=3D"" style=3D"white-space:pre">		</span> (if widen-automatic=
ally</font></div><div class=3D"gmail_default"><font face=3D"monospace, mono=
space"><span class=3D"" style=3D"white-space:pre">		</span> =C2=A0 =C2=A0 (=
widen)</font></div><div class=3D"gmail_default"><font face=3D"monospace, mo=
nospace"><span class=3D"" style=3D"white-space:pre">		</span> =C2=A0 (error=
 &quot;Marker position is outside accessible part of buffer: %s&quot; marke=
r)))</font></div><div class=3D"gmail_default"><font face=3D"monospace, mono=
space"><span class=3D"" style=3D"white-space:pre">	</span> =C2=A0 =C2=A0 (g=
oto-char position)</font></div><div class=3D"gmail_default"><font face=3D"m=
onospace, monospace"><span class=3D"" style=3D"white-space:pre">	</span> =
=C2=A0 =C2=A0 (switch-to-buffer buffer)))))</font></div></div></div>

--001a113ce4dca709090537eb631b--




Acknowledgement sent to rswgnu@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#24021; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.