diff options
| author | Richard M. Stallman | 1995-08-07 08:45:00 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-08-07 08:45:00 +0000 |
| commit | dac6f673310877cc4e5d097752489f84f046b083 (patch) | |
| tree | f580466a69a66281a30f6942b98a8a30a5cce437 | |
| parent | af7bd34e27296229035ed87435f2d741e2700591 (diff) | |
| download | emacs-dac6f673310877cc4e5d097752489f84f046b083.tar.gz emacs-dac6f673310877cc4e5d097752489f84f046b083.zip | |
(byte-compile-output-docform): Check
byte-compile-dynamic-docstrings in input buffer, not output buffer.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 135 |
1 files changed, 69 insertions, 66 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index dd832fae11e..b8b90df4425 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1437,72 +1437,75 @@ With argument, insert value in current buffer after the form." | |||
| 1437 | nil))) | 1437 | nil))) |
| 1438 | 1438 | ||
| 1439 | (defun byte-compile-output-docform (preface name info form specindex quoted) | 1439 | (defun byte-compile-output-docform (preface name info form specindex quoted) |
| 1440 | ;; Print a form with a doc string. INFO is (prefix doc-index postfix). | 1440 | "Print a form with a doc string. INFO is (prefix doc-index postfix). |
| 1441 | ;; If PREFACE and NAME are non-nil, print them too, | 1441 | If PREFACE and NAME are non-nil, print them too, |
| 1442 | ;; before INFO and the FORM but after the doc string itself. | 1442 | before INFO and the FORM but after the doc string itself. |
| 1443 | ;; If SPECINDEX is non-nil, it is the index in FORM | 1443 | If SPECINDEX is non-nil, it is the index in FORM |
| 1444 | ;; of the function bytecode string. In that case, | 1444 | of the function bytecode string. In that case, |
| 1445 | ;; we output that argument and the following argument (the constants vector) | 1445 | we output that argument and the following argument (the constants vector) |
| 1446 | ;; together, for lazy loading. | 1446 | together, for lazy loading. |
| 1447 | ;; QUOTED says that we have to put a quote before the | 1447 | QUOTED says that we have to put a quote before the |
| 1448 | ;; list that represents a doc string reference. | 1448 | list that represents a doc string reference. |
| 1449 | ;; `autoload' needs that. | 1449 | `autoload' needs that." |
| 1450 | (set-buffer | 1450 | ;; We need to examine byte-compile-dynamic-docstrings |
| 1451 | (prog1 (current-buffer) | 1451 | ;; in the input buffer (now current), not in the output buffer. |
| 1452 | (set-buffer outbuffer) | 1452 | (let ((dynamic-docstrings byte-compile-dynamic-docstrings)) |
| 1453 | (let (position) | 1453 | (set-buffer |
| 1454 | 1454 | (prog1 (current-buffer) | |
| 1455 | ;; Insert the doc string, and make it a comment with #@LENGTH. | 1455 | (set-buffer outbuffer) |
| 1456 | (and (>= (nth 1 info) 0) | 1456 | (let (position) |
| 1457 | byte-compile-dynamic-docstrings | 1457 | |
| 1458 | (progn | 1458 | ;; Insert the doc string, and make it a comment with #@LENGTH. |
| 1459 | ;; Make the doc string start at beginning of line | 1459 | (and (>= (nth 1 info) 0) |
| 1460 | ;; for make-docfile's sake. | 1460 | dynamic-docstrings |
| 1461 | (insert "\n") | 1461 | (progn |
| 1462 | (setq position | 1462 | ;; Make the doc string start at beginning of line |
| 1463 | (byte-compile-output-as-comment | 1463 | ;; for make-docfile's sake. |
| 1464 | (nth (nth 1 info) form) nil)) | 1464 | (insert "\n") |
| 1465 | ;; If the doc string starts with * (a user variable), | 1465 | (setq position |
| 1466 | ;; negate POSITION. | 1466 | (byte-compile-output-as-comment |
| 1467 | (if (and (stringp (nth (nth 1 info) form)) | 1467 | (nth (nth 1 info) form) nil)) |
| 1468 | (> (length (nth (nth 1 info) form)) 0) | 1468 | ;; If the doc string starts with * (a user variable), |
| 1469 | (eq (aref (nth (nth 1 info) form) 0) ?*)) | 1469 | ;; negate POSITION. |
| 1470 | (setq position (- position))))) | 1470 | (if (and (stringp (nth (nth 1 info) form)) |
| 1471 | 1471 | (> (length (nth (nth 1 info) form)) 0) | |
| 1472 | (if preface | 1472 | (eq (aref (nth (nth 1 info) form) 0) ?*)) |
| 1473 | (progn | 1473 | (setq position (- position))))) |
| 1474 | (insert preface) | 1474 | |
| 1475 | (prin1 name outbuffer))) | 1475 | (if preface |
| 1476 | (insert (car info)) | 1476 | (progn |
| 1477 | (let ((print-escape-newlines t) | 1477 | (insert preface) |
| 1478 | (print-readably t) ; print #[] for bytecode, 'x for (quote x) | 1478 | (prin1 name outbuffer))) |
| 1479 | (print-gensym nil) ; this is too dangerous for now | 1479 | (insert (car info)) |
| 1480 | (index 0)) | 1480 | (let ((print-escape-newlines t) |
| 1481 | (prin1 (car form) outbuffer) | 1481 | (print-readably t) ; print #[] for bytecode, 'x for (quote x) |
| 1482 | (while (setq form (cdr form)) | 1482 | (print-gensym nil) ; this is too dangerous for now |
| 1483 | (setq index (1+ index)) | 1483 | (index 0)) |
| 1484 | (insert " ") | 1484 | (prin1 (car form) outbuffer) |
| 1485 | (cond ((and (numberp specindex) (= index specindex)) | 1485 | (while (setq form (cdr form)) |
| 1486 | (let ((position | 1486 | (setq index (1+ index)) |
| 1487 | (byte-compile-output-as-comment | 1487 | (insert " ") |
| 1488 | (cons (car form) (nth 1 form)) | 1488 | (cond ((and (numberp specindex) (= index specindex)) |
| 1489 | t))) | 1489 | (let ((position |
| 1490 | (princ (format "(#$ . %d) nil" position) outbuffer) | 1490 | (byte-compile-output-as-comment |
| 1491 | (setq form (cdr form)) | 1491 | (cons (car form) (nth 1 form)) |
| 1492 | (setq index (1+ index)))) | 1492 | t))) |
| 1493 | ((= index (nth 1 info)) | 1493 | (princ (format "(#$ . %d) nil" position) outbuffer) |
| 1494 | (if position | 1494 | (setq form (cdr form)) |
| 1495 | (princ (format (if quoted "'(#$ . %d)" "(#$ . %d)") | 1495 | (setq index (1+ index)))) |
| 1496 | position) | 1496 | ((= index (nth 1 info)) |
| 1497 | outbuffer) | 1497 | (if position |
| 1498 | (let ((print-escape-newlines nil)) | 1498 | (princ (format (if quoted "'(#$ . %d)" "(#$ . %d)") |
| 1499 | (goto-char (prog1 (1+ (point)) | 1499 | position) |
| 1500 | (prin1 (car form) outbuffer))) | 1500 | outbuffer) |
| 1501 | (insert "\\\n") | 1501 | (let ((print-escape-newlines nil)) |
| 1502 | (goto-char (point-max))))) | 1502 | (goto-char (prog1 (1+ (point)) |
| 1503 | (t | 1503 | (prin1 (car form) outbuffer))) |
| 1504 | (prin1 (car form) outbuffer))))) | 1504 | (insert "\\\n") |
| 1505 | (insert (nth 2 info))))) | 1505 | (goto-char (point-max))))) |
| 1506 | (t | ||
| 1507 | (prin1 (car form) outbuffer))))) | ||
| 1508 | (insert (nth 2 info)))))) | ||
| 1506 | nil) | 1509 | nil) |
| 1507 | 1510 | ||
| 1508 | (defun byte-compile-keep-pending (form &optional handler) | 1511 | (defun byte-compile-keep-pending (form &optional handler) |