GNU bug report logs - #20148
24.4: function `bookmark-get-bookmark'

Previous Next

Package: emacs;

Reported by: Boruch Baum <boruch_baum <at> gmx.com>

Date: Fri, 20 Mar 2015 04:44:02 UTC

Severity: wishlist

Tags: fixed

Found in version 24.4

Fixed in version 26.3

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20148 in the body.
You can then email your comments to 20148 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20148; Package emacs. (Fri, 20 Mar 2015 04:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Boruch Baum <boruch_baum <at> gmx.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 20 Mar 2015 04:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Boruch Baum <boruch_baum <at> gmx.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4: function `bookmark-get-bookmark'
Date: Fri, 20 Mar 2015 00:42:21 -0400
[Message part 1 (text/plain, inline)]
Function `bookmark-get-bookmark' ...

1] tests for the existence of a bookmark by checking whether the input
string matches a cons cell. This casts a net much wider than desirable,
and might better be (assoc bookmark-name-or-record bookmark-alist).

2] returns only a string value on error, without passing nil back to the
calling function.

My usage case is that I was scripting a function to find org-mode files
in a directory tree, and add them to a bookmark list if they aren't
already bookmarked according to my naming convention. Originally, I had
tried checking for the existence of a bookmark using a few of the
bookmark.el functions, such as bookmark-get-bookmark, but that looked
inconvenient because they returned string values on failure.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0


[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20148; Package emacs. (Fri, 20 Mar 2015 05:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 20148 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Boruch Baum <boruch_baum <at> gmx.com>, 20148 <at> debbugs.gnu.org
Subject: RE: bug#20148: 24.4: function `bookmark-get-bookmark'
Date: Thu, 19 Mar 2015 22:04:42 -0700 (PDT)
> Function `bookmark-get-bookmark' ...
> 
> 1] tests for the existence of a bookmark by checking whether the input
> string matches a cons cell. This casts a net much wider than desirable,
> and might better be (assoc bookmark-name-or-record bookmark-alist).

See the actual code.

> 2] returns only a string value on error, without passing nil back to the
> calling function.
> 
> My usage case is that I was scripting a function to find org-mode files
> in a directory tree, and add them to a bookmark list if they aren't
> already bookmarked according to my naming convention. Originally, I had
> tried checking for the existence of a bookmark using a few of the
> bookmark.el functions, such as bookmark-get-bookmark, but that looked
> inconvenient because they returned string values on failure.

See the actual code.

The doc string neglects to mention the optional argument.  It should
say something like this (taken from Bookmark+):

  Non-nil optional arg NOERROR means return nil if BOOKMARK is not a
  valid bookmark.  If NOERROR is nil then raise an error in this case.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20148; Package emacs. (Fri, 20 Mar 2015 11:05:02 GMT) Full text and rfc822 format available.

Message #11 received at 20148 <at> debbugs.gnu.org (full text, mbox):

From: Boruch Baum <boruch_baum <at> gmx.com>
To: Drew Adams <drew.adams <at> oracle.com>, 20148 <at> debbugs.gnu.org
Subject: Re: bug#20148: 24.4: function `bookmark-get-bookmark'
Date: Fri, 20 Mar 2015 07:04:01 -0400
[Message part 1 (text/plain, inline)]
Hello Drew. Apology for the inconvenience.

On 03/20/2015 01:04 AM, Drew Adams wrote:
>> Function `bookmark-get-bookmark' ...
>>
>> 1] tests for the existence of a bookmark by checking whether the input
>> string matches a cons cell. This casts a net much wider than desirable,
>> and might better be (assoc bookmark-name-or-record bookmark-alist).
> 
> See the actual code.
You're right. You could have just said 'line 336, not 335'.

> 
>> 2] returns only a string value on error, without passing nil back to the
>> calling function.
>>
>> My usage case is that I was scripting a function to find org-mode files
>> in a directory tree, and add them to a bookmark list if they aren't
>> already bookmarked according to my naming convention. Originally, I had
>> tried checking for the existence of a bookmark using a few of the
>> bookmark.el functions, such as bookmark-get-bookmark, but that looked
>> inconvenient because they returned string values on failure.
> 
> See the actual code.
> 
> The doc string neglects to mention the optional argument.  It should
> say something like this (taken from Bookmark+):
> 
>   Non-nil optional arg NOERROR means return nil if BOOKMARK is not a
>   valid bookmark.  If NOERROR is nil then raise an error in this case.
Missed that also.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0


[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20148; Package emacs. (Fri, 20 Mar 2015 14:32:01 GMT) Full text and rfc822 format available.

Message #14 received at 20148 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Boruch Baum <boruch_baum <at> gmx.com>
Cc: 20148 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#20148: 24.4: function `bookmark-get-bookmark'
Date: Fri, 20 Mar 2015 10:31:51 -0400
Does that mean the bug can be closed?


        Stefan


>>>>> "Boruch" == Boruch Baum <boruch_baum <at> gmx.com> writes:

> Hello Drew. Apology for the inconvenience.
> On 03/20/2015 01:04 AM, Drew Adams wrote:
>>> Function `bookmark-get-bookmark' ...
>>> 
>>> 1] tests for the existence of a bookmark by checking whether the input
>>> string matches a cons cell. This casts a net much wider than desirable,
>>> and might better be (assoc bookmark-name-or-record bookmark-alist).
>> 
>> See the actual code.
> You're right. You could have just said 'line 336, not 335'.

>> 
>>> 2] returns only a string value on error, without passing nil back to the
>>> calling function.
>>> 
>>> My usage case is that I was scripting a function to find org-mode files
>>> in a directory tree, and add them to a bookmark list if they aren't
>>> already bookmarked according to my naming convention. Originally, I had
>>> tried checking for the existence of a bookmark using a few of the
>>> bookmark.el functions, such as bookmark-get-bookmark, but that looked
>>> inconvenient because they returned string values on failure.
>> 
>> See the actual code.
>> 
>> The doc string neglects to mention the optional argument.  It should
>> say something like this (taken from Bookmark+):
>> 
>> Non-nil optional arg NOERROR means return nil if BOOKMARK is not a
>> valid bookmark.  If NOERROR is nil then raise an error in this case.
> Missed that also.

> -- 
> hkp://keys.gnupg.net
> CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20148; Package emacs. (Fri, 20 Mar 2015 14:46:02 GMT) Full text and rfc822 format available.

Message #17 received at 20148 <at> debbugs.gnu.org (full text, mbox):

From: Boruch Baum <boruch_baum <at> gmx.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 20148 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#20148: 24.4: function `bookmark-get-bookmark'
Date: Fri, 20 Mar 2015 10:44:53 -0400
[Message part 1 (text/plain, inline)]
On 03/20/2015 10:31 AM, Stefan Monnier wrote:
> Does that mean the bug can be closed?
Yes. Though, you might want to tweak the documentation, per Drew's
observation.

>> On 03/20/2015 01:04 AM, Drew Adams wrote:
>>> The doc string neglects to mention the optional argument.  It should
>>> say something like this (taken from Bookmark+):
>>>
>>> Non-nil optional arg NOERROR means return nil if BOOKMARK is not a
>>> valid bookmark.  If NOERROR is nil then raise an error in this case.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0


[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20148; Package emacs. (Sun, 26 May 2019 15:36:04 GMT) Full text and rfc822 format available.

Message #20 received at 20148 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: 20148 <at> debbugs.gnu.org
Subject: Re: bug#20148: 24.4: function `bookmark-get-bookmark'
Date: Sun, 26 May 2019 12:12:33 +0200
[Message part 1 (text/plain, inline)]
The attached patch fixes the docstring as suggested above.

From the above discussion, I believe this bug report can be closed once
this has
been applied.

Thanks,
Stefan Kangas
[Message part 2 (text/html, inline)]
[fix-docstring-of-bookmark-get-bookmark.patch (text/x-patch, attachment)]

Added tag(s) fixed. Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Thu, 30 May 2019 12:39:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.3, send any further explanations to 20148 <at> debbugs.gnu.org and Boruch Baum <boruch_baum <at> gmx.com> Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Thu, 30 May 2019 12:39:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20148; Package emacs. (Thu, 30 May 2019 12:39:02 GMT) Full text and rfc822 format available.

Message #27 received at 20148-done <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20148-done <at> debbugs.gnu.org
Subject: Re: bug#20148: 24.4: function `bookmark-get-bookmark'
Date: Thu, 30 May 2019 13:38:02 +0100
tags 20148 fixed
close 20148 26.3
quit

> From a874f231ba0216ca2c3feedaae8ddb32f378f80e Mon Sep 17 00:00:00 2001
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Sun, 26 May 2019 12:04:56 +0200
> Subject: [PATCH] Fix docstring of bookmark-get-bookmark
>
> * bookmark.el (bookmark-get-bookmark): Fix docstring.
> ---
>  lisp/bookmark.el | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/bookmark.el b/lisp/bookmark.el
> index b1fe690dac..5c14f705eb 100644
> --- a/lisp/bookmark.el
> +++ b/lisp/bookmark.el
> @@ -334,7 +334,9 @@ bookmark-get-bookmark
>  If BOOKMARK-NAME-OR-RECORD is a string, look for the corresponding
>  bookmark record in `bookmark-alist'; return it if found, otherwise
>  error.  Else if BOOKMARK-NAME-OR-RECORD is already a bookmark record,
> -just return it."
> +just return it.
> +Signal an error if bookmark is invalid.  If optional argument
> +NOERROR is non-nil, return nil instead."
>    (cond
>     ((consp bookmark-name-or-record) bookmark-name-or-record)
>     ((stringp bookmark-name-or-record)

The docstring already mentioned signalling an error, so I tweaked your
patch to include only the second of the two new sentences, as well as to
mention the full relative file name (lisp/bookmark.el) and the bug
reference (bug#20148) in the commit log, and pushed to emacs-26[1], and
am therefore closing this report.

[1: 1b2f83bb79]: Fix docstring of bookmark-get-bookmark
  2019-05-30 13:32:10 +0100
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1b2f83bb7984269b92eb0afb323e3e74baf87068

Thanks,

-- 
Basil




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 28 Jun 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 275 days ago.

Previous Next


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