{"id":13646454,"url":"https://github.com/Wilfred/emacs-refactor","last_synced_at":"2025-04-21T18:31:02.874Z","repository":{"id":7845510,"uuid":"9217256","full_name":"Wilfred/emacs-refactor","owner":"Wilfred","description":"language-specific refactoring in Emacs","archived":false,"fork":false,"pushed_at":"2023-01-29T05:54:44.000Z","size":506,"stargazers_count":349,"open_issues_count":22,"forks_count":27,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-06T01:11:20.203Z","etag":null,"topics":["emacs","lisp","refactoring"],"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/Wilfred.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-04T12:05:51.000Z","updated_at":"2025-02-16T06:15:25.000Z","dependencies_parsed_at":"2023-02-15T21:00:38.345Z","dependency_job_id":null,"html_url":"https://github.com/Wilfred/emacs-refactor","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wilfred%2Femacs-refactor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wilfred%2Femacs-refactor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wilfred%2Femacs-refactor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wilfred%2Femacs-refactor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wilfred","download_url":"https://codeload.github.com/Wilfred/emacs-refactor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250110856,"owners_count":21376545,"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","refactoring"],"created_at":"2024-08-02T01:02:56.144Z","updated_at":"2025-04-21T18:31:02.624Z","avatar_url":"https://github.com/Wilfred.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"# emacs-refactor\n\n[![Coverage Status](https://coveralls.io/repos/Wilfred/emacs-refactor/badge.svg)](https://coveralls.io/r/Wilfred/emacs-refactor)\n[![MELPA](http://melpa.org/packages/emr-badge.svg)](http://melpa.org/#/emr)\n[![MELPA stable](http://stable.melpa.org/packages/emr-badge.svg)](http://stable.melpa.org/#/emr)\n\nEmacs Refactor (EMR) is a framework for providing language-specific\nrefactoring in Emacs. It includes refactoring commands for a variety\nof languages, including elisp itself!\n\n- [Summary](#user-content-summary)\n- [Installation](#user-content-installation)\n- [Language support](#user-content-language-support)\n    - [General](#user-content-general)\n    - [C](#user-content-c)\n    - [Lisps](#user-content-lisps)\n    - [Elisp](#user-content-elisp)\n    - [JavaScript](#user-content-javascript)\n    - [Ruby](#user-content-ruby)\n    - [Scheme](#user-content-scheme)\n- [Extension](#user-content-extension)\n\n## Summary\n\nTo use EMR when editing, simply move point to an expression and \n`M-x emr-show-refactor-menu`.\n\n![Example][example-pic]\n\nEMR ships with many refactoring commands, and pull requests for extensions are\nwelcome. See [Extension](#user-content-extension) for details on extending EMR\nto other language modes. It's easy (honest!).\n\n## Installation\n\nInstall `emr` from [MELPA](http://www.melpa.org/), then configure your\ninit.el:\n\n```emacs-lisp\n(define-key prog-mode-map (kbd \"M-RET\") 'emr-show-refactor-menu)\n```\n\n## Language support\n\nMost EMR commands are context-sensitive and are available through the\nrefactor menu. Some actions affect the whole buffer and are available in\nthe menu bar.\n\n### General\n\nThese commands are available for all programming languages.\n\nThe following context-sensitive refactoring commands are available:\n\n* *comment region*\n* *uncomment region*\n\n### C\n\nThe following context-sensitive refactoring commands are available:\n\n* *tidy includes*\n\nThe following buffer-wide actions are available:\n\n* *insert include*\n\nRefactoring support for C is a work in progress. Contributions are welcome.\n\n### Lisps\n\nThese commands are available to all Lisp dialects, including Clojure, Elisp\nand Common Lisp.\n\nThe following context-sensitive refactoring commands are available:\n\n* *comment form*\n* *uncomment block*\n\n### Elisp\n\nThe following context-sensitive refactoring commands are available:\n\n* *delete unused definition*\n* *delete unused let binding form*\n* *eval and replace*\n* *extract autoload*\n* *extract constant*\n* *extract function*\n* *extract to let*\n* *extract variable*\n* *implement function*\n* *inline function*\n* *inline let variable*\n* *inline variable*\n* *insert autoload directive*\n* *tidy autoloads*\n\nThe following buffer-wide actions are available:\n\n* *find unused definitions*\n\n### JavaScript\n\nJavaScript refactoring support requires [js2 refactor][].\n\nThe following refactoring commands are available:\n\n* *extract function*\n* *extract method*\n* *extract variable*\n* *add parameter*\n* *local variable to instance variable*\n* *log region*\n\n### Ruby\n\nRuby refactoring support requires [ruby refactor][].\n\nThe following refactoring commands are available:\n\n* *extract function*\n* *extract variable*\n* *extract constant*\n* *add parameter*\n* *extract to let*\n\n### Scheme\n\nThe following refactoring commands are available:\n\n* *extract function*\n* *extract variable*\n\n## Extension\n\nUse the `emr-declare-command` function to declare a refactoring action. The\naction will automatically become available in the refactoring popup menu.\n\nThis function supports predicate expressions, allowing the options displayed to\nbe context-sensitive.\n\nAs an example, here is the declaration for a refactoring command that ships with\nEMR:\n\n```lisp\n(emr-declare-command 'emr-el-extract-constant\n  :title \"constant\"\n  :description \"defconst\"\n  :modes 'emacs-lisp-mode\n  :predicate (lambda ()\n               (not (or (emr-el:looking-at-definition?)\n                        (emr-el:looking-at-let-binding-symbol?)))))\n```\n\nThis wires the `emr-el-extract-constant` function to be displayed in\n`emacs-lisp-mode`, provided point is not looking at an Elisp definition or\nlet-binding form.\n\nIf your favourite language mode already offers refactoring commands, it is\nsimple to wire them up with EMR using this interface.\n\n[example-pic]: https://raw.github.com/Wilfred/emacs-refactor/master/assets/emr.png\n[js2 refactor]: https://github.com/magnars/js2-refactor.el\n[ruby refactor]: https://github.com/ajvargo/ruby-refactor\n[git]: http://git-scm.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWilfred%2Femacs-refactor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWilfred%2Femacs-refactor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWilfred%2Femacs-refactor/lists"}