emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: add-change-log-entry


From: martin rudalics
Subject: Re: add-change-log-entry
Date: Sat, 21 Jul 2007 11:09:27 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Stefan Monnier wrote:
> Please move it into its own function and then call it from there.

Look at the attached patch (maybe you wanted to suggest a better name).
BTW, may I defvar c-beginning-of-defun and c-end-of-defun here, they
are driving me mad.

Richard Stallman wrote:
> This is a better way to write the big comment:

Applied.
*** add-log.el  Sat Jul 21 10:16:58 2007
--- add-log.el  Sat Jul 21 10:45:10 2007
***************
*** 659,667 ****
--- 659,703 ----
    (add-change-log-entry whoami file-name t))
  ;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window)
  
+ 
  (defvar change-log-indent-text 0)
  
+ (defun change-log-fill-parenthesized-list ()
+   ;; Fill parenthesized lists of names according to GNU standards.
+   ;; * file-name.ext (very-long-foo, very-long-bar, very-long-foobar):
+   ;; should be filled as
+   ;; * file-name.ext (very-long-foo, very-long-bar)
+   ;; (very-long-foobar):
+   (save-excursion
+     (end-of-line 0)
+     (skip-chars-backward " \t")
+     (when (and (equal (char-before) ?\,)
+              (> (point) (1+ (point-min))))
+       (condition-case nil
+         (when (save-excursion
+                 (and (prog2
+                          (up-list -1)
+                          (equal (char-after) ?\()
+                        (skip-chars-backward " \t"))
+                      (or (bolp)
+                          ;; Skip everything but a whitespace or asterisk.
+                          (and (not (zerop (skip-chars-backward "^ \t\n*")))
+                               (skip-chars-backward " \t")
+                               ;; We want one asterisk here.
+                               (= (skip-chars-backward "*") -1)
+                               (skip-chars-backward " \t")
+                               (bolp)))))
+           ;; Delete the comma.
+           (delete-char -1)
+           ;; Close list on previous line.
+           (insert ")")
+           (skip-chars-forward " \t\n")
+           ;; Start list on new line.
+           (insert-before-markers "("))
+       (error nil)))))
+ 
  (defun change-log-indent ()
+   (change-log-fill-parenthesized-list)
    (let* ((indent
          (save-excursion
            (beginning-of-line)
***************
*** 729,735 ****
    (interactive "P")
    (let ((end (progn (forward-paragraph) (point)))
        (beg (progn (backward-paragraph) (point)))
!       (paragraph-start (concat paragraph-start "\\|\\s *\\s(")))
      (fill-region beg end justify)
      t))
  
--- 765,775 ----
    (interactive "P")
    (let ((end (progn (forward-paragraph) (point)))
        (beg (progn (backward-paragraph) (point)))
!       ;; Add lines starting with whitespace followed by a left paren or an
!       ;; asterisk.
!       (paragraph-start (concat paragraph-start "\\|\\s *\\(?:\\s(\\|\\*\\)"))
!       ;; Make sure we call `change-log-indent'.
!       (fill-indent-according-to-mode t))
      (fill-region beg end justify)
      t))
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]