{"id":13646512,"url":"https://github.com/DogLooksGood/parinfer-mode","last_synced_at":"2025-04-21T21:30:56.951Z","repository":{"id":54701849,"uuid":"68835090","full_name":"DogLooksGood/parinfer-mode","owner":"DogLooksGood","description":"Parinfer for Emacs :)","archived":true,"fork":false,"pushed_at":"2021-02-04T13:10:15.000Z","size":6946,"stargazers_count":407,"open_issues_count":14,"forks_count":33,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-11-09T20:37:39.353Z","etag":null,"topics":["emacs","lisp","parinfer"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DogLooksGood.png","metadata":{"files":{"readme":"README.org","changelog":"CHANGELOG.org","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-21T16:14:01.000Z","updated_at":"2024-07-03T07:31:27.000Z","dependencies_parsed_at":"2022-08-14T00:30:49.198Z","dependency_job_id":null,"html_url":"https://github.com/DogLooksGood/parinfer-mode","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DogLooksGood%2Fparinfer-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DogLooksGood%2Fparinfer-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DogLooksGood%2Fparinfer-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DogLooksGood%2Fparinfer-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DogLooksGood","download_url":"https://codeload.github.com/DogLooksGood/parinfer-mode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250136640,"owners_count":21380870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","lisp","parinfer"],"created_at":"2024-08-02T01:02:57.782Z","updated_at":"2025-04-21T21:30:56.382Z","avatar_url":"https://github.com/DogLooksGood.png","language":"Emacs Lisp","readme":"#+TITLE: Parinfer Mode\n#+AUTHOR: DogLooksGood\n\n[[https://melpa.org/#/parinfer][file:https://melpa.org/packages/parinfer-badge.svg]] [[https://stable.melpa.org/#/parinfer][file:https://stable.melpa.org/packages/parinfer-badge.svg]]\n\n[[file:images/logo.png]]\n\n* Deprecated \n\nThis project is no longer maintained.I have no success for a fast enough implementation in Emacs Lisp. \n\nFortunately, there's a [[https://github.com/justinbarclay/parinfer-rust-mode][parinfer-rust-mode]]!\n\n* Demo\n[[file:images/demo.gif]]\n\n* Table of contents\n- [[#what-is-parinfer][What Is Parinfer]]\n- [[#installation][Installation]]\n- [[#indent-and-paren-modes][Indent And Paren Modes]]\n- [[#configurations][Configurations]]\n- [[#credits][Credits]]\n- [[#license][License]]\n- [[#contribution][Contribution]]\n\n* What Is Parinfer\n*Parinfer* is a proof-of-concept editor mode for Lisp programming languages.\nIt will infer some changes to keep Parens and Indentation inline with one another.\nParinfer consists of two modes:\n\n- Indent Mode :: Indent Mode gives you full control of indentation, while Parinfer corrects parens.\n- Paren Mode :: Paren Mode gives you full control of parens, while Parinfer corrects indentation.\n\nTo learn more about Parinfer, please take a look at its [[https://shaunlebron.github.io/parinfer/][home page]].\n\nAnd the *parinfer-mode* is the implementation on Emacs with [[https://github.com/oakmac/parinfer-elisp][parinfer-elisp]].\n\n* Installation\nParinfer is available on MELPA(and MELPA Stable) now, I recommend to install with [[https://github.com/jwiegley/use-package][use-package]].\n\nAdd following code to your ~.emacs~ or ~init.el~.\n\n#+BEGIN_SRC elisp\n  (use-package parinfer\n    :ensure t\n    :bind\n    ((\"C-,\" . parinfer-toggle-mode))\n    :init\n    (progn\n      (setq parinfer-extensions\n            '(defaults       ; should be included.\n              pretty-parens  ; different paren styles for different modes.\n              evil           ; If you use Evil.\n              lispy          ; If you use Lispy. With this extension, you should install Lispy and do not enable lispy-mode directly.\n              paredit        ; Introduce some paredit commands.\n              smart-tab      ; C-b \u0026 C-f jump positions and smart shift with tab \u0026 S-tab.\n              smart-yank))   ; Yank behavior depend on mode.\n      (add-hook 'clojure-mode-hook #'parinfer-mode)\n      (add-hook 'emacs-lisp-mode-hook #'parinfer-mode)\n      (add-hook 'common-lisp-mode-hook #'parinfer-mode)\n      (add-hook 'scheme-mode-hook #'parinfer-mode)\n      (add-hook 'lisp-mode-hook #'parinfer-mode)))\n#+END_SRC\n\n* Indent And Paren Modes\nToggle *Indent Mode* and *Paren Mode* with command ~parinfer-toggle-mode~.\n\n** Avoid unexpect buffer changes.\nWhenever you switch to *Indent Mode*, parinfer-mode will correct all parens of current buffer.\n\nAfter opening a file, the parinfer-mode enable *Indent Mode* if it won't make any changes.\nOtherwise, *Paren Mode* will be enabled, you can switch to *Indent Mode* manually later.\n\nAlternatively, you can use ~parinfer-diff~ command to see how will *Indent Mode* modify the buffer with ~Ediff~.\n\n[[file:images/diff_demo.gif]]\n\nAnd there are some keybindings in Ediff:\n| Key  | Description                                               |\n|------+-----------------------------------------------------------|\n| ~q~  | Quit diff.                                                |\n| ~b~  | B-\u003eA in Ediff, this can apply change to your origin code. |\n| ~ra~ | Restore A in Ediff, this can revert change.               |\n| ~n~  | Move to next difference.                                  |\n| ~p~  | Move to previous difference.                              |\n\nAlso, There's a command ~parinfer-auto-fix~ to fix wrong indentation for whole buffer. (Only works with balanced parens)\n\n* Configurations\n** parinfer-auto-switch-indent-mode\n#+BEGIN_SRC emacs-lisp\n  (setq parinfer-auto-switch-indent-mode nil)  ;; default\n#+END_SRC\n\n~t~ for enable, Parinfer will auto switch to *Indent Mode* whenever parens are balance in *Paren Mode*.\n\n** parinfer-auto-switch-indent-mode-when-closing\n#+BEGIN_SRC emacs-lisp\n  (setq parinfer-auto-switch-indent-mode-when-closing nil)  ;; default\n#+END_SRC\n\n~t~ for enable, Parinfer will auto switch to *Indent Mode* when the inserted close parens (~)~, ~]~, ~}~) balance the parens of current sexp.\n** parinfer-delay-invoke-threshold\n#+BEGIN_SRC emacs-lisp\n  (setq parinfer-delay-invoke-threshold 6000)  ;; default\n#+END_SRC\n\nWhen the length of text for processing is longer than this, Parinfer will process text after a idle delay instead of process immediately.\n\n** parinfer-delay-invoke-idle\n#+BEGIN_SRC emacs-lisp\n  (setq parinfer-delay-invoke-idle 0.3)  ;; default\n#+END_SRC\n\nThe idle seconds before Parinfer processing text on large sexp.\n\n** parinfer-extensions\n#+BEGIN_SRC emacs-lisp\n  (setq parinfer-extensions '(defaults pretty-parens smart-yank))\n#+END_SRC\n\nThe extensions that will be enabled. The list could contain followings:\n\n| Extension     | Function                                                                              |\n|---------------+---------------------------------------------------------------------------------------|\n| defaults      | Should be enabled, basic compatibility                                                |\n| pretty-parens | Use dim style for *Indent Mode*, rainbow delimiters for *Paren Mode*                  |\n| smart-yank    | Yank will preserve indentation in *Indent Mode*, will preserve parens in *Paren Mode* |\n| smart-tab     | ~C-f~ \u0026 ~C-b~ on empty line will goto next/previous import indentation.               |\n| paredit       | Introduce some paredit commands from paredit-mode.                                    |\n| lispy         | Integration with Lispy.                                                               |\n| evil          | Integration with Evil.                                                                |\n| one           | Experimental on fuzz *Indent Mode* and *Paren Mode*. Not recommanded.                 |\n\n** parinfer-lighters\n#+BEGIN_SRC emacs-lisp\n  (setq parinfer-lighters '(\" Parinfer:Indent\" . \"Parinfer:Paren\"))\n#+END_SRC\n\n* Troubleshooting\nIf Parinfer seems to be indenting incorrectly, ensure ~indent-tabs-mode~ is set to ~nil~ via ~(setq-default indent-tabs-mode nil)~. While Parinfer's theoretical model is able to correctly handle indentation with tabs, ~parinfer-mode~ can currently only handle indentation using spaces.\n\n* Credits\n- [[https://github.com/shaunlebron][shaunlebron]] :: Create [[https://shaunlebron.github.io/parinfer/][Parinfer]].\n- [[https://github.com/oakmac][oakmac]] :: Bring Parinfer to Emacs with [[https://github.com/oakmac/parinfer-elisp][parinfer-elisp]].\n- [[https://github.com/tumashu][tumashu]] :: Help me a lot in writing this plugin.\n- [[https://github.com/purcell][purcell]] \u0026 [[https://github.com/syohex][syohex]] :: Advice and Tips for writing emacs plugin\n\n* Contribution\nPlease open an issue if there's any bug or suggestion, and PR is welcomed!\n\n* License\nparinferlib.el from [[https://github.com/oakmac/parinfer-elisp][parinfer-elisp]], is licensed under the [[https://github.com/oakmac/parinfer-elisp/blob/master/LICENSE.md][ISC]].\n\nRest part licensed under the GPLv3.\n","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDogLooksGood%2Fparinfer-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDogLooksGood%2Fparinfer-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDogLooksGood%2Fparinfer-mode/lists"}