Commit f30cf07e authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Make symbol-at-point return nil if there's no symbols in the buffer

* lisp/thingatpt.el (thing-at-point--beginning-of-symbol): Special
op that errors out when there's no symbols in the buffer before
point (bug#14234).
(symbol): Use it.
parent ce1a42a6
Pipeline #8862 failed with stages
in 158 minutes and 27 seconds
......@@ -218,6 +218,15 @@ The bounds of THING are determined by `bounds-of-thing-at-point'."
(put 'sexp 'beginning-op 'thing-at-point--beginning-of-sexp)
;; Symbols
(put 'symbol 'beginning-op 'thing-at-point--beginning-of-symbol)
(defun thing-at-point--beginning-of-symbol ()
"Move point to the beginning of the current symbol."
(and (re-search-backward "\\(\\sw\\|\\s_\\)+")
(skip-syntax-backward "w_")))
;; Lists
(put 'list 'bounds-of-thing-at-point 'thing-at-point-bounds-of-list-at-point)
......@@ -185,7 +185,6 @@ position to retrieve THING.")
(should (eq (symbol-at-point) 'bar))))
(ert-deftest test-symbol-thing-3 ()
:expected-result :failed ; FIXME bug#14234
(insert "`[[`(")
(goto-char 2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment