comparison lisp/simple.el @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents a4f53d9b3154
children a300bb07d72d
comparison
equal deleted inserted replaced
370:bd866891f083 371:cc15677e0335
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 2256 "Indent this line's comment to comment column, or insert an empty comment."
2257 comment. Comments starting in column 0 are not moved."
2258 (interactive "*") 2257 (interactive "*")
2259 (let* ((empty (save-excursion (beginning-of-line) 2258 (let* ((empty (save-excursion (beginning-of-line)
2260 (looking-at "[ \t]*$"))) 2259 (looking-at "[ \t]*$")))
2261 (starter (or (and empty block-comment-start) comment-start)) 2260 (starter (or (and empty block-comment-start) comment-start))
2262 (ender (or (and empty block-comment-end) comment-end))) 2261 (ender (or (and empty block-comment-end) comment-end)))
2279 ;; beginning of what was matched. 2278 ;; beginning of what was matched.
2280 (skip-syntax-backward " " (match-beginning 0)) 2279 (skip-syntax-backward " " (match-beginning 0))
2281 (skip-syntax-backward "^ " (match-beginning 0))))) 2280 (skip-syntax-backward "^ " (match-beginning 0)))))
2282 (setq begpos (point)) 2281 (setq begpos (point))
2283 ;; Compute desired indent. 2282 ;; Compute desired indent.
2284 ;; XEmacs change: Preserve indentation of comments starting in 2283 (if (= (current-column)
2285 ;; column 0, as documented. 2284 (setq indent (funcall comment-indent-function)))
2286 (cond 2285 (goto-char begpos)
2287 ((= (current-column) 0)
2288 (goto-char begpos))
2289 ((= (current-column)
2290 (setq indent (funcall comment-indent-function)))
2291 (goto-char begpos))
2292 (t
2293 ;; If that's different from current, change it. 2286 ;; If that's different from current, change it.
2294 (skip-chars-backward " \t") 2287 (skip-chars-backward " \t")
2295 (delete-region (point) begpos) 2288 (delete-region (point) begpos)
2296 (indent-to indent))) 2289 (indent-to indent))
2297 ;; An existing comment? 2290 ;; An existing comment?
2298 (if cpos 2291 (if cpos
2299 (progn (goto-char cpos) 2292 (progn (goto-char cpos)
2300 (set-marker cpos nil)) 2293 (set-marker cpos nil))
2301 ;; No, insert one. 2294 ;; No, insert one.
2327 (lmessage 'command "Comment column set to %d" comment-column)))) 2320 (lmessage 'command "Comment column set to %d" comment-column))))
2328 2321
2329 (defun kill-comment (arg) 2322 (defun kill-comment (arg)
2330 "Kill the comment on this line, if any. 2323 "Kill the comment on this line, if any.
2331 With argument, kill comments on that many lines starting with this one." 2324 With argument, kill comments on that many lines starting with this one."
2332 ;; this function loses in a lot of situations. it incorrectly recognizes 2325 ;; this function loses in a lot of situations. it incorrectly recognises
2333 ;; comment delimiters sometimes (ergo, inside a string), doesn't work 2326 ;; comment delimiters sometimes (ergo, inside a string), doesn't work
2334 ;; with multi-line comments, can kill extra whitespace if comment wasn't 2327 ;; with multi-line comments, can kill extra whitespace if comment wasn't
2335 ;; through end-of-line, et cetera. 2328 ;; through end-of-line, et cetera.
2336 (interactive "*P") 2329 (interactive "*P")
2337 (or comment-start-skip (error "No comment syntax defined")) 2330 (or comment-start-skip (error "No comment syntax defined"))
2613 ;; Otherwise, if a comment prefix or fill-prefix is inserted, 2606 ;; Otherwise, if a comment prefix or fill-prefix is inserted,
2614 ;; point will end up before it rather than after it. 2607 ;; point will end up before it rather than after it.
2615 (if (save-excursion 2608 (if (save-excursion
2616 (skip-chars-backward " \t") 2609 (skip-chars-backward " \t")
2617 (= (point) fill-point)) 2610 (= (point) fill-point))
2618 ;; 1999-09-17 hniksic: turn off Kinsoku until
2619 ;; it's debugged.
2620 (funcall comment-line-break-function)
2621 ;; 97/3/14 jhod: Kinsoku processing 2611 ;; 97/3/14 jhod: Kinsoku processing
2622 ; ;(indent-new-comment-line) 2612 ;(indent-new-comment-line)
2623 ; (let ((spacep (memq (char-before (point)) '(?\ ?\t)))) 2613 (let ((spacep (memq (char-before (point)) '(?\ ?\t))))
2624 ; (funcall comment-line-break-function) 2614 (funcall comment-line-break-function)
2625 ; ;; if user type space explicitly, leave SPC 2615 ;; if user type space explicitly, leave SPC
2626 ; ;; even if there is no WAN. 2616 ;; even if there is no WAN.
2627 ; (if spacep 2617 (if spacep
2628 ; (save-excursion 2618 (save-excursion
2629 ; (goto-char fill-point) 2619 (goto-char fill-point)
2630 ; ;; put SPC except that there is SPC 2620 ;; put SPC except that there is SPC
2631 ; ;; already or there is sentence end. 2621 ;; already or there is sentence end.
2632 ; (or (memq (char-after (point)) '(?\ ?\t)) 2622 (or (memq (char-after (point)) '(?\ ?\t))
2633 ; (fill-end-of-sentence-p) 2623 (fill-end-of-sentence-p)
2634 ; (insert ?\ ))))) 2624 (insert ?\ )))))
2635 (save-excursion 2625 (save-excursion
2636 (goto-char fill-point) 2626 (goto-char fill-point)
2637 (funcall comment-line-break-function))) 2627 (funcall comment-line-break-function)))
2638 ;; If making the new line didn't reduce the hpos of 2628 ;; If making the new line didn't reduce the hpos of
2639 ;; the end of the line, then give up now; 2629 ;; the end of the line, then give up now;
2765 "Automatically break line at a previous space, in insertion of text." 2755 "Automatically break line at a previous space, in insertion of text."
2766 nil) 2756 nil)
2767 2757
2768 (defun turn-on-auto-fill () 2758 (defun turn-on-auto-fill ()
2769 "Unconditionally turn on Auto Fill mode." 2759 "Unconditionally turn on Auto Fill mode."
2770 (interactive)
2771 (auto-fill-mode 1)) 2760 (auto-fill-mode 1))
2772 2761
2773 (defun set-fill-column (arg) 2762 (defun set-fill-column (arg)
2774 "Set `fill-column' to specified argument. 2763 "Set `fill-column' to specified argument.
2775 Just \\[universal-argument] as argument means to use the current column 2764 Just \\[universal-argument] as argument means to use the current column
2851 (setq comstart 2840 (setq comstart
2852 (buffer-substring (point) (match-end 0))))))) 2841 (buffer-substring (point) (match-end 0)))))))
2853 (if (and comcol (not fill-prefix)) ; XEmacs - (ENE) from fa-extras. 2842 (if (and comcol (not fill-prefix)) ; XEmacs - (ENE) from fa-extras.
2854 (let ((comment-column comcol) 2843 (let ((comment-column comcol)
2855 (comment-start comstart) 2844 (comment-start comstart)
2856 (block-comment-start comstart)
2857 (comment-end comment-end)) 2845 (comment-end comment-end))
2858 (and comment-end (not (equal comment-end "")) 2846 (and comment-end (not (equal comment-end ""))
2859 ; (if (not comment-multi-line) 2847 ; (if (not comment-multi-line)
2860 (progn 2848 (progn
2861 (forward-char -1) 2849 (forward-char -1)
3904 3892
3905 (defcustom display-warning-suppressed-classes nil 3893 (defcustom display-warning-suppressed-classes nil
3906 "List of classes of warnings that shouldn't be displayed. 3894 "List of classes of warnings that shouldn't be displayed.
3907 If any of the CLASS symbols associated with a warning is the same as 3895 If any of the CLASS symbols associated with a warning is the same as
3908 any of the symbols listed here, the warning will not be displayed. 3896 any of the symbols listed here, the warning will not be displayed.
3909 The warning will still be logged in the *Warnings* buffer (unless also 3897 The warning will still logged in the *Warnings* buffer (unless also
3910 contained in `log-warning-suppressed-classes'), but the buffer will 3898 contained in `log-warning-suppressed-classes'), but the buffer will
3911 not be automatically popped up. 3899 not be automatically popped up.
3912 3900
3913 See also `log-warning-minimum-level' and `display-warning-minimum-level'." 3901 See also `log-warning-minimum-level' and `display-warning-minimum-level'."
3914 :type '(repeat symbol) 3902 :type '(repeat symbol)