comparison lisp/simple.el @ 367:a4f53d9b3154 r21-1-13

Import from CVS: tag r21-1-13
author cvs
date Mon, 13 Aug 2007 11:01:07 +0200
parents 182f72e8cd0d
children cc15677e0335
comparison
equal deleted inserted replaced
366:83d76f480a59 367:a4f53d9b3154
2251 :type '(choice (const :tag "Use `comment-end'" nil) 2251 :type '(choice (const :tag "Use `comment-end'" nil)
2252 string) 2252 string)
2253 :group 'fill-comments) 2253 :group 'fill-comments)
2254 2254
2255 (defun indent-for-comment () 2255 (defun indent-for-comment ()
2256 "Indent this line's comment to comment column, or insert an empty comment." 2256 "Indent this line's comment to comment column, or insert an empty
2257 comment. Comments starting in column 0 are not moved."
2257 (interactive "*") 2258 (interactive "*")
2258 (let* ((empty (save-excursion (beginning-of-line) 2259 (let* ((empty (save-excursion (beginning-of-line)
2259 (looking-at "[ \t]*$"))) 2260 (looking-at "[ \t]*$")))
2260 (starter (or (and empty block-comment-start) comment-start)) 2261 (starter (or (and empty block-comment-start) comment-start))
2261 (ender (or (and empty block-comment-end) comment-end))) 2262 (ender (or (and empty block-comment-end) comment-end)))
2278 ;; beginning of what was matched. 2279 ;; beginning of what was matched.
2279 (skip-syntax-backward " " (match-beginning 0)) 2280 (skip-syntax-backward " " (match-beginning 0))
2280 (skip-syntax-backward "^ " (match-beginning 0))))) 2281 (skip-syntax-backward "^ " (match-beginning 0)))))
2281 (setq begpos (point)) 2282 (setq begpos (point))
2282 ;; Compute desired indent. 2283 ;; Compute desired indent.
2283 (if (= (current-column) 2284 ;; XEmacs change: Preserve indentation of comments starting in
2284 (setq indent (funcall comment-indent-function))) 2285 ;; column 0, as documented.
2285 (goto-char begpos) 2286 (cond
2287 ((= (current-column) 0)
2288 (goto-char begpos))
2289 ((= (current-column)
2290 (setq indent (funcall comment-indent-function)))
2291 (goto-char begpos))
2292 (t
2286 ;; If that's different from current, change it. 2293 ;; If that's different from current, change it.
2287 (skip-chars-backward " \t") 2294 (skip-chars-backward " \t")
2288 (delete-region (point) begpos) 2295 (delete-region (point) begpos)
2289 (indent-to indent)) 2296 (indent-to indent)))
2290 ;; An existing comment? 2297 ;; An existing comment?
2291 (if cpos 2298 (if cpos
2292 (progn (goto-char cpos) 2299 (progn (goto-char cpos)
2293 (set-marker cpos nil)) 2300 (set-marker cpos nil))
2294 ;; No, insert one. 2301 ;; No, insert one.
2320 (lmessage 'command "Comment column set to %d" comment-column)))) 2327 (lmessage 'command "Comment column set to %d" comment-column))))
2321 2328
2322 (defun kill-comment (arg) 2329 (defun kill-comment (arg)
2323 "Kill the comment on this line, if any. 2330 "Kill the comment on this line, if any.
2324 With argument, kill comments on that many lines starting with this one." 2331 With argument, kill comments on that many lines starting with this one."
2325 ;; this function loses in a lot of situations. it incorrectly recognises 2332 ;; this function loses in a lot of situations. it incorrectly recognizes
2326 ;; comment delimiters sometimes (ergo, inside a string), doesn't work 2333 ;; comment delimiters sometimes (ergo, inside a string), doesn't work
2327 ;; with multi-line comments, can kill extra whitespace if comment wasn't 2334 ;; with multi-line comments, can kill extra whitespace if comment wasn't
2328 ;; through end-of-line, et cetera. 2335 ;; through end-of-line, et cetera.
2329 (interactive "*P") 2336 (interactive "*P")
2330 (or comment-start-skip (error "No comment syntax defined")) 2337 (or comment-start-skip (error "No comment syntax defined"))
2608 (if (save-excursion 2615 (if (save-excursion
2609 (skip-chars-backward " \t") 2616 (skip-chars-backward " \t")
2610 (= (point) fill-point)) 2617 (= (point) fill-point))
2611 ;; 1999-09-17 hniksic: turn off Kinsoku until 2618 ;; 1999-09-17 hniksic: turn off Kinsoku until
2612 ;; it's debugged. 2619 ;; it's debugged.
2613 (indent-new-comment-line) 2620 (funcall comment-line-break-function)
2614 ;; 97/3/14 jhod: Kinsoku processing 2621 ;; 97/3/14 jhod: Kinsoku processing
2615 ; ;(indent-new-comment-line) 2622 ; ;(indent-new-comment-line)
2616 ; (let ((spacep (memq (char-before (point)) '(?\ ?\t)))) 2623 ; (let ((spacep (memq (char-before (point)) '(?\ ?\t))))
2617 ; (funcall comment-line-break-function) 2624 ; (funcall comment-line-break-function)
2618 ; ;; if user type space explicitly, leave SPC 2625 ; ;; if user type space explicitly, leave SPC
2758 "Automatically break line at a previous space, in insertion of text." 2765 "Automatically break line at a previous space, in insertion of text."
2759 nil) 2766 nil)
2760 2767
2761 (defun turn-on-auto-fill () 2768 (defun turn-on-auto-fill ()
2762 "Unconditionally turn on Auto Fill mode." 2769 "Unconditionally turn on Auto Fill mode."
2770 (interactive)
2763 (auto-fill-mode 1)) 2771 (auto-fill-mode 1))
2764 2772
2765 (defun set-fill-column (arg) 2773 (defun set-fill-column (arg)
2766 "Set `fill-column' to specified argument. 2774 "Set `fill-column' to specified argument.
2767 Just \\[universal-argument] as argument means to use the current column 2775 Just \\[universal-argument] as argument means to use the current column
3896 3904
3897 (defcustom display-warning-suppressed-classes nil 3905 (defcustom display-warning-suppressed-classes nil
3898 "List of classes of warnings that shouldn't be displayed. 3906 "List of classes of warnings that shouldn't be displayed.
3899 If any of the CLASS symbols associated with a warning is the same as 3907 If any of the CLASS symbols associated with a warning is the same as
3900 any of the symbols listed here, the warning will not be displayed. 3908 any of the symbols listed here, the warning will not be displayed.
3901 The warning will still logged in the *Warnings* buffer (unless also 3909 The warning will still be logged in the *Warnings* buffer (unless also
3902 contained in `log-warning-suppressed-classes'), but the buffer will 3910 contained in `log-warning-suppressed-classes'), but the buffer will
3903 not be automatically popped up. 3911 not be automatically popped up.
3904 3912
3905 See also `log-warning-minimum-level' and `display-warning-minimum-level'." 3913 See also `log-warning-minimum-level' and `display-warning-minimum-level'."
3906 :type '(repeat symbol) 3914 :type '(repeat symbol)