]> git.eshelyaron.com Git - emacs.git/commitdiff
(describe-text-sexp): Use `string-match-p'. Simplify.
authorJuanma Barranquero <lekktu@gmail.com>
Sun, 1 Jun 2008 04:48:53 +0000 (04:48 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Sun, 1 Jun 2008 04:48:53 +0000 (04:48 +0000)
(describe-char): Use `looking-at-p', `string-match-p' when possible.

lisp/ChangeLog
lisp/descr-text.el

index 2eadd9aa6e3572f367c2bb924537fc8c7b090d15..05ff225837796fd880c79819c4c85212b328feb6 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-01  Juanma Barranquero  <lekktu@gmail.com>
+
+       * descr-text.el (describe-text-sexp): Use `string-match-p'.  Simplify.
+       (describe-char): Use `looking-at-p', `string-match-p' when possible.
+
 2008-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * tar-mode.el (tar-header-block-summarize): Ensure one space around
@@ -5,8 +10,8 @@
 
 2008-05-31  John Paul Wallington  <jpw@pobox.com>
 
-       * help-fns.el (describe-variable-custom-version-info): Handle
-       dotted `package-version' info.
+       * help-fns.el (describe-variable-custom-version-info):
+       Handle dotted `package-version' info.
 
 2008-05-31  Juanma Barranquero  <lekktu@gmail.com>
 
index d493188a9788aea6e9f8d860aaff85ce1d8ef3ba..9c1d2538ec35f0a83549ad8fec49f53e962f80d5 100644 (file)
   (let ((pp (condition-case signal
                (pp-to-string sexp)
              (error (prin1-to-string signal)))))
-    (when (string-match "\n\\'" pp)
+    (when (string-match-p "\n\\'" pp)
       (setq pp (substring pp 0 (1- (length pp)))))
-    (if (cond ((string-match "\n" pp)
-              nil)
-             ((> (length pp) (- (window-width) (current-column)))
-              nil)
-             (t t))
+
+    (if (and (not (string-match-p "\n" pp))
+            (<= (length pp) (- (window-width) (current-column))))
        (insert pp)
       (insert-text-button
        "[Show]" 'action `(lambda (&rest ignore)
-                       (with-output-to-temp-buffer
-                           "*Pp Eval Output*"
-                         (princ ',pp)))
+                          (with-output-to-temp-buffer
+                              "*Pp Eval Output*"
+                            (princ ',pp)))
        'help-echo "mouse-2, RET: pretty print value in another buffer"))))
 
 (defun describe-property-list (properties)
@@ -493,7 +491,7 @@ as well as widgets, buttons, overlays, and text properties."
                         (cond
                          ((and show-trailing-whitespace
                                (save-excursion (goto-char pos)
-                                               (looking-at "[ \t]+$")))
+                                               (looking-at-p "[ \t]+$")))
                           'trailing-whitespace)
                          ((and nobreak-char-display char (eq char '#xa0))
                           'nobreak-space)
@@ -523,7 +521,7 @@ as well as widgets, buttons, overlays, and text properties."
                (if (eq (car-safe clm) 'insert-text-button)
                    (progn (insert " ") (eval clm))
                  (when (>= (+ (current-column)
-                              (or (string-match "\n" clm)
+                              (or (string-match-p "\n" clm)
                                   (string-width clm))
                               1)
                            (window-width))