mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-21 12:03:55 -08:00
New IELM option to insert newline when inside sexp (bug#80123)
* lisp/ielm.el (ielm-dynamic-return): Add new value `point' to user option. (ielm-return): Implement it (bug#80123).
This commit is contained in:
parent
c86067778b
commit
6d0d71de68
2 changed files with 30 additions and 4 deletions
7
etc/NEWS
7
etc/NEWS
|
|
@ -2060,6 +2060,13 @@ When you kill the IELM process with 'C-c C-c', the input history is now
|
|||
saved to the file specified by 'ielm-history-file-name', just like when
|
||||
you exit the Emacs session or kill the IELM buffer.
|
||||
|
||||
---
|
||||
*** New value 'point' for user option 'ielm-dynamic-return'
|
||||
When 'ielm-dynamic-return' is set to 'point', typing RET has dynamic
|
||||
behavior based on if point is inside an sexp. While the point is inside
|
||||
an sexp typing RET inserts a newline, otherwise the sexp is evaluated.
|
||||
This is useful when the mode 'electric-pair-mode' is enabled.
|
||||
|
||||
** DocView
|
||||
|
||||
---
|
||||
|
|
|
|||
27
lisp/ielm.el
27
lisp/ielm.el
|
|
@ -97,9 +97,27 @@ customizes `ielm-prompt'.")
|
|||
|
||||
(defcustom ielm-dynamic-return t
|
||||
"Controls whether \\<ielm-map>\\[ielm-return] has intelligent behavior in IELM.
|
||||
If non-nil, \\[ielm-return] evaluates input for complete sexps, or inserts a newline
|
||||
and indents for incomplete sexps. If nil, always inserts newlines."
|
||||
:type 'boolean)
|
||||
|
||||
If nil, always insert newlines.
|
||||
|
||||
If `point', insert newline if the point is in the middle of an sexp,
|
||||
otherwise evaluate input. This is useful if you have
|
||||
`electric-pair-mode' enabled.
|
||||
|
||||
If any other non-nil value, insert newline for incomplete sexp input and
|
||||
evaluate input for complete sexps. This is similar to the behavior in
|
||||
text shells."
|
||||
:type
|
||||
'(radio
|
||||
(const :tag "Always insert newline" nil)
|
||||
(const
|
||||
:tag
|
||||
"Insert newline if point is in middle of sexp, otherwise evaluate input"
|
||||
point)
|
||||
(const
|
||||
:tag
|
||||
"Insert newline for incomplete sexp, otherwise evaluate input"
|
||||
t)))
|
||||
|
||||
(defcustom ielm-dynamic-multiline-inputs t
|
||||
"Force multiline inputs to start from column zero?
|
||||
|
|
@ -248,7 +266,8 @@ simply inserts a newline."
|
|||
(if ielm-dynamic-return
|
||||
(let ((state
|
||||
(save-excursion
|
||||
(end-of-line)
|
||||
(unless (eq ielm-dynamic-return 'point)
|
||||
(end-of-line))
|
||||
(parse-partial-sexp (ielm-pm)
|
||||
(point)))))
|
||||
(if (and (< (car state) 1) (not (nth 3 state)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue