Skip to content

Commit

Permalink
Merge pull request #1665 from SequentialDesign/change-insert-()-to-in…
Browse files Browse the repository at this point in the history
…sert-()-or-wrap

change `insert-()` to `insert-()-or-wrap`
  • Loading branch information
cxxxr authored Dec 2, 2024
2 parents 64f3699 + 9e954ae commit 131d466
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/ext/language-mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
(define-key *language-mode-keymap* "M-?" 'find-references)
(define-key *language-mode-keymap* "M-," 'pop-definition-stack)
(define-key *language-mode-keymap* "C-M-i" 'complete-symbol)
(define-key *global-keymap* "M-(" 'insert-\(\))
(define-key *global-keymap* "M-(" 'insert-\(\)-or-wrap)
(define-key *global-keymap* "M-)" 'move-over-\))

(defun beginning-of-defun-1 (n)
Expand Down Expand Up @@ -471,11 +471,18 @@
(complete-symbol)))
(complete-symbol)))

(define-command (insert-\(\) (:advice-classes editable-advice)) () ()
(let ((p (current-point)))
(insert-character p #\()
(insert-character p #\))
(character-offset p -1)))
(define-command (insert-\(\)-or-wrap (:advice-classes editable-advice)) () ()
(if (mark-active-p (cursor-mark (current-point)))
(with-point ((start (cursor-region-beginning (current-point)))
(end (cursor-region-end (current-point))))
(when (point< start (current-point))
(exchange-point-mark))
(insert-character end #\))
(insert-character start #\())
(let ((p (current-point)))
(insert-character p #\()
(insert-character p #\))
(character-offset p -1))))

(defun backward-search-rper ()
(save-excursion
Expand Down

0 comments on commit 131d466

Please sign in to comment.