From c1ecbb750397fc7ffe82e5c84f5a900a4d8eb10e Mon Sep 17 00:00:00 2001 From: Colin Woodbury Date: Wed, 1 Sep 2021 22:46:35 -0700 Subject: [PATCH 1/4] fix(parinfer): unhog binding of SPC m m This was previously clobbering the underlying binding to the ubiquitous `macrostep-expand` function in Elisp buffers. --- modules/editor/parinfer/config.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/editor/parinfer/config.el b/modules/editor/parinfer/config.el index 34221c33d..fbb2f5050 100644 --- a/modules/editor/parinfer/config.el +++ b/modules/editor/parinfer/config.el @@ -22,8 +22,7 @@ :i "" #'parinfer-smart-tab:dwim-right-or-complete :i "" #'parinfer-smart-tab:dwim-left :localleader - "m" #'parinfer-toggle-mode)) - + "p" #'parinfer-toggle-mode)) (use-package! parinfer-rust-mode :when (featurep! +rust) @@ -45,5 +44,5 @@ :config (map! :map parinfer-rust-mode-map :localleader - "m" #'parinfer-rust-switch-mode - "M" #'parinfer-rust-toggle-disable)) + "p" #'parinfer-rust-switch-mode + "P" #'parinfer-rust-toggle-disable)) From be137e04b079c1a1f84b2b2db01e30e62c02cac1 Mon Sep 17 00:00:00 2001 From: Colin Woodbury Date: Thu, 2 Sep 2021 11:54:14 -0700 Subject: [PATCH 2/4] refactor!(parinfer): drop support for parinfer-mode BREAKING CHANGE: It is no longer maintained, and its author directly recommends `parinfer-rust-mode`. Fix #4323 --- modules/editor/parinfer/config.el | 25 ------------------------- modules/editor/parinfer/doctor.el | 17 ++++++++--------- modules/editor/parinfer/packages.el | 16 +--------------- 3 files changed, 9 insertions(+), 49 deletions(-) diff --git a/modules/editor/parinfer/config.el b/modules/editor/parinfer/config.el index fbb2f5050..4f1f14a21 100644 --- a/modules/editor/parinfer/config.el +++ b/modules/editor/parinfer/config.el @@ -1,31 +1,6 @@ ;;; editor/parinfer/config.el -*- lexical-binding: t; -*- -(use-package! parinfer - :unless (featurep! +rust) - :hook ((emacs-lisp-mode - clojure-mode - scheme-mode - lisp-mode - racket-mode - hy-mode) . parinfer-mode) - :init - (setq parinfer-extensions - '(defaults - pretty-parens - smart-tab - smart-yank)) - (when (featurep! :editor evil +everywhere) - (push 'evil parinfer-extensions)) - :config - (map! :map parinfer-mode-map - "\"" nil ; smartparens handles this - :i "" #'parinfer-smart-tab:dwim-right-or-complete - :i "" #'parinfer-smart-tab:dwim-left - :localleader - "p" #'parinfer-toggle-mode)) - (use-package! parinfer-rust-mode - :when (featurep! +rust) :when (bound-and-true-p module-file-suffix) :hook ((emacs-lisp-mode clojure-mode diff --git a/modules/editor/parinfer/doctor.el b/modules/editor/parinfer/doctor.el index 41528d6ea..092c982ba 100644 --- a/modules/editor/parinfer/doctor.el +++ b/modules/editor/parinfer/doctor.el @@ -1,11 +1,10 @@ ;;; editor/parinfer/doctor.el -*- lexical-binding: t; -*- -(when (featurep! +rust) - (unless (fboundp 'module-load) - (warn! "Your emacs wasn't built with dynamic modules support. `parinfer-rust-mode' won't work")) - (when (and (eq system-type 'berkeley-unix) - (not (file-readable-p (concat user-emacs-directory - ".local/etc/parinfer-rust/libparinfer_rust.so")))) - (warn! (concat "Could not read " user-emacs-directory - ".local/etc/parinfer-rust/libparinfer_rust.so. " - "`parinfer-rust-mode' won't work")))) +(unless (fboundp 'module-load) + (warn! "Your emacs wasn't built with dynamic modules support. `parinfer-rust-mode' won't work")) +(when (and (eq system-type 'berkeley-unix) + (not (file-readable-p (concat user-emacs-directory + ".local/etc/parinfer-rust/libparinfer_rust.so")))) + (warn! (concat "Could not read " user-emacs-directory + ".local/etc/parinfer-rust/libparinfer_rust.so. " + "`parinfer-rust-mode' won't work"))) diff --git a/modules/editor/parinfer/packages.el b/modules/editor/parinfer/packages.el index 7735494c6..a82d3e487 100644 --- a/modules/editor/parinfer/packages.el +++ b/modules/editor/parinfer/packages.el @@ -1,18 +1,4 @@ ;; -*- no-byte-compile: t; -*- ;;; editor/parinfer/packages.el -(if (featurep! +rust) - (package! parinfer-rust-mode :pin "c2c1bbec6cc7dad4f546868aa07609b8d58a78f8") - (when (featurep! :editor evil) - ;; Parinfer uses `evil-define-key' without loading evil, so if evil is - ;; installed *after* parinfer, parinfer will throw up void-function errors. - ;; because evil-define-key (a macro) wasn't expanded at compile-time. So we - ;; make sure evil is installed before parinfer... - (package! evil) - ;; ...and that it can see `evil-define-key' if evil was installed in a - ;; separate session: - (autoload 'evil-define-key "evil-core" nil nil 'macro)) - - (package! parinfer - :recipe (:host github :repo "emacsattic/parinfer") - :pin "8659c99a9475ee34af683fdf8f272728c6bebb3a")) +(package! parinfer-rust-mode :pin "c2c1bbec6cc7dad4f546868aa07609b8d58a78f8") From 8377046e5ac918bafeacbe0b5d45cbbc6a0e28df Mon Sep 17 00:00:00 2001 From: Colin Woodbury Date: Sat, 4 Sep 2021 08:37:18 -0700 Subject: [PATCH 3/4] docs(parinfer): update README to latest template --- modules/editor/parinfer/README.org | 54 +++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/modules/editor/parinfer/README.org b/modules/editor/parinfer/README.org index 530df8764..210c8707b 100644 --- a/modules/editor/parinfer/README.org +++ b/modules/editor/parinfer/README.org @@ -1,25 +1,55 @@ #+TITLE: editor/parinfer #+DATE: June 9, 2018 #+SINCE: v2.1 -#+STARTUP: inlineimages +#+STARTUP: inlineimages nofold -* Table of Contents :TOC: +* Table of Contents :TOC_3:noexport: - [[#description][Description]] + - [[#maintainers][Maintainers]] - [[#module-flags][Module Flags]] - - [[#packages][Packages]] + - [[#plugins][Plugins]] +- [[#prerequisites][Prerequisites]] +- [[#features][Features]] + - [[#keybindings][Keybindings]] +- [[#configuration][Configuration]] +- [[#troubleshooting][Troubleshooting]] * Description -Parinfer is a proof-of-concept editor mode for Lisp programming languages. It -will infer some changes to keep Parens and Indentation inline with one another. -https://raw.githubusercontent.com/DogLooksGood/parinfer-mode/a7c041454e05ec2b88333a73e72debaa671ed596/images/demo.gif +Parinfer is a minor mode that aids the writing of Lisp code. It automatically +infers parenthesis matching and indentation alignment, keeping your code +balanced and beautiful. -More information can be found about it [[https://shaunlebron.github.io/parinfer/][in the project's documentation]]. +Note that the original =parinfer-mode= has been deprecated and superceded by +=parinfer-rust-mode=, which has much better performance. + +** Maintainers + +This module has no dedicated maintainers. ** Module Flags -+ =+rust= Use [[github:justinbarclay/parinfer-rust-mode][parinfer-rust-mode]] instead of the now deprecated [[github:DogLooksGood/parinfer-mode][parinfer-mode]]. - This depends on Emacs being compiled with the option `--with-modules`. The - pre-built library is only available for Linux, Windows and MacOS. -** Packages -+ [[https://github.com/DogLooksGood/parinfer-mode][parinfer]] +This module provides no flags. + +** Plugins + ++ [[https://github.com/justinbarclay/parinfer-rust-mode][parinfer-rust-mode]] + +* Prerequisites + +This module has no prerequisites. + +* Features + +** Keybindings + +| Binding | Description | +|-------------------+-------------------------------------------| +| ~ m p~ | Toggle between different inference modes. | +| ~ m P~ | Temporarily disable parinfer. | + +* Configuration +# How to configure this module, including common problems and how to address them. + +* Troubleshooting +# Common issues and their solution, or places to look for help. From fc79256de51e5e4f290007ad589465498805ef03 Mon Sep 17 00:00:00 2001 From: Colin Woodbury Date: Thu, 16 Sep 2021 21:16:32 -0700 Subject: [PATCH 4/4] fix(parinfer): robust check for shared Rust object This helps other platforms like Nix that put shared objects in interesting places. --- modules/editor/parinfer/doctor.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/editor/parinfer/doctor.el b/modules/editor/parinfer/doctor.el index 092c982ba..79a9ff950 100644 --- a/modules/editor/parinfer/doctor.el +++ b/modules/editor/parinfer/doctor.el @@ -3,8 +3,5 @@ (unless (fboundp 'module-load) (warn! "Your emacs wasn't built with dynamic modules support. `parinfer-rust-mode' won't work")) (when (and (eq system-type 'berkeley-unix) - (not (file-readable-p (concat user-emacs-directory - ".local/etc/parinfer-rust/libparinfer_rust.so")))) - (warn! (concat "Could not read " user-emacs-directory - ".local/etc/parinfer-rust/libparinfer_rust.so. " - "`parinfer-rust-mode' won't work"))) + (not (file-readable-p parinfer-rust-library))) + (warn! (concat "Could not read " parinfer-rust-library ". `parinfer-rust-mode' won't work")))