| @ -0,0 +1,18 @@ | |||||
| ;;; flymake-easy-autoloads.el --- automatically extracted autoloads | |||||
| ;; | |||||
| ;;; Code: | |||||
| ;;;### (autoloads nil nil ("flymake-easy-pkg.el" "flymake-easy.el") | |||||
| ;;;;;; (21154 21336 876004 0)) | |||||
| ;;;*** | |||||
| (provide 'flymake-easy-autoloads) | |||||
| ;; Local Variables: | |||||
| ;; version-control: never | |||||
| ;; no-byte-compile: t | |||||
| ;; no-update-autoloads: t | |||||
| ;; coding: utf-8 | |||||
| ;; End: | |||||
| ;;; flymake-easy-autoloads.el ends here | |||||
| @ -0,0 +1 @@ | |||||
| (define-package "flymake-easy" "0.9" "Helpers for easily building flymake checkers" (quote nil)) | |||||
| @ -0,0 +1,148 @@ | |||||
| ;;; flymake-easy.el --- Helpers for easily building flymake checkers | |||||
| ;; Copyright (C) 2012 Steve Purcell | |||||
| ;; Author: Steve Purcell <steve@sanityinc.com> | |||||
| ;; URL: https://github.com/purcell/flymake-easy | |||||
| ;; Version: 0.9 | |||||
| ;; Keywords: convenience, internal | |||||
| ;; This program is free software; you can redistribute it and/or modify | |||||
| ;; it under the terms of the GNU General Public License as published by | |||||
| ;; the Free Software Foundation, either version 3 of the License, or | |||||
| ;; (at your option) any later version. | |||||
| ;; This program is distributed in the hope that it will be useful, | |||||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| ;; GNU General Public License for more details. | |||||
| ;; You should have received a copy of the GNU General Public License | |||||
| ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
| ;;; Commentary: | |||||
| ;; This library provides the `flymake-easy-load' helper function for | |||||
| ;; setting up flymake checkers. Just call that function with the | |||||
| ;; appropriate arguments in a major mode hook function. See | |||||
| ;; `flymake-ruby' for an example: | |||||
| ;; https://github.com/purcell/flymake-ruby | |||||
| ;;; Code: | |||||
| (require 'flymake) | |||||
| (defvar flymake-easy--active nil | |||||
| "Indicates when flymake-easy-load has successfully run in this buffer.") | |||||
| (defvar flymake-easy--command-fn nil | |||||
| "The user-specified function for building the flymake command.") | |||||
| (defvar flymake-easy--location nil | |||||
| "Where to create the temp file when checking, one of 'tempdir or 'inplace.") | |||||
| (defvar flymake-easy--extension nil | |||||
| "The canonical file name extension to use for the current file.") | |||||
| (mapc 'make-variable-buffer-local | |||||
| '(flymake-easy--active | |||||
| flymake-easy--command-fn | |||||
| flymake-easy--location | |||||
| flymake-easy--extension)) | |||||
| (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) | |||||
| "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. | |||||
| Argument PREFIX temp file prefix, supplied by flymake." | |||||
| (make-temp-file (or prefix "flymake-easy") | |||||
| nil | |||||
| (concat "." flymake-easy--extension))) | |||||
| (defun flymake-easy--flymake-init () | |||||
| "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." | |||||
| (let* ((tempfile | |||||
| (flymake-init-create-temp-buffer-copy | |||||
| (cond | |||||
| ((eq 'tempdir flymake-easy--location) | |||||
| 'flymake-easy--tempfile-in-temp-dir) | |||||
| ((eq 'inplace flymake-easy--location) | |||||
| 'flymake-create-temp-inplace) | |||||
| (t | |||||
| (error "unknown location for flymake-easy: %s" flymake-easy--location))))) | |||||
| (command (funcall flymake-easy--command-fn tempfile))) | |||||
| (list (car command) (cdr command)))) | |||||
| (defun flymake-easy-exclude-buffer-p () | |||||
| "Whether to skip flymake in the current buffer." | |||||
| (and (fboundp 'tramp-tramp-file-p) | |||||
| (buffer-file-name) | |||||
| (tramp-tramp-file-p (buffer-file-name)))) | |||||
| (defun flymake-easy-load (command-fn &optional err-line-patterns location extension warning-re info-re) | |||||
| "Enable flymake in the containing buffer using a specific narrow configuration. | |||||
| Argument COMMAND-FN function called to build the | |||||
| command line to run (receives filename, returns list). | |||||
| Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). | |||||
| Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". | |||||
| Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace. | |||||
| Argument WARNING-RE a pattern which identifies error messages as warnings. | |||||
| Argument INFO-RE a pattern which identifies messages as infos (supported only | |||||
| by the flymake fork at https://github.com/illusori/emacs-flymake)." | |||||
| (let ((executable (car (funcall command-fn "dummy")))) | |||||
| (if (executable-find executable) ;; TODO: defer this checking | |||||
| (unless (flymake-easy-exclude-buffer-p) | |||||
| (setq flymake-easy--command-fn command-fn | |||||
| flymake-easy--location (or location 'tempdir) | |||||
| flymake-easy--extension extension | |||||
| flymake-easy--active t) | |||||
| (set (make-local-variable 'flymake-allowed-file-name-masks) | |||||
| '(("." flymake-easy--flymake-init))) | |||||
| (when err-line-patterns | |||||
| (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns)) | |||||
| (dolist (var '(flymake-warning-re flymake-warn-line-regexp)) | |||||
| (set (make-local-variable var) (or warning-re "^[wW]arn"))) | |||||
| (when (boundp 'flymake-info-line-regexp) | |||||
| (set (make-local-variable 'flymake-info-line-regexp) | |||||
| (or info-re "^[iI]nfo"))) | |||||
| (flymake-mode t)) | |||||
| (message "Not enabling flymake: '%s' program not found" executable)))) | |||||
| ;; Internal overrides for flymake | |||||
| (defun flymake-easy--find-all-matches (str) | |||||
| "Return every match for `flymake-err-line-patterns' in STR. | |||||
| This is a judicious override for `flymake-split-output', enabled | |||||
| by the advice below, which allows for matching multi-line | |||||
| patterns." | |||||
| (let (matches | |||||
| (last-match-end-pos 0)) | |||||
| (dolist (pattern flymake-err-line-patterns) | |||||
| (let ((regex (car pattern)) | |||||
| (pos 0)) | |||||
| (while (string-match regex str pos) | |||||
| (push (match-string 0 str) matches) | |||||
| (setq pos (match-end 0))) | |||||
| (setq last-match-end-pos (max pos last-match-end-pos)))) | |||||
| (let ((residual (substring str last-match-end-pos))) | |||||
| (list matches | |||||
| (unless (string= "" residual) residual))))) | |||||
| (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) | |||||
| "Override `flymake-split-output' to support mult-line error messages." | |||||
| (setq ad-return-value (if flymake-easy--active | |||||
| (flymake-easy--find-all-matches output) | |||||
| ad-do-it))) | |||||
| (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) | |||||
| (when flymake-easy--active | |||||
| (setq flymake-check-was-interrupted t))) | |||||
| (provide 'flymake-easy) | |||||
| ;; Local Variables: | |||||
| ;; coding: utf-8 | |||||
| ;; byte-compile-warnings: (not cl-functions) | |||||
| ;; eval: (checkdoc-minor-mode 1) | |||||
| ;; End: | |||||
| ;;; flymake-easy.el ends here | |||||
| @ -0,0 +1,29 @@ | |||||
| ;;; flymake-php-autoloads.el --- automatically extracted autoloads | |||||
| ;; | |||||
| ;;; Code: | |||||
| ;;;### (autoloads (flymake-php-load) "flymake-php" "flymake-php.el" | |||||
| ;;;;;; (21154 21337 0 0)) | |||||
| ;;; Generated autoloads from flymake-php.el | |||||
| (autoload 'flymake-php-load "flymake-php" "\ | |||||
| Configure flymake mode to check the current buffer's php syntax. | |||||
| \(fn)" t nil) | |||||
| ;;;*** | |||||
| ;;;### (autoloads nil nil ("flymake-php-pkg.el") (21154 21337 226745 | |||||
| ;;;;;; 0)) | |||||
| ;;;*** | |||||
| (provide 'flymake-php-autoloads) | |||||
| ;; Local Variables: | |||||
| ;; version-control: never | |||||
| ;; no-byte-compile: t | |||||
| ;; no-update-autoloads: t | |||||
| ;; coding: utf-8 | |||||
| ;; End: | |||||
| ;;; flymake-php-autoloads.el ends here | |||||
| @ -0,0 +1 @@ | |||||
| (define-package "flymake-php" "0.5" "A flymake handler for php-mode files" (quote ((flymake-easy "0.1")))) | |||||
| @ -0,0 +1,40 @@ | |||||
| ;;; flymake-php.el --- A flymake handler for php-mode files | |||||
| ;; | |||||
| ;;; Author: Steve Purcell <steve@sanityinc.com> | |||||
| ;;; URL: https://github.com/purcell/flymake-php | |||||
| ;;; Version: 0.5 | |||||
| ;;; Package-Requires: ((flymake-easy "0.1")) | |||||
| ;;; | |||||
| ;;; Commentary: | |||||
| ;; Usage: | |||||
| ;; (require 'flymake-php) | |||||
| ;; (add-hook 'php-mode-hook 'flymake-php-load) | |||||
| ;; | |||||
| ;; Uses flymake-easy, from https://github.com/purcell/flymake-easy | |||||
| ;;; Code: | |||||
| (require 'flymake-easy) | |||||
| (defconst flymake-php-err-line-patterns | |||||
| '(("\\(?:Parse\\|Fatal\\|syntax\\) error[:,] \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil 1))) | |||||
| (defvar flymake-php-executable "php" | |||||
| "The php executable to use for syntax checking.") | |||||
| (defun flymake-php-command (filename) | |||||
| "Construct a command that flymake can use to check php source." | |||||
| (list flymake-php-executable "-l" "-f" filename)) | |||||
| ;;;###autoload | |||||
| (defun flymake-php-load () | |||||
| "Configure flymake mode to check the current buffer's php syntax." | |||||
| (interactive) | |||||
| (flymake-easy-load 'flymake-php-command | |||||
| flymake-php-err-line-patterns | |||||
| 'tempdir | |||||
| "php")) | |||||
| (provide 'flymake-php) | |||||
| ;;; flymake-php.el ends here | |||||
| @ -0,0 +1,244 @@ | |||||
| 2010-03-29 reedom <fujinaka.tohru@gmail.com> | |||||
| * [ADD] New command `geben-find-file', bound to 'C-c f' in geben-mode. | |||||
| * [ADD] New custom variable `geben-get-tramp-spec-for'. | |||||
| * [CHG] If there only single session alive, `geben-end' ends the session | |||||
| without port inquiry. | |||||
| 2009-11-19 reedom <fujinaka.tohru@gmail.com> | |||||
| * [ADD] An additional parameter `session-port' to `geben-proxy', to tell the | |||||
| proxy to use that port for for incoming debugging session. | |||||
| * [ADD] The 5th element to `geben-dbgp-default-proxy', for the same purpose | |||||
| of above. | |||||
| 2009-05-09 reedom <fujinaka.tohru@gmail.com> | |||||
| * [ADD] New command `geben-run-to-cursor', bound to 'c' in geben-mode. | |||||
| * [FIX] With Komodo's Perl Debugging Extension, GEBEN possibly caused | |||||
| an internal error when user attempted to set a lineno breakpoint | |||||
| at a blank line. | |||||
| 2009-05-08 reedom <fujinaka.tohru@gmail.com> | |||||
| * [ADD] New variable `geben-version'. | |||||
| * [ADD] New command `geben-clear-breakpoints', bound to 'U' in geben-mode. | |||||
| * [ADD] New custom variable `geben-query-on-clear-breakpoints'. | |||||
| * [ADD] New custom variable `geben-pause-at-entry-line'. | |||||
| * [ADD] New command `geben-toggle-pause-at-entry-line-flag'. | |||||
| * [CHG] Key bindings of `geben-set-redirect' is assigned to `>'. | |||||
| * [CHG] Key bindings of `geben-show-backtrace is also assigned to `t'. | |||||
| * [FIX] Even if you unset a breakpoint successfully in the current | |||||
| session, it was not removed from the persist storage. | |||||
| 2009-04-30 reedom <fujinaka.tohru@gmail.com> | |||||
| * [ADD] Add a new command `geben-eval-current-word'. | |||||
| 2009-02-25 reedom <fujinaka.tohru@gmail.com> | |||||
| * [FIX] With HTTP server running on Windows GEBEN failed to | |||||
| create script file copies. | |||||
| * [FIX] Now `eval' command works against PHP(Xdebug) same as | |||||
| before. | |||||
| 2009-02-07 reedom <fujinaka.tohru@gmail.com> | |||||
| * [FIX] Suppressed unwanted focus changing: when the context | |||||
| variable buffer was visible in any window, the focus was | |||||
| moved from the debugging buffer to the context variable | |||||
| buffer after proceeding any continuous command. | |||||
| 2009-01-22 reedom <fujinaka.tohru@gmail.com> | |||||
| * [FIX] Bug in Makefile: cannot byte-compile geben.el if the | |||||
| working directory is not one of the Emacs' default | |||||
| directories. | |||||
| 2009-01-10 reedom <fujinaka.tohru@gmail.com> | |||||
| * [FIX] Implemented `geben-quit-window' | |||||
| * [FIX] Type mismatch error was occurred in breakpoint list mode | |||||
| when any breakpoint deletion was executed. | |||||
| 2009-01-08 reedom <fujinaka.tohru@gmail.com> | |||||
| * [CHG] Redesigned. | |||||
| * [CHG] Make not to require an external DBGp client program. | |||||
| 2008-11-06 reedom <fujinaka.tohru@gmail.com> | |||||
| * [FIX] When setting breakpoint which needed fileuri against | |||||
| remote script file interactively, GEBEN asked with | |||||
| invalid fileuri as a default. | |||||
| * [FIX] Once debugger engine passed invalid fileuri, which | |||||
| have http:// scheme instead of file://, GEBEN made | |||||
| Emacs raise exceptions at exitting Emacs. | |||||
| 2008-11-04 reedom <fujinaka.tohru@gmail.com> | |||||
| * [ADD] Added Makefile. | |||||
| * [ADD] New commands `geben-mode-help' and similar to display | |||||
| description and key bindings of GEBEN's each mode. | |||||
| * [CHG] Face definition: `geben-backtrace-fileuri' | |||||
| * [CHG] Face definition: `geben-breakpoint-face' | |||||
| 2008-11-01 reedom <fujinaka.tohru@gmail.com> | |||||
| * [CHG] Dropped Emacs 21.4 due to use tree-widget.el for the | |||||
| context buffer. | |||||
| * [ADD] New command `geben-display-context and related commands. | |||||
| 2008-10-29 reedom <fujinaka.tohru@gmail.com> | |||||
| * [CHG] Renamed `ogeben-debug-target-remotep' | |||||
| to `geben-always-use-mirror-file-p'. | |||||
| * [CHG] Renamed `geben-close-remote-file-after-finish' | |||||
| to `geben-close-mirror-file-after-finish'. | |||||
| 2008-10-27 reedom <fujinaka.tohru@gmail.com> | |||||
| * [FIX] Location path for remotely fetched source files. | |||||
| 2008-10-25 reedom <fujinaka.tohru@gmail.com> | |||||
| * [CHG] Rearranged function/variable appearance order | |||||
| * [FIX] hit-value of breakpoints were ignored. | |||||
| * [FIX] In the breakpoint list buffer it was not able for | |||||
| breakpoints except line type to went to setting | |||||
| line. | |||||
| * [FIX] Breakpoint marker handling was not enough for | |||||
| breakpoints except line type. | |||||
| 2008-10-24 reedom <fujinaka.tohru@gmail.com> | |||||
| * [FIX] Improved session finishing handling. | |||||
| * [FIX] When reopen a debuggee script file which has | |||||
| any line breakpoints, GEBEN had failed to restore | |||||
| overlays. | |||||
| * [CHG] Wrote some breakpoints related code to overcome | |||||
| the difference between DBGp server implementation. | |||||
| 2008-10-23 reedom <fujinaka.tohru@gmail.com> | |||||
| * [ADD] Support for Komodo Debugger Extentions are added. | |||||
| 2008-10-22 reedom <reedom_@users.sourceforge.net> | |||||
| * [ADD] Supports a kind of breakpoint features found in | |||||
| DBGp specification. | |||||
| * [ADD] New command `geben-breakpoint-menu' and related | |||||
| commands to set a kind of breakpoint. | |||||
| Assigned to `B' key in geben-mode. | |||||
| * [ADD] New command `geben-breakpoint-list' and related | |||||
| commands to display defined breakpoint list. | |||||
| Assigned to `C-c b' key in geben-mode. | |||||
| * [ADD] New face `geben-breakpoint-fileuri'. | |||||
| * [ADD] New face `geben-breakpoint-lineno'. | |||||
| * [ADD] New face `geben-breakpoint-function'. | |||||
| * [ADD] Custom variable `geben-dbgp-feature-list'. | |||||
| * [DEL] Custom variable `geben-dbgp-feature-alist' is | |||||
| now obsolete. | |||||
| 2008-10-15 reedom <reedom_@users.sourceforge.net> | |||||
| * [FIX] Runtime errors on Emacs 21.4. | |||||
| 2008-10-13 reedom <reedom_@users.sourceforge.net> | |||||
| * [CHG] Improved redirection buffer scrolling behavior. | |||||
| 2008-10-13 reedom <reedom_@users.sourceforge.net> | |||||
| * [ADD] New command 'geben-where'. | |||||
| Assigned to `w' key in geben-mode. | |||||
| * [ADD] New face `geben-backtrace-fileuri'. | |||||
| * [ADD] New face `geben-backtrace-lineno'. | |||||
| * [CHG] Renamed DBGp client's buffer name to `*GEBEN process*. | |||||
| * [FIX] Macro version of `geben-dbgp-redirect-buffer-visiblep' | |||||
| causes runtime error on Emacs 22.1.1. | |||||
| 2008-10-11 reedom <reedom_@users.sourceforge.net> | |||||
| * [ADD] STDOUT and STDERR redirection features. | |||||
| * [ADD] New command `geben-set-redirect'. | |||||
| Assigned to `t' key in geben-mode. | |||||
| * [ADD] Custom variable `geben-dbgp-redirect-stdout'. | |||||
| * [ADD] Custom variable `geben-dbgp-redirect-stderr'. | |||||
| * [ADD] Custom variable `geben-dbgp-redirect-combine'. | |||||
| * [ADD] Custom variable `geben-dbgp-redirect-coding-system'. | |||||
| * [ADD] Custom variable `geben-dbgp-redirect-buffer-init-hook'. | |||||
| 2008-10-10 reedom <reedom_@users.sourceforge.net> | |||||
| * [ADD] Backtrace display feature. | |||||
| * [ADD] New command `geben-backtrace'. | |||||
| Assigned to `d' key in geben-mode. | |||||
| * [ADD] Custom variable `geben-display-window-function'. | |||||
| * [FIX] `defface' caused an error on Emacs 21.4 because of using | |||||
| the newly added attribute `min-color'. | |||||
| 2008-10-09 reedom <reedom_@users.sourceforge.net> | |||||
| * [ADD] Variable `geben-dbgp-current-stack'. | |||||
| 2008-10-08 reedom <reedom_@users.sourceforge.net> | |||||
| * [FIX] Fixed increasing breakpoints as often as entering | |||||
| debugging session. | |||||
| * [UPD] Now GEBEN sets/unsets breakpoint in off session state. | |||||
| * [FIX] Make GEBEN do not send commands while off session state. | |||||
| * [ADD] New argument QUIT to `geben' command. It can be specified | |||||
| by the prefix arg, as typing like `M-x C-u geben'. | |||||
| It asks executed GEBEN to quit. | |||||
| 2008-10-08 reedom <reedom_@users.sourceforge.net> | |||||
| * [FIX] Macro version of `geben-what-line' didn't run on Meadow 3.00. | |||||
| * [FIX] Byte compiled geben.el could raise undefined symbol error. | |||||
| 2008-10-07 reedom <reedom_@users.sourceforge.net> | |||||
| * [ADD] Custom face `geben-breakpoint-face'. | |||||
| * [ADD] Suppress inquiry of DBGp client termination at exiting emacs. | |||||
| 2008-10-06 reedom <reedom_@users.sourceforge.net> | |||||
| * [UPD] Now GEBEN manages buffer modification around where line-no | |||||
| breakpoint set. If there was line insertion before | |||||
| breakpoint, GEBEN moves the following line-no breakpoints | |||||
| downwards. Highlight effect(overlay) will be managed as it | |||||
| should be. | |||||
| * [ADD] Custom variable `geben-temporary-file-directory'. | |||||
| * [ADD] Custom variable `geben-close-remote-file-after-finish'. | |||||
| * [ADD] Custom variable `geben-show-breakpoints-debugging-only'. | |||||
| 2008-10-05 reedom <reedom_@users.sourceforge.net> | |||||
| * [FIX] Make GEBEN to call `step_into' at the end of the | |||||
| initial state to place debugger's cursor at the | |||||
| entry point of the debuggee script. | |||||
| * [FIX] Make GEBEN to call `stop' at the stopping state | |||||
| to finish up a debugging session as user expect. | |||||
| * [ADD] Custom variable `geben-dbgp-feature-alist'. | |||||
| * [UPD] Now GEBEN send `feature_set' commands with the variable | |||||
| `geben-dbgp-feature-alist' in the initial state. | |||||
| * [ADD] Custom variable `geben-dbgp-command-line'. | |||||
| 2008-10-04 reedom <reedom_@users.sourceforge.net> | |||||
| * geben.el: [CHG] Removed dependency on CEDET. With this changing | |||||
| many functions were removed/renamed/added | |||||
| * geben.el: [CHG] Moved all of GEBEN implementation to geben.el. | |||||
| 2007-07-04 thoney_f(reedom) <reedom_@users.sourceforge.net> | |||||
| * geben-dbgp.el: [FIX] geben-response-eval didn't decode `PHP object'. | |||||
| * geben-dbgp.el: [FIX] An overlay-arrow-position leaved after finishing | |||||
| a debug session. | |||||
| 2006-12-26 thoney_f(reedom) <reedom_@users.sourceforge.net> | |||||
| * Released version 0.01, a sample implementation. | |||||
| @ -0,0 +1,504 @@ | |||||
| GNU LESSER GENERAL PUBLIC LICENSE | |||||
| Version 2.1, February 1999 | |||||
| Copyright (C) 1991, 1999 Free Software Foundation, Inc. | |||||
| 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| Everyone is permitted to copy and distribute verbatim copies | |||||
| of this license document, but changing it is not allowed. | |||||
| [This is the first released version of the Lesser GPL. It also counts | |||||
| as the successor of the GNU Library Public License, version 2, hence | |||||
| the version number 2.1.] | |||||
| Preamble | |||||
| The licenses for most software are designed to take away your | |||||
| freedom to share and change it. By contrast, the GNU General Public | |||||
| Licenses are intended to guarantee your freedom to share and change | |||||
| free software--to make sure the software is free for all its users. | |||||
| This license, the Lesser General Public License, applies to some | |||||
| specially designated software packages--typically libraries--of the | |||||
| Free Software Foundation and other authors who decide to use it. You | |||||
| can use it too, but we suggest you first think carefully about whether | |||||
| this license or the ordinary General Public License is the better | |||||
| strategy to use in any particular case, based on the explanations below. | |||||
| When we speak of free software, we are referring to freedom of use, | |||||
| not price. Our General Public Licenses are designed to make sure that | |||||
| you have the freedom to distribute copies of free software (and charge | |||||
| for this service if you wish); that you receive source code or can get | |||||
| it if you want it; that you can change the software and use pieces of | |||||
| it in new free programs; and that you are informed that you can do | |||||
| these things. | |||||
| To protect your rights, we need to make restrictions that forbid | |||||
| distributors to deny you these rights or to ask you to surrender these | |||||
| rights. These restrictions translate to certain responsibilities for | |||||
| you if you distribute copies of the library or if you modify it. | |||||
| For example, if you distribute copies of the library, whether gratis | |||||
| or for a fee, you must give the recipients all the rights that we gave | |||||
| you. You must make sure that they, too, receive or can get the source | |||||
| code. If you link other code with the library, you must provide | |||||
| complete object files to the recipients, so that they can relink them | |||||
| with the library after making changes to the library and recompiling | |||||
| it. And you must show them these terms so they know their rights. | |||||
| We protect your rights with a two-step method: (1) we copyright the | |||||
| library, and (2) we offer you this license, which gives you legal | |||||
| permission to copy, distribute and/or modify the library. | |||||
| To protect each distributor, we want to make it very clear that | |||||
| there is no warranty for the free library. Also, if the library is | |||||
| modified by someone else and passed on, the recipients should know | |||||
| that what they have is not the original version, so that the original | |||||
| author's reputation will not be affected by problems that might be | |||||
| introduced by others. | |||||
| Finally, software patents pose a constant threat to the existence of | |||||
| any free program. We wish to make sure that a company cannot | |||||
| effectively restrict the users of a free program by obtaining a | |||||
| restrictive license from a patent holder. Therefore, we insist that | |||||
| any patent license obtained for a version of the library must be | |||||
| consistent with the full freedom of use specified in this license. | |||||
| Most GNU software, including some libraries, is covered by the | |||||
| ordinary GNU General Public License. This license, the GNU Lesser | |||||
| General Public License, applies to certain designated libraries, and | |||||
| is quite different from the ordinary General Public License. We use | |||||
| this license for certain libraries in order to permit linking those | |||||
| libraries into non-free programs. | |||||
| When a program is linked with a library, whether statically or using | |||||
| a shared library, the combination of the two is legally speaking a | |||||
| combined work, a derivative of the original library. The ordinary | |||||
| General Public License therefore permits such linking only if the | |||||
| entire combination fits its criteria of freedom. The Lesser General | |||||
| Public License permits more lax criteria for linking other code with | |||||
| the library. | |||||
| We call this license the "Lesser" General Public License because it | |||||
| does Less to protect the user's freedom than the ordinary General | |||||
| Public License. It also provides other free software developers Less | |||||
| of an advantage over competing non-free programs. These disadvantages | |||||
| are the reason we use the ordinary General Public License for many | |||||
| libraries. However, the Lesser license provides advantages in certain | |||||
| special circumstances. | |||||
| For example, on rare occasions, there may be a special need to | |||||
| encourage the widest possible use of a certain library, so that it becomes | |||||
| a de-facto standard. To achieve this, non-free programs must be | |||||
| allowed to use the library. A more frequent case is that a free | |||||
| library does the same job as widely used non-free libraries. In this | |||||
| case, there is little to gain by limiting the free library to free | |||||
| software only, so we use the Lesser General Public License. | |||||
| In other cases, permission to use a particular library in non-free | |||||
| programs enables a greater number of people to use a large body of | |||||
| free software. For example, permission to use the GNU C Library in | |||||
| non-free programs enables many more people to use the whole GNU | |||||
| operating system, as well as its variant, the GNU/Linux operating | |||||
| system. | |||||
| Although the Lesser General Public License is Less protective of the | |||||
| users' freedom, it does ensure that the user of a program that is | |||||
| linked with the Library has the freedom and the wherewithal to run | |||||
| that program using a modified version of the Library. | |||||
| The precise terms and conditions for copying, distribution and | |||||
| modification follow. Pay close attention to the difference between a | |||||
| "work based on the library" and a "work that uses the library". The | |||||
| former contains code derived from the library, whereas the latter must | |||||
| be combined with the library in order to run. | |||||
| GNU LESSER GENERAL PUBLIC LICENSE | |||||
| TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |||||
| 0. This License Agreement applies to any software library or other | |||||
| program which contains a notice placed by the copyright holder or | |||||
| other authorized party saying it may be distributed under the terms of | |||||
| this Lesser General Public License (also called "this License"). | |||||
| Each licensee is addressed as "you". | |||||
| A "library" means a collection of software functions and/or data | |||||
| prepared so as to be conveniently linked with application programs | |||||
| (which use some of those functions and data) to form executables. | |||||
| The "Library", below, refers to any such software library or work | |||||
| which has been distributed under these terms. A "work based on the | |||||
| Library" means either the Library or any derivative work under | |||||
| copyright law: that is to say, a work containing the Library or a | |||||
| portion of it, either verbatim or with modifications and/or translated | |||||
| straightforwardly into another language. (Hereinafter, translation is | |||||
| included without limitation in the term "modification".) | |||||
| "Source code" for a work means the preferred form of the work for | |||||
| making modifications to it. For a library, complete source code means | |||||
| all the source code for all modules it contains, plus any associated | |||||
| interface definition files, plus the scripts used to control compilation | |||||
| and installation of the library. | |||||
| Activities other than copying, distribution and modification are not | |||||
| covered by this License; they are outside its scope. The act of | |||||
| running a program using the Library is not restricted, and output from | |||||
| such a program is covered only if its contents constitute a work based | |||||
| on the Library (independent of the use of the Library in a tool for | |||||
| writing it). Whether that is true depends on what the Library does | |||||
| and what the program that uses the Library does. | |||||
| 1. You may copy and distribute verbatim copies of the Library's | |||||
| complete source code as you receive it, in any medium, provided that | |||||
| you conspicuously and appropriately publish on each copy an | |||||
| appropriate copyright notice and disclaimer of warranty; keep intact | |||||
| all the notices that refer to this License and to the absence of any | |||||
| warranty; and distribute a copy of this License along with the | |||||
| Library. | |||||
| You may charge a fee for the physical act of transferring a copy, | |||||
| and you may at your option offer warranty protection in exchange for a | |||||
| fee. | |||||
| 2. You may modify your copy or copies of the Library or any portion | |||||
| of it, thus forming a work based on the Library, and copy and | |||||
| distribute such modifications or work under the terms of Section 1 | |||||
| above, provided that you also meet all of these conditions: | |||||
| a) The modified work must itself be a software library. | |||||
| b) You must cause the files modified to carry prominent notices | |||||
| stating that you changed the files and the date of any change. | |||||
| c) You must cause the whole of the work to be licensed at no | |||||
| charge to all third parties under the terms of this License. | |||||
| d) If a facility in the modified Library refers to a function or a | |||||
| table of data to be supplied by an application program that uses | |||||
| the facility, other than as an argument passed when the facility | |||||
| is invoked, then you must make a good faith effort to ensure that, | |||||
| in the event an application does not supply such function or | |||||
| table, the facility still operates, and performs whatever part of | |||||
| its purpose remains meaningful. | |||||
| (For example, a function in a library to compute square roots has | |||||
| a purpose that is entirely well-defined independent of the | |||||
| application. Therefore, Subsection 2d requires that any | |||||
| application-supplied function or table used by this function must | |||||
| be optional: if the application does not supply it, the square | |||||
| root function must still compute square roots.) | |||||
| These requirements apply to the modified work as a whole. If | |||||
| identifiable sections of that work are not derived from the Library, | |||||
| and can be reasonably considered independent and separate works in | |||||
| themselves, then this License, and its terms, do not apply to those | |||||
| sections when you distribute them as separate works. But when you | |||||
| distribute the same sections as part of a whole which is a work based | |||||
| on the Library, the distribution of the whole must be on the terms of | |||||
| this License, whose permissions for other licensees extend to the | |||||
| entire whole, and thus to each and every part regardless of who wrote | |||||
| it. | |||||
| Thus, it is not the intent of this section to claim rights or contest | |||||
| your rights to work written entirely by you; rather, the intent is to | |||||
| exercise the right to control the distribution of derivative or | |||||
| collective works based on the Library. | |||||
| In addition, mere aggregation of another work not based on the Library | |||||
| with the Library (or with a work based on the Library) on a volume of | |||||
| a storage or distribution medium does not bring the other work under | |||||
| the scope of this License. | |||||
| 3. You may opt to apply the terms of the ordinary GNU General Public | |||||
| License instead of this License to a given copy of the Library. To do | |||||
| this, you must alter all the notices that refer to this License, so | |||||
| that they refer to the ordinary GNU General Public License, version 2, | |||||
| instead of to this License. (If a newer version than version 2 of the | |||||
| ordinary GNU General Public License has appeared, then you can specify | |||||
| that version instead if you wish.) Do not make any other change in | |||||
| these notices. | |||||
| Once this change is made in a given copy, it is irreversible for | |||||
| that copy, so the ordinary GNU General Public License applies to all | |||||
| subsequent copies and derivative works made from that copy. | |||||
| This option is useful when you wish to copy part of the code of | |||||
| the Library into a program that is not a library. | |||||
| 4. You may copy and distribute the Library (or a portion or | |||||
| derivative of it, under Section 2) in object code or executable form | |||||
| under the terms of Sections 1 and 2 above provided that you accompany | |||||
| it with the complete corresponding machine-readable source code, which | |||||
| must be distributed under the terms of Sections 1 and 2 above on a | |||||
| medium customarily used for software interchange. | |||||
| If distribution of object code is made by offering access to copy | |||||
| from a designated place, then offering equivalent access to copy the | |||||
| source code from the same place satisfies the requirement to | |||||
| distribute the source code, even though third parties are not | |||||
| compelled to copy the source along with the object code. | |||||
| 5. A program that contains no derivative of any portion of the | |||||
| Library, but is designed to work with the Library by being compiled or | |||||
| linked with it, is called a "work that uses the Library". Such a | |||||
| work, in isolation, is not a derivative work of the Library, and | |||||
| therefore falls outside the scope of this License. | |||||
| However, linking a "work that uses the Library" with the Library | |||||
| creates an executable that is a derivative of the Library (because it | |||||
| contains portions of the Library), rather than a "work that uses the | |||||
| library". The executable is therefore covered by this License. | |||||
| Section 6 states terms for distribution of such executables. | |||||
| When a "work that uses the Library" uses material from a header file | |||||
| that is part of the Library, the object code for the work may be a | |||||
| derivative work of the Library even though the source code is not. | |||||
| Whether this is true is especially significant if the work can be | |||||
| linked without the Library, or if the work is itself a library. The | |||||
| threshold for this to be true is not precisely defined by law. | |||||
| If such an object file uses only numerical parameters, data | |||||
| structure layouts and accessors, and small macros and small inline | |||||
| functions (ten lines or less in length), then the use of the object | |||||
| file is unrestricted, regardless of whether it is legally a derivative | |||||
| work. (Executables containing this object code plus portions of the | |||||
| Library will still fall under Section 6.) | |||||
| Otherwise, if the work is a derivative of the Library, you may | |||||
| distribute the object code for the work under the terms of Section 6. | |||||
| Any executables containing that work also fall under Section 6, | |||||
| whether or not they are linked directly with the Library itself. | |||||
| 6. As an exception to the Sections above, you may also combine or | |||||
| link a "work that uses the Library" with the Library to produce a | |||||
| work containing portions of the Library, and distribute that work | |||||
| under terms of your choice, provided that the terms permit | |||||
| modification of the work for the customer's own use and reverse | |||||
| engineering for debugging such modifications. | |||||
| You must give prominent notice with each copy of the work that the | |||||
| Library is used in it and that the Library and its use are covered by | |||||
| this License. You must supply a copy of this License. If the work | |||||
| during execution displays copyright notices, you must include the | |||||
| copyright notice for the Library among them, as well as a reference | |||||
| directing the user to the copy of this License. Also, you must do one | |||||
| of these things: | |||||
| a) Accompany the work with the complete corresponding | |||||
| machine-readable source code for the Library including whatever | |||||
| changes were used in the work (which must be distributed under | |||||
| Sections 1 and 2 above); and, if the work is an executable linked | |||||
| with the Library, with the complete machine-readable "work that | |||||
| uses the Library", as object code and/or source code, so that the | |||||
| user can modify the Library and then relink to produce a modified | |||||
| executable containing the modified Library. (It is understood | |||||
| that the user who changes the contents of definitions files in the | |||||
| Library will not necessarily be able to recompile the application | |||||
| to use the modified definitions.) | |||||
| b) Use a suitable shared library mechanism for linking with the | |||||
| Library. A suitable mechanism is one that (1) uses at run time a | |||||
| copy of the library already present on the user's computer system, | |||||
| rather than copying library functions into the executable, and (2) | |||||
| will operate properly with a modified version of the library, if | |||||
| the user installs one, as long as the modified version is | |||||
| interface-compatible with the version that the work was made with. | |||||
| c) Accompany the work with a written offer, valid for at | |||||
| least three years, to give the same user the materials | |||||
| specified in Subsection 6a, above, for a charge no more | |||||
| than the cost of performing this distribution. | |||||
| d) If distribution of the work is made by offering access to copy | |||||
| from a designated place, offer equivalent access to copy the above | |||||
| specified materials from the same place. | |||||
| e) Verify that the user has already received a copy of these | |||||
| materials or that you have already sent this user a copy. | |||||
| For an executable, the required form of the "work that uses the | |||||
| Library" must include any data and utility programs needed for | |||||
| reproducing the executable from it. However, as a special exception, | |||||
| the materials to be distributed need not include anything that is | |||||
| normally distributed (in either source or binary form) with the major | |||||
| components (compiler, kernel, and so on) of the operating system on | |||||
| which the executable runs, unless that component itself accompanies | |||||
| the executable. | |||||
| It may happen that this requirement contradicts the license | |||||
| restrictions of other proprietary libraries that do not normally | |||||
| accompany the operating system. Such a contradiction means you cannot | |||||
| use both them and the Library together in an executable that you | |||||
| distribute. | |||||
| 7. You may place library facilities that are a work based on the | |||||
| Library side-by-side in a single library together with other library | |||||
| facilities not covered by this License, and distribute such a combined | |||||
| library, provided that the separate distribution of the work based on | |||||
| the Library and of the other library facilities is otherwise | |||||
| permitted, and provided that you do these two things: | |||||
| a) Accompany the combined library with a copy of the same work | |||||
| based on the Library, uncombined with any other library | |||||
| facilities. This must be distributed under the terms of the | |||||
| Sections above. | |||||
| b) Give prominent notice with the combined library of the fact | |||||
| that part of it is a work based on the Library, and explaining | |||||
| where to find the accompanying uncombined form of the same work. | |||||
| 8. You may not copy, modify, sublicense, link with, or distribute | |||||
| the Library except as expressly provided under this License. Any | |||||
| attempt otherwise to copy, modify, sublicense, link with, or | |||||
| distribute the Library is void, and will automatically terminate your | |||||
| rights under this License. However, parties who have received copies, | |||||
| or rights, from you under this License will not have their licenses | |||||
| terminated so long as such parties remain in full compliance. | |||||
| 9. You are not required to accept this License, since you have not | |||||
| signed it. However, nothing else grants you permission to modify or | |||||
| distribute the Library or its derivative works. These actions are | |||||
| prohibited by law if you do not accept this License. Therefore, by | |||||
| modifying or distributing the Library (or any work based on the | |||||
| Library), you indicate your acceptance of this License to do so, and | |||||
| all its terms and conditions for copying, distributing or modifying | |||||
| the Library or works based on it. | |||||
| 10. Each time you redistribute the Library (or any work based on the | |||||
| Library), the recipient automatically receives a license from the | |||||
| original licensor to copy, distribute, link with or modify the Library | |||||
| subject to these terms and conditions. You may not impose any further | |||||
| restrictions on the recipients' exercise of the rights granted herein. | |||||
| You are not responsible for enforcing compliance by third parties with | |||||
| this License. | |||||
| 11. If, as a consequence of a court judgment or allegation of patent | |||||
| infringement or for any other reason (not limited to patent issues), | |||||
| conditions are imposed on you (whether by court order, agreement or | |||||
| otherwise) that contradict the conditions of this License, they do not | |||||
| excuse you from the conditions of this License. If you cannot | |||||
| distribute so as to satisfy simultaneously your obligations under this | |||||
| License and any other pertinent obligations, then as a consequence you | |||||
| may not distribute the Library at all. For example, if a patent | |||||
| license would not permit royalty-free redistribution of the Library by | |||||
| all those who receive copies directly or indirectly through you, then | |||||
| the only way you could satisfy both it and this License would be to | |||||
| refrain entirely from distribution of the Library. | |||||
| If any portion of this section is held invalid or unenforceable under any | |||||
| particular circumstance, the balance of the section is intended to apply, | |||||
| and the section as a whole is intended to apply in other circumstances. | |||||
| It is not the purpose of this section to induce you to infringe any | |||||
| patents or other property right claims or to contest validity of any | |||||
| such claims; this section has the sole purpose of protecting the | |||||
| integrity of the free software distribution system which is | |||||
| implemented by public license practices. Many people have made | |||||
| generous contributions to the wide range of software distributed | |||||
| through that system in reliance on consistent application of that | |||||
| system; it is up to the author/donor to decide if he or she is willing | |||||
| to distribute software through any other system and a licensee cannot | |||||
| impose that choice. | |||||
| This section is intended to make thoroughly clear what is believed to | |||||
| be a consequence of the rest of this License. | |||||
| 12. If the distribution and/or use of the Library is restricted in | |||||
| certain countries either by patents or by copyrighted interfaces, the | |||||
| original copyright holder who places the Library under this License may add | |||||
| an explicit geographical distribution limitation excluding those countries, | |||||
| so that distribution is permitted only in or among countries not thus | |||||
| excluded. In such case, this License incorporates the limitation as if | |||||
| written in the body of this License. | |||||
| 13. The Free Software Foundation may publish revised and/or new | |||||
| versions of the Lesser General Public License from time to time. | |||||
| Such new versions will be similar in spirit to the present version, | |||||
| but may differ in detail to address new problems or concerns. | |||||
| Each version is given a distinguishing version number. If the Library | |||||
| specifies a version number of this License which applies to it and | |||||
| "any later version", you have the option of following the terms and | |||||
| conditions either of that version or of any later version published by | |||||
| the Free Software Foundation. If the Library does not specify a | |||||
| license version number, you may choose any version ever published by | |||||
| the Free Software Foundation. | |||||
| 14. If you wish to incorporate parts of the Library into other free | |||||
| programs whose distribution conditions are incompatible with these, | |||||
| write to the author to ask for permission. For software which is | |||||
| copyrighted by the Free Software Foundation, write to the Free | |||||
| Software Foundation; we sometimes make exceptions for this. Our | |||||
| decision will be guided by the two goals of preserving the free status | |||||
| of all derivatives of our free software and of promoting the sharing | |||||
| and reuse of software generally. | |||||
| NO WARRANTY | |||||
| 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO | |||||
| WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. | |||||
| EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR | |||||
| OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY | |||||
| KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE | |||||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |||||
| PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE | |||||
| LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME | |||||
| THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |||||
| 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN | |||||
| WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY | |||||
| AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU | |||||
| FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR | |||||
| CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE | |||||
| LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING | |||||
| RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A | |||||
| FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF | |||||
| SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | |||||
| DAMAGES. | |||||
| END OF TERMS AND CONDITIONS | |||||
| How to Apply These Terms to Your New Libraries | |||||
| If you develop a new library, and you want it to be of the greatest | |||||
| possible use to the public, we recommend making it free software that | |||||
| everyone can redistribute and change. You can do so by permitting | |||||
| redistribution under these terms (or, alternatively, under the terms of the | |||||
| ordinary General Public License). | |||||
| To apply these terms, attach the following notices to the library. It is | |||||
| safest to attach them to the start of each source file to most effectively | |||||
| convey the exclusion of warranty; and each file should have at least the | |||||
| "copyright" line and a pointer to where the full notice is found. | |||||
| <one line to give the library's name and a brief idea of what it does.> | |||||
| Copyright (C) <year> <name of author> | |||||
| This library is free software; you can redistribute it and/or | |||||
| modify it under the terms of the GNU Lesser General Public | |||||
| License as published by the Free Software Foundation; either | |||||
| version 2.1 of the License, or (at your option) any later version. | |||||
| This library is distributed in the hope that it will be useful, | |||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
| Lesser General Public License for more details. | |||||
| You should have received a copy of the GNU Lesser General Public | |||||
| License along with this library; if not, write to the Free Software | |||||
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| Also add information on how to contact you by electronic and paper mail. | |||||
| You should also get your employer (if you work as a programmer) or your | |||||
| school, if any, to sign a "copyright disclaimer" for the library, if | |||||
| necessary. Here is a sample; alter the names: | |||||
| Yoyodyne, Inc., hereby disclaims all copyright interest in the | |||||
| library `Frob' (a library for tweaking knobs) written by James Random Hacker. | |||||
| <signature of Ty Coon>, 1 April 1990 | |||||
| Ty Coon, President of Vice | |||||
| That's all there is to it! | |||||
| @ -0,0 +1,187 @@ | |||||
| Version 0.26 (20010-03-29) | |||||
| * new command: | |||||
| - `geben-find-file', bound to 'C-c f' in geben-mode. | |||||
| * new custom variable: | |||||
| - `geben-get-tramp-spec-for'. | |||||
| * improved: | |||||
| - If there only single session alive, `geben-end' ends the session | |||||
| without port inquiry. | |||||
| Version 0.25 (2009-11-19) | |||||
| * improved: | |||||
| - to `geben-proxy' now you can specify any fixed port number to | |||||
| which incoming debugging session is bound. | |||||
| Version 0.24 (2009-05-08) | |||||
| * new commands added: | |||||
| - geben-clear-breakpoints; bound to 'U' in geben-mode. | |||||
| - geben-run-to-cursor; bound to 'c' in geben-mode. | |||||
| * new custom variables added: | |||||
| - geben-query-on-clear-breakpoints | |||||
| * new variables added: | |||||
| - geben-version | |||||
| * changed: Key bindings of `geben-set-redirect' is assigned to `>'. | |||||
| * changed: Key bindings of `geben-show-backtrace is also assigned to `t'. | |||||
| * fixed: Even if you unset a breakpoint successfully in the current | |||||
| session, it was not removed from the persist storage. | |||||
| * fixed: With Komodo's Perl Debugging Extension, GEBEN possibly | |||||
| caused an internal error when user attempted to set a | |||||
| lineno breakpoint at a blank line. | |||||
| Version 0.23 (2009-02-25) | |||||
| * improved: Suppressed unwanted focus changing - when the context | |||||
| variable buffer was visible in any window, the focus was | |||||
| moved from the debugging buffer to the context variable | |||||
| buffer after proceeding any continuous command. | |||||
| * fixed: Now GEBEN works With HTTP server running on Windows unlike | |||||
| before. | |||||
| * fixed: Now `eval' command works against PHP(Xdebug) same as | |||||
| before. | |||||
| Version 0.22 (2009-01-22) | |||||
| * fixed: Bug in Makefile: cannot byte-compile geben.el if the | |||||
| working directory is not one of the Emacs' default | |||||
| directories. | |||||
| Version 0.21 (2009-01-10) | |||||
| * fixed: Implemented `geben-quit-window'. | |||||
| * fixed: Type mismatch error was occurred in breakpoint list mode | |||||
| when any breakpoint deletion was executed. | |||||
| Version 0.20 (2009-01-08) | |||||
| Redesigned. | |||||
| From this release GEBEN does not require an external DBGp client | |||||
| program. | |||||
| * changed: | |||||
| - GEBEN always mirrors debuggee script files under `geben-mode'. | |||||
| When you need to open the original script file to edit, hit any | |||||
| unbound keys of geben-mode and GEBEN asks you to open one. If | |||||
| you respond `yes' then GEBEN attempts to visit the file via | |||||
| `TRAMP'. | |||||
| - More, many things. | |||||
| Version 0.19 (2008-11-06) | |||||
| * fixed: Emacs may not be able to exit by exception. | |||||
| * fixed: Default fileuri parameter on setting breakpoint may be | |||||
| invalid. | |||||
| Version 0.18 (2008-11-04) | |||||
| From this release GEBEN has shifted from beta stage. | |||||
| Incompatible changes: | |||||
| * GEBEN dropped Emacs 21.4 support. | |||||
| Now GEBEN requires Emacs 22.1 and later. | |||||
| Visible changes: | |||||
| * new commands added: | |||||
| - geben-display-context and related commands. | |||||
| - `geben-mode-help' and similar commands to display description | |||||
| and key bindings of GEBEN's each mode. | |||||
| * custom face added: | |||||
| - geben-context-category-face | |||||
| - geben-context-variable-face | |||||
| - geben-context-type-face | |||||
| - geben-context-class-face | |||||
| - geben-context-string-face | |||||
| - geben-context-constant-face | |||||
| Version 0.17 (2008-10-27) | |||||
| Visible changes: | |||||
| * fixed: Location path for remotely fetched source files. | |||||
| Version 0.16 (2008-10-25) | |||||
| Visible changes: | |||||
| * support for Komodo Debugger Extensions are added. | |||||
| * fixed: improved session finishing handling. | |||||
| * fixed: when reopen a debuggee script file which has any line | |||||
| breakpoints, GEBEN had failed to restore overlays. | |||||
| Version 0.15 (2008-10-22) | |||||
| Visible changes: | |||||
| * new commands added: | |||||
| - geben-breakpoint-menu and related commands. | |||||
| - geben-breakpoint-list and related commands. | |||||
| * custom variables added: | |||||
| - geben-dbgp-feature-list | |||||
| * custom face added: | |||||
| - geben-breakpoint-fileuri | |||||
| - geben-breakpoint-lineno | |||||
| - geben-breakpoint-function | |||||
| * custom variables remove: | |||||
| - geben-dbgp-feature-alist | |||||
| Version 0.14 (2008-10-15) | |||||
| * fixed: Runtime erros on Emacs 21.4. | |||||
| Version 0.13 (2008-10-13) | |||||
| Visible changes: | |||||
| * new commands added: | |||||
| - geben-backtrace | |||||
| - geben-where | |||||
| - geben-set-redirect | |||||
| * custom variables added: | |||||
| - geben-display-window-function | |||||
| - geben-dbgp-redirect-stdout | |||||
| - geben-dbgp-redirect-stderr | |||||
| - geben-dbgp-redirect-combine | |||||
| - geben-dbgp-redirect-coding-system | |||||
| - geben-dbgp-redirect-buffer-init-hook | |||||
| * custom face added: | |||||
| - geben-backtrace-fileuri | |||||
| - geben-backtrace-lineno | |||||
| * fixed: compiling error on Emacs 21.4 in `defface' definition. | |||||
| * changed: renamed DBGp client's buffer name to `*GEBEN process*. | |||||
| Version 0.12 (2008-10-08) | |||||
| Visible changes: | |||||
| * added: New argument QUIT to `geben' command. | |||||
| It can be specified by the prefix arg, as typing like | |||||
| `M-x C-u geben'. This asks executed GEBEN to quit. | |||||
| * Now GEBEN sets/unsets breakpoint even in off session state. | |||||
| * fixed: Make GEBEN do not send commands while off session state. | |||||
| * fixed: Increasing breakpoints by entering debugging session. | |||||
| Version 0.11 (2008-10-08) | |||||
| * fixed: Byte compiled geben.el could raise undefined | |||||
| symbol error. | |||||
| Version 0.10 (2008-10-07) | |||||
| Incompatible changes: | |||||
| * Removed dependencies on `CEDET' package. | |||||
| Visible changes: | |||||
| * fixed: Improved line-no breakpoint handling. | |||||
| * fixed: Improved initial and final state handling. | |||||
| * custom variables added: | |||||
| - geben-dbgp-feature-alist | |||||
| - geben-dbgp-command-line | |||||
| - geben-temporary-file-directory | |||||
| - geben-close-remote-file-after-finish | |||||
| - geben-show-breakpoints-debugging-only | |||||
| * custom face added: | |||||
| - geben-breakpoint-face | |||||
| Version 0.01 (2006-12-26) | |||||
| * Sample implementation. | |||||
| @ -0,0 +1,189 @@ | |||||
| GEBEN-0.26 (Beta) | |||||
| ----------------- | |||||
| GEBEN is a software package that interfaces Emacs to DBGp protocol | |||||
| with which you can debug running scripts interactive. At this present | |||||
| DBGp protocol are supported in several script languages with help of | |||||
| custom extensions. | |||||
| * PHP with Xdebug 2.0.* | |||||
| * Perl, Python, Ruby and Tcl with Komodo Debugger Extensions | |||||
| Currently GEBEN implements the following features. | |||||
| * continuation commands: run/stop/step-in/step-over/step-out | |||||
| * set/unset/listing breakpoints | |||||
| * expression evaluation | |||||
| * STDOUT/STDERR redirection | |||||
| * backtrace listing | |||||
| * variable inspection | |||||
| REQUIREMENTS | |||||
| ------------ | |||||
| [server side] | |||||
| - DBGp protocol enabled script engine, like: | |||||
| - PHP with Xdebug | |||||
| - Python with Komode Debugger Extension | |||||
| - etc. | |||||
| [client side] | |||||
| - Emacs22.1 or later | |||||
| BIG CHANGES | |||||
| ----------- | |||||
| - Since version 0.20 GEBEN does not require an external DBGp client | |||||
| program `debugclient'. | |||||
| - At version 0.18 GEBEN dropped Emacs 21.4. | |||||
| - Since version 0.1 GEBEN does not depend on CEDET emacs library. | |||||
| If you have installed CEDET previously only for GEBEN-pre-alpha, | |||||
| you can uninstall CEDET if you want. | |||||
| - Now GEBEN lisp package forms a monolithic file. | |||||
| If you have installed previous version, you should remove all of old | |||||
| GEBEN files from installation directory. | |||||
| INSTALLATION | |||||
| ------------ | |||||
| [server side] | |||||
| - To debug PHP scripts, you'll need to install PHP, Xdebug and | |||||
| optionally a web server. Please visit their official sites to get | |||||
| packages and instructions of installation and configuration. | |||||
| PHP: http://php.net | |||||
| Xdebug: http://xdebug.org | |||||
| - To debug Perl, Python, Ruby and Tcl with GEBEN, Komodo | |||||
| Debugging Extensions will give you a big help. | |||||
| Distribution: http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging | |||||
| Documentation: http://aspn.activestate.com/ASPN/Reference/Products/Komodo/komodo-doc-debugger.html | |||||
| [client side] | |||||
| 1. Unpack GEBEN source code package and change directory to the | |||||
| unpacked directory. | |||||
| <With GNU make command> | |||||
| a. run `make'(or `gmake', depends on your environment). | |||||
| b. If you are an administrator, Run: sudo make install | |||||
| b' Or Run: SITELISP=$HOME/path/to/install make install | |||||
| <Without GNU make command> | |||||
| a. Byte compile 'dbgp.el'. | |||||
| b. Byte compile `geben.el'. | |||||
| c. Copy `dbgp.elc', `geben.elc' and entire `tree-widget' directory to | |||||
| any directory where Emacs can find.(Or add the path to `load-path' | |||||
| list) | |||||
| <common> | |||||
| 2. Insert autoload hooks into your .Emacs file. | |||||
| -> (autoload 'geben "geben" "PHP Debugger on Emacs" t) | |||||
| 3. Restart Emacs. | |||||
| DEBUGGING | |||||
| --------- | |||||
| Here is an illustration on PHP debugging. | |||||
| 1. Run Emacs. | |||||
| 2. Start geben, type: M-x geben | |||||
| 3. Access to the target PHP script page with any browser. | |||||
| You may need to add a query parameter `XDEBUG_SESSION_START' if you | |||||
| configured Xdebug to require manual trigger to start a remote | |||||
| debugging session. | |||||
| e.g.) http://www.example.com/test.php?XDEBUG_SESSION_START=1 | |||||
| 4. Soon the server and GEBEN establish a debugging session | |||||
| connection. Then Emacs loads the script source code of the entry | |||||
| page in a buffer. | |||||
| 5. Now the buffer is under the minor-mode 'geben-mode'. | |||||
| You can control the debugger with several keys. | |||||
| spc step into/step over | |||||
| i step into | |||||
| o step over | |||||
| r step out | |||||
| g run | |||||
| c run to cursor | |||||
| b set a breakpoint at a line | |||||
| B set a breakpoint interactively | |||||
| u unset a breakpoint at a line | |||||
| U clear all breakpoints | |||||
| \C-c b display breakpoint list | |||||
| > set redirection mode | |||||
| \C-u t change redirection mode | |||||
| d display backtrace | |||||
| t display backtrace | |||||
| v display context variables | |||||
| \C-c f visit script file | |||||
| w where | |||||
| q stop | |||||
| When you hit any unbound key of `geben-mode', GEBEN will ask you to | |||||
| edit the original script file. Say yes and GEBEN will attempts to | |||||
| load the script file via `TRAMP'. | |||||
| 6. If you felt you'd debugged enough, it's time to quit GEBEN. | |||||
| To quit GEBEN, type: M-x geben-end | |||||
| Known Issues | |||||
| ------------ | |||||
| * This version is not tested with Xdebug 2.1.* yet. | |||||
| * There are some issues related Xdebug, version of at least 2.0.3. | |||||
| - Xdebug does not support STDERR command feature so that STDERR | |||||
| redirection feature does not work expectedly. | |||||
| - Xdebug does not implement `dbgp:' scheme feature so that with | |||||
| `step-in' command into a lambda function (you can create it with | |||||
| `create_function' in PHP) the cursor position is located at | |||||
| invalid line. | |||||
| - Xdebug may tell invalid line number on breaking by `return' type | |||||
| breakpoint. To this case GEBEN indicates the cursor at the top of | |||||
| the file in where the current breakpoint exists. | |||||
| - Xdebug unexpectedly breaks on returning from class/instance method | |||||
| if there is a `call' type breakpoint to the method. | |||||
| - If Xdebug is not loaded not as `zend_extension', some feature do | |||||
| not work as expectedly (e.g. step_into). | |||||
| SUPPORT | |||||
| ------- | |||||
| We all time need your supports - bug reports, feature requests, | |||||
| code/documents/design contributions, and donations. | |||||
| To submit one or more of them, please visit our web site. | |||||
| http://code.google.com/p/geben-on-emacs/ | |||||
| Also there are mailinglists. | |||||
| For usage questions: | |||||
| http://groups.google.com/group/geben-users | |||||
| For package contributions: | |||||
| http://groups.google.com/group/geben-dev | |||||
| Your posts will make GEBEN development progress. | |||||
| Thank you. | |||||
| -- | |||||
| reedom <fujinaka.tohru@gmail.com> | |||||
| @ -0,0 +1,938 @@ | |||||
| ;;; dbgp.el --- DBGp protocol interface | |||||
| ;; $Id: dbgp.el 116 2010-03-29 12:35:47Z fujinaka.tohru $ | |||||
| ;; | |||||
| ;; Filename: dbgp.el | |||||
| ;; Author: reedom <fujinaka.tohru@gmail.com> | |||||
| ;; Maintainer: reedom <fujinaka.tohru@gmail.com> | |||||
| ;; Version: 0.26 | |||||
| ;; URL: http://code.google.com/p/geben-on-emacs/ | |||||
| ;; Keywords: DBGp, debugger, PHP, Xdebug, Perl, Python, Ruby, Tcl, Komodo | |||||
| ;; Compatibility: Emacs 22.1 | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs | |||||
| ;; | |||||
| ;; This program is free software; you can redistribute it and/or | |||||
| ;; modify it under the terms of the GNU General Public License as | |||||
| ;; published by the Free Software Foundation; either version 2, or | |||||
| ;; (at your option) any later version. | |||||
| ;; | |||||
| ;; This program is distributed in the hope that it will be useful, | |||||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
| ;; General Public License for more details. | |||||
| ;; | |||||
| ;; You should have received a copy of the GNU General Public License | |||||
| ;; along with this program; see the file COPYING. If not, write to | |||||
| ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth | |||||
| ;; Floor, Boston, MA 02110-1301, USA. | |||||
| ;; | |||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |||||
| ;; | |||||
| ;;; Commentary: | |||||
| ;; | |||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |||||
| ;; | |||||
| ;;; Code: | |||||
| (eval-when-compile | |||||
| (when (or (not (boundp 'emacs-version)) | |||||
| (string< emacs-version "22.1")) | |||||
| (error (concat "geben.el: This package requires Emacs 22.1 or later.")))) | |||||
| (eval-and-compile | |||||
| (require 'cl) | |||||
| (require 'xml)) | |||||
| (require 'comint) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; customization | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; For compatibility between versions of custom | |||||
| (eval-and-compile | |||||
| (condition-case () | |||||
| (require 'custom) | |||||
| (error nil)) | |||||
| (if (and (featurep 'custom) (fboundp 'custom-declare-variable) | |||||
| ;; Some XEmacsen w/ custom don't have :set keyword. | |||||
| ;; This protects them against custom. | |||||
| (fboundp 'custom-initialize-set)) | |||||
| nil ;; We've got what we needed | |||||
| ;; We have the old custom-library, hack around it! | |||||
| (if (boundp 'defgroup) | |||||
| nil | |||||
| (defmacro defgroup (&rest args) | |||||
| nil)) | |||||
| (if (boundp 'defcustom) | |||||
| nil | |||||
| (defmacro defcustom (var value doc &rest args) | |||||
| `(defvar (,var) (,value) (,doc)))))) | |||||
| ;; customize group | |||||
| (defgroup dbgp nil | |||||
| "DBGp protocol interface." | |||||
| :group 'debug) | |||||
| (defgroup dbgp-highlighting-faces nil | |||||
| "Faces for DBGp process buffer." | |||||
| :group 'dbgp | |||||
| :group 'font-lock-highlighting-faces) | |||||
| (defcustom dbgp-default-port 9000 | |||||
| "DBGp listener's default port number." | |||||
| :type 'integer | |||||
| :group 'dbgp) | |||||
| (defcustom dbgp-local-address "127.0.0.1" | |||||
| "Local host address. It is used for DBGp proxy. | |||||
| This value is passed to DBGp proxy at connection negotiation. | |||||
| When the proxy receive a new debugging session, the proxy tries | |||||
| to connect to DBGp listener of this address." | |||||
| :type 'string | |||||
| :group 'dbgp) | |||||
| (defface dbgp-response-face | |||||
| '((((class color)) | |||||
| :foreground "brightblue")) | |||||
| "Face for displaying DBGp protocol response message." | |||||
| :group 'dbgp-highlighting-faces) | |||||
| (defface dbgp-decoded-string-face | |||||
| '((((class color)) | |||||
| :inherit 'font-lock-string-face)) | |||||
| "Face for displaying decoded string." | |||||
| :group 'dbgp-highlighting-faces) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; utilities | |||||
| ;;-------------------------------------------------------------- | |||||
| (defsubst dbgp-plist-get (proc prop) | |||||
| (plist-get (process-plist proc) prop)) | |||||
| (defsubst dbgp-plist-put (proc prop val) | |||||
| (let ((plist (process-plist proc))) | |||||
| (if plist | |||||
| (plist-put plist prop val) | |||||
| (set-process-plist proc (list prop val))))) | |||||
| (defsubst dbgp-xml-get-error-node (xml) | |||||
| (car | |||||
| (xml-get-children xml 'error))) | |||||
| (defsubst dbgp-xml-get-error-message (xml) | |||||
| (let ((err (dbgp-xml-get-error-node xml))) | |||||
| (if (stringp (car err)) | |||||
| (car err) | |||||
| (car (xml-node-children | |||||
| (car (xml-get-children err 'message))))))) | |||||
| (defsubst dbgp-make-listner-name (port) | |||||
| (format "DBGp listener<%d>" port)) | |||||
| (defsubst dbgp-process-kill (proc) | |||||
| "Kill DBGp process PROC." | |||||
| (if (memq (process-status proc) '(listen open)) | |||||
| (delete-process proc)) | |||||
| ;; (ignore-errors | |||||
| ;; (with-temp-buffer | |||||
| ;; (set-process-buffer proc (current-buffer))))) | |||||
| ) | |||||
| (defsubst dbgp-ip-get (proc) | |||||
| (first (process-contact proc))) | |||||
| (defsubst dbgp-port-get (proc) | |||||
| (second (process-contact proc))) | |||||
| (defsubst dbgp-proxy-p (proc) | |||||
| (and (dbgp-plist-get proc :proxy) | |||||
| t)) | |||||
| (defsubst dbgp-proxy-get (proc) | |||||
| (dbgp-plist-get proc :proxy)) | |||||
| (defsubst dbgp-listener-get (proc) | |||||
| (dbgp-plist-get proc :listener)) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; DBGp | |||||
| ;;-------------------------------------------------------------- | |||||
| (defcustom dbgp-command-prompt "(cmd) " | |||||
| "DBGp client process buffer's command line prompt to display." | |||||
| :type 'string | |||||
| :group 'dbgp) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; DBGp listener process | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; -- What is DBGp listener process -- | |||||
| ;; | |||||
| ;; DBGp listener process is a network connection, as an entry point | |||||
| ;; for DBGp protocol connection. | |||||
| ;; The process listens at a specific network address to a specific | |||||
| ;; port for a new session connection(from debugger engine) coming. | |||||
| ;; When a new connection has accepted, the DBGp listener creates | |||||
| ;; a new DBGp session process. Then the new process takes over | |||||
| ;; the connection and the DBGp listener process starts listening | |||||
| ;; for another connection. | |||||
| ;; | |||||
| ;; -- DBGp listener custom properties -- | |||||
| ;; | |||||
| ;; :session-init default function for a new DBGp session | |||||
| ;; process to initialize a new session. | |||||
| ;; :session-filter default function for a new DBGp session | |||||
| ;; process to filter protocol messages. | |||||
| ;; :session-sentinel default function for a new DBGp session | |||||
| ;; called when the session is disconnected. | |||||
| (defvar dbgp-listeners nil | |||||
| "List of DBGp listener processes. | |||||
| DBGp listener process is a network connection, as an entry point | |||||
| for DBGp protocol connection. | |||||
| The process listens at a specific network address to a specific | |||||
| port for a new session connection(from debugger engine) coming. | |||||
| When a new connection has accepted, the DBGp listener creates | |||||
| a new DBGp session process. Then the new process takes over | |||||
| the connection and the DBGp listener process starts listening | |||||
| for another connection. | |||||
| -- DBGp listener process custom properties -- | |||||
| :session-accept function to determine to accept a new | |||||
| DBGp session. | |||||
| :session-init function to initialize a new session. | |||||
| :session-filter function to filter protocol messages. | |||||
| :session-sentinel function called when the session is | |||||
| disconnected. | |||||
| :proxy if the listener is created for a proxy | |||||
| connection, this value has a plist of | |||||
| (:addr :port :idekey :multi-session). | |||||
| Otherwise the value is nil. | |||||
| ") | |||||
| (defvar dbgp-sessions nil | |||||
| "List of DBGp session processes. | |||||
| DBGp session process is a network connection, talks with a DBGp | |||||
| debugger engine. | |||||
| A DBGp session process is created by a DBGp listener process | |||||
| after a DBGp session connection from a DBGp debugger engine | |||||
| is accepted. | |||||
| The session process is alive until the session is disconnected. | |||||
| -- DBGp session process custom properties -- | |||||
| :listener The listener process which creates this | |||||
| session process. | |||||
| ") | |||||
| (defvar dbgp-listener-port-history nil) | |||||
| (defvar dbgp-proxy-address-history nil) | |||||
| (defvar dbgp-proxy-port-history nil) | |||||
| (defvar dbgp-proxy-idekey-history nil) | |||||
| (defvar dbgp-proxy-session-port-history nil) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; interactive read functions | |||||
| ;;-------------------------------------------------------------- | |||||
| (defun dbgp-read-string (prompt &optional initial-input history default-value) | |||||
| "Read a string from the terminal, not allowing blanks. | |||||
| Prompt with PROMPT. Whitespace terminates the input. | |||||
| If non-nil, second arg INITIAL-INPUT is a string to insert before reading. | |||||
| This argument has been superseded by DEFAULT-VALUE and should normally | |||||
| be nil in new code. It behaves as in `read-from-minibuffer'. See the | |||||
| documentation string of that function for details. | |||||
| The third arg HISTORY, if non-nil, specifies a history list | |||||
| and optionally the initial position in the list. | |||||
| See `read-from-minibuffer' for details of HISTORY argument. | |||||
| Fourth arg DEFAULT-VALUE is the default value. If non-nil, it is used | |||||
| for history commands, and as the value to return if the user enters | |||||
| the empty string. | |||||
| " | |||||
| (let (str | |||||
| (temp-history (and history | |||||
| (copy-list (symbol-value history))))) | |||||
| (while | |||||
| (progn | |||||
| (setq str (read-string prompt initial-input 'temp-history default-value)) | |||||
| (if (zerop (length str)) | |||||
| (setq str (or default-value "")) | |||||
| (setq str (replace-regexp-in-string "^[ \t\r\n]+" "" str)) | |||||
| (setq str (replace-regexp-in-string "[ \t\r\n]+$" "" str))) | |||||
| (zerop (length str)))) | |||||
| (and history | |||||
| (set history (cons str (remove str (symbol-value history))))) | |||||
| str)) | |||||
| (defun dbgp-read-integer (prompt &optional default history) | |||||
| "Read a numeric value in the minibuffer, prompting with PROMPT. | |||||
| DEFAULT specifies a default value to return if the user just types RET. | |||||
| The third arg HISTORY, if non-nil, specifies a history list | |||||
| and optionally the initial position in the list. | |||||
| See `read-from-minibuffer' for details of HISTORY argument." | |||||
| (let (n | |||||
| (temp-history (and history | |||||
| (mapcar 'number-to-string | |||||
| (symbol-value history))))) | |||||
| (while | |||||
| (let ((str (read-string prompt nil 'temp-history (if (numberp default) | |||||
| (number-to-string default) | |||||
| "")))) | |||||
| (ignore-errors | |||||
| (setq n (cond | |||||
| ((numberp str) str) | |||||
| ((zerop (length str)) default) | |||||
| ((stringp str) (read str))))) | |||||
| (unless (integerp n) | |||||
| (message "Please enter a number.") | |||||
| (sit-for 1) | |||||
| t))) | |||||
| (and history | |||||
| (set history (cons n (remq n (symbol-value history))))) | |||||
| n)) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; DBGp listener start/stop | |||||
| ;;-------------------------------------------------------------- | |||||
| (defsubst dbgp-listener-find (port) | |||||
| (find-if (lambda (listener) | |||||
| (eq port (second (process-contact listener)))) | |||||
| dbgp-listeners)) | |||||
| ;;;###autoload | |||||
| (defun dbgp-start (port) | |||||
| "Start a new DBGp listener listening to PORT." | |||||
| (interactive (let (;;(addrs (mapcar (lambda (intf) | |||||
| ;; (format-network-address (cdar (network-interface-list)) t)) | |||||
| ;; (network-interface-list))) | |||||
| ;;(addr-default (or (car dbgp-listener-address-history) | |||||
| ;; (and (member "127.0.0.1" addrs) | |||||
| ;; "127.0.0.1") | |||||
| ;; (car addrs))) | |||||
| (port-default (or (car dbgp-listener-port-history) | |||||
| 9000))) | |||||
| ;; (or addrs | |||||
| ;; (error "This machine has no network interface to bind.")) | |||||
| (list | |||||
| ;; (completing-read (format "Listener address to bind(default %s): " default) | |||||
| ;; addrs nil t | |||||
| ;; 'dbgp-listener-address-history default) | |||||
| (dbgp-read-integer (format "Listen port(default %s): " port-default) | |||||
| port-default 'dbgp-listener-port-history)))) | |||||
| (let ((result (dbgp-exec port | |||||
| :session-accept 'dbgp-default-session-accept-p | |||||
| :session-init 'dbgp-default-session-init | |||||
| :session-filter 'dbgp-default-session-filter | |||||
| :session-sentinel 'dbgp-default-session-sentinel))) | |||||
| (when (interactive-p) | |||||
| (message (cdr result))) | |||||
| result)) | |||||
| ;;;###autoload | |||||
| (defun dbgp-exec (port &rest session-params) | |||||
| "Start a new DBGp listener listening to PORT." | |||||
| (if (dbgp-listener-alive-p port) | |||||
| (cons (dbgp-listener-find port) | |||||
| (format "The DBGp listener for %d has already been started." port)) | |||||
| (let ((listener (make-network-process :name (dbgp-make-listner-name port) | |||||
| :server 1 | |||||
| :service port | |||||
| :family 'ipv4 | |||||
| :nowait t | |||||
| :noquery t | |||||
| :filter 'dbgp-comint-setup | |||||
| :sentinel 'dbgp-listener-sentinel | |||||
| :log 'dbgp-listener-log))) | |||||
| (unless listener | |||||
| (error "Failed to create DBGp listener for port %d" port)) | |||||
| (dbgp-plist-put listener :listener listener) | |||||
| (and session-params | |||||
| (nconc (process-plist listener) session-params)) | |||||
| (setq dbgp-listeners (cons listener | |||||
| (remq (dbgp-listener-find port) dbgp-listeners))) | |||||
| (cons listener | |||||
| (format "The DBGp listener for %d is started." port))))) | |||||
| (defun dbgp-stop (port &optional include-proxy) | |||||
| "Stop the DBGp listener listening to PORT." | |||||
| (interactive | |||||
| (let ((ports (remq nil | |||||
| (mapcar (lambda (listener) | |||||
| (and (or current-prefix-arg | |||||
| (not (dbgp-proxy-p listener))) | |||||
| (number-to-string (second (process-contact listener))))) | |||||
| dbgp-listeners)))) | |||||
| (list | |||||
| ;; ask user for the target idekey. | |||||
| (read (completing-read "Listener port: " ports nil t | |||||
| (and (eq 1 (length ports)) | |||||
| (car ports)))) | |||||
| current-prefix-arg))) | |||||
| (let ((listener (dbgp-listener-find port))) | |||||
| (dbgp-listener-kill port) | |||||
| (and (interactive-p) | |||||
| (message (if listener | |||||
| "The DBGp listener for port %d is terminated." | |||||
| "DBGp listener for port %d does not exist.") | |||||
| port)) | |||||
| (and listener t))) | |||||
| (defun dbgp-listener-kill (port) | |||||
| (let ((listener (dbgp-listener-find port))) | |||||
| (when listener | |||||
| (delete-process listener)))) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; DBGp proxy listener register/unregister | |||||
| ;;-------------------------------------------------------------- | |||||
| ;;;###autoload | |||||
| (defun dbgp-proxy-register (proxy-ip-or-addr proxy-port idekey multi-session-p &optional session-port) | |||||
| "Register a new DBGp listener to an external DBGp proxy. | |||||
| The proxy should be found at PROXY-IP-OR-ADDR / PROXY-PORT. | |||||
| This creates a new DBGp listener and register it to the proxy | |||||
| associating with the IDEKEY." | |||||
| (interactive (list | |||||
| (let ((default (or (car dbgp-proxy-address-history) "localhost"))) | |||||
| (dbgp-read-string (format "Proxy address (default %s): " default) | |||||
| nil 'dbgp-proxy-address-history default)) | |||||
| (let ((default (or (car dbgp-proxy-port-history) 9001))) | |||||
| (dbgp-read-integer (format "Proxy port (default %d): " default) | |||||
| default 'dbgp-proxy-port-history)) | |||||
| (dbgp-read-string "IDE key: " nil 'dbgp-proxy-idekey-history) | |||||
| (not (memq (read-char "Multi session(Y/n): ") '(?N ?n))) | |||||
| (let ((default (or (car dbgp-proxy-session-port-history) t))) | |||||
| (unless (numberp default) | |||||
| (setq default 0)) | |||||
| (dbgp-read-integer (format "Port for debug session (%s): " | |||||
| (if (< 0 default) | |||||
| (format "default %d, 0 to use any free port" default) | |||||
| (format "leave empty to use any free port"))) | |||||
| default 'dbgp-proxy-session-port-history)))) | |||||
| (let ((result (dbgp-proxy-register-exec proxy-ip-or-addr proxy-port idekey multi-session-p | |||||
| (if (integerp session-port) session-port t) | |||||
| :session-accept 'dbgp-default-session-accept-p | |||||
| :session-init 'dbgp-default-session-init | |||||
| :session-filter 'dbgp-default-session-filter | |||||
| :session-sentinel 'dbgp-default-session-sentinel))) | |||||
| (and (interactive-p) | |||||
| (consp result) | |||||
| (message (cdr result))) | |||||
| result)) | |||||
| ;;;###autoload | |||||
| (defun dbgp-proxy-register-exec (ip-or-addr port idekey multi-session-p session-port &rest session-params) | |||||
| "Register a new DBGp listener to an external DBGp proxy. | |||||
| The proxy should be found at IP-OR-ADDR / PORT. | |||||
| This create a new DBGp listener and register it to the proxy | |||||
| associating with the IDEKEY." | |||||
| (block dbgp-proxy-register-exec | |||||
| ;; check whether the proxy listener already exists | |||||
| (let ((listener (find-if (lambda (listener) | |||||
| (let ((proxy (dbgp-proxy-get listener))) | |||||
| (and proxy | |||||
| (equal ip-or-addr (plist-get proxy :addr)) | |||||
| (eq port (plist-get proxy :port)) | |||||
| (equal idekey (plist-get proxy :idekey))))) | |||||
| dbgp-listeners))) | |||||
| (if listener | |||||
| (return-from dbgp-proxy-register-exec | |||||
| (cons listener | |||||
| (format "The DBGp proxy listener has already been started. idekey: %s" idekey))))) | |||||
| ;; send commands to the external proxy instance | |||||
| (let* ((listener-proc (make-network-process :name "DBGp proxy listener" | |||||
| :server t | |||||
| :service (if (and (numberp session-port) (< 0 session-port)) | |||||
| session-port | |||||
| t) | |||||
| :family 'ipv4 | |||||
| :noquery t | |||||
| :filter 'dbgp-comint-setup | |||||
| :sentinel 'dbgp-listener-sentinel)) | |||||
| (listener-port (second (process-contact listener-proc))) | |||||
| (result (dbgp-proxy-send-command ip-or-addr port | |||||
| (format "proxyinit -a %s:%s -k %s -m %d" | |||||
| dbgp-local-address listener-port idekey | |||||
| (if multi-session-p 1 0))))) | |||||
| (if (and (consp result) | |||||
| (not (equal "1" (xml-get-attribute result 'success)))) | |||||
| ;; successfully connected to the proxy, but respond an error. | |||||
| ;; try to send another command. | |||||
| (setq result (dbgp-proxy-send-command ip-or-addr port | |||||
| (format "proxyinit -p %s -k %s -m %d" | |||||
| listener-port idekey | |||||
| (if multi-session-p 1 0))))) | |||||
| (when (not (and (consp result) | |||||
| (equal "1" (xml-get-attribute result 'success)))) | |||||
| ;; connection failed or the proxy respond an error. | |||||
| ;; give up. | |||||
| (dbgp-process-kill listener-proc) | |||||
| (return-from dbgp-proxy-register-exec | |||||
| (if (not (consp result)) | |||||
| (cons result | |||||
| (cond | |||||
| ((eq :proxy-not-found result) | |||||
| (format "Cannot connect to DBGp proxy \"%s:%s\"." ip-or-addr port)) | |||||
| ((eq :no-response result) | |||||
| "DBGp proxy responds no message.") | |||||
| ((eq :invalid-xml result) | |||||
| "DBGp proxy responds with invalid XML.") | |||||
| (t (symbol-name result)))) | |||||
| (cons :error-response | |||||
| (format "DBGp proxy returns an error: %s" | |||||
| (dbgp-xml-get-error-message result)))))) | |||||
| ;; well done. | |||||
| (dbgp-plist-put listener-proc :proxy (list :addr ip-or-addr | |||||
| :port port | |||||
| :idekey idekey | |||||
| :multi-session multi-session-p)) | |||||
| (dbgp-plist-put listener-proc :listener listener-proc) | |||||
| (and session-params | |||||
| (nconc (process-plist listener-proc) session-params)) | |||||
| (setq dbgp-listeners (cons listener-proc dbgp-listeners)) | |||||
| (cons listener-proc | |||||
| (format "New DBGp proxy listener is registered. idekey: `%s'" idekey))))) | |||||
| ;;;###autoload | |||||
| (defun dbgp-proxy-unregister (idekey &optional proxy-ip-or-addr proxy-port) | |||||
| "Unregister the DBGp listener associated with IDEKEY from a DBGp proxy. | |||||
| After unregistration, it kills the listener instance." | |||||
| (interactive | |||||
| (let (proxies idekeys idekey) | |||||
| ;; collect idekeys. | |||||
| (mapc (lambda (listener) | |||||
| (let ((proxy (dbgp-proxy-get listener))) | |||||
| (and proxy | |||||
| (setq proxies (cons listener proxies)) | |||||
| (add-to-list 'idekeys (plist-get proxy :idekey))))) | |||||
| dbgp-listeners) | |||||
| (or proxies | |||||
| (error "No DBGp proxy listener exists.")) | |||||
| ;; ask user for the target idekey. | |||||
| (setq idekey (completing-read "IDE key: " idekeys nil t | |||||
| (and (eq 1 (length idekeys)) | |||||
| (car idekeys)))) | |||||
| ;; filter proxies and leave ones having the selected ideky. | |||||
| (setq proxies (remove-if (lambda (proxy) | |||||
| (not (equal idekey (plist-get (dbgp-proxy-get proxy) :idekey)))) | |||||
| proxies)) | |||||
| (let ((proxy (if (= 1 (length proxies)) | |||||
| ;; solo proxy. | |||||
| (car proxies) | |||||
| ;; two or more proxies has the same ideky. | |||||
| ;; ask user to select a proxy unregister from. | |||||
| (let* ((addrs (mapcar (lambda (proxy) | |||||
| (let ((prop (dbgp-proxy-get proxy))) | |||||
| (format "%s:%s" (plist-get prop :addr) (plist-get prop :port)))) | |||||
| proxies)) | |||||
| (addr (completing-read "Proxy candidates: " addrs nil t (car addrs))) | |||||
| (pos (position addr addrs))) | |||||
| (and pos | |||||
| (nth pos proxies)))))) | |||||
| (list idekey | |||||
| (plist-get (dbgp-proxy-get proxy) :addr) | |||||
| (plist-get (dbgp-proxy-get proxy) :port))))) | |||||
| (let* ((proxies | |||||
| (remq nil | |||||
| (mapcar (lambda (listener) | |||||
| (let ((prop (dbgp-proxy-get listener))) | |||||
| (and prop | |||||
| (equal idekey (plist-get prop :idekey)) | |||||
| (or (not proxy-ip-or-addr) | |||||
| (equal proxy-ip-or-addr (plist-get prop :addr))) | |||||
| (or (not proxy-port) | |||||
| (equal proxy-port (plist-get prop :port))) | |||||
| listener))) | |||||
| dbgp-listeners))) | |||||
| (proxy (if (< 1 (length proxies)) | |||||
| (error "Multiple proxies are found. Needs more parameters to determine for unregistration.") | |||||
| (car proxies))) | |||||
| (result (and proxy | |||||
| (dbgp-proxy-unregister-exec proxy))) | |||||
| (status (cons result | |||||
| (cond | |||||
| ((processp result) | |||||
| (format "The DBGp proxy listener of `%s' is unregistered." idekey)) | |||||
| ((null result) | |||||
| (format "DBGp proxy listener of `%s' is not registered." idekey)) | |||||
| ((stringp result) | |||||
| (format "DBGp proxy returns an error: %s" result)) | |||||
| ((eq :proxy-not-found result) | |||||
| (format "Cannot connect to DBGp proxy \"%s:%s\"." proxy-ip-or-addr proxy-port)) | |||||
| ((eq :no-response result) | |||||
| "DBGp proxy responds no message.") | |||||
| ((eq :invalid-xml result) | |||||
| "DBGp proxy responds with invalid XML."))))) | |||||
| (and (interactive-p) | |||||
| (cdr status) | |||||
| (message (cdr status))) | |||||
| status)) | |||||
| ;;;###autoload | |||||
| (defun dbgp-proxy-unregister-exec (proxy) | |||||
| "Unregister PROXY from a DBGp proxy. | |||||
| After unregistration, it kills the listener instance." | |||||
| (with-temp-buffer | |||||
| (let* ((prop (dbgp-proxy-get proxy)) | |||||
| (result (dbgp-proxy-send-command (plist-get prop :addr) | |||||
| (plist-get prop :port) | |||||
| (format "proxystop -k %s" (plist-get prop :idekey))))) | |||||
| ;; no matter of the result, remove proxy listener from the dbgp-listeners list. | |||||
| (dbgp-process-kill proxy) | |||||
| (if (consp result) | |||||
| (or (equal "1" (xml-get-attribute result 'success)) | |||||
| (dbgp-xml-get-error-message result)) | |||||
| result)))) | |||||
| (defun dbgp-sessions-kill-all () | |||||
| (interactive) | |||||
| (mapc 'delete-process dbgp-sessions) | |||||
| (setq dbgp-sessions nil)) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; DBGp listener functions | |||||
| ;;-------------------------------------------------------------- | |||||
| (defun dbgp-proxy-send-command (addr port string) | |||||
| "Send DBGp proxy command string to an external DBGp proxy. | |||||
| ADDR and PORT is the address of the target proxy. | |||||
| This function returns an xml list if the command succeeds, | |||||
| or a symbol: `:proxy-not-found', `:no-response', or `:invalid-xml'." | |||||
| (with-temp-buffer | |||||
| (let ((proc (ignore-errors | |||||
| (make-network-process :name "DBGp proxy negotiator" | |||||
| :buffer (current-buffer) | |||||
| :host addr | |||||
| :service port | |||||
| :sentinel (lambda (proc string) "")))) | |||||
| xml) | |||||
| (if (null proc) | |||||
| :proxy-not-found | |||||
| (process-send-string proc string) | |||||
| (dotimes (x 50) | |||||
| (if (= (point-min) (point-max)) | |||||
| (sit-for 0.1 t))) | |||||
| (if (= (point-min) (point-max)) | |||||
| :no-response | |||||
| (or (ignore-errors | |||||
| (setq xml (car (xml-parse-region (point-min) (point-max))))) | |||||
| :invalid-xml)))))) | |||||
| (defun dbgp-listener-alive-p (port) | |||||
| "Return t if any listener for POST is alive." | |||||
| (let ((listener (dbgp-listener-find port))) | |||||
| (and listener | |||||
| (eq 'listen (process-status listener))))) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; DBGp listener process log and sentinel | |||||
| ;;-------------------------------------------------------------- | |||||
| (defun dbgp-listener-sentinel (proc string) | |||||
| (with-current-buffer (get-buffer-create "*DBGp Listener*") | |||||
| (insert (format "[SNT] %S %s\n" proc string))) | |||||
| (setq dbgp-listeners (remq proc dbgp-listeners))) | |||||
| (defun dbgp-listener-log (&rest arg) | |||||
| (with-current-buffer (get-buffer-create "*DBGp Listener*") | |||||
| (insert (format "[LOG] %S\n" arg)))) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; DBGp session process filter and sentinel | |||||
| ;;-------------------------------------------------------------- | |||||
| (defvar dbgp-filter-defer-flag nil | |||||
| "Non-nil means don't process anything from the debugger right now. | |||||
| It is saved for when this flag is not set.") | |||||
| (defvar dbgp-filter-defer-faced nil | |||||
| "Non-nil means this is text that has been saved for later in `gud-filter'.") | |||||
| (defvar dbgp-filter-pending-text nil | |||||
| "Non-nil means this is text that has been saved for later in `gud-filter'.") | |||||
| (defvar dbgp-delete-prompt-marker nil) | |||||
| (defvar dbgp-filter-input-list nil) | |||||
| (defvar dbgp-buffer-process nil | |||||
| "") | |||||
| (put 'dbgp-buffer-process 'permanent-local t) | |||||
| (defadvice open-network-stream (around debugclient-pass-process-to-comint) | |||||
| "[comint hack] Pass the spawned DBGp client process to comint." | |||||
| (let* ((buffer (ad-get-arg 1)) | |||||
| (proc (buffer-local-value 'dbgp-buffer-process buffer))) | |||||
| (set-process-buffer proc buffer) | |||||
| (setq ad-return-value proc))) | |||||
| (defun dbgp-comint-setup (proc string) | |||||
| "Setup a new comint buffer for a newly created session process PROC. | |||||
| This is the first filter function for a new session process created by a | |||||
| listener process. After the setup is done, `dbgp-session-filter' function | |||||
| takes over the filter." | |||||
| (if (not (dbgp-session-accept-p proc)) | |||||
| ;; multi session is disabled | |||||
| (when (memq (process-status proc) '(run connect open)) | |||||
| ;; refuse this session | |||||
| (set-process-filter proc nil) | |||||
| (set-process-sentinel proc nil) | |||||
| (process-send-string proc "run -i 1\0") | |||||
| (dotimes (i 50) | |||||
| (and (eq 'open (process-status proc)) | |||||
| (sleep-for 0 1))) | |||||
| (dbgp-process-kill proc)) | |||||
| ;; accept | |||||
| (setq dbgp-sessions (cons proc dbgp-sessions)) | |||||
| ;; initialize sub process | |||||
| (set-process-query-on-exit-flag proc nil) | |||||
| (let* ((listener (dbgp-listener-get proc)) | |||||
| (buffer-name (format "DBGp <%s:%s>" | |||||
| (first (process-contact proc)) | |||||
| (second (process-contact listener)))) | |||||
| (buf (or (find-if (lambda (buf) | |||||
| ;; find reusable buffer | |||||
| (let ((proc (get-buffer-process buf))) | |||||
| (and (buffer-local-value 'dbgp-buffer-process buf) | |||||
| (not (and proc | |||||
| (eq 'open (process-status proc))))))) | |||||
| (buffer-list)) | |||||
| (get-buffer-create buffer-name)))) | |||||
| (with-current-buffer buf | |||||
| (rename-buffer buffer-name) | |||||
| ;; store PROC to `dbgp-buffer-process'. | |||||
| ;; later the adviced `open-network-stream' will pass it | |||||
| ;; comint. | |||||
| (set (make-local-variable 'dbgp-buffer-process) proc) | |||||
| (set (make-local-variable 'dbgp-filter-defer-flag) nil) | |||||
| (set (make-local-variable 'dbgp-filter-defer-faced) nil) | |||||
| (set (make-local-variable 'dbgp-filter-input-list) nil) | |||||
| (set (make-local-variable 'dbgp-filter-pending-text) nil)) | |||||
| ;; setup comint buffer | |||||
| (ad-activate 'open-network-stream) | |||||
| (unwind-protect | |||||
| (make-comint-in-buffer "DBGp-Client" buf (cons t t)) | |||||
| (ad-deactivate 'open-network-stream)) | |||||
| ;; update PROC properties | |||||
| (set-process-filter proc #'dbgp-session-filter) | |||||
| (set-process-sentinel proc #'dbgp-session-sentinel) | |||||
| (with-current-buffer buf | |||||
| (set (make-local-variable 'dbgp-delete-prompt-marker) | |||||
| (make-marker)) | |||||
| ;;(set (make-local-variable 'comint-use-prompt-regexp) t) | |||||
| ;;(setq comint-prompt-regexp (concat "^" dbgp-command-prompt)) | |||||
| (setq comint-input-sender 'dbgp-session-send-string) | |||||
| ;; call initializer function | |||||
| (funcall (or (dbgp-plist-get listener :session-init) | |||||
| 'null) | |||||
| proc)) | |||||
| (dbgp-session-filter proc string)))) | |||||
| (defun dbgp-session-accept-p (proc) | |||||
| "Determine whether PROC should be accepted to be a new session." | |||||
| (let ((accept-p (dbgp-plist-get proc :session-accept))) | |||||
| (or (not accept-p) | |||||
| (funcall accept-p proc)))) | |||||
| (defun dbgp-session-send-string (proc string &optional echo-p) | |||||
| "Send a DBGp protocol STRING to PROC." | |||||
| (if echo-p | |||||
| (dbgp-session-echo-input proc string)) | |||||
| (comint-send-string proc (concat string "\0"))) | |||||
| (defun dbgp-session-echo-input (proc string) | |||||
| (with-current-buffer (process-buffer proc) | |||||
| (if dbgp-filter-defer-flag | |||||
| (setq dbgp-filter-input-list | |||||
| (append dbgp-filter-input-list (list string))) | |||||
| (let ((eobp (eobp)) | |||||
| (process-window (get-buffer-window (current-buffer)))) | |||||
| (save-excursion | |||||
| (save-restriction | |||||
| (widen) | |||||
| (goto-char (process-mark proc)) | |||||
| (insert (propertize | |||||
| (concat string "\n") | |||||
| 'front-sticky t | |||||
| 'font-lock-face 'comint-highlight-input)) | |||||
| (set-marker (process-mark proc) (point)))) | |||||
| (when eobp | |||||
| (if process-window | |||||
| (with-selected-window process-window | |||||
| (goto-char (point-max))) | |||||
| (goto-char (point-max)))))))) | |||||
| (defun dbgp-session-filter (proc string) | |||||
| ;; Here's where the actual buffer insertion is done | |||||
| (let ((buf (process-buffer proc)) | |||||
| (listener (dbgp-listener-get proc)) | |||||
| (session-filter (dbgp-plist-get proc :session-filter)) | |||||
| output process-window chunks) | |||||
| (block dbgp-session-filter | |||||
| (unless (buffer-live-p buf) | |||||
| (return-from dbgp-session-filter)) | |||||
| (with-current-buffer buf | |||||
| (when dbgp-filter-defer-flag | |||||
| ;; If we can't process any text now, | |||||
| ;; save it for later. | |||||
| (setq dbgp-filter-defer-faced t | |||||
| dbgp-filter-pending-text (if dbgp-filter-pending-text | |||||
| (concat dbgp-filter-pending-text string) | |||||
| string)) | |||||
| (return-from dbgp-session-filter)) | |||||
| ;; If we have to ask a question during the processing, | |||||
| ;; defer any additional text that comes from the debugger | |||||
| ;; during that time. | |||||
| (setq dbgp-filter-defer-flag t) | |||||
| (setq dbgp-filter-defer-faced nil) | |||||
| (ignore-errors | |||||
| ;; Process now any text we previously saved up. | |||||
| (setq dbgp-filter-pending-text (if dbgp-filter-pending-text | |||||
| (concat dbgp-filter-pending-text string) | |||||
| string)) | |||||
| (setq chunks (dbgp-session-response-to-chunk)) | |||||
| ;; If we have been so requested, delete the debugger prompt. | |||||
| (if (marker-buffer dbgp-delete-prompt-marker) | |||||
| (save-restriction | |||||
| (widen) | |||||
| (let ((inhibit-read-only t)) | |||||
| (delete-region (process-mark proc) | |||||
| dbgp-delete-prompt-marker) | |||||
| (comint-update-fence) | |||||
| (set-marker dbgp-delete-prompt-marker nil)))) | |||||
| ;; Save the process output, checking for source file markers. | |||||
| (and chunks | |||||
| (setq output | |||||
| (concat | |||||
| (mapconcat (if (functionp session-filter) | |||||
| (lambda (chunk) (funcall session-filter proc chunk)) | |||||
| #'quote) | |||||
| chunks | |||||
| "\n") | |||||
| "\n")) | |||||
| (setq output | |||||
| (concat output | |||||
| (if dbgp-filter-input-list | |||||
| (mapconcat (lambda (input) | |||||
| (concat | |||||
| (propertize dbgp-command-prompt | |||||
| 'font-lock-face 'comint-highlight-prompt) | |||||
| (propertize (concat input "\n") | |||||
| 'font-lock-face 'comint-highlight-input))) | |||||
| dbgp-filter-input-list | |||||
| "") | |||||
| dbgp-command-prompt))) | |||||
| (setq dbgp-filter-input-list nil)))) | |||||
| ;; Let the comint filter do the actual insertion. | |||||
| ;; That lets us inherit various comint features. | |||||
| (and output | |||||
| (ignore-errors | |||||
| (comint-output-filter proc output)))) | |||||
| (if (with-current-buffer buf | |||||
| (setq dbgp-filter-defer-flag nil) | |||||
| dbgp-filter-defer-faced) | |||||
| (dbgp-session-filter proc "")))) | |||||
| (defun dbgp-session-response-to-chunk () | |||||
| (let* ((string dbgp-filter-pending-text) | |||||
| (send (length string)) ; string end | |||||
| (lbeg 0) ; line begin | |||||
| tbeg ; text begin | |||||
| tlen ; text length | |||||
| (i 0) ; running pointer | |||||
| chunks) | |||||
| (while (< i send) | |||||
| (if (< 0 (elt string i)) | |||||
| (incf i) | |||||
| (setq tlen (string-to-number (substring string lbeg i))) | |||||
| (setq tbeg (1+ i)) | |||||
| (setq i (+ tbeg tlen)) | |||||
| (when (< i send) | |||||
| (setq chunks (cons (substring string tbeg i) chunks)) | |||||
| (incf i) | |||||
| (setq lbeg i)))) | |||||
| ;; Remove chunk from `dbgp-filter-pending-text'. | |||||
| (setq dbgp-filter-pending-text | |||||
| (and (< lbeg i) | |||||
| (substring dbgp-filter-pending-text lbeg))) | |||||
| (nreverse chunks))) | |||||
| (defun dbgp-session-sentinel (proc string) | |||||
| (let ((sentinel (dbgp-plist-get proc :session-sentinel))) | |||||
| (ignore-errors | |||||
| (and (functionp sentinel) | |||||
| (funcall sentinel proc string)))) | |||||
| (setq dbgp-sessions (remq proc dbgp-sessions))) | |||||
| ;;-------------------------------------------------------------- | |||||
| ;; default session initializer, filter and sentinel | |||||
| ;;-------------------------------------------------------------- | |||||
| (defun dbgp-default-session-accept-p (proc) | |||||
| "Determine whether PROC should be accepted to be a new session." | |||||
| (or (not dbgp-sessions) | |||||
| (if (dbgp-proxy-p proc) | |||||
| (plist-get (dbgp-proxy-get proc) :multi-session) | |||||
| (dbgp-plist-get proc :multi-session)))) | |||||
| (defun dbgp-default-session-init (proc) | |||||
| (with-current-buffer (process-buffer proc) | |||||
| (pop-to-buffer (current-buffer)))) | |||||
| (defun dbgp-default-session-filter (proc string) | |||||
| (with-temp-buffer | |||||
| ;; parse xml | |||||
| (insert (replace-regexp-in-string "\n" "" string)) | |||||
| (let ((xml (car (xml-parse-region (point-min) (point-max)))) | |||||
| text) | |||||
| ;; if the xml has a child node encoded with base64, decode it. | |||||
| (when (equal "base64" (xml-get-attribute xml 'encoding)) | |||||
| ;; remain decoded string | |||||
| (setq text (with-current-buffer (process-buffer proc) | |||||
| (decode-coding-string | |||||
| (base64-decode-string (car (xml-node-children xml))) | |||||
| buffer-file-coding-system))) | |||||
| ;; decoded string may have invalid characters for xml, | |||||
| ;; so replace the child node with a placeholder | |||||
| (setcar (xml-node-children xml) "\0")) | |||||
| ;; create formatted xml string | |||||
| (erase-buffer) | |||||
| (when (string-match "^.*?\\?>" string) | |||||
| (insert (match-string 0 string)) | |||||
| (insert "\n")) | |||||
| (xml-print (list xml)) | |||||
| (add-text-properties (point-min) | |||||
| (point-max) | |||||
| (list 'front-sticky t | |||||
| 'font-lock-face 'dbgp-response-face)) | |||||
| (when text | |||||
| ;; restore decoded string into a right place | |||||
| (goto-char (point-min)) | |||||
| (and (search-forward "\0" nil t) | |||||
| (replace-match (propertize (concat "\n" text) | |||||
| 'front-sticky t | |||||
| 'font-lock-face 'dbgp-decoded-string-face) | |||||
| nil t))) | |||||
| ;; return a formatted xml string | |||||
| (buffer-string)))) | |||||
| (defun dbgp-default-session-sentinel (proc string) | |||||
| (let ((output "\nDisconnected.\n\n")) | |||||
| (when (buffer-live-p (process-buffer proc)) | |||||
| (dbgp-session-echo-input proc output)))) | |||||
| (provide 'dbgp) | |||||
| @ -0,0 +1,111 @@ | |||||
| ;;; geben-autoloads.el --- automatically extracted autoloads | |||||
| ;; | |||||
| ;;; Code: | |||||
| ;;;### (autoloads (dbgp-proxy-unregister-exec dbgp-proxy-unregister | |||||
| ;;;;;; dbgp-proxy-register-exec dbgp-proxy-register dbgp-exec dbgp-start) | |||||
| ;;;;;; "dbgp" "dbgp.el" (21154 21324 0 0)) | |||||
| ;;; Generated autoloads from dbgp.el | |||||
| (autoload 'dbgp-start "dbgp" "\ | |||||
| Start a new DBGp listener listening to PORT. | |||||
| \(fn PORT)" t nil) | |||||
| (autoload 'dbgp-exec "dbgp" "\ | |||||
| Start a new DBGp listener listening to PORT. | |||||
| \(fn PORT &rest SESSION-PARAMS)" nil nil) | |||||
| (autoload 'dbgp-proxy-register "dbgp" "\ | |||||
| Register a new DBGp listener to an external DBGp proxy. | |||||
| The proxy should be found at PROXY-IP-OR-ADDR / PROXY-PORT. | |||||
| This creates a new DBGp listener and register it to the proxy | |||||
| associating with the IDEKEY. | |||||
| \(fn PROXY-IP-OR-ADDR PROXY-PORT IDEKEY MULTI-SESSION-P &optional SESSION-PORT)" t nil) | |||||
| (autoload 'dbgp-proxy-register-exec "dbgp" "\ | |||||
| Register a new DBGp listener to an external DBGp proxy. | |||||
| The proxy should be found at IP-OR-ADDR / PORT. | |||||
| This create a new DBGp listener and register it to the proxy | |||||
| associating with the IDEKEY. | |||||
| \(fn IP-OR-ADDR PORT IDEKEY MULTI-SESSION-P SESSION-PORT &rest SESSION-PARAMS)" nil nil) | |||||
| (autoload 'dbgp-proxy-unregister "dbgp" "\ | |||||
| Unregister the DBGp listener associated with IDEKEY from a DBGp proxy. | |||||
| After unregistration, it kills the listener instance. | |||||
| \(fn IDEKEY &optional PROXY-IP-OR-ADDR PROXY-PORT)" t nil) | |||||
| (autoload 'dbgp-proxy-unregister-exec "dbgp" "\ | |||||
| Unregister PROXY from a DBGp proxy. | |||||
| After unregistration, it kills the listener instance. | |||||
| \(fn PROXY)" nil nil) | |||||
| ;;;*** | |||||
| ;;;### (autoloads (geben geben-mode) "geben" "geben.el" (21154 21324 | |||||
| ;;;;;; 0 0)) | |||||
| ;;; Generated autoloads from geben.el | |||||
| (autoload 'geben-mode "geben" "\ | |||||
| Minor mode for debugging source code with GEBEN. | |||||
| The geben-mode buffer commands: | |||||
| \\{geben-mode-map} | |||||
| \(fn &optional ARG)" t nil) | |||||
| (autoload 'geben "geben" "\ | |||||
| Start GEBEN, a DBGp protocol frontend - a script debugger. | |||||
| Variations are described below. | |||||
| By default, starts GEBEN listening to port `geben-dbgp-default-port'. | |||||
| Prefixed with one \\[universal-argument], asks listening port number interactively and | |||||
| starts GEBEN on the port. | |||||
| Prefixed with two \\[universal-argument]'s, starts a GEBEN proxy listener. | |||||
| Prefixed with three \\[universal-argument]'s, kills a GEBEN listener. | |||||
| Prefixed with four \\[universal-argument]'s, kills a GEBEN proxy listener. | |||||
| GEBEN communicates with script servers, located anywhere local or | |||||
| remote, in DBGp protocol (e.g. PHP with Xdebug extension) | |||||
| to help you debugging your script with some valuable features: | |||||
| - continuation commands like `step in', `step out', ... | |||||
| - a kind of breakpoints like `line no', `function call' and | |||||
| `function return'. | |||||
| - evaluation | |||||
| - stack dump | |||||
| - etc. | |||||
| The script servers should be DBGp protocol enabled. | |||||
| Ask to your script server administrator about this setting up | |||||
| issue. | |||||
| Once you've done these setup operation correctly, run GEBEN first | |||||
| and your script on your script server second. After some | |||||
| negotiation GEBEN will display your script's entry source code. | |||||
| The debugging session is started. | |||||
| In the debugging session the source code buffers are under the | |||||
| minor mode `geben-mode'. Key mapping and other information is | |||||
| described its help page. | |||||
| \(fn &optional ARGS)" t nil) | |||||
| ;;;*** | |||||
| ;;;### (autoloads nil nil ("geben-pkg.el") (21154 21324 725959 0)) | |||||
| ;;;*** | |||||
| (provide 'geben-autoloads) | |||||
| ;; Local Variables: | |||||
| ;; version-control: never | |||||
| ;; no-byte-compile: t | |||||
| ;; no-update-autoloads: t | |||||
| ;; coding: utf-8 | |||||
| ;; End: | |||||
| ;;; geben-autoloads.el ends here | |||||
| @ -0,0 +1,3 @@ | |||||
| (define-package "geben" "0.26" | |||||
| "A remote debugging environment for Emacs." | |||||
| '()) | |||||
| @ -0,0 +1,96 @@ | |||||
| PHP Extras | |||||
| A small collection of extra features for Emacs php-mode. | |||||
| Currently includes: | |||||
| - php-extras-insert-previous-variable | |||||
| - php-extras-eldoc-documentation-function | |||||
| - Auto complete source for PHP functions based on | |||||
| php-extras-eldoc-documentation-function | |||||
| php-extras-insert-previous-variable | |||||
| When variable names get too long or you have to juggle a lot of nested | |||||
| arrays it gets cumbersome to repeat the same variables over and over | |||||
| again while programming. | |||||
| In example you have the code below and want to debug what value you | |||||
| actually parsed to some_function(). You have point at ^ and now all you | |||||
| have to write is repeat the variable... | |||||
| some_function($my_array['some_level'][0]['another_level'][7]); | |||||
| print_r(^); | |||||
| Enter php-extras and you just hit C-c C-$ and it will insert the | |||||
| previous variable (including array indexes). | |||||
| If you prefix the command (i.e. C-u 3 C-c C-$) it will search back 3 | |||||
| variables and with negative prefix arguments it will search forward. | |||||
| php-extras-eldoc-documentation-function | |||||
| eldoc-mode is a nice minor mode that ships with Emacs. It will display a | |||||
| function tip in the mini buffer showing the function and its arguments | |||||
| for the function at point. That is if you provide a function to look up | |||||
| the function definition. | |||||
| php-extras provides such a function for looking up all the core PHP | |||||
| functions. | |||||
| The function php-extras-generate-eldoc will download the PHP function | |||||
| summary PHP Subversion repository and extract the function definitions | |||||
| (slow) and store them in a hash table on disk for you. | |||||
| If you install php-extras as an ELPA package the hash table is already | |||||
| generated for you. | |||||
| Auto complete source for PHP functions based | |||||
| The PHP functions extracted for php-extras-eldoc-documentation-function | |||||
| is also setup as a source for auto-complete. | |||||
| auto-complete already comes with a dictionary of PHP functions and will | |||||
| auto complete on them using the ac-source-dictionary. | |||||
| The source we provide with php-extras will hopefully be more up to date. | |||||
| Installation | |||||
| The easiest way to install php-extras is probably to install it via the | |||||
| ELPA archive at Marmalade. | |||||
| ELPA (package.el) is part of Emacs 24. For Emacs 23 see Marmalade for | |||||
| installation instructions. | |||||
| The version number of the ELPA package will have the date appended when | |||||
| the package was build and hence the date the documentation got extracted | |||||
| from php.net. | |||||
| Manual installation | |||||
| I really recommend that you install this package via ELPA as described | |||||
| above. | |||||
| If you insist on installing it manually try to follow this recipe: | |||||
| - Place the folder with the files somewhere on your disk. | |||||
| - Add this to your .emacs / .emacs.d/init.el: | |||||
| (add-to-list 'load-path "/somewhere/on/your/disk/php-xtras") | |||||
| (eval-after-load 'php-mode | |||||
| (require 'php-extras)) | |||||
| - Either restart your Emacs or evaluate the add-to-list expression. | |||||
| - Generate the hash table containing the PHP functions: | |||||
| M-x load-library RET php-extras-gen-eldoc RET | |||||
| M-x php-extras-generate-eldoc RET | |||||
| Development of PHP Extras | |||||
| PHP Extras is developed at GitHub. Feature requests, ideas, bug reports, | |||||
| and pull request are more than welcome! | |||||
| @ -0,0 +1,18 @@ | |||||
| This is the file .../info/dir, which contains the | |||||
| topmost node of the Info hierarchy, called (dir)Top. | |||||
| The first time you invoke Info you start off looking at this node. | |||||
| File: dir, Node: Top This is the top of the INFO tree | |||||
| This (the Directory node) gives a menu of major topics. | |||||
| Typing "q" exits, "?" lists all Info commands, "d" returns here, | |||||
| "h" gives a primer for first-timers, | |||||
| "mEmacs<Return>" visits the Emacs manual, etc. | |||||
| In Emacs, you can click mouse button 2 on a menu item or cross reference | |||||
| to select it. | |||||
| * Menu: | |||||
| Programming | |||||
| * PHP Extras: (php-extras). Extra features for `php-mode'. | |||||
| @ -0,0 +1,83 @@ | |||||
| ;;; php-extras-autoloads.el --- automatically extracted autoloads | |||||
| ;; | |||||
| ;;; Code: | |||||
| ;;;### (autoloads (php-extras-completion-setup php-extras-completion-at-point | |||||
| ;;;;;; php-extras-autocomplete-setup php-extras-eldoc-documentation-function | |||||
| ;;;;;; php-extras-insert-previous-variable php-extras-auto-complete-insert-parenthesis | |||||
| ;;;;;; php-extras-insert-previous-variable-key) "php-extras" "php-extras.el" | |||||
| ;;;;;; (21154 21313 0 0)) | |||||
| ;;; Generated autoloads from php-extras.el | |||||
| (defvar php-extras-insert-previous-variable-key [(control c) (control $)] "\ | |||||
| Key sequence for `php-extras-insert-previous-variable'.") | |||||
| (custom-autoload 'php-extras-insert-previous-variable-key "php-extras" nil) | |||||
| (defvar php-extras-auto-complete-insert-parenthesis t "\ | |||||
| Whether auto complete insert should add a pair of parenthesis.") | |||||
| (custom-autoload 'php-extras-auto-complete-insert-parenthesis "php-extras" t) | |||||
| (autoload 'php-extras-insert-previous-variable "php-extras" "\ | |||||
| Insert previously used variable from buffer. | |||||
| With prefix argument search that number of times backwards for | |||||
| variable. If prefix argument is negative search forward. | |||||
| \(fn ARG)" t nil) | |||||
| (autoload 'php-extras-eldoc-documentation-function "php-extras" "\ | |||||
| Get function arguments for core PHP function at point. | |||||
| \(fn)" nil nil) | |||||
| (add-hook 'php-mode-hook 'php-extras-eldoc-setup) | |||||
| (autoload 'php-extras-autocomplete-setup "php-extras" "\ | |||||
| \(fn)" nil nil) | |||||
| (add-hook 'php-mode-hook #'php-extras-autocomplete-setup) | |||||
| (autoload 'php-extras-completion-at-point "php-extras" "\ | |||||
| \(fn)" nil nil) | |||||
| (autoload 'php-extras-completion-setup "php-extras" "\ | |||||
| \(fn)" nil nil) | |||||
| (add-hook 'php-mode-hook #'php-extras-completion-setup) | |||||
| (eval-after-load 'php-mode `(let ((map php-mode-map) (key php-extras-insert-previous-variable-key)) (define-key map key 'php-extras-insert-previous-variable))) | |||||
| ;;;*** | |||||
| ;;;### (autoloads (php-extras-generate-eldoc) "php-extras-gen-eldoc" | |||||
| ;;;;;; "php-extras-gen-eldoc.el" (21154 21313 0 0)) | |||||
| ;;; Generated autoloads from php-extras-gen-eldoc.el | |||||
| (autoload 'php-extras-generate-eldoc "php-extras-gen-eldoc" "\ | |||||
| Regenerate PHP function argument hash table from php.net. This is slow! | |||||
| \(fn)" t nil) | |||||
| ;;;*** | |||||
| ;;;### (autoloads nil nil ("php-extras-eldoc-functions.el" "php-extras-pkg.el") | |||||
| ;;;;;; (21154 21313 274916 0)) | |||||
| ;;;*** | |||||
| (provide 'php-extras-autoloads) | |||||
| ;; Local Variables: | |||||
| ;; version-control: never | |||||
| ;; no-byte-compile: t | |||||
| ;; no-update-autoloads: t | |||||
| ;; coding: utf-8 | |||||
| ;; End: | |||||
| ;;; php-extras-autoloads.el ends here | |||||
| @ -0,0 +1,102 @@ | |||||
| ;;; php-extras-gen-eldoc.el --- Extra features for `php-mode' | |||||
| ;; Copyright (C) 2012, 2013 Arne Jørgensen | |||||
| ;; Author: Arne Jørgensen <arne@arnested.dk> | |||||
| ;; This software is free software: you can redistribute it and/or | |||||
| ;; modify it under the terms of the GNU General Public License as | |||||
| ;; published by the Free Software Foundation, either version 3 of the | |||||
| ;; License, or (at your option) any later version. | |||||
| ;; This software is distributed in the hope that it will be useful, | |||||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
| ;; General Public License for more details. | |||||
| ;; You should have received a copy of the GNU General Public License | |||||
| ;; along with this software. If not, see | |||||
| ;; <http://www.gnu.org/licenses/>. | |||||
| ;;; Commentary: | |||||
| ;; Download and parse PHP manual from php.net and build a new | |||||
| ;; `php-extras-function-arguments' hash table of PHP functions and | |||||
| ;; their arguments. | |||||
| ;; Please note that build a new `php-extras-function-arguments' is a | |||||
| ;; slow process and might be error prone. | |||||
| ;;; Code: | |||||
| (require 'php-mode) | |||||
| (require 'php-extras) | |||||
| (defvar php-extras-gen-eldoc-temp-methodname nil) | |||||
| (defvar php-extras-php-funcsummary-url | |||||
| "http://svn.php.net/repository/phpdoc/doc-base/trunk/funcsummary.txt" | |||||
| "URL of the funcsummary.txt list of PHP functions.") | |||||
| ;;;###autoload | |||||
| (defun php-extras-generate-eldoc () | |||||
| "Regenerate PHP function argument hash table from php.net. This is slow!" | |||||
| (interactive) | |||||
| (when (yes-or-no-p "Regenerate PHP function argument hash table from php.net? This is slow! ") | |||||
| (php-extras-generate-eldoc-1 t))) | |||||
| (defun php-extras-generate-eldoc-1 (&optional byte-compile) | |||||
| (let ((function-arguments-temp (make-hash-table | |||||
| :size 5000 | |||||
| :rehash-threshold 1.0 | |||||
| :rehash-size 100 | |||||
| :test 'equal))) | |||||
| (with-temp-buffer | |||||
| (url-insert-file-contents php-extras-php-funcsummary-url) | |||||
| (goto-char (point-min)) | |||||
| (let ((line-count (count-lines (point-min) (point-max)))) | |||||
| (with-syntax-table php-mode-syntax-table | |||||
| (while (not (eobp)) | |||||
| (let ((current-line (buffer-substring (point-at-bol) (point-at-eol)))) | |||||
| ;; Skip methods for now: is there anything more intelligent | |||||
| ;; we could do with them? | |||||
| (unless (string-match-p "::" current-line) | |||||
| (search-forward "(" (point-at-eol)) | |||||
| (goto-char (match-beginning 0)) | |||||
| (let ((function-name (thing-at-point 'symbol)) | |||||
| (help-string (replace-regexp-in-string "[[:space:]]+" " " | |||||
| current-line)) | |||||
| (progress (* 100 (/ (float (line-number-at-pos)) line-count)))) | |||||
| (message "[%2d%%] Parsing %s..." progress function-name) | |||||
| (puthash function-name help-string function-arguments-temp)))) | |||||
| ;; Skip over function description | |||||
| (forward-line 2))))) | |||||
| (let* ((file (concat php-extras-eldoc-functions-file ".el")) | |||||
| (base-name (file-name-nondirectory php-extras-eldoc-functions-file))) | |||||
| (with-temp-file file | |||||
| (insert (format | |||||
| ";;; %s.el -- file auto generated by `php-extras-generate-eldoc' | |||||
| \(require 'php-extras) | |||||
| \(setq php-extras-function-arguments %S) | |||||
| \(provide 'php-extras-eldoc-functions) | |||||
| ;;; %s.el ends here | |||||
| " | |||||
| base-name | |||||
| function-arguments-temp | |||||
| base-name))) | |||||
| (when byte-compile | |||||
| (message "Byte compiling and loading %s ..." file) | |||||
| (byte-compile-file file t) | |||||
| (message "Byte compiling and loading %s ... done." file))))) | |||||
| (provide 'php-extras-gen-eldoc) | |||||
| ;;; php-extras-gen-eldoc.el ends here | |||||
| @ -0,0 +1,3 @@ | |||||
| (define-package "php-extras" "1.0.0.20130923" | |||||
| "Extra features for `php-mode'" | |||||
| '((php-mode "1.5.0"))) | |||||
| @ -0,0 +1,208 @@ | |||||
| ;;; php-extras.el --- Extra features for `php-mode' | |||||
| ;; Copyright (C) 2012, 2013 Arne Jørgensen | |||||
| ;; Author: Arne Jørgensen <arne@arnested.dk> | |||||
| ;; URL: https://github.com/arnested/php-extras | |||||
| ;; Created: June 28, 2012 | |||||
| ;; Version: 1.0.0.20130923 | |||||
| ;; Package-Requires: ((php-mode "1.5.0")) | |||||
| ;; Keywords: programming, php | |||||
| ;; This software is free software: you can redistribute it and/or | |||||
| ;; modify it under the terms of the GNU General Public License as | |||||
| ;; published by the Free Software Foundation, either version 3 of the | |||||
| ;; License, or (at your option) any later version. | |||||
| ;; This software is distributed in the hope that it will be useful, | |||||
| ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
| ;; General Public License for more details. | |||||
| ;; You should have received a copy of the GNU General Public License | |||||
| ;; along with this software. If not, see | |||||
| ;; <http://www.gnu.org/licenses/>. | |||||
| ;;; Commentary: | |||||
| ;; Extra features for `php-mode': | |||||
| ;; * `php-extras-insert-previous-variable' | |||||
| ;; * `php-extras-eldoc-documentation-function' | |||||
| ;; * Auto complete source for PHP functions based on | |||||
| ;; `php-extras-eldoc-documentation-function' | |||||
| ;;; Code: | |||||
| (require 'eldoc) | |||||
| (require 'thingatpt) | |||||
| (defvar php-extras-php-variable-regexp | |||||
| (format "\\(\\$[a-zA-Z_%s-%s][a-zA-Z0-9_%s-%s]*\\(\\[.*\\]\\)*\\)" | |||||
| (char-to-string 127) (char-to-string 255) | |||||
| (char-to-string 127) (char-to-string 255)) | |||||
| "Regexp for a PHP variable.") | |||||
| (defvar php-extras-eldoc-functions-file (concat (file-name-directory (or load-file-name buffer-file-name)) "php-extras-eldoc-functions") | |||||
| "File holding `php-extras-function-arguments' hash table.") | |||||
| (defvar php-extras-function-arguments 'not-loaded | |||||
| "Hash table of PHP functions and their function arguments. | |||||
| Generated by `php-extras-gen-eldoc-elem-string'.") | |||||
| ;;;###autoload | |||||
| (defcustom php-extras-insert-previous-variable-key [(control c) (control $)] | |||||
| "Key sequence for `php-extras-insert-previous-variable'." | |||||
| :group 'php | |||||
| :set #'(lambda (symbol value) | |||||
| ;; Always set the variable `php-extras-insert-previous-variable-key'. | |||||
| (set-default symbol value) | |||||
| ;; When `php-mode-map' is already loaded define it in the map. | |||||
| (when (boundp 'php-mode-map) | |||||
| ;; First undefine the old key sequence if defined. | |||||
| (when (eq (lookup-key php-mode-map php-extras-insert-previous-variable-key) 'php-extras-insert-previous-variable) | |||||
| (define-key php-mode-map php-extras-insert-previous-variable-key 'undefined)) | |||||
| ;; Then define the new key sequence. | |||||
| (define-key php-mode-map value 'php-extras-insert-previous-variable))) | |||||
| :type 'key-sequence) | |||||
| ;;;###autoload | |||||
| (defcustom php-extras-auto-complete-insert-parenthesis t | |||||
| "Whether auto complete insert should add a pair of parenthesis." | |||||
| :group 'php | |||||
| :type 'boolean) | |||||
| ;;;###autoload | |||||
| (defun php-extras-insert-previous-variable (arg) | |||||
| "Insert previously used variable from buffer. | |||||
| With prefix argument search that number of times backwards for | |||||
| variable. If prefix argument is negative search forward." | |||||
| (interactive "P") | |||||
| (when (null arg) | |||||
| (setq arg 1)) | |||||
| (save-excursion | |||||
| (dotimes (var (abs arg)) | |||||
| (if (> arg 0) | |||||
| (re-search-backward php-extras-php-variable-regexp nil t) | |||||
| (re-search-forward php-extras-php-variable-regexp nil t)))) | |||||
| (if (match-string-no-properties 1) | |||||
| (insert (match-string-no-properties 1)) | |||||
| (message "No variable to insert."))) | |||||
| ;;;###autoload | |||||
| (defun php-extras-eldoc-documentation-function () | |||||
| "Get function arguments for core PHP function at point." | |||||
| (when (eq php-extras-function-arguments 'not-loaded) | |||||
| (php-extras-load-eldoc)) | |||||
| (when (hash-table-p php-extras-function-arguments) | |||||
| (or | |||||
| (gethash (php-get-pattern) php-extras-function-arguments) | |||||
| (save-excursion | |||||
| (ignore-errors | |||||
| (backward-up-list) | |||||
| (gethash (php-get-pattern) php-extras-function-arguments)))))) | |||||
| ;;;###autoload | |||||
| (add-hook 'php-mode-hook 'php-extras-eldoc-setup) | |||||
| (defun php-extras-eldoc-setup () | |||||
| (unless eldoc-documentation-function | |||||
| (set (make-local-variable 'eldoc-documentation-function) | |||||
| #'php-extras-eldoc-documentation-function)) | |||||
| (eldoc-add-command 'completion-at-point)) | |||||
| (defun php-extras-load-eldoc () | |||||
| (unless | |||||
| (require 'php-extras-eldoc-functions php-extras-eldoc-functions-file t) | |||||
| (warn "PHP function descriptions not loaded. Try M-x php-extras-generate-eldoc"))) | |||||
| (defun php-extras-ac-insert-action () | |||||
| "Auto-complete insert action for PHP. | |||||
| If `php-extras-auto-complete-insert-parenthesis' is t insert a | |||||
| pair of parenthesis after the inserted auto complete selection; | |||||
| place point in between the parenthesis and show the `eldoc' | |||||
| documentation for the inserted selection." | |||||
| (when php-extras-auto-complete-insert-parenthesis | |||||
| (insert "()") | |||||
| (backward-char) | |||||
| (when (and (boundp 'eldoc-documentation-function) | |||||
| (fboundp 'eldoc-message)) | |||||
| (eldoc-message (funcall eldoc-documentation-function))))) | |||||
| (defvar ac-source-php-extras | |||||
| '((candidates . php-extras-autocomplete-candidates) | |||||
| (candidate-face . php-extras-autocomplete-candidate-face) | |||||
| (selection-face . php-extras-autocomplete-selection-face) | |||||
| (action . php-extras-ac-insert-action) | |||||
| (cache)) | |||||
| "Auto complete source for PHP functions.") | |||||
| (defface php-extras-autocomplete-candidate-face | |||||
| '((t (:inherit ac-candidate-face))) | |||||
| "Face for PHP auto complete candidate." | |||||
| :group 'php) | |||||
| (defface php-extras-autocomplete-selection-face | |||||
| '((t (:inherit ac-selection-face))) | |||||
| "Face for PHP auto complete selection." | |||||
| :group 'php) | |||||
| (defun php-extras-autocomplete-candidates () | |||||
| "Generate PHP auto complete candidates. | |||||
| The candidates are generated from the | |||||
| `php-extras-function-arguments' hash table." | |||||
| (let (candidates) | |||||
| (when (eq php-extras-function-arguments 'not-loaded) | |||||
| (php-extras-load-eldoc)) | |||||
| (when (hash-table-p php-extras-function-arguments) | |||||
| (maphash (lambda (key value) (setq candidates (cons key candidates))) php-extras-function-arguments)) | |||||
| candidates)) | |||||
| ;;;###autoload | |||||
| (defun php-extras-autocomplete-setup () | |||||
| (eval-after-load 'auto-complete | |||||
| '(add-to-list 'ac-sources 'ac-source-php-extras))) | |||||
| ;;;###autoload | |||||
| (add-hook 'php-mode-hook #'php-extras-autocomplete-setup) | |||||
| ;;; Setup basic Emacs completion-at-point to complete on function names | |||||
| ;;;###autoload | |||||
| (defun php-extras-completion-at-point () | |||||
| (when (eq php-extras-function-arguments 'not-loaded) | |||||
| (php-extras-load-eldoc)) | |||||
| (when (hash-table-p php-extras-function-arguments) | |||||
| (let ((bounds (bounds-of-thing-at-point 'symbol))) | |||||
| (if bounds | |||||
| (list (car bounds) (cdr bounds) php-extras-function-arguments | |||||
| :exclusive 'no) | |||||
| nil)))) | |||||
| ;;;###autoload | |||||
| (defun php-extras-completion-setup () | |||||
| (add-hook 'completion-at-point-functions | |||||
| #'php-extras-completion-at-point | |||||
| nil t)) | |||||
| ;;;###autoload | |||||
| (add-hook 'php-mode-hook #'php-extras-completion-setup) | |||||
| ;;;###autoload | |||||
| (eval-after-load 'php-mode | |||||
| `(let ((map php-mode-map) | |||||
| (key php-extras-insert-previous-variable-key)) | |||||
| (define-key map key 'php-extras-insert-previous-variable))) | |||||
| (provide 'php-extras) | |||||
| ;;; php-extras.el ends here | |||||
| @ -0,0 +1,175 @@ | |||||
| Dette er php-extras.info, produceret med makeinfo version 4.8 ud fra | |||||
| stdin. | |||||
| File: php-extras.info, Node: Top, Up: (dir) | |||||
| Top | |||||
| *** | |||||
| * Menu: | |||||
| * PHP Extras:: | |||||
| File: php-extras.info, Node: PHP Extras, Prev: Top, Up: Top | |||||
| 1 PHP Extras | |||||
| ************ | |||||
| A small collection of extra features for Emacs `php-mode'. | |||||
| Currently includes: | |||||
| * `php-extras-insert-previous-variable' | |||||
| * `php-extras-eldoc-documentation-function' | |||||
| * Auto complete source for PHP functions based on | |||||
| `php-extras-eldoc-documentation-function' | |||||
| * Menu: | |||||
| * php-extras-insert-previous-variable:: | |||||
| * php-extras-eldoc-documentation-function:: | |||||
| * Auto complete source for PHP functions based:: | |||||
| * Installation:: | |||||
| * Development of PHP Extras:: | |||||
| File: php-extras.info, Node: php-extras-insert-previous-variable, Next: php-extras-eldoc-documentation-function, Up: PHP Extras | |||||
| 1.1 `php-extras-insert-previous-variable' | |||||
| ========================================= | |||||
| When variable names get too long or you have to juggle a lot of nested | |||||
| arrays it gets cumbersome to repeat the same variables over and over | |||||
| again while programming. | |||||
| In example you have the code below and want to debug what value you | |||||
| actually parsed to `some_function()'. You have point at `^' and now all | |||||
| you have to write is repeat the variable... | |||||
| some_function($my_array['some_level'][0]['another_level'][7]); | |||||
| print_r(^); | |||||
| Enter `php-extras' and you just hit C-c C-$ and it will insert the | |||||
| previous variable (including array indexes). | |||||
| If you prefix the command (i.e. C-u 3 C-c C-$) it will search back 3 | |||||
| variables and with negative prefix arguments it will search forward. | |||||
| File: php-extras.info, Node: php-extras-eldoc-documentation-function, Next: Auto complete source for PHP functions based, Prev: php-extras-insert-previous-variable, Up: PHP Extras | |||||
| 1.2 `php-extras-eldoc-documentation-function' | |||||
| ============================================= | |||||
| `eldoc-mode' is a nice minor mode that ships with Emacs. It will | |||||
| display a function tip in the mini buffer showing the function and its | |||||
| arguments for the function at point. That is if you provide a function | |||||
| to look up the function definition. | |||||
| `php-extras' provides such a function for looking up all the core | |||||
| PHP functions. | |||||
| The function `php-extras-generate-eldoc' will download the PHP | |||||
| function summary PHP Subversion repository | |||||
| (http://svn.php.net/repository/phpdoc/doc-base/trunk/funcsummary.txt) | |||||
| and extract the function definitions (slow) and store them in a hash | |||||
| table on disk for you. | |||||
| If you install `php-extras' as an ELPA package the hash table is | |||||
| already generated for you. | |||||
| File: php-extras.info, Node: Auto complete source for PHP functions based, Next: Installation, Prev: php-extras-eldoc-documentation-function, Up: PHP Extras | |||||
| 1.3 Auto complete source for PHP functions based | |||||
| ================================================ | |||||
| The PHP functions extracted for | |||||
| `php-extras-eldoc-documentation-function' is also setup as a source for | |||||
| auto-complete (http://cx4a.org/software/auto-complete). | |||||
| auto-complete (http://cx4a.org/software/auto-complete) already comes | |||||
| with a dictionary of PHP functions and will auto complete on them using | |||||
| the `ac-source-dictionary'. | |||||
| The source we provide with `php-extras' will hopefully be more up to | |||||
| date. | |||||
| File: php-extras.info, Node: Installation, Next: Development of PHP Extras, Prev: Auto complete source for PHP functions based, Up: PHP Extras | |||||
| 1.4 Installation | |||||
| ================ | |||||
| The easiest way to install `php-extras' is probably to install it via | |||||
| the ELPA archive at Marmalade | |||||
| (http://marmalade-repo.org/packages/php-extras). | |||||
| ELPA (package.el) is part of Emacs 24. For Emacs 23 see Marmalade | |||||
| (http://marmalade-repo.org) for installation instructions. | |||||
| The version number of the ELPA package will have the date appended | |||||
| when the package was build and hence the date the documentation got | |||||
| extracted from php.net (http://php.net). | |||||
| * Menu: | |||||
| * Manual installation:: | |||||
| File: php-extras.info, Node: Manual installation, Up: Installation | |||||
| 1.4.1 Manual installation | |||||
| ------------------------- | |||||
| I really recommend that you install this package via ELPA as described | |||||
| above. | |||||
| If you insist on installing it manually try to follow this recipe: | |||||
| * Place the folder with the files somewhere on your disk. | |||||
| * Add this to your `.emacs' / `.emacs.d/init.el': | |||||
| (add-to-list 'load-path "/somewhere/on/your/disk/php-xtras") | |||||
| (eval-after-load 'php-mode | |||||
| (require 'php-extras)) | |||||
| * Either restart your Emacs or evaluate the `add-to-list' expression. | |||||
| * Generate the hash table containing the PHP functions: | |||||
| M-x load-library RET php-extras-gen-eldoc RET | |||||
| M-x php-extras-generate-eldoc RET | |||||
| File: php-extras.info, Node: Development of PHP Extras, Prev: Installation, Up: PHP Extras | |||||
| 1.5 Development of PHP Extras | |||||
| ============================= | |||||
| PHP Extras is developed at GitHub | |||||
| (https://github.com/arnested/php-extras). Feature requests, ideas, bug | |||||
| reports, and pull request are more than welcome! | |||||
| Tag Table: | |||||
| Node: Top77 | |||||
| Node: PHP Extras160 | |||||
| Node: php-extras-insert-previous-variable720 | |||||
| Node: php-extras-eldoc-documentation-function1627 | |||||
| Node: Auto complete source for PHP functions based2604 | |||||
| Node: Installation3280 | |||||
| Node: Manual installation3958 | |||||
| Node: Development of PHP Extras4688 | |||||
| End Tag Table | |||||
| @ -0,0 +1,36 @@ | |||||
| ;;; php-mode-autoloads.el --- automatically extracted autoloads | |||||
| ;; | |||||
| ;;; Code: | |||||
| ;;;### (autoloads (php-mode php-file-patterns) "php-mode" "php-mode.el" | |||||
| ;;;;;; (21154 21303 0 0)) | |||||
| ;;; Generated autoloads from php-mode.el | |||||
| (defvar php-file-patterns '("\\.php[s34]?\\'" "\\.phtml\\'" "\\.inc\\'") "\ | |||||
| List of file patterns for which to automatically invoke `php-mode'.") | |||||
| (custom-autoload 'php-file-patterns "php-mode" nil) | |||||
| (autoload 'php-mode "php-mode" "\ | |||||
| Major mode for editing PHP code. | |||||
| \\{php-mode-map} | |||||
| \(fn)" t nil) | |||||
| ;;;*** | |||||
| ;;;### (autoloads nil nil ("php-mode-pkg.el") (21154 21303 508318 | |||||
| ;;;;;; 0)) | |||||
| ;;;*** | |||||
| (provide 'php-mode-autoloads) | |||||
| ;; Local Variables: | |||||
| ;; version-control: never | |||||
| ;; no-byte-compile: t | |||||
| ;; no-update-autoloads: t | |||||
| ;; coding: utf-8 | |||||
| ;; End: | |||||
| ;;; php-mode-autoloads.el ends here | |||||
| @ -0,0 +1 @@ | |||||
| (define-package "php-mode" "1.5.0" "major mode for editing PHP code" (quote nil)) | |||||