comparison lisp/newcomment.el @ 30090:6ea3040d5833

(uncomment-region): Be more careful when skipping backwards over `=' not to bump into BOBP.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 06 Jul 2000 13:24:28 +0000
parents c2940b6e267e
children 62205b47cdfd
comparison
equal deleted inserted replaced
30089:f7f64f1ccc38 30090:6ea3040d5833
4 4
5 ;; Author: code extracted from Emacs-20's simple.el 5 ;; Author: code extracted from Emacs-20's simple.el
6 ;; Maintainer: Stefan Monnier <monnier@cs.yale.edu> 6 ;; Maintainer: Stefan Monnier <monnier@cs.yale.edu>
7 ;; Keywords: comment uncomment 7 ;; Keywords: comment uncomment
8 ;; Version: $Name: $ 8 ;; Version: $Name: $
9 ;; Revision: $Id: newcomment.el,v 1.16 2000/06/04 22:02:11 monnier Exp $ 9 ;; Revision: $Id: newcomment.el,v 1.17 2000/06/20 09:40:36 fx Exp $
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
587 (delete-char (- numarg))) 587 (delete-char (- numarg)))
588 588
589 ;; Remove the end-comment (and leading padding and such). 589 ;; Remove the end-comment (and leading padding and such).
590 (goto-char (point-max)) (comment-enter-backward) 590 (goto-char (point-max)) (comment-enter-backward)
591 ;; Check for special `=' used sometimes in comment-box. 591 ;; Check for special `=' used sometimes in comment-box.
592 (when (and (= (- (point-max) (point)) 1) (> (point) 7) 592 (when (= (- (point-max) (point)) 1)
593 (save-excursion (backward-char 7) 593 (let ((pos (point)))
594 (looking-at "=\\{7\\}"))) 594 ;; skip `=' but only if there are at least 7.
595 (skip-chars-backward "=")) 595 (when (> (skip-chars-backward "=") -7) (goto-char pos))))
596 (unless (looking-at "\\(\n\\|\\s-\\)*\\'") 596 (unless (looking-at "\\(\n\\|\\s-\\)*\\'")
597 (when (and (bolp) (not (bobp))) (backward-char)) 597 (when (and (bolp) (not (bobp))) (backward-char))
598 (if (null arg) (delete-region (point) (point-max)) 598 (if (null arg) (delete-region (point) (point-max))
599 (skip-syntax-forward " ") 599 (skip-syntax-forward " ")
600 (delete-char numarg))) 600 (delete-char numarg)))
959 959
960 (provide 'newcomment) 960 (provide 'newcomment)
961 961
962 ;;; Change Log: 962 ;;; Change Log:
963 ;; $Log: newcomment.el,v $ 963 ;; $Log: newcomment.el,v $
964 ;; Revision 1.17 2000/06/20 09:40:36 fx
965 ;; (comment) <defgroup>: Add :version.
966 ;; (comment-multi-line): Doc fix.
967 ;;
964 ;; Revision 1.16 2000/06/04 22:02:11 monnier 968 ;; Revision 1.16 2000/06/04 22:02:11 monnier
965 ;; (comment-indent): Ignore comment-indent-hook. 969 ;; (comment-indent): Ignore comment-indent-hook.
966 ;; 970 ;;
967 ;; Revision 1.15 2000/05/25 19:05:46 monnier 971 ;; Revision 1.15 2000/05/25 19:05:46 monnier
968 ;; Add abundant autoload cookies. 972 ;; Add abundant autoload cookies.