emacs-devel
[Top][All Lists]
Advanced

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

Re: Suggested experimental test


From: Gregory Heytings
Subject: Re: Suggested experimental test
Date: Tue, 23 Mar 2021 14:15:12 +0000


I use C-o (usually followed by C-n) many times a day, instead of <Enter>, in order to suppress re-indentation of the current line in cases where that re-indentation will be incorrect for my purposes**.

Oh, I see -- it's useful as an alternative to `RET' exactly when re-indentation does the wrong thing?

Yes, but not only that -- it doesn't move point to the next line, unlike RET.

Why should a control key must be reserved forever for that very specific purpose, and for that very specific purpose only, in the default Emacs bindings?

Opening an empty line is a very useful editing primitive, not unlike going to the next line with RET.


I'd bet it is useful, as it is, only for 0.5% of Emacs users, perhaps even less. No other editor I know has that feature. And I'd bet that 90% of those 0.5% would be happier with a better open-line primitive, for example one which can be called when point is in the middle of a line, like "o" and "O" in vi. The discussion showed that those who use it use it at BOL, and that it wasn't used alone, but as part of a sequence, for example C-a C-o or C-o C-n. Nobody even mentioned the fact that open-line uses the fill-prefix and the left-margin.

As I said, an improved version of that command could for example be put on M-RET. Here's an attempt:

(defun smart-open-line (&optional arg)
  (interactive "*p")
  (when (> arg 0)
    (beginning-of-line)
    (let ((p (point-marker)))
      (dotimes (_ arg) (insert "\n"))
      (goto-char p)))
  (when (< arg 0)
    (setq arg (abs arg))
    (beginning-of-line)
    (forward-line 1)
    (dotimes (_ arg) (insert "\n"))
    (forward-line -1)))
(global-set-key (kbd "M-RET") 'smart-open-line)

And even assuming that it is useful as it is, that doesn't answer the main question: why should a control character key be reserved forever for that very specific purpose, and for that very specific purpose only?


Trying to change that will always cause staunch resistance, especially when the purpose for which this is done is vague and not perceived as important enough by enough people.


I could have clarified the purpose indeed, but the risk would have been to start two parallel discussions.



reply via email to

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