jyp / boon

Ergonomic Command Mode for Emacs
GNU General Public License v3.0
323 stars 34 forks source link

Enhancements for Lisp editing #117

Closed contrapunctus-1 closed 2 years ago

contrapunctus-1 commented 3 years ago

Even though I use the smartparens package, most of the time I'm using Boon commands to edit Lisp sources. There is some smartparens and Paxedit functionality I'd like to see in Boon in Lisp modes* -

  1. [Paredit/Smartparens-inspired] Deletion and paste commands preserve parentheses balance.
    • I don't usually mess up parenthesis balance with Boon, but when I do, it's by accidentally running the character or beginning/end of line selectors.
  2. [Paxedit-inspired] Automatic whitespace management -
    • if a command leaves a dangling parenthesis or a line with only whitespace, run delete-indentation
    • (optionally) run something like sp-indent-defun after each command.
    • (are there any more situations where whitespace management can be automated?)
  3. [Paxedit-inspired] A select-pair operation, which selects things like a symbol-value pair in a let, setq, setf etc, a keyword-value pair in a plist, a cons cell in an alist, and so on. While boon-select-symbol can be used for this purpose, it involves going to the start or end of the expressions - this one would also work when the cursor is within them.
  4. [Tweak to Boon behavior] Quotes are treated as part of the symbol (e.g. make '|symbol -> boon-take-region boon-select-symbol result in | rather than '|).
    • Optionally, change boon-smarter-forward/backward so that | :keyword -> boon-take-region boon-smarter-forward results in | rather than |keyword.

*whether these are actually implemented in Boon, or as integrations to Smartparens and Paxedit, is another question.

jyp commented 2 years ago

For 1. and 2. I am not sure how to act. Seems like more design is necessary. If you have more specific ideas please open another issue. For 3. you can define your own selector (PR accepted if you want to share it!). For 4. I don't actually understand what you're proposing, please clarify in a new issue. I am going to close this issue because there is no clear action path, and all points seem to be mostly independent anyway.