comparison lisp/simple.el @ 2299:53abb56a18fa

* simple.el (comment-indent-function): New variable, intended to replace comment-indent-hook. (comment-indent-hook): Make this default to nil now. (indent-for-comment): If comment-indent-hook is non-nil, call it for backward compatibility; otherwise, call comment-indent-function. * bytecomp.el: Declare comment-indent-hook an obsolete variable.
author Jim Blandy <jimb@redhat.com>
date Sun, 21 Mar 1993 07:04:44 +0000
parents a7d915ce7676
children 1380ea427dee
comparison
equal deleted inserted replaced
2298:872a3a2c3fed 2299:53abb56a18fa
1489 1489
1490 (defconst comment-end "" 1490 (defconst comment-end ""
1491 "*String to insert to end a new comment. 1491 "*String to insert to end a new comment.
1492 Should be an empty string if comments are terminated by end-of-line.") 1492 Should be an empty string if comments are terminated by end-of-line.")
1493 1493
1494 (defconst comment-indent-hook 1494 (defconst comment-indent-hook nil
1495 "Obsolete variable for function to compute desired indentation for a comment.
1496 This function is called with no args with point at the beginning of
1497 the comment's starting delimiter.")
1498
1499 (defconst comment-indent-function
1495 '(lambda () comment-column) 1500 '(lambda () comment-column)
1496 "Function to compute desired indentation for a comment. 1501 "Function to compute desired indentation for a comment.
1497 This function is called with no args with point at the beginning of 1502 This function is called with no args with point at the beginning of
1498 the comment's starting delimiter.") 1503 the comment's starting delimiter.")
1499 1504
1519 (skip-chars-backward " \t" (match-beginning 0)) 1524 (skip-chars-backward " \t" (match-beginning 0))
1520 (skip-chars-backward "^ \t" (match-beginning 0))))) 1525 (skip-chars-backward "^ \t" (match-beginning 0)))))
1521 (setq begpos (point)) 1526 (setq begpos (point))
1522 ;; Compute desired indent. 1527 ;; Compute desired indent.
1523 (if (= (current-column) 1528 (if (= (current-column)
1524 (setq indent (funcall comment-indent-hook))) 1529 (if comment-indent-hook
1530 (funcall comment-indent-hook)
1531 (funcall comment-indent-function)))
1525 (goto-char begpos) 1532 (goto-char begpos)
1526 ;; If that's different from current, change it. 1533 ;; If that's different from current, change it.
1527 (skip-chars-backward " \t") 1534 (skip-chars-backward " \t")
1528 (delete-region (point) begpos) 1535 (delete-region (point) begpos)
1529 (indent-to indent)) 1536 (indent-to indent))