ropemacs-0.7/0000755000175000001440000000000011755012033013762 5ustar generalusers00000000000000ropemacs-0.7/MANIFEST.in0000644000175000001440000000027111533667556015544 0ustar generalusers00000000000000include README.txt COPYING setup.py MANIFEST.in CONTRIBUTORS recursive-include ropemacs *.py recursive-include ropemode *.py recursive-include docs *.txt recursive-include docs *.patch ropemacs-0.7/docs/0000755000175000001440000000000011755012033014712 5ustar generalusers00000000000000ropemacs-0.7/docs/todo.txt0000644000175000001440000000021511533667556016442 0ustar generalusers00000000000000TODO ==== > Public Release 1.0 > Public Release 0.6 * saving the old values of refactoring configs * showing proposal type in code-assist ropemacs-0.7/docs/pymacs_signalrecursion.patch0000644000175000001440000000214111533667556022540 0ustar generalusers00000000000000# It can be applied on Pymacs 0.23 or 0.24-beta1. The problem is # signal.signal() is called twice for signal.SIGINT. You can use # ``patch -p1 < signal_recursion.patch`` in the extracted directory. --- a/Pymacs/pymacs.py +++ b/Pymacs/pymacs.py @@ -69,20 +69,6 @@ import signal self.original_handler = signal.signal( signal.SIGINT, self.interrupt_handler) - for counter in range(1, signal.NSIG): - if counter == signal.SIGINT: - self.original_handler = signal.signal(counter, - self.interrupt_handler) - - # The following few lines of code are reported to create IO - # problems within the Pymacs helper itself, so I merely comment - # them for now, until we know better. - - #else: - # try: - # signal.signal(counter, self.generic_handler) - # except RuntimeError: - # pass self.inhibit_quit = True # Start protocol and services. from Pymacs import __version__ ropemacs-0.7/docs/ropemacs.txt0000644000175000001440000000352411533667556017314 0ustar generalusers00000000000000========================= ropemacs, rope in emacs ========================= Ropemacs is a plugin for performing python refactorings in emacs. It uses rope_ library and pymacs_. You should install `rope`_ library and pymacs_ before using ropemacs. You can download ropemacs from `project download page`_. .. _rope: http://rope.sf.net/ Features ======== * Supports many of the refactorings that are supported by rope_ library: * Rename * Extract method/local variable * Move class/function/module/package/method * Inline method/local variable/parameter * Restructuring * Change signature * ... * Other refactoring-related features * Previewing refactorings * Undo/redo refactorings * Showing refactoring progress * Code-assists * Code-completion * Goto definition * Show pydoc * Find occurrences * Organize imports (remove unused and duplicate imports and sort them) * Generating python elements Source Repository ================= The repository version needs ropemode (which was once part of ropemacs); in order to use the repository version of ropemacs you need to put ropemode in your ``PYTHONPATH``. Note that ropemode is included in released packages. Ropemacs: * repo url: http://bitbucket.org/agr/ropemacs * snapshot: http://bitbucket.org/agr/ropemacs/get/tip.gz Ropemode: * repo url: http://bitbucket.org/agr/ropemode * snapshot: http://bitbucket.org/agr/ropemode/get/tip.gz Feedback ======== Send your bug reports, feature requests and patches to `rope-dev (at) googlegroups.com`_. License ======= Ropemacs is under the terms of GNU GPL (GNU General Public License). .. _project download page: http://sf.net/projects/rope/files .. _`rope-dev (at) googlegroups.com`: http://groups.google.com/group/rope-dev .. _pymacs: http://pymacs.progiciels-bpi.ca/pymacs.html .. _Mercurial: http://selenic.com/mercurial ropemacs-0.7/docs/done.txt0000644000175000001440000001062511533667556016430 0ustar generalusers00000000000000====== Done ====== > Public Release 0.6 : October 3, 2008 - include a patch for pymacs signal bug : October 3, 2008 - set next-error-function : July 16, 2008 > Public Release 0.6c2 : June 20, 2008 - fixed go to occurrence in xemacs : June 20, 2008 - added ropemacs-guess-project variable : June 18, 2008 - fixed error messages that contain percent sign : June 18, 2008 - fixed ask directory and entering default directory : June 9, 2008 - added rope-run-module command : May 24, 2008 - showing line-number in occurrences buffer : May 19, 2008 > Public Release 0.6c1 : May 10, 2008 - supporting inlining parameters : May 10, 2008 - added rope-change-signature : May 9, 2008 - added ropemacs-autoimport-underlineds variable : May 7, 2008 - added rope-find-implementations : April 28, 2008 - added rope-show-calltip : April 12, 2008 - added rope-analyze-modules : April 12, 2008 > Public Release 0.5 : April 5, 2008 - better input error reporting : March 27, 2008 - added ropemacs-completing-read-function variable : March 17, 2008 - added rope-jump-to-global : March 17, 2008 > Public Release 0.5c6 : March 15, 2008 - added rope-analyze-module command : March 15, 2008 - supporting in_hierarchy option of find_occurrences : March 10, 2008 - added ropemacs-max-doc-buffer-height variable : March 7, 2008 - added ropemacs menu : March 7, 2008 - added rope-show-call-doc command : March 6, 2008 - added ropemacs-separate-doc-buffer variable : March 6, 2008 - supporting maxfixes option of rope-goto-definition : March 6, 2008 - supporting maxfixes option of rope-show-doc : March 6, 2008 - added ropemacs minor mode : March 1, 2008 > Public Release 0.5c5 : March 1, 2008 - filtering resources : February 29, 2008 - added support for introduce factory refactoring : February 25, 2008 > Public Release 0.5c4 : February 16, 2008 - compatibility with pymacs : February 14, 2008 - faster code-assists : February 7, 2008 - prefixing rope-find-file shows only python files : February 2, 2008 - merged rope-complete-and-import with code-assist : January 28, 2008 > Public Release 0.5c3 : January 28, 2008 - added support for autoimport : January 26, 2008 - added introduce method object refactoring : January 25, 2008 - added use function refactoring : January 25, 2008 > Public Release 0.5c2 : January 17, 2008 - showing change description in undo/redo : January 8, 2008 - added rope-find-file-other-window : January 4, 2008 - added ropemacs-enable-shortcuts variable : January 3, 2008 > Public Release 0.5c1 : January 3, 2008 - deprecated rope-code-assist-max-fixes : December 28, 2007 - deprecated rope-confirm-saving : December 28, 2007 - added ropemacs-local-prefix and ropemacs-global-prefix : December 28, 2007 - handling narrowed regions : December 21, 2007 > Public Release 0.4 : December 19, 2007 - supporting emacs 21 : December 18, 2007 - added ``rope-code-assist-max-fixes`` variable : December 17, 2007 - printing traceback when task runner gets interrupted : December 14, 2007 - supporting ``only_current`` option for inline refactoring : December 13, 2007 - supporting ``global_`` option for extract refactorings : December 13, 2007 - not raising exceptions in hooks : December 5, 2007 > Public Release 0.3 : December 5, 2007 - setting many configs using batchset in dialogs : December 1, 2007 - updating buffers with moved files : December 1, 2007 - showing the old value of a field in dialogs : November 30, 2007 - new file/directory/module/package; ``C-x p n [fdmp]`` : November 30, 2007 - lucky-assist; ``M-?`` : November 29, 2007 - find occurrences; ``C-c f`` : November 29, 2007 - edit project config; ``C-x p c`` : November 28, 2007 > Public Release 0.2 : November 28, 2007 - previewing changes : November 27, 2007 - specifying refactoring options : November 26, 2007 - restructuring support : November 26, 2007 - added ``rope-confirm-saving`` variable : November 26, 2007 - only activating local keys in python mode : November 26, 2007 - find file and advanced matching : November 25, 2007 - generate python element; ``C-c n [vfcmp]`` : November 23, 2007 - rope find file; ``C-c p f`` : November 23, 2007 - code-assist; ``M-/`` : November 23, 2007 > Public Release 0.1 : September 9, 2007 - moving elements, methods and modules : October 30, 2007 - undoing refactorings : October 29, 2007 - inline refactoring : October 29, 2007 - extract method and local variable : October 29, 2007 - goto definition : October 29, 2007 - rename refactoring : October 29, 2007 ropemacs-0.7/CONTRIBUTORS0000644000175000001440000000022311533667556015663 0ustar generalusers00000000000000======================= Ropemacs Contributors ======================= * Sebastjan Trepca * Stefan Reichoer ropemacs-0.7/ropemacs.egg-info/0000755000175000001440000000000011755012033017265 5ustar generalusers00000000000000ropemacs-0.7/ropemacs.egg-info/PKG-INFO0000644000175000001440000000322111755012033020360 0ustar generalusers00000000000000Metadata-Version: 1.1 Name: ropemacs Version: 0.7 Summary: An emacs mode for using rope python refactoring library Home-page: http://rope.sf.net/ropemacs.html Author: Ali Gholami Rudi Author-email: aligrudi@users.sourceforge.net License: GNU GPL Description: ========================= ropemacs, rope in emacs ========================= Ropemacs is an emacs mode that uses rope_ library to provide features like python refactorings and code-assists. You should install rope_ library and pymacs_ before using ropemacs. .. _rope: http://rope.sf.net/ .. _pymacs: http://pymacs.progiciels-bpi.ca/pymacs.html New Features ============ ``rope-find-occurrences`` sets ``next-error-function``. That means compilation mode keys like ``C-x \``` work for occurrences buffer, too. Also there is a bug in pymacs 23 and 24-beta1 that makes python reach maximum recursion after interrupting a pymacs command; a patch is included in the docs folder. Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Operating System :: OS Independent Classifier: Environment :: X11 Applications Classifier: Environment :: Win32 (MS Windows) Classifier: Environment :: MacOS X Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU General Public License (GPL) Classifier: Natural Language :: English Classifier: Programming Language :: Python Classifier: Topic :: Text Editors :: Emacs Classifier: Topic :: Software Development Requires: ropemode ropemacs-0.7/ropemacs.egg-info/requires.txt0000644000175000001440000000003511755012033021663 0ustar generalusers00000000000000rope >= 0.9.4 ropemode >= 0.2ropemacs-0.7/ropemacs.egg-info/dependency_links.txt0000644000175000001440000000000111755012033023333 0ustar generalusers00000000000000 ropemacs-0.7/ropemacs.egg-info/SOURCES.txt0000644000175000001440000000047011755012033021152 0ustar generalusers00000000000000CONTRIBUTORS COPYING MANIFEST.in README.txt setup.py docs/done.txt docs/pymacs_signalrecursion.patch docs/ropemacs.txt docs/todo.txt ropemacs/__init__.py ropemacs.egg-info/PKG-INFO ropemacs.egg-info/SOURCES.txt ropemacs.egg-info/dependency_links.txt ropemacs.egg-info/requires.txt ropemacs.egg-info/top_level.txtropemacs-0.7/ropemacs.egg-info/top_level.txt0000644000175000001440000000001111755012033022007 0ustar generalusers00000000000000ropemacs ropemacs-0.7/COPYING0000644000175000001440000004310311533667556015042 0ustar generalusers00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. ropemacs-0.7/README.txt0000644000175000001440000003220511755011726015472 0ustar generalusers00000000000000========================= ropemacs, rope in emacs ========================= Ropemacs is an emacs mode that uses rope_ library to provide features like python refactorings and code-assists. You should install rope_ library and pymacs_ before using ropemacs. .. _rope: http://rope.sf.net/ .. _pymacs: http://pymacs.progiciels-bpi.ca/pymacs.html New Features ============ ``rope-find-occurrences`` sets ``next-error-function``. That means compilation mode keys like ``C-x \``` work for occurrences buffer, too. Also there is a bug in pymacs 23 and 24-beta1 that makes python reach maximum recursion after interrupting a pymacs command; a patch is included in the docs folder. Setting Up ========== After installing pymacs, add these lines to your ``~/.emacs`` file:: (require 'pymacs) (pymacs-load "ropemacs" "rope-") Note that rope and ropemacs should be in your ``PYTHONPATH`` for this to work. Also note that ropemacs may redefine some standard Emacs and your custom key bindings. To prevent this, put the following example lines to your ``~/.emacs`` *before* the lines presented above: (setq ropemacs-enable-shortcuts nil) (setq ropemacs-local-prefix "C-c C-p") See keybinding_ and variables_ sections for more details. Loading Lazily -------------- If you want to load ropemacs only when you really need it, you can use a function like this in your ``~/.emacs``:: (defun load-ropemacs () "Load pymacs and ropemacs" (interactive) (require 'pymacs) (pymacs-load "ropemacs" "rope-") ;; Automatically save project python buffers before refactorings (setq ropemacs-confirm-saving 'nil) ) (global-set-key "\C-xpl" 'load-ropemacs) And execute ``load-ropemacs`` (or use ``C-x p l``) whenever you want to use ropemacs. Not Installing -------------- If you don't want to install rope library and ropemacs you can extract them somewhere and add these lines to your ``.emacs``:: ;; Add this before loading pymacs if you haven't installed rope and ropemacs (setq pymacs-load-path '("/path/to/rope" "/path/to/ropemacs")) Multiple Python Versions ------------------------ Rope needs at least Python2.5. If you have older versions of Python you can use ``PYMACS_PYTHON`` environment variable. You can add:: (setenv "PYMACS_PYTHON" "python2.5") to force pymacs to use Python2.5. Ropemacs Minor Mode ------------------- Ropemacs registers its local keys when ``ropemacs-mode`` is enabled. By default it is enabled using ``python-mode`` hook (this hook is available if you are using Emacs' ``python.el`` or XEmacs' ``python-mode.el``). If you want to enable it in other major modes either execute ``ropemacs-mode`` manually or call it in some other hook. Getting Started =============== Refactoring Dialog ------------------ Ropemacs refactorings use a special kind of dialog. When you start a refactoring, you'll be asked to confirm saving modified python buffers; you can change it by using ``ropemacs-confirm-saving`` variable. Adding ``(setq ropemacs-confirm-saving 'nil)`` to your ``.emacs`` file, will make emacs save them without asking. After that depending on the refactoring, you'll be asked about the essential information a refactoring needs to know (like the new name in rename refactoring). You can skip it by prefixing the refactoring; this can be useful when using batchset command (described later). Next you'll see the base prompt of a refactoring dialog that shows something like "Choose what to do". By entering the name of a refactoring option you can set its value. After setting each option you'll be returned back to the base prompt. Finally, you can ask rope to perform, preview or cancel the refactoring. See keybinding_ section and try the refactorings yourself. Finding Files ------------- By using ``rope-find-file`` (``C-x p f`` by default), you can search for files in your project. When you complete the minibuffer you'll see all files in the project; files are shown as their reversed paths. For instance ``projectroot/docs/todo.txt`` is shown like ``todo.txt= 0.9.4', 'ropemode >= 0.2'] except ImportError: from distutils.core import setup classifiers=[ 'Development Status :: 4 - Beta', 'Operating System :: OS Independent', 'Environment :: X11 Applications', 'Environment :: Win32 (MS Windows)', 'Environment :: MacOS X', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Natural Language :: English', 'Programming Language :: Python', 'Topic :: Text Editors :: Emacs', 'Topic :: Software Development'] def get_long_description(): lines = open('README.txt').read().splitlines(False) end = lines.index('Setting Up') return '\n' + '\n'.join(lines[:end]) + '\n' setup(name='ropemacs', version='0.7', description='An emacs mode for using rope python refactoring library', long_description=get_long_description(), packages=['ropemacs'], author='Ali Gholami Rudi', author_email='aligrudi@users.sourceforge.net', url='http://rope.sf.net/ropemacs.html', license='GNU GPL', classifiers=classifiers, requires=['ropemode'], **extra_kwargs) ropemacs-0.7/ropemacs/0000755000175000001440000000000011755012033015573 5ustar generalusers00000000000000ropemacs-0.7/ropemacs/__init__.py0000644000175000001440000005036711755011726017727 0ustar generalusers00000000000000"""ropemacs, an emacs mode for using rope refactoring library""" import sys import ropemode.decorators import ropemode.environment import ropemode.interface from Pymacs import lisp from rope.base import utils class LispUtils(ropemode.environment.Environment): def ask(self, prompt, default=None, starting=None): if default is not None: prompt = prompt + ('[%s] ' % default) result = lisp.read_from_minibuffer(prompt, starting, None, None, None, default, None) if result == '' and default is not None: return default return result def ask_values(self, prompt, values, default=None, starting=None, exact=True): if self._emacs_version() < 22: values = [[value, value] for value in values] if exact and default is not None: prompt = prompt + ('[%s] ' % default) reader = lisp['ropemacs-completing-read-function'].value() result = reader(prompt, values, None, exact, starting) if result == '' and exact: return default return result def ask_completion(self, prompt, values, starting=None): return self.ask_values(prompt, values, starting=starting, exact=None) def ask_directory(self, prompt, default=None, starting=None): location = starting or default if location is not None: prompt = prompt + ('[%s] ' % location) if lisp.fboundp(lisp['read-directory-name']): # returns default when starting is entered result = lisp.read_directory_name(prompt, location, location) else: result = lisp.read_file_name(prompt, location, location) if result == '' and location is not None: return location return result def message(self, msg): message(msg) def yes_or_no(self, prompt): return lisp.yes_or_no_p(prompt) def y_or_n(self, prompt): return lisp.y_or_n_p(prompt) def get(self, name, default=None): lispname = 'ropemacs-' + name.replace('_', '-') if lisp.boundp(lisp[lispname]): return lisp[lispname].value() return default def get_offset(self): return lisp.point() - 1 def get_text(self): end = lisp.buffer_size() + 1 old_min = lisp.point_min() old_max = lisp.point_max() narrowed = (old_min != 1 or old_max != end) if narrowed: lisp.narrow_to_region(1, lisp.buffer_size() + 1) try: return lisp.buffer_string() finally: if narrowed: lisp.narrow_to_region(old_min, old_max) def get_region(self): offset1 = self.get_offset() lisp.exchange_point_and_mark() offset2 = self.get_offset() lisp.exchange_point_and_mark() return min(offset1, offset2), max(offset1, offset2) def filename(self): return lisp.buffer_file_name() def is_modified(self): return lisp.buffer_modified_p() def goto_line(self, lineno): lisp.goto_line(lineno) def insert_line(self, line, lineno): current = lisp.point() lisp.goto_line(lineno) lisp.insert(line + '\n') lisp.goto_char(current + len(line) + 1) def insert(self, text): lisp.insert(text) def delete(self, start, end): lisp.delete_region(start, end) def filenames(self): result = [] for buffer in lisp.buffer_list(): filename = lisp.buffer_file_name(buffer) if filename: result.append(filename) return result def save_files(self, filenames): ask = self.get('confirm_saving') initial = lisp.current_buffer() for filename in filenames: buffer = lisp.find_buffer_visiting(filename) if buffer: if lisp.buffer_modified_p(buffer): if not ask or lisp.y_or_n_p('Save %s buffer?' % filename): lisp.set_buffer(buffer) lisp.save_buffer() lisp.set_buffer(initial) def reload_files(self, filenames, moves={}): if self.filename() in moves: initial = None else: initial = lisp.current_buffer() for filename in filenames: buffer = lisp.find_buffer_visiting(filename) if buffer: if filename in moves: lisp.kill_buffer(buffer) lisp.find_file(moves[filename]) else: lisp.set_buffer(buffer) lisp.revert_buffer(False, True) if initial is not None: lisp.set_buffer(initial) def find_file(self, filename, readonly=False, other=False): if other: lisp.find_file_other_window(filename) elif readonly: lisp.find_file_read_only(filename) else: lisp.find_file(filename) def _make_buffer(self, name, contents, empty_goto=True, switch=False, window='other', modes=[], fit_lines=None): """Make an emacs buffer `window` can be one of `None`, 'current' or 'other'. """ new_buffer = lisp.get_buffer_create(name) lisp.set_buffer(new_buffer) lisp.toggle_read_only(-1) lisp.erase_buffer() if contents or empty_goto: lisp.insert(contents) for mode in modes: lisp[mode + '-mode']() lisp.buffer_disable_undo(new_buffer) lisp.toggle_read_only(1) if switch: if window == 'current': lisp.switch_to_buffer(new_buffer) else: lisp.switch_to_buffer_other_window(new_buffer) lisp.goto_char(lisp.point_min()) elif window == 'other': if self.get("use_pop_to_buffer"): lisp.pop_to_buffer(new_buffer) lisp.goto_char(lisp.point_min()) else: new_window = lisp.display_buffer(new_buffer) lisp.set_window_point(new_window, lisp.point_min()) if (fit_lines and lisp.fboundp(lisp['fit-window-to-buffer'])): lisp.fit_window_to_buffer(new_window, fit_lines) lisp.bury_buffer(new_buffer) return new_buffer def _hide_buffer(self, name, delete=True): buffer = lisp.get_buffer(name) if buffer is not None: window = lisp.get_buffer_window(buffer) if window is not None: lisp.bury_buffer(buffer) if delete: lisp.delete_window(window) else: if lisp.buffer_name(lisp.current_buffer()) == name: lisp.switch_to_buffer(None) def _emacs_version(self): return int(lisp['emacs-version'].value().split('.')[0]) def create_progress(self, name): if lisp.fboundp(lisp['make-progress-reporter']): progress = _LispProgress(name) else: progress = _OldProgress(name) return progress def current_word(self): return lisp.current_word() def push_mark(self): marker_ring = self.get('marker_ring') marker = lisp.point_marker() lisp.ring_insert(marker_ring, marker) def pop_mark(self): marker_ring = self.get('marker_ring') if lisp.ring_empty_p(marker_ring): self.message("There are no more marked buffers in \ the rope-marker-ring") else: oldbuf = lisp.current_buffer() marker = lisp.ring_remove(marker_ring, 0) marker_buffer = lisp.marker_buffer(marker) if marker_buffer is None: lisp.message("The marked buffer has been deleted") return marker_point = lisp.marker_position(marker) lisp.set_buffer(marker_buffer) lisp.goto_char(marker_point) #Kill that marker so it doesn't slow down editing. lisp.set_marker(marker, None, None) if not lisp.eq(oldbuf, marker_buffer): lisp.switch_to_buffer(marker_buffer) def prefix_value(self, prefix): return lisp.prefix_numeric_value(prefix) def show_occurrences(self, locations): text = ['List of occurrences:', ''] for location in locations: line = '%s : %s %s %s' % (location.filename, location.lineno, location.note, location.offset) text.append(line) text = '\n'.join(text) + '\n' buffer = self._make_buffer('*rope-occurrences*', text, switch=False) lisp.set_buffer(buffer) lisp.toggle_read_only(1) lisp.set(lisp["next-error-function"], lisp.rope_occurrences_next) lisp.local_set_key('\r', lisp.rope_occurrences_goto) lisp.local_set_key('q', lisp.delete_window) def show_doc(self, docs, altview=False): use_minibuffer = not altview if self.get('separate_doc_buffer'): use_minibuffer = not use_minibuffer if not use_minibuffer: fit_lines = self.get('max_doc_buffer_height') buffer = self._make_buffer('*rope-pydoc*', docs, empty_goto=False, fit_lines=fit_lines) lisp.local_set_key('q', lisp.bury_buffer) elif docs: docs = '\n'.join(docs.split('\n')[:7]) self.message(docs) def preview_changes(self, diffs): self._make_buffer('*rope-preview*', diffs, switch=True, modes=['diff'], window='current') try: return self.yes_or_no('Do the changes? ') finally: self._hide_buffer('*rope-preview*', delete=False) def local_command(self, name, callback, key=None, prefix=False): globals()[name] = callback self._set_interaction(callback, prefix) if self.local_prefix and key: key = self._key_sequence(self.local_prefix + ' ' + key) self._bind_local(_lisp_name(name), key) def _bind_local(self, name, key): lisp('(define-key ropemacs-local-keymap "%s" \'%s)' % (self._key_sequence(key), name)) def global_command(self, name, callback, key=None, prefix=False): globals()[name] = callback self._set_interaction(callback, prefix) if self.global_prefix and key: key = self._key_sequence(self.global_prefix + ' ' + key) lisp.global_set_key(key, lisp[_lisp_name(name)]) def _key_sequence(self, sequence): result = [] for key in sequence.split(): if key.startswith('C-'): number = ord(key[-1].upper()) - ord('A') + 1 result.append(chr(number)) elif key.startswith('M-'): number = ord(key[-1].upper()) + 0x80 result.append(chr(number)) else: result.append(key) return ''.join(result) def _set_interaction(self, callback, prefix): if hasattr(callback, 'im_func'): callback = callback.im_func if prefix: callback.interaction = 'P' else: callback.interaction = '' def add_hook(self, name, callback, hook): mapping = {'before_save': 'before-save-hook', 'after_save': 'after-save-hook', 'exit': 'kill-emacs-hook'} globals()[name] = callback lisp.add_hook(lisp[mapping[hook]], lisp[_lisp_name(name)]) @property @utils.saveit def global_prefix(self): return self.get('global_prefix') @property @utils.saveit def local_prefix(self): return self.get('local_prefix') def _lisp_name(name): return 'rope-' + name.replace('_', '-') class _LispProgress(object): def __init__(self, name): self.progress = lisp.make_progress_reporter('%s ... ' % name, 0, 100) def update(self, percent): lisp.progress_reporter_update(self.progress, percent) def done(self): lisp.progress_reporter_done(self.progress) class _OldProgress(object): def __init__(self, name): self.name = name self.update(0) def update(self, percent): if percent != 0: message('%s ... %s%%%%' % (self.name, percent)) else: message('%s ... ' % self.name) def done(self): message('%s ... done' % self.name) def message(message): lisp.message(message.replace('%', '%%')) def occurrences_goto(): if lisp.line_number_at_pos() < 3: lisp.forward_line(3 - lisp.line_number_at_pos()) lisp.end_of_line() end = lisp.point() lisp.beginning_of_line() line = lisp.buffer_substring_no_properties(lisp.point(), end) tokens = line.split() if tokens: filename = tokens[0] offset = int(tokens[-1]) resource = _interface._get_resource(filename) LispUtils().find_file(resource.real_path, other=True) lisp.goto_char(offset + 1) occurrences_goto.interaction = '' def occurrences_next(arg, reset): lisp.switch_to_buffer_other_window('*rope-occurrences*', True) if reset: lisp.goto_char(lisp.point_min()) lisp.forward_line(arg) if lisp.eobp(): lisp.message("Cycling rope occurences") lisp.goto_char(lisp.point_min()) occurrences_goto() occurrences_next.interaction = '' DEFVARS = """\ (defgroup ropemacs nil "ropemacs, an emacs plugin for rope." :link '(url-link "http://rope.sourceforge.net/ropemacs.html") :prefix "rope-") (defcustom ropemacs-confirm-saving t "Shows whether to confirm saving modified buffers before refactorings. If non-nil, you have to confirm saving all modified python files before refactorings; otherwise they are saved automatically.") (defcustom ropemacs-codeassist-maxfixes 1 "The number of errors to fix before code-assist. How many errors to fix, at most, when proposing code completions.") (defcustom ropemacs-separate-doc-buffer t "Should `rope-show-doc' use a separate buffer or the minibuffer.") (defcustom ropemacs-max-doc-buffer-height 22 "The maximum buffer height for `rope-show-doc'.") (defcustom ropemacs-use-pop-to-buffer nil "Use native `pop-to-buffer' to show new buffer. This affect all ropemacs function including `rope-show-doc'.") (defcustom ropemacs-enable-autoimport 'nil "Specifies whether autoimport should be enabled.") (defcustom ropemacs-autoimport-modules nil "The name of modules whose global names should be cached. The `rope-generate-autoimport-cache' reads this list and fills its cache.") (defcustom ropemacs-autoimport-underlineds 'nil "If set, autoimport will cache names starting with underlines, too.") (defcustom ropemacs-completing-read-function (if (and (boundp 'ido-mode) ido-mode) 'ido-completing-read 'completing-read) "Function to call when prompting user to choose between a list of options. This should take the same arguments as `completing-read'. Possible values are `completing-read' and `ido-completing-read'. Note that you must set `ido-mode' if using`ido-completing-read'." :type 'function) (make-obsolete-variable 'rope-confirm-saving 'ropemacs-confirm-saving) (make-obsolete-variable 'rope-code-assist-max-fixes 'ropemacs-codeassist-maxfixes) (defcustom ropemacs-local-prefix "C-c r" "The prefix for ropemacs refactorings. Use nil to prevent binding keys.") (defcustom ropemacs-global-prefix "C-x p" "The prefix for ropemacs project commands. Use nil to prevent binding keys.") (defcustom ropemacs-marker-ring-length 16 "Length of the rope marker ring.") (defcustom ropemacs-marker-ring (make-ring ropemacs-marker-ring-length) "Ring of markers which are locations from which goto-definition was invoked.") (defcustom ropemacs-enable-shortcuts 't "Shows whether to bind ropemacs shortcuts keys. If non-nil it binds: ================ ============================ Key Command ================ ============================ M-/ rope-code-assist C-c g rope-goto-definition C-c u rope-pop-mark C-c d rope-show-doc C-c f rope-find-occurrences M-? rope-lucky-assist ================ ============================ ") (defvar ropemacs-local-keymap (make-sparse-keymap)) (easy-menu-define ropemacs-mode-menu ropemacs-local-keymap "`ropemacs' menu" '("Rope" ["Code assist" rope-code-assist t] ["Lucky assist" rope-lucky-assist t] ["Goto definition" rope-goto-definition t] ["Pop mark" rope-pop-mark t] ["Jump to global" rope-jump-to-global t] ["Show documentation" rope-show-doc t] ["Find Occurrences" rope-find-occurrences t] ["Analyze module" rope-analyze-module t] ("Refactor" ["Inline" rope-inline t] ["Extract Variable" rope-extract-variable t] ["Extract Method" rope-extract-method t] ["Organize Imports" rope-organize-imports t] ["Rename" rope-rename t] ["Move" rope-move t] ["Restructure" rope-restructure t] ["Use Function" rope-use-function t] ["Introduce Factory" rope-introduce-factory t] ("Generate" ["Class" rope-generate-class t] ["Function" rope-generate-function t] ["Module" rope-generate-module t] ["Package" rope-generate-package t] ["Variable" rope-generate-variable t] ) ("Module" ["Module to Package" rope-module-to-package t] ["Rename Module" rope-rename-current-module t] ["Move Module" rope-move-current-module t] ) "--" ["Undo" rope-undo t] ["Redo" rope-redo t] ) ("Project" ["Open project" rope-open-project t] ["Close project" rope-close-project t] ["Find file" rope-find-file t] ["Open project config" rope-project-config t] ) ("Create" ["Module" rope-create-module t] ["Package" rope-create-package t] ["File" rope-create-file t] ["Directory" rope-create-directory t] ) )) (defcustom ropemacs-guess-project 'nil "Try to guess the project when needed. If non-nil, ropemacs tries to guess and open the project that contains a file on which the rope command is performed when no project is already opened.") (provide 'ropemacs) """ MINOR_MODE = """\ (define-minor-mode ropemacs-mode "ropemacs, rope in emacs!" nil " Rope" ropemacs-local-keymap :global nil) ) """ shortcuts = [('M-/', 'rope-code-assist'), ('M-?', 'rope-lucky-assist'), ('C-c g', 'rope-goto-definition'), ('C-c u', 'rope-pop-mark'), ('C-c d', 'rope-show-doc'), ('C-c f', 'rope-find-occurrences')] _interface = None def _load_ropemacs(): global _interface ropemode.decorators.logger.message = message lisp(DEFVARS) _interface = ropemode.interface.RopeMode(env=LispUtils()) _interface.init() lisp(MINOR_MODE) if LispUtils().get('enable_shortcuts'): for key, command in shortcuts: LispUtils()._bind_local(command, key) lisp.add_hook(lisp['python-mode-hook'], lisp['ropemacs-mode']) def _started_from_pymacs(): import inspect frame = sys._getframe() while frame: # checking frame.f_code.co_name == 'pymacs_load_helper' might # be very fragile. filename = inspect.getfile(frame).rstrip('c') if filename.endswith(('Pymacs.py', 'pymacs.py')): return True frame = frame.f_back if _started_from_pymacs(): _load_ropemacs() ropemacs-0.7/setup.cfg0000644000175000001440000000007311755012033015603 0ustar generalusers00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0