emacs-devel
[Top][All Lists]
Advanced

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

Re: how-many/count-matches for non-interactive use


From: Richard Stallman
Subject: Re: how-many/count-matches for non-interactive use
Date: Sat, 23 Oct 2004 14:49:03 -0400

      For most others, the current behavior prevents nuisance
    messaging, as intended.

Could you tell me some of the functions where you reached this
conclusion?

    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.

It is not a no-op, but it is not correct either.  These commands as
currently written would behave incorrectly in some cases in a keyboard
macro.  They are certainly instances of the problem I was worried
about: expecting interactive-p not to be affected by keyboard macros.
They need to be fixed.

Your approach to the third one is to replace interactive-p with t (in
effect).  I think that is the right approach for all three.  Your
approach to the first two is to delete the call to
prefix-numeric-value.  As far as I can see, that would extend the bug
to the non-macro case.

So I think this is the right fix for those.


*** indent.el   12 Oct 2004 04:45:09 -0400      1.58
--- indent.el   23 Oct 2004 13:29:00 -0400      
***************
*** 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,211 ----
  Interactively, WIDTH is the prefix argument, if specified.
  Without prefix argument, the command prompts for WIDTH."
    (interactive "r\nNSet left margin to column: ")
!   (setq width (prefix-numeric-value width))
    (save-excursion
      ;; If inside indentation, start from BOL.
      (goto-char from)
***************
*** 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")
--- 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: ")
!   (setq width (prefix-numeric-value width))
    (save-excursion
      (goto-char from)
      (skip-chars-backward " \t")
***************
*** 289,297 ****
  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))))
--- 289,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 current-prefix-arg)
!             standard-indent))
    (save-excursion
      (alter-text-property from to 'right-margin
         (lambda (v) (+ inc (or v 0))))





reply via email to

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