emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Interactive specs, align.el


From: Juri Linkov
Subject: Re: Interactive specs, align.el
Date: Sun, 11 Dec 2005 12:46:05 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> I think using `region-beginning' and `region-end' is cleaner than
>> `(max (point) (mark))', but for `repeat-complex-command' this change
>> makes no difference.
>
> It does make a difference for one of them. Yes, I overlooked the
> `append' in the other one. Yes, it's still an improvement.

I looked only at the first command, but it is true that the second is ok.

As for fixing the first command, I looked at the code that keeps
some command arguments unevaluated in the command history, and see
that the whole function `fix_command' is a hairy hack, so it's better
not to change it radically now.  Rather below is a patch for align.el
that satisfies the current logic of keeping region-beginning/region-end
in the command history.

Index: lisp/align.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/align.el,v
retrieving revision 1.20
diff -c -r1.20 align.el
*** lisp/align.el       10 Dec 2005 12:35:04 -0000      1.20
--- lisp/align.el       11 Dec 2005 10:45:02 -0000
***************
*** 930,950 ****
  using a REGEXP like \"(\". All you would have to do is to mark the
  region, call `align-regexp' and type in that regular expression."
    (interactive
!    (append
!     (list (region-beginning) (region-end))
      (if current-prefix-arg
!       (list (read-string "Complex align using regexp: "
!                          "\\(\\s-*\\)")
!             (string-to-number
!              (read-string
!               "Parenthesis group to modify (justify if negative): " "1"))
!             (string-to-number
!              (read-string "Amount of spacing (or column if negative): "
!                           (number-to-string align-default-spacing)))
!             (y-or-n-p "Repeat throughout line? "))
!       (list (concat "\\(\\s-*\\)"
!                   (read-string "Align regexp: "))
!           1 align-default-spacing nil))))
    (let ((rule
         (list (list nil (cons 'regexp regexp)
                     (cons 'group (abs group))
--- 930,953 ----
  using a REGEXP like \"(\". All you would have to do is to mark the
  region, call `align-regexp' and type in that regular expression."
    (interactive
!    (list
!     (region-beginning)
!     (region-end)
      (if current-prefix-arg
!       (read-string "Complex align using regexp: " "\\(\\s-*\\)")
!       (concat "\\(\\s-*\\)" (read-string "Align regexp: ")))
!     (if current-prefix-arg
!       (string-to-number
!        (read-string
!         "Parenthesis group to modify (justify if negative): " "1"))
!       1)
!     (if current-prefix-arg
!       (string-to-number
!        (read-string "Amount of spacing (or column if negative): "
!                     (number-to-string align-default-spacing)))
!       align-default-spacing)
!     (if current-prefix-arg
!       (y-or-n-p "Repeat throughout line? "))))
    (let ((rule
         (list (list nil (cons 'regexp regexp)
                     (cons 'group (abs group))

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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