[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how-many/count-matches for non-interactive use
From: |
Luc Teirlinck |
Subject: |
Re: how-many/count-matches for non-interactive use |
Date: |
Fri, 22 Oct 2004 20:53:51 -0500 (CDT) |
>From my previous message:
2. Three functions in `indent.el'. I could check these out further.
If they give any problems, they are trivial to fix.
I checked it now. The functions `set-left-margin' and
`set-right-margin' do not give any problems with keyboard macros.
However, their call to `interactive-p' is a useless and ugly no-op.
The `N' interactive code _gives_ the numeric prefix argument, hence
the lines removed in the patch below are useless and confusing.
In as far as `increase-right-margin' is concerned, I did not check its
effect on keyboard macros, because again, the call to `interactive-p'
is stylistically ugly. It is inconsistent with the way exactly the
same thing gets achieved in `set-left-margin', `set-right-margin' and
`decrease-right-margin' and with the usual way to handle this in other
places in Emacs.
I propose the following patch to indent.el. It eliminates all uses of
`interactive-p' from indent.el. I can install if desired.
That leaves _maybe_ problems in ibuf-ext.el and allout.el. I have the
impression that here again the (maybe) offending calls to
interactive-p should be eliminated and that the argument reading should
instead be done in the interactive calls. I am not really familiar
with these files however and I will leave this up to the maintainers of
the respective files.
Proposed patch to indent.el:
===File ~/indent.el-diff====================================
*** indent.el 29 Sep 2004 20:45:32 -0500 1.58
--- indent.el 22 Oct 2004 19:47:31 -0500
***************
*** 205,211 ****
Interactively, WIDTH is the prefix argument, if specified.
Without prefix argument, the command prompts for WIDTH."
(interactive "r\nNSet left margin to column: ")
- (if (interactive-p) (setq width (prefix-numeric-value width)))
(save-excursion
;; If inside indentation, start from BOL.
(goto-char from)
--- 205,210 ----
***************
*** 229,235 ****
Interactively, WIDTH is the prefix argument, if specified.
Without prefix argument, the command prompts for WIDTH."
(interactive "r\nNSet right margin to width: ")
- (if (interactive-p) (setq width (prefix-numeric-value width)))
(save-excursion
(goto-char from)
(skip-chars-backward " \t")
--- 228,233 ----
***************
*** 289,300 ****
the right margin width.
If `auto-fill-mode' is active, re-fill the region to fit the new margin."
(interactive "r\nP")
! (if (interactive-p)
! (setq inc (if inc (prefix-numeric-value current-prefix-arg)
! standard-indent)))
(save-excursion
(alter-text-property from to 'right-margin
! (lambda (v) (+ inc (or v 0))))
(if auto-fill-function
(fill-region from to nil t t))))
--- 287,296 ----
the right margin width.
If `auto-fill-mode' is active, re-fill the region to fit the new margin."
(interactive "r\nP")
! (setq inc (if inc (prefix-numeric-value inc) standard-indent))
(save-excursion
(alter-text-property from to 'right-margin
! (lambda (v) (+ inc (or v 0))))
(if auto-fill-function
(fill-region from to nil t t))))
============================================================
- Re: how-many/count-matches for non-interactive use, (continued)
- Re: how-many/count-matches for non-interactive use, David Kastrup, 2004/10/19
- Re: how-many/count-matches for non-interactive use, Robert J. Chassell, 2004/10/20
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/19
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/20
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/20
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/22
- Convert keyboard macros to Lisp (was: how-many/count-matches for non-interactive use), Juri Linkov, 2004/10/22
- Re: Convert keyboard macros to Lisp (was: how-many/count-matches for non-interactive use), Richard Stallman, 2004/10/23
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/22
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/22
- Re: how-many/count-matches for non-interactive use,
Luc Teirlinck <=
- Re: how-many/count-matches for non-interactive use, John Paul Wallington, 2004/10/23
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/23
- Re: how-many/count-matches for non-interactive use, Ken Manheimer, 2004/10/25
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/27
- Re: how-many/count-matches for non-interactive use, Ken Manheimer, 2004/10/28
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/23
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/23
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/24
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/25
- Re: how-many/count-matches for non-interactive use, Kim F. Storm, 2004/10/26