emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117365: * etc/NEWS: New Tramp method "nc".


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r117365: * etc/NEWS: New Tramp method "nc".
Date: Thu, 19 Jun 2014 14:03:54 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117365
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9130
author: Robert Brown (tiny change) <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2014-06-19 10:03:45 -0400
message:
  * etc/NEWS: New Tramp method "nc".
  
  * lisp/emacs-lisp/lisp-mode.el (lisp-string-after-doc-keyword-p): New fun.
  (lisp-string-in-doc-position-p): New function, extracted from
  lisp-font-lock-syntactic-face-function.
  (lisp-font-lock-syntactic-face-function): Use them.
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/lisp-mode.el   lispmode.el-20091113204419-o5vbwnq5f7feedwu-205
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2014-06-17 19:33:58 +0000
+++ b/etc/NEWS  2014-06-19 14:03:45 +0000
@@ -72,6 +72,9 @@
 
 * Changes in Specialized Modes and Packages in Emacs 24.5
 
+** Lisp mode
+*** Strings after `:documentation' are highlighted as docstrings.
+
 ** Rectangle editing
 *** Rectangle Mark mode can have corners past EOL or in the middle of a TAB.
 *** C-x C-x in rectangle-mark-mode now cycles through the four corners.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-06-19 11:14:59 +0000
+++ b/lisp/ChangeLog    2014-06-19 14:03:45 +0000
@@ -1,3 +1,10 @@
+2014-06-19  Robert Brown  <address@hidden>  (tiny change)
+
+       * emacs-lisp/lisp-mode.el (lisp-string-after-doc-keyword-p): New fun.
+       (lisp-string-in-doc-position-p): New function, extracted from
+       lisp-font-lock-syntactic-face-function.
+       (lisp-font-lock-syntactic-face-function): Use them (bug#9130).
+
 2014-06-19  Grégoire Jadi  <address@hidden>
 
        * net/rcirc.el (rcirc-omit-mode): Fix recenter error.  (Bug#17769)

=== modified file 'lisp/emacs-lisp/lisp-mode.el'
--- a/lisp/emacs-lisp/lisp-mode.el      2014-05-14 17:15:15 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el      2014-06-19 14:03:45 +0000
@@ -413,6 +413,41 @@
 (defvar lisp-cl-font-lock-keywords lisp-cl-font-lock-keywords-1
   "Default expressions to highlight in Lisp modes.")
 
+(defun lisp-string-in-doc-position-p (listbeg startpos)
+  (let* ((firstsym (and listbeg
+                        (save-excursion
+                          (goto-char listbeg)
+                          (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")
+                               (match-string 1)))))
+         (docelt (and firstsym
+                      (function-get (intern-soft firstsym)
+                                    lisp-doc-string-elt-property))))
+    (and docelt
+         ;; It's a string in a form that can have a docstring.
+         ;; Check whether it's in docstring position.
+         (save-excursion
+           (when (functionp docelt)
+             (goto-char (match-end 1))
+             (setq docelt (funcall docelt)))
+           (goto-char listbeg)
+           (forward-char 1)
+           (condition-case nil
+               (while (and (> docelt 0) (< (point) startpos)
+                           (progn (forward-sexp 1) t))
+                 (setq docelt (1- docelt)))
+             (error nil))
+           (and (zerop docelt) (<= (point) startpos)
+                (progn (forward-comment (point-max)) t)
+                (= (point) startpos))))))
+
+(defun lisp-string-after-doc-keyword-p (listbeg startpos)
+  (and listbeg                          ; We are inside a Lisp form.
+       (save-excursion
+         (goto-char startpos)
+         (ignore-errors
+           (progn (backward-sexp 1)
+                  (looking-at ":documentation\\_>"))))))
+
 (defun lisp-font-lock-syntactic-face-function (state)
   (if (nth 3 state)
       ;; This might be a (doc)string or a |...| symbol.
@@ -420,32 +455,9 @@
         (if (eq (char-after startpos) ?|)
             ;; This is not a string, but a |...| symbol.
             nil
-          (let* ((listbeg (nth 1 state))
-                 (firstsym (and listbeg
-                                (save-excursion
-                                  (goto-char listbeg)
-                                  (and (looking-at "([ 
\t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")
-                                       (match-string 1)))))
-                 (docelt (and firstsym
-                              (function-get (intern-soft firstsym)
-                                            lisp-doc-string-elt-property))))
-            (if (and docelt
-                     ;; It's a string in a form that can have a docstring.
-                     ;; Check whether it's in docstring position.
-                     (save-excursion
-                       (when (functionp docelt)
-                         (goto-char (match-end 1))
-                         (setq docelt (funcall docelt)))
-                       (goto-char listbeg)
-                       (forward-char 1)
-                       (condition-case nil
-                           (while (and (> docelt 0) (< (point) startpos)
-                                       (progn (forward-sexp 1) t))
-                             (setq docelt (1- docelt)))
-                         (error nil))
-                       (and (zerop docelt) (<= (point) startpos)
-                            (progn (forward-comment (point-max)) t)
-                            (= (point) (nth 8 state)))))
+          (let ((listbeg (nth 1 state)))
+            (if (or (lisp-string-in-doc-position-p listbeg startpos)
+                    (lisp-string-after-doc-keyword-p listbeg startpos))
                 font-lock-doc-face
               font-lock-string-face))))
     font-lock-comment-face))


reply via email to

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