{"id":14235413,"url":"https://github.com/python-rope/ropemacs","last_synced_at":"2025-08-11T00:31:21.687Z","repository":{"id":12235950,"uuid":"14847281","full_name":"python-rope/ropemacs","owner":"python-rope","description":"emacs mode that uses rope library to provide features like python refactorings and code-assists","archived":false,"fork":false,"pushed_at":"2023-02-20T01:50:05.000Z","size":424,"stargazers_count":133,"open_issues_count":10,"forks_count":26,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-07-03T00:55:16.373Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-rope.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-01T22:15:11.000Z","updated_at":"2025-01-01T16:30:55.000Z","dependencies_parsed_at":"2024-12-13T01:30:20.755Z","dependency_job_id":"ce1e7401-c6f5-40ef-85c3-c8e99ccb4e76","html_url":"https://github.com/python-rope/ropemacs","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/python-rope/ropemacs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropemacs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropemacs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropemacs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropemacs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-rope","download_url":"https://codeload.github.com/python-rope/ropemacs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropemacs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269813534,"owners_count":24479340,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-20T21:01:54.077Z","updated_at":"2025-08-11T00:31:21.341Z","avatar_url":"https://github.com/python-rope.png","language":"Python","readme":".. csv-table::\n\n   \"❗If you are using ropemacs, consider using `pylsp-rope`_ in Emacs.\"\n\n.. _pylsp-rope: https://github.com/python-rope/pylsp-rope\n\n**This project is quite definitively free for adoption. Anybody who actually cares for Emacs, please, take this over from my hands. Thank you!**\n\n\n=========================\n ropemacs, rope in emacs\n=========================\n\nRopemacs is an emacs mode that uses rope_ library to provide features\nlike python refactorings and code-assists.  You should install pymacs_ before using ropemacs.\n\n.. _rope: https://github.com/python-rope/rope/\n.. _pymacs: https://github.com/dgentry/Pymacs\n\n\nNew Features\n============\n\n``rope-find-occurrences`` sets ``next-error-function``.  That means\ncompilation mode keys like ``C-x \\``` work for occurrences buffer,\ntoo.\n\nAlso there is a bug in pymacs 23 and 24-beta1 that makes python reach\nmaximum recursion after interrupting a pymacs command; a patch is\nincluded in the docs folder.\n\n\nSetting Up\n==========\n\nInstall latest version of ropemacs::\n\n  python -m pip install --user --editable \"git+https://github.com/python-rope/ropemacs.git#egg=ropemacs\"\n\nAfter installing pymacs, add these lines to your ``~/.emacs`` file::\n\n  (require 'pymacs)\n  (pymacs-load \"ropemacs\" \"rope-\")\n\nAlso note that ropemacs may redefine some standard Emacs and your custom key\nbindings.  To prevent this, put the following example lines to your\n``~/.emacs`` *before* the lines presented above::\n\n  (setq ropemacs-enable-shortcuts nil)\n  (setq ropemacs-local-prefix \"C-c C-p\")\n\nSee keybinding_ and variables_ sections for more details.\n\nLoading Lazily\n--------------\n\nIf you want to load ropemacs only when you really need it, you can use\na function like this in your ``~/.emacs``::\n\n  (defun load-ropemacs ()\n    \"Load pymacs and ropemacs\"\n    (interactive)\n    (require 'pymacs)\n    (pymacs-load \"ropemacs\" \"rope-\")\n    ;; Automatically save project python buffers before refactorings\n    (setq ropemacs-confirm-saving 'nil)\n  )\n  (global-set-key \"\\C-xpl\" 'load-ropemacs)\n\nAnd execute ``load-ropemacs`` (or use ``C-x p l``) whenever you want\nto use ropemacs.\n\n\nNot Installing\n--------------\n\nIf you don't want to install rope library and ropemacs you can extract\nthem somewhere and add these lines to your ``.emacs``::\n\n  ;; Add this before loading pymacs if you haven't installed rope and ropemacs\n  (setq pymacs-load-path '(\"/path/to/rope\"\n                           \"/path/to/ropemacs\"))\n\n\nMultiple Python Versions\n------------------------\n\nRope needs at least Python2.5.  If you have older versions of Python\nyou can use ``PYMACS_PYTHON`` environment variable.  You can add::\n\n  (setenv \"PYMACS_PYTHON\" \"python2.5\")\n\nto force pymacs to use Python2.5.\n\n\nRopemacs Minor Mode\n-------------------\n\nRopemacs registers its local keys when ``ropemacs-mode`` is enabled.\nBy default it is enabled using ``python-mode`` hook (this hook is\navailable if you are using Emacs' ``python.el`` or XEmacs'\n``python-mode.el``).  If you want to enable it in other major modes\neither execute ``ropemacs-mode`` manually or call it in some other\nhook.\n\n\nGetting Started\n===============\n\nRefactoring Dialog\n------------------\n\nRopemacs refactorings use a special kind of dialog.  When you start a\nrefactoring, you'll be asked to confirm saving modified python\nbuffers; you can change it by using ``ropemacs-confirm-saving``\nvariable.  Adding ``(setq ropemacs-confirm-saving 'nil)`` to your\n``.emacs`` file, will make emacs save them without asking.\n\nAfter that depending on the refactoring, you'll be asked about the\nessential information a refactoring needs to know (like the new name\nin rename refactoring).  You can skip it by prefixing the refactoring;\nthis can be useful when using batchset command (described later).\n\nNext you'll see the base prompt of a refactoring dialog that shows\nsomething like \"Choose what to do\".  By entering the name of a\nrefactoring option you can set its value.  After setting each option\nyou'll be returned back to the base prompt.  Finally, you can ask rope\nto perform, preview or cancel the refactoring.\n\nSee keybinding_ section and try the refactorings yourself.\n\n\nFinding Files\n-------------\n\nBy using ``rope-find-file`` (``C-x p f`` by default), you can search\nfor files in your project.  When you complete the minibuffer you'll\nsee all files in the project; files are shown as their reversed paths.\nFor instance ``projectroot/docs/todo.txt`` is shown like\n``todo.txt\u003cdocs``.  This way you can find files faster in your\nproject.  ``rope-find-file-other-window`` (``C-x p 4 f``) opens the\nfile in the other window.  With prefix, these commands show python\nfiles only.\n\n\nCode-Assist\n-----------\n\nRopemacs integrates with ``completion-at-point`` (``C-M-i`` by\ndefault). Called once, it will insert the common prefix.  Called twice,\nit will pop up a buffer with all available completions.\n\n``rope-code-assist`` command (``M-/`` by default) will let you select\nfrom a list of completions.  If prefixed (``C-u M-/``), ropemacs\ninserts the common prefix, automatically.  If a numeric argument is\ngiven, ropemacs will insert the common prefix for that many of the\nfirst proposals.\n\n``rope-lucky-assist`` command (``M-?``) does not ask anything;\ninstead, it inserts the first proposal.  By prefixing it, you can\nchoose which proposal to insert.  ``C-u 1 M-?`` uses the second\npropsal, for instance.\n\nHere::\n\n  xxaa = None\n  xxab = None\n  xxba = None\n  xxbb = None\n\n  x^\n\nconsider cursor is at ``^`` position.  This table shows what happens\nwhen code-assist commands are used:\n\n============  ==========  =======================\nKey           Inserts     Minibuffer Completions\n============  ==========  =======================\nM-/                       xxaa, xxab, xxba, xxbb\nC-u M-/       x           xxaa, xxab, xxba, xxbb\nC-u 2 M-/     xa          xxaa, xxab\nM-?           xaa\nC-u 1 M-/     xab\nC-u 3 M-/     xbb\n============  ==========  =======================\n\nNote that minibuffer completions are shown by pressing tab key at the\ncompletion prompt.  Also you can use ``rope-completions`` lisp function\nto get the list of completions.\n\n\nFinding Occurrences\n-------------------\n\nThe find occurrences command (``C-c f`` by default) can be used to\nfind the occurrences of a python name.  If ``unsure`` option is\n``yes``, it will also show unsure occurrences; unsure occurrences are\nindicated with a ``?`` mark in the end.\n\n\nDialog ``batchset`` Command\n---------------------------\n\nWhen you use ropemacs dialogs there is a command called ``batchset``.\nIt can set many options at the same time.  After selecting this\ncommand from dialog base prompt, you are asked to enter a string.\n\n``batchset`` strings can set the value of configs in two ways.  The\nsingle line form is like this::\n\n  name1 value1\n  name2 value2\n\nThat is the name of config is followed its value.  For multi-line\nvalues you can use::\n\n  name1\n   line1\n   line2\n\n  name2\n   line3\n\nEach line of the definition should start with a space or a tab.  Note\nthat blank lines before the name of config definitions are ignored.\n\n``batchset`` command is useful when performing refactorings with long\nconfigs, like restructurings::\n\n  pattern ${pycore}.create_module(${project}.root, ${name})\n\n  goal generate.create_module(${project}, ${name})\n\n  imports\n   from rope.contrib import generate\n\n  args\n   pycore: type=rope.base.pycore.PyCore\n   project: type=rope.base.project.Project\n\n.. ignore the two-space indents\n\nThis is a valid ``batchset`` string for restructurings.  When using\nbatchset, you usually want to skip initial questions.  That can be\ndone by prefixing refactorings.\n\nJust for the sake of completeness, the reverse of the above\nrestructuring can be::\n\n  pattern ${create_module}(${project}, ${name})\n\n  goal ${project}.pycore.create_module(${project}.root, ${name})\n\n  args\n   create_module: name=rope.contrib.generate.create_module\n   project: type=rope.base.project.Project\n\n\nEnabling Autoimport\n-------------------\n\nRopemacs can propose and automatically import global names in other\nmodules.  But this feature is disabled by default.  Before using it,\nyou should add::\n\n  (setq ropemacs-enable-autoimport 't)\n\nto your ``~/.emacs`` file.  After enabling, rope maintains a cache of\nglobal names for each project.  It updates the cache only when modules\nare changed; if you want to cache all your modules at once, use\n``rope-generate-autoimport-cache``.  It will cache all of the modules\ninside the project plus those whose names are listed in\n``ropemacs-autoimport-modules`` list::\n\n  # add the name of modules you want to autoimport\n  (setq ropemacs-autoimport-modules '(\"os\" \"shutil\"))\n\nNow if you are in a buffer that contains::\n\n  rmtree\n\nand you execute ``ropemacs-auto-import`` you'll end up with::\n\n  from shutil import rmtree\n  rmtree\n\nAlso ``rope-code-assist`` and ``rope-lucky-assist`` propose\nauto-imported names by using ``name : module`` style.  Selecting them\nwill import the module automatically.\n\n\nFiltering Resources\n-------------------\n\nSome refactorings, restructuring and find occurrences take an option\ncalled resources.  This option can be used to limit the resources on\nwhich a refactoring should be applied.\n\nIt uses a simple format: each line starts with either '+' or '-'.\nEach '+' means include the file (or its children if it's a folder)\nthat comes after it.  '-' has the same meaning for exclusion.  So\nusing::\n\n  +rope\n  +ropetest\n  -rope/contrib\n\nmeans include all python files inside ``rope`` and ``ropetest``\nfolders and their subfolder, but those that are in ``rope/contrib``.\nOr::\n\n  -ropetest\n  -setup.py\n\nmeans include all python files inside the project but ``setup.py`` and\nthose under ``ropetest`` folder.\n\n\nVariables\n---------\n\n* ``ropemacs-confirm-saving``: If non-nil, you have to confirm saving all\n  modified python files before refactorings; otherwise they are saved\n  automatically. Defaults to ``t``.\n* ``ropemacs-codeassist-maxfixes``: The maximum number of syntax errors\n  to fix for code assists.  The default value is ``1``.\n* ``ropemacs-separate-doc-buffer``: Should ``rope-show-doc`` use a\n  separate buffer or the minibuffer.  Defaults to ``t``.\n* ``ropemacs-guess-project``: If non-nil, ropemacs tries to guess and\n  open the project that contains the file on which a rope command is\n  performed when no project is already opened.\n\n* ``ropemacs-enable-autoimport``: Shows whether to enable autoimport.\n  Defaults to ``nil``.\n* ``ropemacs-autoimport-modules``: The name of modules whose global\n  names should be cached.  ``rope-generate-autoimport-cache`` reads\n  this list and fills its cache.\n* ``ropemacs-autoimport-underlineds``: If set, autoimport will cache\n  names starting with underlines, too.\n\nThese variables change the keybinding.  They should be set before\nloading ropemacs.\n\n* ``ropemacs-local-prefix``: The prefix for ropemacs refactorings.\n  Defaults to ``C-c r``.\n* ``ropemacs-global-prefix``: The prefix for ropemacs project commands\n  Defaults to ``C-x p``.\n* ``ropemacs-enable-shortcuts``: Shows whether to bind ropemacs\n  shortcuts keys.  Defaults to ``t``.\n\n\nKeybinding\n----------\n\nUses almost the same keybinding as ropeide.  Note that global commands\nhave a ``C-x p`` prefix and local commands have a ``C-c r`` prefix.\nYou can change that (see variables_ section).\n\n================  ============================\nKey               Command\n================  ============================\nC-x p o           rope-open-project\nC-x p k           rope-close-project\nC-x p f           rope-find-file\nC-x p 4 f         rope-find-file-other-window\nC-x p u           rope-undo\nC-x p r           rope-redo\nC-x p c           rope-project-config\nC-x p n [mpfd]    rope-create-(module|package|file|directory)\n\\                 rope-write-project\n\\\nC-c r r           rope-rename\nC-c r l           rope-extract-variable\nC-c r m           rope-extract-method\nC-c r i           rope-inline\nC-c r v           rope-move\nC-c r x           rope-restructure\nC-c r u           rope-use-function\nC-c r f           rope-introduce-factory\nC-c r s           rope-change-signature\nC-c r 1 r         rope-rename-current-module\nC-c r 1 v         rope-move-current-module\nC-c r 1 p         rope-module-to-package\n\\\nC-c r o           rope-organize-imports\nC-c r n [vfcmp]   rope-generate-(variable|function|class|module|package)\n\\\nC-c r a /         rope-code-assist\nC-c r a g         rope-goto-definition\nC-c r a d         rope-show-doc\nC-c r a f         rope-find-occurrences\nC-c r a ?         rope-lucky-assist\nC-c r a j         rope-jump-to-global\nC-c r a c         rope-show-calltip\n\\                 rope-analyze-module\n\\\n\\                 rope-auto-import\n\\                 rope-generate-autoimport-cache\n================  ============================\n\n\nShortcuts\n---------\n\nSome commands are used very frequently; specially the commands in\ncode-assist group.  You can define your own shortcuts like this::\n\n  (define-key ropemacs-local-keymap \"\\C-cg\" 'rope-goto-definition)\n\nRopemacs itself comes with a few shortcuts:\n\n================  ============================\nKey               Command\n================  ============================\nM-/               rope-code-assist\nM-?               rope-lucky-assist\nC-c g             rope-goto-definition\nC-c d             rope-show-doc\nC-c f             rope-find-occurrences\n================  ============================\n\nThese shortcuts will be used only when ropemacs-enable-shortcuts is\nnon-nil (it is enabled by default).  Note that in order to disable these\nshortcuts, the value of ropemacs-enable-shortcuts should be set *before*\nloading ropemacs::\n\n  (setq ropemacs-enable-shortcuts 'nil)\n\n\nContributing\n============\n\nSend your bug reports, feature requests and patches to `ropemacs Github \nIssue Tracker`_ or `rope Github Discussions`_\n\n.. _`ropemacs Github Issue Tracker`: https://github.com/python-rope/ropemacs/issues\n.. _`rope Github Discussions`: https://github.com/python-rope/rope/discussions\n\nLicense\n=======\n\nThis program is under the terms of GPL (GNU General Public License).\nHave a look at ``COPYING`` file for more information.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-rope%2Fropemacs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-rope%2Fropemacs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-rope%2Fropemacs/lists"}