GNU bug report logs - #58552
29.0.50; [PATCH] dictionary-lookup-definition "Wrong type argument" error when there is no word at point

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Sat, 15 Oct 2022 19:37:01 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 58552 in the body.
You can then email your comments to 58552 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#58552; Package emacs. (Sat, 15 Oct 2022 19:37:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Martín <mardani29 <at> yahoo.es>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 15 Oct 2022 19:37:01 GMT) Full text and rfc822 format available.

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

From: Daniel Martín <mardani29 <at> yahoo.es>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [PATCH] dictionary-lookup-definition "Wrong type argument"
 error when there is no word at point
Date: Sat, 15 Oct 2022 21:36:35 +0200
[Message part 1 (text/plain, inline)]
Steps to reproduce the issue:

emacs -Q
M-x dictionary-lookup-definition RET
Answer "y" if asked about using dict.org.

Expected result:

As there is no word at point to act on, the operation should inform the
user right away.

Actual result:

dictionary-encode-charset: Wrong type argument: stringp, nil

An empty dictionary buffer is shown, which is confusing.

The attached patch informs the user that there is no word at point to
act on and aborts the operation early.

If you think it's a good patch, please install on my behalf.  Thanks.

[0001-Signal-an-error-in-dictionary-lookup-if-there-s-no-w.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58552; Package emacs. (Sun, 16 Oct 2022 09:26:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 58552 <at> debbugs.gnu.org
Subject: Re: bug#58552: 29.0.50; [PATCH] dictionary-lookup-definition "Wrong
 type argument" error when there is no word at point
Date: Sun, 16 Oct 2022 11:25:35 +0200
Daniel Martín <mardani29 <at> yahoo.es> writes:

> If you think it's a good patch, please install on my behalf.  Thanks.

Looks good to me; now pushed to Emacs 29.




bug marked as fixed in version 29.1, send any further explanations to 58552 <at> debbugs.gnu.org and Daniel Martín <mardani29 <at> yahoo.es> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 16 Oct 2022 09:26:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58552; Package emacs. (Sun, 16 Oct 2022 20:54:02 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 58552 <at> debbugs.gnu.org
Subject: Re: bug#58552: 29.0.50;
 [PATCH] dictionary-lookup-definition "Wrong type argument" error when
 there is no word at point
Date: Sun, 16 Oct 2022 16:53:03 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

As far as I can tell, the message below was sent only to me.
But the message is strange.  So I decided to forward it here.

------- Start of forwarded message -------
From: Daniel Martín <mardani29 <at> yahoo.es>
Date: Sat, 15 Oct 2022 21:25:59 +0200
Subject: [PATCH] Signal an error in dictionary lookup if there's no word at
 point

* lisp/net/dictionary.el (dictionary-lookup-definition): Signal an
error when there is no word at point.
- ---
 lisp/net/dictionary.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 4c52382c67..b8f5018005 100644
- --- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -1173,7 +1173,10 @@ dictionary-search
 (defun dictionary-lookup-definition ()
   "Unconditionally lookup the word at point."
   (interactive)
- -  (dictionary-new-search (cons (current-word) dictionary-default-dictionary)))
+  (let ((word (current-word)))
+    (unless word
+      (error "No word at point"))
+    (dictionary-new-search (cons word dictionary-default-dictionary))))
 
 (defun dictionary-previous ()
   "Go to the previous location in the current buffer."
- -- 
2.34.1


- --=-=-=--
------- End of forwarded message -------
-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 14 Nov 2022 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 218 days ago.

Previous Next


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