emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116810: * lisp/emacs-lisp/nadvice.el (advice--make-


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r116810: * lisp/emacs-lisp/nadvice.el (advice--make-docstring): Try harder to find
Date: Thu, 20 Mar 2014 16:01:28 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116810
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16993
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2014-03-20 12:00:17 -0400
message:
  * lisp/emacs-lisp/nadvice.el (advice--make-docstring): Try harder to find
  the docstring of functions advised before dumping.
  * src/doc.c (store_function_docstring): Warn when we don't know where to
  put a docstring.
  (Fsubstitute_command_keys): Don't advertise the fact that
  text-properties are dropped, since we think it's a bug that we'll fix
  in 24.5.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/nadvice.el     nadvice.el-20121015213644-851fdxs2vximj8nr-1
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/doc.c                      doc.c-20091113204419-o5vbwnq5f7feedwu-250
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-20 01:20:15 +0000
+++ b/lisp/ChangeLog    2014-03-20 16:00:17 +0000
@@ -1,3 +1,8 @@
+2014-03-20  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/nadvice.el (advice--make-docstring): Try harder to find
+       the docstring of functions advised before dumping (bug#16993).
+
 2014-03-19  Stefan-W. Hahn  <address@hidden>  (tiny change)
 
        * ps-print.el (ps-generate-postscript-with-faces):

=== modified file 'lisp/emacs-lisp/nadvice.el'
--- a/lisp/emacs-lisp/nadvice.el        2014-03-17 18:30:53 +0000
+++ b/lisp/emacs-lisp/nadvice.el        2014-03-20 16:00:17 +0000
@@ -74,12 +74,19 @@
 
 (defun advice--make-docstring (function)
   "Build the raw docstring for FUNCTION, presumably advised."
-  (let ((flist (indirect-function function))
-        (docstring nil))
+  (let* ((flist (indirect-function function))
+         (docfun nil)
+         (docstring nil))
     (if (eq 'macro (car-safe flist)) (setq flist (cdr flist)))
     (while (advice--p flist)
       (let ((bytecode (aref flist 1))
+            (doc (aref flist 4))
             (where nil))
+        ;; Hack attack!  For advices installed before calling
+        ;; Snarf-documentation, the integer offset into the DOC file will not
+        ;; be installed in the "core unadvised function" but in the advice
+        ;; object instead!  So here we try to undo the damage.
+        (if (integerp doc) (setq docfun flist))
         (dolist (elem advice--where-alist)
           (if (eq bytecode (cadr elem)) (setq where (car elem))))
         (setq docstring
@@ -101,8 +108,9 @@
                "\n")))
       (setq flist (advice--cdr flist)))
     (if docstring (setq docstring (concat docstring "\n")))
-    (let* ((origdoc (unless (eq function flist) ;Avoid inf-loops.
-                      (documentation flist t)))
+    (unless docfun (setq docfun flist))
+    (let* ((origdoc (unless (eq function docfun) ;Avoid inf-loops.
+                      (documentation docfun t)))
            (usage (help-split-fundoc origdoc function)))
       (setq usage (if (null usage)
                       (let ((arglist (help-function-arglist flist)))

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-03-20 14:09:37 +0000
+++ b/src/ChangeLog     2014-03-20 16:00:17 +0000
@@ -1,5 +1,11 @@
 2014-03-20  Stefan Monnier  <address@hidden>
 
+       * doc.c (store_function_docstring): Warn when we don't know where to
+       put a docstring.
+       (Fsubstitute_command_keys): Don't advertise the fact that
+       text-properties are dropped, since we think it's a bug that we'll fix
+       in 24.5.
+
        * frame.h (SET_FRAME_VISIBLE): Keep frame_garbaged up to date.
        * xterm.c (handle_one_xevent) <MapNotify>: Don't garbage the frame.
        * frame.c (frame_garbaged): Make "docstring" more precise.

=== modified file 'src/doc.c'
--- a/src/doc.c 2014-02-28 02:00:17 +0000
+++ b/src/doc.c 2014-03-20 16:00:17 +0000
@@ -535,6 +535,9 @@
         docstring, since we've found a docstring for it.  */
       if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING)
        ASET (fun, COMPILED_DOC_STRING, make_number (offset));
+      else
+       message ("No docstring slot for %s",
+                SYMBOLP (obj) ? SDATA (SYMBOL_NAME (obj)) : "<anonymous>");
     }
 }
 
@@ -707,7 +710,7 @@
 thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ 
into the output.
 
 Return the original STRING if no substitutions are made.
-Otherwise, return a new string, without any text properties.  */)
+Otherwise, return a new string.  */)
   (Lisp_Object string)
 {
   char *buf;


reply via email to

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