help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Indenting with the tab key like everyone else


From: R. Diez
Subject: Re: Indenting with the tab key like everyone else
Date: Tue, 16 Jul 2019 09:23:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2


I am not sure what you really want to do exactly. There are some tips I
thought of based on the code:
> [...]

After much fighting with Emacs, I think I narrowed the problem down to a weird side-effect of calling (use-region-p). I have written this routine for test purposes. I would be interested to know if you can reproduce it on your Emacs.

  ; This routine lets you test the surprising side-effect of calling 
(use-region-p).
  ;
  ; Before calling this routine, select a few text lines by going to the 
beginning of a line
  ; (column 0) and pressing Shift + <cursor down> a few times. The lines will 
be highlighted.
  ;
  ; Then call this routine interactively a few times in a row. The lines will 
indent one character at a time.
  ; The first time, the highlighting will disappear, but the selection will 
somehow stay, so that
  ; further calls will still indent the same lines.
  ;
  ; After the test above, change "(if t" below to "(if (use-region-p)", and 
repeat the test.
  ; The first time, the text will indent one character, but the second call 
will not indent anymore,
  ; because the selection is completely lost.


  (defun indentation-test nil ""
    (interactive)

    (if t
    ; (if (use-region-p)
      (indent-rigidly (region-beginning) (region-end) 1)
      (message "Skipping because there is no selection.")
    )
  )

Best regards,
  rdiez



reply via email to

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