[
  {
    "path": "COPYING",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n                            NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License along\n    with this program; if not, write to the Free Software Foundation, Inc.,\n    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.\n"
  },
  {
    "path": "GF-QuickStart",
    "content": "ElScreen-GF 1.5.3 Quick Start Guide\n\n 1) Install ElScreen, ElScreen-GF.\n 2) Make sure that the grep on your system is GNU-compatible.\n 3) Visit a source code you want to read.\n 4) Put the cursor on the keyword you want to search.\n 5) Type `C-z C-g G', and `RET'.\n 6) Select line you want to jump to.\n 7) Type `O'.\n\nElScreen-GF also supports GNU ID Utils, cscope and GNU GLOBAL as an\nexternal program to search keywords.  For more detail, please refer\nREADME file in this tarball.\n"
  },
  {
    "path": "GF-README",
    "content": "ElScreen-GF 1.5.3 README file\n\nThis is the distribution of ElScreen-GF 1.5.3, released November 2007.\nIt is an Emacs interface to GNU grep (or its compatibles), GNU ID\nUtils, cscope, and GNU GLOBAL.  ElScreen-GF makes it easier to search\nkeyword or token in source codes, list the results, and jump to them.\nThis will help you to read or hack source codes, especially in a big\nsource tree.\n\nIt works with ElScreen 1.4.0 or later, on GNU Emacs 21 or later and\nXEmacs 21.4 or later.  Enjoy!\n\n\nExternal Programs\n-----------------\nElScreen-GF supports the followings as external program:\n\n  - GNU grep (http://www.gnu.org/software/grep/grep.html)\n\n    grep is famous utility to print lines matching the specified\n    pattern.  GNU grep has several extended features to traditional\n    grep.  Nowadays major state-of-the-art OS may have GNU grep or its\n    compatible one.\n\n  - GNU ID Utils (http://www.gnu.org/software/idutils/idutils.html)\n\n    This is language-independent (but currently supports C, C++,\n    Assembly, text.  Perl also seems to be supported in the CVS HEAD)\n    identifier database tool, which stores tokens, literal numbers, or\n    words of human-readable text.\n\n  - cscope (http://cscope.sourceforge.net/)\n\n    cscope is an interactive tool that allows you to browse through C\n    source files for specified elements of code.  This provides you\n    the curses-based screen-oriented interface, but ElScreen-GF uses\n    only line-oriented interface.  In addition, ElScreen-GF uses `sort'\n    to sort its output.\n\n  - GNU GLOBAL (http://www.gnu.org/software/global/)\n\n    GNU GLOBAL is an yet another source code tag system.  You can\n    locate a symbol in the source files.  In addition, ElScreen-GF\n    uses `sort' to sort its output.\n\n\nFiles\n-----\nThis package should contain the following files:\n\n    elscreen-gf.el  ElScreen-GF 1.5.3 main file.\n    README          Introduction to ElScreen-GF 1.5.3 (this file)\n    QuickStart      Quick Start Guide\n\n\nInstallation\n------------\nMake sure that you have installed ElScreen.  Put elscreen-gf.el in\nthis directory to your load-path, and put following line just next to\nElScreen entry:\n\n (load \"elscreen-gf\" \"ElScreen-GF\" t)\n\nAs mentioned above, you also have to install one of supported external\nprograms.  Please refer their own manuals for more detail.\n\n\nUsage\n-----\nThe following sequences may valid on ElScreen:\n\n    C-z             ElScreen prefix key\n    C-z C-g         ElScreen-GF prefix key\n    C-z C-g G       Run grep\n    C-z C-g g       Run gid (GNU ID Utils)\n    C-z C-g m       Run mkid (GNU ID Utils)\n    C-z C-g c       Run cscope\n    C-z C-g l       Run global (GNU GLOBAL)\n    C-z C-g t       Run gtags (GNU GLOBAL)\n    C-z C-g u       Go back to the point where the previous search\n                    was invoked.\n    C-z C-g v       Show ElScreen-GF version.\n\nAlthough a token around the cursor is shown as default value for grep,\ngid, cscope and global, you can specify other keyword.  Regexp is also\naccepted.  Once you run grep, gid, cscope or global, ElScreen-GF\nbuffer is created and becomes active.  In this buffer, you may use\nfollowing keys:\n\n    n               Move cursor to the next entry, vertically down.\n    p               Move cursor to the previous entry, vertically up.\n    SPC             Scroll entries upward full screen.\n    DEL             Scroll entries downward full screen.\n    <               Move cursor to the first entry.\n    >               Move cursor to the last entry.\n    N               Move cursor to the first entry of the next source\n                    file.\n    P               Move cursor to the first entry of the previous\n                    source file.\n    t               Toggle truncated lines.\n    o               Jump to the file and line that the selected entry\n                    specifies.\n    O               Likewise, except the buffer is set to read-only.\n    C-g             Delete running grep, gid, cscope or global process.\n    q               Exit from ElScreen-GF mode.  This deletes\n                    ElScreen-GF buffer and its window (or screen when\n                    there is only one window).\n    v               Show ElScreen-GF version.\n\n\nSetup\n-----\nYou can set the following variables to configure ElScreen-GF.  These\ncan be set in .emacs (or .emacs.d/init.el) file directly or \"Options\"\nin your menu bar.\n\n    elscreen-gf-grep-program-name\n    elscreen-gf-idutils-gid-program-name\n    elscreen-gf-idutils-mkid-program-name\n    elscreen-gf-cscope-program-name\n    elscreen-gf-global-program-name\n    elscreen-gf-global-gtags-program-name\n\n        Name of external programs.\n\n    elscreen-gf-mode-truncate-lines\n\n        If non nil, each line of result in the ElScreen-GF mode is\n        shown in truncated manner by default.  The default value is\n        `t'.\n\n    elscreen-gf-invoke-point-history-length\n\n        Maximum number of invoke-point stored by ElScreen-GF.\n        invoke-point is the location where gf searches were invoked.\n\n    elscreen-gf-mode-selected-entry-face\n\n        Face used for the selected entry in ElScreen-GF mode.\n\n    elscreen-gf-mode-file-name-face\n\n        Face used for file name in ElScreen-GF mode.\n\n    elscreen-gf-mode-line-number-face\n\n        Face used for line number in ElScreen-GF mode.\n\n    elscreen-gf-mode-pattern-face\n\n        Face used to emphasize the specified keyword in ElScreen-GF\n        mode.\n\n    elscreen-gf-emphasis-after-jump-face\n\n        Face used to emphasize the selected line after jump.\n\n\nAutomatic Database Update\n-------------------------\nYou can update `ID' GNU ID Utils database or `GTAGS' GNU GLOBAL\ndatabase after saveing buffer with using\n\n  elscreen-gf-idutils-mkid-setup-after-save-hook\n  elscreen-gf-global-gtags-setup-after-save-hook\n\nfor GNU ID Utils and GNU GLOBAL respectively.  For instance, you can\nadd following lines to update `ID' database when saving C source code:\n\n  (add-hook 'c-mode-hook 'elscreen-gf-idutils-mkid-setup-after-save-hook)\n\n\nWhere Can I Get ElScreen-GF?\n----------------------------\nElScreen-GF (and ElScreen) is available from the following anonymous\nftp site.\n\n       ftp://ftp.morishima.net/pub/morishima.net/naoto/ElScreen/\n\n\nBug Reports\n-----------\nElScreen-GF is maintained by Naoto Morishima.  Please mail bug\nreports and any comments to:\n\n       naoto@morishima.net\n"
  },
  {
    "path": "Readme.md",
    "content": "ElScreen\n==========\n\n\nThis is a fork of\n[ElScreen](http://www.morishima.net/~naoto/elscreen-en/?lang=en)\nupdated for Emacs 24 and `package.el`.  ElScreen is an Emacs utility\nwith which you can have multiple screens (window-configuration) on\nyour GNU Emacs as well as GNU screen on terminal.\n\nIf you use emacs-lisp applications which have many windows (like\nGnus, irchat, Wanderlust, Mew...), ElScreen makes it easy to\nswitch to a different screen, with its configuration unchanged.\nYou can also create and kill screen, jump to them, rename the\nscreen, and so on.\n\nThis version of ElScreen does not require any external dependencies.\n\n\nInstallation\n------------\n\n\nThe preferred way to install ElScreen is through\n[MELPA](https://melpa.org/) and `package.el`.  If you have Emacs 24,\nyou should already have `package.el`.  To enable MELPA, add something\nlike the following in your `.emacs.d` file:\n\n    (add-to-list 'package-archives\n         '(\"melpa\" . \"https://melpa.org/packages/\") t)\n\nOnce you have installed ElScreen, you can activate it like so:\n\n    (elscreen-start)\n\n\nUsage\n-----\nYou may use following sequences on ElScreen:\n\n`C-z c`<br />\n`C-z C-c`<br />\nCreate a new screen and switch to it.\n\n`C-z C`<br />\nCreate a new screen with the window-configuration of\nthe current screen.\n           \n`C-z k`<br />\n`C-z C-k`<br />\nKill current screen.\n\n`C-z M-k`<br />\nKill current screen and buffers.\n\n`C-z K`<br />\nKill other screens.\n\n`C-z n`<br />\n`C-z C-n`<br />\nSwitch to the \"next\" screen in a cyclic order.\n\n`C-z p`<br />\n`C-z C-p`<br />\nSwitch to the \"previous\" screen in a cyclic order.\n\n`C-z a`<br />\n`C-z C-a`<br />\nToggle to the screen selected previously.\n\n`C-z '`<br />\nPrompt for a screen number to switch to.\n\n`C-z \"`<br />\nPresent a list of all screens for selection.\n\n`C-z 0..9`<br />\nJump to the screen number 0-9.\n\n`C-z C-s`<br />\nSwap current screen with previous one.\n  \n`C-z w`<br />\n`C-z C-w`<br />\nShow a list of screen.\n  \n`C-z A`<br />\nAllow the user to enter a name for the current screen.\n\n`C-z m`<br />\n`C-z C-m`<br />\nRepeat the last message displayed in the mini-buffer.\n  \n`C-z t`<br />\n`C-z C-t`<br />\n    \n`C-z b`<br />\nSwitch to the screen in which specified buffer is\nsplayed.\n  \n`C-z C-f`<br />\nCreate new screen and open file.\n  \n`C-z C-r`<br />\nCreate new screen and open file but don't allow changes.\n  \n`C-z d`<br />\nCreate new screen and run dired.\n\n`C-z M-x`<br />\nRead function name, then call it with new screen.\n\n`C-z i`<br />\nShow/hide the screen number in the mode line.\n\n`C-z T`<br />\nShow/hide the tab on the top of each frame.\n\n`C-z v`<br />\nDisplay ElScreen version.\n\n`C-z ?`<br />\nShow key bindings of ElScreen and Add-On softwares.\n  \n\n\nSetup\n-----\nYou can set the following variables to configure ElScreen.  These\ncan be set in `.emacs` file directly or \"Options\" in your menu bar.\n\n    elscreen-prefix-key\n\nElScreen prefix-key.  The default value is `\\C-z`.\n\n    elscreen-buffer-to-nickname-alist\n\nThe pairs of buffer-name and corresponding screen nickname or function\nthat returns nickname, which are listed by\n`elscreen-display-screen-name-list` only when major-mode cannot\ndetermine its screen nickname.  The default value is:\n\n        '((\"^dired-mode$\" .\n           (lambda ()\n             (format \"Dired(%s)\" dired-directory)))\n          (\"^Info-mode$\" .\n           (lambda ()\n             (format \"Info(%s)\" (file-name-nondirectory Info-current-file))))\n          (\"^mew-draft-mode$\" .\n           (lambda ()\n             (format \"Mew(%s)\" (buffer-name (current-buffer)))))\n          (\"^mew-\" . \"Mew\")\n          (\"^irchat-\" . \"IRChat\")\n          (\"^liece-\" . \"Liece\")\n          (\"^lookup-\" . \"Lookup\"))\n\n    elscreen-mode-to-nickname-alist\n\nThe pairs of major-mode and corresponding screen nickname or function\nthat returns nickname, which are listed by\n`elscreen-display-screen-name-list`.  The default value is:\n\n        '((\"[Ss]hell\" . \"shell\")\n          (\"compilation\" . \"compile\")\n          (\"-telnet\" . \"telnet\")\n          (\"dict\" . \"OnlineDict\")\n          (\"*WL:Message*\" . \"Wanderlust\"))\n\n    elscreen-startup-command-line-processing\n\nIf non `nil`, ElScreen processes command line arguments of Emacsen when\nstarting up, and opens files with new screens if needed.  The default\nvalue is `t`.\n\n    elscreen-display-screen-number\n\nIf non `nil`, show the number of the current screen in mode line.  The\ndefault value is `t`.\n\n    elscreen-display-tab\n\nSpecify how the tabs at the top of frame should be displayed.  `t` means\nto display tabs whose width should be calculated automatically.  A\nvalue of integer means to display tabs with fixed width of this value.\n`nil` means don't display tabs.  The default value is `t`.\n\n    elscreen-tab-display-control\n\nIf non `nil`, display the tab (labeled with `[<->]`) to switch to\nnext/previous screen or create new screen at the most left side of the\ntab line.  The default value is `t`.\n\n    elscreen-tab-display-kill-screen\n\nLocation of the icon (`[X]`) to kill corresponding screen on each tab.\nPossible values are `'left`, `'right` and `nil` (to hide icons).  The\ndefault value is `'left`.\n\n\nBugs\n----\nUnder multiple-frame environment, screen numbers displayed on mode\nline of each frame is changed at the same time.  On GNU Emacs 21, tabs\nalso has this restriction.\n\n\nAcknowledgment\n--------------\nMany people contributed to ElScreen by reporting problems or suggesting\nvarious improvements.  Here is a list of these people.\n\n  * Tohru Sugayama\n  * Yoshinobu Takenaga\n  * Masatoshi Takamura\n  * Jin Kashimura\n  * Takahiko Sakai\n  * Norio Suzuki\n  * Yoshitatsu Takeshita\n  * Yoichi Nakayama\n  * sen_ml@eccosys.com\n  * Dan Debertin\n  * Yoshinori Koseki\n  * Hideyuki Shirai\n  * Masahiro Ishiyama\n  * Alexy Khrabrov\n"
  },
  {
    "path": "elscreen-buffer-list.el",
    "content": ";;;\n\n;; This code is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published\n;; by the Free Software Foundation; either version 3, or (at your\n;; option) any later version.\n;;\n;; This code is distributed in the hope that it will be useful, but\n;; WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n;; General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with Emacs. If not, see http://www.gnu.org/licenses.\n\n(provide 'elscreen-buffer-list)\n(require 'elscreen)\n\n;; From escreen.el\n(defun buffer-dead-p (buffer)\n  (not (static-if (fboundp 'buffer-live-p)\n           (buffer-live-p buffer)\n         ;; Emacs 18 doesn't have buffer-live-p.\n         ;; Killed buffers have no names.\n         (buffer-name buffer))))\n\n;; From escreen.el\n(defun reorder-buffer-list (new-list)\n  \"Set buffers in NEW-LIST to be the most recently used, in order.\"\n  (when new-list\n    (let (firstbuf buf)\n      (while new-list\n        (setq buf (car new-list))\n        (when (stringp buf)\n          (setq buf (get-buffer buf)))\n        (unless (buffer-dead-p buf)\n          (bury-buffer buf)\n          (unless firstbuf\n            (setq firstbuf buf)))\n        (setq new-list (cdr new-list)))\n      (setq new-list (buffer-list))\n      (while (not (eq (car new-list) firstbuf))\n        (bury-buffer (car new-list))\n        (setq new-list (cdr new-list))))))\n\n\n(defun elscreen-get-buffer-list (screen)\n  \"Return buffer-list of SCREEN.\"\n  (let ((screen-property (elscreen-get-screen-property screen)))\n    (get-alist 'buffer-list screen-property)))\n\n(defun elscreen-set-buffer-list (screen buflist)\n  \"Set buffer-list of SCREEN to BUFLIST.\"\n  (let ((screen-property (elscreen-get-screen-property screen)))\n    (set-alist 'screen-property 'buffer-list buflist)\n    (elscreen-set-screen-property screen screen-property)))\n\n(defun elscreen-save-buffer-list (&optional screen)\n  \"Save the buffer-list order for SCREEN, or current screen\"\n  (elscreen-set-buffer-list (or screen\n                                (elscreen-get-current-screen))\n                            (buffer-list)))\n\n(defun elscreen-load-buffer-list (&optional screen)\n  \"Set emacs' buffer-list order to that of SCREEN, or current screen\"\n  (reorder-buffer-list (elscreen-get-buffer-list\n                        (or screen\n                            (elscreen-get-current-screen)))))\n\n(defadvice elscreen-goto-internal (around manage-buffer-list activate)\n  \"Manage screen-specific buffer lists.\"\n  (when (and elscreen-buffer-list-enabled\n             (elscreen-screen-live-p (elscreen-get-previous-screen)))\n    (elscreen-save-buffer-list (elscreen-get-previous-screen)))\n  ad-do-it\n  (when elscreen-buffer-list-enabled\n    (elscreen-load-buffer-list (elscreen-get-current-screen))))\n\n(defcustom elscreen-buffer-list-enabled nil\n  \"Whether to save and load screen-local buffer lists.\"\n  :type 'boolean\n  :group 'elscreen)\n\n(defun toggle-elscreen-buffer-list (&optional arg)\n  (interactive \"P\")\n  (setq elscreen-buffer-list-enabled\n        (cond ((null arg) (not elscreen-buffer-list-enabled))\n              (t (> arg 0))))\n  (message \"Screen-specific buffer lists %s\"\n\t   (if elscreen-buffer-list-enabled \"enabled\" \"disabled\")))\n\n(fset 'enable-elscreen-buffer-list\n      (apply-partially 'toggle-elscreen-buffer-list 1))\n(fset 'disable-elscreen-buffer-list\n      (apply-partially 'toggle-elscreen-buffer-list 0))\n"
  },
  {
    "path": "elscreen-color-theme.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-color-theme.el\n;;\n(defconst elscreen-color-theme-version \"0.0.0 (November 19, 2007)\")\n;;\n;; Author:   Naoto Morishima <naoto@morishima.net>\n;; Created:  November 19, 2007\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-color-theme)\n(require 'elscreen)\n\n(defcustom elscreen-color-theme-override-theme nil\n  \"Non-nil to override theme's faces\"\n  :type 'boolean\n  :group 'color-theme)\n\n(defcustom elscreen-color-theme-tab-background-face-function\n  'elscreen-color-theme-tab-background-face-default-function\n  \"Function to generate a face for background of the tabs of ElScreen.\"\n  :type 'function\n  :group 'color-theme)\n\n(defcustom elscreen-color-theme-tab-control-face-function\n  'elscreen-color-theme-tab-control-face-default-function\n  \"Function to generate a face for the control tab of ElScreen.\"\n  :type 'function\n  :group 'color-theme)\n\n(defcustom elscreen-color-theme-tab-current-screen-face-function\n  'elscreen-color-theme-tab-current-screen-face-default-function\n  \"Function to generate a face for the current tab of ElScreen.\"\n  :type 'function\n  :group 'color-theme)\n\n(defcustom elscreen-color-theme-tab-other-screen-face-function\n  'elscreen-color-theme-tab-other-screen-face-default-function\n  \"Function to generate a face for inactive tabs of ElScreen.\"\n  :type 'function\n  :group 'color-theme)\n\n(defsubst elscreen-color-theme-generate-color (color weight)\n  (let* ((max-value (car (color-values \"white\")))\n         (dividing-value (round (/ max-value 2)))\n         (unit-value (round (/ dividing-value 16))))\n    (apply 'format \"#%02x%02x%02x\"\n           (mapcar\n            (lambda (value)\n              (let* ((sign (if (< dividing-value value) -1 1))\n                     (adjustment (* sign unit-value weight)))\n                (+ value adjustment)))\n            (color-values color)))))\n\n(defun elscreen-color-theme-tab-background-face-default-function (theme)\n  (let* ((params (color-theme-frame-params theme))\n         (background (cdr (assoc 'background-color params)))\n         (faces\n          (when background\n            `(:background\n              ,(elscreen-color-theme-generate-color background 8)))))\n    (when faces `((t ,faces)))))\n\n(defun elscreen-color-theme-tab-control-face-default-function (theme)\n  (let* ((params (color-theme-frame-params theme))\n         (foreground (cdr (assoc 'foreground-color params)))\n         (background (cdr (assoc 'background-color params)))\n         (faces (nconc\n                 (when foreground `(:foreground ,foreground))\n                 (when background `(:background ,background)))))\n    (when faces `((t ,faces)))))\n\n(defalias 'elscreen-color-theme-tab-current-screen-face-default-function\n  'elscreen-color-theme-tab-control-face-default-function)\n\n(defun elscreen-color-theme-tab-other-screen-face-default-function (theme)\n  (let* ((params (color-theme-frame-params theme))\n         (foreground (cdr (assoc 'foreground-color params)))\n         (background (cdr (assoc 'background-color params)))\n         (faces (nconc\n                 (when foreground\n                   `(:foreground\n                     ,(elscreen-color-theme-generate-color foreground 12)))\n                 (when background\n                   `(:background\n                     ,(elscreen-color-theme-generate-color background 4))))))\n    (when faces `((t ,faces)))))\n\n(defadvice color-theme-install (around elscreen-color-theme-install activate)\n  (let* ((theme-faces (color-theme-faces (color-theme-canonic theme)))\n         (elscreen-faces\n          (delete nil\n                  (mapcar\n                   (lambda (face-name)\n                     (unless (and (not elscreen-color-theme-override-theme)\n                                  (assoc face-name theme-faces))\n                       (let* ((face-fn\n                               (symbol-value\n                                (intern\n                                 (concat (replace-regexp-in-string\n                                          \"^elscreen\"\n                                          \"elscreen-color-theme\"\n                                          (symbol-name face-name))\n                                         \"-function\"))))\n                              (faces (funcall face-fn theme)))\n                         (when faces (list face-name faces)))))\n                   '(elscreen-tab-background-face\n                     elscreen-tab-control-face\n                     elscreen-tab-current-screen-face\n                     elscreen-tab-other-screen-face)))))\n    ad-do-it\n    (when elscreen-faces\n      (color-theme-install-faces elscreen-faces))))\n"
  },
  {
    "path": "elscreen-dired.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-dired.el \n;;\n(defconst elscreen-dired-version \"0.1.0 (November 6, 2005)\")\n;;\n;; Author:   Naoto Morishima <naoto@morishima.net>\n;; Created:  August 9, 2004\n;; Revised:  November 6, 2005\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-dired)\n(require 'elscreen)\n\n\n;;; Code:\n\n(defadvice dired-find-file-other-window (around elscreen-dired-find-file-other-window activate)\n  (let ((window-configuration (current-window-configuration))\n\t(buffer nil))\n    ad-do-it\n    (unless (eq major-mode 'dired-mode)\n      (setq buffer (current-buffer))\n      (set-window-configuration window-configuration)\n      (elscreen-find-and-goto-by-buffer buffer t))))\n"
  },
  {
    "path": "elscreen-dnd.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-dnd.el\n;;\n(defconst elscreen-dnd-version \"0.0.0 (December 15, 2005)\")\n;;\n;; Author:   Hideyuki Shirai <shirai@meadowy.org>\n;;           Naoto Morishima <naoto@morishima.net>\n;; Created:  December 15, 2005\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-dnd)\n(require 'elscreen)\n\n(defcustom elscreen-dnd-open-file-new-screen t\n  \"If non-nil, always create new screen to open dropped files.\"\n  :type 'boolean\n  :group 'dnd)\n\n\n;; Code:\n\n(defmacro elscreen-dnd-drag-n-drop (ad-do-it)\n  (` (progn\n       (elscreen-notify-screen-modification-suppress\n\t(, ad-do-it))\n       (elscreen-notify-screen-modification 'force))))\n\n(defadvice dnd-handle-one-url (around elscreen-dnd-handle-open-url activate)\n  (if (not elscreen-dnd-open-file-new-screen)\n      ad-do-it\n    (let ((dnd-open-file-other-window nil)\n\t  file-buffer)\n      (save-window-excursion\n\tad-do-it\n\t(setq file-buffer (current-buffer)))\n      (if (elscreen-screen-modified-p 'dnd-handle-one-url)\n\t  (elscreen-find-and-goto-by-buffer file-buffer 'create)\n\t(elscreen-find-screen-by-buffer file-buffer 'create)))))\n\n(mapc\n (lambda (drag-n-drop-function)\n   (eval (` (defadvice (, drag-n-drop-function) (around elscreen-dnd-drag-n-drop activate)\n\t      (elscreen-dnd-drag-n-drop ad-do-it)))))\n (list 'x-dnd-handle-drag-n-drop-event 'mac-drag-n-drop 'w32-drag-n-drop))\n"
  },
  {
    "path": "elscreen-gf.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-gf.el\n;;\n(defconst elscreen-gf-version \"1.5.3 (November 07, 2007)\")\n;;\n;; Author:   Naoto Morishima <naoto@morishima.net>\n;; Based on: grep-family.el\n;;              by Youki Kadobayashi <youki-k@is.aist-nara.ac.jp>\n;; Created:  June 23, 1996\n;; Revised:  November 07, 2007\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-gf)\n(require 'elscreen)\n(require 'ring)\n\n;;; User Customizable Variables:\n\n(defgroup elscreen-gf nil\n  \"ElScreen-GF -- Grep Family on ElScreen\"\n  :tag \"ElScreen-GF\"\n  :group 'tools)\n\n(defcustom elscreen-gf-grep-program-name \"grep\"\n  \"Program invoked by \\\\[elscreen-gf-grep] command.\"\n  :type 'string\n  :group 'elscreen-gf)\n\n(defcustom elscreen-gf-idutils-gid-program-name \"gid\"\n  \"Program invoked by \\\\[elscreen-gf-idutils-gid] command.\"\n  :type 'string\n  :group 'elscreen-gf)\n\n(defcustom elscreen-gf-idutils-mkid-program-name \"mkid\"\n  \"Program invoked by \\\\[elscreen-gf-idutils-mkid] command.\"\n  :type 'string\n  :group 'elscreen-gf)\n\n(defcustom elscreen-gf-cscope-program-name \"cscope\"\n  \"Program invoked by \\\\[elscreen-gf-cscope] command.\"\n  :type 'string\n  :group 'elscreen-gf)\n\n(defcustom elscreen-gf-global-program-name \"global\"\n  \"Program invoked by \\\\[elscreen-gf-global] command.\"\n  :type 'string\n  :group 'elscreen-gf)\n\n(defcustom elscreen-gf-global-gtags-program-name \"gtags\"\n  \"Program invoked by \\\\[elscreen-gf-global-gtags] command.\"\n  :type 'string\n  :group 'elscreen-gf)\n\n(defcustom elscreen-gf-mode-truncate-lines t\n  \"If non-nil, truncate each line in ElScreen-GF mode.\"\n  :tag \"Truncate lines in ElScreen-GF mode.\"\n  :type 'boolean\n  :group 'elscreen-gf)\n\n(defvar elscreen-gf-invoke-point-history)\n\n(defcustom elscreen-gf-invoke-point-history-length 8\n  \"Length of histories for the locations where gf searchs were invoked.\"\n  :tag \"Length of histries for invoke-point.\"\n  :type '(integer :size 4)\n  :set (lambda (symbol value)\n         (when (and (numberp value)\n                    (>= value 4)\n                    (<= value 64))\n           (custom-set-default symbol value)\n           (let ((old-history (when (boundp 'elscreen-gf-invoke-point-history)\n                                elscreen-gf-invoke-point-history)))\n             (setq elscreen-gf-invoke-point-history (make-ring value))\n             (when (and old-history (ring-p old-history))\n               (while (and (not (ring-empty-p old-history))\n                           (< (ring-length elscreen-gf-invoke-point-history)\n                              value))\n                 (ring-insert-at-beginning elscreen-gf-invoke-point-history\n                                           (ring-remove old-history 0)))))))\n  :group 'elscreen-gf)\n\n(defface elscreen-gf-mode-selected-entry-face\n  '((t (:underline t)))\n  \"Face used for the selected entry in ElScreen-GF mode.\"\n  :group 'elscreen-gf)\n\n(defface elscreen-gf-mode-file-name-face\n  '((((class color) (background dark))\n     (:foreground \"khaki\" :bold t))\n    (((class color) (background light))\n     (:foreground \"DarkSlateBlue\" :bold t))\n    (t (:bold t)))\n  \"Face used for file name in ElScreen-GF mode.\"\n  :group 'elscreen-gf)\n\n(defface elscreen-gf-mode-line-number-face\n  '((((class color) (background dark))\n     (:foreground \"gray\" :bold t))\n    (((class color) (background light))\n     (:foreground \"gray50\" :bold t))\n    (t (:bold t)))\n  \"Face used for line number in ElScreen-GF mode.\"\n  :group 'elscreen-gf)\n\n(defface elscreen-gf-mode-pattern-face\n  '((((class color) (background dark))\n     (:foreground \"tomato\" :bold t))\n    (((class color) (background light))\n     (:foreground \"tomato\" :bold t))\n    (t (:bold t)))\n  \"Face used to emphasize the specified keyword in ElScreen-GF mode.\"\n  :group 'elscreen-gf)\n\n(defface elscreen-gf-emphasis-after-jump-face\n  '((((class color) (background light))\n     (:background \"LightSteelBlue1\"))\n    (((class color) (background dark))\n     (:background \"SteelBlue\"))\n    (t (:bold t)))\n  \"Face used to emphasize the selected line after jump.\"\n  :group 'elscreen-gf)\n\n;;; Key bindings:\n\n(defvar elscreen-gf-map (make-sparse-keymap)\n  \"Keymap for elscreen-gf.\")\n(define-key elscreen-gf-map \"G\" 'elscreen-gf-grep)\n(define-key elscreen-gf-map \"m\" 'elscreen-gf-idutils-mkid)\n(define-key elscreen-gf-map \"g\" 'elscreen-gf-idutils-gid)\n(define-key elscreen-gf-map \"c\" 'elscreen-gf-cscope)\n(define-key elscreen-gf-map \"t\" 'elscreen-gf-global-gtags)\n(define-key elscreen-gf-map \"l\" 'elscreen-gf-global)\n(define-key elscreen-gf-map \"u\" 'elscreen-gf-go-back-to-latest-invoke-point)\n(define-key elscreen-gf-map \"v\" 'elscreen-gf-display-version)\n\n(define-key elscreen-map \"\\C-g\" elscreen-gf-map)\n\n(defvar elscreen-gf-mode-map (make-sparse-keymap)\n  \"keymap used in elscreen-gf mode.\")\n(define-key elscreen-gf-mode-map \"n\"    'elscreen-gf-mode-next-line)\n(define-key elscreen-gf-mode-map \"p\"    'elscreen-gf-mode-previous-line)\n(define-key elscreen-gf-mode-map \" \"    'elscreen-gf-mode-scroll-up)\n(define-key elscreen-gf-mode-map \"\\177\" 'elscreen-gf-mode-scroll-down)\n(define-key elscreen-gf-mode-map \"<\"    'elscreen-gf-mode-beginning-of-buffer)\n(define-key elscreen-gf-mode-map \">\"    'elscreen-gf-mode-end-of-buffer)\n(define-key elscreen-gf-mode-map \"N\"    'elscreen-gf-mode-next-file)\n(define-key elscreen-gf-mode-map \"P\"    'elscreen-gf-mode-previous-file)\n(define-key elscreen-gf-mode-map \"t\"    'elscreen-gf-mode-truncate-lines-toggle)\n(define-key elscreen-gf-mode-map \"o\"    'elscreen-gf-mode-jump-to-entry)\n(define-key elscreen-gf-mode-map \"O\"    'elscreen-gf-mode-jump-to-entry-read-only)\n(define-key elscreen-gf-mode-map \"\\C-g\" 'elscreen-gf-mode-search-quit)\n(define-key elscreen-gf-mode-map \"q\"    'elscreen-gf-mode-exit)\n(define-key elscreen-gf-mode-map \"v\"    'elscreen-gf-display-version)\n\n\n;;; Internal Functions and Variables:\n\n(defvar elscreen-gf-invoke-point-history\n  (make-ring elscreen-gf-invoke-point-history-length))\n\n(defsubst elscreen-gf-overlay-create (start end face)\n  (let ((overlay (make-overlay start end)))\n    (overlay-put overlay 'face face)\n    (overlay-put overlay 'evaporate t)\n    overlay))\n\n(defsubst elscreen-gf-move-overlay-create (overlay-symbol start end face)\n  (let ((overlay (condition-case nil\n                     (symbol-value overlay-symbol)\n                   (error nil))))\n    (if (overlayp overlay)\n        (move-overlay overlay start end (current-buffer))\n      (set overlay-symbol (elscreen-gf-overlay-create start end face))\n      (setq overlay (symbol-value overlay-symbol)))\n    overlay))\n\n(defun elscreen-gf-define-major-mode-token (major-mode token-chars)\n  (let ((thing-symbol (intern (format \"%s-thing\" (symbol-name major-mode)))))\n    (put major-mode 'elscreen-gf-major-mode-thing thing-symbol)\n    (put thing-symbol 'token-chars token-chars)\n    (put thing-symbol 'end-op\n         `(lambda ()\n            (re-search-forward (concat \"\\\\=[\" ,token-chars \"]*\") nil t)))\n    (put thing-symbol 'beginning-op\n         `(lambda ()\n            (if (re-search-backward (concat \"[^\" ,token-chars \"]\") nil t)\n                (forward-char)\n              (goto-char (point-min)))))))\n\n(elscreen-gf-define-major-mode-token 'c-mode \"a-zA-Z0-9_\")\n(elscreen-gf-define-major-mode-token 'perl-mode \"a-zA-Z0-9_\")\n(elscreen-gf-define-major-mode-token 'emacs-lisp-mode \"-a-zA-Z0-9/+:<>\")\n\n(defsubst elscreen-gf-major-mode-token-chars (major-mode)\n  (get (get major-mode 'elscreen-gf-major-mode-thing) 'token-chars))\n\n(defsubst elscreen-gf-db-directory (file-name &optional directory)\n  (let ((directory (expand-file-name\n                    (or directory\n                        (and (buffer-file-name)\n                             (file-name-directory (buffer-file-name)))\n                        default-directory)))\n        (previous-directory nil))\n    (catch 'found\n      (while (and directory\n                  (not (and previous-directory\n                            (string= directory previous-directory))))\n        (if (file-exists-p (concat directory file-name))\n            (throw 'found directory))\n        (setq previous-directory directory)\n        (setq directory (file-name-directory\n                         (directory-file-name directory)))))))\n\n\n;;; ElScreen-GF mode\n\n(defconst elscreen-gf-mode-to-nickname-alist\n  '((\"^elscreen-gf-mode$\" . (lambda ()\n                              (format \"ElScreen-GF%s\"\n                                      (if (and (elscreen-gf-process-exclusive-p\n                                                elscreen-gf-idutils-mkid-process\n                                                'noerror)\n                                               (elscreen-gf-process-exclusive-p\n                                                elscreen-gf-global-gtags-process\n                                                'noerror))\n                                          \"\" \" (!)\")))))\n  \"*Alist composed of the pair of mode-name and corresponding screen-name.\")\n(elscreen-set-mode-to-nickname-alist 'elscreen-gf-mode-to-nickname-alist)\n\n(defun elscreen-gf-goto-screen-create (target-directory)\n  (let ((buffer (get-buffer-create \"ElScreen-GF\")))\n    (elscreen-find-and-goto-by-buffer buffer 'create)\n    (switch-to-buffer buffer)\n    (elscreen-gf-mode target-directory)\n    (let ((buffer-read-only nil))\n      (erase-buffer))))\n\n(defvar elscreen-gf-pattern)\n(defvar elscreen-gf-invoke-point)\n(defvar elscreen-gf-filter-odd-string)\n(defvar elscreen-gf-selected-entry-overlay)\n(defun elscreen-gf-mode (target-directory)\n  \"Major mode for jumping to the entries.\n\nKey bindings:\n\\\\{elscreen-gf-mode-map}\"\n  (setq major-mode 'elscreen-gf-mode)\n  (setq mode-name \"ElScreen-GF\")\n  (use-local-map elscreen-gf-mode-map)\n  (setq buffer-read-only t)\n  (setq case-fold-search nil)\n  (setq truncate-lines elscreen-gf-mode-truncate-lines)\n  (set (make-local-variable 'elscreen-gf-pattern) nil)\n  (set (make-local-variable 'elscreen-gf-invoke-point) nil)\n  (set (make-local-variable 'elscreen-gf-filter-odd-string) nil)\n  (set (make-local-variable 'elscreen-gf-selected-entry-overlay) nil)\n  (setq default-directory target-directory)\n\n  (auto-fill-mode nil))\n\n(defun elscreen-gf-mode-selected-entry-overlay ()\n  (elscreen-gf-move-overlay-create\n   'elscreen-gf-selected-entry-overlay\n   (point-at-bol) (point-at-eol)\n   'elscreen-gf-mode-selected-entry-face))\n\n(defun elscreen-gf-mode-next-line ()\n  \"Move the current entry vertically down.\"\n  (interactive)\n  (let ((current-line (line-number-at-pos)))\n    (cond\n     ((< current-line 4)\n      (goto-char (point-min))\n      (forward-line 3))\n     ((< current-line (line-number-at-pos (point-max)))\n      (forward-line 1)))\n    (elscreen-gf-mode-selected-entry-overlay)))\n\n(defun elscreen-gf-mode-previous-line ()\n  \"Move the current entry vertically up.\"\n  (interactive)\n  (let ((current-line (line-number-at-pos)))\n    (cond\n     ((< 4 current-line)\n      (forward-line -1))\n     (t\n      (goto-char (point-min))\n      (forward-line 3)))\n    (elscreen-gf-mode-selected-entry-overlay)))\n\n(defun elscreen-gf-mode-scroll-up ()\n  \"Scroll entries upward full screen.\"\n  (interactive)\n  (scroll-up)\n  (elscreen-gf-mode-selected-entry-overlay))\n\n(defun elscreen-gf-mode-scroll-down ()\n  \"Scroll entries downward full screen.\"\n  (interactive)\n  (scroll-down)\n  (elscreen-gf-mode-selected-entry-overlay))\n\n(defun elscreen-gf-mode-beginning-of-buffer ()\n  \"Move the current entry to the beginning of the entries.\"\n  (interactive)\n  (goto-char (point-min))\n  (forward-line 3)\n  (elscreen-gf-mode-selected-entry-overlay))\n\n(defun elscreen-gf-mode-end-of-buffer ()\n  \"Move the current entry to the end of the entries.\"\n  (interactive)\n  (goto-char (point-max))\n  (forward-line -1)\n  (elscreen-gf-mode-selected-entry-overlay))\n\n(defun elscreen-gf-mode-next-file ()\n  (interactive)\n  (cond\n   ((save-excursion\n      (beginning-of-line)\n      (looking-at \"^\\\\([^:\\n]+\\\\):\\\\([0-9]+\\\\):\"))\n    (let ((file-name (match-string 1)))\n      (goto-char (point-max))\n      (re-search-backward (concat \"^\" file-name \":\"))\n      (forward-line)))\n   (t\n    (re-search-forward \"^\\\\([^:\\n]+\\\\):\\\\([0-9]+\\\\):\" nil t)\n    (beginning-of-line)))\n  (elscreen-gf-mode-selected-entry-overlay))\n\n(defun elscreen-gf-mode-previous-file ()\n  (interactive)\n  (cond\n   ((save-excursion\n      (beginning-of-line)\n      (looking-at \"^\\\\([^:\\n]+\\\\):\\\\([0-9]+\\\\):\"))\n    (let ((file-name (match-string 1)))\n      (goto-char (point-min))\n      (re-search-forward (concat \"^\" file-name \":\"))\n      (forward-line -1)\n      (beginning-of-line)))\n   (t\n    (re-search-backward \"^\\\\([^:\\n]+\\\\):\\\\([0-9]+\\\\):\" nil t)))\n  (when (looking-at \"^\\\\([^:\\n]+\\\\):\\\\([0-9]+\\\\):\")\n    (let ((file-name (match-string 1)))\n      (goto-char (point-min))\n      (re-search-forward (concat \"^\" file-name \":\"))\n      (beginning-of-line)))\n  (elscreen-gf-mode-selected-entry-overlay))\n\n(defun elscreen-gf-mode-truncate-lines-toggle ()\n  \"Toggle truncated lines.\"\n  (interactive)\n  (let ((window-start (window-start))\n        (line-number-in-window 0))\n    (beginning-of-line)\n    (save-excursion\n      (while (> (point) window-start)\n        (setq line-number-in-window (1+ line-number-in-window))\n        (vertical-motion -1)))\n    (setq truncate-lines (not truncate-lines))\n    (recenter line-number-in-window)))\n\n(defvar elscreen-gf-emphasis-after-jump-overlay nil)\n(defun elscreen-gf-mode-jump-to-entry ()\n  \"Jump to the current entry.\"\n  (interactive)\n  (when (save-excursion\n          (beginning-of-line)\n          (looking-at \"^\\\\([^:\\n]+\\\\):\\\\([0-9]+\\\\):\"))\n    (when (not (eq (marker-buffer (cdr elscreen-gf-invoke-point))\n                   (current-buffer)))\n      (ring-insert elscreen-gf-invoke-point-history elscreen-gf-invoke-point))\n    (let ((file-name (match-string 1))\n          (line (string-to-number (match-string 2)))\n          (pattern elscreen-gf-pattern)\n          token-chars nontoken-chars)\n      (isearch-update-ring pattern)\n      (elscreen-find-file file-name)\n      (setq token-chars\n            (or (elscreen-gf-major-mode-token-chars major-mode)\n                (elscreen-gf-major-mode-token-chars 'elscreen-gf-mode)\n                \"a-zA-Z0-9\"))\n      (setq nontoken-chars (format \"[^%s]\" token-chars))\n      (goto-char (point-min))\n      (forward-line (1- line))\n      (let ((case-fold-search nil))\n        (goto-char (or (and (re-search-forward\n                             (format \"\\\\(^\\\\|%s\\\\)\\\\(%s\\\\)\\\\(%s\\\\|$\\\\)\"\n                                     nontoken-chars pattern nontoken-chars)\n                             (point-at-eol) t)\n                            (match-beginning 2))\n                       (and (search-forward pattern (point-at-eol) t)\n                            (match-beginning 0))\n                       (point-at-bol))))\n      (elscreen-gf-move-overlay-create 'elscreen-gf-emphasis-after-jump-overlay\n                                       (point-at-bol) (point-at-eol)\n                                       'elscreen-gf-emphasis-after-jump-face))))\n\n(defun elscreen-gf-mode-jump-to-entry-read-only ()\n  (interactive)\n  (elscreen-gf-mode-jump-to-entry)\n  (read-only-mode 'toggle))\n\n(defvar elscreen-gf-search-process nil)\n\n(defun elscreen-gf-mode-search-quit (&optional force)\n  (interactive)\n  (when (and (not (elscreen-gf-process-exclusive-p\n                   elscreen-gf-search-process 'noerror))\n             (or force\n                 (yes-or-no-p\n                  (format \"Really quit %s? \"\n                          (process-name elscreen-gf-search-process)))))\n    (delete-process elscreen-gf-search-process)))\n\n(defun elscreen-gf-mode-exit ()\n  (interactive)\n  (let* ((current-screen (elscreen-get-current-screen))\n         (buffer (get-buffer \"ElScreen-GF\"))\n         (screen (when (buffer-live-p buffer)\n                   (elscreen-find-screen-by-buffer buffer))))\n    (when screen\n      (elscreen-goto-internal screen)\n      (mapc\n       (lambda (window)\n         (if (one-window-p)\n             (elscreen-kill screen)\n           (delete-window window)))\n       (get-buffer-window-list buffer)))\n    (when buffer\n      (kill-buffer buffer))\n    (when (elscreen-screen-live-p screen)\n      (elscreen-set-window-configuration\n       screen (elscreen-current-window-configuration)))\n    (when (elscreen-screen-live-p current-screen)\n      (elscreen-goto-internal current-screen))))\n\n;;; Fundamental functions shared among GNU grep/GNI ID Utils/cscope/GNU global\n\n(defun elscreen-gf-process-exclusive-p (process &optional noerror)\n  (let ((exclusive-p (not (and (processp process)\n                               (eq (process-status process) 'run)))))\n    (when (not (or exclusive-p noerror))\n      (message \"Sorry, %s is running now. Try again later.\"\n               (process-name process)))\n    exclusive-p))\n\n(defsubst elscreen-gf-search-token-at-point ()\n  (let* ((thing (or (get major-mode 'elscreen-gf-major-mode-thing) 'word))\n         (thing-at-point (or (thing-at-point thing) \"\")))\n    (set-text-properties 0 (length thing-at-point) nil thing-at-point)\n    thing-at-point))\n\n(defvar elscreen-gf-search-pattern-history nil)\n(defsubst elscreen-gf-search-read-pattern (prompt &optional pattern-default)\n  (let* ((pattern-default (or pattern-default\n                              (elscreen-gf-search-token-at-point)\n                              \"\")))\n    (read-string prompt (cons pattern-default 0)\n                 'elscreen-gf-search-pattern-history)))\n\n(defun elscreen-gf-search-regexp-dot-to-token (regexp token)\n  (let ((index 0)\n        (token-length (length token)))\n    (save-match-data\n      (while (setq index (string-match \"\\\\.\" regexp index))\n        (if (and (/= index 0)\n                 (string= (substring regexp (1- index) index) \"\\\\\"))\n            (setq index (1+ index))\n          (setq regexp (concat (substring regexp 0 index)\n                               token\n                               (substring regexp (1+ index))))\n          (setq index (+ index token-length))))))\n  regexp)\n\n(defun elscreen-gf-read-selection (title prompt option-defs)\n  (let ((candidate-buffer (generate-new-buffer \" *ElScreen-GF-Read-Selection*\"))\n        candidate-window-height\n        (minibuffer-map (copy-keymap minibuffer-local-map))\n        window frame-last-window mini-hist)\n    ;; prepare candidate buffer\n    (with-current-buffer candidate-buffer\n      (setq buffer-read-only t)\n      (let ((buffer-read-only nil))\n        (erase-buffer)\n        (insert title \"\\n\"\n                (mapconcat\n                 (lambda (option-def)\n                   (apply 'format \"  %s) %s\\n\" option-def))\n                 option-defs nil))\n        (goto-char (point-min))\n        (save-excursion\n          (while (not (eobp))\n            (when (looking-at \"^  \\\\([0-9a-z]\\\\)) .*$\")\n              (put-text-property\n               (match-beginning 1) (match-end 1) 'face 'bold))\n            (forward-line 1)))\n        (setq candidate-window-height (line-number-at-pos (point-max)))\n        (set-buffer-modified-p nil)))\n    ;; prepare candidate window\n    (save-window-excursion\n      (setq frame-last-window\n            (previous-window (frame-first-window)))\n      (while (minibuffer-window-active-p frame-last-window)\n        (setq frame-last-window (previous-window frame-last-window)))\n      (while (and (not (one-window-p))\n                  (or (< (window-width frame-last-window)\n                         (frame-width))\n                      (< (window-height frame-last-window)\n                         (+ candidate-window-height window-min-height))))\n        (setq window frame-last-window)\n        (setq frame-last-window (previous-window window))\n        (delete-window window))\n      (select-window (split-window frame-last-window))\n      (shrink-window (- (window-height) candidate-window-height))\n      (switch-to-buffer candidate-buffer)\n      ;; make keymap for minibuffer\n      (suppress-keymap minibuffer-map t)\n      (define-key minibuffer-map \"\\C-m\" 'undefined)\n      (define-key minibuffer-map \"\\C-g\" 'abort-recursive-edit)\n      (mapc\n       (lambda (option-def)\n         (define-key minibuffer-map (car option-def) 'self-insert-and-exit))\n       option-defs)\n      ;; read key from minibuffer\n      (unwind-protect\n          (assoc\n           (read-from-minibuffer prompt nil minibuffer-map nil 'mini-hist)\n           option-defs)\n        (kill-buffer candidate-buffer)))))\n\n(defsubst elscreen-gf-run-search-command (command-name pattern command directory line-parser)\n  (put 'elscreen-gf-mode 'elscreen-gf-major-mode-thing\n       (or (get major-mode 'elscreen-gf-major-mode-thing) 'word))\n  (let ((invoke-point (cons (elscreen-get-current-screen) (point-marker))))\n    (elscreen-gf-goto-screen-create directory)\n    (setq elscreen-gf-pattern pattern)\n    (setq elscreen-gf-invoke-point invoke-point))\n  (let ((buffer-read-only nil))\n    (insert \"DIR: \" (abbreviate-file-name directory) \"\\n\"\n            \"CMD: \" command \" (reformatted by gf)\\n\\n\"))\n  (message \"Running %s...\" command-name)\n  (setq elscreen-gf-search-process\n        (start-process command-name (current-buffer)\n                       \"sh\" \"-c\" command \"2> /dev/null\"))\n  (process-put elscreen-gf-search-process\n               'elscreen-gf-search-line-parser line-parser)\n  (set-process-filter elscreen-gf-search-process 'elscreen-gf-search-filter)\n  (set-process-sentinel elscreen-gf-search-process 'elscreen-gf-search-sentinel))\n\n(defun elscreen-gf-search-filter (process string)\n  (set-buffer (process-buffer process))\n  (save-excursion\n    (let* ((string (concat elscreen-gf-filter-odd-string string))\n           (token-chars (or (elscreen-gf-major-mode-token-chars major-mode)\n                            \"a-zA-Z0-9\"))\n           (nontoken-chars (format \"[^%s]\" token-chars))\n           (line-parser (process-get process 'elscreen-gf-search-line-parser))\n           (buffer-read-only nil))\n      (goto-char (point-max))\n      (save-excursion (insert string))\n      (while (and (not (eobp)) (looking-at \".*\\n\"))\n        (beginning-of-line)\n        (let* ((line (buffer-substring (point-at-bol) (point-at-eol)))\n               (line-elms (funcall line-parser line))\n               (file-name (nth 0 line-elms))\n               (line-number (nth 1 line-elms))\n               (source (nth 2 line-elms))\n               start end)\n          (when line-elms\n            (delete-region (point-at-bol) (point-at-eol))\n            (elscreen-gf-overlay-create\n             (point) (progn (insert (file-relative-name file-name)) (point))\n             'elscreen-gf-mode-file-name-face)\n            (insert \":\")\n            (elscreen-gf-overlay-create\n             (point) (progn (insert line-number) (point))\n             'elscreen-gf-mode-line-number-face)\n            (insert \":\")\n            (save-excursion (insert (nth 0 source)))\n            (forward-char (nth 1 source))\n            (setq start (point) end (+ start (nth 2 source)))\n            (while (or (and (eq (point) start)\n                            (save-excursion\n                              (re-search-forward\n                               (format \"\\\\(%s\\\\)\\\\(%s\\\\|$\\\\)\"\n                                       elscreen-gf-pattern nontoken-chars)\n                               end t))\n                            (eq (match-beginning 1) start))\n                       (re-search-forward\n                        (format \"%s\\\\(%s\\\\)\\\\(%s\\\\|$\\\\)\"\n                                nontoken-chars elscreen-gf-pattern\n                                nontoken-chars)\n                        end t))\n              (elscreen-gf-overlay-create (match-beginning 1) (match-end 1)\n                                          'elscreen-gf-mode-pattern-face)\n              (goto-char (match-end 1)))))\n        (forward-line))\n      (setq elscreen-gf-filter-odd-string\n            (buffer-substring (point-at-bol) (point-at-eol)))\n      (delete-region (point-at-bol) (point-at-eol)))))\n\n(defun elscreen-gf-search-sentinel (process event)\n  (let ((status (string-match \"finished\" event)))\n    (message \"Running %s... done\" (process-name elscreen-gf-search-process))\n    (setq elscreen-gf-search-process nil)\n    (set-buffer (process-buffer process))\n    (elscreen-gf-mode-selected-entry-overlay)))\n\n;;; GNU grep\n\n(defun elscreen-gf-grep (&optional pattern file-name-re)\n  \"Run grep, with user-specified args, and collect output\nin the ElScreen-GF buffer.\"\n  (interactive)\n  (cond\n   ((not (executable-find elscreen-gf-grep-program-name))\n    (error \"grep not found.\"))\n   ((elscreen-gf-process-exclusive-p elscreen-gf-search-process)\n    (let* ((pattern (or pattern\n                        (elscreen-gf-search-read-pattern \"Run grep (pattern): \")))\n           (buffer-file-name (or (buffer-file-name) \"\"))\n           (file-name-re-default (concat\n                                  (file-name-directory buffer-file-name)\n                                  \"*\"\n                                  (when (file-name-extension buffer-file-name)\n                                    \".\")\n                                  (file-name-extension buffer-file-name)))\n           (file-name-re (or file-name-re\n                             (read-string\n                              \"Run grep (files): \"\n                              (cons file-name-re-default 0) nil \"*\")))\n           (token-chars (or (elscreen-gf-major-mode-token-chars major-mode)\n                            \"a-zA-Z0-9\"))\n           (token-chars-re (format \"[%s]\" token-chars))\n           (nontoken-chars-re (format \"[^%s]\" token-chars))\n           (pattern-tokenize (elscreen-gf-search-regexp-dot-to-token\n                              pattern token-chars-re))\n           (command (format \"%s -IHn %s %s\"\n                            elscreen-gf-grep-program-name\n                            (format \"'\\\\(^\\\\|%s\\\\)\\\\(%s\\\\)\\\\(%s\\\\|$\\\\)'\"\n                                    nontoken-chars-re\n                                    pattern-tokenize\n                                    nontoken-chars-re)\n                            file-name-re)))\n      (elscreen-gf-run-search-command\n       \"grep\" pattern-tokenize command default-directory\n       'elscreen-gf-grep-line-parser)))))\n\n(defun elscreen-gf-grep-line-parser (line)\n  (when (string-match \"^\\\\([^:\\n]+\\\\):\\\\([0-9]+\\\\):\\\\(.*\\\\)$\" line)\n    (let ((file-name (match-string 1 line))\n          (line-number (match-string 2 line))\n          (source (match-string 3 line)))\n      (list file-name line-number (list source 0 (length source))))))\n\n;;; GNU ID Utils\n\n(defsubst elscreen-gf-idutils-id-directory (&optional directory)\n  (elscreen-gf-db-directory \"ID\" directory))\n\n(defvar elscreen-gf-idutils-mkid-process nil)\n\n(defun elscreen-gf-idutils-mkid (&optional directory)\n  \"Run mkid, with user-specified args.\"\n  (interactive)\n  (cond\n   ((not (executable-find elscreen-gf-idutils-mkid-program-name))\n    (error \"mkid not found.\"))\n   ((elscreen-gf-process-exclusive-p elscreen-gf-idutils-mkid-process)\n    (let ((default-directory\n            (or (and directory (file-directory-p directory) directory)\n                (read-directory-name \"Run mkid (target): \"\n                                     (or (elscreen-gf-idutils-id-directory)\n                                         default-directory) nil t)))\n          (command (format \"%s\" elscreen-gf-idutils-mkid-program-name)))\n      (message \"Running mkid...\")\n      (setq elscreen-gf-idutils-mkid-process\n            (start-process \"mkid\" nil \"sh\" \"-c\" command))\n      (set-process-sentinel elscreen-gf-idutils-mkid-process\n                            'elscreen-gf-idutils-mkid-sentinel)\n      (elscreen-notify-screen-modification 'force-immediately)))))\n\n(defun elscreen-gf-idutils-mkid-sentinel (process event)\n  (let ((status (string-match \"finished\" event)))\n    (message \"Running mkid... %s\" (if status \"done\" \"error\"))\n    (setq elscreen-gf-idutils-mkid-process nil)\n    (elscreen-notify-screen-modification 'force-immediately)))\n\n(defun elscreen-gf-idutils-mkid-after-save ()\n  (when (and (buffer-file-name)\n             (elscreen-gf-process-exclusive-p\n              elscreen-gf-idutils-mkid-process 'noerror))\n    (let ((id-directory (elscreen-gf-idutils-id-directory)))\n      (when id-directory\n        (elscreen-gf-idutils-mkid id-directory)))))\n\n(defun elscreen-gf-idutils-mkid-setup-after-save-hook ()\n  (make-local-variable 'after-save-hook)\n  (add-hook 'after-save-hook 'elscreen-gf-idutils-mkid-after-save))\n\n(defun elscreen-gf-idutils-gid (&optional pattern)\n  \"Run gid, with user-specified args, and collect output\nin the ElScreen-GF buffer.\"\n  (interactive)\n  (cond\n   ((not (executable-find elscreen-gf-idutils-gid-program-name))\n    (when (yes-or-no-p \"gid not found; execute grep instead? \")\n      (elscreen-gf-grep)))\n   ((not (elscreen-gf-idutils-id-directory))\n    (funcall\n     (nth 2 (elscreen-gf-read-selection\n             \"Cannot locate `ID'; what instead?\"\n             \"Select action: \"\n             '((\"m\" \"Execute mkid to generate `ID'\" elscreen-gf-idutils-mkid)\n               (\"g\" \"Execute grep\" elscreen-gf-grep))))))\n   ((elscreen-gf-process-exclusive-p elscreen-gf-search-process)\n    (let* ((pattern (or pattern\n                        (elscreen-gf-search-read-pattern \"Run gid (pattern): \")))\n           (token-chars (or (elscreen-gf-major-mode-token-chars major-mode)\n                            \"a-zA-Z0-9\"))\n           (token-chars-re (format \"[%s]\" token-chars))\n           (pattern-tokenize (elscreen-gf-search-regexp-dot-to-token\n                              pattern token-chars-re))\n           (directory (elscreen-gf-idutils-id-directory))\n           (command (format \"%s --regexp '^(%s)$'\"\n                            elscreen-gf-idutils-gid-program-name pattern)))\n      ;; XXX: gid does not raise error even if given regexp starts with '*',\n      ;; so we should check it here.\n      (when (string-match \"^\\\\*\" pattern)\n        (error \"Invalid regexp: %s\" pattern))\n      (elscreen-gf-run-search-command\n       \"gid\" pattern-tokenize command directory\n       'elscreen-gf-grep-line-parser)))))\n\n;;; cscope\n\n(defsubst elscreen-gf-cscope-cross-ref-directory (&optional directory)\n  (elscreen-gf-db-directory \"cscope.out\" directory))\n\n(defun elscreen-gf-cscope (&optional pattern directory)\n  \"Run cscope, with user-specified args, and collect output\nin the ElScreen-GF buffer.\"\n  (interactive)\n  (cond\n   ((not (executable-find elscreen-gf-cscope-program-name))\n    (when (yes-or-no-p \"cscope not found; execute grep instead? \")\n      (elscreen-gf-grep)))\n   ((elscreen-gf-process-exclusive-p elscreen-gf-search-process)\n    (let* ((pattern (or pattern\n                        (elscreen-gf-search-read-pattern\n                         \"Run cscope (pattern): \")))\n           (directory (or (and directory (file-directory-p directory) directory)\n                          (elscreen-gf-cscope-cross-ref-directory)\n                          (read-directory-name \"Run cscope (target): \"\n                                               default-directory nil t)))\n           (token-chars (or (elscreen-gf-major-mode-token-chars major-mode)\n                            \"a-zA-Z0-9\"))\n           (token-chars-re (format \"[%s]\" token-chars))\n           (pattern-tokenize (elscreen-gf-search-regexp-dot-to-token\n                              pattern token-chars-re))\n           (query-type-def (elscreen-gf-read-selection\n                            \"Available query type for cscope: \"\n                            \"Select query type: \"\n                            '((\"0\" \"Find this C symbol\" 0)\n                              (\"1\" \"Find this function definition\" 1)\n                              (\"2\" \"Find functions calling this function\" 3))))\n           (query-type (nth 2 query-type-def))\n           (command (format \"%s -LR -%d '%s' | sort -k 1,1 -k 3,3n\"\n                            elscreen-gf-cscope-program-name query-type pattern))\n           (line-parser (intern\n                         (format \"elscreen-gf-cscope-line-parser-query-type-%s\"\n                                 (car query-type-def)))))\n      (elscreen-gf-run-search-command\n       \"cscope\" pattern-tokenize command directory line-parser)))))\n\n(defsubst elscreen-gf-cscope-line-parser-string-match (line)\n  (string-match \"^\\\\([^ ]+\\\\) \\\\([^ ]+\\\\) \\\\([0-9]+\\\\) \\\\(.*\\\\)$\" line))\n\n(defun elscreen-gf-cscope-line-parser-common (line)\n  (when (elscreen-gf-cscope-line-parser-string-match line)\n    (let ((file-name (match-string 1 line))\n          (line-number (match-string 3 line))\n          (function-name (match-string 2 line))\n          (source (match-string 4 line)))\n      (list file-name line-number\n            (list (format \"[%s] %s\" function-name source)\n                  (+ (length function-name) 3) (length source))))))\n\n(defalias 'elscreen-gf-cscope-line-parser-query-type-0\n  'elscreen-gf-cscope-line-parser-common)\n\n(defun elscreen-gf-cscope-line-parser-query-type-1 (line)\n  (when (elscreen-gf-cscope-line-parser-string-match line)\n    (let ((file-name (match-string 1 line))\n          (line-number (match-string 3 line))\n          (source (match-string 4 line)))\n      (list file-name line-number (list source 0 (length source))))))\n\n(defalias 'elscreen-gf-cscope-line-parser-query-type-2\n  'elscreen-gf-cscope-line-parser-common)\n\n;;; GNU global\n\n(defsubst elscreen-gf-global-tags-directory (&optional directory)\n  (elscreen-gf-db-directory \"GTAGS\" directory))\n\n(defvar elscreen-gf-global-gtags-process nil)\n\n(defun elscreen-gf-global-gtags (&optional directory)\n  \"Run gtags, with user-specified args.\"\n  (interactive)\n  (cond\n   ((not (executable-find elscreen-gf-global-gtags-program-name))\n    (error \"gtags not found.\"))\n   ((elscreen-gf-process-exclusive-p elscreen-gf-global-gtags-process)\n    (let ((default-directory\n            (or (and directory (file-directory-p directory) directory)\n                (read-directory-name \"Run gtags (target): \"\n                                     (or (elscreen-gf-global-tags-directory)\n                                         default-directory) nil t)))\n          (command (format \"%s\" elscreen-gf-global-gtags-program-name)))\n      (message \"Running gtags...\")\n      (setq elscreen-gf-global-gtags-process\n            (start-process \"gtags\" nil \"sh\" \"-c\" command))\n      (set-process-sentinel elscreen-gf-global-gtags-process\n                            'elscreen-gf-global-gtags-sentinel)\n      (elscreen-notify-screen-modification 'force-immediately)))))\n\n(defun elscreen-gf-global-gtags-sentinel (process event)\n  (let ((status (string-match \"finished\" event)))\n    (message \"Running gtags... %s\" (if status \"done\" \"error\"))\n    (setq elscreen-gf-global-gtags-process nil)\n    (elscreen-notify-screen-modification 'force-immediately)))\n\n(defun elscreen-gf-global-gtags-after-save ()\n  (when (and (buffer-file-name)\n             (elscreen-gf-process-exclusive-p\n              elscreen-gf-global-gtags-process 'noerror))\n    (let ((tags-directory (elscreen-gf-global-tags-directory)))\n      (when tags-directory\n        (elscreen-gf-global-gtags tags-directory)))))\n\n(defun elscreen-gf-global-gtags-setup-after-save-hook ()\n  (make-local-variable 'after-save-hook)\n  (add-hook 'after-save-hook 'elscreen-gf-global-gtags-after-save))\n\n(defvar elscreen-gf-global-5.0-or-later-p)\n(defsubst elscreen-gf-global-5.0-or-later-p ()\n  (unless (boundp 'elscreen-gf-global-5.0-or-later-p)\n    (let (global-version)\n      (with-temp-buffer\n        (call-process elscreen-gf-global-program-name nil t nil \"--version\")\n        (setq global-version (string-to-number\n                              (buffer-substring (point-min) (point-max)))))\n      (setq elscreen-gf-global-5.0-or-later-p (and global-version\n                                                   (<= 5.0 global-version)))))\n  elscreen-gf-global-5.0-or-later-p)\n\n(defun elscreen-gf-global (&optional pattern directory)\n  \"Run global, with user-specified args, and collect output\nin the ElScreen-GF buffer.\"\n  (interactive)\n  (cond\n   ((not (executable-find elscreen-gf-global-program-name))\n    (when (yes-or-no-p \"global not found; execute grep instead? \")\n      (elscreen-gf-grep)))\n   ((not (elscreen-gf-global-tags-directory))\n    (funcall\n     (nth 2 (elscreen-gf-read-selection\n             \"Cannot locate `GTAGS'; what instead?\"\n             \"Select action: \"\n             '((\"t\" \"Execute gtags to generate `GTAGS'\" elscreen-gf-global-gtags)\n               (\"g\" \"Execute grep\" elscreen-gf-grep))))))\n   ((elscreen-gf-process-exclusive-p elscreen-gf-search-process)\n    (let* ((pattern (or pattern\n                        (elscreen-gf-search-read-pattern\n                         \"Run global (pattern): \")))\n           (directory (or (and directory (file-directory-p directory) directory)\n                          (elscreen-gf-global-tags-directory)\n                          (read-directory-name \"Run global (target): \"\n                                               default-directory nil t)))\n           (token-chars (or (elscreen-gf-major-mode-token-chars major-mode)\n                            \"a-zA-Z0-9\"))\n           (token-chars-re (format \"[%s]\" token-chars))\n           (pattern-tokenize (elscreen-gf-search-regexp-dot-to-token\n                              pattern token-chars-re))\n           (query-type (nth 2 (elscreen-gf-read-selection\n                               \"Available query type for GNU GLOBAL: \"\n                               \"Select query type: \"\n                               '((\"0\" \"Find this object definition\" \"\")\n                                 (\"1\" \"Find this object references\" \" -r\")))))\n           (command (format\n                     (cond\n                      ((elscreen-gf-global-5.0-or-later-p)\n                       \"%s%s --result=grep -e '%s' | sort -t : -k 1,1 -k 2,2n\")\n                      (t\n                       \"%s -x%s -e '%s' | sort -k 3,3 -k 2,2n\"))\n                     elscreen-gf-global-program-name query-type pattern))\n           (line-parser (if (elscreen-gf-global-5.0-or-later-p)\n                            'elscreen-gf-grep-line-parser\n                          'elscreen-gf-global-line-parser)))\n      (elscreen-gf-run-search-command\n       \"global\" pattern-tokenize command directory line-parser)))))\n\n(defun elscreen-gf-global-line-parser (line)\n  (when (string-match \"^[^ ]+ +\\\\([0-9]+\\\\) +\\\\([^ ]+\\\\) \\\\(.*\\\\)$\" line)\n    (let ((file-name (match-string 2 line))\n          (line-number (match-string 1 line))\n          (source (match-string 3 line)))\n    (list file-name line-number (list source 0 (length source))))))\n\n;;; Going back to the latest invoke-point.\n\n(defun elscreen-gf-go-back-to-latest-invoke-point ()\n  (interactive)\n  (while (not (or (ring-empty-p elscreen-gf-invoke-point-history)\n                  (let ((invoke-point\n                         (ring-ref elscreen-gf-invoke-point-history 0)))\n                    (buffer-live-p (marker-buffer (cdr invoke-point))))))\n    (ring-remove elscreen-gf-invoke-point-history 0))\n  (if (ring-empty-p elscreen-gf-invoke-point-history)\n      (message \"No more invoke-points to go back to.\")\n    (let* ((invoke-point (ring-remove elscreen-gf-invoke-point-history 0))\n           (invoke-point-screen (car invoke-point))\n           (invoke-point-marker (cdr invoke-point))\n           (invoke-point-buffer (marker-buffer invoke-point-marker))\n           (invoke-point-position (marker-position invoke-point-marker))\n           (invoke-point-buffer-screen-list\n            (elscreen-find-screens\n             `(lambda (screen)\n                (elscreen-goto-internal screen)\n                (not (null (get-buffer-window ,invoke-point-buffer))))))\n           (get-marker-window\n            (lambda (marker)\n              (catch 'found\n                (save-window-excursion\n                  (mapc\n                   (lambda (window)\n                     (select-window window)\n                     (when (eq (point) (marker-position marker))\n                       (throw 'found window)))\n                   (get-buffer-window-list (marker-buffer marker))))\n                nil))))\n      (cond\n       ((null invoke-point-buffer-screen-list)\n        ;; No screens showing invoke-point-buffer, so create new screen\n        ;; and show it.\n        (elscreen-create)\n        (switch-to-buffer invoke-point-buffer)\n        (goto-char invoke-point-position))\n       ((memq invoke-point-screen invoke-point-buffer-screen-list)\n        ;; invoke-point-screen shows invoke-point-buffer, so go to the\n        ;; screen and select the window showing the buffer.  If there are\n        ;; two or more window showing the buffer, we prefer the window\n        ;; whose buffer's point is invoke-point-position.  Anyway,\n        ;; we are moving point to it.\n        (elscreen-goto invoke-point-screen)\n        (select-window (or (funcall get-marker-window invoke-point-marker)\n                           (get-buffer-window invoke-point-buffer)))\n        (goto-char invoke-point-position))\n       ((catch 'found\n          (mapc\n           (lambda (screen)\n             (let (window)\n               (when (save-window-excursion\n                       (elscreen-goto-internal screen)\n                       (setq window (funcall get-marker-window\n                                             invoke-point-marker)))\n                 ;; There is (at least one) screen showing buffer whose\n                 ;; point is invoke-point-position, so show it.\n                 (elscreen-goto screen)\n                 (select-window window)\n                 (throw 'found t))))\n           invoke-point-buffer-screen-list)))\n       (t\n        ;; invoke-point-screen does not show invoke-point-buffer, and\n        ;; the others does not show invoke-point-buffer whose point is\n        ;; invoke-point-position; so we're showing one of screens showing\n        ;; invoke-point-buffer and moving point to invoke-point-position.\n        (elscreen-goto (car invoke-point-buffer-screen-list))\n        (select-window (get-buffer-window invoke-point-buffer))\n        (goto-char invoke-point-position))))))\n\n;;; Help\n\n(defvar elscreen-gf-help \"ElScreen-GF keys:\n  \\\\[elscreen-gf-grep]    Run grep\n  \\\\[elscreen-gf-idutils-mkid]    Run mkid (GNU ID Utils)\n  \\\\[elscreen-gf-idutils-gid]    Run gid (GNU ID Utils)\n  \\\\[elscreen-gf-cscope]    Run cscope\n  \\\\[elscreen-gf-global-gtags]    Run gtags (GNU GLOBAL)\n  \\\\[elscreen-gf-global]    Run global (GNU GLOBAL)\n  \\\\[elscreen-gf-go-back-to-latest-invoke-point]    Go back to the latest invoke-point.\n  \\\\[elscreen-gf-display-version]    Display ElScreen-GF version\")\n(elscreen-set-help 'elscreen-gf-help)\n\n(defun elscreen-gf-display-version ()\n  \"Display ElScreen-GF version.\"\n  (interactive)\n  (elscreen-message (concat \"ElScreen-GF version \" elscreen-gf-version)))\n"
  },
  {
    "path": "elscreen-goby.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-goby.el \n;;\n(defconst elscreen-goby-version \"0.0.0 (July 14, 2005)\")\n;;\n;; Author:   Naoto Morishima <naoto@dl.naist.jp>\n;;              Nara Institute of Science and Technology, Japan\n;; Created:  July 14, 2005\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-goby)\n(require 'elscreen)\n\n\n;;; Code:\n\n(defadvice goby-view-mode (before elscreen-goby-view-mode activate)\n  (set (make-local-variable 'elscreen-display-tab) nil))\n\n(defadvice goby-view-quit (before elscreen-goby-view-quit activate)\n  (kill-local-variable 'elscreen-display-tab))\n"
  },
  {
    "path": "elscreen-howm.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-howm.el\n;;\n(defconst elscreen-howm-version \"0.1.3 (September 14, 2008)\")\n;;\n;; Author:   Naoto Morishima <naoto@morishima.net>\n;; Created:  November 06, 2005\n;; Revised:  September 14, 2008\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-howm)\n(require 'elscreen)\n\n;;; User Customizable Variables:\n\n(defcustom elscreen-howm-mode-to-nickname-alist\n  '((\"^howm-\\\\(menu-mode$\\\\|view-\\\\)\" . \"howm(menu)\"))\n  \"*Alist composed of the pair of mode-name and corresponding screen-name.\"\n  :type '(alist :key-type string :value-type (choice string function))\n  :tag \"Howm major-mode to nickname alist\"\n  :set (lambda (symbol value)\n         (custom-set-default symbol value)\n         (elscreen-rebuild-mode-to-nickname-alist))\n  :group 'howm)\n(elscreen-set-mode-to-nickname-alist 'elscreen-howm-mode-to-nickname-alist)\n\n(defcustom elscreen-howm-buffer-to-nickname-alist\n  '((\"\\\\.howm$\" . elscreen-howm-mode-buffer-to-nickname))\n  \"*Alist composed of the pair of regular expression of\nbuffer-name and corresponding screen-name.\"\n  :type '(alist :key-type string :value-type (choice string function))\n  :tag \"Howm buffer to nickname alist\"\n  :set (lambda (symbol value)\n         (custom-set-default symbol value)\n         (elscreen-rebuild-buffer-to-nickname-alist))\n  :group 'howm)\n(elscreen-set-buffer-to-nickname-alist 'elscreen-howm-buffer-to-nickname-alist)\n\n\n;;; Code:\n\n;; delete other windows when howm-menu is invoked\n(defadvice howm-menu (around elscreen-howm-menu activate)\n  (delete-other-windows)\n  ad-do-it)\n\n;; create new page with new screen\n(defadvice howm-create-file-with-title (around elscreen-howm-create-file-with-title activate)\n  (save-current-buffer\n    (elscreen-create))\n  ad-do-it)\n\n;; open existing page with new screen\n(defadvice howm-view-open-item (around elscreen-howm-view-open-item activate)\n  (let ((window-configuration (elscreen-current-window-configuration))\n        howm-item-buffer)\n    ad-do-it\n    (setq howm-item-buffer (current-buffer))\n    (elscreen-apply-window-configuration window-configuration)\n    (elscreen-find-and-goto-by-buffer howm-item-buffer 'create)))\n\n(eval-after-load \"howm-view\"\n  '(unless (fboundp 'howm-view-open-item)\n     (elscreen-message \"This version of elscreen-howm does not work well with your howm.  Upgrade howm to version 1.3.3 or later, or downgrade elscreen-howm to version 0.0.1.\")))\n\n;; screen nickname\n(defun elscreen-howm-mode-buffer-to-nickname ()\n  (format \"howm(%s%s%s)\"\n          elscreen-howm-title\n          (if (zerop (length elscreen-howm-title)) \"\" \":\")\n          (substring (buffer-name (current-buffer)) 0 -5)))\n\n(defun elscreen-howm-mode-update-title ()\n  (let ((title (howm-title-at-current-point)))\n    (when (not (string-equal elscreen-howm-title title))\n      (setq elscreen-howm-title title)\n      (elscreen-notify-screen-modification 'force-immediately))))\n\n(defun elscreen-howm-mode-initialize ()\n  (set (make-local-variable 'elscreen-howm-title)\n       (howm-title-at-current-point))\n  (add-hook 'post-command-hook 'elscreen-howm-mode-update-title t t))\n\n(add-hook 'howm-mode-on-hook 'elscreen-howm-mode-initialize)\n\n;; kill screen when exiting from howm-mode\n(defun howm-save-and-kill-buffer/screen ()\n  (interactive)\n  (let* ((file-name (buffer-file-name)))\n    (if (save-excursion\n          (goto-char (point-min))\n          (re-search-forward \"[^ \\t\\r\\n]\" nil t))\n        (howm-save-buffer)\n      (set-buffer-modified-p nil)\n      (when (file-exists-p file-name)\n        (delete-file file-name)\n        (message \"(Deleted %s)\" (file-name-nondirectory file-name))))\n    (kill-buffer nil)\n    (unless (elscreen-one-screen-p)\n      (elscreen-kill))))\n\n(eval-after-load \"howm-mode\"\n  '(progn\n     (define-key howm-mode-map\n       \"\\C-c\\C-c\" 'howm-save-and-kill-buffer/screen)))\n"
  },
  {
    "path": "elscreen-server.el",
    "content": ";;; elscreen-server.el --- server support for elscreen\n;;\n(defconst elscreen-server-version \"0.2.0 (November 23, 2007)\")\n;;\n;; Author:   Hideyuki Shirai <shirai@meadowy.org>\n;;           Naoto Morishima <naoto@morishima.net>\n;; Created:  October 11, 2007\n;; Revised:  November 23, 2007\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n;;; Commentary:\n\n;;; Code:\n\n(require 'elscreen)\n(require 'dframe)\n\n(defcustom elscreen-server-dont-use-dedicated-frame t\n  \"*Non-nil to use dframe-attached-frame if frame is dedicated.\"\n  :type 'boolean\n  :group 'server)\n\n(defun elscreen-server-visit-files-new-screen (buffer-list)\n  \"Create a screen for each buffer in BUFFER-LIST.\"\n  (let* ((selected-frame (selected-frame))\n         (dframe-attached-frame (dframe-attached-frame selected-frame)))\n    (when (and elscreen-server-dont-use-dedicated-frame\n               (framep dframe-attached-frame))\n      (select-frame dframe-attached-frame))\n    (let ((screen (car (mapcar\n                        (lambda (buffer)\n                          (elscreen-find-screen-by-buffer buffer 'create))\n                        buffer-list))))\n      (and screen\n           (elscreen-goto screen)))\n    (elscreen-notify-screen-modification 'force-immediately)\n    (select-frame selected-frame)))\n\n(eval-after-load \"server\"\n  ;; For server.el distributed with GNU Emacs\n  '(progn\n     (defadvice server-visit-files (after elscreen-server-visit-files activate)\n       (elscreen-server-visit-files-new-screen ad-return-value))))\n\n(provide 'elscreen-server)\n;;; elscreen-server.el ends here\n"
  },
  {
    "path": "elscreen-speedbar.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-speedbar.el\n;;\n(defconst elscreen-speedbar-version \"0.0.0 (November 18, 2007)\")\n;;\n;; Author:   Naoto Morishima <naoto@morishima.net>\n;; Created:  November 18, 2007\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-speedbar)\n(require 'elscreen)\n\n(defcustom elscreen-speedbar-find-file-in-screen t\n  \"Non-nil to use ElScreen to open file when the selected file is being\nopened in the attached frame.\"\n  :type 'boolean\n  :group 'speedbar)\n\n(defadvice speedbar-frame-mode (after elscreen-speedbar-frame-mode activate)\n  (with-current-buffer speedbar-buffer\n    (set (make-local-variable 'elscreen-display-tab) nil)))\n\n(defadvice speedbar-find-file-in-frame (around elscreen-speedbar-find-file-in-frame activate)\n  (let ((buffer (find-file-noselect file)))\n    (if (or (get-buffer-window buffer 0)\n            dframe-power-click\n            (numberp speedbar-select-frame-method)\n            (not elscreen-speedbar-find-file-in-screen))\n        (let ((dframe-power-click (and (not elscreen-speedbar-find-file-in-screen)\n                                       dframe-power-click)))\n          ad-do-it)\n      (dframe-select-attached-frame speedbar-frame)\n      (elscreen-find-and-goto-by-buffer buffer 'create))\n    (elscreen-notify-screen-modification 'force-immediately)))\n"
  },
  {
    "path": "elscreen-w3m.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-w3m.el\n;;\n(defconst elscreen-w3m-version \"0.2.2 (July 26, 2006)\")\n;;\n;; Author:   Naoto Morishima <naoto@morishima.net>\n;; Created:  August 6, 2004\n;; Revised:  July 26, 2006\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-w3m)\n(require 'elscreen)\n\n;; Code:\n\n(defconst elscreen-w3m-mode-to-nickname-alist\n  '((\"^w3m-mode\" .\n     (lambda (buf)\n       (with-current-buffer buf\n         (let ((graphic (and window-system\n                             w3m-show-graphic-icons-in-header-line)))\n           (concat\n            (when (and graphic w3m-use-favicon w3m-favicon-image)\n              (concat\n               (propertize\n                \" \"\n                'display w3m-favicon-image)\n               (propertize\n                \" \"\n                'display '(space :width 0.5))))\n            (w3m-current-title)))))))\n  \"*Alist composed of the pair of mode-name and corresponding screen-name.\")\n(elscreen-set-mode-to-nickname-alist 'elscreen-w3m-mode-to-nickname-alist)\n\n(defun elscreen-w3m-mailto-url-popup-function (buffer)\n  (elscreen-find-and-goto-by-buffer buffer 'create))\n\n(defadvice w3m-copy-buffer (around elscreen-w3m-copy-buffer activate)\n  (let ((current-buffer (current-buffer)))\n    (if (< (elscreen-get-number-of-screens) 10)\n        (elscreen-create)\n      (split-window)\n      (other-window 1))\n    (unless (ad-get-arg 0)\n      (ad-set-arg 0 current-buffer))\n    ad-do-it))\n\n(defadvice w3m-favicon-retrieve (around elscreen-w3m-favicon-retrieve activate)\n  ad-do-it\n  (run-at-time 1 nil 'elscreen-notify-screen-modification 'force-immediately))\n\n(defun elscreen-w3m-initialize ()\n  (setq w3m-pop-up-frames nil)\n  (setq w3m-pop-up-windows nil)\n  (setq w3m-use-tab nil)\n  (setq w3m-use-tab-menubar nil)\n  (setq w3m-use-header-line nil)\n  (setq w3m-mailto-url-popup-function-alist\n        '((cmail-mail-mode . elscreen-w3m-mailto-url-popup-function)\n          (mail-mode . elscreen-w3m-mailto-url-popup-function)\n          (message-mode . elscreen-w3m-mailto-url-popup-function)\n          (mew-draft-mode . elscreen-w3m-mailto-url-popup-function)\n          (mh-letter-mode . elscreen-w3m-mailto-url-popup-function)\n          (wl-draft-mode . elscreen-w3m-mailto-url-popup-function)))\n  (elscreen-screen-modified-hook-setup\n   (w3m-fontify-after-hook 'force-immediately)))\n\n(add-hook 'w3m-load-hook 'elscreen-w3m-initialize)\n"
  },
  {
    "path": "elscreen-wl.el",
    "content": ";; -*- Mode: Emacs-Lisp -*-\n;;\n;; elscreen-wl.el\n;;\n(defconst elscreen-wl-version \"0.8.0 (November 03, 2007)\")\n;;\n;; Author:   Naoto Morishima <naoto@morishima.net>\n;; Created:  March 24, 2001\n;; Revised:  November 03, 2007\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n\n(provide 'elscreen-wl)\n(require 'elscreen)\n(require 'wl)\n\n\n;;; User Customizable Variables:\n\n(defcustom elscreen-wl-draft-use-elscreen t\n  \"Non-nil to use ElScreen when Wanderlust prepares draft buffer.\nThis option will override the option `wl-draft-use-frame'.\"\n  :type 'boolean\n  :group 'wl-draft)\n\n(defcustom elscreen-wl-display-biff-on-tab t\n  \"Non-nil to use ElScreen's tab to display biff icon instead of\nmode-line.\"\n  :type 'boolean\n  :set (lambda (symbol value)\n         (custom-set-default symbol value)\n         (let ((buf (get-buffer wl-folder-buffer-name)))\n           (when buf\n             (with-current-buffer buf\n               (wl-mode-line-buffer-identification))))\n         (elscreen-notify-screen-modification 'force-immediately))\n  :group 'wl-highlight)\n\n(defcustom elscreen-wl-mode-to-nickname-alist\n  '((\"^wl-folder-mode$\" . (lambda (buf)\n                            (elscreen-wl-nickname-with-biff-status \"Folder\")))\n    (\"^wl-summary-mode$\" . (lambda (buf)\n                             (elscreen-wl-nickname-with-biff-status\n                              (wl-summary-buffer-folder-name))))\n    (\"^wl-draft-mode$\" . (lambda (buf)\n                           (let ((buffer-name (buffer-name))\n                                 (subject (std11-field-body \"Subject\")))\n                             (format \"WL(%s%s)\"\n                                     buffer-name\n                                     (if (zerop (length subject))\n                                         \"\"\n                                       (concat \"[\" subject \"]\"))))))\n    (\"^wl-\" . \"Wanderlust\"))\n  \"*Alist composed of the pair of mode-name and corresponding screen-name.\"\n  :type '(alist :key-type string :value-type (choice string function))\n  :tag \"Wanderlust major-mode to screen nickname alist\"\n  :set (lambda (symbol value)\n         (custom-set-default symbol value)\n         (elscreen-rebuild-mode-to-nickname-alist))\n  :group 'wl)\n(elscreen-set-mode-to-nickname-alist 'elscreen-wl-mode-to-nickname-alist)\n\n\n;;; Code:\n\n(defmacro elscreen-wl-draft-create-buffer (ad-do-it)\n  `(let ((wl-draft-use-frame wl-draft-use-frame)\n         (wl-draft-reply-buffer-style wl-draft-reply-buffer-style))\n     (when elscreen-wl-draft-use-elscreen\n       (setq wl-draft-use-frame nil)\n       (setq wl-draft-reply-buffer-style 'full)\n       (elscreen-create))\n     ,ad-do-it\n     (when elscreen-wl-draft-use-elscreen\n       (make-local-variable 'kill-buffer-hook)\n       (add-hook 'kill-buffer-hook\n                 (lambda ()\n                   (when `(buffer-live-p ,(current-buffer))\n                     (elscreen-kill)))))))\n\n(defadvice wl-draft-create-buffer (around\n                                   elscreen-ad-wl-draft-create-buffer\n                                   activate)\n  (elscreen-wl-draft-create-buffer ad-do-it))\n\n(defadvice wl-draft-reedit (around\n                            elscreen-ad-wl-draft-reedit\n                            activate)\n  (elscreen-wl-draft-create-buffer ad-do-it))\n\n(defadvice wl-jump-to-draft-buffer (around\n                                    elscreen-ad-wl-jump-to-draft-screen\n                                    activate)\n  (let ((original-buffer (current-buffer))\n        draft-buffer)\n    ad-do-it\n    (when elscreen-wl-draft-use-elscreen\n      (setq draft-buffer (current-buffer))\n      (if (not (eq original-buffer draft-buffer))\n          (progn\n            (switch-to-buffer original-buffer)\n            (elscreen-find-and-goto-by-buffer draft-buffer))))))\n\n(defmacro elscreen-wl-compensate-summary-window (ad-do-it)\n  `(let ((wl-draft-use-frame (or wl-draft-use-frame\n                                 elscreen-wl-draft-use-elscreen)))\n     ,ad-do-it))\n\n(defadvice wl-draft-forward (around elscreen-ad-wl-draft-forward activate)\n  (elscreen-wl-compensate-summary-window ad-do-it))\n\n(defadvice wl-draft-reply (around elscreen-ad-wl-draft-forward activate)\n  (elscreen-wl-compensate-summary-window ad-do-it))\n\n;; Biff on ElScreen's tab\n\n(defsubst elscreen-wl-nickname-with-biff-status (name)\n  (concat\n   (when (and wl-biff-check-folder-list elscreen-wl-display-biff-on-tab)\n     (concat\n      (if wl-modeline-biff-status\n          wl-modeline-biff-state-on\n        wl-modeline-biff-state-off)\n      (propertize \" \" 'display '(space :width 0.5))))\n   (format \"WL(%s)\" name)))\n\n(add-hook 'wl-biff-notify-hook\n          (lambda ()\n            (when elscreen-wl-display-biff-on-tab\n              (setq wl-modeline-biff-status t)\n              (elscreen-notify-screen-modification 'force-immediately))))\n\n(add-hook 'wl-biff-unnotify-hook\n          (lambda ()\n            (when elscreen-wl-display-biff-on-tab\n              (setq wl-modeline-biff-status nil)\n              (elscreen-notify-screen-modification 'force-immediately))))\n\n(defadvice wl-mode-line-buffer-identification (around elscreen-wl-mode-line-buffer-identification activate)\n  (let ((wl-biff-check-folder-list wl-biff-check-folder-list))\n    (when elscreen-wl-display-biff-on-tab\n      (setq wl-biff-check-folder-list nil))\n    ad-do-it))\n"
  },
  {
    "path": "elscreen.el",
    "content": ";;; elscreen.el --- Emacs window session manager\n\n;; Author: Naoto Morishima <naoto@morishima.net>\n;; Based on: screens.el\n;;              by Heikki T. Suopanki <suopanki@stekt1.oulu.fi>\n;; Created:  June 22, 1996\n;; Revised:  April 11, 2012 by Emanuel Evans\n;; Maintainer: Akinori MUSHA <knu@iDaemons.org>\n;; Homepage: https://github.com/knu/elscreen\n;; Version:  20180321\n;; Package-Requires: ((emacs \"24\"))\n;; Keywords: window, convenience\n\n;; This file is NOT part of GNU Emacs.\n\n;;; License:\n\n;; This program is free software; you can redistribute it and/or modify\n;; it under the terms of the GNU General Public License as published by\n;; the Free Software Foundation; either version 2, or (at your option)\n;; any later version.\n;;\n;; This program is distributed in the hope that it will be useful,\n;; but WITHOUT ANY WARRANTY; without even the implied warranty of\n;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;; GNU General Public License for more details.\n;;\n;; You should have received a copy of the GNU General Public License\n;; along with this program; see the file COPYING.  If not, write to\n;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,\n;; USA.\n\n;;; Commentary:\n\n;; This is a fork of ElScreen designed to be installed with\n;; package.el.  It does not require APEL (it also probably does not\n;; work with XEmacs).  In order to start using ElScreen, add\n;; (elscreen-start) to your emacs configuration.  For help on how to\n;; use elscreen, try \\C-z ?.\n\n;;; Code:\n\n;;; User Customizable Variables:\n\n(require 'dired)\n\n(declare-function iswitchb-read-buffer \"iswitchb\")\n\n(defconst elscreen-version \"20180321\")\n\n(defgroup elscreen nil\n  \"ElScreen -- Screen Manager for Emacs\"\n  :tag \"ElScreen\"\n  :group 'environment)\n\n(defcustom elscreen-prefix-key \"\\C-z\"\n  \"*Prefix key for ElScreen commands.\"\n  :tag \"Prefix Key of ElScreen\"\n  :type '(string :size 10)\n  :set (lambda (symbol value)\n         (when (boundp 'elscreen-map)\n           (elscreen-set-prefix-key value))\n         (custom-set-default symbol value))\n  :group 'elscreen)\n\n(defcustom elscreen-default-buffer-name \"*scratch*\"\n  \"*Name of a buffer in new screen.\"\n  :tag \"Name of Default Buffer\"\n  :type '(string :size 24)\n  :group 'elscreen)\n\n(defcustom elscreen-default-buffer-initial-major-mode initial-major-mode\n  \"*Major mode command symbol to use for the default buffer.\"\n  :tag \"Major Mode for Default Buffer\"\n  :type 'function\n  :group 'elscreen)\n\n(defcustom elscreen-default-buffer-initial-message initial-scratch-message\n  \"*Initial message displayed in default buffer.\nIf this is nil, no message will be displayed.\"\n  :tag \"Message to Display in the Default Buffer\"\n  :type '(choice (text :tag \"Message\")\n                 (const :tag \"none\" nil))\n  :group 'elscreen)\n\n(defcustom elscreen-mode-to-nickname-alist\n  '((\"^dired-mode$\" .\n     (lambda ()\n       (format \"Dired(%s)\" dired-directory)))\n    (\"^Info-mode$\" .\n     (lambda ()\n       (format \"Info(%s)\" (file-name-nondirectory Info-current-file))))\n    (\"^mew-draft-mode$\" .\n     (lambda ()\n       (format \"Mew(%s)\" (buffer-name (current-buffer)))))\n    (\"^mew-\" . \"Mew\")\n    (\"^irchat-\" . \"IRChat\")\n    (\"^liece-\" . \"Liece\")\n    (\"^lookup-\" . \"Lookup\"))\n  \"*Alist composed of the pair of name of major-mode and corresponding screen-name.\"\n  :tag \"Alist to Derive Screen Names from Major Modes\"\n  :type '(alist :key-type string :value-type (choice string function))\n  :set (lambda (symbol value)\n         (custom-set-default symbol value)\n         (when (fboundp 'elscreen-rebuild-mode-to-nickname-alist)\n           (elscreen-rebuild-mode-to-nickname-alist)))\n  :group 'elscreen)\n\n(defcustom elscreen-buffer-to-nickname-alist\n  '((\"[Ss]hell\" . \"shell\")\n    (\"compilation\" . \"compile\")\n    (\"-telnet\" . \"telnet\")\n    (\"dict\" . \"OnlineDict\")\n    (\"*WL:Message*\" . \"Wanderlust\"))\n  \"*Alist composed of the pair of regular expression of\nbuffer-name and corresponding screen-name.\"\n  :tag \"Alist to Derive Screen Names from Major Modes\"\n  :type '(alist :key-type string :value-type (choice string function))\n  :set (lambda (symbol value)\n         (custom-set-default symbol value)\n         (when (fboundp 'elscreen-rebuild-buffer-to-nickname-alist)\n           (elscreen-rebuild-buffer-to-nickname-alist)))\n  :group 'elscreen)\n\n(defcustom elscreen-display-screen-number t\n  \"*Non-nil to display the number of current screen in the mode line.\"\n  :tag \"Show/Hide Screen Number on the mode-line\"\n  :type 'boolean\n  :group 'elscreen)\n\n(defcustom elscreen-display-tab t\n  \"*Specify how the tabs at the top of frame should be displayed.\nt means to display tabs whose width should be calculated automatically.\nA value of integer means to display tabs with fixed width of this value.\nnil means don't display tabs.\"\n  :tag \"Specify how the tabs at the top of frame should be displayed\"\n  :type '(choice (const :tag \"Show (automatic width tab)\" t)\n                 (integer :tag \"Show (fixed width tab)\" :size 4 :value 16)\n                 (const :tag \"Hide\" nil))\n  :set (lambda (symbol value)\n         (when (or (booleanp value)\n                   (and (numberp value)\n                        (> value 0)))\n           (custom-set-default symbol value)\n           (when (fboundp 'elscreen-tab-update)\n             (elscreen-tab-update t))))\n  :group 'elscreen)\n\n(make-obsolete-variable 'elscreen-tab-display-create-screen\n                        'elscreen-tab-display-control \"2012-04-11\")\n(defcustom elscreen-tab-display-control t\n  \"*Non-nil to display control tab at the most left side.\"\n  :tag \"Show/Hide the Control Tab\"\n  :type 'boolean\n  :set (lambda (symbol value)\n         (custom-set-default symbol value)\n         (when (fboundp 'elscreen-tab-update)\n           (elscreen-tab-update t)))\n  :group 'elscreen)\n\n(defcustom elscreen-tab-display-kill-screen 'left\n  \"*Location of the icons to kill a screen on each tab.  Possible values are 'left, 'right, or nil (to hide them).\"\n  :tag \"Location of Buttons to Kill Screen on Each Tab\"\n  :type '(choice (const :tag \"Left\" left)\n                 (const :tag \"Right\" right)\n                 (const :tag \"None\" nil))\n  :set (lambda (symbol value)\n         (custom-set-default symbol value)\n         (when (fboundp 'elscreen-tab-update)\n           (elscreen-tab-update t)))\n  :group 'elscreen)\n\n(defface elscreen-tab-background-face\n  '((((type x w32 mac ns) (class color))\n     :background \"Gray50\")\n    (((class color))\n     (:background \"black\")))\n  \"Face to fontify background of tab line.\"\n  :group 'elscreen)\n\n(defface elscreen-tab-control-face\n  '((((type x w32 mac ns) (class color))\n     (:background \"white\" :foreground \"black\" :underline \"Gray50\"))\n    (((class color))\n     (:background \"white\" :foreground \"black\" :underline t))\n    (t (:underline t)))\n  \"Face for control tab.\"\n  :group 'elscreen)\n\n(defface elscreen-tab-current-screen-face\n  '((((class color))\n     (:background \"white\" :foreground \"black\"))\n    (t (:underline t)))\n  \"Face for current screen tab.\"\n  :group 'elscreen)\n\n(defface elscreen-tab-other-screen-face\n  '((((type x w32 mac ns) (class color))\n     :background \"Gray85\" :foreground \"Gray50\")\n    (((class color))\n     (:background \"blue\" :foreground \"black\" :underline t)))\n  \"Face for tabs other than current screen one.\"\n  :group 'elscreen)\n\n\n;;; Key & Menu bindings:\n\n(defvar elscreen-map (make-sparse-keymap)\n  \"Keymap for ElScreen.\")\n(define-key elscreen-map \"\\C-c\" 'elscreen-create)\n(define-key elscreen-map \"c\"    'elscreen-create)\n(define-key elscreen-map \"C\"    'elscreen-clone)\n(define-key elscreen-map \"\\C-k\" 'elscreen-kill)\n(define-key elscreen-map \"k\"    'elscreen-kill)\n(define-key elscreen-map \"\\M-k\" 'elscreen-kill-screen-and-buffers)\n(define-key elscreen-map \"K\"    'elscreen-kill-others)\n(define-key elscreen-map \"\\C-p\" 'elscreen-previous)\n(define-key elscreen-map \"p\"    'elscreen-previous)\n(define-key elscreen-map \"\\C-n\" 'elscreen-next)\n(define-key elscreen-map \"n\"    'elscreen-next)\n(define-key elscreen-map \"\\C-a\" 'elscreen-toggle)\n(define-key elscreen-map \"a\"    'elscreen-toggle)\n(define-key elscreen-map \"'\"    'elscreen-goto)\n(define-key elscreen-map \"\\\"\"   'elscreen-select-and-goto)\n(define-key elscreen-map \"0\"    'elscreen-jump-0)\n(define-key elscreen-map \"1\"    'elscreen-jump)\n(define-key elscreen-map \"2\"    'elscreen-jump)\n(define-key elscreen-map \"3\"    'elscreen-jump)\n(define-key elscreen-map \"4\"    'elscreen-jump)\n(define-key elscreen-map \"5\"    'elscreen-jump)\n(define-key elscreen-map \"6\"    'elscreen-jump)\n(define-key elscreen-map \"7\"    'elscreen-jump)\n(define-key elscreen-map \"8\"    'elscreen-jump)\n(define-key elscreen-map \"9\"    'elscreen-jump-9)\n(define-key elscreen-map \"\\C-s\" 'elscreen-swap)\n(define-key elscreen-map \"\\C-w\" 'elscreen-display-screen-name-list)\n(define-key elscreen-map \"w\"    'elscreen-display-screen-name-list)\n(define-key elscreen-map \"\\C-m\" 'elscreen-display-last-message)\n(define-key elscreen-map \"m\"    'elscreen-display-last-message)\n(define-key elscreen-map \"\\C-t\" 'elscreen-display-time)\n(define-key elscreen-map \"t\"    'elscreen-display-time)\n(define-key elscreen-map \"A\"    'elscreen-screen-nickname)\n(define-key elscreen-map \"b\"    'elscreen-find-and-goto-by-buffer)\n(define-key elscreen-map \"\\C-f\" 'elscreen-find-file)\n(define-key elscreen-map \"\\C-r\" 'elscreen-find-file-read-only)\n(define-key elscreen-map \"d\"    'elscreen-dired)\n(define-key elscreen-map \"\\M-x\" 'elscreen-execute-extended-command)\n(define-key elscreen-map \"i\"    'elscreen-toggle-display-screen-number)\n(define-key elscreen-map \"T\"    'elscreen-toggle-display-tab)\n(define-key elscreen-map \"?\"    'elscreen-help)\n(define-key elscreen-map \"v\"    'elscreen-display-version)\n(define-key elscreen-map \"j\"    'elscreen-link)\n(define-key elscreen-map \"s\"    'elscreen-split)\n\n(defun elscreen-set-prefix-key (prefix-key)\n  (when (not (eq elscreen-prefix-key prefix-key))\n    (when elscreen-prefix-key\n      (global-set-key elscreen-prefix-key\n                      (get 'elscreen-prefix-key\n                           'global-map-original-definition))\n      (define-key minibuffer-local-map elscreen-prefix-key\n        (get 'elscreen-prefix-key 'minibuffer-local-map-original-definition)))\n    (put 'elscreen-prefix-key 'global-map-original-definition\n         (lookup-key global-map prefix-key))\n    (put 'elscreen-prefix-key 'minibuffer-local-map-original-definition\n         (lookup-key minibuffer-local-map prefix-key)))\n  (global-set-key prefix-key elscreen-map)\n  (define-key minibuffer-local-map prefix-key 'undefined)\n  (setq elscreen-prefix-key prefix-key))\n\n(defvar elscreen-help \"ElScreen keys:\n  \\\\[elscreen-create]    Create a new screen and switch to it\n  \\\\[elscreen-clone]    Create a new screen with the window-configuration of current screen\n  \\\\[elscreen-kill]    Kill current screen\n  \\\\[elscreen-kill-screen-and-buffers]  Kill current screen and buffers\n  \\\\[elscreen-kill-others]    Kill other screens\n  \\\\[elscreen-next]    Switch to the \\\"next\\\" screen in a cyclic order\n  \\\\[elscreen-previous]    Switch to the \\\"previous\\\" screen in a cyclic order\n  \\\\[elscreen-toggle]    Toggle to the screen selected previously\n  \\\\[elscreen-select-and-goto]    Jump to the specified screen\n  \\\\[elscreen-jump-0]\n    :      Jump to the screen #\n  \\\\[elscreen-jump-9]\n  \\\\[elscreen-swap]  Swap current screen with previous one\n  \\\\[elscreen-display-screen-name-list]    Show list of screens\n  \\\\[elscreen-screen-nickname]    Name current screen\n  \\\\[elscreen-display-last-message]    Show last message\n  \\\\[elscreen-display-time]    Show time\n  \\\\[elscreen-find-and-goto-by-buffer]    Switch to the screen in which specified buffer is displayed\n  \\\\[elscreen-find-file]  Create new screen and open file\n  \\\\[elscreen-find-file-read-only]  Create new screen and open file but don't allow changes\n  \\\\[elscreen-dired]    Create new screen and run dired\n  \\\\[elscreen-execute-extended-command]  Read function name, then call it with new screen\n  \\\\[elscreen-toggle-display-screen-number]    Show/hide the screen number in the mode line\n  \\\\[elscreen-toggle-display-tab]    Show/hide the tab at the top of screen\n  \\\\[elscreen-display-version]    Show ElScreen version\n  \\\\[elscreen-help]    Show this help\"\n  \"Help shown by elscreen-help-mode\")\n\n;;; alist utility functions (taken from APEL):\n\n(defun elscreen--put-alist (key value alist)\n  \"Set cdr of an element (KEY . ...) in ALIST to VALUE and return ALIST.\nIf there is no such element, create a new pair (KEY . VALUE) and\nreturn a new alist whose car is the new pair and cdr is ALIST.\"\n  (let ((elm (assoc key alist)))\n    (if elm\n        (progn\n          (setcdr elm value)\n          alist)\n      (cons (cons key value) alist))))\n\n(defun elscreen--set-alist (symbol key value)\n  \"Set cdr of an element (KEY . ...) in the alist bound to SYMBOL to VALUE.\"\n  (or (boundp symbol)\n      (set symbol nil))\n  (set symbol (elscreen--put-alist key value (symbol-value symbol))))\n\n(defun elscreen--del-alist (key alist)\n  \"Delete an element whose car equals KEY from ALIST.\nReturn the modified ALIST.\"\n  (let ((pair (assoc key alist)))\n    (if pair\n        (delq pair alist)\n      alist)))\n\n(defun elscreen-window-history-supported-p ()\n  (and (fboundp 'window-prev-buffers)\n       (fboundp 'window-next-buffers)\n       (fboundp 'set-window-prev-buffers)\n       (fboundp 'set-window-next-buffers)))\n\n(defun elscreen-get-all-window-history-alist ()\n  (when (elscreen-window-history-supported-p)\n    (mapcar (lambda (window)\n              (let ((prevs (window-prev-buffers window))\n                    (nexts (window-next-buffers window)))\n                (cons window (cons prevs nexts))))\n            (window-list))))\n\n(defun elscreen-restore-all-window-history-alist (history-alist)\n  (when (elscreen-window-history-supported-p)\n    (mapc (lambda (entry)\n            (let* ((window (car entry))\n                   (histories (cdr entry))\n                   (prevs (car histories))\n                   (nexts (cdr histories)))\n              (when (window-valid-p window)\n                (set-window-prev-buffers window prevs)\n                (set-window-next-buffers window nexts))))\n          history-alist)))\n\n(defun elscreen--remove-alist (symbol key)\n  \"Delete an element whose car equals KEY from the alist bound to SYMBOL.\"\n  (and (boundp symbol)\n       (set symbol (elscreen--del-alist key (symbol-value symbol)))))\n\n;;; Internal Functions:\n\n(defvar elscreen-frame-confs nil\n  \"Alist that contains the information about screen configurations.\")\n\n(defun elscreen-current-window-configuration ()\n  (list (current-window-configuration) (point-marker)))\n\n(defun elscreen-default-window-configuration ()\n  (let ((default-buffer (get-buffer elscreen-default-buffer-name)))\n    (save-window-excursion\n      (set-window-dedicated-p (selected-window) nil)\n      (delete-other-windows)\n      (if default-buffer\n          (switch-to-buffer default-buffer)\n        (switch-to-buffer (get-buffer-create elscreen-default-buffer-name))\n        (funcall elscreen-default-buffer-initial-major-mode)\n        (insert elscreen-default-buffer-initial-message)\n        (set-buffer-modified-p nil))\n      (elscreen-current-window-configuration))))\n\n(defun elscreen-apply-window-configuration (elscreen-window-configuration)\n  (let ((window-configuration (car elscreen-window-configuration))\n        (marker (cadr elscreen-window-configuration)))\n    (set-window-configuration window-configuration)\n    (when (marker-buffer marker)\n      (goto-char marker))))\n\n(defsubst elscreen-copy-tree (tree)\n  (if (fboundp 'copy-tree)\n      (copy-tree tree)\n    (elscreen-copy-tree-1 tree)))\n\n(defun elscreen-copy-tree-1 (tree)\n  (let (clone)\n    (while (consp tree)\n      (setq clone (cons (or (and (consp (car tree))\n                                 (elscreen-copy-tree-1 (car tree)))\n                            (car tree))\n                        clone))\n      (setq tree (cdr tree)))\n    (nconc (nreverse clone) tree)))\n\n(defmacro elscreen-save-screen-excursion (&rest body)\n  \"Execute BODY, preserving ElScreen meta data.\nReturn the value of the last form in BODY.\"\n  `(let ((original-buffer-list (buffer-list))\n         (original-buffer-live-p nil)\n         (original-elscreen-window-configuration\n          (elscreen-current-window-configuration))\n         (original-frame-confs (elscreen-copy-tree elscreen-frame-confs))\n         (original-window-histories (elscreen-get-all-window-history-alist)))\n     (unwind-protect\n         (save-window-excursion ,@body)\n       (setq elscreen-frame-confs original-frame-confs)\n       (elscreen-apply-window-configuration\n        original-elscreen-window-configuration)\n       (mapc\n        (lambda (buffer)\n          (when (buffer-live-p buffer)\n            (bury-buffer buffer)\n            (setq original-buffer-live-p t)))\n        original-buffer-list)\n       (when original-buffer-live-p\n         (while (not (memq (car (buffer-list)) original-buffer-list))\n           (bury-buffer (car (buffer-list)))))\n       (elscreen-restore-all-window-history-alist original-window-histories))))\n\n(defsubst elscreen-get-frame-confs (frame)\n  (assoc-default frame elscreen-frame-confs))\n\n(defun elscreen-make-frame-confs (frame &optional keep-window-configuration)\n  (when (null (elscreen-get-frame-confs frame))\n    (let ((selected-frame (selected-frame))\n          elscreen-window-configuration)\n      (save-current-buffer\n        (select-frame frame)\n        (setq elscreen-window-configuration\n              (if keep-window-configuration\n                  (elscreen-current-window-configuration)\n                (elscreen-default-window-configuration)))\n        (elscreen--set-alist 'elscreen-frame-confs frame\n                   (list\n                    (cons 'screen-property\n                          (list\n                           (cons 0 (list\n                                    (cons 'window-configuration\n                                          elscreen-window-configuration)))))\n                    (cons 'screen-history (list 0))\n                    (cons 'modified-inquirer nil)\n                    (cons 'screen-to-name-alist-cache nil)))\n        (elscreen-apply-window-configuration elscreen-window-configuration)\n        (elscreen-notify-screen-modification 'force-immediately)\n        (select-frame selected-frame)))))\n\n(defun elscreen-delete-frame-confs (frame)\n  (elscreen--remove-alist 'elscreen-frame-confs frame))\n\n(add-hook 'after-make-frame-functions 'elscreen-make-frame-confs)\n(add-hook 'delete-frame-functions 'elscreen-delete-frame-confs)\n\n(defsubst elscreen-get-conf-list (type)\n  (assoc-default type (elscreen-get-frame-confs (selected-frame))))\n\n(defsubst elscreen-set-conf-list (type conf-list)\n  (let ((frame-conf (elscreen-get-frame-confs (selected-frame))))\n    (elscreen--set-alist 'frame-conf type conf-list)))\n\n(defun elscreen-get-screen-property (screen)\n  (let ((screen-property-list (elscreen-get-conf-list 'screen-property)))\n    (assoc-default screen screen-property-list)))\n\n(defun elscreen-set-screen-property (screen property)\n  (let ((screen-property-list (elscreen-get-conf-list 'screen-property)))\n    (elscreen--set-alist 'screen-property-list screen property)\n    (elscreen-set-conf-list 'screen-property screen-property-list)))\n\n(defun elscreen-delete-screen-property (screen)\n  (let ((screen-property-list (elscreen-get-conf-list 'screen-property)))\n    (elscreen--remove-alist 'screen-property-list screen)\n    (elscreen-set-conf-list 'screen-property screen-property-list)))\n\n(defun elscreen-get-number-of-screens ()\n  \"Return total number of screens.\"\n  (length (elscreen-get-conf-list 'screen-property)))\n\n(defun elscreen-one-screen-p ()\n  \"Return t if there is only one screen.\"\n  (= (elscreen-get-number-of-screens) 1))\n\n(defun elscreen-get-screen-list ()\n  \"Return a list of screen numbers.\"\n  (mapcar 'car (elscreen-get-conf-list 'screen-property)))\n\n(defun elscreen-screen-live-p (screen)\n  \"Return t when SCREEN is alive.\"\n  (not (null (elscreen-get-screen-property screen))))\n\n(defun elscreen-get-window-configuration (screen)\n  \"Return pair of window-configuration and marker of SCREEN\nfrom `elscreen-frame-confs', a cons cell.\"\n  (let ((screen-property (elscreen-get-screen-property screen)))\n    (assoc-default 'window-configuration screen-property)))\n\n(defun elscreen-set-window-configuration (screen winconf)\n  \"Set pair of window-configuration and marker of SCREEN to WINCONF.\"\n  (let ((screen-property (elscreen-get-screen-property screen)))\n    (elscreen--set-alist 'screen-property 'window-configuration winconf)\n    (elscreen-set-screen-property screen screen-property)))\n\n(defun elscreen-get-screen-nickname (screen)\n  \"Return nickname of SCREEN from `elscreen-frame-confs', a string.\"\n  (let ((screen-property (elscreen-get-screen-property screen)))\n    (assoc-default 'nickname screen-property)))\n\n(defun elscreen-set-screen-nickname (screen nickname)\n  \"Set nickname of SCREEN to NICKNAME.\"\n  (let ((screen-property (elscreen-get-screen-property screen)))\n    (elscreen--set-alist 'screen-property 'nickname nickname)\n    (elscreen-set-screen-property screen screen-property)))\n\n(defun elscreen-delete-screen-nickname (screen)\n  \"Remove nickname of SCREEN from `elscreen-frame-confs'.\"\n  (let ((screen-property (elscreen-get-screen-property screen)))\n    (elscreen--remove-alist 'screen-property 'nickname)\n    (elscreen-set-screen-property screen screen-property)))\n\n(defun elscreen-append-screen-to-history (screen)\n  (let ((screen-history (elscreen-get-conf-list 'screen-history)))\n    (setcdr (last screen-history) (list screen))))\n\n(defun elscreen-delete-screen-from-history (screen)\n  (let ((screen-history (elscreen-get-conf-list 'screen-history)))\n    (setq screen-history (delq screen screen-history))\n    (elscreen-set-conf-list 'screen-history screen-history)))\n\n(defun elscreen-set-current-screen (screen)\n  (let ((screen-history (elscreen-get-conf-list 'screen-history)))\n    (setq screen-history (cons screen (delq screen screen-history)))\n    (elscreen-set-conf-list 'screen-history screen-history)))\n\n(defun elscreen-get-current-screen ()\n  (car (elscreen-get-conf-list 'screen-history)))\n\n(defun elscreen-get-previous-screen ()\n  (cadr (elscreen-get-conf-list 'screen-history)))\n\n(defun elscreen-status-label (screen &optional default)\n  (let ((default (or default \" \"))\n        (current-screen (elscreen-get-current-screen))\n        (previous-screen (elscreen-get-previous-screen)))\n    (cond\n     ((eq screen current-screen) \"+\")\n     ((eq screen previous-screen) \"-\")\n     (t default))))\n\n(defvar elscreen-notify-screen-modification-suppress-flag nil)\n(defmacro elscreen-notify-screen-modification-suppress (&rest body)\n  `(let ((elscreen-notify-screen-modification-suppress-flag t))\n     ,@body))\n\n(defvar elscreen-screen-update-hook nil)\n(defun elscreen-run-screen-update-hook ()\n  (when elscreen-frame-confs\n    (elscreen-notify-screen-modification-suppress\n     (run-hooks 'elscreen-screen-update-hook)))\n  (remove-hook 'post-command-hook 'elscreen-run-screen-update-hook))\n\n(defun elscreen-screen-modified-p (inquirer)\n  (let* ((inquirer-list (elscreen-get-conf-list 'modified-inquirer))\n         (modified (null (memq inquirer inquirer-list))))\n    (add-to-list 'inquirer-list inquirer)\n    (elscreen-set-conf-list 'modified-inquirer inquirer-list)\n    modified))\n\n(defun elscreen-set-screen-modified ()\n  (elscreen-set-conf-list 'modified-inquirer nil)\n  (add-hook 'post-command-hook 'elscreen-run-screen-update-hook))\n\n(defvar elscreen-screen-modified-hook-pwc nil)\n(defun elscreen-notify-screen-modification (&optional mode)\n  (when (and (not (window-minibuffer-p))\n             (not elscreen-notify-screen-modification-suppress-flag)\n             (or (eq mode 'force)\n                 (eq mode 'force-immediately)\n                 (null elscreen-screen-modified-hook-pwc)\n                 (not (fboundp 'compare-window-configurations))\n                 (not (compare-window-configurations\n                       (current-window-configuration)\n                       elscreen-screen-modified-hook-pwc))))\n    (setq elscreen-screen-modified-hook-pwc\n          (current-window-configuration))\n    (elscreen-set-screen-modified)\n    (when (eq mode 'force-immediately)\n      (elscreen-run-screen-update-hook))))\n\n(defmacro elscreen-screen-modified-hook-setup (&rest hooks-and-functions)\n  (cons\n   'progn\n   (mapcar\n    (lambda (hook-or-function)\n      (let ((mode ''normal))\n        (when (listp hook-or-function)\n          (setq mode (nth 1 hook-or-function))\n          (setq hook-or-function (nth 0 hook-or-function)))\n        (cond\n         ((string-match \"-\\\\(hooks?\\\\|functions\\\\)$\"\n                        (symbol-name hook-or-function))\n          `(add-hook (quote ,hook-or-function)\n                     (lambda (&rest ignore)\n                       (elscreen-notify-screen-modification ,mode))))\n         (t ;; Assume hook-or-function is function\n          `(defadvice ,hook-or-function (around\n                                         elscreen-screen-modified-advice\n                                         activate)\n             ad-do-it\n             (elscreen-notify-screen-modification ,mode))))))\n    hooks-and-functions)))\n\n(elscreen-screen-modified-hook-setup\n (recenter 'force) (change-major-mode-hook 'force)\n other-window\n window-configuration-change-hook window-size-change-functions\n (handle-switch-frame 'force) ;; GNU Emacs 21\n (delete-frame 'force)\n (Info-find-node-2 'force))\n\n(defun elscreen-get-screen-to-name-alist-cache ()\n  (elscreen-get-conf-list 'screen-to-name-alist-cache))\n\n(defun elscreen-set-screen-to-name-alist-cache (alist)\n  (elscreen-set-conf-list 'screen-to-name-alist-cache alist))\n\n(defvar elscreen-mode-to-nickname-alist-symbol-list nil)\n(defvar elscreen-mode-to-nickname-alist-internal nil)\n(defun elscreen-rebuild-mode-to-nickname-alist ()\n  (setq elscreen-mode-to-nickname-alist-internal\n        (apply 'append\n               (mapcar 'symbol-value\n                       elscreen-mode-to-nickname-alist-symbol-list)))\n  (elscreen-notify-screen-modification 'force-immediately))\n(defun elscreen-set-mode-to-nickname-alist (mode-to-nickname-alist-symbol)\n  (add-to-list 'elscreen-mode-to-nickname-alist-symbol-list\n               mode-to-nickname-alist-symbol)\n  (elscreen-rebuild-mode-to-nickname-alist))\n(elscreen-set-mode-to-nickname-alist 'elscreen-mode-to-nickname-alist)\n\n(defvar elscreen-buffer-to-nickname-alist-symbol-list nil)\n(defvar elscreen-buffer-to-nickname-alist-internal nil)\n(defun elscreen-rebuild-buffer-to-nickname-alist ()\n  (setq elscreen-buffer-to-nickname-alist-internal\n        (apply 'append\n               (mapcar 'symbol-value\n                       elscreen-buffer-to-nickname-alist-symbol-list)))\n  (elscreen-notify-screen-modification 'force-immediately))\n(defun elscreen-set-buffer-to-nickname-alist (buffer-to-nickname-alist-symbol)\n  (add-to-list 'elscreen-buffer-to-nickname-alist-symbol-list\n               buffer-to-nickname-alist-symbol)\n  (elscreen-rebuild-buffer-to-nickname-alist))\n(elscreen-set-buffer-to-nickname-alist 'elscreen-buffer-to-nickname-alist)\n\n(defsubst elscreen-get-alist-to-nickname (alist op mode-or-buffer-name)\n  (catch 'found\n    (progn\n      (mapc\n       (lambda (map)\n         (let ((nickname nil)\n               (condition-data (car map))\n               (string-or-function (cdr map)))\n           (when (funcall op condition-data mode-or-buffer-name)\n             (cond\n              ((functionp string-or-function)\n               (setq nickname\n                     (condition-case nil\n                         (funcall string-or-function)\n                       (wrong-number-of-arguments\n                        (funcall string-or-function (current-buffer))))))\n              (t\n               (setq nickname string-or-function)))\n             (throw 'found (cons 'nickname nickname)))))\n       alist)\n      nil)))\n\n(defun elscreen-get-screen-to-name-alist (&optional truncate-length padding)\n  (when (elscreen-screen-modified-p 'elscreen-get-screen-to-name-alist)\n    (elscreen-notify-screen-modification-suppress\n     (elscreen-set-window-configuration (elscreen-get-current-screen)\n                                        (elscreen-current-window-configuration))\n     (let* ((screen-list (sort (elscreen-get-screen-list) '<))\n            screen-name screen-to-name-alist nickname-type-map)\n       (elscreen-save-screen-excursion\n        (mapc\n         (lambda (screen)\n           ;; If nickname exists, use it.\n           (setq screen-name (elscreen-get-screen-nickname screen))\n           ;; Nickname does not exist, so examine major-mode and buffer-name.\n           (when (null screen-name)\n             (elscreen-goto-internal screen)\n\n             (setq nickname-type-map\n                   (mapcar\n                    (lambda (window)\n                      (with-current-buffer (window-buffer window)\n                        (or (elscreen-get-alist-to-nickname\n                             elscreen-mode-to-nickname-alist-internal\n                             'string-match (symbol-name major-mode))\n                            (elscreen-get-alist-to-nickname\n                             elscreen-buffer-to-nickname-alist-internal\n                             'string-match (buffer-name))\n                            (cons 'buffer-name (buffer-name)))))\n                    (window-list)))\n\n             (let (nickname-list)\n               (while (> (length nickname-type-map) 0)\n                 (let ((type (caar nickname-type-map))\n                       (name (cdar nickname-type-map)))\n                   (when name\n                     (setq nickname-list (cons name nickname-list)))\n                   (setq nickname-type-map\n                         (if (eq type 'nickname)\n                             (delete (car nickname-type-map) nickname-type-map)\n                           (cdr nickname-type-map)))))\n               (setq screen-name\n                     (mapconcat 'identity (reverse nickname-list) \":\"))))\n\n           (elscreen--set-alist 'screen-to-name-alist screen screen-name))\n         screen-list))\n\n       (elscreen-set-screen-to-name-alist-cache screen-to-name-alist))))\n\n  ;; Arguments of truncate-length and padding are deprecated.\n  (if truncate-length\n      (let ((screen-to-name-alist\n             (copy-alist (elscreen-get-screen-to-name-alist-cache))))\n        (elscreen-message \"Arguments for `elscreen-get-screen-to-name-alist' are deprecated.  Use elscreen-truncate-screen-name for each screen-name.\")\n        (mapc\n         (lambda (screen-to-name)\n           (setcdr screen-to-name\n                   (elscreen-truncate-screen-name (cdr screen-to-name)\n                                                  truncate-length padding)))\n         screen-to-name-alist)\n        screen-to-name-alist)\n    (elscreen-get-screen-to-name-alist-cache)))\n\n(defun elscreen-truncate-screen-name (screen-name truncate-length &optional padding)\n  (let ((truncate-length (max truncate-length 4)))\n    (cond\n     ((> (string-width screen-name) truncate-length)\n      (concat (truncate-string-to-width screen-name (- truncate-length 3)\n                                        nil ?.)\n              \"...\"))\n     (padding\n      (truncate-string-to-width screen-name truncate-length nil ?\\ ))\n     (t\n      screen-name))))\n\n(defun elscreen-goto-internal (screen)\n  \"Set the configuration of windows, buffers and markers previousuly\nstored as SCREEN.\"\n  (let ((elscreen-window-configuration\n         (elscreen-get-window-configuration screen)))\n    (elscreen-apply-window-configuration elscreen-window-configuration)))\n\n(defvar elscreen-create-hook nil)\n(defun elscreen-create-internal (&optional noerror)\n  \"Create a new screen.\nIf NOERROR is not nil, no message is displayed in mini buffer\nwhen error is occurred.\"\n  (cond\n   ((>= (elscreen-get-number-of-screens) 10)\n    (unless noerror\n      (elscreen-message \"No more screens.\"))\n    nil)\n   (t\n    (let ((screen-list (sort (elscreen-get-screen-list) '<))\n          (screen 0))\n      (elscreen-set-window-configuration\n       (elscreen-get-current-screen)\n       (elscreen-current-window-configuration))\n      (while (eq (nth screen screen-list) screen)\n        (setq screen (+ screen 1)))\n      (elscreen-set-window-configuration\n       screen (elscreen-default-window-configuration))\n      (elscreen-append-screen-to-history screen)\n      (elscreen-notify-screen-modification 'force)\n      (run-hooks 'elscreen-create-hook)\n      screen))))\n\n(defun elscreen-kill-internal (screen)\n  (elscreen-delete-screen-property screen)\n  (elscreen-delete-screen-from-history screen)\n  screen)\n\n(defun elscreen-find-screens (condition)\n  (let ((screen-list (sort (elscreen-get-screen-list) '<))\n        result)\n    (save-current-buffer\n      (elscreen-set-window-configuration\n       (elscreen-get-current-screen)\n       (elscreen-current-window-configuration))\n      (elscreen-notify-screen-modification-suppress\n       (elscreen-save-screen-excursion\n        (mapc\n         (lambda (screen)\n           (when (funcall condition screen)\n             (setq result (cons screen result))))\n         screen-list))\n       result))))\n\n(defun elscreen-find-screen (condition)\n  (catch 'elscreen-find-screen\n    (elscreen-find-screens `(lambda (screen)\n                              (when (funcall ,condition screen)\n                                (throw 'elscreen-find-screen screen))))))\n\n(defun elscreen-find-screen-by-buffer (buffer &optional create)\n  (let* ((buffer (if (bufferp buffer) buffer (get-buffer buffer)))\n         (screen (when buffer\n                   (elscreen-find-screen\n                    `(lambda (screen)\n                       (elscreen-goto-internal screen)\n                       (not (null (get-buffer-window ,buffer))))))))\n    (when (and buffer (null screen) create)\n      (cond\n       ((setq screen (elscreen-create-internal 'noerror))\n        (save-window-excursion\n          (elscreen-goto-internal screen)\n          (switch-to-buffer buffer t)\n          (elscreen-set-window-configuration\n           screen (elscreen-current-window-configuration))))\n       (t\n        (setq screen (elscreen-get-current-screen))\n        (elscreen-goto-internal screen)\n        (save-selected-window\n          (select-window (split-window))\n          (switch-to-buffer buffer t)))))\n    screen))\n\n(defun elscreen-find-screen-by-major-mode (major-mode-or-re)\n  (let ((major-mode-re (cond\n                        ((stringp major-mode-or-re)\n                         major-mode-or-re)\n                        ((symbolp major-mode-or-re)\n                         (format \"^%s$\" (regexp-quote\n                                         (symbol-name major-mode-or-re))))\n                        (t nil))))\n    (when major-mode-re\n      (elscreen-find-screen\n       (lambda (screen)\n         (elscreen-goto-internal screen)\n         (save-selected-window\n           (catch 'found\n             (mapc\n              (lambda (window)\n                (select-window window)\n                (when (string-match major-mode-re (symbol-name major-mode))\n                  (throw 'found t)))\n              (window-list))\n             nil)))))))\n\n(defvar elscreen-last-message \"Welcome to ElScreen!\"\n  \"Last shown message.\")\n(defun elscreen-message (message &optional sec)\n  \"Display MESSAGE in mini-buffer for SEC seconds.\nDefault value for SEC is 3.\"\n  (when message\n    (setq elscreen-last-message message)\n    (message \"%s\" message)\n    (sit-for (or sec 3)))\n  (message nil))\n\n\n;;; User Interfaces:\n\n(defun elscreen-create ()\n  \"Create a new screen and switch to it.\"\n  (interactive)\n  (let ((screen (elscreen-create-internal)))\n    (if screen\n        (elscreen-goto screen))))\n\n(defun elscreen-clone (&optional screen)\n  \"Create a new screen with the window-configuration of SCREEN.\nIf SCREEN is ommitted, current-screen is used.\"\n  (interactive)\n  (let ((screen (or screen (elscreen-get-current-screen)))\n        clone elscreen-window-configuration)\n    (cond\n     ((not (elscreen-screen-live-p screen))\n      (elscreen-message \"There is no such screen, cannot clone\"))\n    ((setq clone (elscreen-create-internal))\n     (save-window-excursion\n       (elscreen-goto-internal screen)\n       (setq elscreen-window-configuration\n             (elscreen-current-window-configuration)))\n     (elscreen-set-window-configuration clone elscreen-window-configuration)\n     (elscreen-goto clone)))))\n\n(defvar elscreen-kill-hook nil)\n(defun elscreen-kill (&optional screen)\n  \"Kill SCREEN.  If optional argument SCREEN is\nommitted, current-screen is killed.\"\n  (interactive \"P\")\n  (let ((screen (or (and (numberp screen) screen)\n                    (elscreen-get-current-screen))))\n    (cond\n     ((not (elscreen-screen-live-p screen))\n      (elscreen-message \"There is no such screen, cannot kill\")\n      nil)\n     ((elscreen-one-screen-p)\n      (elscreen-message \"There is only one screen, cannot kill\")\n      nil)\n     (t\n      (elscreen-kill-internal screen)\n      (elscreen-goto-internal (elscreen-get-current-screen))\n      (elscreen-notify-screen-modification 'force)\n      (run-hooks 'elscreen-kill-hook)\n      screen))))\n\n(defun elscreen-kill-screen-and-buffers (&optional screen)\n  \"Kill buffers on SCREEN and SCREEN itself.  If optional\nargument SCREEN is omitted, current screen is killed.\"\n  (interactive)\n  (let* ((screen (or screen (elscreen-get-current-screen)))\n         (elscreen-window-configuration\n          (elscreen-get-window-configuration screen)))\n    (when (elscreen-kill screen)\n      (save-window-excursion\n        (elscreen-apply-window-configuration elscreen-window-configuration)\n        (mapc\n         (lambda (buffer)\n           (when (buffer-live-p buffer)\n             (kill-buffer buffer)))\n         (mapcar 'window-buffer (window-list))))\n      screen)))\n\n(defun elscreen-kill-others (&optional screen)\n  \"Kill screens other than SCREEN.  If optional argument SCREEN\nis ommitted, current screen will survive.\"\n  (interactive)\n  (let* ((screen (or screen (elscreen-get-current-screen)))\n         (screen-list (when (elscreen-screen-live-p screen)\n                        (delq screen (sort (elscreen-get-screen-list) '<))))\n         screen-list-string)\n    (cond\n     ((not (elscreen-screen-live-p screen)) ;; XXX\n      (when (called-interactively-p 'any)\n        (elscreen-message \"There is no such screen\")))\n     ((null screen-list)\n      (when (called-interactively-p 'any)\n        (elscreen-message \"There is only one screen, cannot kill\")))\n     ((or\n       (not (called-interactively-p 'any))\n       (yes-or-no-p (format \"Really kill screens other than %d? \" screen)))\n      (setq screen-list-string (mapconcat\n                                (lambda (screen)\n                                  (elscreen-kill-internal screen)\n                                  (number-to-string screen))\n                                screen-list \",\"))\n      (elscreen-goto-internal screen)\n      (elscreen-notify-screen-modification 'force-immediately)\n      (when (called-interactively-p 'any)\n        (elscreen-message (format \"screen %s killed\" screen-list-string)))))\n    screen-list))\n\n(defvar elscreen-goto-hook nil)\n(defun elscreen-goto (screen)\n  \"Switch to screen SCREEN.\"\n  (interactive \"NGoto screen number: \")\n  (cond\n   ((eq (elscreen-get-current-screen) screen))\n   ((elscreen-screen-live-p screen)\n    (elscreen-set-window-configuration\n     (elscreen-get-current-screen)\n     (elscreen-current-window-configuration))\n    (elscreen-set-current-screen screen)\n    (elscreen-goto-internal screen)\n    (elscreen-notify-screen-modification 'force)\n    (run-hooks 'elscreen-goto-hook)\n    screen)\n   (t\n    (elscreen-message (format \"No screen %d\" screen))\n    nil)))\n\n(defun elscreen-next ()\n  \"Switch to the next screen.\"\n  (interactive)\n  (cond\n   ((elscreen-one-screen-p)\n    (elscreen-message\n     (format \"You cannot escape from screen %d!\"\n             (elscreen-get-current-screen))))\n   (t\n    (let* ((screen-list (sort (elscreen-get-screen-list) '<))\n           (next-screen\n            (or (nth 1 (memq (elscreen-get-current-screen) screen-list))\n                (car screen-list))))\n      (elscreen-goto next-screen)))))\n\n(defun elscreen-previous ()\n  \"Switch to the previous screen.\"\n  (interactive)\n  (cond\n   ((elscreen-one-screen-p)\n    (elscreen-message\n     (format \"You cannot escape from screen %d!\"\n             (elscreen-get-current-screen))))\n   (t\n    (let* ((screen-list (sort (elscreen-get-screen-list) '>))\n           (previous-screen\n            (or (nth 1 (memq (elscreen-get-current-screen) screen-list))\n                (car screen-list))))\n      (elscreen-goto previous-screen)))))\n\n(defun elscreen-toggle ()\n  \"Toggle to the screen selected previously.\"\n  (interactive)\n  (cond\n   ((elscreen-one-screen-p)\n    (elscreen-message\n     (format \"You cannot escape from screen %d!\"\n             (elscreen-get-current-screen))))\n   (t\n    (elscreen-goto (elscreen-get-previous-screen)))))\n\n(defun elscreen-jump ()\n  \"Switch to specified screen.\"\n  (interactive)\n  (let ((next-screen (string-to-number (string last-command-event))))\n    (if (and (<= 0 next-screen) (<= next-screen 9))\n        (elscreen-goto next-screen))))\n(defalias 'elscreen-jump-0 'elscreen-jump)\n(defalias 'elscreen-jump-9 'elscreen-jump)\n\n(defun elscreen-swap ()\n  \"Interchange screens selected currently and previously.\"\n  (interactive)\n  (cond\n   ((elscreen-one-screen-p)\n    (elscreen-message \"There is only one screen, cannot swap\"))\n   (t\n    (let* ((current-screen (elscreen-get-current-screen))\n           (previous-screen (elscreen-get-previous-screen))\n           (current-screen-property\n            (elscreen-get-screen-property current-screen))\n           (previous-screen-property\n            (elscreen-get-screen-property previous-screen)))\n      (elscreen-set-screen-property current-screen previous-screen-property)\n      (elscreen-set-screen-property previous-screen current-screen-property)\n      (elscreen-goto-internal (elscreen-get-current-screen))))))\n\n(defun elscreen-screen-nickname (nickname)\n  \"Set nickname for current screen to NICKNAME.\"\n  (interactive \"sSet window title to: \")\n  (cond\n   ((zerop (length nickname))\n    (elscreen-delete-screen-nickname (elscreen-get-current-screen)))\n   (t\n    (elscreen-set-screen-nickname (elscreen-get-current-screen) nickname)))\n  (elscreen-notify-screen-modification 'force))\n\n(defun elscreen-display-screen-name-list ()\n  \"Display the list of screens in mini-buffer.\"\n  (interactive)\n  (let ((screen-list (sort (elscreen-get-screen-list) '<))\n        (screen-to-name-alist (elscreen-get-screen-to-name-alist)))\n    (elscreen-message\n     (mapconcat\n      (lambda (screen)\n        (let ((screen-name (assoc-default screen screen-to-name-alist)))\n          (format \"%d%s %s\" screen\n                  (elscreen-status-label screen \"\")\n                  screen-name)))\n      screen-list \"  \"))))\n\n\n;;; Help\n\n(defvar elscreen-help-symbol-list nil)\n(defun elscreen-set-help (help-symbol)\n  (add-to-list 'elscreen-help-symbol-list help-symbol t))\n(elscreen-set-help 'elscreen-help)\n\n(defun elscreen-help ()\n  \"Show key bindings of ElScreen and Add-On softwares.\"\n  (interactive)\n  (with-output-to-temp-buffer \"*ElScreen Help*\"\n    (princ (substitute-command-keys\n            (mapconcat 'symbol-value\n                       elscreen-help-symbol-list \"\\n\\n\")))\n    (help-print-return-message)))\n\n\n;;; Utility Functions\n\n(defun elscreen-display-version ()\n  \"Display ElScreen version.\"\n  (interactive)\n  (elscreen-message (concat \"ElScreen version \" elscreen-version)))\n\n(defun elscreen-toggle-display-screen-number ()\n  \"Toggle the screen number in the mode line.\"\n  (interactive)\n  (setq elscreen-display-screen-number (null elscreen-display-screen-number))\n  (elscreen-notify-screen-modification 'force))\n\n(defun elscreen-toggle-display-tab ()\n  \"Toggle the tab on the top of screen.\"\n  (interactive)\n  (setq elscreen-display-tab (null elscreen-display-tab))\n  (elscreen-notify-screen-modification 'force))\n\n(defun elscreen-display-last-message ()\n  \"Repeat the last message displayed in the mini-buffer.\"\n  (interactive)\n  (elscreen-message elscreen-last-message 5))\n\n(defun elscreen-display-time ()\n  \"Show system information.\"\n  (interactive)\n  (elscreen-message\n   (format \"%s %s / %s\"\n           (current-time-string)\n           (nth 1 (current-time-zone))\n           (mapconcat\n            (lambda (load)\n              (format \"%.2f\" (/ load 100.0)))\n            (load-average) \" \"))))\n\n(defun elscreen-select-and-goto ()\n  (interactive)\n  (let* ((screen-list (sort (elscreen-get-screen-list) '<))\n         (screen-to-name-alist (elscreen-get-screen-to-name-alist))\n         (command-list '((\"c\" . elscreen-create)\n                         (\"n\" . elscreen-next)\n                         (\"p\" . elscreen-previous)\n                         (\"t\" .  elscreen-toggle)))\n         (truncate-length (- (frame-width) 6))\n         (candidate-window-height (max (+ (elscreen-get-number-of-screens) 4)\n                                       window-min-height))\n         (candidate-buffer (get-buffer-create\n                            (format \" *ElScreen-select:%s*\"\n                                    (prin1-to-string (selected-frame)))))\n         (candidate (concat\n                     \"Current screen list: \\n\\n\"\n                     (mapconcat\n                      (lambda (screen)\n                        (format \"  %d%s %s\\n\" screen\n                                (elscreen-status-label screen)\n                                (elscreen-truncate-screen-name\n                                 (assoc-default screen screen-to-name-alist)\n                                 truncate-length)))\n                      screen-list nil)))\n         (prompt \"Select screen or (c)reate, (n)ext, (p)revious, (t)oggle: \")\n         (minibuffer-map (copy-keymap minibuffer-local-map))\n         window frame-last-window command-or-target-screen mini-hist)\n    ;; prepare window to show candidates\n    (save-window-excursion\n      (setq frame-last-window (previous-window (frame-first-window)))\n      (while (minibuffer-window-active-p frame-last-window)\n        (setq frame-last-window (previous-window frame-last-window)))\n      (while (and (not (one-window-p))\n                  (or (< (window-width frame-last-window)\n                         (frame-width))\n                      (< (window-height frame-last-window)\n                         (+ candidate-window-height window-min-height))))\n        (setq window frame-last-window)\n        (setq frame-last-window (previous-window window))\n        (delete-window window))\n      (select-window (split-window frame-last-window))\n      (shrink-window (- (window-height) candidate-window-height))\n      ;; now switch to the buffer for candidates and fill it\n      (switch-to-buffer candidate-buffer)\n      (let ((buffer-read-only nil))\n        (erase-buffer)\n        (insert candidate)\n        (goto-char (point-min))\n        (save-excursion\n          (while (not (eobp))\n            (when (looking-at \"^  \\\\([0-9]\\\\)\\\\(.\\\\) \\\\(.*\\\\)$\")\n              (put-text-property\n               (match-beginning 1) (match-end 1) 'face 'bold)\n              (cond\n               ((string= (match-string 2) \"+\")\n                (put-text-property\n                 (match-beginning 3) (match-end 3) 'face 'bold))))\n            (forward-line 1)))\n        (setq buffer-read-only t)\n        (set-buffer-modified-p nil))\n      ;; make keymap for minibuffer\n      (suppress-keymap minibuffer-map t)\n      (define-key minibuffer-map \"\\C-g\" 'abort-recursive-edit)\n      (define-key minibuffer-map \"\\C-m\" 'exit-recursive-edit)\n      (define-key minibuffer-map \"q\" 'exit-recursive-edit)\n      (define-key minibuffer-map \" \" 'exit-recursive-edit)\n      (mapc\n       (lambda (command)\n         (define-key minibuffer-map (car command) 'self-insert-and-exit))\n       command-list)\n      (mapc\n       (lambda (screen)\n         (define-key minibuffer-map (number-to-string screen)\n           'self-insert-and-exit))\n       screen-list)\n      ;; read key from minibuffer\n      (unwind-protect\n          (setq command-or-target-screen\n                (read-from-minibuffer prompt nil minibuffer-map\n                                      nil 'mini-hist))\n        (kill-buffer candidate-buffer)))\n    (cond\n     ((string= command-or-target-screen \"\"))\n     ((assoc-default command-or-target-screen command-list)\n      (funcall (assoc-default command-or-target-screen command-list)))\n     (t\n      (elscreen-goto (string-to-number command-or-target-screen))))))\n\n(defun elscreen-find-and-goto-by-buffer (&optional buffer create noselect)\n  \"Go to the screen that has the window with buffer BUFFER,\ncreating one if none already exists.\"\n  (interactive)\n  (let* ((prompt \"Go to the screen with specified buffer: \")\n         (create (or create (called-interactively-p 'any)))\n         (buffer-name (or (and (bufferp buffer) (buffer-name buffer))\n                          (and (stringp buffer) buffer)\n                          (and (featurep 'iswitchb)\n                               (iswitchb-read-buffer prompt))\n                          (read-buffer prompt)))\n         (target-screen (elscreen-find-screen-by-buffer\n                         (get-buffer-create buffer-name) create)))\n    (when target-screen\n      (elscreen-goto target-screen)\n      (unless noselect\n        (select-window (get-buffer-window buffer-name))))\n    target-screen))\n\n(defun elscreen-find-file (filename)\n  \"Edit file FILENAME.\nSwitch to a screen visiting file FILENAME,\ncreating one if none already exists.\"\n  (interactive \"FFind file in new screen: \")\n  (elscreen-find-and-goto-by-buffer (find-file-noselect filename) 'create))\n\n(defun elscreen-find-file-read-only (filename)\n  \"Edit file FILENAME with new screen but don't allow changes.\nLike \\\\[elscreen-find-file] but marks buffer as read-only.\nUse \\\\[toggle-read-only] to permit editing.\"\n  (interactive \"FFind file read-only in new screen: \")\n  (elscreen-find-file filename)\n  (setq buffer-read-only t))\n\n(defun elscreen-dired (dirname &optional switches)\n  (interactive (progn\n                 (or (featurep 'dired) (require 'dired))\n                 (dired-read-dir-and-switches \"in new screen \")))\n  (elscreen-find-and-goto-by-buffer (dired-noselect dirname switches) 'create))\n\n(defun elscreen-execute-extended-command (prefix-arg)\n  (interactive \"P\")\n  (let ((prefix-arg prefix-arg)\n        (prefix-key (key-description elscreen-prefix-key))\n        target-screen)\n    (setq this-command (intern (completing-read\n                                ;; Note: this has the hard-wired\n                                ;;  \"C-u\" and \"M-x\" string bug in common\n                                ;;  with all Emacs's.\n                                ;; (i.e. it prints C-u and M-x regardless of\n                                ;; whether some other keys were actually bound\n                                ;; to `execute-extended-command' and\n                                ;; `universal-argument'.\n                                (cond ((eq prefix-arg '-)\n                                       (format \"- %s M-x \" prefix-key))\n                                      ((equal prefix-arg '(4))\n                                       (format \"C-u %s M-x \" prefix-key))\n                                      ((integerp prefix-arg)\n                                       (format \"%d %s M-x \"\n                                               prefix-arg prefix-key))\n                                      ((and (consp prefix-arg)\n                                            (integerp (car prefix-arg)))\n                                       (format \"%d %s M-x \"\n                                               (car prefix-arg) prefix-key))\n                                      (t\n                                       (format \"%s M-x \" prefix-key)))\n                                obarray 'commandp t nil\n                                'extended-command-history)))\n    (if (setq target-screen (elscreen-create-internal 'noerror))\n        (elscreen-goto target-screen)\n      (select-window (split-window)))\n    (command-execute this-command t)))\n\n\n;;; Mode Line & Menu & Tab\n\n;; GNU Emacs\n(defvar elscreen-mode-line-string \"[0]\")\n(defun elscreen-mode-line-update ()\n  (when (elscreen-screen-modified-p 'elscreen-mode-line-update)\n    (setq elscreen-mode-line-string\n          (format \"[%d]\" (elscreen-get-current-screen)))\n    (force-mode-line-update)))\n\n(let ((point (memq 'mode-line-position mode-line-format))\n      (elscreen-mode-line-elm '(elscreen-display-screen-number\n                                (\" \" elscreen-mode-line-string))))\n  (when (and (null (member elscreen-mode-line-elm mode-line-format)) point)\n    (setcdr point (cons elscreen-mode-line-elm (cdr point)))))\n\n(add-hook 'elscreen-screen-update-hook 'elscreen-mode-line-update)\n\n  ;; Menu\n\n(define-key-after (lookup-key global-map [menu-bar]) [elscreen]\n  (cons \"ElScreen\" (make-sparse-keymap \"ElScreen\")) 'buffer)\n\n(defvar elscreen-menu-bar-command-entries\n  (list (list 'elscreen-command-separator\n              'menu-item\n              \"--\")\n        (list 'elscreen-create\n              'menu-item\n              \"Create Screen\"\n              'elscreen-create\n              :help \"Create a new screen and switch to it\")\n        (list 'elscreen-clone\n              'menu-item\n              \"Clone Screen\"\n              'elscreen-clone\n              :help \"Create a new screen with the window-configuration of current screen\")\n        (list 'elscreen-kill\n              'menu-item\n              \"Kill Screen\"\n              'elscreen-kill\n              :help \"Kill current screen\")\n        (list 'elscreen-kill-screen-and-buffers\n              'menu-item\n              \"Kill Screen and Buffers\"\n              'elscreen-kill-screen-and-buffers\n              :help \"Kill current screen and buffers\")\n        (list 'elscreen-kill-others\n              'menu-item\n              \"Kill Other Screens\"\n              'elscreen-kill-others\n              :help \"Kill other screens\")\n        (list 'elscreen-next\n              'menu-item\n              \"Next Screen\"\n              'elscreen-next\n              :help \"Switch to the \\\"next\\\" screen in a cyclic order\")\n        (list 'elscreen-previous\n              'menu-item\n              \"Previous Screen\"\n              'elscreen-previous\n              :help \"Switch to the \\\"previous\\\" screen in a cyclic order\")\n        (list 'elscreen-toggle\n              'menu-item\n              \"Toggle Screen\"\n              'elscreen-toggle\n              :help \"Toggle to the screen selected previously\")\n        (list 'elscreen-command-separator\n              'menu-item\n              \"--\")\n        (list 'elscreen-toggle-display-screen-number\n              'menu-item\n              \"Display Screen Number\"\n              'elscreen-toggle-display-screen-number\n              :help \"Display screen number on the mode line\"\n              :button '(:toggle . elscreen-display-screen-number))\n        (list 'elscreen-toggle-display-tab\n              'menu-item\n              \"Display Tab\"\n              'elscreen-toggle-display-tab\n              :help \"Display tab on the top of screen\"\n              :button '(:toggle . elscreen-display-tab))))\n\n(defun elscreen-menu-bar-update (&optional force)\n  (when (and (lookup-key (current-global-map) [menu-bar elscreen])\n             (or force\n                 (elscreen-screen-modified-p 'elscreen-menu-bar-update)))\n    (let ((screen-list (sort (elscreen-get-screen-list) '<))\n          (screen-to-name-alist (elscreen-get-screen-to-name-alist))\n          (elscreen-menu nil))\n      (setq elscreen-menu\n            (mapcar\n             (lambda (screen)\n               (list (string-to-char (number-to-string screen))\n                     'menu-item\n                     (format \"%d%s %s\" screen\n                             (elscreen-status-label screen)\n                             (elscreen-truncate-screen-name\n                              (assoc-default screen screen-to-name-alist) 25))\n                     'elscreen-jump\n                     :keys (format \"%s %d\"\n                                   (key-description elscreen-prefix-key)\n                                   screen)))\n             screen-list))\n      (setq elscreen-menu\n            (nconc elscreen-menu elscreen-menu-bar-command-entries))\n      (setq elscreen-menu\n            (cons 'keymap (cons \"Select Screen\" elscreen-menu)))\n      (define-key (current-global-map) [menu-bar elscreen]\n        (cons (copy-sequence \"ElScreen\") elscreen-menu)))))\n\n(add-hook 'elscreen-screen-update-hook 'elscreen-menu-bar-update)\n\n  ;; Tab\n\n(defvar elscreen-tab-format nil)\n(make-variable-buffer-local 'elscreen-tab-format)\n\n(defsubst elscreen-tab-create-keymap (&rest definitions)\n  (let ((keymap (make-sparse-keymap))\n        (key-function-pairs\n         (eval-when-compile\n           (mapcar\n            (lambda (key)\n              (cons key 'ignore))\n            (list 'mouse-1 'mouse-2 'mouse-3\n                  'down-mouse-1 'down-mouse-2 'down-mouse-3\n                  'drag-mouse-1 'drag-mouse-2 'drag-mouse-3)))))\n    (while definitions\n      (elscreen--set-alist 'key-function-pairs (car definitions) (cadr definitions))\n      (setq definitions (cddr definitions)))\n    (mapc\n     (lambda (key-function-pair)\n       (let ((key (car key-function-pair))\n             (function (cdr key-function-pair)))\n         (define-key keymap (vector 'header-line key) function)))\n     key-function-pairs)\n    keymap))\n\n(defsubst elscreen-tab-width ()\n  (if (numberp elscreen-display-tab)\n      elscreen-display-tab\n    (let* ((number-of-screens (elscreen-get-number-of-screens))\n           (available-width\n            (- (frame-width) (if elscreen-tab-display-control 4 0)))\n           (tab-width\n            (round (- (/ available-width number-of-screens)\n                      (if elscreen-tab-display-kill-screen 5.5 1.5)))))\n      (max (min tab-width 16) 1))))\n\n(defun elscreen-tab-escape-% (string)\n  (if (string-match \"%\" string)\n      (let ((retval \"\")\n            start (end 0) substring)\n        (while (setq start end)\n          (setq end (next-property-change start string))\n          (setq substring (replace-regexp-in-string\n                           \"%\" \"%%\" (substring string start end)))\n          (set-text-properties 0 (length substring)\n                               (text-properties-at start string) substring)\n          (setq retval (concat retval substring)))\n        retval)\n    string))\n\n(defun elscreen-tab-update (&optional force)\n  (when (and (not (window-minibuffer-p))\n             (or (elscreen-screen-modified-p 'elscreen-tab-update) force))\n    (walk-windows\n     (lambda (window)\n       (with-current-buffer (window-buffer window)\n         (when (and (boundp 'elscreen-tab-format)\n                    (equal header-line-format elscreen-tab-format)\n                    (or (not (eq (window-buffer window)\n                                 (window-buffer (frame-first-window))))\n                        (not elscreen-display-tab)))\n           (kill-local-variable 'elscreen-tab-format)\n           (setq header-line-format nil))))\n     'other 'other)\n\n    (when elscreen-display-tab\n      (let ((screen-list (sort (elscreen-get-screen-list) '<))\n            (screen-to-name-alist (elscreen-get-screen-to-name-alist))\n            (current-screen (elscreen-get-current-screen))\n            (half-space (propertize\n                           \" \"\n                           'display '(space :width 0.5)))\n            (tab-separator (propertize\n                            \" \"\n                            'face 'elscreen-tab-background-face\n                            'display '(space :width 0.5)))\n            (control-tab (propertize\n                          \"<->\"\n                          'face 'elscreen-tab-control-face\n                          'local-map (elscreen-tab-create-keymap\n                                      'mouse-1 'elscreen-previous\n                                      'mouse-2 'elscreen-create\n                                      'mouse-3 'elscreen-next)\n                          'help-echo \"mouse-1: previous screen, mouse-2: create new screen, mouse-3: next screen\")))\n        (with-current-buffer (window-buffer (frame-first-window))\n          (kill-local-variable 'elscreen-tab-format)\n          (when elscreen-tab-display-control\n            (setq elscreen-tab-format\n                  (nconc\n                   elscreen-tab-format\n                   (list\n                    control-tab\n                    tab-separator))))\n\n          (mapc\n           (lambda (screen)\n             (let ((kill-screen\n                    (propertize\n                     \"[X]\"\n                     'local-map (elscreen-tab-create-keymap\n                                 'mouse-1 `(lambda (e)\n                                             (interactive \"e\")\n                                             (elscreen-kill ,screen))\n                                 'M-mouse-1 `(lambda (e)\n                                               (interactive \"e\")\n                                               (elscreen-kill-screen-and-buffers ,screen)))\n                     'help-echo (format \"mouse-1: kill screen %d, M-mouse-1: kill screen %d and buffers on it\" screen screen))))\n               (setq elscreen-tab-format\n                     (nconc\n                      elscreen-tab-format\n                      (list\n                       (propertize\n                        (concat\n                         (when (or (eq elscreen-tab-display-kill-screen 'left)\n                                   (eq elscreen-tab-display-kill-screen t))\n                           kill-screen)\n                         half-space\n                         (propertize\n                          (format \"%d%s%s%s\"\n                                  screen\n                                  (elscreen-status-label screen)\n                                  half-space\n                                  (elscreen-tab-escape-%\n                                   (elscreen-truncate-screen-name\n                                    (assoc-default screen screen-to-name-alist)\n                                    (elscreen-tab-width) t)))\n                          'help-echo (assoc-default screen screen-to-name-alist)\n                          'local-map (elscreen-tab-create-keymap\n                                      'mouse-1 `(lambda (e)\n                                                  (interactive \"e\")\n                                                  (elscreen-goto ,screen))))\n                         (when (eq elscreen-tab-display-kill-screen 'right)\n                           (concat half-space kill-screen)))\n                        'face (if (eq current-screen screen)\n                                  'elscreen-tab-current-screen-face\n                                'elscreen-tab-other-screen-face))\n                       tab-separator)))))\n           screen-list)\n\n          (setq elscreen-tab-format\n                (nconc\n                 elscreen-tab-format\n                 (list\n                  (propertize\n                   (make-string (window-width) ?\\ )\n                   'face 'elscreen-tab-background-face\n                   'local-map (elscreen-tab-create-keymap)))))\n\n          (setq header-line-format elscreen-tab-format))))))\n\n(add-hook 'elscreen-screen-update-hook 'elscreen-tab-update)\n\n;;; Unsupported Functions...\n\n(defun elscreen-link ()\n  (interactive)\n  (cond\n   ((null (one-window-p))\n    (elscreen-message \"current screen must not have two or more window!\"))\n   ((or (null (elscreen-get-previous-screen))\n        (elscreen-one-screen-p))\n    (elscreen-message \"must specify previous screen!\"))\n   ((and (elscreen-goto (elscreen-get-previous-screen))\n         (null (one-window-p)))\n    (elscreen-goto (elscreen-get-previous-screen))\n    (elscreen-message \"previous screen must not have two or more window!\"))\n   (t\n    (let ((elscreen-link-buffer (current-buffer)))\n      (elscreen-kill)\n      (switch-to-buffer-other-window elscreen-link-buffer)))))\n\n(defun elscreen-split ()\n  (interactive)\n  (if (and (null (one-window-p))\n           (< (elscreen-get-number-of-screens) 10))\n      (let ((elscreen-split-buffer (current-buffer)))\n        (delete-window)\n        (elscreen-create)\n        (switch-to-buffer elscreen-split-buffer)\n        (elscreen-goto (elscreen-get-previous-screen)))\n    (elscreen-message \"cannot split screen!\")))\n\n;;; Start ElScreen!\n\n;;;###autoload\n(defun elscreen-start ()\n  (interactive)\n  (mapc\n   (lambda (frame)\n     (elscreen-make-frame-confs frame 'keep))\n   (frame-list))\n  (let ((prefix-key elscreen-prefix-key)\n        (elscreen-prefix-key nil))\n    (elscreen-set-prefix-key prefix-key)))\n\n(provide 'elscreen)\n\n;;; elscreen.el ends here\n"
  }
]