Skip to content

Commit

Permalink
Merge pull request #1666 from SequentialDesign/change-move-over-)-to-…
Browse files Browse the repository at this point in the history
…move-over-)-and-wrap

change `move-over-)` to `move-over-)-or-wrap`
  • Loading branch information
cxxxr authored Dec 2, 2024
2 parents 131d466 + a8bc851 commit 4114452
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/ext/language-mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
(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-\(\)-or-wrap)
(define-key *global-keymap* "M-)" 'move-over-\))
(define-key *global-keymap* "M-)" 'move-over-\)-or-wrap)

(defun beginning-of-defun-1 (n)
(alexandria:when-let ((fn (variable-value 'beginning-of-defun-function :buffer)))
Expand Down Expand Up @@ -505,16 +505,23 @@
(delete-character p)
(character-offset p -1))))

(define-command (move-over-\) (:advice-classes movable-advice editable-advice)) () ()
(let ((rper (backward-search-rper)))
(if rper
(progn
(backward-delete-to-rper)
(scan-lists (current-point) 1 1 T)
(newline-and-indent 1))
(progn
(scan-lists (current-point) 1 1 T)
(newline-and-indent 1)))))
(define-command (move-over-\)-or-wrap (:advice-classes movable-advice 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> end (current-point))
(exchange-point-mark))
(insert-character end #\))
(insert-character start #\())
(let ((rper (backward-search-rper)))
(if rper
(progn
(backward-delete-to-rper)
(scan-lists (current-point) 1 1 T)
(newline-and-indent 1))
(progn
(scan-lists (current-point) 1 1 T)
(newline-and-indent 1))))))

(defun match-pattern-p (pattern file)
(etypecase pattern
Expand Down

0 comments on commit 4114452

Please sign in to comment.