From 91478f46238ab5a0f5fb7e6e6b4b1da0163c596e Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Sun, 12 Feb 2017 09:46:03 -0500 Subject: Nix some useless uses of looking-at, looking-back * lisp/allout.el (allout-kill-topic): (allout-next-topic-pending-encryption): * lisp/bookmark.el (bookmark-kill-line): * lisp/cus-edit.el (custom-save-variables, custom-save-faces): * lisp/cus-theme.el (custom-theme-write-variables): (custom-theme-write-faces): * lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads): * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): * lisp/emacs-lisp/checkdoc.el (checkdoc-interactive-loop): (checkdoc-interactive-ispell-loop): (checkdoc-message-interactive-ispell-loop, checkdoc-this-string-valid): (checkdoc-this-string-valid-engine): * lisp/emacs-lisp/elint.el (elint-get-top-forms): * lisp/emulation/viper-cmd.el (viper-backward-indent): * lisp/image-dired.el (image-dired-delete-char): * lisp/simple.el (kill-visual-line): Replace instances of looking-at, looking-back with char comparisons using following-char, preceding-char. --- lisp/emacs-lisp/checkdoc.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lisp/emacs-lisp/checkdoc.el') diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 59edbe100e1..1d6fdfa4e87 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -603,7 +603,7 @@ style." (checkdoc-overlay-put cdo 'face 'highlight) ;; Make sure the whole doc string is visible if possible. (sit-for 0) - (if (and (looking-at "\"") + (if (and (= (following-char) ?\") (not (pos-visible-in-window-p (save-excursion (forward-sexp 1) (point)) (selected-window)))) @@ -743,9 +743,9 @@ buffer, otherwise searching starts at START-HERE." (while (checkdoc-next-docstring) (message "Searching for doc string spell error...%d%%" (floor (* 100.0 (point)) (point-max))) - (if (looking-at "\"") - (checkdoc-ispell-docstring-engine - (save-excursion (forward-sexp 1) (point-marker))))) + (when (= (following-char) ?\") + (checkdoc-ispell-docstring-engine + (save-excursion (forward-sexp 1) (point-marker))))) (message "Checkdoc: Done.")))) (defun checkdoc-message-interactive-ispell-loop (start-here) @@ -763,7 +763,7 @@ buffer, otherwise searching starts at START-HERE." (while (checkdoc-message-text-next-string (point-max)) (message "Searching for message string spell error...%d%%" (floor (* 100.0 (point)) (point-max))) - (if (looking-at "\"") + (if (= (following-char) ?\") (checkdoc-ispell-docstring-engine (save-excursion (forward-sexp 1) (point-marker))))) (message "Checkdoc: Done.")))) @@ -1381,7 +1381,7 @@ See the style guide in the Emacs Lisp manual for more details." "All variables and subroutines might as well have a \ documentation string") (point) (+ (point) 1) t))))) - (if (and (not err) (looking-at "\"")) + (if (and (not err) (= (following-char) ?\")) (with-syntax-table checkdoc-syntax-table (checkdoc-this-string-valid-engine fp)) err))) @@ -1395,7 +1395,7 @@ regexp short cuts work. FP is the function defun information." ;; we won't accidentally lose our place. This could cause ;; end-of doc string whitespace to also delete the " char. (s (point)) - (e (if (looking-at "\"") + (e (if (= (following-char) ?\") (save-excursion (forward-sexp 1) (point-marker)) (point)))) (or @@ -1475,7 +1475,7 @@ regexp short cuts work. FP is the function defun information." ((looking-at "[\\!?;:.)]") ;; These are ok nil) - ((and checkdoc-permit-comma-termination-flag (looking-at ",")) + ((and checkdoc-permit-comma-termination-flag (= (following-char) ?,)) nil) (t ;; If it is not a complete sentence, let's see if we can -- cgit v1.2.1