Skip to content

Commit

Permalink
Don't consider a single trailing colon as part of the token. Otherwise
Browse files Browse the repository at this point in the history
case statements include the trailing colon.

 with '#' will be ignored, and an empty message aborts the commit.
  • Loading branch information
Andersbakken committed Feb 13, 2020
1 parent 31f7842 commit 74cfc68
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/rtags.el
Original file line number Diff line number Diff line change
Expand Up @@ -2834,21 +2834,27 @@ This includes both declarations and definitions."
(rtags-call-rc :path fn "-G" "-F" token)
(rtags-handle-results-buffer token t nil fn 'guess-function-at-point))))))

(defun rtags-looking-at-symbol-char (no-scope)
(cond ((looking-at "[0-9A-Za-z_~#]") t)
(no-scope nil)
((looking-at "::") t)
((and (looking-at ":") (looking-back ":")) t)
(t nil)))

(defun rtags-current-token (&optional no-scope)
"Return current program identifier under point.

If NO-SCOPE is true do not include scopes \"::\""
(save-excursion
(let ((symbol-chars (concat "[0-9A-Za-z_~#" (if (not no-scope) ":") "]")))
(when (looking-at symbol-chars)
(while (and (> (point) (point-min)) (looking-at symbol-chars))
(backward-char))
(when (not (looking-at symbol-chars))
(when (rtags-looking-at-symbol-char no-scope)
(while (and (> (point) (point-min)) (rtags-looking-at-symbol-char no-scope))
(backward-char))
(when (not (rtags-looking-at-symbol-char no-scope))
(forward-char))
(let ((start (point)))
(while (rtags-looking-at-symbol-char no-scope)
(forward-char))
(let ((start (point)))
(while (looking-at symbol-chars)
(forward-char))
(buffer-substring-no-properties start (point)))))))
(buffer-substring-no-properties start (point))))))

(defun rtags-rename-confirm-text (confirms prevlen)
(with-temp-buffer
Expand Down

0 comments on commit 74cfc68

Please sign in to comment.