unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: 58552@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <E1okAd5-0003Kn-Hl@fencepost.gnu.org> (raw)
In-Reply-To: <m14jw4q3p8.fsf@yahoo.es> (bug-gnu-emacs@gnu.org)

[[[ 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@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)







      parent reply	other threads:[~2022-10-16 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m14jw4q3p8.fsf.ref@yahoo.es>
2022-10-15 19:36 ` bug#58552: 29.0.50; [PATCH] dictionary-lookup-definition "Wrong type argument" error when there is no word at point Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-16  9:25   ` Lars Ingebrigtsen
2022-10-16 20:53   ` Richard Stallman [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=E1okAd5-0003Kn-Hl@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=58552@debbugs.gnu.org \
    --cc=mardani29@yahoo.es \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).