]> git.eshelyaron.com Git - emacs.git/commitdiff
Signal an error in dictionary lookup if there's no word at point
authorDaniel Martín <mardani29@yahoo.es>
Sun, 16 Oct 2022 09:25:17 +0000 (11:25 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 16 Oct 2022 09:25:17 +0000 (11:25 +0200)
* lisp/net/dictionary.el (dictionary-lookup-definition): Signal an
error when there is no word at point (bug#58552).

lisp/net/dictionary.el

index 4c52382c6727f707c125ac214195babf71d00e99..b8f5018005ba5b9261930f18de31eecfa4be4fd1 100644 (file)
@@ -1173,7 +1173,10 @@ allows editing it."
 (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."