emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5127535: Convert more uses of looking-at to followi


From: Mark Oteiza
Subject: [Emacs-diffs] master 5127535: Convert more uses of looking-at to following-char
Date: Fri, 7 Jul 2017 00:00:34 -0400 (EDT)

branch: master
commit 51275358e91d654e0cb49b749bf83d2fa19476c7
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>

    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.
---
 lisp/dired-aux.el     | 4 ++--
 lisp/dired-x.el       | 4 ++--
 lisp/help-fns.el      | 6 +++---
 lisp/proced.el        | 2 +-
 lisp/progmodes/f90.el | 4 ++--
 lisp/ses.el           | 4 ++--
 lisp/tar-mode.el      | 2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index e454775..095ce8b 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 527685a..7ceb672 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 <address@hidden> fixed uid.
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 32324ae..f5d94d8 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 0736ab0..86d7968 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 b3661bf..49e072c 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 97bade3..741d588 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 f25b1a4..1d453d2 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]