From: Mark Oteiza Date: Fri, 7 Jul 2017 03:53:19 +0000 (-0400) Subject: Convert more uses of looking-at to following-char X-Git-Tag: emacs-26.0.90~519^2~4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=51275358e91d654e0cb49b749bf83d2fa19476c7;p=emacs.git Convert more uses of looking-at to following-char More followup to Karl Fogel's commit a84da83c1. * lisp/dired-aux.el (dired-add-entry, dired-subdir-hidden-p): * lisp/dired-x.el (dired-mark-unmarked-files, dired-mark-sexp): * lisp/help-fns.el (doc-file-to-man, doc-file-to-info): * lisp/proced.el (proced-toggle-marks): * lisp/progmodes/f90.el (f90-indent-line): * lisp/ses.el (ses-load): * lisp/tar-mode.el (tar-expunge): Replace instances of looking-at with char comparisons using following-char. --- diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index e4547758587..095ce8ba89c 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1399,7 +1399,7 @@ files matching `dired-omit-regexp'." ;; else try to find correct place to insert (if (dired-goto-subdir directory) (progn ;; unhide if necessary - (if (looking-at-p "\r") + (if (= (following-char) ?\r) ;; Point is at end of subdir line. (dired-unhide-subdir)) ;; found - skip subdir and `total' line @@ -2639,7 +2639,7 @@ Lower levels are unaffected." (and selective-display (save-excursion (dired-goto-subdir dir) - (looking-at-p "\r")))) + (= (following-char) ?\r)))) ;;;###autoload (defun dired-hide-subdir (arg) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 527685acf37..7ceb672bf2f 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -634,7 +634,7 @@ Optional fifth argument CASE-FOLD-P specifies the value of (dired-mark-if (and ;; not already marked - (looking-at-p " ") + (= (following-char) ?\s) ;; uninteresting (let ((fn (dired-get-filename localp t)) ;; Match patterns case-insensitively on case-insensitive @@ -1530,7 +1530,7 @@ refer at all to the underlying file system. Contrast this with (setq mode (buffer-substring (point) (+ mode-len (point)))) (forward-char mode-len) ;; Skip any extended attributes marker ("." or "+"). - (or (looking-at " ") + (or (= (following-char) ?\s) (forward-char 1)) (setq nlink (read (current-buffer))) ;; Karsten Wenger fixed uid. diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 32324ae3bcb..f5d94d8419f 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1271,14 +1271,14 @@ BUFFER should be a buffer or a buffer name." (insert-file-contents file) (let (notfirst) (while (search-forward "" nil 'move) - (if (looking-at "S") + (if (= (following-char) ?S) (delete-region (1- (point)) (line-end-position)) (delete-char -1) (if notfirst (insert "\n.DE\n") (setq notfirst t)) (insert "\n.SH ") - (insert (if (looking-at "F") "Function " "Variable ")) + (insert (if (= (following-char) ?F) "Function " "Variable ")) (delete-char 1) (forward-line 1) (insert ".DS L\n")))) @@ -1304,7 +1304,7 @@ BUFFER should be a buffer or a buffer name." (forward-char 1)) (goto-char (point-min)) (while (search-forward "" nil t) - (unless (looking-at "S") + (when (/= (following-char) ?S) (setq type (char-after) name (buffer-substring (1+ (point)) (line-end-position)) doc (buffer-substring (line-beginning-position 2) diff --git a/lisp/proced.el b/lisp/proced.el index 0736ab09dc9..86d79689a49 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -767,7 +767,7 @@ The time interval for updates is specified via `proced-auto-update-interval'." (while (not (eobp)) (cond ((looking-at mark-re) (proced-insert-mark nil)) - ((looking-at " ") + ((= (following-char) ?\s) (proced-insert-mark t)) (t (forward-line 1))))))) diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index b3661bfe3f1..49e072c65bd 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -1880,8 +1880,8 @@ after indenting." ;; FIXME This means f90-calculate-indent gives different answers ;; for comments and preprocessor lines to this function. ;; Better to make f90-calculate-indent return the correct answer? - (cond ((looking-at "!") (setq indent (f90-comment-indent))) - ((looking-at "#") (setq indent 0)) + (cond ((= (following-char) ?!) (setq indent (f90-comment-indent))) + ((= (following-char) ?#) (setq indent 0)) (t (and f90-smart-end (looking-at "end") (f90-match-end)) diff --git a/lisp/ses.el b/lisp/ses.el index 97bade380ec..741d588e4be 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -1880,7 +1880,7 @@ Does not execute cell formulas or print functions." (setq ses--numlocprn 0) (dotimes (_ numlocprn) (let ((x (read (current-buffer)))) - (or (and (looking-at-p "\n") + (or (and (= (following-char) ?\n) (eq (car-safe x) 'ses-local-printer) (apply #'ses--local-printer (cdr x))) (error "local printer-def error")) @@ -1890,7 +1890,7 @@ Does not execute cell formulas or print functions." (dotimes (col ses--numcols) (let* ((x (read (current-buffer))) (sym (car-safe (cdr-safe x)))) - (or (and (looking-at-p "\n") + (or (and (= (following-char) ?\n) (eq (car-safe x) 'ses-cell) (ses-create-cell-variable sym row col)) (error "Cell-def error")) diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index f25b1a45ba1..1d453d2980e 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -1118,7 +1118,7 @@ for this to be permanent." (save-excursion (goto-char (point-min)) (while (not (eobp)) - (if (looking-at "D") + (if (= (following-char) ?D) (progn (tar-expunge-internal) (setq n (1+ n))) (forward-line 1)))