diff --git a/elpa/archives/melpa-stable/archive-contents b/elpa/archives/melpa-stable/archive-contents new file mode 100644 index 000000000..c3c3913ff --- /dev/null +++ b/elpa/archives/melpa-stable/archive-contents @@ -0,0 +1,2 @@ + +(1 (zygospore . [(0 0 3) nil "reversible C-x 1 (delete-other-windows)" single ((:url . "https://github.com/louiskottmann/zygospore.el"))]) (zenburn-theme . [(2 0) nil "A low contrast color theme for Emacs." single ((:url . "http://github.com/bbatsov/zenburn-emacs"))]) (yasnippet . [(0 8 0) nil "Yet another snippet extension for Emacs." tar ((:url . "http://github.com/capitaomorte/yasnippet") (:keywords "convenience" "emulation"))]) (yascroll . [(0 1) nil "Yet Another Scroll Bar Mode" single ((:keywords "convenience"))]) (yagist . [(0 8 9) ((json (1 2 0))) "Yet Another Emacs integration for gist.github.com" single ((:url . "https://github.com/mhayashi1120/yagist.el/raw/master/yagist.el") (:keywords "gist" "git" "github" "paste" "pastie" "pastebin"))]) (yafolding . [(0 1 4) nil "Yet another folding extension for Emacs" single ((:keywords "folding"))]) (xterm-color . [(1 0) nil "ANSI & XTERM 256 color support" single nil]) (xcscope . [(1 1) nil "cscope interface for (X)Emacs" single ((:url . "https://github.com/dkogan/xcscope.el") (:keywords "languages" "c"))]) (ws-butler . [(0 3) nil "Unobtrusively remove trailing whitespace." single ((:url . "https://github.com/lewang/ws-butler"))]) (writeroom-mode . [(2 5) nil "Minor mode for distraction-free writing" tar ((:keywords "text"))]) (writegood-mode . [(2 0) nil "Polish up poor writing on the fly" single ((:url . "http://github.com/bnbeckwith/writegood-mode") (:keywords "writing" "weasel-words" "grammar"))]) (wrap-region . [(0 7 3) ((dash (1 0 3))) "Wrap text with punctation or tag" single ((:url . "http://github.com/rejeep/wrap-region") (:keywords "speed" "convenience"))]) (wonderland . [(0 1 1) ((dash (2 0 0)) (dash-functional (1 0 0)) (multi (2 0 0)) (emacs (24))) "declarative configuration for Emacsen" single ((:url . "http://github.com/kurisuwhyte/emacs-wonderland") (:keywords "configuration" "profile" "wonderland"))]) (wispjs-mode . [(0 2 0) ((clojure-mode (0))) "Major mode for Wisp code." single ((:url . "https://github.com/krisajenkins/wispjs-mode"))]) (wisp-mode . [(0 6 1) nil "Tools for wisp: the Whitespace-to-Lisp preprocessor" single ((:keywords "languages" "lisp"))]) (window-numbering . [(1 1 2) nil "No description available." single nil]) (window-layout . [(1 2) nil "window layout manager" single ((:keywords "window" "layout"))]) (window-end-visible . [(0 1 0) nil "Find the last visible point in a window" single ((:url . "http://github.com/rolandwalker/window-end-visible") (:keywords "extensions"))]) (wiki-nav . [(1 0 0) ((button-lock (1 0 0)) (nav-flash (1 0 0))) "Simple file navigation using [[WikiStrings]]" single ((:url . "http://github.com/rolandwalker/button-lock") (:keywords "mouse" "button" "hypermedia" "navigation"))]) (whitespace-cleanup-mode . [(0 8) nil "Intelligently call whitespace-cleanup on save" single ((:url . "https://github.com/purcell/whitespace-cleanup-mode") (:keywords "convenience"))]) (weechat . [(0 2) ((s (1 3 1)) (cl-lib (0 2)) (emacs (24)) (tracking (1 2))) "Chat via WeeChat's relay protocol in Emacs" tar nil]) (wcheck-mode . [(2014 6 21) nil "General interface for text checkers" tar nil]) (wacspace . [(0 4 2) ((dash (1 2 0)) (cl-lib (0 2))) "The WACky WorkSPACE manager for emACS" tar nil]) (vlf . [(1 5) nil "View Large Files" tar ((:url . "https://github.com/m00natic/vlfi") (:keywords "large files" "utilities"))]) (vim-region . [(0 3 0) ((expand-region (20140127))) "Select region as vim" single ((:url . "https://github.com/ongaeshi/emacs-vim-region"))]) (vector-utils . [(0 1 2) nil "Vector-manipulation utility functions" single ((:url . "http://github.com/rolandwalker/vector-utils") (:keywords "extensions"))]) (vcomp . [(0 3 1) nil "compare version strings" single ((:url . "https://github.com/tarsius/vcomp") (:keywords "versions"))]) (utop . [(1 14) ((emacs (24))) "Universal toplevel for OCaml" single ((:url . "https://github.com/diml/utop") (:keywords "ocaml" "languages"))]) (use-package . [(20140601) ((bind-key (1 0)) (diminish (0 44))) "A use-package declaration for simplifying your .emacs" single ((:url . "https://github.com/jwiegley/use-package") (:keywords "dotemacs" "startup" "speed" "config" "package"))]) (unicode-whitespace . [(0 2 4) ((ucs-utils (0 7 6)) (persistent-soft (0 8 8)) (pcache (0 2 3))) "teach whitespace-mode about fancy characters" single ((:url . "http://github.com/rolandwalker/unicode-whitespace") (:keywords "faces" "wp" "interface"))]) (unicode-progress-reporter . [(0 5 4) ((emacs (24 1 0)) (ucs-utils (0 7 6)) (persistent-soft (0 8 8)) (pcache (0 2 3))) "Progress-reporter with fancy characters" single ((:url . "http://github.com/rolandwalker/unicode-progress-reporter") (:keywords "interface"))]) (unicode-fonts . [(0 4 2) ((font-utils (0 7 2)) (ucs-utils (0 8 0)) (list-utils (0 4 2)) (persistent-soft (0 8 8)) (pcache (0 2 3))) "Configure Unicode fonts" single ((:url . "http://github.com/rolandwalker/unicode-fonts") (:keywords "i18n" "faces" "frames" "wp" "interface"))]) (unicode-enbox . [(0 1 4) ((string-utils (0 3 2)) (ucs-utils (0 7 6)) (persistent-soft (0 8 8)) (pcache (0 2 3))) "Surround a string with box-drawing characters" single ((:url . "http://github.com/rolandwalker/unicode-enbox") (:keywords "extensions" "interface"))]) (unfill . [(0 1) nil "The inverse of fill-paragraph and fill-region" single ((:keywords "utilities"))]) (underwater-theme . [(1 1 0) nil "A gentle, deep blue color theme" single ((:keywords "faces"))]) (ucs-utils . [(0 8 0) ((persistent-soft (0 8 8)) (pcache (0 2 3)) (list-utils (0 4 2))) "Utilities for Unicode characters" tar ((:url . "http://github.com/rolandwalker/ucs-utils") (:keywords "i18n" "extensions"))]) (typo . [(1 1) nil "Minor mode for typographic editing" single ((:url . "https://github.com/jorgenschaefer/typoel") (:keywords "convenience" "wp"))]) (twittering-mode . [(2 0 0) nil "Major mode for Twitter" single ((:url . "http://twmode.sf.net/") (:keywords "twitter" "web"))]) (twilight-anti-bright-theme . [(0 1 1) nil "A soothing Emacs 24 light-on-dark theme" single ((:url . "https://github.com/jimeh/twilight-anti-bright-theme.el") (:keywords "themes"))]) (tup-mode . [(1 3 1) nil "Major mode for editing files for Tup" single ((:url . "https://github.com/ejmr/tup-mode"))]) (tumble . [(1 5) nil "an Tumblr mode for Emacs" single ((:keywords "tumblr"))]) (tuareg . [(2 0 8) ((caml (3 12 0 1))) "OCaml mode for Emacs." tar ((:url . "http://forge.ocamlcore.org/projects/tuareg/") (:keywords "ocaml" "languages"))]) (ttrss . [(1 7 5) ((emacs (23 1))) "Tiny Tiny RSS elisp bindings" single ((:url . "https://github.com/pedros/ttrss.el") (:keywords "news" "local"))]) (truthy . [(0 2 8) ((list-utils (0 4 2))) "Test the content of a value" single ((:url . "http://github.com/rolandwalker/truthy") (:keywords "extensions"))]) (traad . [(0 4) nil "emacs interface to the traad refactoring server." single ((:url . "https://github.com/abingham/traad"))]) (thrift . [(0 9 1) nil "No description available." single nil]) (theme-changer . [(2 1 0) nil "Sunrise/Sunset Theme Changer for Emacs" single ((:url . "https://github.com/hadronzoo/theme-changer") (:keywords "color-theme" "deftheme" "solar" "sunrise" "sunset"))]) (textmate-to-yas . [(0 21) nil "Import Textmate macros into yasnippet syntax" tar ((:url . "https://github.com/mlf176f2/textmate-to-yas.el/") (:keywords "yasnippet" "textmate"))]) (textmate . [(1) nil "No description available." single nil]) (test-case-mode . [(0 1 9) nil "unit test front-end" single ((:url . "http://nschum.de/src/emacs/test-case-mode/") (:keywords "tools"))]) (terraform-mode . [(0 1) ((cl-lib (0 5))) "Major mode for terraform configuration file" single ((:url . "https://github.com/syohex/emacs-terraform-mode"))]) (tern-auto-complete . [(0 6 2) ((tern (0 0 1)) (auto-complete (1 4)) (cl-lib (0 5)) (emacs (24))) "Tern Completion by auto-complete.el" single nil]) (tern . [(0 6 2) ((json (1 2)) (cl-lib (0 5)) (emacs (24))) "Tern-powered JavaScript integration" single ((:url . "http://ternjs.net/"))]) (tempbuf . [(1 4) nil "kill unused buffers in the background" single ((:keywords "convenience"))]) (tagedit . [(1 4 0) ((s (1 3 1)) (dash (1 0 3))) "Some paredit-like features for html-mode" single ((:keywords "convenience"))]) (tabbar-ruler . [(0 40) ((tabbar (2 0 1))) "Pretty tabbar, autohide, use both tabbar/ruler" tar ((:url . "http://github.com/mlf176f2/tabbar-ruler.el") (:keywords "tabbar" "ruler mode" "menu" "tool bar."))]) (syntactic-sugar . [(0 9 4) nil "Effect-free forms such as if/then/else" single ((:url . "http://github.com/rolandwalker/syntactic-sugar") (:keywords "extensions"))]) (swift-mode . [(0 2 0) ((emacs (24 1))) "Major-mode for Apple's Swift programming language." single nil]) (svg-mode-line-themes . [(0 1 1) ((xmlgen (0 4))) "SVG-based themes for mode-line" tar ((:url . "https://github.com/sabof/svg-mode-line-themes"))]) (suomalainen-kalenteri . [(2014 6 15) nil "Finnish national and Christian holidays for calendar" tar nil]) (sudden-death . [(0 2) nil "Totsuzen-no-Shi" single ((:url . "https://github.com/yewton/sudden-death.el"))]) (subshell-proc . [(0 1) nil "Functions for working with comints" single ((:url . "https://github.com/andrewmains12/subshell-proc"))]) (stumpwm-mode . [(0 9 8) nil "special lisp mode for evaluating code into running stumpwm" single ((:keywords "comm" "lisp" "tools"))]) (stripe-buffer . [(0 2 2) ((cl-lib (1 0))) "Use a different background for even and odd lines" single ((:url . "https://github.com/sabof/stripe-buffer"))]) (string-utils . [(0 3 2) ((list-utils (0 4 2))) "String-manipulation utilities" single ((:url . "http://github.com/rolandwalker/string-utils") (:keywords "extensions"))]) (string-edit . [(0 1 0) ((dash (1 2 0))) "Avoid escape nightmares by editing string in separate buffer" single nil]) (stgit . [(0 17 1) nil "No description available." single nil]) (stekene-theme . [(1 0 8) ((emacs (24))) "The stekene dark and light color themes." tar nil]) (starter-kit-ruby . [(2 0 3) ((inf-ruby (2 2 1)) (starter-kit (2 0 1))) "Saner defaults and goodies for Ruby" single ((:url . "http://www.emacswiki.org/cgi-bin/wiki/StarterKit") (:keywords "convenience"))]) (starter-kit-perl . [(2 0 3) nil "Some helpful Perl code" single nil]) (starter-kit-lisp . [(2 0 3) ((starter-kit (2 0 2)) (elisp-slime-nav (0 1))) "Saner defaults and goodies for lisp languages" single ((:url . "http://www.emacswiki.org/cgi-bin/wiki/StarterKit") (:keywords "convenience"))]) (starter-kit-js . [(2 0 3) ((starter-kit (2 0 1))) "Saner defaults and goodies for Javascript" single ((:url . "http://www.emacswiki.org/cgi-bin/wiki/StarterKit") (:keywords "convenience"))]) (starter-kit-eshell . [(2 0 3) nil "Saner defaults and goodies: eshell tweaks" single ((:url . "http://www.emacswiki.org/cgi-bin/wiki/StarterKit") (:keywords "convenience"))]) (starter-kit-bindings . [(2 0 3) ((starter-kit (2 0 2))) "Saner defaults and goodies: bindings" single ((:url . "http://www.emacswiki.org/cgi-bin/wiki/StarterKit") (:keywords "convenience"))]) (starter-kit . [(2 0 3) ((paredit (22)) (idle-highlight-mode (1 1 1)) (find-file-in-project (3 0)) (smex (1 1 1)) (ido-ubiquitous (0 3)) (magit (0 8 1))) "Saner defaults and goodies." tar nil]) (stan-snippets . [(2 4 1) ((yasnippet (0 8 0)) (stan-mode (2 4 1))) "Yasnippets for Stan" tar ((:url . "http://github.com/stan-dev/stan-mode") (:keywords "languages"))]) (stan-mode . [(2 4 1) nil "Major mode for editing Stan files" tar ((:url . "http://github.com/stan-dev/stan-mode") (:keywords "languanges"))]) (sprintly-mode . [(0 0 4) ((furl (0 0 2))) "Major mode for dealing with sprint.ly" single ((:url . "https://github.com/sprintly/sprintly-mode"))]) (sparql-mode . [(0 9 2) nil "Edit and interactively evaluate SPARQL queries." tar ((:url . "https://github.com/ljos/sparql-mode"))]) (sourcemap . [(0 1) ((cl-lib (0 5)) (emacs (24))) "Sourcemap parser" single ((:url . "https://github.com/syohex/emacs-sourcemap"))]) (solarized-theme . [(1 1 0) ((dash (2 6 0))) "The Solarized color theme, ported to Emacs." tar nil]) (smex . [(3 0) nil "M-x interface with Ido-style fuzzy matching." single ((:url . "http://github.com/nonsequitur/smex/") (:keywords "convenience" "usability"))]) (smeargle . [(0 1) ((cl-lib (0 5)) (emacs (24))) "Highlighting region by last updated time" single ((:url . "https://github.com/syohex/emacs-smeargle"))]) (smartscan . [(0 2) nil "Jumps between other symbols found at point" single ((:keywords "extensions"))]) (smartrep . [(0 0 3) nil "Support sequential operation which omitted prefix keys." single ((:url . "https://github.com/myuhe/smartrep.el") (:keywords "convenience"))]) (smart-tabs-mode . [(1 0) nil "Intelligently indent with tabs, align with spaces!" single ((:url . "http://www.emacswiki.org/emacs/SmartTabs") (:keywords "languages"))]) (smart-mode-line . [(2 5 3) ((emacs (24 3)) (dash (2 2 0))) "A color coded smart mode-line." tar ((:url . "http://github.com/Bruce-Connor/smart-mode-line") (:keywords "mode-line" "faces" "theme" "themes"))]) (slime-volleyball . [(1 1) nil "An SVG Slime Volleyball Game" tar ((:keywords "games"))]) (slime-ritz . [(0 6 0) nil "slime extensions for ritz" single ((:url . "https://github.com/pallet/ritz") (:keywords "languages" "lisp" "slime"))]) (slime-company . [(0 6) ((slime (2 3 2)) (company (0 7))) "slime completion backend for company mode" single ((:keywords "convenience" "lisp" "abbrev"))]) (slime . [(2 9) ((cl-lib (0 5))) "Superior Lisp Interaction Mode for Emacs" tar ((:url . "https://github.com/slime/slime") (:keywords "languages" "lisp" "slime"))]) (slim-mode . [(1 1) nil "Major mode for editing Slim files" single ((:url . "http://github.com/minad/emacs-slim") (:keywords "markup" "language"))]) (slamhound . [(1 5 4) nil "Rip Clojure namespaces apart and rebuild them." single ((:url . "https://github.com/technomancy/slamhound") (:keywords "tools" "lisp"))]) (skewer-mode . [(1 6 1) ((simple-httpd (1 4 0)) (js2-mode (20090723)) (emacs (24))) "live browser JavaScript, CSS, and HTML interaction" tar nil]) (skewer-less . [(0 2) ((skewer-mode (1 5 3))) "Skewer support for live LESS stylesheet updates" single ((:keywords "languages" "tools"))]) (skeletor . [(1 4) ((s (1 7 0)) (f (0 14 0)) (dash (2 2 0)) (cl-lib (0 3)) (emacs (24 1))) "Provides project skeletons for Emacs" tar nil]) (simplezen . [(0 1 1) nil "A simple subset of zencoding-mode for Emacs." single nil]) (simpleclip . [(1 0 0) nil "Simplified access to the system clipboard" single ((:url . "http://github.com/rolandwalker/simpleclip") (:keywords "convenience"))]) (simple-httpd . [(1 4 5) ((cl-lib (0 3))) "pure elisp HTTP server" single ((:url . "https://github.com/skeeto/emacs-http-server"))]) (shut-up . [(0 3 1) ((cl-lib (0 3)) (emacs (24))) "Shut up would you!" single ((:url . "http://github.com/rejeep/shut-up.el"))]) (shm . [(1 0 1) nil "No description available." tar nil]) (shell-pop . [(0 3) nil "helps you to use shell easily on Emacs. Only one key action to work." single ((:url . "http://github.com/kyagi/shell-pop-el") (:keywords "shell" "terminal" "tools"))]) (shampoo . [(0 0 1) nil "Shampoo, a remote Smalltalk developemnt" tar nil]) (session . [(2 3 1) nil "use variables, registers and buffer places across sessions" single ((:url . "http://emacs-session.sourceforge.net/") (:keywords "session" "session management" "desktop" "data" "tools"))]) (serverspec . [(0 0 4) ((dash (2 6 0)) (s (1 9 0)) (f (0 16 2)) (helm (1 6 1))) "Serverspec minor mode" tar ((:url . "http://101000lab.org"))]) (servant . [(0 3 0) ((s (1 8 0)) (dash (2 2 0)) (f (0 11 0)) (ansi (0 3 0)) (commander (0 5 0)) (epl (0 2)) (shut-up (0 2 1)) (web-server (0 0 1))) "ELPA server written in Emacs Lisp" tar ((:url . "http://github.com/rejeep/servant.el") (:keywords "elpa" "server"))]) (sekka . [(1 5 5) nil "No description available." single nil]) (scss-mode . [(0 5 0) nil "Major mode for editing SCSS files" single ((:url . "https://github.com/antonj/scss-mode") (:keywords "scss" "css" "mode"))]) (scheme-here . [(0 6) nil "cmuscheme extension for multiple inferior processes" single ((:url . "https://github.com/zhaov/scheme-here") (:keywords "scheme"))]) (scala-mode . [(2 11 2) nil "Major mode for editing Scala code." tar ((:keywords "scala" "languages" "oop"))]) (save-sexp . [(0 2 0) nil "save variables in files using setter forms like `setq'" tar ((:url . "https://github.com/tarsius/save-sexp") (:keywords "convenience"))]) (sauron . [(0 10) nil "Track (erc/org/dbus/...) events and react to them." tar nil]) (sackspace . [(0 8 2) nil "A better backspace" single ((:url . "http://github.com/cofi/sackspace.el") (:keywords "delete" "convenience"))]) (s . [(1 9 0) nil "The long lost Emacs string manipulation library." single ((:keywords "strings"))]) (rvm . [(1 3 0) nil "Emacs integration for rvm" single ((:url . "http://www.emacswiki.org/emacs/RvmEl") (:keywords "ruby" "rvm"))]) (rust-mode . [(0 11 0) nil "A major emacs mode for editing Rust source code" single ((:url . "https://github.com/rust-lang/rust") (:keywords "languages"))]) (ruby-tools . [(0 1 2) nil "Collection of handy functions for ruby-mode." tar nil]) (ruby-test-mode . [(1 0) nil "Minor mode for Behaviour and Test Driven" single ((:keywords "ruby" "unit" "test" "rspec"))]) (ruby-hash-syntax . [(0 3) nil "Toggle ruby hash syntax between classic and 1.9 styles" single ((:url . "https://github.com/purcell/ruby-hash-syntax") (:keywords "languages"))]) (ruby-end . [(0 4 0) nil "Automatic insertion of end blocks for Ruby" single ((:url . "http://github.com/rejeep/ruby-end") (:keywords "speed" "convenience" "ruby"))]) (ruby-compilation . [(2 10) ((inf-ruby (2 2 1))) "run a ruby process in a compilation buffer" single ((:url . "https://github.com/eschulte/rinari") (:keywords "test" "convenience"))]) (rtags . [(1 1) nil "No description available." tar nil]) (rsense . [(0 3) nil "RSense client for Emacs" single ((:keywords "convenience"))]) (roguel-ike . [(0 1) ((popup (0 5 0))) "A coffee-break roguelike" tar nil]) (rnc-mode . [(1 0 6) nil "A major mode for editing RELAX NG Compact syntax." single nil]) (rinari . [(2 10) ((ruby-mode (1 0)) (inf-ruby (2 2 1)) (ruby-compilation (0 8)) (jump (2 0))) "Rinari Is Not A Rails IDE" single ((:url . "https://github.com/eschulte/rinari") (:keywords "ruby" "rails" "project" "convenience" "web"))]) (reveal-in-finder . [(0 3 1) nil "Reveal the file associated with the buffer in the OS X Finder" single ((:url . "https://github.com/kaz-yos/elisp") (:keywords "os x" "finder"))]) (request-deferred . [(0 1 0) nil "Wrap request.el by deferred" single nil]) (request . [(0 1 0) nil "Compatible layer for URL request in Emacs" single nil]) (req-package . [(0 5) ((use-package (1 0)) (dash (2 7 0)) (log4e (0 2 0))) "A use-package wrapper for package runtime dependencies management" single ((:url . "https://github.com/edvorg/req-package") (:keywords "dotemacs" "startup" "speed" "config" "package"))]) (relax . [(0 2) ((json (1 2))) "For browsing and interacting with CouchDB" single ((:url . "http://github.com/technomancy/relax.el") (:keywords "database" "http"))]) (relative-line-numbers . [(0 2 6) ((emacs (24))) "Display relative line numbers on the margin" single ((:url . "https://github.com/Fanael/relative-line-numbers"))]) (rbenv . [(0 0 3) nil "Emacs integration for rbenv" single ((:url . "https://github.com/senny/rbenv.el") (:keywords "ruby" "rbenv"))]) (rase . [(1 1) nil "Run At Sun Event daemon" single ((:url . "https://github.com/m00natic/rase/") (:keywords "solar" "sunrise" "sunset" "midday" "midnight"))]) (rainbow-identifiers . [(0 2 1) ((emacs (24))) "Highlight identifiers according to their names" single ((:url . "https://github.com/Fanael/rainbow-identifiers"))]) (rainbow-delimiters . [(1 3 7) nil "Highlight nested parens, brackets, braces a different color at each depth." single ((:url . "http://github.com/jlr/rainbow-delimiters/raw/master/rainbow-delimiters.el") (:keywords "faces" "convenience" "lisp" "matching" "tools" "rainbow" "rainbow parentheses" "rainbow parens"))]) (r-autoyas . [(0 28) nil "Provides automatically created yasnippets for R function argument lists." tar ((:url . "https://github.com/mlf176f2/r-autoyas.el") (:keywords "r" "yasnippet"))]) (quickrun . [(2 0 6) nil "Run commands quickly" single ((:url . "https://github.com/syohex/emacs-quickrun"))]) (qml-mode . [(0 1) nil "Major mode for editing QT Declarative (QML) code." single ((:url . "https://github.com/coldnew/qml-mode") (:keywords "qml" "qt" "qt declarative"))]) (qiita . [(0 0 1) nil "No description available." single nil]) (pyvenv . [(1 3) nil "Python virtual environment interface" single ((:url . "http://github.com/jorgenschaefer/pyvenv") (:keywords "python" "virtualenv" "tools"))]) (python-environment . [(0 0 1) ((deferred (0 3 1))) "virtualenv API for Emacs Lisp" tar ((:keywords "applications" "tools"))]) (pushbullet . [(0 5 2) ((grapnel (0 5 2)) (json (1 2))) "Emacs client for the PushBullet Android app" single ((:url . "http://www.github.com/theanalyst/revolver") (:keywords "convenience"))]) (puppet-mode . [(0 3) ((emacs (24 1)) (cl-lib (0 5)) (pkg-info (0 4))) "Major mode for Puppet manifests" single ((:url . "https://github.com/lunaryorn/puppet-mode") (:keywords "languages"))]) (pungi . [(0 9 5) ((jedi (0 2 0 -3 2))) "Integrates jedi with virtualenv and buildout python environments" single ((:keywords "convenience"))]) (projectile . [(0 11 0) ((s (1 6 0)) (dash (1 5 0)) (pkg-info (0 4))) "Manage and navigate projects in Emacs easily" single ((:url . "https://github.com/bbatsov/projectile") (:keywords "project" "convenience"))]) (project-root . [(0 7) nil "Define a project root and take actions based upon it." single nil]) (project-persist . [(0 3) nil "A minor mode to allow loading and saving of project settings." tar nil]) (project-explorer . [(0 13 4) ((cl-lib (0 3)) (es-lib (0 3)) (es-windows (0 1)) (emacs (24))) "A project explorer sidebar" single ((:url . "https://github.com/sabof/project-explorer"))]) (prodigy . [(0 6 0) ((s (1 8 0)) (dash (2 4 0)) (f (0 14 0)) (emacs (24))) "Manage external services from within Emacs" single ((:url . "http://github.com/rejeep/prodigy.el"))]) (processing-mode . [(1 0) ((yasnippet (0 8 0))) "Major mode for Processing 2.0" single ((:keywords "languages" "snippets"))]) (pretty-mode . [(2 0 2) nil "Redisplay parts of the buffer as pretty symbols." single ((:url . "https://github.com/akatov/pretty-mode") (:keywords "pretty" "unicode" "symbols"))]) (powerline . [(2 2) ((cl-lib (0 2))) "Rewrite of Powerline" tar ((:url . "http://github.com/milkypostman/powerline/") (:keywords "mode-line"))]) (pov-mode . [(3 3) nil "Major mode for editing POV-Ray scene files." tar nil]) (popwin . [(0 6 2) nil "Popup Window Manager." single ((:keywords "convenience"))]) (popup . [(0 5 0) ((cl-lib (0 3))) "Visual Popup User Interface" single ((:keywords "lisp"))]) (plenv . [(0 32) nil "A plenv wrapper for Emacs" single ((:keywords "emacs" "perl"))]) (pkgbuild-mode . [(0 11) nil "Interface to the ArchLinux package manager" single nil]) (pkg-info . [(0 5) ((dash (1 6 0)) (epl (0 4))) "Information about packages" single ((:url . "https://github.com/lunaryorn/pkg-info.el") (:keywords "convenience"))]) (phpunit . [(0 2 0) nil "Launch PHP unit tests using phpunit" single ((:url . "https://github.com/nlamirault/phpunit.el") (:keywords "php" "tests" "phpunit"))]) (php-mode . [(1 13 5) nil "Major mode for editing PHP code" single ((:url . "https://github.com/ejmr/php-mode"))]) (php-auto-yasnippets . [(2 3 1) ((php-mode (1 11)) (yasnippet (0 8 0))) "Creates snippets for PHP functions" tar ((:url . "https://github.com/ejmr/php-auto-yasnippets"))]) (phi-search-mc . [(2 1) ((phi-search (2 0 0)) (multiple-cursors (1 2 1))) "multiple-cursors extension for phi-search" single ((:url . "https://github.com/knu/phi-search-mc.el") (:keywords "search" "cursors"))]) (ph . [(0 1 0) ((emacs (24 3))) "A global minor mode for managing multiple projects." tar nil]) (perspective . [(1 9) nil "switch between named \"perspectives\" of the editor" single ((:url . "http://github.com/nex3/perspective-el") (:keywords "workspace" "convenience" "frames"))]) (persp-projectile . [(0 11 0) ((perspective (1 9)) (projectile (0 11 0)) (cl-lib (0 3))) "Perspective integration with Projectile" single ((:keywords "project" "convenience"))]) (persp-mode . [(0 9 98) ((workgroups (0 2 0))) "\"perspectives\" + save/load + shared among frames." single ((:url . "https://github.com/Bad-ptr/persp-mode.el") (:keywords "perspectives"))]) (persistent-soft . [(0 8 8) ((pcache (0 2 3)) (list-utils (0 4 2))) "Persistent storage, returning nil on failure" single ((:url . "http://github.com/rolandwalker/persistent-soft") (:keywords "data" "extensions"))]) (pcache . [(0 2 4) ((eieio (1 3))) "persistent caching for Emacs" single nil]) (pastehub . [(0 5 2) nil "A client for the PasteHub cloud service" single ((:url . "https://github.com/kiyoka/pastehub"))]) (paste-kde . [(0 6) ((web (0 3 6))) "paste text to KDE's pastebin service" single ((:keywords "comm" "convenience" "tools"))]) (password-store . [(1 6 3) ((dash (1 5 0)) (f (0 11 0)) (s (1 9 0))) "Password store (pass) support" single ((:keywords "pass"))]) (passthword . [(1 3) ((cl-lib (0 5))) "Simple password manager" single nil]) (parent-mode . [(2 0) ((emacs (24))) "get major mode's parent modes" single ((:url . "https://github.com/Fanael/parent-mode"))]) (parenface . [(1 1) nil "Provide a face for parens in lisp modes." single]) (paren-face . [(0 1 0) nil "a face for parentheses in lisp modes" single ((:url . "http://github.com/tarsius/paren-face"))]) (paredit-everywhere . [(0 4) ((paredit (22))) "Enable some paredit features in non-lisp buffers" single ((:keywords "languages" "convenience"))]) (paredit . [(23) nil "minor mode for editing parentheses" single ((:keywords "lisp"))]) (paradox . [(1 0 2) ((emacs (24 1)) (tabulated-list (1 0)) (package (1 0)) (dash (2 6 0)) (cl-lib (1 0)) (json (1 3))) "A modern Packages Menu. Colored, with package ratings, and customizable." tar ((:url . "http://github.com/Bruce-Connor/paradox") (:keywords "package" "packages" "mode-line"))]) (pangu-spacing . [(0 4) nil "Minor-mode to add space between Chinese and English characters." single ((:url . "http://github.com/coldnew/pangu-spacing"))]) (pandoc-mode . [(2 5 4) nil "Minor mode for interacting with Pandoc" tar ((:keywords "text" "pandoc"))]) (pallet . [(0 6) ((cask (0 6))) "A package management tool for Emacs, using Cask." tar nil]) (page-break-lines . [(0 9) nil "Display ugly ^L page breaks as tidy horizontal lines" single ((:url . "https://github.com/purcell/page-break-lines") (:keywords "convenience" "faces"))]) (packed . [(0 3 4) ((cl-lib (0 2)) (magit (1 1 1))) "Package manager agnostic Emacs Lisp package utilities" tar nil]) (outshine . [(1 0) nil "No description available." single nil]) (outorg . [(1 0) nil "No description available." single nil]) (osx-plist . [(1 0 0) nil "Apple plist file parser" single ((:keywords "convenience"))]) (osx-location . [(0 1) nil "Watch and respond to changes in geographical location on OS X" tar nil]) (osx-browse . [(0 8 8) ((string-utils (0 3 2)) (browse-url-dwim (0 6 6))) "Web browsing helpers for OS X" single ((:url . "http://github.com/rolandwalker/osx-browse") (:keywords "hypermedia" "external"))]) (orglink . [(0 2 1) ((dash (1 3 2)) (org (8 0))) "use Org Mode links in other modes" single ((:url . "http://github.com/tarsius/orglink") (:keywords "hypertext"))]) (orgbox . [(0 5 0) ((org (8 0)) (cl-lib (0 5))) "Mailbox-like task scheduling Org." single ((:url . "https://github.com/yasuhito/orgbox") (:keywords "org"))]) (org-trello . [(0 4 8) ((db (0 0 6)) (s (1 7 0)) (esxml (0 3 0)) (elnode (0 9 9 7 6)) (request (0 2 0)) (dash (2 5 0))) "Minor mode to synchronize org-mode buffer and trello board" tar nil]) (org-toodledo . [(2 16) nil "Toodledo integration for Emacs Org mode" tar ((:keywords "outlines" "data"))]) (org-readme . [(20130322 926) ((http-post-simple (1 0)) (yaoddmuse (0 1 1)) (header2 (21 0)) (lib-requires (21 0))) "Integrates Readme.org and Commentary/Change-logs." tar ((:url . "https://github.com/mlf176f2/org-readme") (:keywords "header2" "readme.org" "emacswiki" "git"))]) (org-protocol-jekyll . [(0 1) nil "Jekyll's handler for org-protocol" single nil]) (org-pomodoro . [(1 3 1) ((alert (0 5 10))) "Pomodoro implementation for org-mode." tar nil]) (org-page . [(0 41) ((ht (1 5)) (mustache (0 22)) (htmlize (1 47)) (org (8))) "a static site generator based on org mode" tar nil]) (org-outlook . [(0 11) nil "Outlook org" tar ((:url . "https://github.com/mlf176f2/org-outlook.el") (:keywords "org-outlook"))]) (org-magit . [(0 2 0) ((magit (0 8)) (org (6 1))) "basic support for magit links" single ((:keywords "git" "magit" "outlines"))]) (org-mac-iCal . [(7 9 3 5) nil "Imports events from iCal.app to the Emacs diary" single ((:keywords "outlines" "calendar"))]) (org-journal . [(1 5 2) nil "a simple org-mode based journaling mode" single ((:url . "http://github.com/bastibe/emacs-journal"))]) (org-elisp-help . [(0 1 0) ((cl-lib (0 2)) (org (8 0))) "org links to emacs-lisp documentation" single ((:url . "http://tarsius.github.com/org-elisp-help") (:keywords "org" "remember" "lisp"))]) (org-bullets . [(0 2 2) nil "Show bullets in org-mode as UTF-8 characters" single ((:url . "https://github.com/sabof/org-bullets"))]) (org-agenda-property . [(1 3 1) ((emacs (24 2))) "Display org properties in the agenda buffer." single ((:url . "http://github.com/Bruce-Connor/org-agenda-property") (:keywords "calendar"))]) (operate-on-number . [(1 1 0) nil "Operate on number at point with arithmetic functions" single ((:url . "https://github.com/knu/operate-on-number.el") (:keywords "editing"))]) (octomacs . [(0 0 1) nil "Octopress interface for Emacs" single ((:url . "http://technosorcery.net"))]) (object-registry . [(1 2 0) ((cl-lib (0 2))) "track data items by various instance slots" single ((:url . "https://github.com/tarsius/object-registry") (:keywords "data" "oo"))]) (ob-translate . [(0 1 2) ((google-translate (0 4)) (org (8))) "Translation of text blocks in org-mode." single ((:url . "https://github.com/krisajenkins/ob-translate") (:keywords "org" "babel" "translate" "translation"))]) (ob-sml . [(0 2) ((sml-mode (6 4))) "org-babel functions for template evaluation" single ((:url . "http://orgmode.org") (:keywords "literate programming" "reproducible research"))]) (o-blog . [(2 0) nil "" tar ((:keywords "emacs"))]) (nvm . [(0 0 3) ((s (1 8 0)) (dash (2 4 0)) (f (0 14 0))) "Manage Node versions within Emacs" single ((:url . "http://github.com/rejeep/nvm.el") (:keywords "node" "nvm"))]) (nsis-mode . [(0 44) nil "NSIS-mode" tar ((:url . "http://github.com/mlf176f2/nsis-mode") (:keywords "nsis"))]) (nrepl-sync . [(0 3 1) ((cider (0 6))) "connect to nrepl port and eval .sync.clj." single ((:url . "https://github.com/phillord/lein-sync"))]) (nrepl-ritz . [(0 6 0) ((nrepl (0 1 5))) "nrepl extensions for ritz" single ((:url . "https://github.com/pallet/ritz") (:keywords "languages" "lisp" "nrepl"))]) (notmuch . [(0 18 1) nil "No description available." tar nil]) (nose . [(0 1 1) nil "Easy Python test running in Emacs" single ((:keywords "nose" "python" "testing"))]) (nodejs-repl . [(0 0 2) nil "Run Node.js REPL" single nil]) (nix-mode . [(1 7) nil "No description available." single nil]) (ninja-mode . [(1 5 1) nil "Major mode for editing .ninja files" single nil]) (neotree . [(0 2) nil "A emacs tree plugin like NerdTree for Vim" single ((:url . "https://github.com/jaypei/emacs-neotree"))]) (nemerle . [(1 2) nil "major mode for editing nemerle programs" single ((:keywords "nemerle" "mode" "languages"))]) (ncl-mode . [(0 98) nil "No description available." tar nil]) (navorski . [(0 2 3) ((dash (1 5 0)) (multi-term (0 8 14))) "Helping you live in the terminal, like Viktor did." single ((:keywords "terminal"))]) (navi-mode . [(1 0) nil "No description available." single nil]) (nav-flash . [(1 1 0) nil "Briefly highlight the current line" single ((:url . "http://github.com/rolandwalker/nav-flash") (:keywords "extensions" "navigation" "interface"))]) (mykie . [(0 2 1) nil "Command multiplexer: Register multiple functions to a keybind" tar ((:url . "https://github.com/yuutayamada/mykie-el") (:keywords "emacs" "configuration" "keybind"))]) (multiple-cursors . [(1 3 0) nil "Multiple cursors for Emacs." tar nil]) (multi-web-mode . [(0 2 1) nil "multiple major mode support for web editing" tar ((:keywords "convenience" "languages" "wp"))]) (multi . [(2 0 1) ((emacs (24))) "Clojure-style multi-methods for emacs lisp" single ((:url . "http://github.com/kurisuwhyte/emacs-multi") (:keywords "multimethod" "generic" "predicate" "dispatch"))]) (moz . [(1 1 0) nil "Lets current buffer interact with inferior mozilla." single ((:url . "http://github.com/bard/mozrepl/raw/master/chrome/content/moz.el"))]) (move-dup . [(0 2 1) nil "Eclipse-like moving and duplicating lines or rectangles." single ((:keywords "convenience" "wp"))]) (morlock . [(0 4 0) nil "more font-lock keywords for elisp" single ((:url . "http://github.com/tarsius/morlock") (:keywords "convenience"))]) (mode-line-debug . [(1 2 1) nil "show status of `debug-on-error' in the mode-line" single ((:url . "https://github.com/tarsius/mode-line-debug") (:keywords "convenience" "lisp"))]) (mode-icons . [(0 1 0) nil "Show icons for modes" tar ((:url . "http://ryuslash.org/projects/mode-icons.html") (:keywords "multimedia"))]) (mocker . [(0 3 0) ((eieio (1 3)) (el-x (0 2 4))) "mocking framework for emacs" single ((:keywords "lisp" "testing"))]) (mmm-mode . [(0 5 1) nil "Allow Multiple Major Modes in a buffer" tar ((:url . "https://github.com/purcell/mmm-mode") (:keywords "convenience" "faces" "languages" "tools"))]) (mmm-mako . [(1 1) ((mmm-mode (0 4 8))) "MMM submode class for Mako Templates" single ((:url . "https://bitbucket.org/pjenvey/mmm-mako"))]) (minimal-session-saver . [(0 6 2) nil "Very lean session saver" single ((:url . "http://github.com/rolandwalker/minimal-session-saver") (:keywords "tools" "frames" "project"))]) (miniedit . [(2 0) nil "Enhanced editing for minibuffer fields." single nil]) (minibuffer-cua . [(1 0 0) nil "Make CUA mode's S-up/S-down work in minibuffer" single ((:url . "https://github.com/knu/minibuffer-cua.el") (:keywords "completion" "editing"))]) (minibuffer-complete-cycle . [(1 25 20130814) nil "Cycle through the *Completions* buffer" single ((:url . "https://github.com/knu/minibuffer-complete-cycle") (:keywords "completion"))]) (milkode . [(0 3) nil "Command line search and direct jump with Milkode" tar ((:keywords "milkode" "search" "grep" "jump" "keyword"))]) (migemo . [(1 9 1) nil "Japanese incremental search through dynamic pattern expansion" single ((:url . "https://github.com/emacs-jp/migemo"))]) (mew . [(6 6) nil "Messaging in the Emacs World" tar nil]) (merlin . [(1 6) nil "Mode for Merlin, an assistant for OCaml." single ((:url . "http://github.com/the-lambda-church/merlin") (:keywords "ocaml" "languages"))]) (mentor . [(0 1) nil "Control rtorrent from GNU Emacs" tar ((:keywords "bittorrent" "rtorrent"))]) (mc-extras . [(1 0 3) ((multiple-cursors (1 2 1))) "Extra functions for multiple-cursors mode." tar ((:url . "https://github.com/knu/mc-extras.el") (:keywords "editing" "cursors"))]) (maxframe . [(0 5) nil "No description available." single nil]) (marmalade . [(0 0 4) ((furl (0 0 2))) "Elisp interface for the Emacs Lisp package server." single ((:url . "http://code.google.com/p/marmalade"))]) (markdown-toc . [(0 0 6) ((s (1 7 0)) (dash (2 5 0)) (markdown-mode (2 0))) "A simple TOC generator for markdown file" tar nil]) (markdown-mode . [(2 0) nil "Emacs Major mode for Markdown-formatted text files" single ((:url . "http://jblevins.org/projects/markdown-mode/") (:keywords "markdown" "github flavored markdown" "itex"))]) (mark-tools . [(0 3) nil "Some simple tools to access the mark-ring in Emacs" single ((:url . "https://github.com/stsquad/emacs-mark-tools"))]) (map-regexp . [(0 3 0) ((cl-lib (0 2))) "map over matches of a regular expression" single ((:url . "https://github.com/tarsius/map-regexp") (:keywords "convenience"))]) (map-progress . [(0 5 0) nil "mapping macros that report progress" single ((:url . "https://github.com/tarsius/map-progress/") (:keywords "convenience"))]) (mallard-mode . [(0 3 0) nil "Major mode for editing Mallard files" tar ((:url . "https://github.com/jhradilek/emacs-mallard-mode") (:keywords "xml" "mallard"))]) (malinka . [(0 2 0) ((s (1 9 0)) (dash (2 4 0)) (f (0 11 0)) (cl-lib (0 3)) (rtags (0 0)) (projectile (0 11 0))) "A C/C++ project configuration package for Emacs" single ((:url . "https://github.com/LefterisJP/malinka") (:keywords "c" "c++" "project-management"))]) (malabar-mode . [(20140303 946) ((fringe-helper (1 0 1))) "A better Java mode for Emacs" tar ((:url . "http://www.github.com/m0smith/malabar-mode") (:keywords "java" "maven" "language" "malabar"))]) (makey . [(0 3) ((cl-lib (0 2))) "interactive commandline mode" single nil]) (make-color . [(0 4) nil "Alternative to picking color - update fg/bg color by pressing r/g/b/... keys" single ((:url . "http://github.com/alezost/make-color.el") (:keywords "color"))]) (magit-tramp . [(0 1 0) ((magit (1 2 0))) "git method for TRAMP" single ((:url . "https://github.com/sigma/magit-tramp"))]) (magit-topgit . [(90140807) ((cl-lib (0 3)) (magit (1 3 0))) "topgit plug-in for Magit" single ((:keywords "vc" "tools"))]) (magit-svn . [(90140807) ((cl-lib (0 3)) (magit (1 3 0))) "git-svn plug-in for Magit" single ((:keywords "vc" "tools"))]) (magit-stgit . [(90140807) ((cl-lib (0 3)) (magit (1 3 0))) "StGit plug-in for Magit" single ((:keywords "vc" "tools"))]) (magit-push-remote . [(0 5 0) ((magit (1 3 0))) "push remote support for Magit" single ((:url . "https://github.com/tarsius/magit-push-remote") (:keywords "convenience"))]) (magit-gitflow . [(1 0 0) ((magit (1 3 0))) "gitflow extension for magit" single ((:url . "https://github.com/jtatarik/magit-gitflow") (:keywords "vc" "tools"))]) (magit-gh-pulls . [(0 3) ((gh (0 4 3)) (magit (1 1 0))) "GitHub pull requests extension for Magit" single ((:keywords "tools"))]) (magit-find-file . [(1 0 8) ((magit (1 2 0))) "completing-read over all files in Git" single ((:url . "https://github.com/bradleywright/magit-find-file.el") (:keywords "git"))]) (magit-annex . [(0 10 0) ((cl-lib (0 3)) (magit (1 2 0))) "Use git annex within magit" single ((:url . "https://github.com/kyleam/magit-annex") (:keywords "magit" "git-annex"))]) (magit . [(90140807) ((cl-lib (0 3)) (git-commit-mode (0 14 0)) (git-rebase-mode (0 14 0))) "control Git from Emacs" tar ((:keywords "vc" "tools"))]) (macrostep . [(0 7) nil "interactive macro stepper for Emacs Lisp" single ((:url . "https://github.com/joddie/macrostep") (:keywords "lisp" "languages" "macro" "debugging"))]) (macro-math . [(1 0) nil "in-buffer mathematical operations" single ((:url . "http://nschum.de/src/emacs/macro-math/") (:keywords "convenience"))]) (m-buffer . [(0 4) ((dash (2 5 0)) (emacs (24 3))) "Buffer Manipulation Functions" single nil]) (lua-mode . [(20140514) nil "a major-mode for editing Lua scripts" single ((:url . "http://immerrr.github.com/lua-mode") (:keywords "languages" "processes" "tools"))]) (love-minor-mode . [(1 1) nil "Minor mode for working on LÖVE projects" single ((:url . "https://github.com/ejmr/love-minor-mode"))]) (logito . [(0 1) ((eieio (1 3))) "logging library for Emacs" single ((:keywords "lisp" "tool"))]) (logalimacs . [(1 0 0) nil "Front-end to logaling-command for Ruby gems" single ((:url . "https://github.com/logaling/logalimacs"))]) (log4j-mode . [(1 3) nil "major mode for viewing log files" single ((:keywords "log" "log4j" "java"))]) (literate-coffee-mode . [(0 2) ((coffee-mode (0 5 0))) "major-mode for Literate CoffeeScript" single ((:url . "https://github.com/syohex/emacs-literate-coffee-mode"))]) (list-utils . [(0 4 2) nil "List-manipulation utility functions" single ((:url . "http://github.com/rolandwalker/list-utils") (:keywords "extensions"))]) (lispyscript-mode . [(0 3 5) nil "Major mode for LispyScript code." single ((:url . "https://github.com/krisajenkins/lispyscript-mode") (:keywords "lisp" "languages"))]) (lispy . [(0 13 0) ((helm (1 5 3)) (ace-jump-mode (2 0)) (s (1 4 0)) (noflet (0 0 10)) (multiple-cursors (1 3 0)) (iedit (0 97))) "vi-like Paredit" tar nil]) (linum-relative . [(0 4) nil "display relative line number in emacs." single ((:url . "http://github.com/coldnew/linum-relative") (:keywords "converience"))]) (linked-buffer . [(0 3) nil "No description available." tar nil]) (link . [(1 10) nil "No description available." single nil]) (lingr . [(0 2) nil "Lingr Client for GNU Emacs" single ((:url . "http://github.com/lugecy/lingr-el") (:keywords "chat" "client" "internet"))]) (lfe-mode . [(0 8) nil "Lisp Flavoured Erlang mode" tar nil]) (less-css-mode . [(0 18) nil "Major mode for editing LESS CSS files (lesscss.org)" single ((:url . "https://github.com/purcell/less-css-mode") (:keywords "less" "css" "mode"))]) (ledger-mode . [(3 0 3) nil "Helper code for use with the \"ledger\" command-line tool" tar nil]) (latex-extra . [(1 7 5) ((auctex (11 86 1))) "Adds several useful functionalities to LaTeX-mode." single ((:url . "http://github.com/Bruce-Connor/latex-extra") (:keywords "tex"))]) (langtool . [(1 2 1) nil "Grammer check utility using LanguageTool" single ((:url . "https://github.com/mhayashi1120/Emacs-langtool/raw/master/langtool.el") (:keywords "docs"))]) (know-your-http-well . [(0 2 0) nil "Look up the meaning of HTTP headers, methods, relations, status codes" tar nil]) (kivy-mode . [(1 8 0) nil "Emacs major mode for editing Kivy files" single nil]) (killer . [(0 2 2) nil "kill and delete text" single ((:url . "http://github.com/tarsius/killer") (:keywords "convenience"))]) (kill-ring-search . [(1 1) nil "incremental search for the kill ring" single ((:url . "http://nschum.de/src/emacs/kill-ring-search/") (:keywords "convenience" "matching"))]) (keymap-utils . [(0 4 4) ((cl-lib (0 2))) "Keymap utilities" tar nil]) (keydef . [(1 15) nil "a simpler way to define keys, with kbd syntax" single ((:keywords "convenience" "lisp" "customization" "keyboard" "keys"))]) (keychain-environment . [(2 0 1) nil "load keychain environment variables" single ((:url . "https://github.com/tarsius/keychain-environment") (:keywords "gnupg" "pgp" "ssh"))]) (key-combo . [(1 2) nil "map key sequence to commands" tar ((:url . "https://github.com/uk-ar/key-combo") (:keywords "keyboard" "input"))]) (jump-to-line . [(0 2 0) nil "Jump to line number at point." single ((:keywords "jump" "line" "back" "file" "ruby" "csharp" "python" "perl"))]) (jump . [(2 3) ((findr (0 7)) (inflections (1 1))) "build functions which contextually jump between files" single ((:url . "http://github.com/eschulte/jump.el/tree/master") (:keywords "project" "convenience" "navigation"))]) (jsx-mode . [(0 1 10) nil "major mode for JSX" single ((:url . "https://github.com/jsx/jsx-mode.el"))]) (json-mode . [(1 1 0) nil "Major mode for editing JSON files" single ((:url . "https://github.com/joshwnj/json-mode"))]) (js3-mode . [(1 1 0) nil "An improved JavaScript editing mode" tar ((:keywords "javascript" "languages"))]) (js2-refactor . [(0 6 1) ((js2-mode (20101228)) (multiple-cursors (1 0 0)) (dash (1 0 0)) (s (1 0 0)) (yasnippet (20130218))) "A JavaScript refactoring library for emacs." tar nil]) (js2-mode . [(20140114) ((emacs (24 1))) "Improved JavaScript editing mode" tar ((:url . "https://github.com/mooz/js2-mode/") (:keywords "languages" "javascript"))]) (jedi . [(0 1 2) ((epc (0 1 0)) (auto-complete (1 4))) "Python auto-completion for Emacs" tar nil]) (jabber . [(0 8 92) nil "A Jabber client for Emacs." tar nil]) (j-mode . [(1 1 1) nil "Major mode for editing J programs" tar ((:url . "http://github.com/zellio/j-mode") (:keywords "j" "langauges"))]) (ix . [(0 7) ((grapnel (0 5 3))) "Emacs client for http://ix.io pastebin" single ((:url . "http://www.github.com/theanalyst/ix.el"))]) (irony . [(0 1 0) ((cl-lib (0 5))) "C/C++ minor mode powered by libclang" tar ((:url . "https://github.com/Sarcasm/irony-mode") (:keywords "c" "convenience" "tools"))]) (ir-black-theme . [(1 0 1) nil "Port of ir-black theme" single ((:keywords "faces"))]) (instapaper . [(0 9 5) nil "No description available." single nil]) (insert-shebang . [(0 9 3) nil "Insert shebang line automatically." single ((:url . "http://github.com/psachin/insert-shebang") (:keywords "shebang" "tool" "convenience"))]) (inline-crypt . [(0 1 4) nil "Simple inline encryption via openssl" tar nil]) (initsplit . [(1 6) nil "No description available." single nil]) (inflections . [(2 3) nil "convert english words between singular and plural" single ((:url . "https://github.com/eschulte/jump.el") (:keywords "ruby" "rails" "languages" "oop"))]) (inf-ruby . [(2 2 4) nil "Run a ruby process in a buffer" single ((:url . "http://github.com/nonsequitur/inf-ruby") (:keywords "languages" "ruby"))]) (import-popwin . [(0 8) ((popwin (0 6)) (cl-lib (0 5))) "popwin buffer near by import statements with popwin" single ((:url . "https://github.com/syohex/emacs-import-popwin"))]) (immutant-server . [(1 2 0) nil "Run your Immutant server in Emacs" single ((:url . "http://www.github.com/leathekd/immutant-server.el"))]) (ignoramus . [(0 7 0) nil "Ignore backups, build files, et al." single ((:url . "http://github.com/rolandwalker/ignoramus") (:keywords "convenience" "tools"))]) (iflipb . [(1 2) nil "interactively flip between recently visited buffers" single ((:url . "http://hg.rosdahl.net/iflipb"))]) (idris-mode . [(0 9 14) ((emacs (24))) "Major mode for editing Idris code" tar ((:url . "https://github.com/idris-hackers/idris-mode") (:keywords "languages"))]) (ido-ubiquitous . [(2 13) ((emacs (24 1))) "Use ido (nearly) everywhere." single ((:url . "https://github.com/DarwinAwardWinner/ido-ubiquitous") (:keywords "convenience"))]) (ido-load-library . [(0 2 0) ((persistent-soft (0 8 8)) (pcache (0 2 3))) "Load-library alternative using ido-completing-read" single ((:url . "http://github.com/rolandwalker/ido-load-library") (:keywords "maint" "completion"))]) (ido-complete-space-or-hyphen . [(1 1) nil "No description available." single nil]) (idle-highlight-mode . [(1 1 3) nil "highlight the word the point is on" single ((:url . "http://www.emacswiki.org/cgi-bin/wiki/IdleHighlight") (:keywords "convenience"))]) (identica-mode . [(1 3 1) nil "Major mode API client for status.net open microblogging" tar ((:url . "http://blog.gabrielsaldana.org/identica-mode-for-emacs/") (:keywords "identica" "web"))]) (ibuffer-vc . [(0 7) ((cl-lib (0 2))) "Group ibuffer's list by VC project, or show VC status" single ((:url . "http://github.com/purcell/ibuffer-vc") (:keywords "themes"))]) (hyde . [(0 2) nil "No description available." tar nil]) (httprepl . [(1 1) ((s (1 9 0)) (dash (2 5 0)) (emacs (24))) "An HTTP REPL" single ((:url . "https://github.com/gregsexton/httprepl.el") (:keywords "http" "repl"))]) (httpcode . [(0 1) nil "explains the meaning of an HTTP status code" single ((:url . "http://github.com/rspivak/httpcode.el"))]) (hl-todo . [(1 3 1) nil "highlight TODO keywords" single ((:url . "http://github.com/tarsius/hl-todo") (:keywords "convenience"))]) (hl-sexp . [(1 0 0) nil "highlight the current sexp" single ((:keywords "faces" "frames" "emulation"))]) (hl-sentence . [(3) nil "highlight a sentence based on customizable face" single ((:url . "http://github.com/milkypostman/hl-sentence") (:keywords "highlighting"))]) (historyf . [(0 0 8) nil "file history library like browser" single ((:url . "https://github.com/k1LoW/emacs-historyf"))]) (hippie-namespace . [(0 5 8) nil "Special treatment for namespace prefixes in hippie-expand" single ((:url . "http://github.com/rolandwalker/hippie-namespace") (:keywords "convenience" "lisp" "tools" "completion"))]) (hippie-expand-slime . [(0 1) nil "Hook slime's completion into hippie-expand" single ((:url . "https://github.com/purcell/hippie-expand-slime"))]) (highlight-symbol . [(1 2) nil "automatic and manual symbol highlighting" single ((:url . "http://nschum.de/src/emacs/highlight-symbol/") (:keywords "faces" "matching"))]) (highlight-parentheses . [(1 0 2) nil "highlight surrounding parentheses" single ((:url . "http://nschum.de/src/emacs/highlight-parentheses/") (:keywords "faces" "matching"))]) (highlight-numbers . [(0 2) ((emacs (24)) (parent-mode (2 0))) "Highlight numbers in source code" single ((:url . "https://github.com/Fanael/highlight-numbers"))]) (highlight-defined . [(0 1 5) ((emacs (24))) "Syntax highlighting of known Elisp symbols" single ((:url . "https://github.com/Fanael/highlight-defined"))]) (highlight-blocks . [(0 1 4) ((emacs (24))) "Highlight the blocks point is in" single ((:url . "https://github.com/Fanael/highlight-blocks"))]) (helm-themes . [(0 3) ((helm (1 0))) "Color theme selection with helm interface" single ((:url . "https://github.com/syohex/emacs-helm-themes"))]) (helm-spaces . [(0 2) ((helm (1 0)) (spaces (0 1 0))) "helm sources for spaces" single ((:url . "https://github.com/yasuyk/helm-spaces") (:keywords "helm" "frames" "convenience"))]) (helm-robe . [(0 1) ((helm (1 0))) "completing read function for robe" single ((:url . "https://github.com/syohex/emacs-helm-robe"))]) (helm-pydoc . [(0 6) ((helm (1 0)) (cl-lib (0 5))) "pydoc with helm interface" tar ((:url . "https://github.com/syohex/emacs-helm-pydoc"))]) (helm-projectile . [(0 11 0) ((helm (1 4 0)) (projectile (0 11 0)) (cl-lib (0 3))) "Helm integration for Projectile" single ((:url . "https://github.com/bbatsov/projectile") (:keywords "project" "convenience"))]) (helm-proc . [(0 0 4) ((helm (1 6 0))) "Helm interface for managing system processes" tar nil]) (helm-perldoc . [(0 7) ((helm (1 0)) (deferred (0 3 1)) (cl-lib (0 5))) "perldoc with helm interface" tar ((:url . "https://github.com/syohex/emacs-helm-perldoc"))]) (helm-package . [(0 2) ((helm (1 0)) (cl-lib (0 3))) "Listing ELPA packages with helm interface" single ((:url . "https://github.com/syohex/emacs-helm-package"))]) (helm-open-github . [(0 11) ((helm (1 0)) (gh (1 0)) (cl-lib (0 5))) "Utilities of Opening Github Page" single ((:url . "https://github.com/syohex/emacs-helm-open-github"))]) (helm-hayoo . [(0 0 5) ((helm (1 6 0)) (json (1 2)) (haskell-mode (13 7))) "Source and configured helm for searching hayoo" single ((:keywords "helm"))]) (helm-gtags . [(1 2 8) ((helm (1 5 6)) (cl-lib (0 5))) "GNU GLOBAL helm interface" single ((:url . "https://github.com/syohex/emacs-helm-gtags"))]) (helm-github-stars . [(1 1 1) ((helm (1 5 5))) "Helm integration for your starred repositories on github" single ((:keywords "helm" "github" "stars"))]) (helm-ghq . [(1 2 0) ((helm (1 6 2))) "ghq with helm interface" single ((:url . "https://github.com/masutaka/emacs-helm-ghq"))]) (helm-descbinds . [(1 7 1) nil "Yet Another `describe-bindings' with `helm'." single ((:keywords "helm" "help"))]) (helm-dash . [(1 0 0) ((helm (0 0 0))) "Helm extension to search dash docsets" single ((:keywords "docs"))]) (helm-backup . [(0 2 0) ((helm (1 5 5)) (s (1 8 0))) "Backup each file change using git" single ((:url . "http://github.com/antham/helm-backup") (:keywords "backup"))]) (helm-ag . [(0 25) ((helm (1 5 6)) (cl-lib (0 5))) "the silver searcher with helm interface" single ((:url . "https://github.com/syohex/emacs-helm-ag"))]) (helm-ack . [(0 12) ((helm (1 0)) (cl-lib (0 5))) "Ack command with helm interface" single ((:url . "https://github.com/syohex/emacs-helm-ack"))]) (helm . [(1 6 3) nil "Helm is an Emacs incremental and narrowing framework" tar nil]) (header-button . [(0 3 0) nil "clickable buttons in header lines" single ((:url . "https://github.com/emacsattic/header-button") (:keywords "extensions"))]) (haskell-mode . [(13 10) nil "A Haskell editing mode" tar nil]) (hardhat . [(0 4 4) ((ignoramus (0 7 0))) "Protect against clobbering user-writable files" single ((:url . "http://github.com/rolandwalker/hardhat") (:keywords "convenience"))]) (haml-mode . [(3 1 5) ((ruby-mode (1 0))) "Major mode for editing Haml files" single ((:url . "http://github.com/nex3/haml/tree/master") (:keywords "markup" "language" "html"))]) (ham-mode . [(1 1 1) ((html-to-markdown (1 2)) (markdown-mode (2 0))) "Html As Markdown. Transparently edit an html file using markdown." single ((:url . "http://github.com/Bruce-Connor/ham-mode") (:keywords "convenience" "emulation" "wp"))]) (hackernews . [(0 2) ((json (1 2))) "Access the hackernews aggregator from Emacs" tar nil]) (guru-mode . [(0 2) nil "Become an Emacs guru" single ((:url . "https://github.com/bbatsov/guru-mode") (:keywords "convenience"))]) (gruber-darker-theme . [(0 6) nil "Gruber Darker color theme for Emacs 24." single ((:url . "http://github.com/rexim/gruber-darker-theme"))]) (groovy-mode . [(201311291207.0) nil "Groovy mode derived mode" tar nil]) (grizzl . [(0 1 1) nil "Fuzzy Search Library & Completing Read" tar nil]) (grin . [(1 0) nil "run grin and grind (python replacements for grep and find) putting hits in a grep buffer" single ((:url . "http://bitbucket.org/dariusp686/emacs-grin") (:keywords "python" "grin" "grind" "grep" "find"))]) (grass-mode . [(0 1) ((cl-lib (0 2))) "Provides Emacs modes for interacting with the GRASS GIS program" single ((:keywords "grass" "gis"))]) (grapnel . [(0 5 3) nil "HTTP request lib with flexible callback dispatch" single ((:url . "http://www.github.com/leathekd/grapnel"))]) (graphene . [(1 0) ((auto-complete (20130330)) (smartparens (20130329)) (multi-web-mode (20130205)) (smex (20120915)) (sr-speedbar (20130309)) (project-persist (20130309)) (exec-path-from-shell (20121108))) "A set of defaults targeted at GUI text editor diaspora." tar nil]) (gradle-mode . [(0 5 4) ((s (1 8 0))) "Gradle integration with Emacs' compile" single ((:url . "http://github.com/jacobono/emacs-gradle-mode") (:keywords "gradle"))]) (goto-gem . [(1 2) ((s (1 9 0))) "Open dired in gem directory" single ((:keywords "gemfile" "convenience"))]) (google-translate . [(0 9 2) nil "Emacs interface to Google Translate." tar nil]) (google-this . [(1 8) nil "A set of functions and bindings to google under point." single ((:url . "http://github.com/Bruce-Connor/emacs-google-this") (:keywords "convenience" "hypermedia"))]) (golden-ratio . [(0 0 4) nil "Automatic resizing of Emacs windows to the golden ratio" single ((:keywords "window" "resizing"))]) (go-eldoc . [(0 17) ((go-mode (0)) (cl-lib (0 5))) "eldoc for go-mode" single ((:url . "https://github.com/syohex/emacs-go-eldoc"))]) (go-direx . [(0 3) ((direx (0 1 -3)) (cl-lib (0 5))) "Tree style source code viewer for Go language" single ((:url . "https://github.com/syohex/emacs-go-direx"))]) (gnus-desktop-notify . [(1 4) ((gnus (1 0))) "Gnus Desktop Notification global minor mode" single ((:url . "http://www.thregr.org/~wavexx/hacks/gnus-desktop-notify/"))]) (gnuplot . [(0 6 1) nil "No description available." tar nil]) (gmail-message-mode . [(1 3 1) ((ham-mode (1 0))) "A major-mode for editing gmail messages using markdown syntax." single ((:url . "http://github.com/Bruce-Connor/gmail-message-mode") (:keywords "mail" "convenience" "emulation"))]) (gitignore-mode . [(0 15 0) nil "Major mode for editing .gitignore files" single ((:url . "https://github.com/magit/git-modes") (:keywords "convenience" "vc" "git"))]) (gitconfig-mode . [(0 15 0) nil "Major mode for editing .gitconfig files" single ((:url . "https://github.com/magit/git-modes") (:keywords "convenience" "vc" "git"))]) (gitconfig . [(1 0 0) nil "Emacs lisp interface to work with git-config variables" single ((:keywords "git" "gitconfig" "git-config"))]) (gitattributes-mode . [(0 15 0) nil "Major mode for editing .gitattributes files" single ((:url . "https://github.com/magit/git-modes") (:keywords "convenience" "vc" "git"))]) (git-timemachine . [(1 5) ((cl-lib (0 5))) "Walk through git revisions of a file" single ((:url . "https://github.com/pidu/git-timemachine") (:keywords "git"))]) (git-rebase-mode . [(0 15 0) nil "Major mode for editing git rebase files" single ((:url . "https://github.com/magit/git-modes") (:keywords "convenience" "vc" "git"))]) (git-messenger . [(0 13) ((popup (0 5 0))) "Pop up last commit information of current line" single ((:url . "https://github.com/syohex/emacs-git-messenger"))]) (git-link . [(0 0 2) nil "Get the GitHub/Bitbucket/Gitorious URL for a buffer location" single ((:url . "http://github.com/sshaw/git-link"))]) (git-gutter-fringe . [(0 20) ((git-gutter (0 71)) (fringe-helper (0 1 1)) (cl-lib (0 5)) (emacs (24))) "Fringe version of git-gutter.el" single ((:url . "https://github.com/syohex/emacs-git-gutter-fringe"))]) (git-gutter-fringe+ . [(0 1) ((git-gutter+ (0 1)) (fringe-helper (20130519 1641))) "Fringe version of git-gutter+.el" single ((:url . "https://github.com/nonsequitur/git-gutter-fringe-plus"))]) (git-gutter . [(0 72) ((cl-lib (0 5)) (emacs (24))) "Port of Sublime Text plugin GitGutter" single ((:url . "https://github.com/syohex/emacs-git-gutter"))]) (git-gutter+ . [(0 2) nil "Manage Git hunks straight from the buffer" single ((:url . "https://github.com/nonsequitur/git-gutter-plus"))]) (git-commit-mode . [(0 15 0) nil "Major mode for editing git commit messages" single ((:url . "https://github.com/magit/git-modes") (:keywords "convenience" "vc" "git"))]) (git-auto-commit-mode . [(4 2 2) nil "Emacs Minor mode to automatically commit and push" single ((:url . "http://ryuslash.org/projects/git-auto-commit-mode/") (:keywords "vc"))]) (git . [(0 1 1) ((s (1 7 0)) (dash (2 2 0)) (f (0 10 0))) "An Elisp API for programmatically using Git" single ((:url . "http://github.com/rejeep/git.el") (:keywords "git"))]) (gist . [(1 1 0) ((eieio (1 3)) (gh (0 7 0)) (tabulated-list (0))) "Emacs integration for gist.github.com" single ((:keywords "gist" "git" "github" "paste" "pastie" "pastebin"))]) (ghc . [(4 1 6) nil "Sub mode for Haskell mode" tar nil]) (gh . [(0 8 0) ((eieio (1 3)) (pcache (0 2 4)) (logito (0 1))) "A GitHub library for Emacs" tar nil]) (ggtags . [(0 8 5) ((emacs (24)) (cl-lib (0 5))) "emacs frontend to GNU Global source code tagging system" single ((:url . "https://github.com/leoliu/ggtags") (:keywords "tools" "convenience"))]) (ggo-mode . [(20130521) nil "Gengetopt major mode" single ((:keywords "extensions" "convenience" "local"))]) (geiser . [(0 5) nil "GNU Emacs and Scheme talk to each other" tar nil]) (gather . [(1 0 5) nil "Gather string in buffer." single ((:url . "https://github.com/mhayashi1120/Emacs-gather/raw/master/gather.el") (:keywords "matching" "convenience" "tools"))]) (fwb-cmds . [(0 4 0) nil "misc frame, window and buffer commands" single ((:url . "http://github.com/tarsius/fwb-cmds") (:keywords "convenience"))]) (fvwm-mode . [(1 6 4) nil "major mode for editing Fvwm configuration files" single ((:keywords "files"))]) (fuzzy . [(0 1) nil "Fuzzy Matching" single ((:keywords "convenience"))]) (full-ack . [(1 0) nil "a front-end for ack" single ((:url . "http://nschum.de/src/emacs/full-ack/") (:keywords "tools" "matching"))]) (fuel . [(0 96) nil "No description available." tar nil]) (fringe-helper . [(1 0 1) nil "helper functions for fringe bitmaps" single ((:url . "http://nschum.de/src/emacs/fringe-helper/") (:keywords "lisp"))]) (frame-restore . [(0 5) ((emacs (24 1))) "Restore Emacs frame" single ((:url . "https://github.com/lunaryorn/frame-restore.el") (:keywords "frames" "convenience"))]) (fountain-mode . [(1 3 2) ((s (1 9 0))) "Major mode for screenwriting in Fountain markup" single ((:url . "https://github.com/rnkn/fountain-mode/") (:keywords "wp"))]) (font-utils . [(0 7 2) ((persistent-soft (0 8 8)) (pcache (0 2 3))) "Utility functions for working with fonts" single ((:url . "http://github.com/rolandwalker/font-utils") (:keywords "extensions"))]) (fold-this . [(0 2 0) nil "Just fold this region please" single ((:keywords "convenience"))]) (fold-dwim-org . [(0 6) ((fold-dwim (1 2))) "Fold DWIM bound to org key-strokes." single ((:url . "https://github.com/mlf176f2/fold-dwim-org") (:keywords "folding" "emacs" "org-mode"))]) (fold-dwim . [(1 2) nil "No description available." single nil]) (fm . [(1 0) nil "follow mode for compilation/output buffers" single ((:keywords "outlines"))]) (flyspell-lazy . [(0 6 6) nil "Improve flyspell responsiveness using idle timers" single ((:url . "http://github.com/rolandwalker/flyspell-lazy") (:keywords "spelling"))]) (flymake-shell . [(0 8) ((flymake-easy (0 1))) "A flymake syntax-checker for shell scripts" single ((:url . "https://github.com/purcell/flymake-shell"))]) (flymake-sass . [(0 6) ((flymake-easy (0 1))) "Flymake handler for sass files" single ((:url . "https://github.com/purcell/flymake-sass"))]) (flymake-ruby . [(0 8) ((flymake-easy (0 1))) "A flymake handler for ruby-mode files" single ((:url . "https://github.com/purcell/flymake-ruby"))]) (flymake-python-pyflakes . [(0 9) ((flymake-easy (0 8))) "A flymake handler for python-mode files using pyflakes (or flake8)" single ((:url . "https://github.com/purcell/flymake-python-pyflakes"))]) (flymake-php . [(0 5) ((flymake-easy (0 1))) "A flymake handler for php-mode files" single ((:url . "https://github.com/purcell/flymake-php"))]) (flymake-perlcritic . [(1 0 3) ((flymake (0 3))) "Flymake handler for Perl to invoke Perl::Critic" tar ((:url . "https://github.com/illusori/emacs-flymake-perlcritic"))]) (flymake-json . [(0 1) ((flymake-easy (0 1))) "A flymake handler for json using jsonlint" single ((:url . "https://github.com/purcell/flymake-json"))]) (flymake-jslint . [(0 23) nil "Flymake support for javascript using jslint" single ((:url . "https://github.com/purcell/flymake-jslint"))]) (flymake-hlint . [(0 2) ((flymake-easy (0 1))) "A flymake handler for haskell-mode files using hlint" single ((:url . "https://github.com/purcell/flymake-hlint"))]) (flymake-haskell-multi . [(0 3) ((flymake-easy (0 1))) "Syntax-check haskell-mode using both ghc and hlint" tar nil]) (flymake-haml . [(0 8) ((flymake-easy (0 1))) "A flymake handler for haml files" single ((:url . "https://github.com/purcell/flymake-haml"))]) (flymake-gjshint . [(0 0 6) nil "A flymake handler for javascript using both jshint and gjslint" single ((:keywords "flymake" "javascript" "jshint" "gjslint"))]) (flymake-easy . [(0 9) nil "Helpers for easily building flymake checkers" single ((:url . "https://github.com/purcell/flymake-easy") (:keywords "convenience" "internal"))]) (flymake-css . [(0 3) ((flymake-easy (0 1))) "Flymake support for css using csslint" single ((:url . "https://github.com/purcell/flymake-css"))]) (flymake-coffee . [(0 12) ((flymake-easy (0 1))) "A flymake handler for coffee script" single ((:url . "https://github.com/purcell/flymake-coffee"))]) (flycheck-ledger . [(0 4) ((flycheck (0 15))) "Flycheck integration for ledger files" single ((:keywords "convenience" "languages" "tools"))]) (flycheck-hdevtools . [(0 3) ((flycheck (0 15))) "A flycheck checker for Haskell using hdevtools" single ((:url . "https://github.com/flycheck/flycheck-hdevtools") (:keywords "convenience" "languages" "tools"))]) (flycheck-haskell . [(0 4) ((flycheck (0 16)) (haskell-mode (13 7)) (dash (2 4 0)) (f (0 11 0))) "Flycheck: Cabal projects and sandboxes" single ((:url . "https://github.com/flycheck/flycheck-haskell") (:keywords "tools" "convenience"))]) (flycheck-dmd-dub . [(0 4) nil "Sets flycheck-dmd-include-paths from dub package information" single ((:url . "http://github.com/atilaneves/flycheck-dmd-dub") (:keywords "languages"))]) (flycheck-color-mode-line . [(0 2) ((flycheck (0 13)) (dash (1 2)) (emacs (24 1))) "Change mode line color with Flycheck status" single ((:keywords "convenience" "language" "tools"))]) (flycheck-cask . [(0 1) ((flycheck (0 14)) (dash (2 0 0)) (f (0 6 0))) "Cask support in Flycheck" single ((:url . "https://github.com/flycheck/flycheck-cask") (:keywords "tools" "convenience"))]) (flycheck . [(0 19) ((s (1 9 0)) (dash (2 4 0)) (f (0 11 0)) (pkg-info (0 4)) (cl-lib (0 3)) (emacs (24 1))) "Modern on-the-fly syntax checking for GNU Emacs" tar ((:url . "https://flycheck.readthedocs.org") (:keywords "convenience" "languages" "tools"))]) (flx-ido . [(0 5) ((flx (0 1)) (cl-lib (0 3))) "flx integration for ido" single ((:url . "https://github.com/lewang/flx"))]) (flx . [(0 5) ((cl-lib (0 3))) "fuzzy matching with good sorting" single ((:url . "https://github.com/lewang/flx"))]) (floobits . [(1 5 8) ((json (1 2)) (highlight (0))) "Floobits plugin for real-time collaborative editing" tar ((:url . "http://github.com/Floobits/floobits-emacs") (:keywords "comm" "tools"))]) (fixmee . [(0 8 4) ((button-lock (1 0 0)) (nav-flash (1 0 0)) (back-button (0 6 0)) (smartrep (0 0 3)) (string-utils (0 3 2)) (tabulated-list (0))) "Quickly navigate to FIXME notices in code" single ((:url . "http://github.com/rolandwalker/fixmee") (:keywords "navigation" "convenience"))]) (fiplr . [(0 2 4) ((grizzl (0 1 0))) "Fuzzy Search for Files in Projects" tar nil]) (find-file-in-repository . [(1 2) nil "Quickly find files in a git, mercurial or other repository" single ((:url . "https://github.com/hoffstaetter/find-file-in-repository") (:keywords "files" "convenience" "repository" "project" "source control"))]) (find-file-in-project . [(3 3) nil "Find files in a project quickly." single ((:url . "http://www.emacswiki.org/cgi-bin/wiki/FindFileInProject") (:keywords "project" "convenience"))]) (finalize . [(1 0 0) ((emacs (24 1)) (cl-lib (0 3)) (eieio (1 4))) "finalizers for Emacs Lisp" tar nil]) (fill-column-indicator . [(1 81) nil "Graphically indicate the fill column" tar ((:keywords "convenience"))]) (fastnav . [(1 0 7) nil "Fast navigation and editing routines." single ((:keywords "nav" "fast" "fastnav" "navigation"))]) (fasm-mode . [(0 1 9) nil "Fasm major mode" single ((:url . "https://github.com/Fanael/fasm-mode"))]) (fancy-narrow . [(0 9 4) nil "narrow-to-region with more eye candy." single ((:url . "http://github.com/Bruce-Connor/fancy-narrow-region") (:keywords "faces" "convenience"))]) (fancy-battery . [(0 2) ((emacs (24 1))) "Fancy battery display" single ((:url . "https://github.com/lunaryorn/fancy-battery.el") (:keywords "convenience" "tools" "hardware"))]) (factlog . [(0 0 1) nil "File activity logger" single nil]) (fabric . [(0 1 0) nil "Launch Fabric using Emacs" tar ((:url . "https://github.com/nlamirault/fabric.el") (:keywords "python" "fabric"))]) (f . [(0 16 2) ((s (1 7 0)) (dash (2 2 0))) "Modern API for working with files and directories" single ((:url . "http://github.com/rejeep/f.el") (:keywords "files" "directories"))]) (eyebrowse . [(0 2 1) ((dash (2 4 0)) (s (1 4 0)) (emacs (24))) "Easy window config switching" single ((:url . "https://github.com/wasamasa/eyebrowse") (:keywords "convenience"))]) (extend-dnd . [(0 5) nil "R drag and Drop" tar ((:url . "https://github.com/mlf176f2/extend-dnd") (:keywords "extend" "drag and drop"))]) (express . [(0 6 0) ((string-utils (0 3 2))) "Alternatives to `message'" single ((:url . "http://github.com/rolandwalker/express") (:keywords "extensions" "message" "interface"))]) (expand-region . [(0 10 0) nil "Increase selected region by semantic units." tar nil]) (exec-path-from-shell . [(1 8) nil "Get environment variables such as $PATH from the shell" single ((:url . "https://github.com/purcell/exec-path-from-shell") (:keywords "environment"))]) (eww-lnum . [(1 0) nil "Operations using link numbers" single ((:url . "https://github.com/m00natic/eww-lnum") (:keywords "eww" "browse" "conkeror"))]) (evm . [(0 4 1) ((dash (2 3 0)) (f (0 13 0))) "Emacs Version Manager" single ((:url . "http://github.com/rejeep/evm"))]) (evil-visualstar . [(0 0 1) ((evil (0))) "Starts a * or # search from the visual selection" single ((:url . "https://github.com/bling/evil-visualstar") (:keywords "evil" "vim" "visualstar"))]) (evil-space . [(0 0 2) ((evil (1 0 0))) "Repeat motion in Evil. Correct the behaviour of what SPC should do." single ((:url . "http://github.com/linktohack/evil-space") (:keywords "space" "repeat" "motion"))]) (evil-numbers . [(0 4) nil "increment/decrement numbers like in vim" single ((:url . "http://github.com/cofi/evil-numbers") (:keywords "numbers" "increment" "decrement" "octal" "hex" "binary"))]) (evil-nerd-commenter . [(1 5 2) nil "Comment/uncomment lines efficiently. Like Nerd Commenter in Vim" tar nil]) (evil-matchit . [(1 3 2) nil "Vim matchit ported into Emacs (requires EVIL)" tar nil]) (evil-leader . [(0 4 2) ((evil (0))) "let there be " single ((:url . "http://github.com/cofi/evil-leader") (:keywords "evil" "vim-emulation" "leader"))]) (evil-jumper . [(0 0 1) ((evil (0))) "Jump like vimmers do!" single ((:url . "https://github.com/bling/evil-jumper") (:keywords "evil" "vim" "jumplist" "jump" "list"))]) (evil-args . [(1 0) ((evil (1 0 8))) "Motions and text objects for delimited arguments in Evil." single ((:url . "http://github.com/wcsmith/evil-args") (:keywords "evil" "vim-emulation"))]) (evil . [(1 0 9) ((undo-tree (0 6 3)) (goto-last-change (1 2))) "Extensible Vi layer for Emacs." tar nil]) (eval-sexp-fu . [(0 4 0) nil "Tiny functionality enhancements for evaluating sexps." single ((:keywords "lisp" "highlight" "convenience"))]) (esup . [(0 4) nil "the Emacs StartUp Profiler (ESUP)" single ((:url . "http://github.com/jschaf/esup") (:keywords "emacs-lisp" "elisp" "profile" "startup"))]) (ess-smart-underscore . [(0 79) nil "Ess Smart Underscore" tar ((:url . "http://github.com/mlf176f2/ess-smart-underscore.el") (:keywords "ess" "underscore"))]) (ess . [(13 9) nil "No description available." tar nil]) (espuds . [(0 2 6) ((s (1 7 0)) (dash (2 2 0)) (noflet (0 0 10)) (f (0 12 1))) "Ecukes step definitions" single ((:url . "http://github.com/ecukes/espuds") (:keywords "test"))]) (es-windows . [(0 3) ((cl-lib (0 3)) (emacs (24))) "Window-management utilities" single ((:url . "https://github.com/sabof/es-windows"))]) (es-mode . [(3 0 0) nil "A major mode for editing Elasticsearch queries" tar ((:url . "http://www.github.com/dakrone/es-mode") (:keywords "elasticsearch"))]) (ert-runner . [(0 6 3) ((s (1 6 1)) (dash (1 8 0)) (f (0 10 0)) (commander (0 2 0)) (ansi (0 1 0)) (shut-up (0 1 0))) "Opinionated Ert testing workflow" tar ((:url . "http://github.com/rejeep/ert-runner.el") (:keywords "test"))]) (ert-async . [(0 1 0) nil "Async support for ERT" single ((:url . "http://github.com/rejeep/ert-async.el") (:keywords "test"))]) (ergoemacs-mode . [(5 14 7 3) ((emacs (24 1)) (undo-tree (0 6 5))) "Emacs mode based on common modern interface and ergonomics." tar ((:url . "https://github.com/ergoemacs/ergoemacs-mode") (:keywords "convenience"))]) (ercn . [(1 0 2) nil "Flexible ERC notifications" single ((:url . "http://www.github.com/leathekd/ercn"))]) (erc-hl-nicks . [(1 3 0) nil "ERC nick highlighter that ignores uniquifying chars when colorizing" single ((:url . "http://www.github.com/leathekd/erc-hl-nicks"))]) (erc-crypt . [(1 0) nil "Symmetric Encryption for ERC" single ((:keywords "application"))]) (epl . [(0 7) ((cl-lib (0 3))) "Emacs Package Library" single ((:url . "http://github.com/cask/epl") (:keywords "convenience"))]) (epc . [(0 1 0) ((concurrent (0 3 1)) (ctable (0 1 0))) "A RPC stack for the Emacs Lisp" tar ((:url . "https://github.com/kiwanami/emacs-epc") (:keywords "lisp" "rpc"))]) (enotify . [(0 1 3) nil "No description available." tar nil]) (emmet-mode . [(1 0 8) nil "Unofficial Emmet's support for emacs" single ((:url . "https://github.com/smihica/emmet-mode") (:keywords "convenience"))]) (emamux . [(0 12) ((cl-lib (0 5))) "Interact with tmux" single ((:url . "https://github.com/syohex/emacs-emamux"))]) (emacsql . [(1 0 2) ((emacs (24 3)) (cl-lib (0 3)) (finalize (1 0 0))) "high-level SQL database front-end" tar ((:url . "https://github.com/skeeto/emacsql"))]) (emacsc . [(1 2 20131027) nil "helper for emacsc(1)" tar ((:url . "https://github.com/knu/emacsc") (:keywords "tools"))]) (emacs-setup . [(1 0) nil "Package for maintaining your emacs configuration. Clean up your .emacs!" tar nil]) (emacs-eclim . [(0 2) nil "No description available." tar nil]) (elx . [(0 9 6) ((emacs (24 3 50))) "extract information from Emacs Lisp libraries" single ((:url . "https://github.com/tarsius/elx") (:keywords "docs" "libraries" "packages"))]) (elpy . [(1 5 0) ((company (0 8 2)) (find-file-in-project (3 3)) (highlight-indentation (0 5 0)) (idomenu (0 1)) (pyvenv (1 3)) (yasnippet (0 8 0))) "Emacs Python Development Environment" tar nil]) (elpa-audit . [(0 4) nil "Handy functions for inspecting and comparing package archives" single ((:url . "https://github.com/purcell/elpa-audit") (:keywords "maint"))]) (elmine . [(0 3) nil "No description available." single nil]) (elixir-mode . [(1 4 1) nil "Major mode for editing Elixir files" tar ((:url . "https://github.com/elixir-lang/emacs-elixir") (:keywords "languages" "elixir"))]) (elixir-mix . [(0 3 0) nil "Emacs integration for Elixir's mix" single ((:url . "http://github.com/tonini/elixir-mix.el") (:keywords "elixir" "mix" "elixir-mix"))]) (elisp-slime-nav . [(0 7) ((cl-lib (0 2))) "Make M-. and M-, work in elisp like they do in slime" single ((:url . "https://github.com/purcell/elisp-slime-nav") (:keywords "navigation" "slime" "elisp" "emacs-lisp"))]) (elfeed-web . [(1 1 1) ((simple-httpd (1 4 3)) (elfeed (1 0 1)) (emacs (24 1))) "web interface to Elfeed" tar nil]) (elfeed . [(1 1 1) ((emacs (24 1))) "an Emacs Atom/RSS feed reader" tar nil]) (el-x . [(0 3 0) nil "main entry point for el-x package" tar ((:keywords "lisp"))]) (el-spice . [(0 2 2) ((thingatpt+ (0))) "Extra spice for emacs lisp programming" tar ((:url . "https://github.com/vedang/el-spice") (:keywords "configuration"))]) (el-mock . [(1 25 0) nil "Tiny Mock and Stub framework in Emacs Lisp" single ((:url . "http://github.com/rejeep/el-mock.el") (:keywords "lisp" "testing" "unittest"))]) (el-get . [(5 1) nil "Manage the external elisp bits and pieces you depend upon" tar ((:url . "http://www.emacswiki.org/emacs/el-get") (:keywords "emacs" "package" "elisp" "install" "elpa" "git" "git-svn" "bzr" "cvs" "svn" "darcs" "hg" "apt-get" "fink" "pacman" "http" "http-tar" "emacswiki"))]) (el-autoyas . [(0 5) nil "Automatically create Emacs-Lisp Yasnippets" tar ((:url . "https://github.com/mlf176f2/el-autoyas.el") (:keywords "emacs" "lisp" "mode" "yasnippet"))]) (ein . [(0 2 0) ((websocket (0 9)) (auto-complete (1 4))) "Emacs IPython Notebook" tar nil]) (eide . [(2 0 0) nil "Emacs-IDE" tar ((:url . "http://emacs-ide.tuxfamily.org/"))]) (egison-mode . [(3 3 10) nil "Egison editing mode" single ((:url . "https://github.com/egisatoshi/egison3/blob/master/elisp/egison-mode.el"))]) (edts . [(0 1 0) nil "No description available." tar nil]) (editorconfig . [(0 3) nil "EditorConfig Emacs extension" single ((:url . "http://github.com/editorconfig/editorconfig-emacs#readme"))]) (edit-server . [(1 13) nil "server that responds to edit requests from Chrome" single ((:url . "https://github.com/stsquad/emacs_chrome"))]) (edit-list . [(0 3) nil "edit a single list" single ((:url . "http://mwolson.org/static/dist/elisp/edit-list.el"))]) (edbi . [(0 1 2) ((concurrent (0 3 1)) (ctable (0 1 1)) (epc (0 1 1))) "Emacs Database Interface" tar nil]) (ecukes . [(0 6 15) ((commander (0 6 1)) (espuds (0 2 2)) (ansi (0 3 0)) (dash (2 2 0)) (s (1 8 0)) (f (0 11 0))) "Cucumber for Emacs." tar nil]) (ecb . [(2 -3 24) nil "a code browser for Emacs" tar ((:keywords "browser" "code" "programming" "tools"))]) (ebib . [(1 15 6) nil "a BibTeX database manager" tar ((:keywords "text" "bibtex"))]) (easy-kill-extras . [(0 9 1) ((easy-kill (0 9 4))) "Extra functions for easy-kill." single ((:url . "https://github.com/knu/easy-kill-extras.el") (:keywords "killing" "convenience"))]) (easy-kill . [(0 9 3) ((emacs (24)) (cl-lib (0 5))) "kill & mark things easily" tar ((:url . "https://github.com/leoliu/easy-kill") (:keywords "killing" "convenience"))]) (e2wm-R . [(0 4) ((e2wm (1 2))) "some e2wm plugin and perspective for GNU R" single ((:keywords "window manager" "convenience" "e2wm"))]) (e2wm . [(1 3) nil "simple window manager for emacs" tar ((:keywords "tools" "window manager"))]) (dynamic-fonts . [(0 6 4) ((font-utils (0 7 0)) (persistent-soft (0 8 8)) (pcache (0 2 3))) "Set faces based on available fonts" single ((:url . "http://github.com/rolandwalker/dynamic-fonts") (:keywords "faces" "frames"))]) (dvorak-mode . [(1 0 0) nil "Switch to dvorak layout easily" single ((:url . "https://github.com/proofit404/dvorak-mode"))]) (ducpel . [(0 1) ((cl-lib (0 5))) "Logic game with sokoban elements" tar ((:url . "https://github.com/alezost/ducpel") (:keywords "games"))]) (drupal-spell . [(0 2 2) nil "Aspell extra dictionary for Drupal" tar ((:url . "https://github.com/arnested/drupal-spell") (:keywords "wp"))]) (drupal-mode . [(0 5 0) ((php-mode (1 5 0))) "Advanced minor mode for Drupal development" tar ((:url . "https://github.com/arnested/drupal-mode") (:keywords "programming" "php" "drupal"))]) (drag-stuff . [(0 1 0) nil "Drag stuff (lines, words, region, etc...) around" tar nil]) (dispass . [(1 1 2) nil "Emacs wrapper for DisPass" single ((:url . "http://projects.ryuslash.org/dispass.el/") (:keywords "processes"))]) (discover . [(0 3) ((makey (0 3))) "discover more of Emacs" single nil]) (dired-k . [(0 10) ((cl-lib (0 5)) (emacs (24))) "highlight dired buffer by file size, modified time, git status" tar ((:url . "https://github.com/syohex/emacs-dired-k"))]) (dired-efap . [(0 8) nil "Edit Filename At Point in a dired buffer" single ((:keywords "dired" "environment" "files" "renaming"))]) (diminish . [(0 44) nil "Diminished modes are minor modes with no modeline display" single ((:url . "http://www.eskimo.com/~seldon") (:keywords "extensions" "diminish" "minor" "codeprose"))]) (dim-autoload . [(1 1 2) nil "dim complete autoload cookie lines" single ((:url . "http://github.com/tarsius/dim-autoload") (:keywords "convenience"))]) (digistar-mode . [(0 2) nil "major mode for Digistar scripts" single ((:keywords "languages"))]) (dictionary . [(1 10) nil "No description available." single nil]) (desktop-registry . [(1 2 0) nil "Keep a central registry of desktop files" single ((:url . "http://projects.ryuslash.org/desktop-registry/") (:keywords "convenience"))]) (demangle-mode . [(1 0) ((emacs (24)) (cl-lib (0 1))) "Automatically demangle C++ symbols" single ((:keywords "c" "tools"))]) (deft . [(0 5 1) nil "quickly browse, filter, and edit plain text notes" single ((:url . "http://jblevins.org/projects/deft/") (:keywords "plain text" "notes" "simplenote" "notational velocity"))]) (deferred . [(0 3 2) nil "Simple asynchronous functions for emacs lisp" single ((:url . "https://github.com/kiwanami/emacs-deferred") (:keywords "deferred" "async"))]) (dedicated . [(1 0 0) nil "A very simple minor mode for dedicated buffers" single ((:keywords "dedicated" "buffer"))]) (dash-functional . [(2 8 0) ((dash (2 0 0)) (emacs (24))) "Collection of useful combinators for Emacs Lisp" single ((:keywords "lisp" "functions" "combinators"))]) (dash . [(2 8 0) nil "A modern list library for Emacs" single ((:keywords "lists"))]) (dart-mode . [(0 9) nil "Major mode for editing Dart files" single ((:url . "http://code.google.com/p/dart-mode") (:keywords "language"))]) (d-mode . [(2 0 6) nil "D Programming Language mode for (X)Emacs" single ((:keywords "d" "programming" "language" "emacs" "cc-mode"))]) (cython-mode . [(0 21 1 1) nil "Major mode for editing Cython files" single nil]) (cyberpunk-theme . [(1 10) nil "Cyberpunk Color Theme" single ((:keywords "color" "theme" "cyberpunk"))]) (cuda-mode . [(1 0 0) nil "NVIDIA CUDA Major Mode" single ((:keywords "c" "languages"))]) (ctags-update . [(0 2 0) nil "(auto) update TAGS in parent directory using exuberant-ctags" single ((:url . "https://github.com/jixiuf/helm-etags-plus") (:keywords "exuberant-ctags" "etags"))]) (ctags . [(1 1 1) nil "No description available." single nil]) (ctable . [(0 1 2) nil "Table component for Emacs Lisp" single ((:url . "https://github.com/kiwanami/emacs-ctable") (:keywords "table"))]) (cryptol-mode . [(0 1 0) nil "Cryptol major mode for Emacs" single ((:url . "http://github.com/thoughtpolice/cryptol-mode") (:keywords "cryptol" "cryptography"))]) (creds . [(0 0 6 1) ((s (1 9 0)) (dash (2 5 0))) "A parser credentials file library (not limited to credentials entries)" tar nil]) (cpputils-cmake . [(0 4 14) nil "Easy real time C++ syntax check and intellisense if you use CMake" tar nil]) (cperl-mode . [(6 2) nil "Perl code editing commands for Emacs" single ((:keywords "languages" "perl"))]) (connection . [(1 10) nil "No description available." single nil]) (conkeror-minor-mode . [(1 6 1) nil "Mode for editing conkeror javascript files." single ((:url . "http://github.com/BruceConnor/conkeror-minor-mode") (:keywords "programming" "tools"))]) (concurrent . [(0 3 2) ((deferred (0 3 1))) "Concurrent utility functions for emacs lisp" single ((:url . "https://github.com/kiwanami/emacs-deferred/blob/master/README-concurrent.markdown") (:keywords "deferred" "async" "concurrent"))]) (company-tern . [(0 2 0) ((company (0 8 0)) (tern (0 0 1)) (dash (2 8 0)) (dash-functional (2 8 0)) (s (1 9 0)) (cl-lib (0 5 0))) "Tern backend for company-mode" single ((:url . "https://github.com/proofit404/company-tern"))]) (company-ghc . [(0 0 8) ((cl-lib (0 5)) (company (0 8 0)) (ghc (4 1 1)) (emacs (24))) "company-mode ghc-mod backend" single ((:url . "https://github.com/iquiw/company-ghc") (:keywords "haskell" "completion"))]) (company . [(0 8 2) ((emacs (24 1)) (cl-lib (0 5))) "Modular text completion framework" tar ((:url . "http://company-mode.github.io/") (:keywords "abbrev" "convenience" "matching"))]) (commander . [(0 7 0) ((s (1 6 0)) (dash (2 0 0)) (cl-lib (0 3)) (f (0 6 1))) "Emacs command line parser" single ((:url . "http://github.com/rejeep/commander.el") (:keywords "cli" "argv"))]) (colorsarenice-theme . [(1 0 12) ((emacs (24))) "A color theme." tar nil]) (color-theme-sanityinc-tomorrow . [(1 13) nil "A version of Chris Kempson's various Tomorrow themes" tar nil]) (color-theme-sanityinc-solarized . [(2 27) nil "A version of Ethan Schoonover's Solarized themes" tar nil]) (coffee-mode . [(0 5 5) ((emacs (24 1)) (cl-lib (0 5))) "Major mode to edit CoffeeScript files in Emacs" single ((:url . "http://github.com/defunkt/coffee-mode") (:keywords "coffeescript" "major" "mode"))]) (cmake-mode . [(3 0 1) nil "major-mode for editing CMake sources" single nil]) (cm-mode . [(1 1) nil "Minor mode for CriticMarkup" single ((:keywords "text" "markdown"))]) (clojure-test-mode . [(2 2 0) ((clojure-mode (1 7)) (cider (0 4 0))) "Minor mode for Clojure tests" single ((:url . "http://emacswiki.org/cgi-bin/wiki/ClojureTestMode") (:keywords "languages" "lisp" "test"))]) (clojure-mode . [(2 2 0) nil "Major mode for Clojure code" single ((:url . "http://github.com/clojure-emacs/clojure-mode") (:keywords "languages" "lisp"))]) (clojure-cheatsheet . [(0 2 2) ((helm (1 5 3)) (cider (0 1 8))) "The Clojure Cheatsheet for Emacs" single ((:url . "https://github.com/krisajenkins/clojure-cheatsheet") (:keywords "clojure" "nrepl" "cheatsheet" "helm"))]) (clj-refactor . [(0 12 0) ((s (1 8 0)) (dash (2 4 0)) (yasnippet (0 6 1)) (paredit (22)) (multiple-cursors (1 2 2))) "A collection of clojure refactoring functions" single ((:keywords "convenience"))]) (clips-mode . [(0 7) nil "Major mode for editing CLIPS code and REPL" tar nil]) (cl-lib-highlight . [(1 0 0) ((cl-lib (0 3))) "full cl-lib font-lock highlighting" single ((:url . "https://github.com/skeeto/cl-lib-highlight"))]) (cider . [(0 7 0) ((clojure-mode (2 0 0)) (cl-lib (0 3)) (dash (2 4 1)) (pkg-info (0 4)) (emacs (24))) "Clojure Integrated Development Environment and REPL" tar ((:url . "http://www.github.com/clojure-emacs/cider") (:keywords "languages" "clojure" "cider"))]) (charmap . [(0 0 1) nil "Unicode table for Emacs" single ((:url . "https://github.com/lateau/charmap") (:keywords "unicode" "character" "ucs"))]) (cfengine-code-style . [(3 6 1) nil "C code style for CFEngine project." single ((:url . "https://github.com/cfengine/core"))]) (cerbere . [(0 1 0) ((s (1 9 0)) (f (0 16 0)) (go-mode (20140409)) (pkg-info (0 5))) "Unit testing in Emacs for several programming languages" tar ((:url . "https://github.com/nlamirault/cerbere") (:keywords "python" "go" "php" "tests" "tdd"))]) (cdlatex . [(4 7) nil "Fast input methods for LaTeX environments and math" single ((:keywords "tex"))]) (cask . [(0 7 0) ((s (1 8 0)) (dash (2 2 0)) (f (0 16 0)) (epl (0 5)) (shut-up (0 1 0)) (cl-lib (0 3)) (package-build (0 1))) "Cask: Project management for Emacs package development" tar ((:url . "http://github.com/cask/cask") (:keywords "speed" "convenience"))]) (calfw . [(1 3) nil "Calendar view framework on Emacs" tar ((:keywords "calendar"))]) (cake2 . [(2 1 0) ((dash (2 6 0)) (s (1 9 0)) (f (0 16 2)) (ht (2 0)) (json (1 2)) (cake-inflector (1 1 0)) (historyf (0 0 8)) (anything (1 3 9))) "CakePHP2 Minor Mode" tar ((:url . "http://code.101000lab.org"))]) (cake-inflector . [(1 1 1) ((s (1 9 0))) "Lazy porting CakePHP infrector.php to el" single ((:url . "https://github.com/k1LoW/emacs-cake-inflector"))]) (cake . [(1 4 3) ((cake-inflector (1 1 0)) (historyf (0 0 8)) (anything (1 3 9))) "CakePHP Minor Mode" tar ((:url . "https://github.com/k1LoW/emacs-cake"))]) (cacoo . [(2 1 2) ((concurrent (0 3 1))) "Minor mode for Cacoo : http://cacoo.com" tar nil]) (button-lock . [(1 0 0) nil "Clickable text defined by regular expression" single ((:url . "http://github.com/rolandwalker/button-lock") (:keywords "mouse" "button" "hypermedia" "extensions"))]) (bundler . [(1 1 0) ((inf-ruby (2 1))) "Interact with Bundler from Emacs" single ((:url . "http://github.com/tobiassvn/") (:keywords "bundler" "ruby"))]) (bug-reference-github . [(0 2 0) nil "Automatically set `bug-reference-url-format' in Github repositories." single ((:url . "https://github.com/arnested/bug-reference-github") (:keywords "programming" "tools"))]) (bufshow . [(0 1 0) nil "No description available." single nil]) (buffer-utils . [(0 1 0) nil "Buffer-manipulation utility functions" single ((:url . "http://github.com/rolandwalker/buffer-utils") (:keywords "extensions"))]) (browse-url-dwim . [(0 6 8) ((string-utils (0 3 2))) "Context-sensitive external browse URL or Internet search" single ((:url . "http://github.com/rolandwalker/browse-url-dwim") (:keywords "hypermedia"))]) (browse-kill-ring . [(1 6 0) nil "interactively insert items from kill-ring" single ((:url . "https://github.com/browse-kill-ring/browse-kill-ring") (:keywords "convenience"))]) (bog . [(0 6 0) ((org (8 0 0)) (dash (2 5 0))) "Extensions for research notes in Org mode" single ((:url . "https://github.com/kyleam/bog") (:keywords "bibtex" "org-mode"))]) (birds-of-paradise-plus-theme . [(0 1 1) nil "A brown/orange light-on-dark theme for Emacs 24 (deftheme)." single ((:url . "https://github.com/jimeh/birds-of-paradise-plus-theme.el") (:keywords "themes"))]) (bind-key . [(20140601) nil "A simple way to manage personal keybindings" single ((:url . "https://github.com/jwiegley/use-package") (:keywords "keys" "keybinding" "config" "dotemacs"))]) (beeminder . [(1 0 0) nil "Emacs interface for Beeminder" single ((:keywords "beeminder"))]) (bbdb2erc . [(0 1 3) ((bbdb (3 0))) "make bbdb show if pal is online with ERC, click i to chat" single ((:keywords "irc" "contacts" "chat" "client" "internet"))]) (bbdb-vcard . [(0 3) nil "vCard import/export for BBDB" tar ((:url . "http://github.com/trebb/bbdb-vcard") (:keywords "data" "calendar" "mail" "news"))]) (bbcode-mode . [(2 0 0) nil "Major mode for writing BBCode markup" single ((:url . "https://github.com/ejmr/bbcode-mode"))]) (back-button . [(0 6 6) ((nav-flash (1 0 0)) (smartrep (0 0 3)) (ucs-utils (0 7 2)) (persistent-soft (0 8 8)) (pcache (0 2 3))) "Visual navigation through mark rings" single ((:url . "http://github.com/rolandwalker/back-button") (:keywords "convenience" "navigation" "interface"))]) (babel . [(1 4) nil "interface to web translation services such as Babelfish" single ((:keywords "translation" "web"))]) (autopair . [(0 6 1) ((cl-lib (0 3))) "Automagically pair braces and quotes like TextMate" single ((:url . "http://autopair.googlecode.com") (:keywords "convenience" "emulations"))]) (auto-shell-command . [(1 0 0) ((deferred (20130312)) (popwin (20130329))) "Run the shell command asynchronously that you specified when you save the file." single ((:keywords "shell" "save" "async" "deferred" "auto"))]) (auto-indent-mode . [(0 126) nil "Auto indent Minor mode" tar ((:url . "https://github.com/mlf176f2/auto-indent-mode.el/") (:keywords "auto" "indentation"))]) (auto-dictionary . [(1 1) nil "automatic dictionary switcher for flyspell" single ((:url . "http://nschum.de/src/emacs/auto-dictionary/") (:keywords "wp"))]) (auto-complete-exuberant-ctags . [(0 0 7) ((auto-complete (1 4 0))) "Exuberant ctags auto-complete.el source" single ((:url . "http://code.101000lab.org") (:keywords "anto-complete" "exuberant ctags"))]) (auto-complete-clang-async . [(0 5) nil "Auto Completion source for clang for GNU Emacs" single ((:keywords "completion" "convenience"))]) (auto-complete . [(1 4 0) ((popup (0 5 0))) "Auto Completion for GNU Emacs" tar nil]) (auto-compile . [(1 2 1) ((cl-lib (0 2)) (packed (0 3 4))) "automatically compile Emacs Lisp libraries" single ((:url . "http://tarsius.github.com/auto-compile") (:keywords "compile" "convenience" "lisp"))]) (aurel . [(0 6) nil "Search, get info, vote and download AUR packages" single ((:url . "https://github.com/alezost/aurel") (:keywords "tools"))]) (apples-mode . [(0 0 2) nil "Major mode for editing and executing AppleScript code" tar ((:keywords "applescript" "languages"))]) (anzu . [(0 36) ((cl-lib (0 5)) (emacs (24))) "Show number of matches in mode-line while searching" single ((:url . "https://github.com/syohex/emacs-anzu"))]) (anything-replace-string . [(0 9 2) ((anything (1 3 9))) "`replace-string' and `query-replace' `anything.el' interface" single ((:url . "http://code.101000lab.org"))]) (anything-exuberant-ctags . [(0 1 2) ((anything (1 3 9))) "Exuberant ctags anything.el interface" single ((:url . "http://code.101000lab.org") (:keywords "anything" "exuberant ctags"))]) (anything . [(1 3 9) nil "open anything / QuickSilver-like candidate-selection framework" tar ((:url . "http://repo.or.cz/w/anything-config.git") (:keywords "files" "frames" "help" "matching" "outlines" "processes" "tools" "convenience" "anything"))]) (anyins . [(0 1 1) nil "Insert content at multiple places from shell command or kill-ring" single ((:url . "http://github.com/antham/anyins") (:keywords "insert" "rectangular"))]) (anti-zenburn-theme . [(2 1) nil "Low-contrast Zenburn-inverted theme" single ((:url . "https://github.com/m00natic/anti-zenburn-theme"))]) (ansible . [(0 0 2) ((s (1 9 0)) (f (0 16 2))) "Ansible minor mode" tar ((:url . "http://101000lab.org"))]) (ansi . [(0 2 1) ((s (1 6 1)) (dash (1 5 0))) "Turn string into ansi strings" single ((:url . "http://github.com/rejeep/ansi") (:keywords "color" "ansi"))]) (angular-snippets . [(0 2 3) ((s (1 4 0)) (dash (1 2 0))) "Yasnippets for AngularJS" tar nil]) (anaphora . [(1 0 0) nil "anaphoric macros providing implicit temp variables" single ((:url . "http://github.com/rolandwalker/anaphora") (:keywords "extensions"))]) (anaconda-mode . [(0 1 0) nil "No description available." tar nil]) (alect-themes . [(0 6) nil "Configurable color themes (light, dark and black) for Emacs 24" tar nil]) (ag . [(0 44) nil "A front-end for ag ('the silver searcher'), the C ack replacement." single nil]) (aes . [(0 6) nil "Implementation of AES" single ((:url . "https://github.com/gaddhi/aes") (:keywords "data" "tools"))]) (adoc-mode . [(0 6 2) ((markup-faces (1 0 0))) "a major-mode for editing AsciiDoc files in Emacs" single ((:url . "https://github.com/sensorflo/adoc-mode/wiki") (:keywords "wp" "asciidoc"))]) (actionscript-mode . [(7 2 2) nil "A simple mode for editing Actionscript 3 files" single ((:keywords "language" "modes"))]) (ack-menu . [(0 2 3) nil "No description available." tar]) (ack-and-a-half . [(1 2 0) nil "Yet another front-end for ack" single ((:url . "http://technosorcery.net"))]) (ace-window . [(0 4 0) ((ace-jump-mode (2 0))) "Quickly switch windows using `ace-jump-mode'." single ((:url . "https://github.com/abo-abo/ace-window") (:keywords "cursor" "window" "location"))]) (ace-jump-mode . [(2 0) nil "a quick cursor location minor mode for emacs" single ((:url . "https://github.com/winterTTr/ace-jump-mode/") (:keywords "motion" "location" "cursor"))]) (ac-slime . [(0 5) nil "An auto-complete source using slime completions" single ((:url . "https://github.com/purcell/ac-slime"))]) (ac-octave . [(0 4) ((auto-complete (1 4 0))) "An auto-complete source for Octave" single ((:url . "https://github.com/coldnew/ac-octave") (:keywords "octave" "auto-complete" "completion"))]) (ac-nrepl . [(0 21) ((cider (0 1)) (auto-complete (1 4))) "auto-complete sources for Clojure using nrepl completions" single ((:url . "https://github.com/purcell/ac-nrepl") (:keywords "languages" "clojure" "nrepl"))]) (ac-ispell . [(0 6) ((auto-complete (1 4))) "ispell completion source for auto-complete" single ((:url . "https://github.com/syohex/emacs-ac-ispell"))]) (ac-inf-ruby . [(0 4) ((inf-ruby (2 3 2)) (auto-complete (1 4))) "Enable auto-complete in inf-ruby sessions" single ((:keywords "languages" "tools"))]) (ac-helm . [(2 1) ((helm (20130328)) (auto-complete (1 4 0)) (popup (0 5 0))) "Auto Complete with Helm" single ((:keywords "completion" "convenience" "helm"))]) (ac-geiser . [(0 1) ((geiser (0 5)) (auto-complete (1 4))) "Auto-complete backend for geiser" tar nil]) (ac-etags . [(0 6) ((auto-complete (1 4))) "etags/ctags completion source for auto-complete" single ((:url . "https://github.com/syohex/emacs-ac-etags"))]) (ac-cider . [(0 2 0) ((cider (0 6 0)) (auto-complete (1 4))) "Clojure auto-complete sources using CIDER" single ((:url . "https://github.com/clojure-emacs/ac-cider") (:keywords "languages" "clojure" "nrepl" "cider" "compliment"))]) (ac-cake2 . [(1 0 1) ((cake2 (1 1 2)) (auto-complete (1 4 0))) "CakePHP 2 Minor Mode auto-complete.el source" single ((:url . "http://code.101000lab.org"))]) (ac-cake . [(1 0 0) ((cake (1 4 2)) (auto-complete (1 4))) "CakePHP Minor Mode auto-complete.el source" single ((:url . "http://code.101000lab.org"))]) (abc-mode . [(20140225 944) nil "Major mode for editing abc music files" single ((:keywords "local" "docs"))])) diff --git a/elpa/auto-complete-20140803.2118/auto-complete-autoloads.el b/elpa/auto-complete-20140803.2118/auto-complete-autoloads.el new file mode 100644 index 000000000..09372168c --- /dev/null +++ b/elpa/auto-complete-20140803.2118/auto-complete-autoloads.el @@ -0,0 +1,66 @@ +;;; auto-complete-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (global-auto-complete-mode auto-complete-mode auto-complete) +;;;;;; "auto-complete" "auto-complete.el" (21478 16695 0 0)) +;;; Generated autoloads from auto-complete.el + +(autoload 'auto-complete "auto-complete" "\ +Start auto-completion at current point. + +\(fn &optional SOURCES)" t nil) + +(autoload 'auto-complete-mode "auto-complete" "\ +AutoComplete mode + +\(fn &optional ARG)" t nil) + +(defvar global-auto-complete-mode nil "\ +Non-nil if Global-Auto-Complete mode is enabled. +See the command `global-auto-complete-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-auto-complete-mode'.") + +(custom-autoload 'global-auto-complete-mode "auto-complete" nil) + +(autoload 'global-auto-complete-mode "auto-complete" "\ +Toggle Auto-Complete mode in all buffers. +With prefix ARG, enable Global-Auto-Complete mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Auto-Complete mode is enabled in all buffers where +`auto-complete-mode-maybe' would do it. +See `auto-complete-mode' for more information on Auto-Complete mode. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads (ac-config-default) "auto-complete-config" "auto-complete-config.el" +;;;;;; (21478 16695 0 0)) +;;; Generated autoloads from auto-complete-config.el + +(autoload 'ac-config-default "auto-complete-config" "\ + + +\(fn)" nil nil) + +;;;*** + +;;;### (autoloads nil nil ("auto-complete-pkg.el") (21478 16695 123947 +;;;;;; 0)) + +;;;*** + +(provide 'auto-complete-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; auto-complete-autoloads.el ends here diff --git a/elpa/auto-complete-20140803.2118/auto-complete-config.el b/elpa/auto-complete-20140803.2118/auto-complete-config.el new file mode 100644 index 000000000..40e63bc8a --- /dev/null +++ b/elpa/auto-complete-20140803.2118/auto-complete-config.el @@ -0,0 +1,521 @@ +;;; auto-complete-config.el --- auto-complete additional configuations + +;; Copyright (C) 2009, 2010 Tomohiro Matsuyama + +;; Author: Tomohiro Matsuyama +;; Keywords: convenience +;; Version: 1.4 + +;; 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 . + +;;; Commentary: + +;; + +;;; Code: + +(eval-when-compile + (require 'cl)) + +(require 'auto-complete) + + + +;;;; Additional sources + +;; imenu + +(defvar ac-imenu-index nil) + +(ac-clear-variable-every-10-minutes 'ac-imenu-index) + +(defun ac-imenu-candidates () + (loop with i = 0 + with stack = (progn + (unless (local-variable-p 'ac-imenu-index) + (make-local-variable 'ac-imenu-index)) + (or ac-imenu-index + (setq ac-imenu-index + (ignore-errors + (with-no-warnings + (imenu--make-index-alist)))))) + with result + while (and stack (or (not (integerp ac-limit)) + (< i ac-limit))) + for node = (pop stack) + if (consp node) + do + (let ((car (car node)) + (cdr (cdr node))) + (if (consp cdr) + (mapc (lambda (child) + (push child stack)) + cdr) + (when (and (stringp car) + (string-match (concat "^" (regexp-quote ac-prefix)) car)) + ;; Remove extra characters + (if (string-match "^.*\\(()\\|=\\|<>\\)$" car) + (setq car (substring car 0 (match-beginning 1)))) + (push car result) + (incf i)))) + finally return (nreverse result))) + +(ac-define-source imenu + '((depends imenu) + (candidates . ac-imenu-candidates) + (symbol . "s"))) + +;; gtags + +(defface ac-gtags-candidate-face + '((t (:inherit ac-candidate-face :foreground "navy"))) + "Face for gtags candidate" + :group 'auto-complete) + +(defface ac-gtags-selection-face + '((t (:inherit ac-selection-face :background "navy"))) + "Face for the gtags selected candidate." + :group 'auto-complete) + +(defun ac-gtags-candidate () + (ignore-errors + (split-string (shell-command-to-string (format "global -ciq %s" ac-prefix)) "\n"))) + +(ac-define-source gtags + '((candidates . ac-gtags-candidate) + (candidate-face . ac-gtags-candidate-face) + (selection-face . ac-gtags-selection-face) + (requires . 3) + (symbol . "s"))) + +;; yasnippet + +(defface ac-yasnippet-candidate-face + '((t (:inherit ac-candidate-face + :background "sandybrown" :foreground "black"))) + "Face for yasnippet candidate." + :group 'auto-complete) + +(defface ac-yasnippet-selection-face + '((t (:inherit ac-selection-face :background "coral3"))) + "Face for the yasnippet selected candidate." + :group 'auto-complete) + +(defun ac-yasnippet-table-hash (table) + (cond + ((fboundp 'yas/snippet-table-hash) + (yas/snippet-table-hash table)) + ((fboundp 'yas/table-hash) + (yas/table-hash table)))) + +(defun ac-yasnippet-table-parent (table) + (cond + ((fboundp 'yas/snippet-table-parent) + (yas/snippet-table-parent table)) + ((fboundp 'yas/table-parent) + (yas/table-parent table)))) + +(defun ac-yasnippet-candidate-1 (table) + (with-no-warnings + (let ((hashtab (ac-yasnippet-table-hash table)) + (parent (ac-yasnippet-table-parent table)) + candidates) + (maphash (lambda (key value) + (push key candidates)) + hashtab) + (setq candidates (all-completions ac-prefix (nreverse candidates))) + (if parent + (setq candidates + (append candidates (ac-yasnippet-candidate-1 parent)))) + candidates))) + +(defun ac-yasnippet-candidates () + (with-no-warnings + (cond (;; 0.8 onwards + (fboundp 'yas-active-keys) + (all-completions ac-prefix (yas-active-keys))) + (;; >0.6.0 + (fboundp 'yas/get-snippet-tables) + (apply 'append (mapcar 'ac-yasnippet-candidate-1 + (condition-case nil + (yas/get-snippet-tables major-mode) + (wrong-number-of-arguments + (yas/get-snippet-tables))))) + ) + (t + (let ((table + (if (fboundp 'yas/snippet-table) + ;; <0.6.0 + (yas/snippet-table major-mode) + ;; 0.6.0 + (yas/current-snippet-table)))) + (if table + (ac-yasnippet-candidate-1 table))))))) + +(ac-define-source yasnippet + '((depends yasnippet) + (candidates . ac-yasnippet-candidates) + (action . yas/expand) + (candidate-face . ac-yasnippet-candidate-face) + (selection-face . ac-yasnippet-selection-face) + (symbol . "a"))) + +;; semantic + +(defun ac-semantic-candidates (prefix) + (with-no-warnings + (delete "" ; semantic sometimes returns an empty string + (mapcar (lambda (elem) + (cons (semantic-tag-name elem) + (semantic-tag-clone elem))) + (ignore-errors + (or (semantic-analyze-possible-completions + (semantic-analyze-current-context)) + (senator-find-tag-for-completion prefix))))))) + +(defun ac-semantic-doc (symbol) + (with-no-warnings + (let* ((proto (semantic-format-tag-summarize-with-file symbol nil t)) + (doc (semantic-documentation-for-tag symbol)) + (res proto)) + (when doc + (setq res (concat res "\n\n" doc))) + res))) + +(ac-define-source semantic + '((available . (or (require 'semantic-ia nil t) + (require 'semantic/ia nil t))) + (candidates . (ac-semantic-candidates ac-prefix)) + (document . ac-semantic-doc) + (prefix . cc-member) + (requires . 0) + (symbol . "m"))) + +(ac-define-source semantic-raw + '((available . (or (require 'semantic-ia nil t) + (require 'semantic/ia nil t))) + (candidates . (ac-semantic-candidates ac-prefix)) + (document . ac-semantic-doc) + (symbol . "s"))) + +;; eclim + +(defun ac-eclim-candidates () + (with-no-warnings + (loop for c in (eclim/java-complete) + collect (nth 1 c)))) + +(ac-define-source eclim + '((candidates . ac-eclim-candidates) + (prefix . c-dot) + (requires . 0) + (symbol . "f"))) + +;; css + +;; Copied from company-css.el +(defconst ac-css-property-alist + ;; see http://www.w3.org/TR/CSS21/propidx.html + '(("azimuth" angle "left-side" "far-left" "left" "center-left" "center" + "center-right" "right" "far-right" "right-side" "behind" "leftwards" + "rightwards") + ("background" background-color background-image background-repeat + background-attachment background-position) + ("background-attachment" "scroll" "fixed") + ("background-color" color "transparent") + ("background-image" uri "none") + ("background-position" percentage length "left" "center" "right" percentage + length "top" "center" "bottom" "left" "center" "right" "top" "center" + "bottom") + ("background-repeat" "repeat" "repeat-x" "repeat-y" "no-repeat") + ("border" border-width border-style border-color) + ("border-bottom" border) + ("border-bottom-color" border-color) + ("border-bottom-style" border-style) + ("border-bottom-width" border-width) + ("border-collapse" "collapse" "separate") + ("border-color" color "transparent") + ("border-left" border) + ("border-left-color" border-color) + ("border-left-style" border-style) + ("border-left-width" border-width) + ("border-right" border) + ("border-right-color" border-color) + ("border-right-style" border-style) + ("border-right-width" border-width) + ("border-spacing" length length) + ("border-style" border-style) + ("border-top" border) + ("border-top-color" border-color) + ("border-top-style" border-style) + ("border-top-width" border-width) + ("border-width" border-width) + ("bottom" length percentage "auto") + ("caption-side" "top" "bottom") + ("clear" "none" "left" "right" "both") + ("clip" shape "auto") + ("color" color) + ("content" "normal" "none" string uri counter "attr()" "open-quote" + "close-quote" "no-open-quote" "no-close-quote") + ("counter-increment" identifier integer "none") + ("counter-reset" identifier integer "none") + ("cue" cue-before cue-after) + ("cue-after" uri "none") + ("cue-before" uri "none") + ("cursor" uri "*" "auto" "crosshair" "default" "pointer" "move" "e-resize" + "ne-resize" "nw-resize" "n-resize" "se-resize" "sw-resize" "s-resize" + "w-resize" "text" "wait" "help" "progress") + ("direction" "ltr" "rtl") + ("display" "inline" "block" "list-item" "run-in" "inline-block" "table" + "inline-table" "table-row-group" "table-header-group" "table-footer-group" + "table-row" "table-column-group" "table-column" "table-cell" + "table-caption" "none") + ("elevation" angle "below" "level" "above" "higher" "lower") + ("empty-cells" "show" "hide") + ("float" "left" "right" "none") + ("font" font-style font-variant font-weight font-size "/" line-height + font-family "caption" "icon" "menu" "message-box" "small-caption" + "status-bar") + ("font-family" family-name generic-family) + ("font-size" absolute-size relative-size length percentage) + ("font-style" "normal" "italic" "oblique") + ("font-variant" "normal" "small-caps") + ("font-weight" "normal" "bold" "bolder" "lighter" "100" "200" "300" "400" + "500" "600" "700" "800" "900") + ("height" length percentage "auto") + ("left" length percentage "auto") + ("letter-spacing" "normal" length) + ("line-height" "normal" number length percentage) + ("list-style" list-style-type list-style-position list-style-image) + ("list-style-image" uri "none") + ("list-style-position" "inside" "outside") + ("list-style-type" "disc" "circle" "square" "decimal" "decimal-leading-zero" + "lower-roman" "upper-roman" "lower-greek" "lower-latin" "upper-latin" + "armenian" "georgian" "lower-alpha" "upper-alpha" "none") + ("margin" margin-width) + ("margin-bottom" margin-width) + ("margin-left" margin-width) + ("margin-right" margin-width) + ("margin-top" margin-width) + ("max-height" length percentage "none") + ("max-width" length percentage "none") + ("min-height" length percentage) + ("min-width" length percentage) + ("orphans" integer) + ("outline" outline-color outline-style outline-width) + ("outline-color" color "invert") + ("outline-style" border-style) + ("outline-width" border-width) + ("overflow" "visible" "hidden" "scroll" "auto") + ("padding" padding-width) + ("padding-bottom" padding-width) + ("padding-left" padding-width) + ("padding-right" padding-width) + ("padding-top" padding-width) + ("page-break-after" "auto" "always" "avoid" "left" "right") + ("page-break-before" "auto" "always" "avoid" "left" "right") + ("page-break-inside" "avoid" "auto") + ("pause" time percentage) + ("pause-after" time percentage) + ("pause-before" time percentage) + ("pitch" frequency "x-low" "low" "medium" "high" "x-high") + ("pitch-range" number) + ("play-during" uri "mix" "repeat" "auto" "none") + ("position" "static" "relative" "absolute" "fixed") + ("quotes" string string "none") + ("richness" number) + ("right" length percentage "auto") + ("speak" "normal" "none" "spell-out") + ("speak-header" "once" "always") + ("speak-numeral" "digits" "continuous") + ("speak-punctuation" "code" "none") + ("speech-rate" number "x-slow" "slow" "medium" "fast" "x-fast" "faster" + "slower") + ("stress" number) + ("table-layout" "auto" "fixed") + ("text-align" "left" "right" "center" "justify") + ("text-decoration" "none" "underline" "overline" "line-through" "blink") + ("text-indent" length percentage) + ("text-transform" "capitalize" "uppercase" "lowercase" "none") + ("top" length percentage "auto") + ("unicode-bidi" "normal" "embed" "bidi-override") + ("vertical-align" "baseline" "sub" "super" "top" "text-top" "middle" + "bottom" "text-bottom" percentage length) + ("visibility" "visible" "hidden" "collapse") + ("voice-family" specific-voice generic-voice "*" specific-voice + generic-voice) + ("volume" number percentage "silent" "x-soft" "soft" "medium" "loud" + "x-loud") + ("white-space" "normal" "pre" "nowrap" "pre-wrap" "pre-line") + ("widows" integer) + ("width" length percentage "auto") + ("word-spacing" "normal" length) + ("z-index" "auto" integer)) + "A list of CSS properties and their possible values.") + +(defconst ac-css-value-classes + '((absolute-size "xx-small" "x-small" "small" "medium" "large" "x-large" + "xx-large") + (border-style "none" "hidden" "dotted" "dashed" "solid" "double" "groove" + "ridge" "inset" "outset") + (color "aqua" "black" "blue" "fuchsia" "gray" "green" "lime" "maroon" "navy" + "olive" "orange" "purple" "red" "silver" "teal" "white" "yellow" + "rgb") + (counter "counter") + (family-name "Courier" "Helvetica" "Times") + (generic-family "serif" "sans-serif" "cursive" "fantasy" "monospace") + (generic-voice "male" "female" "child") + (margin-width "auto") ;; length percentage + (relative-size "larger" "smaller") + (shape "rect") + (uri "url")) + "A list of CSS property value classes and their contents.") + +(defconst ac-css-pseudo-classes + '("active" "after" "before" "first" "first-child" "first-letter" "first-line" + "focus" "hover" "lang" "left" "link" "right" "visited") + "Identifiers for CSS pseudo-elements and pseudo-classes.") + +(defvar ac-css-property nil + "Current editing property.") + +(defun ac-css-prefix () + (when (save-excursion (re-search-backward "\\_<\\(.+?\\)\\_>\\s *:[^;]*\\=" nil t)) + (setq ac-css-property (match-string 1)) + (or (ac-prefix-symbol) (point)))) + +(defun ac-css-property-candidates () + (let ((list (assoc-default ac-css-property ac-css-property-alist))) + (if list + (loop with seen + with value + while (setq value (pop list)) + if (symbolp value) + do (unless (memq value seen) + (push value seen) + (setq list + (append list + (or (assoc-default value ac-css-value-classes) + (assoc-default (symbol-name value) ac-css-property-alist))))) + else collect value) + ac-css-pseudo-classes))) + +(ac-define-source css-property + '((candidates . ac-css-property-candidates) + (prefix . ac-css-prefix) + (requires . 0))) + +;; slime +(ac-define-source slime + '((depends slime) + (candidates . (car (slime-simple-completions ac-prefix))) + (symbol . "s") + (cache))) + +;; ghc-mod +(ac-define-source ghc-mod + '((depends ghc) + (candidates . (ghc-select-completion-symbol)) + (symbol . "s") + (cache))) + + + +;;;; Not maintained sources + +;; ropemacs + +(defvar ac-ropemacs-loaded nil) +(defun ac-ropemacs-require () + (with-no-warnings + (unless ac-ropemacs-loaded + (pymacs-load "ropemacs" "rope-") + (if (boundp 'ropemacs-enable-autoimport) + (setq ropemacs-enable-autoimport t)) + (setq ac-ropemacs-loaded t)))) + +(defun ac-ropemacs-setup () + (ac-ropemacs-require) + ;(setq ac-sources (append (list 'ac-source-ropemacs) ac-sources)) + (setq ac-omni-completion-sources '(("\\." ac-source-ropemacs)))) + +(defun ac-ropemacs-initialize () + (autoload 'pymacs-apply "pymacs") + (autoload 'pymacs-call "pymacs") + (autoload 'pymacs-eval "pymacs" nil t) + (autoload 'pymacs-exec "pymacs" nil t) + (autoload 'pymacs-load "pymacs" nil t) + (add-hook 'python-mode-hook 'ac-ropemacs-setup) + t) + +(defvar ac-ropemacs-completions-cache nil) +(defvar ac-source-ropemacs + '((init + . (lambda () + (setq ac-ropemacs-completions-cache + (mapcar + (lambda (completion) + (concat ac-prefix completion)) + (ignore-errors + (rope-completions)))))) + (candidates . ac-ropemacs-completions-cache))) + +;; rcodetools + +(defvar ac-source-rcodetools + '((init . (lambda () + (require 'rcodetools) + (condition-case x + (save-excursion + (rct-exec-and-eval rct-complete-command-name "--completion-emacs-icicles")) + (error) (setq rct-method-completion-table nil)))) + (candidates . (lambda () + (all-completions + ac-prefix + (mapcar + (lambda (completion) + (replace-regexp-in-string "\t.*$" "" (car completion))) + rct-method-completion-table)))))) + + + +;;;; Default settings + +(defun ac-common-setup () + ;(add-to-list 'ac-sources 'ac-source-filename) + ) + +(defun ac-emacs-lisp-mode-setup () + (setq ac-sources (append '(ac-source-features ac-source-functions ac-source-yasnippet ac-source-variables ac-source-symbols) ac-sources))) + +(defun ac-cc-mode-setup () + (setq ac-sources (append '(ac-source-yasnippet ac-source-gtags) ac-sources))) + +(defun ac-ruby-mode-setup ()) + +(defun ac-css-mode-setup () + (setq ac-sources (append '(ac-source-css-property) ac-sources))) + +;;;###autoload +(defun ac-config-default () + (setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers)) + (add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup) + (add-hook 'c-mode-common-hook 'ac-cc-mode-setup) + (add-hook 'ruby-mode-hook 'ac-ruby-mode-setup) + (add-hook 'css-mode-hook 'ac-css-mode-setup) + (add-hook 'auto-complete-mode-hook 'ac-common-setup) + (global-auto-complete-mode t)) + +(provide 'auto-complete-config) +;;; auto-complete-config.el ends here diff --git a/elpa/auto-complete-20140803.2118/auto-complete-config.elc b/elpa/auto-complete-20140803.2118/auto-complete-config.elc new file mode 100644 index 000000000..e90d0ce5f Binary files /dev/null and b/elpa/auto-complete-20140803.2118/auto-complete-config.elc differ diff --git a/elpa/auto-complete-20140803.2118/auto-complete-pkg.el b/elpa/auto-complete-20140803.2118/auto-complete-pkg.el new file mode 100644 index 000000000..733894d05 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/auto-complete-pkg.el @@ -0,0 +1,2 @@ +(define-package "auto-complete" "20140803.2118" "Auto Completion for GNU Emacs" + '((popup "0.5.0"))) diff --git a/elpa/auto-complete-20140803.2118/auto-complete-pkg.elc b/elpa/auto-complete-20140803.2118/auto-complete-pkg.elc new file mode 100644 index 000000000..0f41d6bf6 Binary files /dev/null and b/elpa/auto-complete-20140803.2118/auto-complete-pkg.elc differ diff --git a/elpa/auto-complete-20140803.2118/auto-complete.el b/elpa/auto-complete-20140803.2118/auto-complete.el new file mode 100644 index 000000000..088f09608 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/auto-complete.el @@ -0,0 +1,2101 @@ +;;; auto-complete.el --- Auto Completion for GNU Emacs + +;; Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Tomohiro Matsuyama + +;; Author: Tomohiro Matsuyama +;; URL: http://cx4a.org/software/auto-complete +;; Keywords: completion, convenience +;; Version: 1.4.0 + +;; 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 . + +;;; Commentary: +;; +;; This extension provides a way to complete with popup menu like: +;; +;; def-!- +;; +-----------------+ +;; |defun::::::::::::| +;; |defvar | +;; |defmacro | +;; | ... | +;; +-----------------+ +;; +;; You can complete by typing and selecting menu. +;; +;; Entire documents are located in doc/ directory. +;; Take a look for information. +;; +;; Enjoy! + +;;; Code: + + + +(defconst ac-version "1.4.0") + +(eval-when-compile + (require 'cl)) + +(require 'popup) + +;;;; Global stuff + +(defun ac-error (&optional var) + "Report an error and disable `auto-complete-mode'." + (ignore-errors + (message "auto-complete error: %s" var) + (auto-complete-mode -1) + var)) + + + +;;;; Customization + +(defgroup auto-complete nil + "Auto completion." + :group 'completion + :prefix "ac-") + +(defcustom ac-delay 0.1 + "Delay to completions will be available." + :type 'float + :group 'auto-complete) + +(defcustom ac-auto-show-menu 0.8 + "Non-nil means completion menu will be automatically shown." + :type '(choice (const :tag "Yes" t) + (const :tag "Never" nil) + (float :tag "Timer")) + :group 'auto-complete) + +(defcustom ac-show-menu-immediately-on-auto-complete t + "Non-nil means menu will be showed immediately on `auto-complete'." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-expand-on-auto-complete t + "Non-nil means expand whole common part on first time `auto-complete'." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-disable-faces '(font-lock-comment-face font-lock-string-face font-lock-doc-face) + "Non-nil means disable automatic completion on specified faces." + :type '(repeat symbol) + :group 'auto-complete) + +(defcustom ac-stop-flymake-on-completing t + "Non-nil means disble flymake temporarily on completing." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-flycheck-poll-completion-end-interval 0.5 + "Polling interval to restart automatically flycheck's checking after completion is end." + :type 'float + :group 'auto-complete) + +(defcustom ac-use-fuzzy (and (locate-library "fuzzy") t) + "Non-nil means use fuzzy matching." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-fuzzy-cursor-color "red" + "Cursor color in fuzzy mode." + :type 'string + :group 'auto-complete) + +(defcustom ac-use-comphist t + "Non-nil means use intelligent completion history." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-comphist-threshold 0.7 + "Percentage of ignoring low scored candidates." + :type 'float + :group 'auto-complete) + +(defcustom ac-comphist-file + (expand-file-name (concat (if (boundp 'user-emacs-directory) + user-emacs-directory + "~/.emacs.d/") + "/ac-comphist.dat")) + "Completion history file name." + :type 'string + :group 'auto-complete) + +(defcustom ac-user-dictionary nil + "User defined dictionary" + :type '(repeat string) + :group 'auto-complete) + +(defcustom ac-dictionary-files '("~/.dict") + "Dictionary files." + :type '(repeat string) + :group 'auto-complete) +(defvaralias 'ac-user-dictionary-files 'ac-dictionary-files) + +(defcustom ac-dictionary-directories + (ignore-errors + (when load-file-name + (let ((installed-dir (file-name-directory load-file-name))) + (loop for name in '("ac-dict" "dict") + for dir = (concat installed-dir name) + if (file-directory-p dir) + collect dir)))) + "Dictionary directories." + :type '(repeat string) + :group 'auto-complete) + +(defcustom ac-use-quick-help t + "Non-nil means use quick help." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-quick-help-delay 1.5 + "Delay to show quick help." + :type 'float + :group 'auto-complete) + +(defcustom ac-menu-height 10 + "Max height of candidate menu." + :type 'integer + :group 'auto-complete) +(defvaralias 'ac-candidate-menu-height 'ac-menu-height) + +(defcustom ac-quick-help-height 20 + "Max height of quick help." + :type 'integer + :group 'auto-complete) + +(defcustom ac-quick-help-prefer-pos-tip t + "Prefer native tooltip with pos-tip than overlay popup for displaying quick help." + :type 'boolean + :group 'auto-complete) +(defvaralias 'ac-quick-help-prefer-x 'ac-quick-help-prefer-pos-tip) + +(defcustom ac-candidate-limit nil + "Limit number of candidates. Non-integer means no limit." + :type 'integer + :group 'auto-complete) +(defvaralias 'ac-candidate-max 'ac-candidate-limit) + +(defcustom ac-modes + '(emacs-lisp-mode lisp-mode lisp-interaction-mode + slime-repl-mode + c-mode cc-mode c++-mode go-mode + java-mode malabar-mode clojure-mode clojurescript-mode scala-mode + scheme-mode + ocaml-mode tuareg-mode coq-mode haskell-mode agda-mode agda2-mode + perl-mode cperl-mode python-mode ruby-mode lua-mode tcl-mode + ecmascript-mode javascript-mode js-mode js2-mode php-mode css-mode + makefile-mode sh-mode fortran-mode f90-mode ada-mode + xml-mode sgml-mode + ts-mode + sclang-mode + verilog-mode + qml-mode) + "Major modes `auto-complete-mode' can run on." + :type '(repeat symbol) + :group 'auto-complete) + +(defcustom ac-compatible-packages-regexp + "^ac-" + "Regexp to indicate what packages can work with auto-complete." + :type 'string + :group 'auto-complete) + +(defcustom ac-non-trigger-commands + '(*table--cell-self-insert-command + electric-buffer-list) + "Commands that can't be used as triggers of `auto-complete'." + :type '(repeat symbol) + :group 'auto-complete) + +(defcustom ac-trigger-commands + '(self-insert-command) + "Trigger commands that specify whether `auto-complete' should start or not." + :type '(repeat symbol) + :group 'auto-complete) + +(defcustom ac-trigger-commands-on-completing + '(delete-backward-char + backward-delete-char + backward-delete-char-untabify + ;; autopair + autopair-backspace + ;; paredit + paredit-backward-delete + paredit-backward-delete-word) + "Trigger commands that specify whether `auto-complete' should continue or not." + :type '(repeat symbol) + :group 'auto-complete) + +(defcustom ac-trigger-key nil + "Non-nil means `auto-complete' will start by typing this key. +If you specify this TAB, for example, `auto-complete' will start by typing TAB, +and if there is no completions, an original command will be fallbacked." + :type '(choice (const :tag "None" nil) + (string :tag "Key")) + :group 'auto-complete + :set (lambda (symbol value) + (set-default symbol value) + (when (and value + (fboundp 'ac-set-trigger-key)) + (ac-set-trigger-key value)))) + +(defcustom ac-auto-start 2 + "Non-nil means completion will be started automatically. +Positive integer means if a length of a word you entered is larger than the value, +completion will be started automatically. +If you specify `nil', never be started automatically." + :type '(choice (const :tag "Yes" t) + (const :tag "Never" nil) + (integer :tag "Require")) + :group 'auto-complete) + +(defcustom ac-stop-words nil + "List of string to stop completion." + :type '(repeat string) + :group 'auto-complete) +(defvaralias 'ac-ignores 'ac-stop-words) + +(defcustom ac-use-dictionary-as-stop-words t + "Non-nil means a buffer related dictionary will be thought of as stop words." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-ignore-case 'smart + "Non-nil means auto-complete ignores case. +If this value is `smart', auto-complete ignores case only when +a prefix doen't contain any upper case letters." + :type '(choice (const :tag "Yes" t) + (const :tag "Smart" smart) + (const :tag "No" nil)) + :group 'auto-complete) + +(defcustom ac-dwim t + "Non-nil means `auto-complete' works based on Do What I Mean." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-use-menu-map nil + "Non-nil means a special keymap `ac-menu-map' on completing menu will be used." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-use-overriding-local-map nil + "Non-nil means `overriding-local-map' will be used to hack for overriding key events on auto-completion." + :type 'boolean + :group 'auto-complete) + +(defcustom ac-disable-inline nil + "Non-nil disable inline completion visibility" + :type 'boolean + :group 'auto-complete) + +(defcustom ac-candidate-menu-min 1 + "Number of candidates required to display menu" + :type 'integer + :group 'auto-complete) + +(defcustom ac-max-width nil + "Maximum width for auto-complete menu to have" + :type '(choice (const :tag "No limit" nil) + (const :tag "Character Limit" 25) + (const :tag "Window Ratio Limit" 0.5)) + :group 'auto-complete) + +(defface ac-completion-face + '((t (:foreground "darkgray" :underline t))) + "Face for inline completion" + :group 'auto-complete) + +(defface ac-candidate-face + '((t (:inherit popup-face))) + "Face for candidate." + :group 'auto-complete) + +(defface ac-candidate-mouse-face + '((t (:inherit popup-menu-mouse-face))) + "Mouse face for candidate." + :group 'auto-complete) + +(defface ac-selection-face + '((t (:inherit popup-menu-selection-face))) + "Face for selected candidate." + :group 'auto-complete) + +(defvar auto-complete-mode-hook nil + "Hook for `auto-complete-mode'.") + + + +;;;; Internal variables + +(defvar auto-complete-mode nil + "Dummy variable to suppress compiler warnings.") + +(defvar ac-cursor-color nil + "Old cursor color.") + +(defvar ac-inline nil + "Inline completion instance.") + +(defvar ac-menu nil + "Menu instance.") + +(defvar ac-show-menu nil + "Flag to show menu on timer tick.") + +(defvar ac-last-completion nil + "Cons of prefix marker and selected item of last completion.") + +(defvar ac-quick-help nil + "Quick help instance") + +(defvar ac-completing nil + "Non-nil means `auto-complete-mode' is now working on completion.") + +(defvar ac-buffer nil + "Buffer where auto-complete is started.") + +(defvar ac-point nil + "Start point of prefix.") + +(defvar ac-last-point nil + "Last point of updating pattern.") + +(defvar ac-prefix nil + "Prefix string.") +(defvaralias 'ac-target 'ac-prefix) + +(defvar ac-selected-candidate nil + "Last selected candidate.") + +(defvar ac-common-part nil + "Common part string of meaningful candidates. +If there is no common part, this will be nil.") + +(defvar ac-whole-common-part nil + "Common part string of whole candidates. +If there is no common part, this will be nil.") + +(defvar ac-prefix-overlay nil + "Overlay for prefix string.") + +(defvar ac-timer nil + "Completion idle timer.") + +(defvar ac-show-menu-timer nil + "Show menu idle timer.") + +(defvar ac-quick-help-timer nil + "Quick help idle timer.") + +(defvar ac-triggered nil + "Flag to update.") + +(defvar ac-limit nil + "Limit number of candidates for each sources.") + +(defvar ac-candidates nil + "Current candidates.") + +(defvar ac-candidates-cache nil + "Candidates cache for individual sources.") + +(defvar ac-fuzzy-enable nil + "Non-nil means fuzzy matching is enabled.") + +(defvar ac-dwim-enable nil + "Non-nil means DWIM completion will be allowed.") + +(defvar ac-mode-map (make-sparse-keymap) + "Auto-complete mode map. It is also used for trigger key command. See also `ac-trigger-key'.") + +(defvar ac-completing-map + (let ((map (make-sparse-keymap))) + (define-key map "\t" 'ac-expand) + (define-key map [tab] 'ac-expand) + (define-key map "\r" 'ac-complete) + (define-key map [return] 'ac-complete) + (define-key map (kbd "M-TAB") 'auto-complete) + + (define-key map "\M-n" 'ac-next) + (define-key map "\M-p" 'ac-previous) + (define-key map [down] 'ac-next) + (define-key map [up] 'ac-previous) + + (define-key map [f1] 'ac-help) + (define-key map [M-f1] 'ac-persist-help) + (define-key map (kbd "C-?") 'ac-help) + (define-key map (kbd "C-M-?") 'ac-persist-help) + + (define-key map [C-down] 'ac-quick-help-scroll-down) + (define-key map [C-up] 'ac-quick-help-scroll-up) + (define-key map "\C-\M-n" 'ac-quick-help-scroll-down) + (define-key map "\C-\M-p" 'ac-quick-help-scroll-up) + + (dotimes (i 9) + (let ((symbol (intern (format "ac-complete-select-%d" (1+ i))))) + (fset symbol + `(lambda () + (interactive) + (when (and (ac-menu-live-p) (popup-select ac-menu ,i)) + (ac-complete)))) + (define-key map (read-kbd-macro (format "M-%s" (1+ i))) symbol))) + + map) + "Keymap for completion.") +(defvaralias 'ac-complete-mode-map 'ac-completing-map) + +(defvar ac-menu-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map ac-completing-map) + (define-key map "\C-n" 'ac-next) + (define-key map "\C-p" 'ac-previous) + (define-key map "\C-s" 'ac-isearch) + (define-key map [mouse-1] 'ac-mouse-1) + (define-key map [down-mouse-1] 'ac-ignore) + (define-key map [mouse-4] 'ac-mouse-4) + (define-key map [mouse-5] 'ac-mouse-5) + map) + "Keymap for completion on completing menu.") + +(defvar ac-current-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map ac-completing-map) + map)) + +(defvar ac-match-function 'all-completions + "Default match function.") + +(defvar ac-prefix-definitions + '((symbol . ac-prefix-symbol) + (file . ac-prefix-file) + (valid-file . ac-prefix-valid-file) + (c-dot . ac-prefix-c-dot) + (c-dot-ref . ac-prefix-c-dot-ref) + (cc-member . ac-prefix-cc-member)) + "Prefix definitions for common use.") + +(defvar ac-sources '(ac-source-words-in-same-mode-buffers) + "Sources for completion.") +(make-variable-buffer-local 'ac-sources) + +(defvar ac-compiled-sources nil + "Compiled source of `ac-sources'.") + +(defvar ac-current-sources nil + "Current working sources. This is sublist of `ac-compiled-sources'.") + +(defvar ac-omni-completion-sources nil + "Do not use this anymore.") + +(defvar ac-current-prefix-def nil) + +(defvar ac-ignoring-prefix-def nil) + + + +;;;; Intelligent completion history + +(defvar ac-comphist nil + "Database of completion history.") + +(defsubst ac-comphist-make-tab () + (make-hash-table :test 'equal)) + +(defsubst ac-comphist-tab (db) + (nth 0 db)) + +(defsubst ac-comphist-cache (db) + (nth 1 db)) + +(defun ac-comphist-make (&optional tab) + (list (or tab (ac-comphist-make-tab)) (make-hash-table :test 'equal :weakness t))) + +(defun ac-comphist-get (db string &optional create) + (let* ((tab (ac-comphist-tab db)) + (index (gethash string tab))) + (when (and create (null index)) + (setq index (make-vector (length string) 0)) + (puthash string index tab)) + index)) + +(defun ac-comphist-add (db string prefix) + (setq prefix (min prefix (1- (length string)))) + (when (<= 0 prefix) + (setq string (substring-no-properties string)) + (let ((stat (ac-comphist-get db string t))) + (incf (aref stat prefix)) + (remhash string (ac-comphist-cache db))))) + +(defun ac-comphist-score (db string prefix) + (setq prefix (min prefix (1- (length string)))) + (if (<= 0 prefix) + (let ((cache (gethash string (ac-comphist-cache db)))) + (or (and cache (aref cache prefix)) + (let ((stat (ac-comphist-get db string)) + (score 0.0)) + (when stat + (loop for p from 0 below (length string) + ;; sigmoid function + with a = 5 + with b = (/ 700.0 a) ; bounds for avoiding range error in `exp' + with d = (/ 6.0 a) + for x = (max (- b) (min b (- d (abs (- prefix p))))) + for r = (/ 1.0 (1+ (exp (* (- a) x)))) + do + (incf score (* (aref stat p) r)))) + ;; Weight by distance + (incf score (max 0.0 (- 0.3 (/ (- (length string) prefix) 100.0)))) + (unless cache + (setq cache (make-vector (length string) nil)) + (puthash string cache (ac-comphist-cache db))) + (aset cache prefix score) + score))) + 0.0)) + +(defun ac-comphist-sort (db collection prefix &optional threshold) + (let (result + (n 0) + (total 0) + (cur 0)) + (setq result (mapcar (lambda (a) + (when (and cur threshold) + (if (>= cur (* total threshold)) + (setq cur nil) + (incf n) + (incf cur (cdr a)))) + (car a)) + (sort (mapcar (lambda (string) + (let ((score (ac-comphist-score db string prefix))) + (incf total score) + (cons string score))) + collection) + (lambda (a b) (< (cdr b) (cdr a)))))) + (if threshold + (cons n result) + result))) + +(defun ac-comphist-serialize (db) + (let (alist) + (maphash (lambda (k v) + (push (cons k v) alist)) + (ac-comphist-tab db)) + (list alist))) + +(defun ac-comphist-deserialize (sexp) + (condition-case nil + (ac-comphist-make (let ((tab (ac-comphist-make-tab))) + (mapc (lambda (cons) + (puthash (car cons) (cdr cons) tab)) + (nth 0 sexp)) + tab)) + (error (message "Invalid comphist db.") nil))) + +(defun ac-comphist-init () + (ac-comphist-load) + (add-hook 'kill-emacs-hook 'ac-comphist-save)) + +(defun ac-comphist-load () + (interactive) + (let ((db (if (file-exists-p ac-comphist-file) + (ignore-errors + (with-temp-buffer + (insert-file-contents ac-comphist-file) + (goto-char (point-min)) + (ac-comphist-deserialize (read (current-buffer)))))))) + (setq ac-comphist (or db (ac-comphist-make))))) + +(defun ac-comphist-save () + (interactive) + (require 'pp) + (ignore-errors + (with-temp-buffer + (pp (ac-comphist-serialize ac-comphist) (current-buffer)) + (write-region (point-min) (point-max) ac-comphist-file)))) + + + +;;;; Dictionary +(defvar ac-buffer-dictionary nil) +(defvar ac-file-dictionary (make-hash-table :test 'equal)) + +(defun ac-clear-dictionary-cache () + (interactive) + (dolist (buffer (buffer-list)) + (with-current-buffer buffer + (if (local-variable-p 'ac-buffer-dictionary) + (kill-local-variable 'ac-buffer-dictionary)))) + (clrhash ac-file-dictionary)) + +(defun ac-file-dictionary (filename) + (let ((cache (gethash filename ac-file-dictionary 'none))) + (if (and cache (not (eq cache 'none))) + cache + (let (result) + (ignore-errors + (with-temp-buffer + (insert-file-contents filename) + (setq result (split-string (buffer-string) "\n" t)))) + (puthash filename result ac-file-dictionary) + result)))) + +(defun ac-mode-dictionary (mode) + (loop for name in (cons (symbol-name mode) + (ignore-errors (list (file-name-extension (buffer-file-name))))) + append (loop for dir in ac-dictionary-directories + for file = (concat dir "/" name) + if (file-exists-p file) + append (ac-file-dictionary file)))) + +(defun ac-buffer-dictionary (&optional buffer) + (with-current-buffer (or buffer (current-buffer)) + (if (local-variable-p 'ac-buffer-dictionary) + ac-buffer-dictionary + (make-local-variable 'ac-buffer-dictionary) + (setq ac-buffer-dictionary + (apply 'append + ac-user-dictionary + (ac-mode-dictionary major-mode) + (mapcar 'ac-file-dictionary ac-dictionary-files)))))) + + + +;;;; Auto completion internals + +(defun ac-menu-at-wrapper-line-p () + "Return non-nil if current line is long and wrapped to next visual line." + (and (not truncate-lines) + (eq (line-beginning-position) + (save-excursion + (vertical-motion 1) + (line-beginning-position))))) + +(defun ac-stop-word-p (word) + (or (member word ac-stop-words) + (if ac-use-dictionary-as-stop-words + (member word (ac-buffer-dictionary))))) + +(defun ac-prefix-default () + "Same as `ac-prefix-symbol' but ignore a number prefix." + (let ((start (ac-prefix-symbol))) + (when start + (loop with end = (point) + for pos from start below end + for c = (char-after pos) + if (not (and (<= ?0 c) (<= c ?9))) + return start)))) + +(defun ac-prefix-symbol () + "Default prefix definition function." + (require 'thingatpt) + (car-safe (bounds-of-thing-at-point 'symbol))) + +(defun ac-prefix-file () + "File prefix." + (let ((point (re-search-backward "[\"<>' \t\r\n]" nil t))) + (if point (1+ point)))) + +(defsubst ac-windows-remote-file-p (file) + (and (memq system-type '(ms-dos windows-nt cygwin)) + (string-match-p "\\`\\(?://\\|\\\\\\\\\\)" file))) + +(defun ac-prefix-valid-file () + "Existed (or to be existed) file prefix." + (let* ((line-beg (line-beginning-position)) + (end (point)) + (start (or (let ((point (re-search-backward "[\"<>'= \t\r\n]" line-beg t))) + (if point (1+ point))) + line-beg)) + (file (buffer-substring start end))) + (if (and file (or (string-match "^/" file) + (and (setq file (and (string-match "^[^/]*/" file) + (match-string 0 file))) + (file-directory-p file)))) + (unless (ac-windows-remote-file-p file) + start)))) + +(defun ac-prefix-c-dot () + "C-like languages dot(.) prefix." + (if (re-search-backward "\\.\\(\\(?:[a-zA-Z0-9][_a-zA-Z0-9]*\\)?\\)\\=" nil t) + (match-beginning 1))) + +(defun ac-prefix-c-dot-ref () + "C-like languages dot(.) and reference(->) prefix." + (if (re-search-backward "\\(?:\\.\\|->\\)\\(\\(?:[a-zA-Z0-9][_a-zA-Z0-9]*\\)?\\)\\=" nil t) + (match-beginning 1))) + +(defun ac-prefix-cc-member () + "C-like languages member(.)(->)(::) prefix." + (when (re-search-backward "\\(?:\\.\\|->\\|::\\)\\(\\(?:[a-zA-Z0-9][_a-zA-Z0-9]*\\)?\\)\\=" nil t) + (match-beginning 1))) + +(defun ac-define-prefix (name prefix) + "Define new prefix definition. +You can not use it in source definition like (prefix . `NAME')." + (push (cons name prefix) ac-prefix-definitions)) + +(defun ac-match-substring (prefix candidates) + (loop with regexp = (regexp-quote prefix) + for candidate in candidates + if (string-match regexp candidate) + collect candidate)) + +(defsubst ac-source-entity (source) + (if (symbolp source) + (symbol-value source) + source)) + +(defun ac-source-available-p (source) + (if (and (symbolp source) + (get source 'available)) + (eq (get source 'available) t) + (let* ((src (ac-source-entity source)) + (avail-pair (assq 'available src)) + (avail-cond (cdr avail-pair)) + (available (and (if avail-pair + (cond + ((symbolp avail-cond) + (funcall avail-cond)) + ((listp avail-cond) + (eval avail-cond))) + t) + (loop for feature in (assoc-default 'depends src) + unless (require feature nil t) return nil + finally return t)))) + (if (symbolp source) + (put source 'available (if available t 'no))) + available))) + +(defun ac-compile-sources (sources) + "Compiled `SOURCES' into expanded sources style." + (loop for source in sources + if (ac-source-available-p source) + do + (setq source (ac-source-entity source)) + ;; prefix + (let* ((prefix (assoc 'prefix source)) + (real (assoc-default (cdr prefix) ac-prefix-definitions))) + (cond + (real + (add-to-list 'source (cons 'prefix real))) + ((null prefix) + (add-to-list 'source (cons 'prefix 'ac-prefix-default))))) + ;; match + (let ((match (assq 'match source))) + (cond + ((eq (cdr match) 'substring) + (setcdr match 'ac-match-substring)))) + and collect source)) + +(defun ac-compiled-sources () + (or ac-compiled-sources + (setq ac-compiled-sources + (ac-compile-sources ac-sources)))) + +(defsubst ac-menu-live-p () + (popup-live-p ac-menu)) + +(defun ac-menu-create (point width height) + (setq ac-menu + (popup-create point width height + :around t + :face 'ac-candidate-face + :max-width ac-max-width + :mouse-face 'ac-candidate-mouse-face + :selection-face 'ac-selection-face + :symbol t + :scroll-bar t + :margin-left 1 + :keymap ac-menu-map + ))) + +(defun ac-menu-delete () + (when ac-menu + (popup-delete ac-menu) + (setq ac-menu))) + +(defsubst ac-inline-overlay () + (nth 0 ac-inline)) + +(defsubst ac-inline-live-p () + (and ac-inline (ac-inline-overlay) t)) + +(defun ac-inline-show (point string) + (unless ac-inline + (setq ac-inline (list nil))) + (save-excursion + (let ((overlay (ac-inline-overlay)) + (width 0) + (string-width (string-width string)) + (length 0) + (original-string string)) + ;; Calculate string space to show completion + (goto-char point) + (let (c) + (while (and (not (eolp)) + (< width string-width) + (setq c (char-after)) + (not (eq c ?\t))) ; special case for tab + (incf width (char-width c)) + (incf length) + (forward-char))) + + ;; Show completion + (goto-char point) + (cond + ((= width 0) + ;; End-of-line + ;; Do nothing + ) + ((<= width string-width) + ;; No space to show + ;; Do nothing + ) + ((> width string-width) + ;; Need to fill space + (setq string (concat string (make-string (- width string-width) ? ))))) + (setq string (propertize string 'face 'ac-completion-face)) + (if overlay + (progn + (move-overlay overlay point (+ point length)) + (overlay-put overlay 'invisible nil)) + (setq overlay (make-overlay point (+ point length))) + (setf (nth 0 ac-inline) overlay) + (overlay-put overlay 'priority 9999) + ;; Help prefix-overlay in some cases + (overlay-put overlay 'keymap ac-current-map)) + ;; TODO no width but char + (if (eq length 0) + ;; Case: End-of-line + (progn + (put-text-property 0 1 'cursor t string) + (overlay-put overlay 'after-string string)) + (let ((display (substring string 0 1)) + (after-string (substring string 1))) + (overlay-put overlay 'display display) + (overlay-put overlay 'after-string after-string))) + (overlay-put overlay 'string original-string)))) + +(defun ac-inline-delete () + (when (ac-inline-live-p) + (ac-inline-hide) + (delete-overlay (ac-inline-overlay)) + (setq ac-inline nil))) + +(defun ac-inline-hide () + (when (ac-inline-live-p) + (let ((overlay (ac-inline-overlay)) + (buffer-undo-list t)) + (when overlay + (move-overlay overlay (point-min) (point-min)) + (overlay-put overlay 'invisible t) + (overlay-put overlay 'display nil) + (overlay-put overlay 'after-string nil))))) + +(defun ac-inline-update () + (if (and ac-completing ac-prefix (stringp ac-common-part)) + (let ((common-part-length (length ac-common-part)) + (prefix-length (length ac-prefix))) + (if (> common-part-length prefix-length) + (progn + (ac-inline-hide) + (ac-inline-show (point) (substring ac-common-part prefix-length))) + (ac-inline-delete))) + (ac-inline-delete))) + +(defun ac-put-prefix-overlay () + (unless ac-prefix-overlay + (let (newline) + ;; Insert newline to make sure that cursor always on the overlay + (when (eobp) + (popup-save-buffer-state + (insert "\n")) + (setq newline t)) + (setq ac-prefix-overlay (make-overlay ac-point (1+ (point)) nil t t)) + (overlay-put ac-prefix-overlay 'priority 9999) + (overlay-put ac-prefix-overlay 'keymap (make-sparse-keymap)) + (overlay-put ac-prefix-overlay 'newline newline)))) + +(defun ac-remove-prefix-overlay () + (when ac-prefix-overlay + (when (overlay-get ac-prefix-overlay 'newline) + ;; Remove inserted newline + (popup-save-buffer-state + (goto-char (point-max)) + (if (eq (char-before) ?\n) + (delete-char -1)))) + (delete-overlay ac-prefix-overlay))) + +(defun ac-activate-completing-map () + (if (and ac-show-menu ac-use-menu-map) + (set-keymap-parent ac-current-map ac-menu-map)) + (when (and ac-use-overriding-local-map + (null overriding-terminal-local-map)) + (setq overriding-terminal-local-map ac-current-map)) + (when ac-prefix-overlay + (set-keymap-parent (overlay-get ac-prefix-overlay 'keymap) ac-current-map))) + +(defun ac-deactivate-completing-map () + (set-keymap-parent ac-current-map ac-completing-map) + (when (and ac-use-overriding-local-map + (eq overriding-terminal-local-map ac-current-map)) + (setq overriding-terminal-local-map nil)) + (when ac-prefix-overlay + (set-keymap-parent (overlay-get ac-prefix-overlay 'keymap) nil))) + +(defsubst ac-selected-candidate () + (if ac-menu + (popup-selected-item ac-menu))) + +(defun ac-prefix (requires ignore-list) + (loop with current = (point) + with point + with prefix-def + with sources + for source in (ac-compiled-sources) + for prefix = (assoc-default 'prefix source) + for req = (or (assoc-default 'requires source) requires 1) + + if (null prefix-def) + do + (unless (member prefix ignore-list) + (save-excursion + (setq point (cond + ((symbolp prefix) + (funcall prefix)) + ((stringp prefix) + (and (re-search-backward (concat prefix "\\=") nil t) + (or (match-beginning 1) (match-beginning 0)))) + ((stringp (car-safe prefix)) + (let ((regexp (nth 0 prefix)) + (end (nth 1 prefix)) + (group (nth 2 prefix))) + (and (re-search-backward (concat regexp "\\=") nil t) + (funcall (if end 'match-end 'match-beginning) + (or group 0))))) + (t + (eval prefix)))) + (if (and point + (integerp req) + (< (- current point) req)) + (setq point nil)) + (if point + (setq prefix-def prefix)))) + + if (equal prefix prefix-def) do (push source sources) + + finally return + (and point (list prefix-def point (nreverse sources))))) + +(defun ac-init () + "Initialize current sources to start completion." + (setq ac-candidates-cache nil) + (loop for source in ac-current-sources + for function = (assoc-default 'init source) + if function do + (save-excursion + (cond + ((functionp function) + (funcall function)) + (t + (eval function)))))) + +(defun ac-candidates-1 (source) + (let* ((do-cache (assq 'cache source)) + (function (assoc-default 'candidates source)) + (action (assoc-default 'action source)) + (document (assoc-default 'document source)) + (symbol (assoc-default 'symbol source)) + (ac-limit (or (assoc-default 'limit source) ac-limit)) + (face (or (assoc-default 'face source) (assoc-default 'candidate-face source))) + (selection-face (assoc-default 'selection-face source)) + (cache (and do-cache (assq source ac-candidates-cache))) + (candidates (cdr cache))) + (unless cache + (setq candidates (save-excursion + (cond + ((functionp function) + (funcall function)) + (t + (eval function))))) + ;; Convert (name value) format candidates into name with text properties. + (setq candidates (mapcar (lambda (candidate) + (if (consp candidate) + (propertize (car candidate) 'value (cdr candidate)) + candidate)) + candidates)) + (when do-cache + (push (cons source candidates) ac-candidates-cache))) + (setq candidates (funcall (or (assoc-default 'match source) + ac-match-function) + ac-prefix candidates)) + ;; Remove extra items regarding to ac-limit + (if (and (integerp ac-limit) (> ac-limit 1) (> (length candidates) ac-limit)) + (setcdr (nthcdr (1- ac-limit) candidates) nil)) + ;; Put candidate properties + (setq candidates (mapcar (lambda (candidate) + (popup-item-propertize candidate + 'action action + 'symbol symbol + 'document document + 'popup-face face + 'selection-face selection-face)) + candidates)) + candidates)) + +(defun ac-candidates () + "Produce candidates for current sources." + (loop with completion-ignore-case = (or (eq ac-ignore-case t) + (and (eq ac-ignore-case 'smart) + (let ((case-fold-search nil)) (not (string-match "[[:upper:]]" ac-prefix))))) + with case-fold-search = completion-ignore-case + with prefix-len = (length ac-prefix) + for source in ac-current-sources + append (ac-candidates-1 source) into candidates + finally return + (progn + (delete-dups candidates) + (if (and ac-use-comphist ac-comphist) + (if ac-show-menu + (let* ((pair (ac-comphist-sort ac-comphist candidates prefix-len ac-comphist-threshold)) + (n (car pair)) + (result (cdr pair)) + (cons (if (> n 0) (nthcdr (1- n) result))) + (cdr (cdr cons))) + (if cons (setcdr cons nil)) + (setq ac-common-part (try-completion ac-prefix result)) + (setq ac-whole-common-part (try-completion ac-prefix candidates)) + (if cons (setcdr cons cdr)) + result) + (setq candidates (ac-comphist-sort ac-comphist candidates prefix-len)) + (setq ac-common-part (if candidates (popup-x-to-string (car candidates)))) + (setq ac-whole-common-part (try-completion ac-prefix candidates)) + candidates) + (setq ac-common-part (try-completion ac-prefix candidates)) + (setq ac-whole-common-part ac-common-part) + candidates)))) + +(defun ac-update-candidates (cursor scroll-top) + "Update candidates of menu to `ac-candidates' and redraw it." + (setf (popup-cursor ac-menu) cursor + (popup-scroll-top ac-menu) scroll-top) + (setq ac-dwim-enable (= (length ac-candidates) 1)) + (if ac-candidates + (progn + (setq ac-completing t) + (ac-activate-completing-map)) + (setq ac-completing nil) + (ac-deactivate-completing-map)) + (unless ac-disable-inline + (ac-inline-update)) + (popup-set-list ac-menu ac-candidates) + (if (and (not ac-fuzzy-enable) + (<= (length ac-candidates) ac-candidate-menu-min)) + (popup-hide ac-menu) + (if ac-show-menu + (popup-draw ac-menu)))) + +(defun ac-reposition () + "Force to redraw candidate menu with current `ac-candidates'." + (let ((cursor (popup-cursor ac-menu)) + (scroll-top (popup-scroll-top ac-menu)) + (height (popup-height ac-menu))) + (ac-menu-delete) + (ac-menu-create ac-point (popup-preferred-width ac-candidates) height) + (ac-update-candidates cursor scroll-top))) + +(defun ac-cleanup () + "Cleanup auto completion." + (if ac-cursor-color + (set-cursor-color ac-cursor-color)) + (when (and ac-use-comphist ac-comphist) + (when (and (null ac-selected-candidate) + (member ac-prefix ac-candidates)) + ;; Assume candidate is selected by just typing + (setq ac-selected-candidate ac-prefix) + (setq ac-last-point ac-point)) + (when ac-selected-candidate + (ac-comphist-add ac-comphist + ac-selected-candidate + (if ac-last-point + (- ac-last-point ac-point) + (length ac-prefix))))) + (ac-deactivate-completing-map) + (ac-remove-prefix-overlay) + (ac-remove-quick-help) + (ac-inline-delete) + (ac-menu-delete) + (ac-cancel-timer) + (ac-cancel-show-menu-timer) + (ac-cancel-quick-help-timer) + (setq ac-cursor-color nil + ac-inline nil + ac-show-menu nil + ac-menu nil + ac-completing nil + ac-point nil + ac-last-point nil + ac-prefix nil + ac-prefix-overlay nil + ac-selected-candidate nil + ac-common-part nil + ac-whole-common-part nil + ac-triggered nil + ac-limit nil + ac-candidates nil + ac-candidates-cache nil + ac-fuzzy-enable nil + ac-dwim-enable nil + ac-compiled-sources nil + ac-current-sources nil + ac-current-prefix-def nil + ac-ignoring-prefix-def nil)) + +(defsubst ac-abort () + "Abort completion." + (ac-cleanup)) + +(defun ac-expand-string (string &optional remove-undo-boundary) + "Expand `STRING' into the buffer and update `ac-prefix' to `STRING'. +This function records deletion and insertion sequences by `undo-boundary'. +If `remove-undo-boundary' is non-nil, this function also removes `undo-boundary' +that have been made before in this function. When `buffer-undo-list' is +`t', `remove-undo-boundary' has no effect." + (when (eq buffer-undo-list t) + (setq remove-undo-boundary nil)) + (when (not (equal string (buffer-substring ac-point (point)))) + (undo-boundary) + ;; We can't use primitive-undo since it undoes by + ;; groups, divided by boundaries. + ;; We don't want boundary between deletion and insertion. + ;; So do it manually. + ;; Delete region silently for undo: + (if remove-undo-boundary + (progn + (let (buffer-undo-list) + (save-excursion + (delete-region ac-point (point)))) + (setq buffer-undo-list + (nthcdr 2 buffer-undo-list))) + (delete-region ac-point (point))) + (insert (substring-no-properties string)) + ;; Sometimes, possible when omni-completion used, (insert) added + ;; to buffer-undo-list strange record about position changes. + ;; Delete it here: + (when (and remove-undo-boundary + (integerp (cadr buffer-undo-list))) + (setcdr buffer-undo-list (nthcdr 2 buffer-undo-list))) + (undo-boundary) + (setq ac-selected-candidate string) + (setq ac-prefix string))) + +(defun ac-set-trigger-key (key) + "Set `ac-trigger-key' to `KEY'. It is recommemded to use this function instead of calling `setq'." + ;; Remove old mapping + (when ac-trigger-key + (define-key ac-mode-map (read-kbd-macro ac-trigger-key) nil)) + + ;; Make new mapping + (setq ac-trigger-key key) + (when key + (define-key ac-mode-map (read-kbd-macro key) 'ac-trigger-key-command))) + +(defun ac-set-timer () + (unless ac-timer + (setq ac-timer (run-with-idle-timer ac-delay ac-delay 'ac-update-greedy)))) + +(defun ac-cancel-timer () + (when (timerp ac-timer) + (cancel-timer ac-timer) + (setq ac-timer nil))) + +(defun ac-update (&optional force) + (when (and auto-complete-mode + ac-prefix + (or ac-triggered + force) + (not isearch-mode)) + (ac-put-prefix-overlay) + (setq ac-candidates (ac-candidates)) + (let ((preferred-width (popup-preferred-width ac-candidates))) + ;; Reposition if needed + (when (or (null ac-menu) + (>= (popup-width ac-menu) preferred-width) + (<= (popup-width ac-menu) (- preferred-width 10)) + (and (> (popup-direction ac-menu) 0) + (ac-menu-at-wrapper-line-p))) + (ac-inline-hide) ; Hide overlay to calculate correct column + (ac-remove-quick-help) + (ac-menu-delete) + (ac-menu-create ac-point preferred-width ac-menu-height))) + (ac-update-candidates 0 0) + t)) + +(defun ac-update-greedy (&optional force) + (let (result) + (while (when (and (setq result (ac-update force)) + (null ac-candidates)) + (add-to-list 'ac-ignoring-prefix-def ac-current-prefix-def) + (ac-start :force-init t) + ac-current-prefix-def)) + result)) + +(defun ac-set-show-menu-timer () + (when (and (or (integerp ac-auto-show-menu) (floatp ac-auto-show-menu)) + (null ac-show-menu-timer)) + (setq ac-show-menu-timer (run-with-idle-timer ac-auto-show-menu ac-auto-show-menu 'ac-show-menu)))) + +(defun ac-cancel-show-menu-timer () + (when (timerp ac-show-menu-timer) + (cancel-timer ac-show-menu-timer) + (setq ac-show-menu-timer nil))) + +(defun ac-show-menu () + (when (not (eq ac-show-menu t)) + (setq ac-show-menu t) + (ac-inline-hide) + (ac-remove-quick-help) + (ac-update t))) + +(defun ac-help (&optional persist) + (interactive "P") + (when ac-menu + (popup-menu-show-help ac-menu persist))) + +(defun ac-persist-help () + (interactive) + (ac-help t)) + +(defun ac-last-help (&optional persist) + (interactive "P") + (when ac-last-completion + (popup-item-show-help (cdr ac-last-completion) persist))) + +(defun ac-last-persist-help () + (interactive) + (ac-last-help t)) + +(defun ac-set-quick-help-timer () + (when (and ac-use-quick-help + (null ac-quick-help-timer)) + (setq ac-quick-help-timer (run-with-idle-timer ac-quick-help-delay ac-quick-help-delay 'ac-quick-help)))) + +(defun ac-cancel-quick-help-timer () + (when (timerp ac-quick-help-timer) + (cancel-timer ac-quick-help-timer) + (setq ac-quick-help-timer nil))) + +(defun ac-pos-tip-show-quick-help (menu &optional item &rest args) + (let* ((point (plist-get args :point)) + (around nil) + (parent-offset (popup-offset menu)) + (doc (popup-menu-documentation menu item))) + (when (stringp doc) + (if (popup-hidden-p menu) + (setq around t) + (setq point nil)) + (with-no-warnings + (pos-tip-show doc + 'popup-tip-face + (or point + (and menu + (popup-child-point menu parent-offset)) + (point)) + nil 300 + popup-tip-max-width + nil nil + (and (not around) 0)) + (unless (plist-get args :nowait) + (clear-this-command-keys) + (unwind-protect + (push (read-event (plist-get args :prompt)) unread-command-events) + (pos-tip-hide)) + t))))) + +(defun ac-quick-help-use-pos-tip-p () + (and ac-quick-help-prefer-pos-tip + window-system + (featurep 'pos-tip))) + +(defun ac-quick-help (&optional force) + (interactive) + ;; TODO don't use FORCE + (when (and (or force + (with-no-warnings + ;; called-interactively-p can take no args + (called-interactively-p)) + ;; ac-isearch'ing + (null this-command)) + (ac-menu-live-p) + (null ac-quick-help)) + (setq ac-quick-help + (funcall (if (ac-quick-help-use-pos-tip-p) + 'ac-pos-tip-show-quick-help + 'popup-menu-show-quick-help) + ac-menu nil + :point ac-point + :height ac-quick-help-height + :nowait t)))) + +(defun ac-remove-quick-help () + (when (ac-quick-help-use-pos-tip-p) + (with-no-warnings + (pos-tip-hide))) + (when ac-quick-help + (popup-delete ac-quick-help) + (setq ac-quick-help nil))) + +(defun ac-last-quick-help () + (interactive) + (when (and ac-last-completion + (eq (marker-buffer (car ac-last-completion)) + (current-buffer))) + (let ((doc (popup-item-documentation (cdr ac-last-completion))) + (point (marker-position (car ac-last-completion)))) + (when (stringp doc) + (if (ac-quick-help-use-pos-tip-p) + (with-no-warnings (pos-tip-show doc nil point nil 300)) + (popup-tip doc + :point point + :around t + :scroll-bar t + :margin t)))))) + +(defmacro ac-define-quick-help-command (name arglist &rest body) + (declare (indent 2)) + `(progn + (defun ,name ,arglist ,@body) + (put ',name 'ac-quick-help-command t))) + +(ac-define-quick-help-command ac-quick-help-scroll-down () + (interactive) + (when ac-quick-help + (popup-scroll-down ac-quick-help))) + +(ac-define-quick-help-command ac-quick-help-scroll-up () + (interactive) + (when ac-quick-help + (popup-scroll-up ac-quick-help))) + + + +;;;; Auto completion isearch + +(defun ac-isearch-callback (list) + (setq ac-dwim-enable (eq (length list) 1))) + +(defun ac-isearch () + (interactive) + (when (ac-menu-live-p) + (ac-cancel-show-menu-timer) + (ac-show-menu) + (if ac-use-quick-help + (let ((popup-menu-show-quick-help-function + (if (ac-quick-help-use-pos-tip-p) + 'ac-pos-tip-show-quick-help + 'popup-menu-show-quick-help))) + (popup-isearch ac-menu + :callback 'ac-isearch-callback + :help-delay ac-quick-help-delay)) + (popup-isearch ac-menu :callback 'ac-isearch-callback)))) + + + +;;;; Auto completion commands + +(defun* auto-complete-1 (&key sources (triggered 'command)) + (let ((menu-live (ac-menu-live-p)) + (inline-live (ac-inline-live-p)) + started) + (ac-abort) + (let ((ac-sources (or sources ac-sources))) + (if (or ac-show-menu-immediately-on-auto-complete + inline-live) + (setq ac-show-menu t)) + (setq started (ac-start :triggered triggered))) + (when (ac-update-greedy t) + ;; TODO Not to cause inline completion to be disrupted. + (if (ac-inline-live-p) + (ac-inline-hide)) + ;; Not to expand when it is first time to complete + (when (and (or (and (not ac-expand-on-auto-complete) + (> (length ac-candidates) 1) + (not menu-live)) + (not (let ((ac-common-part ac-whole-common-part)) + (ac-expand-common)))) + ac-use-fuzzy + (null ac-candidates)) + (ac-fuzzy-complete))) + started)) + +;;;###autoload +(defun auto-complete (&optional sources) + "Start auto-completion at current point." + (interactive) + (auto-complete-1 :sources sources)) + +(defun ac-fuzzy-complete () + "Start fuzzy completion at current point." + (interactive) + (if (not (require 'fuzzy nil t)) + (message "Please install fuzzy.el if you use fuzzy completion") + (unless (ac-menu-live-p) + (ac-start)) + (let ((ac-match-function 'fuzzy-all-completions)) + (unless ac-cursor-color + (setq ac-cursor-color (frame-parameter (selected-frame) 'cursor-color))) + (if ac-fuzzy-cursor-color + (set-cursor-color ac-fuzzy-cursor-color)) + (setq ac-show-menu t) + (setq ac-fuzzy-enable t) + (setq ac-triggered nil) + (ac-update t))) + t) + +(defun ac-next () + "Select next candidate." + (interactive) + (when (ac-menu-live-p) + (when (popup-hidden-p ac-menu) + (ac-show-menu)) + (popup-next ac-menu) + (if (eq this-command 'ac-next) + (setq ac-dwim-enable t)))) + +(defun ac-previous () + "Select previous candidate." + (interactive) + (when (ac-menu-live-p) + (when (popup-hidden-p ac-menu) + (ac-show-menu)) + (popup-previous ac-menu) + (if (eq this-command 'ac-previous) + (setq ac-dwim-enable t)))) + +(defun ac-expand () + "Try expand, and if expanded twice, select next candidate." + (interactive) + (unless (ac-expand-common) + (let ((string (ac-selected-candidate))) + (when string + (when (equal ac-prefix string) + (ac-next) + (setq string (ac-selected-candidate))) + (ac-expand-string string (eq last-command this-command)) + ;; Do reposition if menu at long line + (if (and (> (popup-direction ac-menu) 0) + (ac-menu-at-wrapper-line-p)) + (ac-reposition)) + (setq ac-show-menu t) + string)))) + +(defun ac-expand-common () + "Try to expand meaningful common part." + (interactive) + (if (and ac-dwim ac-dwim-enable) + (ac-complete) + (when (and (ac-inline-live-p) + ac-common-part) + (ac-inline-hide) + (ac-expand-string ac-common-part (eq last-command this-command)) + (setq ac-common-part nil) + t))) + +(defun ac-complete-1 (candidate) + (let ((action (popup-item-property candidate 'action)) + (fallback nil)) + (when candidate + (unless (ac-expand-string candidate) + (setq fallback t)) + ;; Remember to show help later + (when (and ac-point candidate) + (unless ac-last-completion + (setq ac-last-completion (cons (make-marker) nil))) + (set-marker (car ac-last-completion) ac-point ac-buffer) + (setcdr ac-last-completion candidate))) + (ac-abort) + (cond + (action + (funcall action)) + (fallback + (ac-fallback-command))) + candidate)) + +(defun ac-complete () + "Try complete." + (interactive) + (ac-complete-1 (ac-selected-candidate))) + +(defun* ac-start (&key + requires + force-init + (triggered (or ac-triggered t))) + "Start completion." + (interactive) + (if (not auto-complete-mode) + (message "auto-complete-mode is not enabled") + (let* ((info (ac-prefix requires ac-ignoring-prefix-def)) + (prefix-def (nth 0 info)) + (point (nth 1 info)) + (sources (nth 2 info)) + prefix + (init (or force-init (not (eq ac-point point))))) + (if (or (null point) + (progn + (setq prefix (buffer-substring-no-properties point (point))) + (and (not (eq triggered 'command)) + (ac-stop-word-p prefix)))) + (prog1 nil + (ac-abort)) + (unless ac-cursor-color + (setq ac-cursor-color (frame-parameter (selected-frame) 'cursor-color))) + (setq ac-show-menu (or ac-show-menu (if (eq ac-auto-show-menu t) t)) + ac-current-sources sources + ac-buffer (current-buffer) + ac-point point + ac-prefix prefix + ac-limit ac-candidate-limit + ac-triggered triggered + ac-current-prefix-def prefix-def) + (when (or init (null ac-prefix-overlay)) + (ac-init)) + (ac-set-timer) + (ac-set-show-menu-timer) + (ac-set-quick-help-timer) + (ac-put-prefix-overlay) + t)))) + +(defun ac-stop () + "Stop completiong." + (interactive) + (setq ac-selected-candidate nil) + (ac-abort)) + +(defun ac-ignore (&rest ignore) + "Same as `ignore'." + (interactive)) + +(defun ac-mouse-1 (event) + (interactive "e") + (popup-awhen (popup-menu-item-of-mouse-event event) + (ac-complete-1 it))) + +(defun ac-mouse-4 (event) + (interactive "e") + (ac-previous)) + +(defun ac-mouse-5 (event) + (interactive "e") + (ac-next)) + +(defun ac-trigger-key-command (&optional force) + (interactive "P") + (let (started) + (when (or force (ac-trigger-command-p last-command)) + (setq started (auto-complete-1 :triggered 'trigger-key))) + (unless started + (ac-fallback-command 'ac-trigger-key-command)))) + + + +;;;; Basic cache facility + +(defvar ac-clear-variables-every-minute-timer nil) +(defvar ac-clear-variables-after-save nil) +(defvar ac-clear-variables-every-minute nil) +(defvar ac-minutes-counter 0) + +(defun ac-clear-variable-after-save (variable &optional pred) + (add-to-list 'ac-clear-variables-after-save (cons variable pred))) + +(defun ac-clear-variables-after-save () + (dolist (pair ac-clear-variables-after-save) + (if (or (null (cdr pair)) + (funcall (cdr pair))) + (set (car pair) nil)))) + +(defun ac-clear-variable-every-minutes (variable minutes) + (add-to-list 'ac-clear-variables-every-minute (cons variable minutes))) + +(defun ac-clear-variable-every-minute (variable) + (ac-clear-variable-every-minutes variable 1)) + +(defun ac-clear-variable-every-10-minutes (variable) + (ac-clear-variable-every-minutes variable 10)) + +(defun ac-clear-variables-every-minute () + (incf ac-minutes-counter) + (dolist (pair ac-clear-variables-every-minute) + (if (eq (% ac-minutes-counter (cdr pair)) 0) + (set (car pair) nil)))) + + + +;;;; Auto complete mode + +(defun ac-cursor-on-diable-face-p (&optional point) + (memq (get-text-property (or point (point)) 'face) ac-disable-faces)) + +(defun ac-trigger-command-p (command) + "Return non-nil if `COMMAND' is a trigger command." + (and (symbolp command) + (not (memq command ac-non-trigger-commands)) + (or (memq command ac-trigger-commands) + (string-match "self-insert-command" (symbol-name command)) + (string-match "electric" (symbol-name command))))) + +(defun ac-fallback-key-sequence () + (setq unread-command-events + (append (this-single-command-raw-keys) + unread-command-events)) + (read-key-sequence-vector "")) + +(defun ac-fallback-command (&optional except-command) + (let* ((auto-complete-mode nil) + (keys (ac-fallback-key-sequence)) + (command (and keys (key-binding keys)))) + (when (and (commandp command) + (not (eq command except-command))) + (setq this-command command) + (call-interactively command)))) + +(defun ac-compatible-package-command-p (command) + "Return non-nil if `COMMAND' is compatible with auto-complete." + (and (symbolp command) + (string-match ac-compatible-packages-regexp (symbol-name command)))) + +(defun ac-handle-pre-command () + (condition-case var + (if (or (setq ac-triggered (and (not ac-fuzzy-enable) ; ignore key storkes in fuzzy mode + (or (eq this-command 'auto-complete) ; special case + (ac-trigger-command-p this-command) + (and ac-completing + (memq this-command ac-trigger-commands-on-completing))) + (not (ac-cursor-on-diable-face-p)) + (or ac-triggered t))) + (ac-compatible-package-command-p this-command)) + (progn + (if (or (not (symbolp this-command)) + (not (get this-command 'ac-quick-help-command))) + (ac-remove-quick-help)) + ;; Not to cause inline completion to be disrupted. + (ac-inline-hide)) + (ac-abort)) + (error (ac-error var)))) + +(defun ac-handle-post-command () + (condition-case var + (when (and ac-triggered + (or ac-auto-start + ac-completing) + (not isearch-mode)) + (setq ac-last-point (point)) + (ac-start :requires (unless ac-completing ac-auto-start)) + (unless ac-disable-inline + (ac-inline-update))) + (error (ac-error var)))) + +(defvar ac-flycheck-poll-completion-end-timer nil + "Timer to poll end of completion.") + +(defun ac-syntax-checker-workaround () + (if ac-stop-flymake-on-completing + (progn + (make-local-variable 'ac-flycheck-poll-completion-end-timer) + (when (require 'flymake nil t) + (defadvice flymake-on-timer-event (around ac-flymake-stop-advice activate) + (unless ac-completing + ad-do-it))) + (when (require 'flycheck nil t) + (defadvice flycheck-handle-idle-change (around ac-flycheck-stop-advice activate) + (if ac-completing + (setq ac-flycheck-poll-completion-end-timer + (run-at-time ac-flycheck-poll-completion-end-interval + nil + #'flycheck-handle-idle-change)) + ad-do-it)))) + (when (featurep 'flymake) + (ad-disable-advice 'flymake-on-timer-event 'around 'ac-flymake-stop-advice)) + (when (featurep 'flycheck) + (ad-disable-advice 'flycheck-handle-idle-change 'around 'ac-flycheck-stop-advice)))) + +(defun ac-setup () + (if ac-trigger-key + (ac-set-trigger-key ac-trigger-key)) + (if ac-use-comphist + (ac-comphist-init)) + (unless ac-clear-variables-every-minute-timer + (setq ac-clear-variables-every-minute-timer (run-with-timer 60 60 'ac-clear-variables-every-minute))) + (ac-syntax-checker-workaround)) + +;;;###autoload +(define-minor-mode auto-complete-mode + "AutoComplete mode" + :lighter " AC" + :keymap ac-mode-map + :group 'auto-complete + (if auto-complete-mode + (progn + (ac-setup) + (add-hook 'pre-command-hook 'ac-handle-pre-command nil t) + (add-hook 'post-command-hook 'ac-handle-post-command nil t) + (add-hook 'after-save-hook 'ac-clear-variables-after-save nil t) + (run-hooks 'auto-complete-mode-hook)) + (remove-hook 'pre-command-hook 'ac-handle-pre-command t) + (remove-hook 'post-command-hook 'ac-handle-post-command t) + (remove-hook 'after-save-hook 'ac-clear-variables-after-save t) + (ac-abort))) + +(defun auto-complete-mode-maybe () + "What buffer `auto-complete-mode' prefers." + (if (and (not (minibufferp (current-buffer))) + (memq major-mode ac-modes)) + (auto-complete-mode 1))) + +;;;###autoload +(define-global-minor-mode global-auto-complete-mode + auto-complete-mode auto-complete-mode-maybe + :group 'auto-complete) + + + +;;;; Compatibilities with other extensions + +(defun ac-flyspell-workaround () + "Flyspell uses `sit-for' for delaying its process. Unfortunatelly, +it stops auto completion which is trigger with `run-with-idle-timer'. +This workaround avoid flyspell processes when auto completion is being started." + (interactive) + (defadvice flyspell-post-command-hook (around ac-flyspell-workaround activate) + (unless ac-triggered + ad-do-it))) + +(defun ac-linum-workaround () + "linum-mode tries to display the line numbers even for the +completion menu. This workaround stops that annoying behavior." + (interactive) + (defadvice linum-update (around ac-linum-update-workaround activate) + (unless ac-completing + ad-do-it))) + + + +;;;; Standard sources + +(defmacro ac-define-source (name source) + "Source definition macro. It defines a complete command also." + (declare (indent 1)) + `(progn + (defvar ,(intern (format "ac-source-%s" name))) + ;; Use `setq' to reset ac-source-NAME every time + ;; `ac-define-source' is called. This is useful, for example + ;; when evaluating `ac-define-source' using C-M-x (`eval-defun'). + (setq ,(intern (format "ac-source-%s" name)) ,source) + (defun ,(intern (format "ac-complete-%s" name)) () + (interactive) + (auto-complete '(,(intern (format "ac-source-%s" name))))))) + +;; Words in buffer source +(defvar ac-word-index nil) + +(defun ac-candidate-words-in-buffer (point prefix limit) + (let ((i 0) + candidate + candidates + (regexp (concat "\\_<" (regexp-quote prefix) "\\(\\sw\\|\\s_\\)+\\_>"))) + (save-excursion + ;; Search backward + (goto-char point) + (while (and (or (not (integerp limit)) (< i limit)) + (re-search-backward regexp nil t)) + (setq candidate (match-string-no-properties 0)) + (unless (member candidate candidates) + (push candidate candidates) + (incf i))) + ;; Search backward + (goto-char (+ point (length prefix))) + (while (and (or (not (integerp limit)) (< i limit)) + (re-search-forward regexp nil t)) + (setq candidate (match-string-no-properties 0)) + (unless (member candidate candidates) + (push candidate candidates) + (incf i))) + (nreverse candidates)))) + +(defun ac-incremental-update-word-index () + (unless (local-variable-p 'ac-word-index) + (make-local-variable 'ac-word-index)) + (if (null ac-word-index) + (setq ac-word-index (cons nil nil))) + ;; Mark incomplete + (if (car ac-word-index) + (setcar ac-word-index nil)) + (let ((index (cdr ac-word-index)) + (words (ac-candidate-words-in-buffer ac-point ac-prefix (or (and (integerp ac-limit) ac-limit) 10)))) + (dolist (word words) + (unless (member word index) + (push word index) + (setcdr ac-word-index index))))) + +(defun ac-update-word-index-1 () + (unless (local-variable-p 'ac-word-index) + (make-local-variable 'ac-word-index)) + (when (and (not (car ac-word-index)) + (< (buffer-size) 1048576)) + ;; Complete index + (setq ac-word-index + (cons t + (split-string (buffer-substring-no-properties (point-min) (point-max)) + "\\(?:^\\|\\_>\\).*?\\(?:\\_<\\|$\\)"))))) + +(defun ac-update-word-index () + (dolist (buffer (buffer-list)) + (when (or ac-fuzzy-enable + (not (eq buffer (current-buffer)))) + (with-current-buffer buffer + (ac-update-word-index-1))))) + +(defun ac-word-candidates (&optional buffer-pred) + (loop initially (unless ac-fuzzy-enable (ac-incremental-update-word-index)) + for buffer in (buffer-list) + if (and (or (not (integerp ac-limit)) (< (length candidates) ac-limit)) + (if buffer-pred (funcall buffer-pred buffer) t)) + append (funcall ac-match-function + ac-prefix + (and (local-variable-p 'ac-word-index buffer) + (cdr (buffer-local-value 'ac-word-index buffer)))) + into candidates + finally return candidates)) + +(ac-define-source words-in-buffer + '((candidates . ac-word-candidates))) + +(ac-define-source words-in-all-buffer + '((init . ac-update-word-index) + (candidates . ac-word-candidates))) + +(ac-define-source words-in-same-mode-buffers + '((init . ac-update-word-index) + (candidates . (ac-word-candidates + (lambda (buffer) + (derived-mode-p (buffer-local-value 'major-mode buffer))))))) + +;; Lisp symbols source +(defvar ac-symbols-cache nil) +(ac-clear-variable-every-10-minutes 'ac-symbols-cache) + +(defun ac-symbol-file (symbol type) + (if (fboundp 'find-lisp-object-file-name) + (find-lisp-object-file-name symbol type) + (let ((file-name (with-no-warnings + (describe-simplify-lib-file-name + (symbol-file symbol type))))) + (when (equal file-name "loaddefs.el") + ;; Find the real def site of the preloaded object. + (let ((location (condition-case nil + (if (eq type 'defun) + (find-function-search-for-symbol symbol nil + "loaddefs.el") + (find-variable-noselect symbol file-name)) + (error nil)))) + (when location + (with-current-buffer (car location) + (when (cdr location) + (goto-char (cdr location))) + (when (re-search-backward + "^;;; Generated autoloads from \\(.*\\)" nil t) + (setq file-name (match-string 1))))))) + (if (and (null file-name) + (or (eq type 'defun) + (integerp (get symbol 'variable-documentation)))) + ;; It's a object not defined in Elisp but in C. + (if (get-buffer " *DOC*") + (if (eq type 'defun) + (help-C-file-name (symbol-function symbol) 'subr) + (help-C-file-name symbol 'var)) + 'C-source) + file-name)))) + +(defun ac-symbol-documentation (symbol) + (if (stringp symbol) + (setq symbol (intern-soft symbol))) + (ignore-errors + (with-temp-buffer + (let ((standard-output (current-buffer))) + (prin1 symbol) + (princ " is ") + (cond + ((fboundp symbol) + ;; import help-xref-following + (require 'help-mode) + (let ((help-xref-following t) + (major-mode 'help-mode)) ; avoid error in Emacs 24 + (describe-function-1 symbol)) + (buffer-string)) + ((boundp symbol) + (let ((file-name (ac-symbol-file symbol 'defvar))) + (princ "a variable") + (when file-name + (princ " defined in `") + (princ (if (eq file-name 'C-source) + "C source code" + (file-name-nondirectory file-name)))) + (princ "'.\n\n") + (princ (or (documentation-property symbol 'variable-documentation t) + "Not documented.")) + (buffer-string))) + ((facep symbol) + (let ((file-name (ac-symbol-file symbol 'defface))) + (princ "a face") + (when file-name + (princ " defined in `") + (princ (if (eq file-name 'C-source) + "C source code" + (file-name-nondirectory file-name)))) + (princ "'.\n\n") + (princ (or (documentation-property symbol 'face-documentation t) + "Not documented.")) + (buffer-string))) + (t + (let ((doc (documentation-property symbol 'group-documentation t))) + (when doc + (princ "a group.\n\n") + (princ doc) + (buffer-string))))))))) + +(defun ac-symbol-candidates () + (or ac-symbols-cache + (setq ac-symbols-cache + (loop for x being the symbols + if (or (fboundp x) + (boundp x) + (symbol-plist x)) + collect (symbol-name x))))) + +(ac-define-source symbols + '((candidates . ac-symbol-candidates) + (document . ac-symbol-documentation) + (symbol . "s") + (cache))) + +;; Lisp functions source +(defvar ac-functions-cache nil) +(ac-clear-variable-every-10-minutes 'ac-functions-cache) + +(defun ac-function-candidates () + (or ac-functions-cache + (setq ac-functions-cache + (loop for x being the symbols + if (fboundp x) + collect (symbol-name x))))) + +(ac-define-source functions + '((candidates . ac-function-candidates) + (document . ac-symbol-documentation) + (symbol . "f") + (prefix . "(\\(\\(?:\\sw\\|\\s_\\)+\\)") + (cache))) + +;; Lisp variables source +(defvar ac-variables-cache nil) +(ac-clear-variable-every-10-minutes 'ac-variables-cache) + +(defun ac-variable-candidates () + (or ac-variables-cache + (setq ac-variables-cache + (loop for x being the symbols + if (boundp x) + collect (symbol-name x))))) + +(ac-define-source variables + '((candidates . ac-variable-candidates) + (document . ac-symbol-documentation) + (symbol . "v") + (cache))) + +;; Lisp features source +(defvar ac-emacs-lisp-features nil) +(ac-clear-variable-every-10-minutes 'ac-emacs-lisp-features) + +(defun ac-emacs-lisp-feature-candidates () + (or ac-emacs-lisp-features + (if (fboundp 'find-library-suffixes) + (let ((suffix (concat (regexp-opt (find-library-suffixes) t) "\\'"))) + (setq ac-emacs-lisp-features + (append (mapcar 'prin1-to-string features) + (loop for dir in load-path + if (file-directory-p dir) + append (loop for file in (directory-files dir) + if (string-match suffix file) + collect (substring file 0 (match-beginning 0)))))))))) + +(ac-define-source features + '((depends find-func) + (candidates . ac-emacs-lisp-feature-candidates) + (prefix . "require +'\\(\\(?:\\sw\\|\\s_\\)*\\)") + (requires . 0))) + +(defvaralias 'ac-source-emacs-lisp-features 'ac-source-features) + +;; Abbrev source +(ac-define-source abbrev + '((candidates . (mapcar 'popup-x-to-string (append (vconcat local-abbrev-table global-abbrev-table) nil))) + (action . expand-abbrev) + (symbol . "a") + (cache))) + +;; Files in current directory source +(ac-define-source files-in-current-dir + '((candidates . (directory-files default-directory)) + (cache))) + +;; Filename source +(defvar ac-filename-cache nil) + +(defun ac-filename-candidate () + (let (file-name-handler-alist) + (unless (or (and comment-start-skip + (string-match comment-start-skip ac-prefix)) + (file-regular-p ac-prefix)) + (ignore-errors + (loop with dir = (file-name-directory ac-prefix) + with files = (or (assoc-default dir ac-filename-cache) + (let ((files (directory-files dir nil "^[^.]"))) + (push (cons dir files) ac-filename-cache) + files)) + for file in files + for path = (concat dir file) + collect (if (file-directory-p path) + (concat path "/") + path)))))) + +(ac-define-source filename + '((init . (setq ac-filename-cache nil)) + (candidates . ac-filename-candidate) + (prefix . valid-file) + (requires . 0) + (action . ac-start) + (limit . nil))) + +;; Dictionary source +(ac-define-source dictionary + '((candidates . ac-buffer-dictionary) + (symbol . "d"))) + +(provide 'auto-complete) +;;; auto-complete.el ends here diff --git a/elpa/auto-complete-20140803.2118/auto-complete.elc b/elpa/auto-complete-20140803.2118/auto-complete.elc new file mode 100644 index 000000000..344675c1f Binary files /dev/null and b/elpa/auto-complete-20140803.2118/auto-complete.elc differ diff --git a/elpa/auto-complete-20140803.2118/dict/ada-mode b/elpa/auto-complete-20140803.2118/dict/ada-mode new file mode 100644 index 000000000..bea538fb4 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/ada-mode @@ -0,0 +1,72 @@ +abort +abs +abstract +accept +access +aliased +all +and +array +at +begin +body +case +constant +declare +delay +delta +digits +do +else +elsif +end +entry +exception +exit +for +function +generic +goto +if +in +interface +is +limited +loop +mod +new +not +null +of +or +others +out +overriding +package +pragma +private +procedure +protected +raise +range +record +rem +renames +requeue +return +reverse +select +separate +subtype +synchronized +tagged +task +terminate +then +type +until +use +when +while +with +xor diff --git a/elpa/auto-complete-20140803.2118/dict/c++-mode b/elpa/auto-complete-20140803.2118/dict/c++-mode new file mode 100644 index 000000000..2579e9fec --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/c++-mode @@ -0,0 +1,84 @@ +alignas +alignof +and +and_eq +asm +auto +bitand +bitor +bool +break +case +catch +char +char16_t +char32_t +class +compl +const +const_cast +constexpr +continue +decltype +default +delete +do +double +dynamic_cast +else +enum +explicit +export +extern +false +float +for +friend +goto +if +inline +int +long +mutable +namespace +new +noexcept +not +not_eq +nullptr +operator +or +or_eq +private +protected +public +register +reinterpret_cast +return +short +signed +sizeof +static +static_assert +static_cast +struct +switch +template +this +thread_local +throw +true +try +typedef +typeid +typename +union +unsigned +using +virtual +void +volatile +wchar_t +while +xor +xor_eq diff --git a/elpa/auto-complete-20140803.2118/dict/c-mode b/elpa/auto-complete-20140803.2118/dict/c-mode new file mode 100644 index 000000000..ec262c763 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/c-mode @@ -0,0 +1,44 @@ +auto +_Alignas +_Alignof +_Atomic +_Bool +break +case +char +_Complex +const +continue +default +do +double +else +enum +extern +float +for +goto +_Generic +if +_Imaginary +inline +int +long +_Noreturn +register +restrict +return +short +signed +sizeof +static +struct +switch +_Static_assert +typedef +_Thread_local +union +unsigned +void +volatile +while diff --git a/elpa/auto-complete-20140803.2118/dict/caml-mode b/elpa/auto-complete-20140803.2118/dict/caml-mode new file mode 100644 index 000000000..e709f9f62 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/caml-mode @@ -0,0 +1,231 @@ +# OCaml 3.12.1 + +# Keywords +and +as +assert +begin +class +constraint +do +done +downto +else +end +exception +external +false +for +fun +function +functor +if +in +include +inherit +initializer +lazy +let +match +method +module +mutable +new +object +of +open +or +private +rec +sig +struct +then +to +true +try +type +val +virtual +when +while +with + +# Pervasives +! +!= +& +&& +* +** +*. ++ ++. +- +-. +/ +/. +:= +< +<= +<> += +== +> +>= +@ +FP_infinite +FP_nan +FP_normal +FP_subnormal +FP_zero +LargeFile +Open_append +Open_binary +Open_creat +Open_nonblock +Open_rdonly +Open_text +Open_trunc +Open_wronly +Oupen_excl +^ +^^ +abs +abs_float +acos +asin +asr +at_exit +atan +atan2 +bool_of_string +ceil +char_of_int +classify_float +close_in +close_in_noerr +close_out +close_out_noerr +compare +cos +cosh +decr +do_at_exit +epsilon_float +exit +exp +expm1 +failwith +float +float_of_int +float_of_string +floor +flush +flush_all +format +format4 +format_of_string +fpclass +frexp +fst +ignore +in_channel +in_channel_length +incr +infinity +input +input_binary_int +input_byte +input_char +input_line +input_value +int_of_char +int_of_float +int_of_string +invalid_arg +land +ldexp +lnot +log +log10 +log1p +lor +lsl +lsr +lxor +max +max_float +max_int +min +min_float +min_int +mod +mod_float +modf +nan +neg_infinity +not +open_flag +open_in +open_in_bin +open_in_gen +open_out +open_out_bin +open_out_gen +or +out_channel +out_channel_length +output +output_binary_int +output_byte +output_char +output_string +output_value +pos_in +pos_out +pred +prerr_char +prerr_endline +prerr_float +prerr_int +prerr_newline +prerr_string +print_char +print_endline +print_float +print_int +print_newline +print_string +raise +read_float +read_int +read_line +really_input +ref +seek_in +seek_out +set_binary_mode_in +set_binary_mode_out +sin +sinh +snd +sqrt +stderr +stdin +stdout +string_of_bool +string_of_float +string_of_format +string_of_int +succ +tan +tanh +truncate +unsafe_really_input +valid_float_lexem +|| +~ +~+ +~+. +~- +~-. diff --git a/elpa/auto-complete-20140803.2118/dict/clojure-mode b/elpa/auto-complete-20140803.2118/dict/clojure-mode new file mode 100644 index 000000000..eefe33fcb --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/clojure-mode @@ -0,0 +1,580 @@ +*agent* +*allow-unresolved-vars* +*assert* +*clojure-version* +*command-line-args* +*compile-files* +*compile-path* +*compiler-options* +*data-readers* +*default-data-reader-fn* +*err* +*file* +*flush-on-newline* +*fn-loader* +*in* +*math-context* +*ns* +*out* +*print-dup* +*print-length* +*print-level* +*print-meta* +*print-readably* +*read-eval* +*source-path* +*unchecked-math* +*use-context-classloader* +*verbose-defrecords* +*warn-on-reflection* +->ArrayChunk +->Vec +->VecNode +->VecSeq +-cache-protocol-fn +-reset-methods +accessor +aclone +add-classpath +add-watch +agent +agent-error +agent-errors +aget +alength +alias +all-ns +alter +alter-meta! +alter-var-root +amap +ancestors +and +apply +areduce +array-map +as-> +aset +aset-boolean +aset-byte +aset-char +aset-double +aset-float +aset-int +aset-long +aset-short +assert +assoc +assoc! +assoc-in +associative? +atom +await +await-for +await1 +bases +bean +bigdec +bigint +biginteger +binding +bit-and +bit-and-not +bit-clear +bit-flip +bit-not +bit-or +bit-set +bit-shift-left +bit-shift-right +bit-test +bit-xor +boolean +boolean-array +booleans +bound-fn +bound-fn* +bound? +butlast +byte +byte-array +bytes +case +cast +char +char-array +char-escape-string +char-name-string +char? +chars +chunk +chunk-append +chunk-buffer +chunk-cons +chunk-first +chunk-next +chunk-rest +chunked-seq? +class +class? +clear-agent-errors +clojure-version +coll? +comment +commute +comp +comparator +compare +compare-and-set! +compile +complement +concat +cond +cond-> +cond->> +condp +conj +conj! +cons +constantly +construct-proxy +contains? +count +counted? +create-ns +create-struct +cycle +dec +dec' +decimal? +declare +default-data-readers +definline +definterface +defmacro +defmethod +defmulti +defn +defn- +defonce +defprotocol +defrecord +defstruct +deftype +delay +delay? +deliver +denominator +deref +derive +descendants +destructure +disj +disj! +dissoc +dissoc! +distinct +distinct? +doall +doc +dorun +doseq +dosync +dotimes +doto +double +double-array +doubles +drop +drop-last +drop-while +dtype +empty +empty? +ensure +enumeration-seq +error-handler +error-mode +eval +even? +every-pred +every? +ex-data +ex-info +extend +extend-class +extend-protocol +extend-type +extenders +extends? +false? +ffirst +file-seq +filter +filterv +find +find-doc +find-keyword +find-ns +find-protocol-impl +find-protocol-method +find-var +first +flatten +float +float-array +float? +floats +flush +fn +fn? +fnext +fnil +for +force +format +frequencies +future +future-call +future-cancel +future-cancelled? +future-done? +future? +gen-class +gen-interface +gensym +get +get-in +get-method +get-proxy-class +get-thread-bindings +get-validator +group-by +hash +hash-combine +hash-map +hash-set +identical? +identity +if-let +if-not +ifn? +import +in-ns +inc +inc' +init-proxy +instance? +int +int-array +integer? +interleave +intern +interpose +into +into-array +ints +io! +isa? +iterate +iterator-seq +juxt +keep +keep-indexed +key +keys +keyword +keyword? +last +lazy-cat +lazy-seq +let +letfn +line-seq +list +list* +list? +load +load-file +load-reader +load-string +loaded-libs +locking +long +long-array +longs +loop +macroexpand +macroexpand-1 +make-array +make-hierarchy +map +map-indexed +map? +mapcat +mapv +max +max-key +memfn +memoize +merge +merge-with +meta +method-sig +methods +min +min-key +mod +munge +name +namespace +namespace-munge +neg? +newline +next +nfirst +nil? +nnext +not +not-any? +not-empty +not-every? +not= +ns +ns-aliases +ns-imports +ns-interns +ns-map +ns-name +ns-publics +ns-refers +ns-resolve +ns-unalias +ns-unmap +nth +nthnext +nthrest +num +number? +numerator +object-array +odd? +or +parents +partial +partition +partition-all +partition-by +pcalls +peek +persistent! +pmap +pop +pop! +pop-thread-bindings +pos? +pr +pr-str +prefer-method +prefers +primitives-classnames +print +print-ctor +print-dup +print-method +print-namespace-doc +print-simple +print-str +printf +println +println-str +prn +prn-str +promise +proxy +proxy-call-with-super +proxy-mappings +proxy-name +proxy-super +push-thread-bindings +pvalues +quot +rand +rand-int +rand-nth +range +ratio? +rational? +rationalize +re-find +re-groups +re-matcher +re-matches +re-pattern +re-seq +read +read-line +read-string +realized? +reduce +reduce-kv +reduced +reduced? +reductions +ref +ref-history-count +ref-max-history +ref-min-history +ref-set +refer +refer-clojure +reify +release-pending-sends +rem +remove +remove-all-methods +remove-method +remove-ns +remove-watch +repeat +repeatedly +replace +replicate +require +reset! +reset-meta! +resolve +rest +restart-agent +resultset-seq +reverse +reversible? +rseq +rsubseq +satisfies? +second +select-keys +send +send-off +send-via +seq +seq? +seque +sequence +sequential? +set +set-agent-send-executor! +set-agent-send-off-executor! +set-error-handler! +set-error-mode! +set-validator! +set? +short +short-array +shorts +shuffle +shutdown-agents +slurp +some +some-> +some->> +some-fn +sort +sort-by +sorted-map +sorted-map-by +sorted-set +sorted-set-by +sorted? +special-form-anchor +special-symbol? +spit +split-at +split-with +str +stream? +string? +struct +struct-map +subs +subseq +subvec +supers +swap! +symbol +symbol? +sync +syntax-symbol-anchor +take +take-last +take-nth +take-while +test +the-ns +thread-bound? +time +to-array +to-array-2d +trampoline +transient +tree-seq +true? +type +unchecked-add +unchecked-add-int +unchecked-byte +unchecked-char +unchecked-dec +unchecked-dec-int +unchecked-divide +unchecked-divide-int +unchecked-double +unchecked-float +unchecked-inc +unchecked-inc-int +unchecked-int +unchecked-long +unchecked-multiply +unchecked-multiply-int +unchecked-negate +unchecked-negate-int +unchecked-remainder +unchecked-remainder-int +unchecked-short +unchecked-subtract +unchecked-subtract-int +underive +unquote +unquote-splicing +update-in +update-proxy +use +val +vals +var-get +var-set +var? +vary-meta +vec +vector +vector-of +vector? +when +when-first +when-let +when-not +while +with-bindings +with-bindings* +with-in-str +with-loading-context +with-local-vars +with-meta +with-open +with-out-str +with-precision +with-redefs +with-redefs-fn +xml-seq +zero? +zipmap \ No newline at end of file diff --git a/elpa/auto-complete-20140803.2118/dict/clojurescript-mode b/elpa/auto-complete-20140803.2118/dict/clojurescript-mode new file mode 100644 index 000000000..16348edb6 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/clojurescript-mode @@ -0,0 +1,475 @@ +*agent* +*clojure-version* +*command-line-args* +*compile-files* +*compile-path* +*err* +*file* +*flush-on-newline* +*in* +*ns* +*out* +*print-dup* +*print-length* +*print-level* +*print-meta* +*print-readably* +*read-eval* +*warn-on-reflection* +accessor +aclone +add-classpath +add-watch +agent +agent-error +agent-errors +aget +alength +alias +all-ns +alter +alter-meta! +alter-var-root +amap +ancestors +and +apply +areduce +array-map +aset +aset-boolean +aset-byte +aset-char +aset-double +aset-float +aset-int +aset-long +aset-short +assert +assoc +assoc! +assoc-in +associative? +atom +await +await-for +bases +bean +bigdec +bigint +binding +bit-and +bit-and-not +bit-clear +bit-flip +bit-not +bit-or +bit-set +bit-shift-left +bit-shift-right +bit-test +bit-xor +boolean +boolean-array +booleans +bound-fn +bound-fn* +butlast +byte +byte-array +bytes +case +cast +char +char-array +char-escape-string +char-name-string +char? +chars +class +class? +clear-agent-errors +clojure-version +coll? +comment +commute +comp +comparator +compare +compare-and-set! +compile +complement +concat +cond +condp +conj +conj! +cons +constantly +construct-proxy +contains? +count +counted? +create-ns +create-struct +cycle +dec +decimal? +declare +definline +defmacro +defmethod +defmulti +defn +defn- +defonce +defprotocol +defstruct +deftype +delay +delay? +deliver +deref +derive +descendants +disj +disj! +dissoc +dissoc! +distinct +distinct? +doall +doc +dorun +doseq +dosync +dotimes +doto +double +double-array +doubles +drop +drop-last +drop-while +dtype +empty +empty? +ensure +enumeration-seq +error-handler +error-mode +eval +even? +every? +extend +extend-class +extend-protocol +extend-type +extenders +extends? +false? +ffirst +file-seq +filter +find +find-doc +find-ns +find-var +first +float +float-array +float? +floats +flush +fn +fn? +fnext +for +force +format +future +future-call +future-cancel +future-cancelled? +future-done? +future? +gen-class +gen-interface +gensym +get +get-in +get-method +get-proxy-class +get-thread-bindings +get-validator +hash +hash-map +hash-set +identical? +identity +if-let +if-not +ifn? +import +in-ns +inc +init-proxy +instance? +int +int-array +integer? +interleave +intern +interpose +into +into-array +ints +io! +isa? +iterate +iterator-seq +juxt +key +keys +keyword +keyword? +last +lazy-cat +lazy-seq +let +letfn +line-seq +list +list* +list? +load +load-file +load-reader +load-string +loaded-libs +locking +long +long-array +longs +loop +macroexpand +macroexpand-1 +make-array +make-hierarchy +map +map? +mapcat +max +max-key +memfn +memoize +merge +merge-with +meta +methods +min +min-key +mod +name +namespace +neg? +newline +next +nfirst +nil? +nnext +not +not-any? +not-empty +not-every? +not= +ns +ns-aliases +ns-imports +ns-interns +ns-map +ns-name +ns-publics +ns-refers +ns-resolve +ns-unalias +ns-unmap +nth +nthnext +num +number? +object-array +odd? +or +parents +partial +partition +pcalls +peek +persistent! +pmap +pop +pop! +pop-thread-bindings +pos? +pr +pr-str +prefer-method +prefers +print +print-namespace-doc +print-str +printf +println +println-str +prn +prn-str +promise +proxy +proxy-mappings +proxy-super +push-thread-bindings +pvalues +quot +rand +rand-int +range +ratio? +rationalize +re-find +re-groups +re-matcher +re-matches +re-pattern +re-seq +read +read-line +read-string +reduce +ref +ref-history-count +ref-max-history +ref-min-history +ref-set +refer +refer-clojure +reify +release-pending-sends +rem +remove +remove-method +remove-ns +remove-watch +repeat +repeatedly +replace +replicate +require +reset! +reset-meta! +resolve +rest +restart-agent +resultset-seq +reverse +reversible? +rseq +rsubseq +satisfies? +second +select-keys +send +send-off +seq +seq? +seque +sequence +sequential? +set +set-error-handler! +set-error-mode! +set-validator! +set? +short +short-array +shorts +shutdown-agents +slurp +some +sort +sort-by +sorted-map +sorted-map-by +sorted-set +sorted-set-by +sorted? +special-form-anchor +special-symbol? +split-at +split-with +str +stream? +string? +struct +struct-map +subs +subseq +subvec +supers +swap! +symbol +symbol? +sync +syntax-symbol-anchor +take +take-last +take-nth +take-while +test +the-ns +time +to-array +to-array-2d +trampoline +transient +tree-seq +true? +type +unchecked-add +unchecked-dec +unchecked-divide +unchecked-inc +unchecked-multiply +unchecked-negate +unchecked-remainder +unchecked-subtract +underive +update-in +update-proxy +use +val +vals +var-get +var-set +var? +vary-meta +vec +vector +vector-of +vector? +when +when-first +when-let +when-not +while +with-bindings +with-bindings* +with-in-str +with-local-vars +with-meta +with-open +with-out-str +with-precision +xml-seq +zero? +zipmap \ No newline at end of file diff --git a/elpa/auto-complete-20140803.2118/dict/coq-mode b/elpa/auto-complete-20140803.2118/dict/coq-mode new file mode 100644 index 000000000..219448faa --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/coq-mode @@ -0,0 +1,278 @@ +# Generated by the following form. +# (loop for regexp in (append +# coq-solve-tactics +# coq-keywords +# coq-reserved +# coq-tactics +# coq-tacticals +# (list "Set" "Type" "Prop")) +# append (split-string regexp (regexp-quote "\\s-+")) into words +# finally (loop initially (goto-char (point-max)) +# for word in (delete-dups (sort words 'string<)) +# do (insert word) (newline))) + +Abort +About +Abstract +Add +Admit +Admitted +All +Arguments +AutoInline +Axiom +Bind +Canonical +Cd +Chapter +Check +Close +CoFixpoint +CoInductive +Coercion +Coercions +Comments +Conjecture +Constant +Constructors +Corollary +Declare +Defined +Definition +Delimit +Dependent +Depth +Derive +End +Eval +Export +Extern +Extract +Extraction +Fact +False +Field +File +Fixpoint +Focus +Function +Functional +Goal +Hint +Hypotheses +Hypothesis +Hyps +Identity +If +Immediate +Implicit +Import +Inductive +Infix +Inline +Inlined +Inspect +Inversion +Language +Lemma +Let +Library +Limit +LoadPath +Local +Locate +Ltac +ML +Module +Morphism +Next Obligation +NoInline +Notation +Notations +Obligation +Obligations +Off +On +Opaque +Open +Optimize +Parameter +Parameters +Path +Print +Printing +Program +Proof +Prop +Pwd +Qed +Rec +Record +Recursive +Remark +Remove +Require +Reserved +Reset +Resolve +Rewrite +Ring +Save +Scheme +Scope +Search +SearchAbout +SearchPattern +SearchRewrite +Section +Semi +Set +Setoid +Show +Solve +Sort +Strict +Structure +Synth +Tactic +Test +Theorem +Time +Transparent +True +Type +Undo +Unfocus +Unfold +Unset +Variable +Variables +Width +Wildcard +abstract +absurd +after +apply +as +assert +assumption +at +auto +autorewrite +beta +by +case +cbv +change +clear +clearbody +cofix +coinduction +compare +compute +congruence +constructor +contradiction +cut +cutrewrite +decide +decompose +delta +dependent +dest +destruct +discrR +discriminate +do +double +eapply +eauto +econstructor +eexists +eleft +elim +else +end +equality +esplit +exact +exists +fail +field +first +firstorder +fix +fold +forall +fourier +fun +functional +generalize +hnf +idtac +if +in +induction +info +injection +instantiate +into +intro +intros +intuition +inversion +inversion_clear +iota +lapply +lazy +left +let +linear +load +match +move +omega +pattern +pose +progress +prolog +quote +record +red +refine +reflexivity +rename +repeat +replace +return +rewrite +right +ring +set +setoid +setoid_replace +setoid_rewrite +simpl +simple +simplify_eq +solve +specialize +split +split_Rabs +split_Rmult +stepl +stepr +struct +subst +sum +symmetry +tauto +then +transitivity +trivial +try +unfold +until +using +with +zeta diff --git a/elpa/auto-complete-20140803.2118/dict/css-mode b/elpa/auto-complete-20140803.2118/dict/css-mode new file mode 100644 index 000000000..6ab36ecf2 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/css-mode @@ -0,0 +1,874 @@ +!important +@font-face +@font-feature-values +@keyframes +ActiveBorder +ActiveCaption +Alpha +AppWorkspace +Background +Barn +BasicImage +Blinds +Blur +ButtonFace +ButtonHighlight +ButtonShadow +ButtonText +CaptionText +CheckerBoard +Chroma +Compositor +CradientWipe +DXImageTransform +DropShadow +Emboss +Engrave +Fade +FlipH +FlipV +Glow +Gray +GrayText +Highlight +HighlightText +Hz +ICMFilter +InactiveBorder +InactiveCaption +InactiveCaptionText +InfoBackground +InfoText +Inset +Invert +Iris +Light +MaskFilter +Matrix +Menu +MenuText +Microsoft +MotionBlur +Pixelate +RadialWipe +RandomBars +RandomDissolve +RevealTrans +Scrollbar +Shadow +Slide +Spiral +Stretch +Strips +ThreeDDarkShadow +ThreeDFace +ThreeDHighlight +ThreeDLightShadow +ThreeDShadow +Wave +Wheel +Window +WindowFrame +WindowText +Xray +Zigzag +_azimuth +_background +_background-position-x +_background-position-y +_border +_bottom +_caption +_clear +_clip +_color +_content +_counter +_cue +_cursor +_direction +_display +_elevation +_empty +_filter +_filter:progid:DXImageTransform.Microsoft +_float +_font +_height +_ime +_ime-mode +_layout +_layout-flow +_layout-grid +_layout-grid-char +_layout-grid-line +_layout-grid-mode +_layout-grid-type +_left +_letter +_line +_line-break +_list +_margin +_orphans +_outline +_overflow +_overflow-x +_overflow-y +_padding +_page +_pause +_pitch +_play +_position +_quotes +_richness +_right +_ruby +_ruby-align +_ruby-overhang +_ruby-position +_scrollbar +_scrollbar-3dlight-color +_scrollbar-arrow-color +_scrollbar-base-color +_scrollbar-darkshadow-color +_scrollbar-face-color +_scrollbar-highlight-color +_scrollbar-track-color +_speak +_speech +_stress +_table +_text +_text-align-last +_text-autospace +_text-justify +_text-kashida-space +_text-overflow +_text-underline-position +_top +_unicode +_vertical +_visibility +_voice +_volume +_white +_widows +_width +_word +_word-break +_word-wrap +_writing +_writing-mode +_z +_zoom +above +active +adjust +after +aliceblue +align +align-content +align-items +align-self +always +animation +animation-delay +animation-direction +animation-duration +animation-fill-mode +animation-iteration-count +animation-name +animation-play-state +animation-timing-function +antiquewhite +aqua +aquamarine +armenian +arrow +attachment +auto +autospace +avoid +azimuth +azure +backface-visibility +background +background-attachment +background-clip +background-color +background-image +background-origin +background-position +background-repeat +background-size +bar +base +baseline +before +behind +beige +below +bidi +bidi-override +bisque +black +blanchedalmond +blink +block +blue +blueviolet +bold +bolder +border +border-bottom +border-bottom-color +border-bottom-left-radius +border-bottom-right-radius +border-bottom-style +border-bottom-width +border-collapse +border-color +border-image +border-image-outset +border-image-repeat +border-image-slice +border-image-source +border-image-width +border-left +border-left-color +border-left-style +border-left-width +border-radius +border-right +border-right-color +border-right-style +border-right-width +border-spacing +border-style +border-top +border-top-color +border-top-left-radius +border-top-right-radius +border-top-style +border-top-width +border-width +both +bottom +box +box-decoration-break +box-shadow +box-sizing +break +break-after +break-before +break-inside +brown +burlwood +cadetblue +capitalize +caps +caption +caption-side +cell +cells +center +center-left +center-right +char +chartreuse +chocolate +circle +cjk +cjk-ideographic +clear +clip +close +close-quote +cm +code +collapse +color +column +column-count +column-fill +column-gap +column-rule +column-rule-color +column-rule-style +column-rule-width +column-span +column-width +columns +compact +condensed +content +continuous +coral +cornflowerblue +cornsilk +counter +counter-increment +counter-reset +crimson +crop +cross +crosshair +cue +cue-after +cue-before +cursive +cursor +cyan +darkblue +darkcyan +darkgoldenrod +darkgray +darkgreen +darkkhaki +darkmagenta +darkolivegreen +darkorange +darkorchid +darkred +darksalmon +darkseagreen +darkshadow +darkslateblue +darkslategray +darkturquoise +darkviolet +dashed +decimal +decimal-leading-zero +decoration +deeppink +deepskyblue +default +deg +digits +dimgray +direction +disc +display +dodgerblue +dotted +double +during +e +e-resize +elevation +em +embed +empty +empty-cells +ex +expanded +extra +extra-condensed +extra-expanded +face +family +fantasy +far +far-left +far-right +fast +faster +filter +firebrick +first +first-child +first-letter +first-line +fixed +flex +flex-basis +flex-direction +flex-flow +flex-grow +flex-shrink +flex-wrap +float +floralwhite +flow +focus +font +font-family +font-feature-setting +font-kerning +font-language-override +font-size +font-size-adjust +font-stretch +font-style +font-synthesis +font-variant +font-variant-alternates +font-variant-caps +font-variant-east-asian +font-variant-ligatures +font-variant-numeric +font-variant-position +font-weight +footer +forestgreen +fuchsia +gainsboro +georgian +ghostwhite +gold +goldenrod +gray +greek +green +greenyellow +grid +groove +group +hanging-punctuation +header +hebrew +height +help +hidden +hide +high +higher +hiragana +hiragana-iroha +honeydew +hotpink +hover +hyphens +icon +ideographic +image +image-orientation +image-rendering +image-resolution +ime-mode +in +increment +indent +index +indianred +indigo +inherit +inline +inline-block +inline-table +inset +inside +iroha +italic +item +ivory +justify +justify-content +kHz +kashida +katakana +katakana-iroha +khaki +landscape +lang() +large +larger +last +latin +lavender +lavenderblush +lawngreen +layout +leading +left +left-side +leftwards +lenonchiffon +letter +letter-spacing +level +lightblue +lightcoral +lightcyan +lighter +lightgoldenrodyellow +lightgray +lightgreen +lightgrey +lightpink +lightsalmon +lightseagreen +lightskyblue +lightslategray +lightsteelblue +lightyellow +lime +limegreen +line +line-break +line-height +line-through +linen +link +list +list-item +list-style +list-style-image +list-style-position +list-style-type +loud +low +lower +lower-alpha +lower-greek +lower-latin +lower-roman +lowercase +ltr +magenta +margin +margin-bottom +margin-left +margin-right +margin-top +mark +mark-after +mark-before +marker +marker-offset +marks +maroon +marquee-direction +marquee-play-count +marquee-speed +marquee-style +mask +mask-type +max +max-height +max-width +medium +mediumaquamarine +mediumblue +mediumorchid +mediumpurple +mediumseagreen +mediumslateblue +mediumspringgreen +mediumturquoise +mediumvioletred +menu +message +message-box +middle +midnightblue +min +min-height +min-width +mintcream +mistyrose +mix +mm +moccasin +mode +monospace +move +ms +n +n-resize +naby +narrower +nav-down +nav-index +nav-left +nav-right +nav-up +navajowhite +ne +ne-resize +no +no-close-quote +no-open-quote +no-repeat +none +normal +nowrap +number +numeral +nw +nw-resize +object-fit +object-position +oblique +offset +oldlace +olive +olivedrab +once +opacity +open +open-quote +orange +orangered +orchid +order +orphans +out +outline +outline-color +outline-offset +outline-style +outline-width +outset +outside +overflow +overflow-wrap +overflow-x +overflow-y +overhang +overline +override +padding +padding-bottom +padding-left +padding-right +padding-top +page +page-break-after +page-break-before +page-break-inside +palegoldenrod +palegreen +paleturquoise +palevioletred +papayawhip +pause +pause-after +pause-before +pc +peachpuff +perspective +perspective-origin +peru +phonemes +pink +pitch +pitch-range +play +play-during +plum +pointer +portarait +position +powderblue +pre +pre-line +pre-wrap +progid +progress +pt +punctuation +purple +px +quote +quotes +rad +range +rate +red +relative +repeat +repeat-x +repeat-y +reset +resize +rest +rest-after +rest-before +richness +ridge +right +right-side +rightwards +roman +rosybrown +row +royalblue +rtl +run +run-in +s +s-resize +saddlebrown +salmon +sandybrown +sans-serif +scroll +se +se-resize +seagreen +seashell +semi +semi-condensed +semi-expanded +separate +serif +shadow +show +side +sienna +silent +silever +silver +size +skyblue +slateblue +slategray +slow +slower +small +small-caps +small-caption +smaller +snow +soft +solid +space +spacing +speak +speak-header +speak-numeral +speak-punctuation +specific +specific-voice +speech +speech-rate +spell +spell-out +springgreen +square +static +status +status-bar +steelblue +stress +stretch +style +sub +super +sw +sw-resize +tab-size +table +table-caption +table-cell +table-column +table-column-group +table-footer-group +table-header-group +table-layout +table-row +table-row-group +tan +teal +text +text-align +text-align-last +text-bottom +text-combine-horizontal +text-decoration +text-decoration-color +text-decoration-line +text-decoration-style +text-indent +text-justify +text-orientation +text-overflow +text-shadow +text-top +text-transform +text-underline-position +thick +thin +thistle +through +tomato +top +track +transform +transform-origin +transform-style +transition +transition-delay +transition-duration +transition-property +transition-timing-function +transparent +turquoise +type +ultra +ultra-condensed +ultra-expanded +underline +unicode +unicode-bidi +upper +upper-alpha +upper-latin +upper-roman +uppercase +variant +vertical +vertical-align +violet +visibility +visible +visited +voice +voice-balance +voice-duration +voice-family +voice-pitch +voice-pitch-range +voice-rate +voice-stress +voice-volume +volume +w +w-resize +wait +weight +wheat +white +white-space +whitesmoke +wider +widows +width +word +word-break +word-spacing +word-wrap +wrap +writing-mode +x +x-fast +x-high +x-large +x-loud +x-low +x-slow +x-small +x-soft +xx +xx-large +xx-small +y +yellow +yellowgreen +z +z-index +zero diff --git a/elpa/auto-complete-20140803.2118/dict/erlang-mode b/elpa/auto-complete-20140803.2118/dict/erlang-mode new file mode 100644 index 000000000..960f2b837 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/erlang-mode @@ -0,0 +1,216 @@ +after +begin +catch +case +cond +end +fun +if +let +of +query +receive +try +when +and +andalso +band +bnot +bor +bsl +bsr +bxor +div +not +or +orelse +rem +xor +is_atom +is_binary +is_bitstring +is_boolean +is_float +is_function +is_integer +is_list +is_number +is_pid +is_port +is_record +is_reference +is_tuple +atom +binary +bitstring +boolean +function +integer +list +number +pid +port +record +reference +tuple +abs +adler32 +adler32_combine +alive +apply +atom_to_binary +atom_to_list +binary_to_atom +binary_to_existing_atom +binary_to_list +binary_to_term +bit_size +bitstring_to_list +byte_size +check_process_code +contact_binary +crc32 +crc32_combine +date +decode_packet +delete_module +disconnect_node +element +erase +exit +float +float_to_list +garbage_collect +get +get_keys +group_leader +halt +hd +integer_to_list +internal_bif +iolist_size +iolist_to_binary +is_alive +is_atom +is_binary +is_bitstring +is_boolean +is_float +is_function +is_integer +is_list +is_number +is_pid +is_port +is_process_alive +is_record +is_reference +is_tuple +length +link +list_to_atom +list_to_binary +list_to_bitstring +list_to_existing_atom +list_to_float +list_to_integer +list_to_pid +list_to_tuple +load_module +make_ref +module_loaded +monitor_node +node +node_link +node_unlink +nodes +notalive +now +open_port +pid_to_list +port_close +port_command +port_connect +port_control +pre_loaded +process_flag +process_info +processes +purge_module +put +register +registered +round +self +setelement +size +spawn +spawn_link +spawn_monitor +spawn_opt +split_binary +statistics +term_to_binary +time +throw +tl +trunc +tuple_size +tuple_to_list +unlink +unregister +whereis +append_element +bump_reductions +cancel_timer +demonitor +display +fun_info +fun_to_list +function_exported +get_cookie +get_stacktrace +hash +integer_to_list +is_builtin +list_to_integer +loaded +localtime +localtime_to_universaltime +make_tuple +max +md5 +md5_final +md5_init +md5_update +memory +min +monitor +monitor_node +phash +phash2 +port_call +port_info +port_to_list +ports +process_display +read_timer +ref_to_list +resume_process +send +send_after +send_nosuspend +set_cookie +start_timer +suspend_process +system_flag +system_info +system_monitor +system_profile +trace +trace_delivered +trace_info +trace_pattern +universaltime +universaltime_to_localtime +yield diff --git a/elpa/auto-complete-20140803.2118/dict/go-mode b/elpa/auto-complete-20140803.2118/dict/go-mode new file mode 100644 index 000000000..b943a164c --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/go-mode @@ -0,0 +1,25 @@ +break +case +chan +const +continue +default +defer +else +fallthrough +for +func +go +goto +if +import +interface +map +package +range +return +select +struct +switch +type +var diff --git a/elpa/auto-complete-20140803.2118/dict/haskell-mode b/elpa/auto-complete-20140803.2118/dict/haskell-mode new file mode 100644 index 000000000..9ad1b999b --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/haskell-mode @@ -0,0 +1,679 @@ +Arrows +BangPatterns +Bool +Bounded +CPP +Char +Complex +ConstrainedClassMethods +Control.Applicative +Control.Arrow +Control.Category +Control.Concurrent +Control.Concurrent.MVar +Control.Concurrent.QSem +Control.Concurrent.QSemN +Control.Concurrent.STM +Control.Concurrent.STM.TArray +Control.Concurrent.STM.TChan +Control.Concurrent.STM.TMVar +Control.Concurrent.STM.TVar +Control.Concurrent.SampleVar +Control.Exception +Control.Exception.Base +Control.Monad +Control.Monad.Cont +Control.Monad.Cont.Class +Control.Monad.Error +Control.Monad.Error.Class +Control.Monad.Fix +Control.Monad.Identity +Control.Monad.Instances +Control.Monad.List +Control.Monad.RWS +Control.Monad.RWS.Class +Control.Monad.RWS.Lazy +Control.Monad.RWS.Strict +Control.Monad.Reader +Control.Monad.Reader.Class +Control.Monad.ST +Control.Monad.ST.Lazy +Control.Monad.ST.Strict +Control.Monad.STM +Control.Monad.State +Control.Monad.State.Class +Control.Monad.State.Lazy +Control.Monad.State.Strict +Control.Monad.Trans +Control.Monad.Writer +Control.Monad.Writer.Class +Control.Monad.Writer.Lazy +Control.Monad.Writer.Strict +Control.OldException +Control.Parallel +Control.Parallel.Strategies +DEPRECATED +Data.Array +Data.Array.Diff +Data.Array.IArray +Data.Array.IO +Data.Array.IO.Internals +Data.Array.MArray +Data.Array.Paralell +Data.Array.Paralell.Arr +Data.Array.Paralell.Base +Data.Array.Paralell.Int +Data.Array.Paralell.Lifted +Data.Array.Paralell.PArray +Data.Array.Paralell.Prelude +Data.Array.Paralell.Prelude.Double +Data.Array.Paralell.Stream +Data.Array.Paralell.Unlifted +Data.Array.Paralell.Unlifted.Distributed +Data.Array.Paralell.Unlifted.Paralell +Data.Array.Paralell.Unlifted.Sqeuential +Data.Array.Paralell.Word8 +Data.Array.ST +Data.Array.Storable +Data.Array.Unboxed +Data.Bits +Data.Bool +Data.ByteString +Data.ByteString.Char8 +Data.ByteString.Fusion +Data.ByteString.Internal +Data.ByteString.Lazy +Data.ByteString.Lazy.Char8 +Data.ByteString.Lazy.Fusion +Data.ByteString.Lazy.Internal +Data.ByteString.Unsafe +Data.Char +Data.Complex +Data.Data +Data.Dynamic +Data.Either +Data.Eq +Data.Fixed +Data.Foldable +Data.Function +Data.Generics +Data.Generics.Aliases +Data.Generics.Basics +Data.Generics.Instances +Data.Generics.Schemes +Data.Generics.Text +Data.Generics.Twins +Data.Graph +Data.HashTable +Data.IORef +Data.Int +Data.IntMap +Data.IntSet +Data.Ix +Data.List +Data.Map +Data.Maybe +Data.Monoid +Data.Ord +Data.Ratio +Data.STRef +Data.STRef.Lazy +Data.STRef.Strict +Data.Sequence +Data.Set +Data.String +Data.Time +Data.Time.Calendar +Data.Time.Calendar.Easter +Data.Time.Calendar.Julian +Data.Time.Calendar.MonthDay +Data.Time.Calendar.OrdinalDate +Data.Time.Calendar.WeekDate +Data.Time.Clock +Data.Time.Clock.POSIX +Data.Time.Clock.TAI +Data.Time.Format +Data.Time.LocalTime +Data.Traversable +Data.Tree +Data.Tuple +Data.Typeable +Data.Unique +Data.Version +Data.Word +Debug.Trace +DeriveDataTypeable +DisambiguateRecordFields +Distribution.Compat.ReadP +Distribution.Compiler +Distribution.InstalledPackageInfo +Distribution.License +Distribution.Make +Distribution.ModuleName +Distribution.Package +Distribution.PackageDescription +Distribution.PackageDescription.Check +Distribution.PackageDescription.Configuration +Distribution.PackageDescription.Parse +Distribution.ParseUtils +Distribution.ReadE +Distribution.Simple +Distribution.Simple.Build +Distribution.Simple.Build.Macros +Distribution.Simple.Build.PathsModule +Distribution.Simple.BuildPaths +Distribution.Simple.Command +Distribution.Simple.Compiler +Distribution.Simple.Configure +Distribution.Simple.GHC +Distribution.Simple.Haddock +Distribution.Simple.Hugs +Distribution.Simple.Install +Distribution.Simple.InstallDirs +Distribution.Simple.JHC +Distribution.Simple.LocalBuildInfo +Distribution.Simple.NHC +Distribution.Simple.PackageIndex +Distribution.Simple.PreProcess +Distribution.Simple.PreProcess.Unlit +Distribution.Simple.Program +Distribution.Simple.Register +Distribution.Simple.Setup +Distribution.Simple.SrcDist +Distribution.Simple.UserHooks +Distribution.Simple.Utils +Distribution.System +Distribution.Text +Distribution.Verbosity +Distribution.Version +Double +EQ +Either +EmptyDataDecls +Enum +Eq +ExistentialQuantification +ExtendedDefaultRules +False +FilePath +FlexibleContexts +FlexibleInstances +Float +Floating +Foreign +Foreign.C +Foreign.C.Error +Foreign.C.String +Foreign.C.Types +Foreign.Concurrent +Foreign.ForeignPtr +Foreign.Marshal +Foreign.Marshal.Alloc +Foreign.Marshal.Array +Foreign.Marshal.Error +Foreign.Marshal.Pool +Foreign.Marshal.Utils +Foreign.Ptr +Foreign.StablePtr +Foreign.Storable +ForeignFunctionInterface +Fractional +FunctionnalDependencies +Functor +GADTs +GHC.Arr +GHC.Bool +GHC.Conc +GHC.ConsoleHandler +GHC.Desugar +GHC.Environment +GHC.Err +GHC.Exts +GHC.Generics +GHC.Handle +GHC.Ordering +GHC.PArr +GHC.Prim +GHC.PrimopWrappers +GHC.Tuple +GHC.Types +GHC.Unicode +GHC.Unit +GT +GeneralizedNewtypeDeriving +Generics +INCLUDE +INLINE +IO +IOError +IOException +ImplicitParams +ImplicitPrelude +ImpredicativeTypes +IncoherentInstances +Int +Integer +Integral +Just +KindSignatures +LANGUAGE +LINE +LT +Language.Haskell.Extension +Language.Haskell.Lexer +Language.Haskell.ParseMonad +Language.Haskell.ParseUtils +Language.Haskell.Parser +Language.Haskell.Pretty +Language.Haskell.Syntax +Language.Haskell.TH +Language.Haskell.TH.Lib +Language.Haskell.TH.Ppr +Language.Haskell.TH.PprLib +Language.Haskell.TH.Quote +Language.Haskell.TH.Syntax +Left +LiberalTypeSynonyms +MagicHash +Maybe +Monad +MonoPatBinds +MonomorphismRestriction +MultiParamTypeClasses +NOINLINE +NamedFieldPuns +Network +Network.BSD +Network.Socket +Network.URI +NewQualifiedOperators +NoArrows +NoBangPatterns +NoCPP +NoConstrainedClassMethods +NoDeriveDataTypeable +NoDisambiguateRecordFields +NoEmptyDataDecls +NoExistentialQuantification +NoExtendedDefaultRules +NoFlexibleContexts +NoFlexibleInstances +NoForeignFunctionInterface +NoFunctionnalDependencies +NoGADTs +NoGeneralizedNewtypeDeriving +NoGenerics +NoImplicitParams +NoImplicitPrelude +NoImpredicativeTypes +NoIncoherentInstances +NoKindSignatures +NoLiberalTypeSynonyms +NoMagicHash +NoMonoPatBinds +NoMonomorphismRestriction +NoMultiParamTypeClasses +NoNamedFieldPuns +NoNewQualifiedOperators +NoOverlappingInstances +NoOverloadedStrings +NoPArr +NoPackageImports +NoParallelListComp +NoPatternGuards +NoPolymorphicComponents +NoQuasiQuotes +NoRank2Types +NoRankNTypes +NoRecordWildCards +NoRecursiveDo +NoRelaxedPolyRec +NoScopedTypeVariables +NoStandaloneDeriving +NoTemplateHaskell +NoTransformListComp +NoTypeFamilies +NoTypeOperators +NoTypeSynonymInstances +NoUnboxedTuples +NoUndecidableInstances +NoUnicodeSyntax +NoUnliftedFFITypes +NoViewPatterns +Nothing +Num +Numeric +OPTIONS_GHC +Ord +Ordering +OverlappingInstances +OverloadedStrings +PArr +PackageImports +ParallelListComp +PatternGuards +PolymorphicComponents +Prelude +QuasiQuotes +RULES +Rank2Types +RankNTypes +Ratio +Read +ReadS +Real +RealFloat +RealFrac +RecordWildCards +RecursiveDo +RelaxedPolyRec +Right +SOURCE +SPECIALIZE +ScopedTypeVariables +ShowS +StandaloneDeriving +String +System.CPUTime +System.Cmd +System.Console.Editline +System.Console.GetOpt +System.Console.Readline +System.Directory +System.Environment +System.Exit +System.FilePath +System.FilePath.Posix +System.FilePath.Windows +System.IO +System.IO.Error +System.IO.Unsafe +System.Info +System.Locale +System.Mem +System.Mem.StableName +System.Mem.Weak +System.Posix +System.Posix.Directory +System.Posix.DynamicLinker +System.Posix.DynamicLinker.Module +System.Posix.DynamicLinker.Prim +System.Posix.Env +System.Posix.Error +System.Posix.Files +System.Posix.IO +System.Posix.Process +System.Posix.Process.Internals +System.Posix.Resource +System.Posix.Semaphore +System.Posix.SharedMem +System.Posix.Signals +System.Posix.Signals.Exts +System.Posix.Temp +System.Posix.Terminal +System.Posix.Time +System.Posix.Types +System.Posix.Unistd +System.Posix.User +System.Process +System.Random +System.Time +System.Timeout +TemplateHaskell +Test.HUnit +Test.HUnit.Base +Test.HUnit.Lang +Test.HUnit.Terminal +Test.HUnit.Text +Test.QuickCheck +Test.QuickCheck.Batch +Test.QuickCheck.Poly +Test.QuickCheck.Utils +Text.Html +Text.Html.BlockTable +Text.ParserCombinators.Parsec +Text.ParserCombinators.Parsec.Char +Text.ParserCombinators.Parsec.Combinator +Text.ParserCombinators.Parsec.Error +Text.ParserCombinators.Parsec.Expr +Text.ParserCombinators.Parsec.Language +Text.ParserCombinators.Parsec.Perm +Text.ParserCombinators.Parsec.Pos +Text.ParserCombinators.Parsec.Prim +Text.ParserCombinators.Parsec.Token +Text.ParserCombinators.ReadP +Text.ParserCombinators.ReadPrec +Text.PrettyPrint +Text.PrettyPrint.HughesPJ +Text.Printf +Text.Read +Text.Read.Lex +Text.Regex.Base +Text.Regex.Base.Context +Text.Regex.Base.Impl +Text.Regex.Base.RegexLike +Text.Regex.Posix +Text.Regex.Posix.ByteString +Text.Regex.Posix.String +Text.Regex.Posix.Wrap +Text.Show +Text.Show.Functions +Text.XHtml +Text.XHtml.Debug +Text.XHtml.Frameset +Text.XHtml.Strict +Text.XHtml.Table +Text.XHtml.Transitional +Trace.Hpc.Mix +Trace.Hpc.Reflect +Trace.Hpc.Tix +Trace.Hpc.Util +TransformListComp +True +TypeFamilies +TypeOperators +TypeSynonymInstances +UNPACK +UnboxedTuples +UndecidableInstances +UnicodeSyntax +UnliftedFFITypes +Unsafe.Coerce +ViewPatterns +WARNING +abs +acos +acosh +all +and +any +appendFile +as +asTypeOf +asin +asinh +atan +atan2 +atanh +break +case +catch +ceiling +class +compare +concat +concatMap +const +cos +cosh +curry +cycle +data +decodeFloat +default +deriving +div +divMod +do +drop +dropWhile +either +elem +else +encodeFloat +enumFrom +enumFromThen +enumFromThenTo +enumFromTo +error +exp +exponent +fail +filter +flip +floatDigits +floatRadix +floatRange +floor +fmap +fold +fold1 +foldr +foldr1 +fromEnum +fromInteger +fromIntegral +fromRational +fst +gcd +getChar +getContents +getLine +head +hiding +id +if +import +in +infix +infixl +infixr +init +instance +intract +ioError +isDenormalized +isIEEE +isInfinite +isNan +isNegativeZero +iterate +last +lcm +length +let +lex +lines +log +logBase +lookup +map +mapM +mapM_ +max +maxBound +maximum +maybe +min +minBound +minimum +mod +module +negate +newtype +not +notElem +null +odd +of +or +otherwise +pi +pred +print +product +properFraction +putChar +putStr +putStrLn +qualified +quot +quotRem +read +readFile +readIO +readList +readLn +readParen +reads +readsPrec +realtoFrac +recip +rem +repeat +replicate +return +reverse +round +scaleFloat +scanl +scanl1 +scanr +scanr1 +seq +sequence +sequence_ +show +showChar +showList +showParen +showString +shows +showsPrec +significand +signum +sin +sinh +snd +span +splitAt +sqrt +subtract +succ +sum +tail +take +takeWhile +tan +tanh +then +toEnum +toInteger +toRational +truncate +type +uncurry +undefined +unlines +until +unwords +unzip +unzip3 +userError +where +words +writeFile +zip +zip3 +zipWith +zipWith3 \ No newline at end of file diff --git a/elpa/auto-complete-20140803.2118/dict/java-mode b/elpa/auto-complete-20140803.2118/dict/java-mode new file mode 100644 index 000000000..125deeb50 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/java-mode @@ -0,0 +1,53 @@ +abstract +assert +boolean +break +byte +case +catch +char +class +const +continue +default +do +double +else +enum +extends +final +finally +float +for +goto +if +implements +import +instanceof +int +interface +long +native +new +package +private +protected +public +return +short +static +strictfp +super +switch +synchronized +this +throw +throws +transient +try +void +volatile +while +@Override +@Deprecated +@SuppressWarnings \ No newline at end of file diff --git a/elpa/auto-complete-20140803.2118/dict/javascript-mode b/elpa/auto-complete-20140803.2118/dict/javascript-mode new file mode 100644 index 000000000..3d83f8439 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/javascript-mode @@ -0,0 +1,148 @@ +Anchor +Area +Array +Boolean +Button +Checkbox +Date +Document +Element +FileUpload +Form +Frame +Function +Hidden +History +Image +Infinity +JavaArray +JavaClass +JavaObject +JavaPackage +Link +Location +Math +MimeType +NaN +Navigator +Number +Object +Option +Packages +Password +Plugin +Radio +RegExp +Reset +Select +String +Submit +Text +Textarea +Window +alert +arguments +assign +blur +break +callee +caller +captureEvents +case +clearInterval +clearTimeout +close +closed +comment +confirm +constructor +continue +default +defaultStatus +delete +do +document +else +escape +eval +export +find +focus +for +frames +function +getClass +history +home +if +import +in +innerHeight +innerWidth +isFinite +isNan +java +label +length +location +locationbar +menubar +moveBy +moveTo +name +navigate +navigator +netscape +new +onBlur +onError +onFocus +onLoad +onUnload +open +opener +outerHeight +outerWidth +pageXoffset +pageYoffset +parent +parseFloat +parseInt +personalbar +print +prompt +prototype +ref +releaseEvents +resizeBy +resizeTo +return +routeEvent +scroll +scrollBy +scrollTo +scrollbars +self +setInterval +setTimeout +status +statusbar +stop +sun +switch +taint +this +toString +toolbar +top +typeof +unescape +untaint +unwatch +valueOf +var +void +watch +while +window +with diff --git a/elpa/auto-complete-20140803.2118/dict/lua-mode b/elpa/auto-complete-20140803.2118/dict/lua-mode new file mode 100644 index 000000000..d0de6a4d7 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/lua-mode @@ -0,0 +1,21 @@ +and +break +do +else +elseif +end +false +for +function +if +in +local +nil +not +or +repeat +return +then +true +until +while diff --git a/elpa/auto-complete-20140803.2118/dict/php-mode b/elpa/auto-complete-20140803.2118/dict/php-mode new file mode 100644 index 000000000..07f2e8986 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/php-mode @@ -0,0 +1,6144 @@ +abs +acos +acosh +addcslashes +addslashes +aggregate +aggregate_info +aggregate_methods +aggregate_methods_by_list +aggregate_methods_by_regexp +aggregate_properties +aggregate_properties_by_list +aggregate_properties_by_regexp +aggregation_info +amqpconnection +amqpexchange +amqpqueue +and +apache_child_terminate +apache_getenv +apache_get_modules +apache_get_version +apache_lookup_uri +apache_note +apache_request_headers +apache_reset_timeout +apache_response_headers +apache_setenv +apc_add +apc_bin_dump +apc_bin_dumpfile +apc_bin_load +apc_bin_loadfile +apc_cache_info +apc_cas +apc_clear_cache +apc_compile_file +apc_dec +apc_define_constants +apc_delete +apc_delete_file +apc_exists +apc_fetch +apc_inc +apciterator +apc_load_constants +apc_sma_info +apc_store +apd_breakpoint +apd_callstack +apd_clunk +apd_continue +apd_croak +apd_dump_function_table +apd_dump_persistent_resources +apd_dump_regular_resources +apd_echo +apd_get_active_symbols +apd_set_pprof_trace +apd_set_session +apd_set_session_trace +apd_set_session_trace_socket +appenditerator +array +arrayaccess +array_change_key_case +array_chunk +array_combine +array_count_values +array_diff +array_diff_assoc +array_diff_key +array_diff_uassoc +array_diff_ukey +array_fill +array_fill_keys +array_filter +array_flip +array_intersect +array_intersect_assoc +array_intersect_key +array_intersect_uassoc +array_intersect_ukey +arrayiterator +array_key_exists +array_keys +array_map +array_merge +array_merge_recursive +array_multisort +arrayobject +array_pad +array_pop +array_product +array_push +array_rand +array_reduce +array_replace +array_replace_recursive +array_reverse +array_search +array_shift +array_slice +array_splice +array_sum +array_udiff +array_udiff_assoc +array_udiff_uassoc +array_uintersect +array_uintersect_assoc +array_uintersect_uassoc +array_unique +array_unshift +array_values +array_walk +array_walk_recursive +arsort +as +asin +asinh +asort +assert +assert_options +atan +atan2 +atanh +badfunctioncallexception +badmethodcallexception +base64_decode +base64_encode +base_convert +basename +bbcode_add_element +bbcode_add_smiley +bbcode_create +bbcode_destroy +bbcode_parse +bbcode_set_arg_parser +bbcode_set_flags +bcadd +bccomp +bcdiv +bcmod +bcmul +bcompiler_load +bcompiler_load_exe +bcompiler_parse_class +bcompiler_read +bcompiler_write_class +bcompiler_write_constant +bcompiler_write_exe_footer +bcompiler_write_file +bcompiler_write_footer +bcompiler_write_function +bcompiler_write_functions_from_file +bcompiler_write_header +bcompiler_write_included_filename +bcpow +bcpowmod +bcscale +bcsqrt +bcsub +bin2hex +bindec +bindtextdomain +bind_textdomain_codeset +break +bson_decode +bson_encode +bumpValue +bzclose +bzcompress +bzdecompress +bzerrno +bzerror +bzerrstr +bzflush +bzopen +bzread +bzwrite +cachingiterator +cairo +cairoantialias +cairocontent +cairocontext +cairo_create +cairoexception +cairoextend +cairofillrule +cairofilter +cairofontface +cairo_font_face_get_type +cairo_font_face_status +cairofontoptions +cairo_font_options_create +cairo_font_options_equal +cairo_font_options_get_antialias +cairo_font_options_get_hint_metrics +cairo_font_options_get_hint_style +cairo_font_options_get_subpixel_order +cairo_font_options_hash +cairo_font_options_merge +cairo_font_options_set_antialias +cairo_font_options_set_hint_metrics +cairo_font_options_set_hint_style +cairo_font_options_set_subpixel_order +cairo_font_options_status +cairofontslant +cairofonttype +cairofontweight +cairoformat +cairo_format_stride_for_width +cairogradientpattern +cairohintmetrics +cairohintstyle +cairoimagesurface +cairo_image_surface_create +cairo_image_surface_create_for_data +cairo_image_surface_create_from_png +cairo_image_surface_get_data +cairo_image_surface_get_format +cairo_image_surface_get_height +cairo_image_surface_get_stride +cairo_image_surface_get_width +cairolineargradient +cairolinecap +cairolinejoin +cairomatrix +cairo_matrix_create_scale +cairo_matrix_create_translate +cairo_matrix_invert +cairo_matrix_multiply +cairo_matrix_rotate +cairo_matrix_transform_distance +cairo_matrix_transform_point +cairo_matrix_translate +cairooperator +cairopath +cairopattern +cairo_pattern_add_color_stop_rgb +cairo_pattern_add_color_stop_rgba +cairo_pattern_create_for_surface +cairo_pattern_create_linear +cairo_pattern_create_radial +cairo_pattern_create_rgb +cairo_pattern_create_rgba +cairo_pattern_get_color_stop_count +cairo_pattern_get_color_stop_rgba +cairo_pattern_get_extend +cairo_pattern_get_filter +cairo_pattern_get_linear_points +cairo_pattern_get_matrix +cairo_pattern_get_radial_circles +cairo_pattern_get_rgba +cairo_pattern_get_surface +cairo_pattern_get_type +cairo_pattern_set_extend +cairo_pattern_set_filter +cairo_pattern_set_matrix +cairo_pattern_status +cairopatterntype +cairopdfsurface +cairo_pdf_surface_create +cairo_pdf_surface_set_size +cairo_ps_get_levels +cairopslevel +cairo_ps_level_to_string +cairopssurface +cairo_ps_surface_create +cairo_ps_surface_dsc_begin_page_setup +cairo_ps_surface_dsc_begin_setup +cairo_ps_surface_dsc_comment +cairo_ps_surface_get_eps +cairo_ps_surface_restrict_to_level +cairo_ps_surface_set_eps +cairo_ps_surface_set_size +cairoradialgradient +cairoscaledfont +cairo_scaled_font_create +cairo_scaled_font_extents +cairo_scaled_font_get_ctm +cairo_scaled_font_get_font_face +cairo_scaled_font_get_font_matrix +cairo_scaled_font_get_font_options +cairo_scaled_font_get_scale_matrix +cairo_scaled_font_get_type +cairo_scaled_font_glyph_extents +cairo_scaled_font_status +cairo_scaled_font_text_extents +cairosolidpattern +cairostatus +cairosubpixelorder +cairosurface +cairo_surface_copy_page +cairo_surface_create_similar +cairo_surface_finish +cairo_surface_flush +cairo_surface_get_content +cairo_surface_get_device_offset +cairo_surface_get_font_options +cairo_surface_get_type +cairo_surface_mark_dirty +cairo_surface_mark_dirty_rectangle +cairosurfacepattern +cairo_surface_set_device_offset +cairo_surface_set_fallback_resolution +cairo_surface_show_page +cairo_surface_status +cairosurfacetype +cairo_surface_write_to_png +cairosvgsurface +cairo_svg_surface_create +cairo_svg_surface_restrict_to_version +cairosvgversion +cairo_svg_version_to_string +cairotoyfontface +calculhmac +calcul_hmac +cal_days_in_month +cal_from_jd +cal_info +__call() +callbackfilteriterator +__callStatic() +call_user_func +call_user_func_array +call_user_method +call_user_method_array +cal_to_jd +case +catch +ceil +cfunction +chdb +chdb_create +chdir +checkdate +checkdnsrr +chgrp +chmod +chop +chown +chr +chroot +chunk_split +class +__CLASS__ +class_alias +class_exists +class_implements +classkit_import +classkit_method_add +classkit_method_copy +classkit_method_redefine +classkit_method_remove +classkit_method_rename +class_parents +clearstatcache +clone +__clone() +closedir +closelog +collator +com +com_addref +com_create_guid +com_event_sink +com_get +com_get_active_object +com_invoke +com_isenum +com_load +com_load_typelib +com_message_pump +compact +com_print_typeinfo +com_propget +com_propput +com_propset +com_release +com_set +connection_aborted +connection_status +connection_timeout +const +constant +construct +__construct() +continue +convert_cyr_string +convert_uudecode +convert_uuencode +copy +cos +cosh +count +countable +count_chars +counter_bump +counter_bump_value +counter_create +counter_get +counter_get_meta +counter_get_named +counter_get_value +counter_reset +counter_reset_value +crack_check +crack_closedict +crack_getlastmessage +crack_opendict +crc32 +create_function +crypt +ctype_alnum +ctype_alpha +ctype_cntrl +ctype_digit +ctype_graph +ctype_lower +ctype_print +ctype_punct +ctype_space +ctype_upper +ctype_xdigit +cubrid_affected_rows +cubrid_bind +cubrid_client_encoding +cubrid_close +cubrid_close_prepare +cubrid_close_request +cubrid_col_get +cubrid_col_size +cubrid_column_names +cubrid_column_types +cubrid_commit +cubrid_connect +cubrid_connect_with_url +cubrid_current_oid +cubrid_data_seek +cubrid_db_name +cubrid_disconnect +cubrid_drop +cubrid_errno +cubrid_error +cubrid_error_code +cubrid_error_code_facility +cubrid_error_msg +cubrid_execute +cubrid_fetch +cubrid_fetch_array +cubrid_fetch_assoc +cubrid_fetch_field +cubrid_fetch_lengths +cubrid_fetch_object +cubrid_fetch_row +cubrid_field_flags +cubrid_field_len +cubrid_field_name +cubrid_field_seek +cubrid_field_table +cubrid_field_type +cubrid_free_result +cubrid_get +cubrid_get_autocommit +cubrid_get_charset +cubrid_get_class_name +cubrid_get_client_info +cubrid_get_db_parameter +cubrid_get_server_info +cubrid_insert_id +cubrid_is_instance +cubrid_list_dbs +cubrid_load_from_glo +cubrid_lob_close +cubrid_lob_export +cubrid_lob_get +cubrid_lob_send +cubrid_lob_size +cubrid_lock_read +cubrid_lock_write +cubrid_move_cursor +cubrid_new_glo +cubrid_next_result +cubrid_num_cols +cubrid_num_fields +cubrid_num_rows +cubrid_ping +cubrid_prepare +cubrid_put +cubrid_query +cubrid_real_escape_string +cubrid_result +cubrid_rollback +cubrid_save_to_glo +cubrid_schema +cubrid_send_glo +cubrid_seq_drop +cubrid_seq_insert +cubrid_seq_put +cubrid_set_add +cubrid_set_autocommit +cubrid_set_db_parameter +cubrid_set_drop +cubrid_unbuffered_query +cubrid_version +curl_close +curl_copy_handle +curl_errno +curl_error +curl_exec +curl_getinfo +curl_init +curl_multi_add_handle +curl_multi_close +curl_multi_exec +curl_multi_getcontent +curl_multi_info_read +curl_multi_init +curl_multi_remove_handle +curl_multi_select +curl_setopt +curl_setopt_array +curl_version +current +cyrus_authenticate +cyrus_bind +cyrus_close +cyrus_connect +cyrus_query +cyrus_unbind +date +date_add +date_create +date_create_from_format +date_date_set +date_default_timezone_get +date_default_timezone_set +date_diff +date_format +date_get_last_errors +dateinterval +date_interval_create_from_date_string +date_interval_format +date_isodate_set +date_modify +date_offset_get +date_parse +date_parse_from_format +dateperiod +date_sub +date_sun_info +date_sunrise +date_sunset +datetime +date_time_set +date_timestamp_get +date_timestamp_set +datetimezone +date_timezone_get +date_timezone_set +db2_autocommit +db2_bind_param +db2_client_info +db2_close +db2_column_privileges +db2_columns +db2_commit +db2_connect +db2_conn_error +db2_conn_errormsg +db2_cursor_type +db2_escape_string +db2_exec +db2_execute +db2_fetch_array +db2_fetch_assoc +db2_fetch_both +db2_fetch_object +db2_fetch_row +db2_field_display_size +db2_field_name +db2_field_num +db2_field_precision +db2_field_scale +db2_field_type +db2_field_width +db2_foreign_keys +db2_free_result +db2_free_stmt +db2_get_option +db2_last_insert_id +db2_lob_read +db2_next_result +db2_num_fields +db2_num_rows +db2_pclose +db2_pconnect +db2_prepare +db2_primary_keys +db2_procedure_columns +db2_procedures +db2_result +db2_rollback +db2_server_info +db2_set_option +db2_special_columns +db2_statistics +db2_stmt_error +db2_stmt_errormsg +db2_table_privileges +db2_tables +dba_close +dba_delete +dba_exists +dba_fetch +dba_firstkey +dba_handlers +dba_insert +dba_key_split +dba_list +dba_nextkey +dba_open +dba_optimize +dba_popen +dba_replace +dbase_add_record +dbase_close +dbase_create +dbase_delete_record +dbase_get_header_info +dbase_get_record +dbase_get_record_with_names +dbase_numfields +dbase_numrecords +dbase_open +dbase_pack +dbase_replace_record +dba_sync +dbplus_add +dbplus_aql +dbplus_chdir +dbplus_close +dbplus_curr +dbplus_errcode +dbplus_errno +dbplus_find +dbplus_first +dbplus_flush +dbplus_freealllocks +dbplus_freelock +dbplus_freerlocks +dbplus_getlock +dbplus_getunique +dbplus_info +dbplus_last +dbplus_lockrel +dbplus_next +dbplus_open +dbplus_prev +dbplus_rchperm +dbplus_rcreate +dbplus_rcrtexact +dbplus_rcrtlike +dbplus_resolve +dbplus_restorepos +dbplus_rkeys +dbplus_ropen +dbplus_rquery +dbplus_rrename +dbplus_rsecindex +dbplus_runlink +dbplus_rzap +dbplus_savepos +dbplus_setindex +dbplus_setindexbynumber +dbplus_sql +dbplus_tcl +dbplus_tremove +dbplus_undo +dbplus_undoprepare +dbplus_unlockrel +dbplus_unselect +dbplus_update +dbplus_xlockrel +dbplus_xunlockrel +dbx_close +dbx_compare +dbx_connect +dbx_error +dbx_escape_string +dbx_fetch_row +dbx_query +dbx_sort +dcgettext +dcngettext +deaggregate +debug_backtrace +debug_print_backtrace +debug_zval_dump +decbin +dechex +declare +decoct +default +define +defined +define_syslog_variables +deg2rad +delete +__destruct() +dgettext +die +dio_close +dio_fcntl +dio_open +dio_read +dio_seek +dio_stat +dio_tcsetattr +dio_truncate +dio_write +dir +__DIR__ +directoryiterator +dirname +diskfreespace +disk_free_space +disk_total_space +dl +dngettext +dns_check_record +dns_get_mx +dns_get_record +do +domainexception +domattr +domattribute_name +domattribute_set_value +domattribute_specified +domattribute_value +domcharacterdata +domcomment +domdocument +domdocument_add_root +domdocument_create_attribute +domdocument_create_cdata_section +domdocument_create_comment +domdocument_create_element +domdocument_create_element_ns +domdocument_create_entity_reference +domdocument_create_processing_instruction +domdocument_create_text_node +domdocument_doctype +domdocument_document_element +domdocument_dump_file +domdocument_dump_mem +domdocumentfragment +domdocument_get_element_by_id +domdocument_get_elements_by_tagname +domdocument_html_dump_mem +domdocumenttype +domdocumenttype_entities +domdocumenttype_internal_subset +domdocumenttype_name +domdocumenttype_notations +domdocumenttype_public_id +domdocumenttype_system_id +domdocument_xinclude +domelement +domelement_get_attribute +domelement_get_attribute_node +domelement_get_elements_by_tagname +domelement_has_attribute +domelement_remove_attribute +domelement_set_attribute +domelement_set_attribute_node +domelement_tagname +domentity +domentityreference +domexception +domimplementation +dom_import_simplexml +domnamednodemap +domnode +domnode_add_namespace +domnode_append_child +domnode_append_sibling +domnode_attributes +domnode_child_nodes +domnode_clone_node +domnode_dump_node +domnode_first_child +domnode_get_content +domnode_has_attributes +domnode_has_child_nodes +domnode_insert_before +domnode_is_blank_node +domnode_last_child +domnodelist +domnode_next_sibling +domnode_node_name +domnode_node_type +domnode_node_value +domnode_owner_document +domnode_parent_node +domnode_prefix +domnode_previous_sibling +domnode_remove_child +domnode_replace_child +domnode_replace_node +domnode_set_content +domnode_set_name +domnode_set_namespace +domnode_unlink_node +domnotation +domprocessinginstruction +domprocessinginstruction_data +domprocessinginstruction_target +domtext +domxml_new_doc +domxml_open_file +domxml_open_mem +domxml_version +domxml_xmltree +domxml_xslt_stylesheet +domxml_xslt_stylesheet_doc +domxml_xslt_stylesheet_file +domxml_xslt_version +domxpath +domxsltstylesheet_process +domxsltstylesheet_result_dump_file +domxsltstylesheet_result_dump_mem +dotnet +dotnet_load +doubleval +each +easter_date +easter_days +echo +else +elseif +empty +emptyiterator +enchant_broker_describe +enchant_broker_dict_exists +enchant_broker_free +enchant_broker_free_dict +enchant_broker_get_error +enchant_broker_init +enchant_broker_list_dicts +enchant_broker_request_dict +enchant_broker_request_pwl_dict +enchant_broker_set_ordering +enchant_dict_add_to_personal +enchant_dict_add_to_session +enchant_dict_check +enchant_dict_describe +enchant_dict_get_error +enchant_dict_is_in_session +enchant_dict_quick_check +enchant_dict_store_replacement +enchant_dict_suggest +end +enddeclare +endfor +endforeach +endif +endswitch +endwhile +ereg +eregi +eregi_replace +ereg_replace +errorexception +error_get_last +error_log +error_reporting +escapeshellarg +escapeshellcmd +eval +event_add +event_base_free +event_base_loop +event_base_loopbreak +event_base_loopexit +event_base_new +event_base_priority_init +event_base_set +event_buffer_base_set +event_buffer_disable +event_buffer_enable +event_buffer_fd_set +event_buffer_free +event_buffer_new +event_buffer_priority_set +event_buffer_read +event_buffer_set_callback +event_buffer_timeout_set +event_buffer_watermark_set +event_buffer_write +event_del +event_free +event_new +event_set +exception +exec +exif_imagetype +exif_read_data +exif_tagname +exif_thumbnail +exit +exp +expect_expectl +expect_popen +explode +expm1 +export +extends +extension_loaded +extract +ezmlm_hash +fam_cancel_monitor +fam_close +fam_monitor_collection +fam_monitor_directory +fam_monitor_file +fam_next_event +fam_open +fam_pending +fam_resume_monitor +fam_suspend_monitor +fbsql_affected_rows +fbsql_autocommit +fbsql_blob_size +fbsql_change_user +fbsql_clob_size +fbsql_close +fbsql_commit +fbsql_connect +fbsql_create_blob +fbsql_create_clob +fbsql_create_db +fbsql_database +fbsql_database_password +fbsql_data_seek +fbsql_db_query +fbsql_db_status +fbsql_drop_db +fbsql_errno +fbsql_error +fbsql_fetch_array +fbsql_fetch_assoc +fbsql_fetch_field +fbsql_fetch_lengths +fbsql_fetch_object +fbsql_fetch_row +fbsql_field_flags +fbsql_field_len +fbsql_field_name +fbsql_field_seek +fbsql_field_table +fbsql_field_type +fbsql_free_result +fbsql_get_autostart_info +fbsql_hostname +fbsql_insert_id +fbsql_list_dbs +fbsql_list_fields +fbsql_list_tables +fbsql_next_result +fbsql_num_fields +fbsql_num_rows +fbsql_password +fbsql_pconnect +fbsql_query +fbsql_read_blob +fbsql_read_clob +fbsql_result +fbsql_rollback +fbsql_rows_fetched +fbsql_select_db +fbsql_set_characterset +fbsql_set_lob_mode +fbsql_set_password +fbsql_set_transaction +fbsql_start_db +fbsql_stop_db +fbsql_tablename +fbsql_table_name +fbsql_username +fbsql_warnings +fclose +fdf_add_doc_javascript +fdf_add_template +fdf_close +fdf_create +fdf_enum_values +fdf_errno +fdf_error +fdf_get_ap +fdf_get_attachment +fdf_get_encoding +fdf_get_file +fdf_get_flags +fdf_get_opt +fdf_get_status +fdf_get_value +fdf_get_version +fdf_header +fdf_next_field_name +fdf_open +fdf_open_string +fdf_remove_item +fdf_save +fdf_save_string +fdf_set_ap +fdf_set_encoding +fdf_set_file +fdf_set_flags +fdf_set_javascript_action +fdf_set_on_import_javascript +fdf_set_opt +fdf_set_status +fdf_set_submit_form_action +fdf_set_target_frame +fdf_set_value +fdf_set_version +feof +fflush +fgetc +fgetcsv +fgets +fgetss +file +__FILE__ +fileatime +filectime +file_exists +file_get_contents +filegroup +fileinode +filemtime +fileowner +fileperms +filepro +filepro_fieldcount +filepro_fieldname +filepro_fieldtype +filepro_fieldwidth +filepro_retrieve +filepro_rowcount +file_put_contents +filesize +filesystemiterator +filetype +filter_has_var +filter_id +filter_input +filter_input_array +filteriterator +filter_list +filter_var +filter_var_array +final +finfo_buffer +finfo_close +finfo_file +finfo_open +finfo_set_flags +floatval +flock +floor +flush +fmod +fnmatch +fopen +for +foreach +forward_static_call +forward_static_call_array +fpassthru +fprintf +fputcsv +fputs +fread +frenchtojd +fribidi_log2vis +fscanf +fseek +fsockopen +fstat +ftell +ftok +ftp_alloc +ftp_cdup +ftp_chdir +ftp_chmod +ftp_close +ftp_connect +ftp_delete +ftp_exec +ftp_fget +ftp_fput +ftp_get +ftp_get_option +ftp_login +ftp_mdtm +ftp_mkdir +ftp_nb_continue +ftp_nb_fget +ftp_nb_fput +ftp_nb_get +ftp_nb_put +ftp_nlist +ftp_pasv +ftp_put +ftp_pwd +ftp_quit +ftp_raw +ftp_rawlist +ftp_rename +ftp_rmdir +ftp_set_option +ftp_site +ftp_size +ftp_ssl_connect +ftp_systype +ftruncate +func_get_arg +func_get_args +func_num_args +function +__FUNCTION__ +function_exists +fwrite +gc_collect_cycles +gc_disable +gc_enable +gc_enabled +gd_info +gearmanclient +gearmanjob +gearmantask +gearmanworker +geoip_continent_code_by_name +geoip_country_code3_by_name +geoip_country_code_by_name +geoip_country_name_by_name +geoip_database_info +geoip_db_avail +geoip_db_filename +geoip_db_get_all_info +geoip_id_by_name +geoip_isp_by_name +geoip_org_by_name +geoip_record_by_name +geoip_region_by_name +geoip_region_name_by_code +geoip_time_zone_by_country_and_region +__get() +getallheaders +get_browser +get_called_class +get_cfg_var +get_class +get_class_methods +get_class_vars +getclosure +getconstant +getconstants +getconstructor +get_current_user +getcwd +getdate +get_declared_classes +get_declared_interfaces +getdefaultproperties +get_defined_constants +get_defined_functions +get_defined_vars +getdoccomment +getendline +getenv +getextension +get_extension_funcs +getextensionname +getfilename +get_headers +gethostbyaddr +gethostbyname +gethostbynamel +gethostname +get_html_translation_table +getimagesize +get_included_files +get_include_path +getinterfacenames +getinterfaces +getlastmod +get_loaded_extensions +get_magic_quotes_gpc +get_magic_quotes_runtime +getMeta +get_meta_tags +getmethod +getmethods +getmodifiers +getmxrr +getmygid +getmyinode +getmypid +getmyuid +getname +getNamed +getnamespacename +get_object_vars +getopt +getparentclass +get_parent_class +getproperties +getproperty +getprotobyname +getprotobynumber +getrandmax +get_required_files +get_resource_type +getrusage +getservbyname +getservbyport +getshortname +getstartline +getstaticproperties +getstaticpropertyvalue +gettext +gettimeofday +gettraitaliases +gettraitnames +gettraits +gettype +getValue +glob +global +globiterator +gmagick +gmagickdraw +gmagickpixel +gmdate +gmmktime +gmp_abs +gmp_add +gmp_and +gmp_clrbit +gmp_cmp +gmp_com +gmp_div +gmp_divexact +gmp_div_q +gmp_div_qr +gmp_div_r +gmp_fact +gmp_gcd +gmp_gcdext +gmp_hamdist +gmp_init +gmp_intval +gmp_invert +gmp_jacobi +gmp_legendre +gmp_mod +gmp_mul +gmp_neg +gmp_nextprime +gmp_or +gmp_perfect_square +gmp_popcount +gmp_pow +gmp_powm +gmp_prob_prime +gmp_random +gmp_scan0 +gmp_scan1 +gmp_setbit +gmp_sign +gmp_sqrt +gmp_sqrtrem +gmp_strval +gmp_sub +gmp_testbit +gmp_xor +gmstrftime +gnupg_adddecryptkey +gnupg_addencryptkey +gnupg_addsignkey +gnupg_cleardecryptkeys +gnupg_clearencryptkeys +gnupg_clearsignkeys +gnupg_decrypt +gnupg_decryptverify +gnupg_encrypt +gnupg_encryptsign +gnupg_export +gnupg_geterror +gnupg_getprotocol +gnupg_import +gnupg_init +gnupg_keyinfo +gnupg_setarmor +gnupg_seterrormode +gnupg_setsignmode +gnupg_sign +gnupg_verify +gopher_parsedir +goto +grapheme_extract +grapheme_stripos +grapheme_stristr +grapheme_strlen +grapheme_strpos +grapheme_strripos +grapheme_strrpos +grapheme_strstr +grapheme_substr +gregoriantojd +gupnp_context_get_host_ip +gupnp_context_get_port +gupnp_context_get_subscription_timeout +gupnp_context_host_path +gupnp_context_new +gupnp_context_set_subscription_timeout +gupnp_context_timeout_add +gupnp_context_unhost_path +gupnp_control_point_browse_start +gupnp_control_point_browse_stop +gupnp_control_point_callback_set +gupnp_control_point_new +gupnp_device_action_callback_set +gupnp_device_info_get +gupnp_device_info_get_service +gupnp_root_device_get_available +gupnp_root_device_get_relative_location +gupnp_root_device_new +gupnp_root_device_set_available +gupnp_root_device_start +gupnp_root_device_stop +gupnp_service_action_get +gupnp_service_action_return +gupnp_service_action_return_error +gupnp_service_action_set +gupnp_service_freeze_notify +gupnp_service_info_get +gupnp_service_info_get_introspection +gupnp_service_introspection_get_state_variable +gupnp_service_notify +gupnp_service_proxy_action_get +gupnp_service_proxy_action_set +gupnp_service_proxy_add_notify +gupnp_service_proxy_callback_set +gupnp_service_proxy_get_subscribed +gupnp_service_proxy_remove_notify +gupnp_service_proxy_set_subscribed +gupnp_service_thaw_notify +gzclose +gzcompress +gzdecode +gzdeflate +gzencode +gzeof +gzfile +gzgetc +gzgets +gzgetss +gzinflate +gzopen +gzpassthru +gzputs +gzread +gzrewind +gzseek +gztell +gzuncompress +gzwrite +halt_compiler +haruannotation +haruannotation_setborderstyle +haruannotation_sethighlightmode +haruannotation_seticon +haruannotation_setopened +harudestination +harudestination_setfit +harudestination_setfitb +harudestination_setfitbh +harudestination_setfitbv +harudestination_setfith +harudestination_setfitr +harudestination_setfitv +harudestination_setxyz +harudoc +harudoc_addpage +harudoc_addpagelabel +harudoc_construct +harudoc_createoutline +harudoc_getcurrentencoder +harudoc_getcurrentpage +harudoc_getencoder +harudoc_getfont +harudoc_getinfoattr +harudoc_getpagelayout +harudoc_getpagemode +harudoc_getstreamsize +harudoc_insertpage +harudoc_loadjpeg +harudoc_loadpng +harudoc_loadraw +harudoc_loadttc +harudoc_loadttf +harudoc_loadtype1 +harudoc_output +harudoc_readfromstream +harudoc_reseterror +harudoc_resetstream +harudoc_save +harudoc_savetostream +harudoc_setcompressionmode +harudoc_setcurrentencoder +harudoc_setencryptionmode +harudoc_setinfoattr +harudoc_setinfodateattr +harudoc_setopenaction +harudoc_setpagelayout +harudoc_setpagemode +harudoc_setpagesconfiguration +harudoc_setpassword +harudoc_setpermission +harudoc_usecnsencodings +harudoc_usecnsfonts +harudoc_usecntencodings +harudoc_usecntfonts +harudoc_usejpencodings +harudoc_usejpfonts +harudoc_usekrencodings +harudoc_usekrfonts +haruencoder +haruencoder_getbytetype +haruencoder_gettype +haruencoder_getunicode +haruencoder_getwritingmode +haruexception +harufont +harufont_getascent +harufont_getcapheight +harufont_getdescent +harufont_getencodingname +harufont_getfontname +harufont_gettextwidth +harufont_getunicodewidth +harufont_getxheight +harufont_measuretext +haruimage +haruimage_getbitspercomponent +haruimage_getcolorspace +haruimage_getheight +haruimage_getsize +haruimage_getwidth +haruimage_setcolormask +haruimage_setmaskimage +haruoutline +haruoutline_setdestination +haruoutline_setopened +harupage +harupage_arc +harupage_begintext +harupage_circle +harupage_closepath +harupage_concat +harupage_createdestination +harupage_createlinkannotation +harupage_createtextannotation +harupage_createurlannotation +harupage_curveto +harupage_curveto2 +harupage_curveto3 +harupage_drawimage +harupage_ellipse +harupage_endpath +harupage_endtext +harupage_eofill +harupage_eofillstroke +harupage_fill +harupage_fillstroke +harupage_getcharspace +harupage_getcmykfill +harupage_getcmykstroke +harupage_getcurrentfont +harupage_getcurrentfontsize +harupage_getcurrentpos +harupage_getcurrenttextpos +harupage_getdash +harupage_getfillingcolorspace +harupage_getflatness +harupage_getgmode +harupage_getgrayfill +harupage_getgraystroke +harupage_getheight +harupage_gethorizontalscaling +harupage_getlinecap +harupage_getlinejoin +harupage_getlinewidth +harupage_getmiterlimit +harupage_getrgbfill +harupage_getrgbstroke +harupage_getstrokingcolorspace +harupage_gettextleading +harupage_gettextmatrix +harupage_gettextrenderingmode +harupage_gettextrise +harupage_gettextwidth +harupage_gettransmatrix +harupage_getwidth +harupage_getwordspace +harupage_lineto +harupage_measuretext +harupage_movetextpos +harupage_moveto +harupage_movetonextline +harupage_rectangle +harupage_setcharspace +harupage_setcmykfill +harupage_setcmykstroke +harupage_setdash +harupage_setflatness +harupage_setfontandsize +harupage_setgrayfill +harupage_setgraystroke +harupage_setheight +harupage_sethorizontalscaling +harupage_setlinecap +harupage_setlinejoin +harupage_setlinewidth +harupage_setmiterlimit +harupage_setrgbfill +harupage_setrgbstroke +harupage_setrotate +harupage_setsize +harupage_setslideshow +harupage_settextleading +harupage_settextmatrix +harupage_settextrenderingmode +harupage_settextrise +harupage_setwidth +harupage_setwordspace +harupage_showtext +harupage_showtextnextline +harupage_stroke +harupage_textout +harupage_textrect +hasconstant +hash +hash_algos +hash_copy +hash_file +hash_final +hash_hmac +hash_hmac_file +hash_init +hash_update +hash_update_file +hash_update_stream +hasmethod +hasproperty +header +header_register_callback +header_remove +headers_list +headers_sent +hebrev +hebrevc +hex2bin +hexdec +highlight_file +highlight_string +htmlentities +html_entity_decode +htmlspecialchars +htmlspecialchars_decode +http_build_cookie +http_build_query +http_build_str +http_build_url +http_cache_etag +http_cache_last_modified +http_chunked_decode +http_date +http_deflate +httpdeflatestream +httpdeflatestream_construct +httpdeflatestream_factory +httpdeflatestream_finish +httpdeflatestream_flush +httpdeflatestream_update +http_get +http_get_request_body +http_get_request_body_stream +http_get_request_headers +http_head +http_inflate +httpinflatestream +httpinflatestream_construct +httpinflatestream_factory +httpinflatestream_finish +httpinflatestream_flush +httpinflatestream_update +http_match_etag +http_match_modified +http_match_request_header +httpmessage +httpmessage_addheaders +httpmessage_construct +httpmessage_detach +httpmessage_factory +httpmessage_fromenv +httpmessage_fromstring +httpmessage_getbody +httpmessage_getheader +httpmessage_getheaders +httpmessage_gethttpversion +httpmessage_getparentmessage +httpmessage_getrequestmethod +httpmessage_getrequesturl +httpmessage_getresponsecode +httpmessage_getresponsestatus +httpmessage_gettype +httpmessage_guesscontenttype +httpmessage_prepend +httpmessage_reverse +httpmessage_send +httpmessage_setbody +httpmessage_setheaders +httpmessage_sethttpversion +httpmessage_setrequestmethod +httpmessage_setrequesturl +httpmessage_setresponsecode +httpmessage_setresponsestatus +httpmessage_settype +httpmessage_tomessagetypeobject +httpmessage_tostring +http_negotiate_charset +http_negotiate_content_type +http_negotiate_language +http_parse_cookie +http_parse_headers +http_parse_message +http_parse_params +http_persistent_handles_clean +http_persistent_handles_count +http_persistent_handles_ident +http_post_data +http_post_fields +http_put_data +http_put_file +http_put_stream +httpquerystring +httpquerystring_construct +httpquerystring_get +httpquerystring_mod +httpquerystring_set +httpquerystring_singleton +httpquerystring_toarray +httpquerystring_tostring +httpquerystring_xlate +http_redirect +httprequest +http_request +httprequest_addcookies +httprequest_addheaders +httprequest_addpostfields +httprequest_addpostfile +httprequest_addputdata +httprequest_addquerydata +httprequest_addrawpostdata +httprequest_addssloptions +http_request_body_encode +httprequest_clearhistory +httprequest_construct +httprequest_enablecookies +httprequest_getcontenttype +httprequest_getcookies +httprequest_getheaders +httprequest_gethistory +httprequest_getmethod +httprequest_getoptions +httprequest_getpostfields +httprequest_getpostfiles +httprequest_getputdata +httprequest_getputfile +httprequest_getquerydata +httprequest_getrawpostdata +httprequest_getrawrequestmessage +httprequest_getrawresponsemessage +httprequest_getrequestmessage +httprequest_getresponsebody +httprequest_getresponsecode +httprequest_getresponsecookies +httprequest_getresponsedata +httprequest_getresponseheader +httprequest_getresponseinfo +httprequest_getresponsemessage +httprequest_getresponsestatus +httprequest_getssloptions +httprequest_geturl +http_request_method_exists +http_request_method_name +http_request_method_register +http_request_method_unregister +httprequestpool +httprequestpool_attach +httprequestpool_construct +httprequestpool_destruct +httprequestpool_detach +httprequestpool_getattachedrequests +httprequestpool_getfinishedrequests +httprequestpool_reset +httprequestpool_send +httprequestpool_socketperform +httprequestpool_socketselect +httprequest_resetcookies +httprequest_send +httprequest_setcontenttype +httprequest_setcookies +httprequest_setheaders +httprequest_setmethod +httprequest_setoptions +httprequest_setpostfields +httprequest_setpostfiles +httprequest_setputdata +httprequest_setputfile +httprequest_setquerydata +httprequest_setrawpostdata +httprequest_setssloptions +httprequest_seturl +httpresponse +httpresponse_capture +http_response_code +httpresponse_getbuffersize +httpresponse_getcache +httpresponse_getcachecontrol +httpresponse_getcontentdisposition +httpresponse_getcontenttype +httpresponse_getdata +httpresponse_getetag +httpresponse_getfile +httpresponse_getgzip +httpresponse_getheader +httpresponse_getlastmodified +httpresponse_getrequestbody +httpresponse_getrequestbodystream +httpresponse_getrequestheaders +httpresponse_getstream +httpresponse_getthrottledelay +httpresponse_guesscontenttype +httpresponse_redirect +httpresponse_send +httpresponse_setbuffersize +httpresponse_setcache +httpresponse_setcachecontrol +httpresponse_setcontentdisposition +httpresponse_setcontenttype +httpresponse_setdata +httpresponse_setetag +httpresponse_setfile +httpresponse_setgzip +httpresponse_setheader +httpresponse_setlastmodified +httpresponse_setstream +httpresponse_setthrottledelay +httpresponse_status +http_send_content_disposition +http_send_content_type +http_send_data +http_send_file +http_send_last_modified +http_send_status +http_send_stream +http_support +http_throttle +hwapi_attribute +hwapi_attribute_key +hwapi_attribute_langdepvalue +hwapi_attribute_value +hwapi_attribute_values +hwapi_checkin +hwapi_checkout +hwapi_children +hwapi_content +hwapi_content_mimetype +hwapi_content_read +hwapi_copy +hwapi_dbstat +hwapi_dcstat +hwapi_dstanchors +hwapi_dstofsrcanchor +hwapi_error_count +hwapi_error_reason +hwapi_find +hwapi_ftstat +hwapi_hgcsp +hwapi_hwstat +hwapi_identify +hwapi_info +hwapi_insert +hwapi_insertanchor +hwapi_insertcollection +hwapi_insertdocument +hwapi_link +hwapi_lock +hwapi_move +hwapi_new_content +hwapi_object +hwapi_object_assign +hwapi_object_attreditable +hwapi_objectbyanchor +hwapi_object_count +hwapi_object_insert +hwapi_object_new +hwapi_object_remove +hwapi_object_title +hwapi_object_value +hwapi_parents +hwapi_reason_description +hwapi_reason_type +hwapi_remove +hwapi_replace +hwapi_setcommittedversion +hwapi_srcanchors +hwapi_srcsofdst +hwapi_unlock +hwapi_user +hwapi_userlist +hw_array2objrec +hw_changeobject +hw_children +hw_childrenobj +hw_close +hw_connect +hw_connection_info +hw_cp +hw_deleteobject +hw_docbyanchor +hw_docbyanchorobj +hw_document_attributes +hw_document_bodytag +hw_document_content +hw_document_setcontent +hw_document_size +hw_dummy +hw_edittext +hw_error +hw_errormsg +hw_free_document +hw_getanchors +hw_getanchorsobj +hw_getandlock +hw_getchildcoll +hw_getchildcollobj +hw_getchilddoccoll +hw_getchilddoccollobj +hw_getobject +hw_getobjectbyquery +hw_getobjectbyquerycoll +hw_getobjectbyquerycollobj +hw_getobjectbyqueryobj +hw_getparents +hw_getparentsobj +hw_getrellink +hw_getremote +hw_getremotechildren +hw_getsrcbydestobj +hw_gettext +hw_getusername +hw_identify +hw_incollections +hw_info +hw_inscoll +hw_insdoc +hw_insertanchors +hw_insertdocument +hw_insertobject +hw_mapid +hw_modifyobject +hw_mv +hw_new_document +hw_objrec2array +hw_output_document +hw_pconnect +hw_pipedocument +hw_root +hw_setlinkroot +hw_stat +hw_unlock +hw_who +hypot +ibase_add_user +ibase_affected_rows +ibase_backup +ibase_blob_add +ibase_blob_cancel +ibase_blob_close +ibase_blob_create +ibase_blob_echo +ibase_blob_get +ibase_blob_import +ibase_blob_info +ibase_blob_open +ibase_close +ibase_commit +ibase_commit_ret +ibase_connect +ibase_db_info +ibase_delete_user +ibase_drop_db +ibase_errcode +ibase_errmsg +ibase_execute +ibase_fetch_assoc +ibase_fetch_object +ibase_fetch_row +ibase_field_info +ibase_free_event_handler +ibase_free_query +ibase_free_result +ibase_gen_id +ibase_maintain_db +ibase_modify_user +ibase_name_result +ibase_num_fields +ibase_num_params +ibase_param_info +ibase_pconnect +ibase_prepare +ibase_query +ibase_restore +ibase_rollback +ibase_rollback_ret +ibase_server_info +ibase_service_attach +ibase_service_detach +ibase_set_event_handler +ibase_timefmt +ibase_trans +ibase_wait_event +iconv +iconv_get_encoding +iconv_mime_decode +iconv_mime_decode_headers +iconv_mime_encode +iconv_set_encoding +iconv_strlen +iconv_strpos +iconv_strrpos +iconv_substr +id3_get_frame_long_name +id3_get_frame_short_name +id3_get_genre_id +id3_get_genre_list +id3_get_genre_name +id3_get_tag +id3_get_version +id3_remove_tag +id3_set_tag +idate +idn_to_ascii +idn_to_unicode +idn_to_utf8 +if +ifx_affected_rows +ifx_blobinfile_mode +ifx_byteasvarchar +ifx_close +ifx_connect +ifx_copy_blob +ifx_create_blob +ifx_create_char +ifx_do +ifx_error +ifx_errormsg +ifx_fetch_row +ifx_fieldproperties +ifx_fieldtypes +ifx_free_blob +ifx_free_char +ifx_free_result +ifx_get_blob +ifx_get_char +ifx_getsqlca +ifx_htmltbl_result +ifx_nullformat +ifx_num_fields +ifx_num_rows +ifx_pconnect +ifx_prepare +ifx_query +ifx_textasvarchar +ifx_update_blob +ifx_update_char +ifxus_close_slob +ifxus_create_slob +ifxus_free_slob +ifxus_open_slob +ifxus_read_slob +ifxus_seek_slob +ifxus_tell_slob +ifxus_write_slob +ignore_user_abort +iis_add_server +iis_get_dir_security +iis_get_script_map +iis_get_server_by_comment +iis_get_server_by_path +iis_get_server_rights +iis_get_service_state +iis_remove_server +iis_set_app_settings +iis_set_dir_security +iis_set_script_map +iis_set_server_rights +iis_start_server +iis_start_service +iis_stop_server +iis_stop_service +image2wbmp +imagealphablending +imageantialias +imagearc +imagechar +imagecharup +imagecolorallocate +imagecolorallocatealpha +imagecolorat +imagecolorclosest +imagecolorclosestalpha +imagecolorclosesthwb +imagecolordeallocate +imagecolorexact +imagecolorexactalpha +imagecolormatch +imagecolorresolve +imagecolorresolvealpha +imagecolorset +imagecolorsforindex +imagecolorstotal +imagecolortransparent +imageconvolution +imagecopy +imagecopymerge +imagecopymergegray +imagecopyresampled +imagecopyresized +imagecreate +imagecreatefromgd +imagecreatefromgd2 +imagecreatefromgd2part +imagecreatefromgif +imagecreatefromjpeg +imagecreatefrompng +imagecreatefromstring +imagecreatefromwbmp +imagecreatefromxbm +imagecreatefromxpm +imagecreatetruecolor +imagedashedline +imagedestroy +imageellipse +imagefill +imagefilledarc +imagefilledellipse +imagefilledpolygon +imagefilledrectangle +imagefilltoborder +imagefilter +imagefontheight +imagefontwidth +imageftbbox +imagefttext +imagegammacorrect +imagegd +imagegd2 +imagegif +imagegrabscreen +imagegrabwindow +imageinterlace +imageistruecolor +imagejpeg +imagelayereffect +imageline +imageloadfont +imagepalettecopy +imagepng +imagepolygon +imagepsbbox +imagepsencodefont +imagepsextendfont +imagepsfreefont +imagepsloadfont +imagepsslantfont +imagepstext +imagerectangle +imagerotate +imagesavealpha +imagesetbrush +imagesetpixel +imagesetstyle +imagesetthickness +imagesettile +imagestring +imagestringup +imagesx +imagesy +imagetruecolortopalette +imagettfbbox +imagettftext +imagetypes +image_type_to_extension +image_type_to_mime_type +imagewbmp +imagexbm +imagick +imagick_adaptiveblurimage +imagick_adaptiveresizeimage +imagick_adaptivesharpenimage +imagick_adaptivethresholdimage +imagick_addimage +imagick_addnoiseimage +imagick_affinetransformimage +imagick_animateimages +imagick_annotateimage +imagick_appendimages +imagick_averageimages +imagick_blackthresholdimage +imagick_blurimage +imagick_borderimage +imagick_charcoalimage +imagick_chopimage +imagick_clear +imagick_clipimage +imagick_clippathimage +imagick_clone +imagick_clutimage +imagick_coalesceimages +imagick_colorfloodfillimage +imagick_colorizeimage +imagick_combineimages +imagick_commentimage +imagick_compareimagechannels +imagick_compareimagelayers +imagick_compareimages +imagick_compositeimage +imagick_construct +imagick_contrastimage +imagick_contraststretchimage +imagick_convolveimage +imagick_cropimage +imagick_cropthumbnailimage +imagick_current +imagick_cyclecolormapimage +imagick_decipherimage +imagick_deconstructimages +imagick_deleteimageartifact +imagick_despeckleimage +imagick_destroy +imagick_displayimage +imagick_displayimages +imagick_distortimage +imagickdraw +imagickdraw_affine +imagickdraw_annotation +imagickdraw_arc +imagickdraw_bezier +imagickdraw_circle +imagickdraw_clear +imagickdraw_clone +imagickdraw_color +imagickdraw_comment +imagickdraw_composite +imagickdraw_construct +imagickdraw_destroy +imagickdraw_ellipse +imagickdraw_getclippath +imagickdraw_getcliprule +imagickdraw_getclipunits +imagickdraw_getfillcolor +imagickdraw_getfillopacity +imagickdraw_getfillrule +imagickdraw_getfont +imagickdraw_getfontfamily +imagickdraw_getfontsize +imagickdraw_getfontstyle +imagickdraw_getfontweight +imagickdraw_getgravity +imagickdraw_getstrokeantialias +imagickdraw_getstrokecolor +imagickdraw_getstrokedasharray +imagickdraw_getstrokedashoffset +imagickdraw_getstrokelinecap +imagickdraw_getstrokelinejoin +imagickdraw_getstrokemiterlimit +imagickdraw_getstrokeopacity +imagickdraw_getstrokewidth +imagickdraw_gettextalignment +imagickdraw_gettextantialias +imagickdraw_gettextdecoration +imagickdraw_gettextencoding +imagickdraw_gettextundercolor +imagickdraw_getvectorgraphics +imagick_drawimage +imagickdraw_line +imagickdraw_matte +imagickdraw_pathclose +imagickdraw_pathcurvetoabsolute +imagickdraw_pathcurvetoquadraticbezierabsolute +imagickdraw_pathcurvetoquadraticbezierrelative +imagickdraw_pathcurvetoquadraticbeziersmoothabsolute +imagickdraw_pathcurvetoquadraticbeziersmoothrelative +imagickdraw_pathcurvetorelative +imagickdraw_pathcurvetosmoothabsolute +imagickdraw_pathcurvetosmoothrelative +imagickdraw_pathellipticarcabsolute +imagickdraw_pathellipticarcrelative +imagickdraw_pathfinish +imagickdraw_pathlinetoabsolute +imagickdraw_pathlinetohorizontalabsolute +imagickdraw_pathlinetohorizontalrelative +imagickdraw_pathlinetorelative +imagickdraw_pathlinetoverticalabsolute +imagickdraw_pathlinetoverticalrelative +imagickdraw_pathmovetoabsolute +imagickdraw_pathmovetorelative +imagickdraw_pathstart +imagickdraw_point +imagickdraw_polygon +imagickdraw_polyline +imagickdraw_pop +imagickdraw_popclippath +imagickdraw_popdefs +imagickdraw_poppattern +imagickdraw_push +imagickdraw_pushclippath +imagickdraw_pushdefs +imagickdraw_pushpattern +imagickdraw_rectangle +imagickdraw_render +imagickdraw_rotate +imagickdraw_roundrectangle +imagickdraw_scale +imagickdraw_setclippath +imagickdraw_setcliprule +imagickdraw_setclipunits +imagickdraw_setfillalpha +imagickdraw_setfillcolor +imagickdraw_setfillopacity +imagickdraw_setfillpatternurl +imagickdraw_setfillrule +imagickdraw_setfont +imagickdraw_setfontfamily +imagickdraw_setfontsize +imagickdraw_setfontstretch +imagickdraw_setfontstyle +imagickdraw_setfontweight +imagickdraw_setgravity +imagickdraw_setstrokealpha +imagickdraw_setstrokeantialias +imagickdraw_setstrokecolor +imagickdraw_setstrokedasharray +imagickdraw_setstrokedashoffset +imagickdraw_setstrokelinecap +imagickdraw_setstrokelinejoin +imagickdraw_setstrokemiterlimit +imagickdraw_setstrokeopacity +imagickdraw_setstrokepatternurl +imagickdraw_setstrokewidth +imagickdraw_settextalignment +imagickdraw_settextantialias +imagickdraw_settextdecoration +imagickdraw_settextencoding +imagickdraw_settextundercolor +imagickdraw_setvectorgraphics +imagickdraw_setviewbox +imagickdraw_skewx +imagickdraw_skewy +imagickdraw_translate +imagick_edgeimage +imagick_embossimage +imagick_encipherimage +imagick_enhanceimage +imagick_equalizeimage +imagick_evaluateimage +imagick_extentimage +imagick_flattenimages +imagick_flipimage +imagick_floodfillpaintimage +imagick_flopimage +imagick_frameimage +imagick_fximage +imagick_gammaimage +imagick_gaussianblurimage +imagick_getcolorspace +imagick_getcompression +imagick_getcompressionquality +imagick_getcopyright +imagick_getfilename +imagick_getfont +imagick_getformat +imagick_getgravity +imagick_gethomeurl +imagick_getimage +imagick_getimagealphachannel +imagick_getimageartifact +imagick_getimagebackgroundcolor +imagick_getimageblob +imagick_getimageblueprimary +imagick_getimagebordercolor +imagick_getimagechanneldepth +imagick_getimagechanneldistortion +imagick_getimagechanneldistortions +imagick_getimagechannelextrema +imagick_getimagechannelmean +imagick_getimagechannelrange +imagick_getimagechannelstatistics +imagick_getimageclipmask +imagick_getimagecolormapcolor +imagick_getimagecolors +imagick_getimagecolorspace +imagick_getimagecompose +imagick_getimagecompression +imagick_getimagecompressionquality +imagick_getimagedelay +imagick_getimagedepth +imagick_getimagedispose +imagick_getimagedistortion +imagick_getimageextrema +imagick_getimagefilename +imagick_getimageformat +imagick_getimagegamma +imagick_getimagegeometry +imagick_getimagegravity +imagick_getimagegreenprimary +imagick_getimageheight +imagick_getimagehistogram +imagick_getimageindex +imagick_getimageinterlacescheme +imagick_getimageinterpolatemethod +imagick_getimageiterations +imagick_getimagelength +imagick_getimagemagicklicense +imagick_getimagematte +imagick_getimagemattecolor +imagick_getimageorientation +imagick_getimagepage +imagick_getimagepixelcolor +imagick_getimageprofile +imagick_getimageprofiles +imagick_getimageproperties +imagick_getimageproperty +imagick_getimageredprimary +imagick_getimageregion +imagick_getimagerenderingintent +imagick_getimageresolution +imagick_getimagesblob +imagick_getimagescene +imagick_getimagesignature +imagick_getimagesize +imagick_getimagetickspersecond +imagick_getimagetotalinkdensity +imagick_getimagetype +imagick_getimageunits +imagick_getimagevirtualpixelmethod +imagick_getimagewhitepoint +imagick_getimagewidth +imagick_getinterlacescheme +imagick_getiteratorindex +imagick_getnumberimages +imagick_getoption +imagick_getpackagename +imagick_getpage +imagick_getpixeliterator +imagick_getpixelregioniterator +imagick_getpointsize +imagick_getquantumdepth +imagick_getquantumrange +imagick_getreleasedate +imagick_getresource +imagick_getresourcelimit +imagick_getsamplingfactors +imagick_getsize +imagick_getsizeoffset +imagick_getversion +imagick_hasnextimage +imagick_haspreviousimage +imagick_identifyimage +imagick_implodeimage +imagick_labelimage +imagick_levelimage +imagick_linearstretchimage +imagick_liquidrescaleimage +imagick_magnifyimage +imagick_mapimage +imagick_mattefloodfillimage +imagick_medianfilterimage +imagick_mergeimagelayers +imagick_minifyimage +imagick_modulateimage +imagick_montageimage +imagick_morphimages +imagick_mosaicimages +imagick_motionblurimage +imagick_negateimage +imagick_newimage +imagick_newpseudoimage +imagick_nextimage +imagick_normalizeimage +imagick_oilpaintimage +imagick_opaquepaintimage +imagick_optimizeimagelayers +imagick_orderedposterizeimage +imagick_paintfloodfillimage +imagick_paintopaqueimage +imagick_painttransparentimage +imagick_pingimage +imagick_pingimageblob +imagick_pingimagefile +imagickpixel +imagickpixel_clear +imagickpixel_construct +imagickpixel_destroy +imagickpixel_getcolor +imagickpixel_getcolorasstring +imagickpixel_getcolorcount +imagickpixel_getcolorvalue +imagickpixel_gethsl +imagickpixel_issimilar +imagickpixeliterator +imagickpixeliterator_clear +imagickpixeliterator_construct +imagickpixeliterator_destroy +imagickpixeliterator_getcurrentiteratorrow +imagickpixeliterator_getiteratorrow +imagickpixeliterator_getnextiteratorrow +imagickpixeliterator_getpreviousiteratorrow +imagickpixeliterator_newpixeliterator +imagickpixeliterator_newpixelregioniterator +imagickpixeliterator_resetiterator +imagickpixeliterator_setiteratorfirstrow +imagickpixeliterator_setiteratorlastrow +imagickpixeliterator_setiteratorrow +imagickpixeliterator_synciterator +imagickpixel_setcolor +imagickpixel_setcolorvalue +imagickpixel_sethsl +imagick_polaroidimage +imagick_posterizeimage +imagick_previewimages +imagick_previousimage +imagick_profileimage +imagick_quantizeimage +imagick_quantizeimages +imagick_queryfontmetrics +imagick_queryfonts +imagick_queryformats +imagick_radialblurimage +imagick_raiseimage +imagick_randomthresholdimage +imagick_readimage +imagick_readimageblob +imagick_readimagefile +imagick_recolorimage +imagick_reducenoiseimage +imagick_removeimage +imagick_removeimageprofile +imagick_render +imagick_resampleimage +imagick_resetimagepage +imagick_resizeimage +imagick_rollimage +imagick_rotateimage +imagick_roundcorners +imagick_sampleimage +imagick_scaleimage +imagick_separateimagechannel +imagick_sepiatoneimage +imagick_setbackgroundcolor +imagick_setcolorspace +imagick_setcompression +imagick_setcompressionquality +imagick_setfilename +imagick_setfirstiterator +imagick_setfont +imagick_setformat +imagick_setgravity +imagick_setimage +imagick_setimagealphachannel +imagick_setimageartifact +imagick_setimagebackgroundcolor +imagick_setimagebias +imagick_setimageblueprimary +imagick_setimagebordercolor +imagick_setimagechanneldepth +imagick_setimageclipmask +imagick_setimagecolormapcolor +imagick_setimagecolorspace +imagick_setimagecompose +imagick_setimagecompression +imagick_setimagecompressionquality +imagick_setimagedelay +imagick_setimagedepth +imagick_setimagedispose +imagick_setimageextent +imagick_setimagefilename +imagick_setimageformat +imagick_setimagegamma +imagick_setimagegravity +imagick_setimagegreenprimary +imagick_setimageindex +imagick_setimageinterlacescheme +imagick_setimageinterpolatemethod +imagick_setimageiterations +imagick_setimagematte +imagick_setimagemattecolor +imagick_setimageopacity +imagick_setimageorientation +imagick_setimagepage +imagick_setimageprofile +imagick_setimageproperty +imagick_setimageredprimary +imagick_setimagerenderingintent +imagick_setimageresolution +imagick_setimagescene +imagick_setimagetickspersecond +imagick_setimagetype +imagick_setimageunits +imagick_setimagevirtualpixelmethod +imagick_setimagewhitepoint +imagick_setinterlacescheme +imagick_setiteratorindex +imagick_setlastiterator +imagick_setoption +imagick_setpage +imagick_setpointsize +imagick_setresolution +imagick_setresourcelimit +imagick_setsamplingfactors +imagick_setsize +imagick_setsizeoffset +imagick_settype +imagick_shadeimage +imagick_shadowimage +imagick_sharpenimage +imagick_shaveimage +imagick_shearimage +imagick_sigmoidalcontrastimage +imagick_sketchimage +imagick_solarizeimage +imagick_spliceimage +imagick_spreadimage +imagick_steganoimage +imagick_stereoimage +imagick_stripimage +imagick_swirlimage +imagick_textureimage +imagick_thresholdimage +imagick_thumbnailimage +imagick_tintimage +imagick_transformimage +imagick_transparentpaintimage +imagick_transposeimage +imagick_transverseimage +imagick_trimimage +imagick_uniqueimagecolors +imagick_unsharpmaskimage +imagick_valid +imagick_vignetteimage +imagick_waveimage +imagick_whitethresholdimage +imagick_writeimage +imagick_writeimagefile +imagick_writeimages +imagick_writeimagesfile +imap_8bit +imap_alerts +imap_append +imap_base64 +imap_binary +imap_body +imap_bodystruct +imap_check +imap_clearflag_full +imap_close +imap_create +imap_createmailbox +imap_delete +imap_deletemailbox +imap_errors +imap_expunge +imap_fetchbody +imap_fetchheader +imap_fetchmime +imap_fetch_overview +imap_fetchstructure +imap_fetchtext +imap_gc +imap_getacl +imap_getmailboxes +imap_get_quota +imap_get_quotaroot +imap_getsubscribed +imap_header +imap_headerinfo +imap_headers +imap_last_error +imap_list +imap_listmailbox +imap_listscan +imap_listsubscribed +imap_lsub +imap_mail +imap_mailboxmsginfo +imap_mail_compose +imap_mail_copy +imap_mail_move +imap_mime_header_decode +imap_msgno +imap_num_msg +imap_num_recent +imap_open +imap_ping +imap_qprint +imap_rename +imap_renamemailbox +imap_reopen +imap_rfc822_parse_adrlist +imap_rfc822_parse_headers +imap_rfc822_write_address +imap_savebody +imap_scan +imap_scanmailbox +imap_search +imap_setacl +imap_setflag_full +imap_set_quota +imap_sort +imap_status +imap_subscribe +imap_thread +imap_timeout +imap_uid +imap_undelete +imap_unsubscribe +imap_utf7_decode +imap_utf7_encode +imap_utf8 +implements +implementsinterface +implode +import_request_variables +in_array +include +include_once +inclued_get_data +inet_ntop +inet_pton +infiniteiterator +ingres_autocommit +ingres_autocommit_state +ingres_charset +ingres_close +ingres_commit +ingres_connect +ingres_cursor +ingres_errno +ingres_error +ingres_errsqlstate +ingres_escape_string +ingres_execute +ingres_fetch_array +ingres_fetch_assoc +ingres_fetch_object +ingres_fetch_proc_return +ingres_fetch_row +ingres_field_length +ingres_field_name +ingres_field_nullable +ingres_field_precision +ingres_field_scale +ingres_field_type +ingres_free_result +ingres_next_error +ingres_num_fields +ingres_num_rows +ingres_pconnect +ingres_prepare +ingres_query +ingres_result_seek +ingres_rollback +ingres_set_environment +ingres_unbuffered_query +ini_alter +ini_get +ini_get_all +ini_restore +ini_set +innamespace +inotify_add_watch +inotify_init +inotify_queue_len +inotify_read +inotify_rm_watch +instanceof +interface +interface_exists +intldateformatter +intl_error_name +intl_get_error_code +intl_get_error_message +intl_is_failure +intval +invalidargumentexception +invoke +__invoke() +invokeargs +ip2long +iptcembed +iptcparse +is_a +isabstract +is_array +is_bool +is_callable +iscloneable +is_dir +isdisabled +is_double +is_executable +is_file +isfinal +is_finite +is_float +is_infinite +isinstance +isinstantiable +is_int +is_integer +isinterface +isinternal +isiterateable +is_link +is_long +is_nan +is_null +is_numeric +is_object +is_readable +is_real +is_resource +is_scalar +isset +__isset() +is_soap_fault +is_string +issubclassof +is_subclass_of +istrait +is_uploaded_file +isuserdefined +is_writable +is_writeable +iterator +iteratoraggregate +iterator_apply +iterator_count +iteratoriterator +iterator_to_array +java_last_exception_clear +java_last_exception_get +jddayofweek +jdmonthname +jdtofrench +jdtogregorian +jdtojewish +jdtojulian +jdtounix +jewishtojd +join +jpeg2wbmp +json_decode +json_encode +json_last_error +jsonserializable +judy +judy_type +judy_version +juliantojd +kadm5_chpass_principal +kadm5_create_principal +kadm5_delete_principal +kadm5_destroy +kadm5_flush +kadm5_get_policies +kadm5_get_principal +kadm5_get_principals +kadm5_init_with_password +kadm5_modify_principal +key +krsort +ksort +ktaglib_id3v2_attachedpictureframe +ktaglib_id3v2_frame +ktaglib_id3v2_tag +ktaglib_mpeg_audioproperties +ktaglib_mpeg_file +ktaglib_tag +lcfirst +lcg_value +lchgrp +lchown +ldap_8859_to_t61 +ldap_add +ldap_bind +ldap_close +ldap_compare +ldap_connect +ldap_count_entries +ldap_delete +ldap_dn2ufn +ldap_err2str +ldap_errno +ldap_error +ldap_explode_dn +ldap_first_attribute +ldap_first_entry +ldap_first_reference +ldap_free_result +ldap_get_attributes +ldap_get_dn +ldap_get_entries +ldap_get_option +ldap_get_values +ldap_get_values_len +ldap_list +ldap_mod_add +ldap_mod_del +ldap_modify +ldap_mod_replace +ldap_next_attribute +ldap_next_entry +ldap_next_reference +ldap_parse_reference +ldap_parse_result +ldap_read +ldap_rename +ldap_sasl_bind +ldap_search +ldap_set_option +ldap_set_rebind_proc +ldap_sort +ldap_start_tls +ldap_t61_to_8859 +ldap_unbind +lengthexception +levenshtein +libxml_clear_errors +libxml_disable_entity_loader +libxmlerror +libxml_get_errors +libxml_get_last_error +libxml_set_streams_context +libxml_use_internal_errors +limititerator +__LINE__ +link +linkinfo +list +locale +localeconv +localtime +log +log10 +log1p +logicexception +long2ip +lstat +ltrim +lua +luaclosure +lzf_compress +lzf_decompress +lzf_optimized_for +magic_quotes_runtime +mail +mailparse_determine_best_xfer_encoding +mailparse_msg_create +mailparse_msg_extract_part +mailparse_msg_extract_part_file +mailparse_msg_extract_whole_part_file +mailparse_msg_free +mailparse_msg_get_part +mailparse_msg_get_part_data +mailparse_msg_get_structure +mailparse_msg_parse +mailparse_msg_parse_file +mailparse_rfc822_parse_addresses +mailparse_stream_encode +mailparse_uudecode_all +main +max +maxdb_affected_rows +maxdb_autocommit +maxdb_bind_param +maxdb_bind_result +maxdb_change_user +maxdb_character_set_name +maxdb_client_encoding +maxdb_close +maxdb_close_long_data +maxdb_commit +maxdb_connect +maxdb_connect_errno +maxdb_connect_error +maxdb_data_seek +maxdb_debug +maxdb_disable_reads_from_master +maxdb_disable_rpl_parse +maxdb_dump_debug_info +maxdb_embedded_connect +maxdb_enable_reads_from_master +maxdb_enable_rpl_parse +maxdb_errno +maxdb_error +maxdb_escape_string +maxdb_execute +maxdb_fetch +maxdb_fetch_array +maxdb_fetch_assoc +maxdb_fetch_field +maxdb_fetch_field_direct +maxdb_fetch_fields +maxdb_fetch_lengths +maxdb_fetch_object +maxdb_fetch_row +maxdb_field_count +maxdb_field_seek +maxdb_field_tell +maxdb_free_result +maxdb_get_client_info +maxdb_get_client_version +maxdb_get_host_info +maxdb_get_metadata +maxdb_get_proto_info +maxdb_get_server_info +maxdb_get_server_version +maxdb_info +maxdb_init +maxdb_insert_id +maxdb_kill +maxdb_master_query +maxdb_more_results +maxdb_multi_query +maxdb_next_result +maxdb_num_fields +maxdb_num_rows +maxdb_options +maxdb_param_count +maxdb_ping +maxdb_prepare +maxdb_query +maxdb_real_connect +maxdb_real_escape_string +maxdb_real_query +maxdb_report +maxdb_rollback +maxdb_rpl_parse_enabled +maxdb_rpl_probe +maxdb_rpl_query_type +maxdb_select_db +maxdb_send_long_data +maxdb_send_query +maxdb_server_end +maxdb_server_init +maxdb_set_opt +maxdb_sqlstate +maxdb_ssl_set +maxdb_stat +maxdb_stmt_affected_rows +maxdb_stmt_bind_param +maxdb_stmt_bind_result +maxdb_stmt_close +maxdb_stmt_close_long_data +maxdb_stmt_data_seek +maxdb_stmt_errno +maxdb_stmt_error +maxdb_stmt_execute +maxdb_stmt_fetch +maxdb_stmt_free_result +maxdb_stmt_init +maxdb_stmt_num_rows +maxdb_stmt_param_count +maxdb_stmt_prepare +maxdb_stmt_reset +maxdb_stmt_result_metadata +maxdb_stmt_send_long_data +maxdb_stmt_sqlstate +maxdb_stmt_store_result +maxdb_store_result +maxdb_thread_id +maxdb_thread_safe +maxdb_use_result +maxdb_warning_count +mb_check_encoding +mb_convert_case +mb_convert_encoding +mb_convert_kana +mb_convert_variables +mb_decode_mimeheader +mb_decode_numericentity +mb_detect_encoding +mb_detect_order +mb_encode_mimeheader +mb_encode_numericentity +mb_encoding_aliases +mb_ereg +mb_eregi +mb_eregi_replace +mb_ereg_match +mb_ereg_replace +mb_ereg_search +mb_ereg_search_getpos +mb_ereg_search_getregs +mb_ereg_search_init +mb_ereg_search_pos +mb_ereg_search_regs +mb_ereg_search_setpos +mb_get_info +mb_http_input +mb_http_output +mb_internal_encoding +mb_language +mb_list_encodings +mb_output_handler +mb_parse_str +mb_preferred_mime_name +mb_regex_encoding +mb_regex_set_options +mb_send_mail +mb_split +mb_strcut +mb_strimwidth +mb_stripos +mb_stristr +mb_strlen +mb_strpos +mb_strrchr +mb_strrichr +mb_strripos +mb_strrpos +mb_strstr +mb_strtolower +mb_strtoupper +mb_strwidth +mb_substitute_character +mb_substr +mb_substr_count +m_checkstatus +m_completeauthorizations +m_connect +m_connectionerror +mcrypt_cbc +mcrypt_cfb +mcrypt_create_iv +mcrypt_decrypt +mcrypt_ecb +mcrypt_enc_get_algorithms_name +mcrypt_enc_get_block_size +mcrypt_enc_get_iv_size +mcrypt_enc_get_key_size +mcrypt_enc_get_modes_name +mcrypt_enc_get_supported_key_sizes +mcrypt_enc_is_block_algorithm +mcrypt_enc_is_block_algorithm_mode +mcrypt_enc_is_block_mode +mcrypt_encrypt +mcrypt_enc_self_test +mcrypt_generic +mcrypt_generic_deinit +mcrypt_generic_end +mcrypt_generic_init +mcrypt_get_block_size +mcrypt_get_cipher_name +mcrypt_get_iv_size +mcrypt_get_key_size +mcrypt_list_algorithms +mcrypt_list_modes +mcrypt_module_close +mcrypt_module_get_algo_block_size +mcrypt_module_get_algo_key_size +mcrypt_module_get_supported_key_sizes +mcrypt_module_is_block_algorithm +mcrypt_module_is_block_algorithm_mode +mcrypt_module_is_block_mode +mcrypt_module_open +mcrypt_module_self_test +mcrypt_ofb +md5 +md5_file +mdecrypt_generic +m_deletetrans +m_destroyconn +m_destroyengine +memcache +memcached +memcache_debug +memory_get_peak_usage +memory_get_usage +messageformatter +metaphone +__METHOD__ +method_exists +m_getcell +m_getcellbynum +m_getcommadelimited +m_getheader +mhash +mhash_count +mhash_get_block_size +mhash_get_hash_name +mhash_keygen_s2k +microtime +mime_content_type +min +ming_keypress +ming_setcubicthreshold +ming_setscale +ming_setswfcompression +ming_useconstants +ming_useswfversion +m_initconn +m_initengine +m_iscommadelimited +mkdir +mktime +m_maxconntimeout +m_monitor +m_numcolumns +m_numrows +money_format +mongo +mongobindata +mongocode +mongocollection +mongoconnectionexception +mongocursor +mongocursorexception +mongocursortimeoutexception +mongodate +mongodb +mongodbref +mongoexception +mongogridfs +mongogridfscursor +mongogridfsexception +mongogridfsfile +mongoid +mongoint32 +mongoint64 +mongolog +mongomaxkey +mongominkey +mongopool +mongoregex +mongotimestamp +move_uploaded_file +m_parsecommadelimited +mqseries_back +mqseries_begin +mqseries_close +mqseries_cmit +mqseries_conn +mqseries_connx +mqseries_disc +mqseries_get +mqseries_inq +mqseries_open +mqseries_put +mqseries_put1 +mqseries_set +mqseries_strerror +m_responsekeys +m_responseparam +m_returnstatus +msession_connect +msession_count +msession_create +msession_destroy +msession_disconnect +msession_find +msession_get +msession_get_array +msession_get_data +msession_inc +msession_list +msession_listvar +msession_lock +msession_plugin +msession_randstr +msession_set +msession_set_array +msession_set_data +msession_timeout +msession_uniq +msession_unlock +m_setblocking +m_setdropfile +m_setip +m_setssl +m_setssl_cafile +m_setssl_files +m_settimeout +msg_get_queue +msg_queue_exists +msg_receive +msg_remove_queue +msg_send +msg_set_queue +msg_stat_queue +msql +msql_affected_rows +msql_close +msql_connect +msql_createdb +msql_create_db +msql_data_seek +msql_dbname +msql_db_query +msql_drop_db +msql_error +msql_fetch_array +msql_fetch_field +msql_fetch_object +msql_fetch_row +msql_fieldflags +msql_field_flags +msql_fieldlen +msql_field_len +msql_fieldname +msql_field_name +msql_field_seek +msql_fieldtable +msql_field_table +msql_fieldtype +msql_field_type +msql_free_result +msql_list_dbs +msql_list_fields +msql_list_tables +msql_numfields +msql_num_fields +msql_numrows +msql_num_rows +msql_pconnect +msql_query +msql_regcase +msql_result +msql_select_db +msql_tablename +m_sslcert_gen_hash +mssql_bind +mssql_close +mssql_connect +mssql_data_seek +mssql_execute +mssql_fetch_array +mssql_fetch_assoc +mssql_fetch_batch +mssql_fetch_field +mssql_fetch_object +mssql_fetch_row +mssql_field_length +mssql_field_name +mssql_field_seek +mssql_field_type +mssql_free_result +mssql_free_statement +mssql_get_last_message +mssql_guid_string +mssql_init +mssql_min_error_severity +mssql_min_message_severity +mssql_next_result +mssql_num_fields +mssql_num_rows +mssql_pconnect +mssql_query +mssql_result +mssql_rows_affected +mssql_select_db +mt_getrandmax +mt_rand +m_transactionssent +m_transinqueue +m_transkeyval +m_transnew +m_transsend +mt_srand +multipleiterator +m_uwait +m_validateidentifier +m_verifyconnection +m_verifysslcert +mysql_affected_rows +mysql_client_encoding +mysql_close +mysql_connect +mysql_create_db +mysql_data_seek +mysql_db_name +mysql_db_query +mysql_drop_db +mysql_errno +mysql_error +mysql_escape_string +mysql_fetch_array +mysql_fetch_assoc +mysql_fetch_field +mysql_fetch_lengths +mysql_fetch_object +mysql_fetch_row +mysql_field_flags +mysql_field_len +mysql_field_name +mysql_field_seek +mysql_field_table +mysql_field_type +mysql_free_result +mysql_get_client_info +mysql_get_host_info +mysql_get_proto_info +mysql_get_server_info +mysqli +mysqli_bind_param +mysqli_bind_result +mysqli_client_encoding +mysqli_connect +mysqli_disable_reads_from_master +mysqli_disable_rpl_parse +mysqli_driver +mysqli_enable_reads_from_master +mysqli_enable_rpl_parse +mysqli_escape_string +mysqli_execute +mysqli_fetch +mysqli_get_metadata +mysqli_master_query +mysql_info +mysql_insert_id +mysqli_param_count +mysqli_report +mysqli_result +mysqli_rpl_parse_enabled +mysqli_rpl_probe +mysqli_rpl_query_type +mysqli_send_long_data +mysqli_send_query +mysqli_set_opt +mysqli_slave_query +mysqli_stmt +mysqli_warning +mysql_list_dbs +mysql_list_fields +mysql_list_processes +mysql_list_tables +mysqlnd_ms_get_stats +mysqlnd_ms_query_is_select +mysqlnd_ms_set_user_pick_server +mysqlnd_qc_change_handler +mysqlnd_qc_clear_cache +mysqlnd_qc_get_cache_info +mysqlnd_qc_get_core_stats +mysqlnd_qc_get_handler +mysqlnd_qc_get_query_trace_log +mysqlnd_qc_set_user_handlers +mysql_num_fields +mysql_num_rows +mysql_pconnect +mysql_ping +mysql_query +mysql_real_escape_string +mysql_result +mysql_select_db +mysql_set_charset +mysql_stat +mysql_tablename +mysql_thread_id +mysql_unbuffered_query +namespace +__NAMESPACE__ +natcasesort +natsort +ncurses_addch +ncurses_addchnstr +ncurses_addchstr +ncurses_addnstr +ncurses_addstr +ncurses_assume_default_colors +ncurses_attroff +ncurses_attron +ncurses_attrset +ncurses_baudrate +ncurses_beep +ncurses_bkgd +ncurses_bkgdset +ncurses_border +ncurses_bottom_panel +ncurses_can_change_color +ncurses_cbreak +ncurses_clear +ncurses_clrtobot +ncurses_clrtoeol +ncurses_color_content +ncurses_color_set +ncurses_curs_set +ncurses_define_key +ncurses_def_prog_mode +ncurses_def_shell_mode +ncurses_delay_output +ncurses_delch +ncurses_deleteln +ncurses_del_panel +ncurses_delwin +ncurses_doupdate +ncurses_echo +ncurses_echochar +ncurses_end +ncurses_erase +ncurses_erasechar +ncurses_filter +ncurses_flash +ncurses_flushinp +ncurses_getch +ncurses_getmaxyx +ncurses_getmouse +ncurses_getyx +ncurses_halfdelay +ncurses_has_colors +ncurses_has_ic +ncurses_has_il +ncurses_has_key +ncurses_hide_panel +ncurses_hline +ncurses_inch +ncurses_init +ncurses_init_color +ncurses_init_pair +ncurses_insch +ncurses_insdelln +ncurses_insertln +ncurses_insstr +ncurses_instr +ncurses_isendwin +ncurses_keyok +ncurses_keypad +ncurses_killchar +ncurses_longname +ncurses_meta +ncurses_mouseinterval +ncurses_mousemask +ncurses_mouse_trafo +ncurses_move +ncurses_move_panel +ncurses_mvaddch +ncurses_mvaddchnstr +ncurses_mvaddchstr +ncurses_mvaddnstr +ncurses_mvaddstr +ncurses_mvcur +ncurses_mvdelch +ncurses_mvgetch +ncurses_mvhline +ncurses_mvinch +ncurses_mvvline +ncurses_mvwaddstr +ncurses_napms +ncurses_newpad +ncurses_new_panel +ncurses_newwin +ncurses_nl +ncurses_nocbreak +ncurses_noecho +ncurses_nonl +ncurses_noqiflush +ncurses_noraw +ncurses_pair_content +ncurses_panel_above +ncurses_panel_below +ncurses_panel_window +ncurses_pnoutrefresh +ncurses_prefresh +ncurses_putp +ncurses_qiflush +ncurses_raw +ncurses_refresh +ncurses_replace_panel +ncurses_reset_prog_mode +ncurses_reset_shell_mode +ncurses_resetty +ncurses_savetty +ncurses_scr_dump +ncurses_scr_init +ncurses_scrl +ncurses_scr_restore +ncurses_scr_set +ncurses_show_panel +ncurses_slk_attr +ncurses_slk_attroff +ncurses_slk_attron +ncurses_slk_attrset +ncurses_slk_clear +ncurses_slk_color +ncurses_slk_init +ncurses_slk_noutrefresh +ncurses_slk_refresh +ncurses_slk_restore +ncurses_slk_set +ncurses_slk_touch +ncurses_standend +ncurses_standout +ncurses_start_color +ncurses_termattrs +ncurses_termname +ncurses_timeout +ncurses_top_panel +ncurses_typeahead +ncurses_ungetch +ncurses_ungetmouse +ncurses_update_panels +ncurses_use_default_colors +ncurses_use_env +ncurses_use_extended_names +ncurses_vidattr +ncurses_vline +ncurses_waddch +ncurses_waddstr +ncurses_wattroff +ncurses_wattron +ncurses_wattrset +ncurses_wborder +ncurses_wclear +ncurses_wcolor_set +ncurses_werase +ncurses_wgetch +ncurses_whline +ncurses_wmouse_trafo +ncurses_wmove +ncurses_wnoutrefresh +ncurses_wrefresh +ncurses_wstandend +ncurses_wstandout +ncurses_wvline +new +newinstance +newinstanceargs +newinstancewithoutconstructor +newt_bell +newt_button +newt_button_bar +newt_centered_window +newt_checkbox +newt_checkbox_get_value +newt_checkbox_set_flags +newt_checkbox_set_value +newt_checkbox_tree +newt_checkbox_tree_add_item +newt_checkbox_tree_find_item +newt_checkbox_tree_get_current +newt_checkbox_tree_get_entry_value +newt_checkbox_tree_get_multi_selection +newt_checkbox_tree_get_selection +newt_checkbox_tree_multi +newt_checkbox_tree_set_current +newt_checkbox_tree_set_entry +newt_checkbox_tree_set_entry_value +newt_checkbox_tree_set_width +newt_clear_key_buffer +newt_cls +newt_compact_button +newt_component_add_callback +newt_component_takes_focus +newt_create_grid +newt_cursor_off +newt_cursor_on +newt_delay +newt_draw_form +newt_draw_root_text +newt_entry +newt_entry_get_value +newt_entry_set +newt_entry_set_filter +newt_entry_set_flags +newt_finished +newt_form +newt_form_add_component +newt_form_add_components +newt_form_add_hot_key +newt_form_destroy +newt_form_get_current +newt_form_run +newt_form_set_background +newt_form_set_height +newt_form_set_size +newt_form_set_timer +newt_form_set_width +newt_form_watch_fd +newt_get_screen_size +newt_grid_add_components_to_form +newt_grid_basic_window +newt_grid_free +newt_grid_get_size +newt_grid_h_close_stacked +newt_grid_h_stacked +newt_grid_place +newt_grid_set_field +newt_grid_simple_window +newt_grid_v_close_stacked +newt_grid_v_stacked +newt_grid_wrapped_window +newt_grid_wrapped_window_at +newt_init +newt_label +newt_label_set_text +newt_listbox +newt_listbox_append_entry +newt_listbox_clear +newt_listbox_clear_selection +newt_listbox_delete_entry +newt_listbox_get_current +newt_listbox_get_selection +newt_listbox_insert_entry +newt_listbox_item_count +newt_listbox_select_item +newt_listbox_set_current +newt_listbox_set_current_by_key +newt_listbox_set_data +newt_listbox_set_entry +newt_listbox_set_width +newt_listitem +newt_listitem_get_data +newt_listitem_set +newt_open_window +newt_pop_help_line +newt_pop_window +newt_push_help_line +newt_radiobutton +newt_radio_get_current +newt_redraw_help_line +newt_reflow_text +newt_refresh +newt_resize_screen +newt_resume +newt_run_form +newt_scale +newt_scale_set +newt_scrollbar_set +newt_set_help_callback +newt_set_suspend_callback +newt_suspend +newt_textbox +newt_textbox_get_num_lines +newt_textbox_reflowed +newt_textbox_set_height +newt_textbox_set_text +newt_vertical_scrollbar +newt_wait_for_key +newt_win_choice +newt_win_entries +newt_win_menu +newt_win_message +newt_win_messagev +newt_win_ternary +next +ngettext +nl2br +nl_langinfo +norewinditerator +normalizer +notes_body +notes_copy_db +notes_create_db +notes_create_note +notes_drop_db +notes_find_note +notes_header_info +notes_list_msgs +notes_mark_read +notes_mark_unread +notes_nav_create +notes_search +notes_unread +notes_version +nsapi_request_headers +nsapi_response_headers +nsapi_virtual +nthmac +number_format +numberformatter +oauth +oauthexception +oauth_get_sbs +oauthprovider +oauth_urlencode +ob_clean +ob_deflatehandler +ob_end_clean +ob_end_flush +ob_etaghandler +ob_flush +ob_get_clean +ob_get_contents +ob_get_flush +ob_get_length +ob_get_level +ob_get_status +ob_gzhandler +ob_iconv_handler +ob_implicit_flush +ob_inflatehandler +ob_list_handlers +ob_start +ob_tidyhandler +oci_bind_array_by_name +ocibindbyname +oci_bind_by_name +ocicancel +oci_cancel +oci_client_version +oci_close +ocicloselob +ocicollappend +ocicollassign +ocicollassignelem +oci_collection_append +oci_collection_assign +oci_collection_element_assign +oci_collection_element_get +oci_collection_free +oci_collection_max +oci_collection_size +oci_collection_trim +ocicollgetelem +ocicollmax +ocicollsize +ocicolltrim +ocicolumnisnull +ocicolumnname +ocicolumnprecision +ocicolumnscale +ocicolumnsize +ocicolumntype +ocicolumntyperaw +ocicommit +oci_commit +oci_connect +ocidefinebyname +oci_define_by_name +ocierror +oci_error +ociexecute +oci_execute +ocifetch +oci_fetch +oci_fetch_all +oci_fetch_array +oci_fetch_assoc +ocifetchinto +oci_fetch_object +oci_fetch_row +ocifetchstatement +oci_field_is_null +oci_field_name +oci_field_precision +oci_field_scale +oci_field_size +oci_field_type +oci_field_type_raw +ocifreecollection +ocifreecursor +ocifreedesc +ocifreestatement +oci_free_statement +ociinternaldebug +oci_internal_debug +ociloadlob +oci_lob_append +oci_lob_close +oci_lob_copy +oci_lob_eof +oci_lob_erase +oci_lob_export +oci_lob_flush +oci_lob_free +oci_lob_getbuffering +oci_lob_import +oci_lob_is_equal +oci_lob_load +oci_lob_read +oci_lob_rewind +oci_lob_save +oci_lob_savefile +oci_lob_seek +oci_lob_setbuffering +oci_lob_size +oci_lob_tell +oci_lob_truncate +oci_lob_write +oci_lob_writetemporary +oci_lob_writetofile +ocilogoff +ocilogon +ocinewcollection +oci_new_collection +oci_new_connect +ocinewcursor +oci_new_cursor +ocinewdescriptor +oci_new_descriptor +ocinlogon +ocinumcols +oci_num_fields +oci_num_rows +ociparse +oci_parse +oci_password_change +oci_pconnect +ociplogon +ociresult +oci_result +ocirollback +oci_rollback +ocirowcount +ocisavelob +ocisavelobfile +ociserverversion +oci_server_version +oci_set_action +oci_set_client_identifier +oci_set_client_info +oci_set_edition +oci_set_module_name +ocisetprefetch +oci_set_prefetch +ocistatementtype +oci_statement_type +ociwritelobtofile +ociwritetemporarylob +octdec +odbc_autocommit +odbc_binmode +odbc_close +odbc_close_all +odbc_columnprivileges +odbc_columns +odbc_commit +odbc_connect +odbc_cursor +odbc_data_source +odbc_do +odbc_error +odbc_errormsg +odbc_exec +odbc_execute +odbc_fetch_array +odbc_fetch_into +odbc_fetch_object +odbc_fetch_row +odbc_field_len +odbc_field_name +odbc_field_num +odbc_field_precision +odbc_field_scale +odbc_field_type +odbc_foreignkeys +odbc_free_result +odbc_gettypeinfo +odbc_longreadlen +odbc_next_result +odbc_num_fields +odbc_num_rows +odbc_pconnect +odbc_prepare +odbc_primarykeys +odbc_procedurecolumns +odbc_procedures +odbc_result +odbc_result_all +odbc_rollback +odbc_setoption +odbc_specialcolumns +odbc_statistics +odbc_tableprivileges +odbc_tables +old_function +openal_buffer_create +openal_buffer_data +openal_buffer_destroy +openal_buffer_get +openal_buffer_loadwav +openal_context_create +openal_context_current +openal_context_destroy +openal_context_process +openal_context_suspend +openal_device_close +openal_device_open +openal_listener_get +openal_listener_set +openal_source_create +openal_source_destroy +openal_source_get +openal_source_pause +openal_source_play +openal_source_rewind +openal_source_set +openal_source_stop +openal_stream +opendir +openlog +openssl_cipher_iv_length +openssl_csr_export +openssl_csr_export_to_file +openssl_csr_get_public_key +openssl_csr_get_subject +openssl_csr_new +openssl_csr_sign +openssl_decrypt +openssl_dh_compute_key +openssl_digest +openssl_encrypt +openssl_error_string +openssl_free_key +openssl_get_cipher_methods +openssl_get_md_methods +openssl_get_privatekey +openssl_get_publickey +openssl_open +openssl_pkcs12_export +openssl_pkcs12_export_to_file +openssl_pkcs12_read +openssl_pkcs7_decrypt +openssl_pkcs7_encrypt +openssl_pkcs7_sign +openssl_pkcs7_verify +openssl_pkey_export +openssl_pkey_export_to_file +openssl_pkey_free +openssl_pkey_get_details +openssl_pkey_get_private +openssl_pkey_get_public +openssl_pkey_new +openssl_private_decrypt +openssl_private_encrypt +openssl_public_decrypt +openssl_public_encrypt +openssl_random_pseudo_bytes +openssl_seal +openssl_sign +openssl_verify +openssl_x509_check_private_key +openssl_x509_checkpurpose +openssl_x509_export +openssl_x509_export_to_file +openssl_x509_free +openssl_x509_parse +openssl_x509_read +or +ord +outeriterator +outofboundsexception +outofrangeexception +output_add_rewrite_var +output_reset_rewrite_vars +overflowexception +overload +override_function +ovrimos_close +ovrimos_commit +ovrimos_connect +ovrimos_cursor +ovrimos_exec +ovrimos_execute +ovrimos_fetch_into +ovrimos_fetch_row +ovrimos_field_len +ovrimos_field_name +ovrimos_field_num +ovrimos_field_type +ovrimos_free_result +ovrimos_longreadlen +ovrimos_num_fields +ovrimos_num_rows +ovrimos_prepare +ovrimos_result +ovrimos_result_all +ovrimos_rollback +pack +parentiterator +parse_ini_file +parse_ini_string +parsekit_compile_file +parsekit_compile_string +parsekit_func_arginfo +parse_str +parse_url +passthru +pathinfo +pclose +pcntl_alarm +pcntl_exec +pcntl_fork +pcntl_getpriority +pcntl_setpriority +pcntl_signal +pcntl_signal_dispatch +pcntl_sigprocmask +pcntl_sigtimedwait +pcntl_sigwaitinfo +pcntl_wait +pcntl_waitpid +pcntl_wexitstatus +pcntl_wifexited +pcntl_wifsignaled +pcntl_wifstopped +pcntl_wstopsig +pcntl_wtermsig +pdf_activate_item +pdf_add_annotation +pdf_add_bookmark +pdf_add_launchlink +pdf_add_locallink +pdf_add_nameddest +pdf_add_note +pdf_add_outline +pdf_add_pdflink +pdf_add_table_cell +pdf_add_textflow +pdf_add_thumbnail +pdf_add_weblink +pdf_arc +pdf_arcn +pdf_attach_file +pdf_begin_document +pdf_begin_font +pdf_begin_glyph +pdf_begin_item +pdf_begin_layer +pdf_begin_page +pdf_begin_page_ext +pdf_begin_pattern +pdf_begin_template +pdf_begin_template_ext +pdf_circle +pdf_clip +pdf_close +pdf_close_image +pdf_closepath +pdf_closepath_fill_stroke +pdf_closepath_stroke +pdf_close_pdi +pdf_close_pdi_page +pdf_concat +pdf_continue_text +pdf_create_3dview +pdf_create_action +pdf_create_annotation +pdf_create_bookmark +pdf_create_field +pdf_create_fieldgroup +pdf_create_gstate +pdf_create_pvf +pdf_create_textflow +pdf_curveto +pdf_define_layer +pdf_delete +pdf_delete_pvf +pdf_delete_table +pdf_delete_textflow +pdf_encoding_set_char +pdf_end_document +pdf_end_font +pdf_end_glyph +pdf_end_item +pdf_end_layer +pdf_end_page +pdf_end_page_ext +pdf_endpath +pdf_end_pattern +pdf_end_template +pdf_fill +pdf_fill_imageblock +pdf_fill_pdfblock +pdf_fill_stroke +pdf_fill_textblock +pdf_findfont +pdf_fit_image +pdf_fit_pdi_page +pdf_fit_table +pdf_fit_textflow +pdf_fit_textline +pdf_get_apiname +pdf_get_buffer +pdf_get_errmsg +pdf_get_errnum +pdf_get_font +pdf_get_fontname +pdf_get_fontsize +pdf_get_image_height +pdf_get_image_width +pdf_get_majorversion +pdf_get_minorversion +pdf_get_parameter +pdf_get_pdi_parameter +pdf_get_pdi_value +pdf_get_value +pdf_info_font +pdf_info_matchbox +pdf_info_table +pdf_info_textflow +pdf_info_textline +pdf_initgraphics +pdf_lineto +pdf_load_3ddata +pdf_load_font +pdf_load_iccprofile +pdf_load_image +pdf_makespotcolor +pdf_moveto +pdf_new +pdf_open_ccitt +pdf_open_file +pdf_open_gif +pdf_open_image +pdf_open_image_file +pdf_open_jpeg +pdf_open_memory_image +pdf_open_pdi +pdf_open_pdi_document +pdf_open_pdi_page +pdf_open_tiff +pdf_pcos_get_number +pdf_pcos_get_stream +pdf_pcos_get_string +pdf_place_image +pdf_place_pdi_page +pdf_process_pdi +pdf_rect +pdf_restore +pdf_resume_page +pdf_rotate +pdf_save +pdf_scale +pdf_set_border_color +pdf_set_border_dash +pdf_set_border_style +pdf_set_char_spacing +pdf_setcolor +pdf_setdash +pdf_setdashpattern +pdf_set_duration +pdf_setflat +pdf_setfont +pdf_setgray +pdf_setgray_fill +pdf_setgray_stroke +pdf_set_gstate +pdf_set_horiz_scaling +pdf_set_info +pdf_set_info_author +pdf_set_info_creator +pdf_set_info_keywords +pdf_set_info_subject +pdf_set_info_title +pdf_set_layer_dependency +pdf_set_leading +pdf_setlinecap +pdf_setlinejoin +pdf_setlinewidth +pdf_setmatrix +pdf_setmiterlimit +pdf_set_parameter +pdf_setpolydash +pdf_setrgbcolor +pdf_setrgbcolor_fill +pdf_setrgbcolor_stroke +pdf_set_text_matrix +pdf_set_text_pos +pdf_set_text_rendering +pdf_set_text_rise +pdf_set_value +pdf_set_word_spacing +pdf_shading +pdf_shading_pattern +pdf_shfill +pdf_show +pdf_show_boxed +pdf_show_xy +pdf_skew +pdf_stringwidth +pdf_stroke +pdf_suspend_page +pdf_translate +pdf_utf16_to_utf8 +pdf_utf32_to_utf16 +pdf_utf8_to_utf16 +pdo +pdo_cubrid_schema +pdoexception +pdo_pgsqllobcreate +pdo_pgsqllobopen +pdo_pgsqllobunlink +pdo_sqlitecreateaggregate +pdo_sqlitecreatefunction +pdostatement +pfsockopen +pg_affected_rows +pg_cancel_query +pg_client_encoding +pg_close +pg_connect +pg_connection_busy +pg_connection_reset +pg_connection_status +pg_convert +pg_copy_from +pg_copy_to +pg_dbname +pg_delete +pg_end_copy +pg_escape_bytea +pg_escape_string +pg_execute +pg_fetch_all +pg_fetch_all_columns +pg_fetch_array +pg_fetch_assoc +pg_fetch_object +pg_fetch_result +pg_fetch_row +pg_field_is_null +pg_field_name +pg_field_num +pg_field_prtlen +pg_field_size +pg_field_table +pg_field_type +pg_field_type_oid +pg_free_result +pg_get_notify +pg_get_pid +pg_get_result +pg_host +pg_insert +pg_last_error +pg_last_notice +pg_last_oid +pg_lo_close +pg_lo_create +pg_lo_export +pg_lo_import +pg_lo_open +pg_lo_read +pg_lo_read_all +pg_lo_seek +pg_lo_tell +pg_lo_unlink +pg_lo_write +pg_meta_data +pg_num_fields +pg_num_rows +pg_options +pg_parameter_status +pg_pconnect +pg_ping +pg_port +pg_prepare +pg_put_line +pg_query +pg_query_params +pg_result_error +pg_result_error_field +pg_result_seek +pg_result_status +pg_select +pg_send_execute +pg_send_prepare +pg_send_query +pg_send_query_params +pg_set_client_encoding +pg_set_error_verbosity +pg_trace +pg_transaction_status +pg_tty +pg_unescape_bytea +pg_untrace +pg_update +pg_version +Phar +PharData +PharException +PharFileInfo +php_check_syntax +phpcredits +phpinfo +php_ini_loaded_file +php_ini_scanned_files +php_logo_guid +php_sapi_name +php_strip_whitespace +php_uname +phpversion +pi +png2wbmp +popen +pos +posix_access +posix_ctermid +posix_errno +posix_getcwd +posix_getegid +posix_geteuid +posix_getgid +posix_getgrgid +posix_getgrnam +posix_getgroups +posix_get_last_error +posix_getlogin +posix_getpgid +posix_getpgrp +posix_getpid +posix_getppid +posix_getpwnam +posix_getpwuid +posix_getrlimit +posix_getsid +posix_getuid +posix_initgroups +posix_isatty +posix_kill +posix_mkfifo +posix_mknod +posix_setegid +posix_seteuid +posix_setgid +posix_setpgid +posix_setsid +posix_setuid +posix_strerror +posix_times +posix_ttyname +posix_uname +pow +preg_filter +preg_grep +preg_last_error +preg_match +preg_match_all +preg_quote +preg_replace +preg_replace_callback +preg_split +prev +print +printer_abort +printer_close +printer_create_brush +printer_create_dc +printer_create_font +printer_create_pen +printer_delete_brush +printer_delete_dc +printer_delete_font +printer_delete_pen +printer_draw_bmp +printer_draw_chord +printer_draw_elipse +printer_draw_line +printer_draw_pie +printer_draw_rectangle +printer_draw_roundrect +printer_draw_text +printer_end_doc +printer_end_page +printer_get_option +printer_list +printer_logical_fontheight +printer_open +printer_select_brush +printer_select_font +printer_select_pen +printer_set_option +printer_start_doc +printer_start_page +printer_write +printf +print_r +private +proc_close +proc_get_status +proc_nice +proc_open +proc_terminate +property_exists +protected +ps_add_bookmark +ps_add_launchlink +ps_add_locallink +ps_add_note +ps_add_pdflink +ps_add_weblink +ps_arc +ps_arcn +ps_begin_page +ps_begin_pattern +ps_begin_template +ps_circle +ps_clip +ps_close +ps_close_image +ps_closepath +ps_closepath_stroke +ps_continue_text +ps_curveto +ps_delete +ps_end_page +ps_end_pattern +ps_end_template +ps_fill +ps_fill_stroke +ps_findfont +ps_get_buffer +ps_get_parameter +ps_get_value +ps_hyphenate +ps_include_file +ps_lineto +ps_makespotcolor +ps_moveto +ps_new +ps_open_file +ps_open_image +ps_open_image_file +ps_open_memory_image +pspell_add_to_personal +pspell_add_to_session +pspell_check +pspell_clear_session +pspell_config_create +pspell_config_data_dir +pspell_config_dict_dir +pspell_config_ignore +pspell_config_mode +pspell_config_personal +pspell_config_repl +pspell_config_runtogether +pspell_config_save_repl +pspell_new +pspell_new_config +pspell_new_personal +pspell_save_wordlist +pspell_store_replacement +pspell_suggest +ps_place_image +ps_rect +ps_restore +ps_rotate +ps_save +ps_scale +ps_set_border_color +ps_set_border_dash +ps_set_border_style +ps_setcolor +ps_setdash +ps_setflat +ps_setfont +ps_setgray +ps_set_info +ps_setlinecap +ps_setlinejoin +ps_setlinewidth +ps_setmiterlimit +ps_setoverprintmode +ps_set_parameter +ps_setpolydash +ps_set_text_pos +ps_set_value +ps_shading +ps_shading_pattern +ps_shfill +ps_show +ps_show2 +ps_show_boxed +ps_show_xy +ps_show_xy2 +ps_string_geometry +ps_stringwidth +ps_stroke +ps_symbol +ps_symbol_name +ps_symbol_width +ps_translate +public +putenv +px_close +px_create_fp +px_date2string +px_delete +px_delete_record +px_get_field +px_get_info +px_get_parameter +px_get_record +px_get_schema +px_get_value +px_insert_record +px_new +px_numfields +px_numrecords +px_open_fp +px_put_record +px_retrieve_record +px_set_blob_file +px_set_parameter +px_set_tablename +px_set_targetencoding +px_set_value +px_timestamp2string +px_update_record +qdom_error +qdom_tree +quickhashinthash +quickhashintset +quickhashintstringhash +quickhashstringinthash +quoted_printable_decode +quoted_printable_encode +quotemeta +rad2deg +radius_acct_open +radius_add_server +radius_auth_open +radius_close +radius_config +radius_create_request +radius_cvt_addr +radius_cvt_int +radius_cvt_string +radius_demangle +radius_demangle_mppe_key +radius_get_attr +radius_get_vendor_attr +radius_put_addr +radius_put_attr +radius_put_int +radius_put_string +radius_put_vendor_addr +radius_put_vendor_attr +radius_put_vendor_int +radius_put_vendor_string +radius_request_authenticator +radius_send_request +radius_server_secret +radius_strerror +rand +range +rangeexception +rararchive +rarentry +rarexception +rar_wrapper_cache_stats +rawurldecode +rawurlencode +readdir +read_exif_data +readfile +readgzfile +readline +readline_add_history +readline_callback_handler_install +readline_callback_handler_remove +readline_callback_read_char +readline_clear_history +readline_completion_function +readline_info +readline_list_history +readline_on_new_line +readline_read_history +readline_redisplay +readline_write_history +readlink +realpath +realpath_cache_get +realpath_cache_size +recode +recode_file +recode_string +recursivearrayiterator +recursivecachingiterator +recursivecallbackfilteriterator +recursivedirectoryiterator +recursivefilteriterator +recursiveiterator +recursiveiteratoriterator +recursiveregexiterator +recursivetreeiterator +reflection +reflectionclass +reflectionexception +reflectionextension +reflectionfunction +reflectionfunctionabstract +reflectionmethod +reflectionobject +reflectionparameter +reflectionproperty +reflector +regexiterator +register_shutdown_function +register_tick_function +rename +rename_function +require +require_once +reset +resetValue +resourcebundle +restore_error_handler +restore_exception_handler +restore_include_path +return +rewind +rewinddir +rmdir +round +rpm_close +rpm_get_tag +rpm_is_valid +rpm_open +rpm_version +rrd_create +rrdcreator +rrd_error +rrd_fetch +rrd_first +rrdgraph +rrd_graph +rrd_info +rrd_last +rrd_lastupdate +rrd_restore +rrd_tune +rrd_update +rrdupdater +rrd_version +rrd_xport +rsort +rtrim +runkit_class_adopt +runkit_class_emancipate +runkit_constant_add +runkit_constant_redefine +runkit_constant_remove +runkit_function_add +runkit_function_copy +runkit_function_redefine +runkit_function_remove +runkit_function_rename +runkit_import +runkit_lint +runkit_lint_file +runkit_method_add +runkit_method_copy +runkit_method_redefine +runkit_method_remove +runkit_method_rename +runkit_return_value_used +runkit_sandbox_output_handler +runkit_superglobals +runtimeexception +samconnection_commit +samconnection_connect +samconnection_constructor +samconnection_disconnect +samconnection_errno +samconnection_error +samconnection_isconnected +samconnection_peek +samconnection_peekall +samconnection_receive +samconnection_remove +samconnection_rollback +samconnection_send +samconnection_setDebug +samconnection_subscribe +samconnection_unsubscribe +sammessage_body +sammessage_constructor +sammessage_header +sca_createdataobject +sca_getservice +sca_localproxy_createdataobject +scandir +sca_soapproxy_createdataobject +sdo_das_changesummary_beginlogging +sdo_das_changesummary_endlogging +sdo_das_changesummary_getchangeddataobjects +sdo_das_changesummary_getchangetype +sdo_das_changesummary_getoldcontainer +sdo_das_changesummary_getoldvalues +sdo_das_changesummary_islogging +sdo_das_datafactory_addpropertytotype +sdo_das_datafactory_addtype +sdo_das_datafactory_getdatafactory +sdo_das_dataobject_getchangesummary +sdo_das_relational_applychanges +sdo_das_relational_construct +sdo_das_relational_createrootdataobject +sdo_das_relational_executepreparedquery +sdo_das_relational_executequery +sdo_das_setting_getlistindex +sdo_das_setting_getpropertyindex +sdo_das_setting_getpropertyname +sdo_das_setting_getvalue +sdo_das_setting_isset +sdo_das_xml_addtypes +sdo_das_xml_create +sdo_das_xml_createdataobject +sdo_das_xml_createdocument +sdo_das_xml_document_getrootdataobject +sdo_das_xml_document_getrootelementname +sdo_das_xml_document_getrootelementuri +sdo_das_xml_document_setencoding +sdo_das_xml_document_setxmldeclaration +sdo_das_xml_document_setxmlversion +sdo_das_xml_loadfile +sdo_das_xml_loadstring +sdo_das_xml_savefile +sdo_das_xml_savestring +sdo_datafactory_create +sdo_dataobject_clear +sdo_dataobject_createdataobject +sdo_dataobject_getcontainer +sdo_dataobject_getsequence +sdo_dataobject_gettypename +sdo_dataobject_gettypenamespaceuri +sdo_exception_getcause +sdo_list_insert +sdo_model_property_getcontainingtype +sdo_model_property_getdefault +sdo_model_property_getname +sdo_model_property_gettype +sdo_model_property_iscontainment +sdo_model_property_ismany +sdo_model_reflectiondataobject_construct +sdo_model_reflectiondataobject_export +sdo_model_reflectiondataobject_getcontainmentproperty +sdo_model_reflectiondataobject_getinstanceproperties +sdo_model_reflectiondataobject_gettype +sdo_model_type_getbasetype +sdo_model_type_getname +sdo_model_type_getnamespaceuri +sdo_model_type_getproperties +sdo_model_type_getproperty +sdo_model_type_isabstracttype +sdo_model_type_isdatatype +sdo_model_type_isinstance +sdo_model_type_isopentype +sdo_model_type_issequencedtype +sdo_sequence_getproperty +sdo_sequence_insert +sdo_sequence_move +seekableiterator +sem_acquire +sem_get +sem_release +sem_remove +serializable +serialize +session_cache_expire +session_cache_limiter +session_commit +session_decode +session_destroy +session_encode +session_get_cookie_params +session_id +session_is_registered +session_module_name +session_name +session_pgsql_add_error +session_pgsql_get_error +session_pgsql_get_field +session_pgsql_reset +session_pgsql_set_field +session_pgsql_status +session_regenerate_id +session_register +session_save_path +session_set_cookie_params +session_set_save_handler +session_start +session_unregister +session_unset +session_write_close +__set() +setcookie +setCounterClass +set_error_handler +set_exception_handler +set_file_buffer +set_include_path +setlocale +set_magic_quotes_runtime +setproctitle +setrawcookie +set_socket_blocking +__set_state() +setstaticpropertyvalue +setthreadtitle +set_time_limit +settype +sha1 +sha1_file +shell_exec +shm_attach +shm_detach +shm_get_var +shm_has_var +shmop_close +shmop_delete +shmop_open +shmop_read +shmop_size +shmop_write +shm_put_var +shm_remove +shm_remove_var +show_source +shuffle +signeurlpaiement +similar_text +simplexmlelement +simplexml_import_dom +simplexmliterator +simplexml_load_file +simplexml_load_string +sin +sinh +sizeof +sleep +__sleep() +snmp +snmp2_get +snmp2_getnext +snmp2_real_walk +snmp2_set +snmp2_walk +snmp3_get +snmp3_getnext +snmp3_real_walk +snmp3_set +snmp3_walk +snmpexception +snmpget +snmpgetnext +snmp_get_quick_print +snmp_get_valueretrieval +snmp_read_mib +snmprealwalk +snmpset +snmp_set_enum_print +snmp_set_oid_numeric_print +snmp_set_oid_output_format +snmp_set_quick_print +snmp_set_valueretrieval +snmpwalk +snmpwalkoid +soapclient +soapfault +soapheader +soapparam +soapserver +soapvar +socket_accept +socket_bind +socket_clear_error +socket_close +socket_connect +socket_create +socket_create_listen +socket_create_pair +socket_get_option +socket_getpeername +socket_getsockname +socket_get_status +socket_last_error +socket_listen +socket_read +socket_recv +socket_recvfrom +socket_select +socket_send +socket_sendto +socket_set_block +socket_set_blocking +socket_set_nonblock +socket_set_option +socket_set_timeout +socket_shutdown +socket_strerror +socket_write +solrclient +solrclientexception +solrdocument +solrdocumentfield +solrexception +solrgenericresponse +solr_get_version +solrillegalargumentexception +solrillegaloperationexception +solrinputdocument +solrmodifiableparams +solrobject +solrparams +solrpingresponse +solrquery +solrqueryresponse +solrresponse +solrupdateresponse +solrutils +sort +soundex +sphinxclient +spl_autoload +spl_autoload_call +spl_autoload_extensions +spl_autoload_functions +spl_autoload_register +spl_autoload_unregister +splbool +spl_classes +spldoublylinkedlist +splenum +splfileinfo +splfileobject +splfixedarray +splfloat +splheap +splint +split +spliti +splmaxheap +splminheap +spl_object_hash +splobjectstorage +splobserver +splpriorityqueue +splqueue +splstack +splstring +splsubject +spltempfileobject +spltype +spoofchecker +sprintf +sqlite3 +sqlite3result +sqlite3stmt +sqlite_array_query +sqlite_busy_timeout +sqlite_changes +sqlite_close +sqlite_column +sqlite_create_aggregate +sqlite_create_function +sqlite_current +sqlite_error_string +sqlite_escape_string +sqlite_exec +sqlite_factory +sqlite_fetch_all +sqlite_fetch_array +sqlite_fetch_column_types +sqlite_fetch_object +sqlite_fetch_single +sqlite_fetch_string +sqlite_field_name +sqlite_has_more +sqlite_has_prev +sqlite_key +sqlite_last_error +sqlite_last_insert_rowid +sqlite_libencoding +sqlite_libversion +sqlite_next +sqlite_num_fields +sqlite_num_rows +sqlite_open +sqlite_popen +sqlite_prev +sqlite_query +sqlite_rewind +sqlite_seek +sqlite_single_query +sqlite_udf_decode_binary +sqlite_udf_encode_binary +sqlite_unbuffered_query +sqlite_valid +sql_regcase +sqlsrv_begin_transaction +sqlsrv_cancel +sqlsrv_client_info +sqlsrv_close +sqlsrv_commit +sqlsrv_configure +sqlsrv_connect +sqlsrv_errors +sqlsrv_execute +sqlsrv_fetch +sqlsrv_fetch_array +sqlsrv_fetch_object +sqlsrv_field_metadata +sqlsrv_free_stmt +sqlsrv_get_config +sqlsrv_get_field +sqlsrv_has_rows +sqlsrv_next_result +sqlsrv_num_fields +sqlsrv_num_rows +sqlsrv_prepare +sqlsrv_query +sqlsrv_rollback +sqlsrv_rows_affected +sqlsrv_send_stream_data +sqlsrv_server_info +sqrt +srand +sscanf +ssdeep_fuzzy_compare +ssdeep_fuzzy_hash +ssdeep_fuzzy_hash_filename +ssh2_auth_hostbased_file +ssh2_auth_none +ssh2_auth_password +ssh2_auth_pubkey_file +ssh2_connect +ssh2_exec +ssh2_fetch_stream +ssh2_fingerprint +ssh2_methods_negotiated +ssh2_publickey_add +ssh2_publickey_init +ssh2_publickey_list +ssh2_publickey_remove +ssh2_scp_recv +ssh2_scp_send +ssh2_sftp +ssh2_sftp_lstat +ssh2_sftp_mkdir +ssh2_sftp_readlink +ssh2_sftp_realpath +ssh2_sftp_rename +ssh2_sftp_rmdir +ssh2_sftp_stat +ssh2_sftp_symlink +ssh2_sftp_unlink +ssh2_shell +ssh2_tunnel +stat +static +stats_absolute_deviation +stats_cdf_beta +stats_cdf_binomial +stats_cdf_cauchy +stats_cdf_chisquare +stats_cdf_exponential +stats_cdf_f +stats_cdf_gamma +stats_cdf_laplace +stats_cdf_logistic +stats_cdf_negative_binomial +stats_cdf_noncentral_chisquare +stats_cdf_noncentral_f +stats_cdf_poisson +stats_cdf_t +stats_cdf_uniform +stats_cdf_weibull +stats_covariance +stats_dens_beta +stats_dens_cauchy +stats_dens_chisquare +stats_dens_exponential +stats_dens_f +stats_dens_gamma +stats_dens_laplace +stats_dens_logistic +stats_dens_negative_binomial +stats_dens_normal +stats_dens_pmf_binomial +stats_dens_pmf_hypergeometric +stats_dens_pmf_poisson +stats_dens_t +stats_dens_weibull +stats_den_uniform +stats_harmonic_mean +stats_kurtosis +stats_rand_gen_beta +stats_rand_gen_chisquare +stats_rand_gen_exponential +stats_rand_gen_f +stats_rand_gen_funiform +stats_rand_gen_gamma +stats_rand_gen_ibinomial +stats_rand_gen_ibinomial_negative +stats_rand_gen_int +stats_rand_gen_ipoisson +stats_rand_gen_iuniform +stats_rand_gen_noncenral_chisquare +stats_rand_gen_noncentral_f +stats_rand_gen_noncentral_t +stats_rand_gen_normal +stats_rand_gen_t +stats_rand_get_seeds +stats_rand_phrase_to_seeds +stats_rand_ranf +stats_rand_setall +stats_skew +stats_standard_deviation +stats_stat_binomial_coef +stats_stat_correlation +stats_stat_gennch +stats_stat_independent_t +stats_stat_innerproduct +stats_stat_noncentral_t +stats_stat_paired_t +stats_stat_percentile +stats_stat_powersum +stats_variance +stomp +stomp_connect_error +stompexception +stompframe +stomp_version +strcasecmp +strchr +strcmp +strcoll +strcspn +stream_bucket_append +stream_bucket_make_writeable +stream_bucket_new +stream_bucket_prepend +stream_context_create +stream_context_get_default +stream_context_get_options +stream_context_get_params +stream_context_set_default +stream_context_set_option +stream_context_set_params +stream_copy_to_stream +stream_encoding +stream_filter_append +stream_filter_prepend +stream_filter_register +stream_filter_remove +stream_get_contents +stream_get_filters +stream_get_line +stream_get_meta_data +stream_get_transports +stream_get_wrappers +stream_is_local +stream_notification_callback +stream_register_wrapper +stream_resolve_include_path +stream_select +stream_set_blocking +stream_set_read_buffer +stream_set_timeout +stream_set_write_buffer +stream_socket_accept +stream_socket_client +stream_socket_enable_crypto +stream_socket_get_name +stream_socket_pair +stream_socket_recvfrom +stream_socket_sendto +stream_socket_server +stream_socket_shutdown +stream_supports_lock +streamwrapper +stream_wrapper_register +stream_wrapper_restore +stream_wrapper_unregister +strftime +str_getcsv +stripcslashes +stripos +stripslashes +strip_tags +str_ireplace +stristr +strlen +strnatcasecmp +strnatcmp +strncasecmp +strncmp +str_pad +strpbrk +strpos +strptime +strrchr +str_repeat +str_replace +strrev +strripos +str_rot13 +strrpos +str_shuffle +str_split +strspn +strstr +strtok +strtolower +strtotime +strtoupper +strtr +strval +str_word_count +substr +substr_compare +substr_count +substr_replace +svm +svmmodel +svn_add +svn_auth_get_parameter +svn_auth_set_parameter +svn_blame +svn_cat +svn_checkout +svn_cleanup +svn_client_version +svn_commit +svn_delete +svn_diff +svn_export +svn_fs_abort_txn +svn_fs_apply_text +svn_fs_begin_txn2 +svn_fs_change_node_prop +svn_fs_check_path +svn_fs_contents_changed +svn_fs_copy +svn_fs_delete +svn_fs_dir_entries +svn_fs_file_contents +svn_fs_file_length +svn_fs_is_dir +svn_fs_is_file +svn_fs_make_dir +svn_fs_make_file +svn_fs_node_created_rev +svn_fs_node_prop +svn_fs_props_changed +svn_fs_revision_prop +svn_fs_revision_root +svn_fs_txn_root +svn_fs_youngest_rev +svn_import +svn_log +svn_ls +svn_mkdir +svn_repos_create +svn_repos_fs +svn_repos_fs_begin_txn_for_commit +svn_repos_fs_commit_txn +svn_repos_hotcopy +svn_repos_open +svn_repos_recover +svn_revert +svn_status +svn_update +swfaction +swfaction.construct +swf_actiongeturl +swf_actiongotoframe +swf_actiongotolabel +swf_actionnextframe +swf_actionplay +swf_actionprevframe +swf_actionsettarget +swf_actionstop +swf_actiontogglequality +swf_actionwaitforframe +swf_addbuttonrecord +swf_addcolor +swfbitmap +swfbitmap.construct +swfbitmap.getheight +swfbitmap.getwidth +swfbutton +swfbutton.addaction +swfbutton.addasound +swfbutton.addshape +swfbutton.construct +swfbutton.setaction +swfbutton.setdown +swfbutton.sethit +swfbutton.setmenu +swfbutton.setover +swfbutton.setup +swf_closefile +swf_definebitmap +swf_definefont +swf_defineline +swf_definepoly +swf_definerect +swf_definetext +swfdisplayitem +swfdisplayitem.addaction +swfdisplayitem.addcolor +swfdisplayitem.endmask +swfdisplayitem.getrot +swfdisplayitem.getx +swfdisplayitem.getxscale +swfdisplayitem.getxskew +swfdisplayitem.gety +swfdisplayitem.getyscale +swfdisplayitem.getyskew +swfdisplayitem.move +swfdisplayitem.moveto +swfdisplayitem.multcolor +swfdisplayitem.remove +swfdisplayitem.rotate +swfdisplayitem.rotateto +swfdisplayitem.scale +swfdisplayitem.scaleto +swfdisplayitem.setdepth +swfdisplayitem.setmasklevel +swfdisplayitem.setmatrix +swfdisplayitem.setname +swfdisplayitem.setratio +swfdisplayitem.skewx +swfdisplayitem.skewxto +swfdisplayitem.skewy +swfdisplayitem.skewyto +swf_endbutton +swf_enddoaction +swf_endshape +swf_endsymbol +swffill +swffill.moveto +swffill.rotateto +swffill.scaleto +swffill.skewxto +swffill.skewyto +swffont +swffontchar +swffontchar.addchars +swffontchar.addutf8chars +swffont.construct +swffont.getascent +swffont.getdescent +swffont.getleading +swffont.getshape +swffont.getutf8width +swffont.getwidth +swf_fontsize +swf_fontslant +swf_fonttracking +swf_getbitmapinfo +swf_getfontinfo +swf_getframe +swfgradient +swfgradient.addentry +swfgradient.construct +swf_labelframe +swf_lookat +swf_modifyobject +swfmorph +swfmorph.construct +swfmorph.getshape1 +swfmorph.getshape2 +swfmovie +swfmovie.add +swfmovie.addexport +swfmovie.addfont +swfmovie.construct +swfmovie.importchar +swfmovie.importfont +swfmovie.labelframe +swfmovie.nextframe +swfmovie.output +swfmovie.remove +swfmovie.save +swfmovie.savetofile +swfmovie.setbackground +swfmovie.setdimension +swfmovie.setframes +swfmovie.setrate +swfmovie.startsound +swfmovie.stopsound +swfmovie.streammp3 +swfmovie.writeexports +swf_mulcolor +swf_nextid +swf_oncondition +swf_openfile +swf_ortho +swf_ortho2 +swf_perspective +swf_placeobject +swf_polarview +swf_popmatrix +swf_posround +swfprebuiltclip +swfprebuiltclip.construct +swf_pushmatrix +swf_removeobject +swf_rotate +swf_scale +swf_setfont +swf_setframe +swfshape +swfshape.addfill +swf_shapearc +swfshape.construct +swf_shapecurveto +swf_shapecurveto3 +swfshape.drawarc +swfshape.drawcircle +swfshape.drawcubic +swfshape.drawcubicto +swfshape.drawcurve +swfshape.drawcurveto +swfshape.drawglyph +swfshape.drawline +swfshape.drawlineto +swf_shapefillbitmapclip +swf_shapefillbitmaptile +swf_shapefilloff +swf_shapefillsolid +swf_shapelinesolid +swf_shapelineto +swfshape.movepen +swfshape.movepento +swf_shapemoveto +swfshape.setleftfill +swfshape.setline +swfshape.setrightfill +swf_showframe +swfsound +swfsound.construct +swfsoundinstance +swfsoundinstance.loopcount +swfsoundinstance.loopinpoint +swfsoundinstance.loopoutpoint +swfsoundinstance.nomultiple +swfsprite +swfsprite.add +swfsprite.construct +swfsprite.labelframe +swfsprite.nextframe +swfsprite.remove +swfsprite.setframes +swfsprite.startsound +swfsprite.stopsound +swf_startbutton +swf_startdoaction +swf_startshape +swf_startsymbol +swftext +swftext.addstring +swftext.addutf8string +swftext.construct +swftextfield +swftextfield.addchars +swftextfield.addstring +swftextfield.align +swftextfield.construct +swftextfield.setbounds +swftextfield.setcolor +swftextfield.setfont +swftextfield.setheight +swftextfield.setindentation +swftextfield.setleftmargin +swftextfield.setlinespacing +swftextfield.setmargins +swftextfield.setname +swftextfield.setpadding +swftextfield.setrightmargin +swftext.getascent +swftext.getdescent +swftext.getleading +swftext.getutf8width +swftext.getwidth +swftext.moveto +swftext.setcolor +swftext.setfont +swftext.setheight +swftext.setspacing +swf_textwidth +swf_translate +swfvideostream +swfvideostream.construct +swfvideostream.getnumframes +swfvideostream.setdimension +swf_viewport +swish_construct +swish_getmetalist +swish_getpropertylist +swish_prepare +swish_query +swishresult_getmetalist +swishresults_getparsedwords +swishresults_getremovedstopwords +swishresults_nextresult +swishresults_seekresult +swishresult_stem +swishsearch_execute +swishsearch_resetlimit +swishsearch_setlimit +swishsearch_setphrasedelimiter +swishsearch_setsort +swishsearch_setstructure +switch +sybase_affected_rows +sybase_close +sybase_connect +sybase_data_seek +sybase_deadlock_retry_count +sybase_fetch_array +sybase_fetch_assoc +sybase_fetch_field +sybase_fetch_object +sybase_fetch_row +sybase_field_seek +sybase_free_result +sybase_get_last_message +sybase_min_client_severity +sybase_min_error_severity +sybase_min_message_severity +sybase_min_server_severity +sybase_num_fields +sybase_num_rows +sybase_pconnect +sybase_query +sybase_result +sybase_select_db +sybase_set_message_handler +sybase_unbuffered_query +symlink +sys_getloadavg +sys_get_temp_dir +syslog +system +tan +tanh +tcpwrap_check +tempnam +textdomain +throw +tidy +tidy_access_count +tidy_config_count +tidy_diagnose +tidy_error_count +tidy_get_error_buffer +tidy_get_output +tidy_load_config +tidynode +tidy_reset_config +tidy_save_config +tidy_set_encoding +tidy_setopt +tidy_warning_count +time +time_nanosleep +time_sleep_until +timezone_abbreviations_list +timezone_identifiers_list +timezone_location_get +timezone_name_from_abbr +timezone_name_get +timezone_offset_get +timezone_open +timezone_transitions_get +timezone_version_get +tmpfile +token_get_all +token_name +tokyotyrant +tokyotyrantquery +tokyotyranttable +tostring +__toString() +touch +transliterator +traversable +trigger_error +trim +try +uasort +ucfirst +ucwords +udm_add_search_limit +udm_alloc_agent +udm_alloc_agent_array +udm_api_version +udm_cat_list +udm_cat_path +udm_check_charset +udm_check_stored +udm_clear_search_limits +udm_close_stored +udm_crc32 +udm_errno +udm_error +udm_find +udm_free_agent +udm_free_ispell_data +udm_free_res +udm_get_doc_count +udm_get_res_field +udm_get_res_param +udm_hash32 +udm_load_ispell_data +udm_open_stored +udm_set_agent_param +uksort +umask +underflowexception +unexpectedvalueexception +uniqid +unixtojd +unlink +unpack +unregister_tick_function +unserialize +unset +__unset() +urldecode +urlencode +use +user_error +use_soap_error_handler +usleep +usort +utf8_decode +utf8_encode +v8js +v8jsexception +var +var_dump +var_export +variant +variant_abs +variant_add +variant_and +variant_cast +variant_cat +variant_cmp +variant_date_from_timestamp +variant_date_to_timestamp +variant_div +variant_eqv +variant_fix +variant_get_type +variant_idiv +variant_imp +variant_int +variant_mod +variant_mul +variant_neg +variant_not +variant_or +variant_pow +variant_round +variant_set +variant_set_type +variant_sub +variant_xor +version_compare +vfprintf +virtual +vpopmail_add_alias_domain +vpopmail_add_alias_domain_ex +vpopmail_add_domain +vpopmail_add_domain_ex +vpopmail_add_user +vpopmail_alias_add +vpopmail_alias_del +vpopmail_alias_del_domain +vpopmail_alias_get +vpopmail_alias_get_all +vpopmail_auth_user +vpopmail_del_domain +vpopmail_del_domain_ex +vpopmail_del_user +vpopmail_error +vpopmail_passwd +vpopmail_set_user_quota +vprintf +vsprintf +w32api_deftype +w32api_init_dtype +w32api_invoke_function +w32api_register_function +w32api_set_call_method +__wakeup() +wddx_add_vars +wddx_deserialize +wddx_packet_end +wddx_packet_start +wddx_serialize_value +wddx_serialize_vars +weakref +while +win32_continue_service +win32_create_service +win32_delete_service +win32_get_last_control_message +win32_pause_service +win32_ps_list_procs +win32_ps_stat_mem +win32_ps_stat_proc +win32_query_service_status +win32_set_service_status +win32_start_service +win32_start_service_ctrl_dispatcher +win32_stop_service +wincache_fcache_fileinfo +wincache_fcache_meminfo +wincache_lock +wincache_ocache_fileinfo +wincache_ocache_meminfo +wincache_refresh_if_changed +wincache_rplist_fileinfo +wincache_rplist_meminfo +wincache_scache_info +wincache_scache_meminfo +wincache_ucache_add +wincache_ucache_cas +wincache_ucache_clear +wincache_ucache_dec +wincache_ucache_delete +wincache_ucache_exists +wincache_ucache_get +wincache_ucache_inc +wincache_ucache_info +wincache_ucache_meminfo +wincache_ucache_set +wincache_unlock +wordwrap +xattr_get +xattr_list +xattr_remove +xattr_set +xattr_supported +xdiff_file_bdiff +xdiff_file_bdiff_size +xdiff_file_bpatch +xdiff_file_diff +xdiff_file_diff_binary +xdiff_file_merge3 +xdiff_file_patch +xdiff_file_patch_binary +xdiff_file_rabdiff +xdiff_string_bdiff +xdiff_string_bdiff_size +xdiff_string_bpatch +xdiff_string_diff +xdiff_string_diff_binary +xdiff_string_merge3 +xdiff_string_patch +xdiff_string_patch_binary +xdiff_string_rabdiff +xhprof_disable +xhprof_enable +xhprof_sample_disable +xhprof_sample_enable +xml_error_string +xml_get_current_byte_index +xml_get_current_column_number +xml_get_current_line_number +xml_get_error_code +xml_parse +xml_parse_into_struct +xml_parser_create +xml_parser_create_ns +xml_parser_free +xml_parser_get_option +xml_parser_set_option +xmlreader +xmlrpc_decode +xmlrpc_decode_request +xmlrpc_encode +xmlrpc_encode_request +xmlrpc_get_type +xmlrpc_is_fault +xmlrpc_parse_method_descriptions +xmlrpc_server_add_introspection_data +xmlrpc_server_call_method +xmlrpc_server_create +xmlrpc_server_destroy +xmlrpc_server_register_introspection_callback +xmlrpc_server_register_method +xmlrpc_set_type +xml_set_character_data_handler +xml_set_default_handler +xml_set_element_handler +xml_set_end_namespace_decl_handler +xml_set_external_entity_ref_handler +xml_set_notation_decl_handler +xml_set_object +xml_set_processing_instruction_handler +xml_set_start_namespace_decl_handler +xml_set_unparsed_entity_decl_handler +xmlwriter_end_attribute +xmlwriter_end_cdata +xmlwriter_end_comment +xmlwriter_end_document +xmlwriter_end_dtd +xmlwriter_end_dtd_attlist +xmlwriter_end_dtd_element +xmlwriter_end_dtd_entity +xmlwriter_end_element +xmlwriter_end_pi +xmlwriter_flush +xmlwriter_full_end_element +xmlwriter_open_memory +xmlwriter_open_uri +xmlwriter_output_memory +xmlwriter_set_indent +xmlwriter_set_indent_string +xmlwriter_start_attribute +xmlwriter_start_attribute_ns +xmlwriter_start_cdata +xmlwriter_start_comment +xmlwriter_start_document +xmlwriter_start_dtd +xmlwriter_start_dtd_attlist +xmlwriter_start_dtd_element +xmlwriter_start_dtd_entity +xmlwriter_start_element +xmlwriter_start_element_ns +xmlwriter_start_pi +xmlwriter_text +xmlwriter_write_attribute +xmlwriter_write_attribute_ns +xmlwriter_write_cdata +xmlwriter_write_comment +xmlwriter_write_dtd +xmlwriter_write_dtd_attlist +xmlwriter_write_dtd_element +xmlwriter_write_dtd_entity +xmlwriter_write_element +xmlwriter_write_element_ns +xmlwriter_write_pi +xmlwriter_write_raw +xor +xpath_eval +xpath_eval_expression +xpath_new_context +xpath_register_ns +xpath_register_ns_auto +xptr_eval +xptr_new_context +xslt_backend_info +xslt_backend_name +xslt_backend_version +xslt_create +xslt_errno +xslt_error +xslt_free +xslt_getopt +xslt_process +xsltprocessor +xslt_set_base +xslt_set_encoding +xslt_set_error_handler +xslt_set_log +xslt_set_object +xslt_setopt +xslt_set_sax_handler +xslt_set_sax_handlers +xslt_set_scheme_handler +xslt_set_scheme_handlers +yaml_emit +yaml_emit_file +yaml_parse +yaml_parse_file +yaml_parse_url +yaz_addinfo +yaz_ccl_conf +yaz_ccl_parse +yaz_close +yaz_connect +yaz_database +yaz_element +yaz_errno +yaz_error +yaz_es +yaz_es_result +yaz_get_option +yaz_hits +yaz_itemorder +yaz_present +yaz_range +yaz_record +yaz_scan +yaz_scan_result +yaz_schema +yaz_search +yaz_set_option +yaz_sort +yaz_syntax +yaz_wait +yp_all +yp_cat +yp_errno +yp_err_string +yp_first +yp_get_default_domain +yp_master +yp_match +yp_next +yp_order +zend_logo_guid +zend_thread_id +zend_version +ziparchive +ziparchive_addemptydir +ziparchive_addfile +ziparchive_addfromstring +ziparchive_close +ziparchive_deleteindex +ziparchive_deletename +ziparchive_extractto +ziparchive_getarchivecomment +ziparchive_getcommentindex +ziparchive_getcommentname +ziparchive_getfromindex +ziparchive_getfromname +ziparchive_getnameindex +ziparchive_getstatusstring +ziparchive_getstream +ziparchive_locatename +ziparchive_open +ziparchive_renameindex +ziparchive_renamename +ziparchive_setarchivecomment +ziparchive_setcommentindex +ziparchive_setCommentName +ziparchive_statindex +ziparchive_statname +ziparchive_unchangeall +ziparchive_unchangearchive +ziparchive_unchangeindex +ziparchive_unchangename +zip_close +zip_entry_close +zip_entry_compressedsize +zip_entry_compressionmethod +zip_entry_filesize +zip_entry_name +zip_entry_open +zip_entry_read +zip_open +zip_read +zlib_get_coding_type +amqpchannel +amqpenvelope +autoload +bumpvalue +class_uses +closure +cubrid_get_query_timeout +cubrid_pconnect +cubrid_pconnect_with_url +cubrid_set_query_timeout +directory +domcdatasection +eio_busy +eio_cancel +eio_chmod +eio_chown +eio_close +eio_custom +eio_dup2 +eio_event_loop +eio_fallocate +eio_fchmod +eio_fchown +eio_fdatasync +eio_fstat +eio_fstatvfs +eio_fsync +eio_ftruncate +eio_futime +eio_get_event_stream +eio_grp +eio_grp_add +eio_grp_cancel +eio_grp_limit +eio_link +eio_lstat +eio_mkdir +eio_mknod +eio_nop +eio_npending +eio_nready +eio_nreqs +eio_nthreads +eio_open +eio_poll +eio_read +eio_readahead +eio_readdir +eio_readlink +eio_realpath +eio_rename +eio_rmdir +eio_sendfile +eio_set_max_idle +eio_set_max_parallel +eio_set_max_poll_reqs +eio_set_max_poll_time +eio_set_min_parallel +eio_stat +eio_statvfs +eio_symlink +eio_sync +eio_sync_file_range +eio_syncfs +eio_truncate +eio_unlink +eio_utime +eio_write +get_declared_traits +getimagesizefromstring +getmeta +getnamed +getvalue +hwapi_attribute_new +hwapi_content_new +is_tainted +lapack +lapackexception +ldap_control_paged_result +ldap_control_paged_result_response +libxml_set_external_entity_loader +mysqli_get_cache_stats +mysqli_sql_exception +mysqlnd_ms_get_last_gtid +mysqlnd_ms_get_last_used_connection +mysqlnd_ms_match_wild +mysqlnd_ms_set_qos +mysqlnd_qc_get_available_handlers +mysqlnd_qc_get_normalized_query_trace_log +mysqlnd_qc_set_cache_condition +mysqlnd_qc_set_is_select +mysqlnd_qc_set_storage_handler +mysqlnd_uh_convert_to_mysqlnd +mysqlnd_uh_set_connection_proxy +mysqlnd_uh_set_statement_proxy +mysqlnduhconnection +mysqlnduhpreparedstatement +pg_escape_identifier +pg_escape_literal +phar +phardata +pharexception +pharfileinfo +php_user_filter +reflectionzendextension +resetvalue +session_register_shutdown +session_status +sessionhandler +sessionhandlerinterface +setcounterclass +socket_import_stream +stream_set_chunk_size +taint +tokyotyrantexception +tokyotyrantiterator +trait_exists +untaint +varnishadmin +varnishlog +varnishstat +yaf_action_abstract +yaf_application +yaf_bootstrap_abstract +yaf_config_abstract +yaf_config_ini +yaf_config_simple +yaf_controller_abstract +yaf_dispatcher +yaf_exception +yaf_exception_dispatchfailed +yaf_exception_loadfailed +yaf_exception_loadfailed_action +yaf_exception_loadfailed_controller +yaf_exception_loadfailed_module +yaf_exception_loadfailed_view +yaf_exception_routerfailed +yaf_exception_startuperror +yaf_exception_typeerror +yaf_loader +yaf_plugin_abstract +yaf_registry +yaf_request_abstract +yaf_request_http +yaf_request_simple +yaf_response_abstract +yaf_route_interface +yaf_route_map +yaf_route_regex +yaf_route_rewrite +yaf_route_simple +yaf_route_static +yaf_route_supervar +yaf_router +yaf_session +yaf_view_interface +yaf_view_simple +zlib_decode +zlib_encode +trait +insteadof diff --git a/elpa/auto-complete-20140803.2118/dict/python-mode b/elpa/auto-complete-20140803.2118/dict/python-mode new file mode 100644 index 000000000..108bfa5f0 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/python-mode @@ -0,0 +1,378 @@ +ArithmeticError +AssertionError +AttributeError +BaseException +BufferError +BytesWarning +DeprecationWarning +EOFError +Ellipsis +EnvironmentError +Exception +False +FloatingPointError +FutureWarning +GeneratorExit +IOError +ImportError +ImportWarning +IndentationError +IndexError +KeyError +KeyboardInterrupt +LookupError +MemoryError +NameError +None +NotImplemented +NotImplementedError +OSError +OverflowError +PendingDeprecationWarning +ReferenceError +RuntimeError +RuntimeWarning +StandardError +StopIteration +SyntaxError +SyntaxWarning +SystemError +SystemExit +TabError +True +TypeError +UnboundLocalError +UnicodeDecodeError +UnicodeEncodeError +UnicodeError +UnicodeTranslateError +UnicodeWarning +UserWarning +ValueError +Warning +ZeroDivisionError +__builtins__ +__debug__ +__doc__ +__file__ +__future__ +__import__ +__main__ +__name__ +__package__ +_dummy_thread +_thread +abc +abs +aifc +all +and +any +apply +argparse +array +as +assert +ast +asynchat +asyncio +asyncore +atexit +audioop +base64 +basestring +bdb +bin +binascii +binhex +bisect +bool +break +buffer +builtins +bytearray +bytes +bz2 +calendar +callable +cgi +cgitb +chr +chuck +class +classmethod +cmath +cmd +cmp +code +codecs +codeop +coerce +collections +colorsys +compile +compileall +complex +concurrent +configparser +contextlib +continue +copy +copyreg +copyright +credits +crypt +csv +ctypes +curses +datetime +dbm +decimal +def +del +delattr +dict +difflib +dir +dis +distutils +divmod +doctest +dummy_threading +elif +else +email +enumerate +ensurepip +enum +enumerat +errno +eval +except +exec +execfile +exit +faulthandler +fcntl +file +filecmp +fileinput +filter +finally +float +fnmatch +for +format +formatter +fpectl +fractions +from +frozenset +ftplib +functools +gc +getattr +getopt +getpass +gettext +glob +global +globals +grp +gzip +hasattr +hash +hashlib +heapq +help +hex +hmac +html +http +id +if +imghdr +imp +impalib +import +importlib +in +input +inspect +int +intern +io +ipaddress +is +isinstance +issubclass +iter +itertools +json +keyword +lambda +len +license +linecache +list +locale +locals +logging +long +lzma +macpath +mailbox +mailcap +map +marshal +math +max +memoryview +mimetypes +min +mmap +modulefinder +msilib +msvcrt +multiprocessing +netrc +next +nis +nntplib +not +numbers +object +oct +open +operator +optparse +or +ord +os +ossaudiodev +parser +pass +pathlib +pdb +pickle +pickletools +pipes +pkgutil +platform +plistlib +poplib +posix +pow +pprint +print +profile +property +pty +pwd +py_compiler +pyclbr +pydoc +queue +quit +quopri +raise +random +range +raw_input +re +readline +reduce +reload +repr +reprlib +resource +return +reversed +rlcompleter +round +runpy +sched +select +selectors +set +setattr +shelve +shlex +shutil +signal +site +slice +smtpd +smtplib +sndhdr +socket +socketserver +sorted +spwd +sqlite3 +ssl +stat +staticmethod +statistics +str +string +stringprep +struct +subprocess +sum +sunau +super +symbol +symtable +sys +sysconfig +syslog +tabnanny +tarfile +telnetlib +tempfile +termios +test +textwrap +threading +time +timeit +tkinter +token +tokenize +trace +traceback +tracemalloc +try +tty +tuple +turtle +type +types +unichr +unicode +unicodedata +unittest +urllib +uu +uuid +vars +venv +warnings +wave +weakref +webbrowser +while +winsound +winreg +with +wsgiref +xdrlib +xml +xmlrpc +xrange +yield +zip +zipfile +zipimport +zlib diff --git a/elpa/auto-complete-20140803.2118/dict/qml-mode b/elpa/auto-complete-20140803.2118/dict/qml-mode new file mode 100644 index 000000000..7d9976e6d --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/qml-mode @@ -0,0 +1,183 @@ +AlignBottom +AlignCenter +AlignHCenter +AlignLeft +AlignRight +AlignTop +AlignVCenter +AnchorAnimation +AnchorChanges +Audio +Behavior +Binding +BorderImage +ColorAnimation +Column +Component +Connections +Easing +Flickable +Flipable +Flow +FocusScope +GestureArea +Grid +GridView +Horizontal +Image +InBack +InBounce +InCirc +InCubic +InElastic +InExpo +InOutBack +InOutBounce +InOutCirc +InOutCubic +InOutElastic +InOutExpo +InOutQuad +InOutQuart +InOutQuint +InQuad +InQuart +InQuint +InQuint +InSine +Item +LayoutItem +LeftButton +Linear +ListElement +ListModel +ListView +Loader +MidButton +MiddleButton +MouseArea +NoButton +NumberAnimation +OutBack +OutBounce +OutCirc +OutCubic +OutElastic +OutExpo +OutInBack +OutInBounce +OutInCirc +OutInCubic +OutInElastic +OutInExpo +OutInQuad +OutInQuart +OutInQuint +OutQuad +OutQuart +OutQuint +OutSine +Package +ParallelAnimation +ParentAnimation +ParentChange +ParticleMotionGravity +ParticleMotionLinear +ParticleMotionWander +Particles +Path +PathAttribute +PathCubic +PathLine +PathPercent +PathQuad +PathView +PauseAnimation +PropertyAction +PropertyAnimation +PropertyChanges +Qt +QtObject +Rectangle +Repeater +RightButton +Rotation +RotationAnimation +Row +Scale +ScriptAction +SequentialAnimation +SmoothedAnimation +SoundEffect +SpringFollow +State +StateChangeScript +StateGroup +SystemPalette +Text +TextEdit +TextInput +Timer +Transition +Translate +Vertical +Video +ViewsPositionersMediaEffects +VisualDataModel +VisualItemModel +WebView +WorkerScript +XmlListModel +XmlRole +alias +as +bool +break +case +catch +color +const +continue +date +debugger +default +delete +do +double +else +enum +false +false +finally +for +function +if +import +import +in +instanceof +int +let +new +null +on +parent +property +real +return +signal +string +switch +this +throw +true +try +typeof +undefined +url +var +variant +void +while +with +yield diff --git a/elpa/auto-complete-20140803.2118/dict/ruby-mode b/elpa/auto-complete-20140803.2118/dict/ruby-mode new file mode 100644 index 000000000..1a854178c --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/ruby-mode @@ -0,0 +1,181 @@ +$! +$" +$$ +$& +$' +$* +$+ +$, +$-0 +$-F +$-I +$-K +$-a +$-d +$-i +$-l +$-p +$-v +$-w +$. +$/ +$0 +$1 +$10 +$11 +$2 +$3 +$4 +$5 +$6 +$7 +$8 +$9 +$: +$; +$< +$= +$> +$? +$@ +$DEBUG +$FILENAME +$KCODE +$LOADED_FEATURES +$LOAD_PATH +$PROGRAM_NAME +$SAFE +$VERBOSE +$\ +$_ +$` +$deferr +$defout +$stderr +$stdin +$stdout +$~ +ARGF +ARGV +Array +BEGIN +DATA +END +ENV +FALSE +Float +Integer +NIL +PLATFORM +RELEASE_DATE +RUBY_COPYRIGHT +RUBY_DESCRIPTION +RUBY_PATCHLEVEL +RUBY_PLATFORM +RUBY_RELEASE_DATE +RUBY_VERSION +SCRIPT_LINES__ +STDERR +STDIN +STDOUT +String +TOPLEVEL_BINDING +TRUE +VERSION +__method__ +` +abort +alias +and +at_exit +autoload +autoload? +begin +binding +block_given +break +callcc +caller +case +catch +chomp +chomp! +chop +chop +class +def +defined? +do +else +elsif +end +ensure +eval +exec +exit +exit! +fail +false +for +fork +format +getc +gets +global_variables +gsub +gsub! +if +in +iterator? +lambda +load +local_variables +loop +module +next +nil +not +open +or +p +printf +proc +putc +puts +raise +rand +readline +readlines +redo +require +require_relative +rescue +retry +return +scan +select +self +set_trace_func +sleep +split +sprintf +srand +sub +sub! +super +syscall +system +test +then +throw +trace_var +trap +true +undef +unless +until +untrace_var +warn +when +while +yield diff --git a/elpa/auto-complete-20140803.2118/dict/scheme-mode b/elpa/auto-complete-20140803.2118/dict/scheme-mode new file mode 100644 index 000000000..e5cca6151 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/scheme-mode @@ -0,0 +1,216 @@ +case-lambda +call/cc +class +define-class +exit-handler +field +import +inherit +init-field +interface +let*-values +let-values +let/ec +mixin +opt-lambda +override +protect +provide +public +rename +require +require-for-syntax +syntax +syntax-case +syntax-error +unit/sig +unless +when +with-syntax +and +begin +call-with-current-continuation +call-with-input-file +call-with-output-file +case +cond +define +define-syntax +delay +do +dynamic-wind +else +for-each +if +lambda +let +let* +let-syntax +letrec +letrec-syntax +map +or +syntax-rules +abs +acos +angle +append +apply +asin +assoc +assq +assv +atan +boolean? +caar +cadr +call-with-input-file +call-with-output-file +call-with-values +car +cdddar +cddddr +cdr +ceiling +char->integer +char-alphabetic? +char-ci<=? +char-ci=? +char-ci>? +char-downcase +char-lower-case? +char-numeric? +char-ready? +char-upcase +char-upper-case? +char-whitespace? +char<=? +char=? +char>? +char? +close-input-port +close-output-port +complex? +cons +cos +current-input-port +current-output-port +denominator +display +eof-object? +eq? +equal? +eqv? +eval +even? +exact->inexact +exact? +exp +expt +#f +floor +force +gcd +imag-part +inexact->exact +inexact? +input-port? +integer->char +integer? +interaction-environment +lcm +length +list +list->string +list->vector +list-ref +list-tail +list? +load +log +magnitude +make-polar +make-rectangular +make-string +make-vector +max +member +memq +memv +min +modulo +negative? +newline +not +null-environment +null? +number->string +number? +numerator +odd? +open-input-file +open-output-file +output-port? +pair? +peek-char +port? +positive? +procedure? +quasiquote +quote +quotient +rational? +rationalize +read +read-char +real-part +real? +remainder +reverse +round +scheme-report-environment +set! +set-car! +set-cdr! +sin +sqrt +string +string->list +string->number +string->symbol +string-append +string-ci<=? +string-ci=? +string-ci>? +string-copy +string-fill! +string-length +string-ref +string-set! +string<=? +string=? +string>? +string? +substring +symbol->string +symbol? +#t +tan +transcript-off +transcript-on +truncate +values +vector +vector->list +vector-fill! +vector-length +vector-ref +vector-set! diff --git a/elpa/auto-complete-20140803.2118/dict/sclang-mode b/elpa/auto-complete-20140803.2118/dict/sclang-mode new file mode 100644 index 000000000..2b92135b6 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/sclang-mode @@ -0,0 +1,1481 @@ +A2K +A2K +abs +absdif +AbstractFunction +AbstractIn +AbstractOut +AbstractServerAction +acos +addition +Adverbs +AllpassC +AllpassL +AllpassN +amclip +AmpComp +AmpComp +AmpCompA +AmpCompA +ampdb +Amplitude +Amplitude +APF +AppClock +Archive +Array +Array2D +ArrayedCollection +asin +Assignment +Association +asTarget +atan +atan2 +AudioControl +AudioIn +audio_rate_mapping +AutoClassHelper +Bag +Balance2 +Balance2 +Ball +Ball +BAllPass +BAllPass +BasicOpUGen +basic_live_coding_techniques +BBandPass +BBandPass +BBandStop +BBandStop +BeatTrack +BeatTrack +BeatTrack +BeatTrack2 +BeatTrack2 +BeatTrack2 +BEQSuite +BEQSuite +BHiPass +BHiPass +BHiPass4 +BHiShelf +BHiShelf +BinaryOpFunction +BinaryOpStream +BinaryOpUGen +BiPanB2 +BiPanB2 +Blip +Blip +BLowPass +BLowPass +BLowPass4 +BLowShelf +BLowShelf +Boolean +BPeakEQ +BPeakEQ +BPF +BPF +BPZ2 +BPZ2 +BRF +BRF +BrownNoise +BrownNoise +BRZ2 +BRZ2 +BufAllpassC +BufAllpassL +BufAllpassN +BufChannels +BufChannels +BufCombC +BufCombL +BufCombN +BufDelayC +BufDelayL +BufDelayN +BufDur +BufDur +Buffer +Buffers +BufFrames +BufFrames +BufRateScale +BufRateScale +BufRd +BufRd +BufSampleRate +BufSampleRate +BufSamples +BufSamples +BufWr +BufWr +bundledCommands +Bus +BusPlug +Busses +Button +CCResponder +ceil +Changed +Changed +ChaosGen +Char +CheckBadValues +Class +Classes +ClassHelpTemplate +ClearBuf +ClientVsServer +Clip +Clip +clip2 +ClipNoise +ClipNoise +Clock +CmdPeriod +cmds +CocoaMenuItem +CoinGate +CoinGate +Collection +Collections +Color +CombC +CombL +CombN +Comments +Compander +Compander +CompanderD +Complex +CompositeView +Condition +ContiguousBlockAllocator +Control +Control-Structures +ControlDur +ControlName +ControlRate +ControlSpec +convertRhythm +Convolution +Convolution2 +Convolution2L +Convolution3 +cos +COsc +COsc +cosh +cpsmidi +cpsoct +Crackle +Crackle +Creating-Standalone-Applications +Crossplatform +CSVFileReader +cubed +CuspL +CuspL +CuspN +CuspN +Date +dbamp +Dbrown +Dbrown +Dbufrd +Dbufrd +Dbufwr +Dbufwr +DC +DC +Debugging-tips +DebugNodeWatcher +Decay +Decay +Decay2 +Decay2 +DecodeB2 +DecodeB2 +default_group +DegreeToKey +DegreeToKey +Delay1 +Delay2 +DelayC +DelayL +DelayN +DelTapRd +DelTapRd +DelTapWr +DelTapWr +Demand +Demand +DemandEnvGen +DemandEnvGen +DemandEnvGen +DetectIndex +DetectIndex +DetectSilence +DetectSilence +DetectSilence +Dgeom +Dgeom +Dialog +Dibrown +Dictionary +difsqr +DiskIn +DiskIn +DiskIn +DiskOut +DiskOut +DiskOut +distort +division +Diwhite +Document +DocumentAutoCompletion +Donce +Done +Done +DoubleArray +Dpoll +Dpoll +DragBoth +DragSink +DragSource +Drand +Drand +Dreset +Dreset +Dseq +Dseq +Dser +Dser +Dseries +Dseries +Dshuf +Dshuf +Dstutter +Dstutter +Dswitch +Dswitch +Dswitch1 +Dswitch1 +DUGen +Dunique +Dust +Dust +Dust2 +Dust2 +Duty +Duty +Dwhite +Dwhite +Dwrand +Dwrand +Dxrand +DynKlang +DynKlang +DynKlank +DynKlank +DynKlank +EmacsEditor +EmacsGUI +Env +EnvelopeView +EnvGate +EnvGen +EnvGen +EnvirGui +Environment +EnvironmentRedirect +Error +Event +EventPatternProxy +EventPatternProxy +EventStream +EventStreamPlayer +Event_types +Exception +excess +exp +exponentiation +ExpRand +ExpRand +ExpRand +Expression-Sequence +EZGui +EZKnob +EZLists +EZListView +EZNumber +EZPopUpMenu +EZRanger +EZScroller +EZSlider +EZText +False +FBSineC +FBSineC +FBSineL +FBSineL +FBSineN +FBSineN +Fdef +FFT +FFTTrigger +File +FileReader +Filter +FilterPattern +FilterPattern +Float +FloatArray +floor +FlowLayout +FlowView +Fold +Fold +fold2 +Font +Formant +Formant +Formlet +Formlet +FOS +FOS +frac +Frame +Free +Free +FreeSelf +FreeSelf +FreeSelfWhenDone +FreeSelfWhenDone +FreeVerb +FreeVerb2 +FreqScope +FreqScopeView +FreqShift +FreqShift +FreqShift +FSinOsc +FSinOsc +FuncFilterPattern +Function +FunctionDef +FunctionList +Functions +Gate +GbmanL +GbmanL +GbmanN +GbmanN +Gendy1 +Gendy1 +Gendy2 +Gendy2 +Gendy3 +Gendy3 +GeneralHID +GeneralHIDDevice +GeneralHIDSlot +GeneralHIDSpec +Glossary +Gradient +GrainBuf +GrainBuf +GrainFM +GrainIn +GrainSin +GrayNoise +GrayNoise +greaterorequalthan +greaterthan +Group +Groups +GUI +gui +GUI-Classes +GUI-Overview +GVerb +Harmonics +Hasher +Hasher +Help +HelpDocsLicensing +Helper +HelpSearchResult +HenonC +HenonC +HenonL +HenonL +HenonN +HenonN +HIDDeviceService +Hilbert +HilbertFIR +HiliteGradient +History +HistoryGui +HLayoutView +How-to-Use-the-Interpreter +HPF +HPF +HPZ1 +HPZ1 +HPZ2 +HPZ2 +hypot +hypotApx +IdentityBag +IdentityDictionary +IdentitySet +IEnvGen +IEnvGen +if +IFFT +Impulse +Impulse +In +Index +Index +IndexInBetween +IndexInBetween +IndexL +IndexL +InFeedback +Infinitum +initClass +InRange +InRange +InRect +InRect +Int16Array +Int32Array +Int8Array +Integer +Integrator +Integrator +Integrator +Internal-Snooping +InterplEnv +InterplPairs +InterplXYC +Interpreter +Interval +InTrig +Intro-to-Objects +Introductory_tutorial +IRand +IRand +IRand +isKindOf +isNegative +isPositive +isStrictlyPositive +JITGui +JITLib +jitlib_asCompileString +jitlib_basic_concepts_01 +jitlib_basic_concepts_02 +jitlib_basic_concepts_03 +jitlib_basic_concepts_04 +jitlib_efficiency +jitlib_fading +jitlib_networking +J_concepts_in_SC +K2A +K2A +KeyState +KeyState +KeyTrack +KeyTrack +Klang +Klang +Klang +Klank +Klank +Klank +Knob +Lag +Lag +Lag2 +Lag2 +Lag2UD +Lag2UD +Lag3 +Lag3 +Lag3UD +Lag3UD +LagControl +LagIn +LagUD +LagUD +LastValue +Latch +Latch +LatoocarfianC +LatoocarfianC +LatoocarfianL +LatoocarfianL +LatoocarfianN +LatoocarfianN +LazyEnvir +LeakDC +LeakDC +LeastChange +LeastChange +lessorequalthan +lessthan +LFClipNoise +LFClipNoise +LFCub +LFCub +LFDClipNoise +LFDClipNoise +LFDNoise0 +LFDNoise0 +LFDNoise1 +LFDNoise1 +LFDNoise3 +LFDNoise3 +LFGauss +LFGauss +LFNoise0 +LFNoise0 +LFNoise1 +LFNoise1 +LFNoise2 +LFNoise2 +LFPar +LFPar +LFPulse +LFPulse +LFSaw +LFSaw +LFTri +LFTri +Library +LibraryBase +Licensing +LID +Limiter +Limiter +LinCongC +LinCongC +LinCongL +LinCongL +LinCongN +LinCongN +Line +Line +Linen +Linen +LinExp +LinExp +LinkedList +LinkedListNode +LinLin +LinLin +LinPan2 +LinPan2 +LinRand +LinRand +LinRand +LinSelectX +Linux_udev_setup +LinXFade2 +LinXFade2 +List +ListComprehensions +ListDUGen +ListPattern +ListPattern +ListView +Literals +LocalBuf +LocalBuf +LocalIn +LocalOut +log +log10 +log2 +Logistic +Logistic +loop +LorenzL +LorenzL +Loudness +Loudness +LPF +LPF +LPZ1 +LPZ1 +LPZ2 +LPZ2 +Magnitude +Main +MantissaMask +MantissaMask +matchItem +max +MaxLocalBufs +MaxLocalBufs +Maybe +Median +Median +Method +Method-Calls +MFCC +MFCC +MidEQ +MidEQ +MIDI +midicps +MIDIIn +MIDIOut +MIDIResponder +min +Mix +modifiers +Modifying_Standalones +modulo +Monitor +MonitorGui +MoogFF +MoogFF +More-On-Getting-Help +MostChange +MostChange +MouseButton +MouseButton +MouseX +MouseX +MouseY +MouseY +MovieView +MulAdd +MultiChannel +MultiLevelIdentityDictionary +MultiOutUGen +multiplication +MultiSliderView +MultiTap +NamedControl +NAryOpFunction +NAryOpStream +Ndef +NdefGui +NdefMixer +NdefMixerOld +NdefParamGui +neg +NetAddr +Nil +Node +NodeControl +NodeEvent +NodeMap +NodeMessaging +NodeProxy +NodeProxyEditor +NodeProxy_roles +NodeWatcher +Non-Realtime-Synthesis +Normalizer +Normalizer +NoteOnResponder +Notes-on-the-HTML-Help-System +NotificationCenter +NRand +NRand +NRand +NumAudioBuses +Number +NumberBox +NumBuffers +NumControlBuses +NumInputBuses +NumOutputBuses +NumRunningSynths +Object +ObjectGui +ObjectTable +octcps +OffsetOut +OnePole +OnePole +OneZero +OneZero +Onsets +Onsets +Operators +Order +Order-of-execution +OrderedIdentitySet +Osc +Osc +OSCBundle +OscN +OscN +OSCpathResponder +OSCresponder +OSCresponderNode +OSC_communication +Out +OutputProxy +PAbstractGroup +PackFFT +Padd +Padd +Paddp +Paddp +Paddpre +Paddpre +Pair +Pan2 +Pan2 +Pan4 +Pan4 +PanAz +PanAz +PanB +PanB +PanB2 +PanB2 +Panner +PartConv +Partial-Application +PathName +Pattern +PatternConductor +PatternProxy +PatternProxy +PatternsDocumentedAndNot +Pause +Pause +PauseSelf +PauseSelf +PauseSelfWhenDone +Pavaroh +Pavaroh +Pbeta +Pbeta +Pbind +Pbind +Pbindef +Pbindef +Pbindf +Pbindf +PbindProxy +PbindProxy +Pbinop +Pbinop +Pbrown +Pbrown +Pbus +Pbus +Pcauchy +Pcauchy +Pchain +Pchain +Pclump +Pclutch +Pclutch +Pcollect +Pcollect +Pconst +Pconst +Pdef +Pdef +PdefAllGui +PdefEditor +PdefGui +Pdefn +Pdefn +PdegreeToKey +PdegreeToKey +Pdfsm +Pdfsm +Pdict +Pdict +Pdiff +Pdrop +PdurStutter +PdurStutter +Peak +Peak +PeakFollower +PeakFollower +Pen +Penvir +Penvir +Pevent +Peventmod +Pexprand +Pexprand +PfadeIn +PfadeOut +Pfin +Pfin +Pfindur +Pfindur +PfinQuant +Pfinval +Pfinval +Pflatten +Pflow +Pflow +Pfpar +Pfset +Pfset +Pfsm +Pfsm +Pfunc +Pfunc +Pfuncn +Pfuncn +Pfx +Pfx +Pfxb +Pfxb +Pgate +Pgate +Pgauss +Pgauss +Pgbrown +Pgbrown +Pgeom +Pgeom +Pget +Pgpar +Pgpar +Pgroup +Pgroup +Pgtpar +PG_01_Introduction +PG_02_Basic_Vocabulary +PG_03_What_Is_Pbind +PG_04_Words_to_Phrases +PG_05_Math_on_Patterns +PG_060_Filter_Patterns +PG_06a_Repetition_Contraint_Patterns +PG_06b_Time_Based_Patterns +PG_06c_Composition_of_Patterns +PG_06d_Parallel_Patterns +PG_06e_Language_Control +PG_06f_Server_Control +PG_06g_Data_Sharing +PG_07_Value_Conversions +PG_08_Event_Types_and_Parameters +PG_Cookbook01_Basic_Sequencing +PG_Cookbook02_Manipulating_Patterns +PG_Cookbook03_External_Control +PG_Cookbook04_Sending_MIDI +PG_Cookbook05_Using_Samples +PG_Cookbook06_Phrase_Network +PG_Cookbook07_Rhythmic_Variations +PG_Ref01_Pattern_Internals +Phasor +Phasor +Phid +Phid +PhidKey +PhidKey +PhidSlot +PhidSlot +Phprand +Phprand +Pif +Pif +Pindex +Pindex +PingPong +PinkerNoise +PinkNoise +PinkNoise +Pipe +Pitch +Pitch +Pitch +PitchShift +PitchShift +Pkey +Pkey +Place +Place +Plag +Plambda +Plambda +Platform +play +PlayBuf +PlayBuf +playN +Plazy +Plazy +PlazyEnvir +PlazyEnvir +PlazyEnvirN +PlazyEnvirN +Plet +plot +Plotter +Plprand +Plprand +Pluck +Pluck +Pmeanrand +Pmeanrand +Pmono +Pmono +PmonoArtic +PmonoArtic +PMOsc +PMOsc +Pmul +Pmul +Pmulp +Pmulp +Pmulpre +Pmulpre +Pn +Pn +Pnaryop +Pnaryop +Pnsym +Pnsym +Pnsym1 +Point +Polar +Poll +Poll +Polymorphism +PopUpMenu +Post +pow +Ppar +Ppar +PparGroup +Ppatlace +Ppatlace +Ppatmod +Ppatmod +Pplayer +Ppoisson +Ppoisson +Pprob +Pprob +Pprotect +Pprotect +Pproto +Pproto +Prand +Prand +Preject +Preject +Prewrite +Prewrite +PriorityQueue +Process +Prorate +Prorate +Prout +Prout +Proutine +Proutine +ProxyMixer +ProxyMixerOld +ProxyMonitorGui +ProxySpace +proxyspace_examples +ProxySynthDef +Pseed +Pseed +Pseg +Pseg +Pselect +Pselect +Pseq +Pseq +Pser +Pser +Pseries +Pseries +Pset +Pset +Psetp +Psetp +Psetpre +Psetpre +Pshuf +Pshuf +PSinGrain +Pslide +Pslide +Pspawn +Pspawn +Pspawner +Pspawner +Pstep +Pstep +Pstep2add +Pstep3add +PstepNadd +PstepNadd +PstepNfunc +PstepNfunc +Pstretch +Pstretchp +Pstutter +Pstutter +Pswitch +Pswitch +Pswitch1 +Pswitch1 +Psym +Psym +Psym1 +Psync +Psync +Ptime +Ptime +Ptpar +Ptpar +Ptrace +Ptsym +Ptuple +Ptuple +publishing_code +Pulse +Pulse +PulseCount +PulseDivider +Punop +Punop +pvcalc +pvcalc2 +pvcollect +PV_Add +PV_BinScramble +PV_BinShift +PV_BinWipe +PV_BrickWall +PV_ChainUGen +PV_ChainUGen +PV_ConformalMap +PV_Conj +PV_Copy +PV_CopyPhase +PV_Diffuser +PV_Div +PV_HainsworthFoote +PV_JensenAndersen +PV_LocalMax +PV_MagAbove +PV_MagBelow +PV_MagClip +PV_MagDiv +PV_MagFreeze +PV_MagMul +PV_MagNoise +PV_MagShift +PV_MagSmear +PV_MagSquared +PV_Max +PV_Min +PV_Mul +PV_PhaseShift +PV_PhaseShift270 +PV_PhaseShift90 +PV_RandComb +PV_RandWipe +PV_RectComb +PV_RectComb2 +Pwalk +Pwalk +Pwhile +Pwhile +Pwhite +Pwhite +Pwrand +Pwrand +Pwrap +Pwrap +Pxrand +Pxrand +QuadC +QuadC +QuadL +QuadL +QuadN +QuadN +Quant +Quark +Quarks +RadiansPerSample +Ramp +Ramp +Rand +Rand +Rand +RandID +RandID +Randomness +randomSeed +RandSeed +RandSeed +RangeSlider +RawArray +RawPointer +reciprocal +RecNodeProxy +RecordBuf +RecordBuf +Rect +recursive_phrasing +Ref +RefCopy +Regenerate-GUI-Help +ReplaceOut +resize +Resonz +Resonz +RHPF +RHPF +ring1 +ring2 +ring3 +ring4 +Ringz +Ringz +RLPF +RLPF +RootNode +Rossler +Rotate2 +Rotate2 +round +Routine +runMe +runMe2 +RunningMax +RunningMax +RunningMin +RunningMin +RunningSum +RunningSum +SampleDur +SampleRate +Saw +Saw +SC2DSlider +SC2DTabletSlider +Scale +scaleneg +SCButton +SCCompositeView +SCContainerView +SCControlView +SCDragBoth +SCDragSink +SCDragSource +SCDragView +SCEnvelopeEdit +SCEnvelopeView +SCFont +SCFreqScope +SCFreqScopeWindow +Scheduler +SCHLayoutView +Schmidt +Schmidt +SCImage +SCImageFilter +SCImageKernel +SCKnob +SCLayoutView +SCLevelIndicator +SCListView +SCMenuGroup +SCMenuItem +SCMenuSeparator +SCModalSheet +SCModalWindow +SCMovieView +SCMultiSliderView +SCNumberBox +Scope +ScopeOut +ScopeOut2 +ScopeView +Score +SCPen +SCPopUpMenu +SCQuartzComposerView +SCRangeSlider +ScrollView +SCScope +SCScrollTopView +SCScrollView +SCSlider +SCSliderBase +SCSoundFileView +SCStaticText +SCStaticTextBase +SCStethoscope +SCTabletView +SCTextField +SCTextView +SCTopView +SCUserView +SCUserView-Subclassing +SCView +SCVLayoutView +SCWindow +Select +Select +SelectX +SelectX +SelectXFocus +SelectXFocus +Semaphore +SendPeakRMS +SendReply +SendTrig +SequenceableCollection +SerialPort +Server +Server-Architecture +Server-Command-Reference +ServerBoot +ServerOptions +ServerQuit +ServerTiming +ServerTree +Set +SetBuf +SetResetFF +Shaper +Shaper +SharedIn +SharedOut +Shortcuts +sign +Signal +Silent +Silent +SimpleController +SimpleNumber +sin +sinh +SinOsc +SinOsc +SinOscFB +SkipJack +Slew +Slew +Slider +Slider2D +Slope +Slope +Slope +softclip +softPut +softSet +softVol_ +somepage +SortedList +SOS +SOS +SoundFile +SoundFileView +SoundFileViewProgressWindow +SoundIn +SparseArray +Spawner +Spec +SpecCentroid +SpecCentroid +SpecFlatness +SpecFlatness +SpecPcile +SpecPcile +Splay +SplayAz +SplayZ +Spring +Spring +sqrdif +sqrsum +sqrt +squared +StandardL +StandardL +StandardN +StandardN +StartUp +StaticText +Stepper +StereoConvolution2L +Stethoscope +Stream +StreamClutch +Streams +Streams-Patterns-Events1 +Streams-Patterns-Events2 +Streams-Patterns-Events3 +Streams-Patterns-Events4 +Streams-Patterns-Events5 +Streams-Patterns-Events6 +Streams-Patterns-Events7 +String +StubTemplate +SubsampleOffset +subtraction +sumsqr +Sweep +switch +Symbol +SymbolArray +SymbolicNotations +SyncSaw +SyncSaw +Syntax-Shortcuts +Synth +Synth-Controlling-UGens +Synth-Definition-File-Format +SynthDef +SynthDesc +SynthDescLib +SystemClock +T2A +T2A +T2K +T2K +TabFileReader +TabletSlider2D +TabletView +tan +tanh +Tap +Tap +Task +TaskProxy +TaskProxy +TaskProxyGui +TBall +TBall +TChoose +Tdef +Tdef +TdefAllGui +TdefEditor +TdefGui +TDelay +TDelay +TDuty +TDuty +TempoBusClock +TempoClock +TExpRand +TExpRand +TextField +TextView +TGrains +TGrains +TGrains +the_lazy_proxy +Thread +thresh +Thunk +Timer +TIRand +TIRand +ToggleFF +TopicHelpTemplate +Tour_of_UGens +TRand +TRand +Trig +Trig1 +TrigControl +True +trunc +Tuning +Tutorial +TWChoose +TWChoose +TWindex +TWindex +TwoPole +TwoPole +TwoWayIdentityDictionary +TwoZero +TwoZero +UGen +UGen-doneActions +UGenHelpTemplate +UGens +UGens-and-Synths +UnaryOpFunction +UnaryOpStream +UnaryOpUGen +Understanding-Errors +Undocumented-Classes +UniqueID +UnixFILE +Unpack1FFT +UnpackFFT +UserView +Using-Extensions +Using-the-Startup-File +UsingMIDI +VarLag +VarSaw +VarSaw +VDiskIn +VDiskIn +VDiskIn +Vibrato +View +ViewRedirect +VLayoutView +Volume +VOsc +VOsc +VOsc3 +VOsc3 +Warp +Warp1 +Warp1 +Warp1 +Wavetable +WhiteNoise +WhiteNoise +WidthFirstUGen +WiiMote +WikiUsage +Window +Wrap +Wrap +wrap2 +WrapIndex +WrapIndex +Writing-Classes +Writing_Unit_Generators +XFade +XFade2 +XFade2 +XLine +XLine +XOut +ZeroCrossing +ZeroCrossing diff --git a/elpa/auto-complete-20140803.2118/dict/sh-mode b/elpa/auto-complete-20140803.2118/dict/sh-mode new file mode 100644 index 000000000..df66ae35c --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/sh-mode @@ -0,0 +1,182 @@ +# Bash Family Shell Dictionary +# http://www.gnu.org/software/bash/manual/bash.html + +. +: +[ +alias +bg +bind +break +builtin +caller +cd +command +compgen +complete +compopt +continue +declare +dirs +disown +echo +enable +eval +exec +exit +export +fc +fg +getopts +hash +help +history +jobs +kill +let +local +logout +mapfile +popd +printf +pushd +pwd +read +readarray +readonly +return +set +shift +shopt +source +suspend +test +times +trap +type +typeset +ulimit +umask +unalias +unset +wait +! +[[ +]] +case +do +done +elif +else +esac +fi +for +function +if +in +select +then +time +until +while +{ +} +! +# +$ +* +- +0 +? +@ +_ +BASH +BASH_ALIASES +BASH_ARGC +BASH_ARGV +BASH_CMDS +BASH_COMMAND +BASH_ENV +BASH_EXECUTION_STRING +BASH_LINENO +BASH_REMATCH +BASH_SOURCE +BASH_SUBSHELL +BASH_VERSINFO +BASH_VERSION +BASH_XTRACEFD +BASHOPTS +BASHPID +CDPATH +COLUMNS +COMP_CWORD +COMP_KEY +COMP_LINE +COMP_POINT +COMP_TYPE +COMP_WORDBREAKS +COMP_WORDS +COMPREPLY +DIRSTACK +EMACS +EUID +FCEDIT +FIGNORE +FUNCNAME +GLOBIGNORE +GROUPS +HISTCMD +HISTCONTROL +HISTFILE +HISTFILESIZE +HISTIGNORE +HISTSIZE +HISTTIMEFORMAT +HOME +HOSTFILE +HOSTNAME +HOSTTYPE +IFS +IGNOREEOF +INPUTRC +LANG +LC_ALL +LC_COLLATE +LC_CTYPE +LC_MESSAGES +LC_MESSAGES +LC_NUMERIC +LINENO +LINES +MACHTYPE +MAIL +MAILCHECK +MAILPATH +OLDPWD +OPTARG +OPTERR +OPTIND +OSTYPE +PATH +PIPESTATUS +POSIXLY_CORRECT +PPID +PROMPT_COMMAND +PROMPT_DIRTRIM +PS1 +PS2 +PS3 +PS4 +PWD +RANDOM +REPLY +SECONDS +SHELL +SHELLOPTS +SHLVL +TEXTDOMAIN +TEXTDOMAINDIR +TIMEFORMAT +TMOUT +TMPDIR +UID diff --git a/elpa/auto-complete-20140803.2118/dict/tcl-mode b/elpa/auto-complete-20140803.2118/dict/tcl-mode new file mode 100644 index 000000000..07a128151 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/tcl-mode @@ -0,0 +1,172 @@ +after +append +apply +array +auto_execok +auto_import +auto_load +auto_load_index +auto_mkindex +auto_mkindex_old +auto_qualify +auto_reset +bell +binary +bind +bindtags +break +button +canvas +case +catch +cd +chan +checkbutton +clipboard +clock +close +concat +continue +destroy +dict +encoding +entry +eof +error +eval +event +exec +exit +expr +fblocked +fconfigure +fcopy +file +fileevent +flush +focus +font +for +foreach +format +frame +gets +glob +global +grab +grid +if +image +incr +info +interp +join +label +labelframe +lappend +lassign +lindex +linsert +list +listbox +llength +load +lower +lrange +lrepeat +lreplace +lreverse +lsearch +lset +lsort +menu +menubutton +message +namespace +open +option +pack +package +panedwindow +pid +pkg_mkIndex +place +proc +puts +pwd +radiobutton +raise +read +regexp +registry +regsub +rename +return +scale +scan +scrollbar +seek +selection +set +socket +source +spinbox +split +string +subst +switch +tclLog +tclPkgSetup +tclPkgUnknown +tcl_findLibrary +tell +text +time +tk +tk_chooseColor +tk_chooseDirectory +tk_getOpenFile +tk_getSaveFile +tk_menuSetFocus +tk_messageBox +tk_popup +tk_textCopy +tk_textCut +tk_textPaste +tkwait +toplevel +ttk::button +ttk::checkbutton +ttk::combobox +ttk::entry +ttk::focusFirst +ttk::frame +ttk::label +ttk::labelframe +ttk::menubutton +ttk::notebook +ttk::paned +ttk::panedwindow +ttk::progressbar +ttk::radiobutton +ttk::scale +ttk::scrollbar +ttk::separator +ttk::setTheme +ttk::sizegrip +ttk::style +ttk::takefocus +ttk::themes +ttk::treeview +trace +unknown +unload +unset +update +uplevel +upvar +variable +vwait +while +winfo +wm diff --git a/elpa/auto-complete-20140803.2118/dict/ts-mode b/elpa/auto-complete-20140803.2118/dict/ts-mode new file mode 100644 index 000000000..ffe377f98 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/ts-mode @@ -0,0 +1,797 @@ +absRefPrefix +accessibility +accessibilityWrap +accessKey +ACT +ACTIFSUB +ACTIVSUBRO +ACTRO +addAttributes +addExtUrlsAndShortCuts +additionalHeaders +additionalParams +addParams +addQueryString +addQueryString +adjustItemsH +adjustSubItemsH +adminPanelStyles +after +age +align +align.field +all +allowedAttribs +allowedGroups +allowEdit +allowNew +allowTags +allStdWrap +allWrap +alternativeSortingField +alternativeTempPath +altImgResource +altTarget +altText +alwaysActivePIDlist +alwaysLink +andWhere +angle +antiAlias +append +applyTotalH +applyTotalW +arrayReturnMode +arrowACT +arrowImgParams +arrowNO +ATagBeforeWrap +ATagParams +ATagTitle +atLeast +atMost +authcodeFields +autoInsertPID +autostart +backColor +badMess +base64 +baseURL +beforeImg +beforeImgLink +beforeImgTagParams +beforeROImg +beforeWrap +begin +begin +beginAtLevel +beLoginLinkIPList +beLoginLinkIPList_login +beLoginLinkIPList_logout +beUserLogin +bgImg +blankStrEqFalse +blur +bm +bodyTag +bodyTag +bodyTagAdd +bodyTagCObject +bodyTagMargins +border +border +borderCol +bordersWithin +borderThick +bottomContent +bottomHeight +br +breakSpace +breakWidth +brTag +bytes +c +cache_clearAtMidnight +cached +cache_period +caption +captionAlign +captionSplit +case +case +CASE +casesensitiveComp +cellpadding +cellspacing +char +charcoal +clearCacheOfPages +cMargins +COA +COA_INT +cObject +cObjNum +code +collapse +color +color1 +color2 +color3 +color.default +color.field +colRelations +cols +cols +colSpace +COLUMNS +COMMENT +commentWrap +compensateFieldWidth +compX +compY +concatenateJsAndCss +conf +config +config +CONFIG +constants +CONTENT +content_fallback +content_from_pid_allowOutsideDomain +controllerActionName +controllerExtensionName +controllerName +crop +cropHTML +csConv +cssInline +CSS_inlineStyle +CTABLE +CUR +CURIFSUB +CURIFSUBRO +current +CURRO +cWidth +data +dataArray +dataWrap +date +debug +debugData +debugFunc +debugItemConf +debugRenumberedObject +decimals +dec_point +default +defaultAlign +defaultCmd +defaultCode +defaultGetVars +delete +denyTags +depth +dimensions +directImageLink +directionLeft +directionUp +directReturn +disableAllHeaderCode +disableAltText +disableCharsetHeader +disableImgBorderAttr +disablePageExternalUrl +disablePrefixComment +disablePreviewNotification +displayActiveOnLoad +displayActiveOnLoad +displayrecord +distributeX +distributeY +doctype +doctypeSwitch +doNotLinkIt +doNotShowLink +doNotStripHTML +dontCheckPid +dontFollowMouse +dontHideOnMouseUp +dontLinkIfSubmenu +dontMd5FieldNames +dontWrapInTable +doubleBrTag +doublePostCheck +dWorkArea +edge +edit +editIcons +editIcons +editPanel +EDITPANEL +EDITPANEL +effects +email +emailMess +emboss +emptyTitleHandling +emptyTitleHandling +emptyTitleHandling +enable +enableContentLengthHeader +encapsLines +encapsLinesStdWrap +encapsTagList +entryLevel +equalH +equals +evalErrors +evalFunc +excludeDoktypes +excludeNoSearchPages +excludeUidList +expAll +explode +ext +extbase +externalBlocks +extOnReady +extTarget +face.default +face.field +FEData +fe_userEditSelf +fe_userOwnSelf +field +fieldPrefix +fieldRequired +fieldWrap +file +FILE +filelink +fileList +fileTarget +firstLabel +firstLabelGeneral +flip +flop +foldSpeed +foldTimer +fontFile +fontSize +fontSizeMultiplicator +fontTag +footerData +forceAbsoluteUrl +forceTypeValue +FORM +format +formName +formurl +frame +frameReloadIfNotInFrameset +frameSet +freezeMouseover +ftu +gamma +gapBgCol +gapLineCol +gapLineThickness +gapWidth +gif +GIFBUILDER +globalNesting +GMENU +goodMess +gray +gr_list +groupBy +headerComment +headerData +headTag +height +hiddenFields +hide +hideButCreateMap +hideMenuTimer +hideMenuWhenNotOver +hideNonTranslated +highColor +HMENU +hover +hoverStyle +HRULER +HTML +html5 +htmlmail +HTMLparser +htmlSpecialChars +htmlTag_dir +htmlTag_langKey +htmlTag_setParams +http +icon +iconCObject +icon_image_ext_list +icon_link +icon_thumbSize +if +ifBlank +ifEmpty +IFSUB +IFSUBRO +ignore +IMAGE +image_compression +image_effects +image_frames +imgList +imgMap +imgMapExtras +imgMax +imgNameNotRandom +imgNamePrefix +imgObjNum +imgParams +imgPath +imgStart +IMGTEXT +import +inBranch +includeCSS +includeJS +includeJSFooter +includeJSFooterlibs +includeJSlibs +includeLibrary +includeLibs +includeNotInMenu +incT3Lib_htmlmail +index_descrLgd +index_enable +index_externals +index_metatags +infomail +inlineJS +inlineLanguageLabel +inlineSettings +inlineStyle2TempFile +innerStdWrap_all +innerWrap +innerWrap2 +inputLevels +insertClassesFromRTE +insertData +intensity +intTarget +intval +invert +IProcFunc +isFalse +isGreaterThan +isInList +isLessThan +isPositive +isTrue +itemArrayProcFunc +items +iterations +javascriptLibs +join +jpg +jsFooterInline +jsInline +JSMENU +JSwindow +JSwindow.altUrl +JSwindow.altUrl_noDefaultParams +JSwindow.expand +JSwindow.newWindow +JSwindow_params +jumpurl +jumpurl_enable +jumpurl_mailto_disable +keep +keepNonMatchedTags +keywords +keywordsField +labelStdWrap +labelWrap +lang +language +language_alt +languageField +layer_menu_id +layerStyle +layout +layoutRootPath +leftjoin +leftOffset +levels +limit +lineColor +lineThickness +linkAccessRestrictedPages +linkParams +linkVars +linkWrap +list +listNum +lm +LOAD_REGISTER +locale_all +localNesting +locationData +lockFilePath +lockPosition +lockPosition_addSelf +lockPosition_adjust +loginUser +longdescURL +loop +lowColor +lower +mailto +main +mainScript +makelinks +markers +markerWrap +mask +max +maxAge +maxH +maxHeight +maxItems +maxW +maxWidth +maxWInText +m.bgImg +m.bottomImg +m.bottomImg_mask +md5 +meaningfulTempFilePrefix +menuBackColor +menuHeight +menuOffset +menuWidth +message_page_is_being_generated +message_preview +message_preview_workspace +meta +metaCharset +method +minH +minifyCSS +minifyJS +minItems +minItems +minW +m.mask +moveJsFromHeaderToFooter +MP_defaults +MP_disableTypolinkClosestMPvalue +MP_mapRootPoints +MULTIMEDIA +name +namespaces +negate +newRecordFromTable +newRecordInPid +next +niceText +NO +noAttrib +noBlur +no_cache +noCols +noLink +noLinkUnderline +nonCachedSubst +none +nonTypoTagStdWrap +nonTypoTagUserFunc +nonWrappedTag +noOrderBy +noPageTitle +noResultObj +normalWhenNoLanguage +noRows +noScale +noScaleUp +noscript +noStretchAndMarginCells +notification_email_charset +notification_email_encoding +notification_email_urlmode +noTrimWrap +noValueInsert +noWrapAttr +numberFormat +numRows +obj +offset +offset +_offset +offsetWrap +onlyCurrentPid +opacity +options +orderBy +OTABLE +outerWrap +outline +output +outputLevels +override +overrideAttribs +overrideEdit +overrideId +PAGE +pageGenScript +pageRendererTemplateFile +pageTitleFirst +parameter +params +parseFunc +parseFunc +parseValues +partialRootPath +path +pidInList +pixelSpaceFontSizeRef +plainTextStdWrap +pluginNames +png +postCObject +postUserFunc +postUserFunkInt +preCObject +prefixComment +prefixLocalAnchors +prefixLocalAnchors +prefixRelPathWith +preIfEmptyListNum +prepend +preUserFunc +prev +previewBorder +printBeforeContent +prioriCalc +processScript +properties +protect +protectLvar +quality +quality +radioInputWrap +radioWrap +range +range +rawUrlEncode +recipient +RECORDS +recursive +redirect +reduceColors +relativeToParentLayer +relativeToTriggerItem +relPathPrefix +remap +remapTag +removeBadHTML +removeDefaultJS +removeIfEquals +removeIfFalse +removeObjectsOfDummy +removePrependedNumbers +removeTags +removeWrapping +renderCharset +renderObj +renderWrap +REQ +required +required +resources +resultObj +returnKey +returnLast +reverseOrder +rightjoin +rm +rmTagIfNoAttrib +RO_chBgColor +rootline +rotate +rows +rowSpace +sample +sample +section +sectionIndex +select +sendCacheHeaders +sendCacheHeaders_onlyWhenLoginDeniedInBranch +separator +setContentToCurrent +setCurrent +setfixed +setFixedHeight +setFixedWidth +setJS_mouseOver +setJS_openPic +setKeywords +shadow +sharpen +shear +short +shortcutIcon +showAccessRestrictedPages +showActive +showFirst +simulateStaticDocuments +simulateStaticDocuments_addTitle +simulateStaticDocuments_dontRedirectPathInfoError +simulateStaticDocuments_noTypeIfNoTitle +simulateStaticDocuments_pEnc +simulateStaticDocuments_pEnc_onlyP +simulateStaticDocuments_replacementChar +sitetitle +size +size.default +size.field +slide +smallFormFields +solarize +source +space +spaceAfter +spaceBefore +spaceBelowAbove +spaceLeft +spaceRight +spacing +spamProtectEmailAddresses +spamProtectEmailAddresses_atSubst +spamProtectEmailAddresses_lastDotSubst +SPC +special +split +splitRendering +src +stat +stat_apache +stat_apache_logfile +stat_apache_niceTitle +stat_apache_noHost +stat_apache_noRoot +stat_apache_notExtended +stat_apache_pagenames +stat_excludeBEuserHits +stat_excludeIPList +stat_mysql +stat_pageLen +stat_titleLen +stat_typeNumList +stayFolded +stdWrap +stdWrap2 +strftime +stripHtml +stripProfile +stylesheet +submenuObjSuffixes +subMenuOffset +subparts +subst_elementUid +subst_elementUid +substMarksSeparately +substring +swirl +sword +sword_noMixedCase +sword_standAlone +sys_language_mode +sys_language_overlay +sys_language_softExclude +sys_language_softMergeIfNotBlank +sys_language_uid +sys_page +table +tableParams +tables +tableStdWrap +tableStyle +tags +target +TCAselectItem +TDparams +template +TEMPLATE +templateFile +text +TEXT +textMargin +textMargin_outOfText +textMaxLength +textObjNum +textPos +textStyle +thickness +thousands_sep +title +titleTagFunction +titleText +titleText +tm +TMENU +token +topOffset +totalWidth +transparentBackground +transparentColor +trim +twice +typeNum +types +typolink +typolinkCheckRootline +typolinkEnableLinksAcrossDomains +typolinkLinkAccessRestrictedPages +typolinkLinkAccessRestrictedPages_addParams +uid +uidInList +uniqueGlobal +uniqueLinkVars +uniqueLocal +unset +unsetEmpty +upper +url +useCacheHash +useLargestItemX +useLargestItemY +USER +USERDEF1 +USERDEF1RO +USERDEF2RO +USERFEF2 +userFunc +userFunc_updateArray +userIdColumn +USER_INT +USERNAME_substToken +USERUID_substToken +USR +USRRO +value +variables +wave +where +width +wordSpacing +workArea +workOnSubpart +wrap +wrap2 +wrap3 +wrapAlign +wrapFieldName +wrapItemAndSub +wrapNoWrappedLines +wraps +xhtml_11 +xhtml_2 +xhtml_basic +xhtml_cleaning +xhtmlDoctype +xhtml_frames +xhtml+rdfa_10 +xhtml_strict +xhtml_trans +xml_10 +xml_11 +xmlprologue +xPosOffset +yPosOffset diff --git a/elpa/auto-complete-20140803.2118/dict/tuareg-mode b/elpa/auto-complete-20140803.2118/dict/tuareg-mode new file mode 100644 index 000000000..e709f9f62 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/tuareg-mode @@ -0,0 +1,231 @@ +# OCaml 3.12.1 + +# Keywords +and +as +assert +begin +class +constraint +do +done +downto +else +end +exception +external +false +for +fun +function +functor +if +in +include +inherit +initializer +lazy +let +match +method +module +mutable +new +object +of +open +or +private +rec +sig +struct +then +to +true +try +type +val +virtual +when +while +with + +# Pervasives +! +!= +& +&& +* +** +*. ++ ++. +- +-. +/ +/. +:= +< +<= +<> += +== +> +>= +@ +FP_infinite +FP_nan +FP_normal +FP_subnormal +FP_zero +LargeFile +Open_append +Open_binary +Open_creat +Open_nonblock +Open_rdonly +Open_text +Open_trunc +Open_wronly +Oupen_excl +^ +^^ +abs +abs_float +acos +asin +asr +at_exit +atan +atan2 +bool_of_string +ceil +char_of_int +classify_float +close_in +close_in_noerr +close_out +close_out_noerr +compare +cos +cosh +decr +do_at_exit +epsilon_float +exit +exp +expm1 +failwith +float +float_of_int +float_of_string +floor +flush +flush_all +format +format4 +format_of_string +fpclass +frexp +fst +ignore +in_channel +in_channel_length +incr +infinity +input +input_binary_int +input_byte +input_char +input_line +input_value +int_of_char +int_of_float +int_of_string +invalid_arg +land +ldexp +lnot +log +log10 +log1p +lor +lsl +lsr +lxor +max +max_float +max_int +min +min_float +min_int +mod +mod_float +modf +nan +neg_infinity +not +open_flag +open_in +open_in_bin +open_in_gen +open_out +open_out_bin +open_out_gen +or +out_channel +out_channel_length +output +output_binary_int +output_byte +output_char +output_string +output_value +pos_in +pos_out +pred +prerr_char +prerr_endline +prerr_float +prerr_int +prerr_newline +prerr_string +print_char +print_endline +print_float +print_int +print_newline +print_string +raise +read_float +read_int +read_line +really_input +ref +seek_in +seek_out +set_binary_mode_in +set_binary_mode_out +sin +sinh +snd +sqrt +stderr +stdin +stdout +string_of_bool +string_of_float +string_of_format +string_of_int +succ +tan +tanh +truncate +unsafe_really_input +valid_float_lexem +|| +~ +~+ +~+. +~- +~-. diff --git a/elpa/auto-complete-20140803.2118/dict/verilog-mode b/elpa/auto-complete-20140803.2118/dict/verilog-mode new file mode 100644 index 000000000..acc2f3228 --- /dev/null +++ b/elpa/auto-complete-20140803.2118/dict/verilog-mode @@ -0,0 +1,313 @@ +`define +`else +`endif +`ifdef +`ifndef +`macromodule +`module +`primitive +`timescale +above +abs +absdelay +ac_stim +acos +acosh +alias +aliasparam +always +always_comb +always_ff +always_latch +analog +analysis +and +asin +asinh +assert +assign +assume +atan +atan2 +atanh +automatic +before +begin +bind +bins +binsof +bit +branch +break +buf +bufif0 +bufif1 +byte +case +casex +casez +cell +chandle +class +clocking +cmos +config +connectmodule +connectrules +const +constraint +context +continue +cos +cosh +cover +covergroup +coverpoint +cross +ddt +ddx +deassign +default +define +defparam +design +disable +discipline +dist +do +driver_update +edge +else +end +endcase +endclass +endclocking +endconfig +endconnectrules +enddiscipline +endfunction +endgenerate +endgroup +endif +endinterface +endmodule +endnature +endpackage +endparamset +endprimitive +endprogram +endproperty +endsequence +endspecify +endtable +endtask +enum +event +exclude +exp +expect +export +extends +extern +final +final_step +first_match +flicker_noise +floor +flow +for +force +foreach +forever +fork +forkjoin +from +function +generate +genvar +ground +highz0 +highz1 +hypot +idt +idtmod +if +ifdef +iff +ifndef +ifnone +ignore_bins +illegal_bins +import +incdir +include +inf +initial +initial_step +inout +input +inside +instance +int +integer +interface +intersect +join +join_any +join_none +laplace_nd +laplace_np +laplace_zd +laplace_zp +large +last_crossing +liblist +library +limexp +ln +local +localparam +log +logic +longint +macromodule +mailbox +matches +max +medium +min +modport +module +nand +nand +nature +negedge +net_resolution +new +nmos +nmos +noise_table +nor +noshowcancelled +not +notif0 +notif1 +null +or +output +package +packed +parameter +paramset +pmos +pmos +posedge +potential +pow +primitive +priority +program +property +protected +pull0 +pull1 +pullup +pulsestyle_ondetect +pulsestyle_onevent +pure +rand +randc +randcase +randcase +randsequence +rcmos +real +realtime +ref +reg +release +repeat +return +rnmos +rpmos +rtran +rtranif0 +rtranif1 +scalared +semaphore +sequence +shortint +shortreal +showcancelled +signed +sin +sinh +slew +small +solve +specify +specparam +sqrt +static +string +strong0 +strong1 +struct +super +supply +supply0 +supply1 +table +tagged +tan +tanh +task +then +this +throughout +time +timeprecision +timer +timescale +timeunit +tran +tran +tranif0 +tranif1 +transition +tri +tri +tri0 +tri1 +triand +trior +trireg +type +typedef +union +unique +unsigned +use +uwire +var +vectored +virtual +void +wait +wait_order +wand +weak0 +weak1 +while +white_noise +wildcard +wire +with +within +wor +wreal +xnor +xor +zi_nd +zi_np +zi_zd diff --git a/elpa/cider-0.7.0/cider-autoloads.el b/elpa/cider-0.7.0/cider-autoloads.el new file mode 100644 index 000000000..bfa78b708 --- /dev/null +++ b/elpa/cider-0.7.0/cider-autoloads.el @@ -0,0 +1,128 @@ +;;; cider-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (cider-connect cider-jack-in cider-version) "cider" +;;;;;; "cider.el" (21478 17731 0 0)) +;;; Generated autoloads from cider.el + +(autoload 'cider-version "cider" "\ +Display CIDER's version. + +\(fn)" t nil) + +(autoload 'cider-jack-in "cider" "\ +Start a nREPL server for the current project and connect to it. +If PROMPT-PROJECT is t, then prompt for the project for which to +start the server. + +\(fn &optional PROMPT-PROJECT)" t nil) + +(autoload 'cider-connect "cider" "\ +Connect to an nREPL server identified by HOST and PORT. + +\(fn HOST PORT)" t nil) + +(eval-after-load 'clojure-mode '(progn (define-key clojure-mode-map (kbd "C-c M-j") 'cider-jack-in) (define-key clojure-mode-map (kbd "C-c M-c") 'cider-connect))) + +;;;*** + +;;;### (autoloads (cider-inspect) "cider-inspector" "cider-inspector.el" +;;;;;; (21478 17731 0 0)) +;;; Generated autoloads from cider-inspector.el + +(autoload 'cider-inspect "cider-inspector" "\ +Eval the string EXPRESSION and inspect the result. + +\(fn EXPRESSION)" t nil) + +;;;*** + +;;;### (autoloads (cider-macroexpand-all cider-macroexpand-1) "cider-macroexpansion" +;;;;;; "cider-macroexpansion.el" (21478 17731 0 0)) +;;; Generated autoloads from cider-macroexpansion.el + +(autoload 'cider-macroexpand-1 "cider-macroexpansion" "\ +Invoke 'macroexpand-1' on the expression preceding point. +If invoked with a PREFIX argument, use 'macroexpand' instead of +'macroexpand-1'. + +\(fn &optional PREFIX)" t nil) + +(autoload 'cider-macroexpand-all "cider-macroexpansion" "\ +Invoke 'clojure.walk/macroexpand-all' on the expression preceding point. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (cider-mode cider-mode-line) "cider-mode" "cider-mode.el" +;;;;;; (21478 17732 0 0)) +;;; Generated autoloads from cider-mode.el + +(defvar cider-mode-line '(" cider" (:eval (format "[%s]" (cider-current-ns)))) "\ +Mode line ligher for `cider-mode'. + +The value of this variable is a mode line template as in +`mode-line-format'. See Info Node `(elisp)Mode Line Format' for +details about mode line templates. + +Customize this variable to change how `cider-mode' displays its +status in the mode line. The default value displays the current ns. +Set this variable to nil to disable the mode line +entirely.") + +(custom-autoload 'cider-mode-line "cider-mode" t) + +(autoload 'cider-mode "cider-mode" "\ +Minor mode for REPL interaction from a Clojure buffer. + +\\{cider-mode-map} + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads (cider-scratch) "cider-scratch" "cider-scratch.el" +;;;;;; (21478 17731 0 0)) +;;; Generated autoloads from cider-scratch.el + +(autoload 'cider-scratch "cider-scratch" "\ +Create a scratch buffer. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (cider-selector) "cider-selector" "cider-selector.el" +;;;;;; (21478 17731 0 0)) +;;; Generated autoloads from cider-selector.el + +(autoload 'cider-selector "cider-selector" "\ +Select a new buffer by type, indicated by a single character. +The user is prompted for a single character indicating the method by +which to choose a new buffer. The `?' character describes then +available methods. OTHER-WINDOW provides an optional target. + +See `def-cider-selector-method' for defining new methods. + +\(fn &optional OTHER-WINDOW)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("cider-client.el" "cider-doc.el" "cider-eldoc.el" +;;;;;; "cider-interaction.el" "cider-pkg.el" "cider-repl.el" "cider-stacktrace.el" +;;;;;; "cider-test.el" "cider-util.el" "nrepl-client.el") (21478 +;;;;;; 17732 311672 0)) + +;;;*** + +(provide 'cider-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; cider-autoloads.el ends here diff --git a/elpa/cider-0.7.0/cider-client.el b/elpa/cider-0.7.0/cider-client.el new file mode 100644 index 000000000..d8176311a --- /dev/null +++ b/elpa/cider-0.7.0/cider-client.el @@ -0,0 +1,235 @@ +;;; cider-client.el --- A layer of abstraction above the actual client code. -*- lexical-binding: t -*- + +;; Copyright © 2013-2014 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; A layer of abstraction above the actual client code. + +;;; Code: + +(require 'nrepl-client) + +;;; Words of inspiration +(defun cider-user-first-name () + "Find the current user's first name." + (let ((name (if (string= (user-full-name) "") + (user-login-name) + (user-full-name)))) + (string-match "^[^ ]*" name) + (capitalize (match-string 0 name)))) + +(defvar cider-words-of-inspiration + `("The best way to predict the future is to invent it. -Alan Kay" + "A point of view is worth 80 IQ points. -Alan Kay" + "Lisp isn't a language, it's a building material. -Alan Kay" + "Simple things should be simple, complex things should be possible. -Alan Kay" + "Measuring programming progress by lines of code is like measuring aircraft building progress by weight. -Bill Gates" + "Controlling complexity is the essence of computer programming. -Brian Kernighan" + "The unavoidable price of reliability is simplicity. -C.A.R. Hoare" + "You're bound to be unhappy if you optimize everything. -Donald Knuth" + "Simplicity is prerequisite for reliability. -Edsger W. Dijkstra" + "Deleted code is debugged code. -Jeff Sickel" + "The key to performance is elegance, not battalions of special cases. -Jon Bentley and Doug McIlroy" + "First, solve the problem. Then, write the code. -John Johnson" + "Simplicity is the ultimate sophistication. -Leonardo da Vinci" + "Programming is not about typing... it's about thinking. -Rich Hickey" + "Design is about pulling things apart. -Rich Hickey" + "Programmers know the benefits of everything and the tradeoffs of nothing. -Rich Hickey" + "Code never lies, comments sometimes do. -Ron Jeffries" + "The true delight is in the finding out rather than in the knowing. -Isaac Asimov" + "If paredit is not for you, then you need to become the sort of person that paredit is for. -Phil Hagelberg" + "Take this REPL, fellow hacker, and may it serve you well." + "Let the hacking commence!" + "Hacks and glory await!" + "Hack and be merry!" + "Your hacking starts... NOW!" + "May the Source be with you!" + "May the Source shine upon thy REPL!" + "Code long and prosper!" + "Happy hacking!" + "nREPL server is up, CIDER REPL is online!" + "CIDER REPL operational!" + "Your imagination is the only limit to what you can do with this REPL!" + "This REPL is yours to command!" + "Fame is but a hack away!" + ,(format "%s, this could be the start of a beautiful program." + (cider-user-first-name))) + "Scientifically-proven optimal words of hackerish encouragement.") + +(defun cider-random-words-of-inspiration () + "Select a random entry from `cider-words-of-inspiration'." + (eval (nth (random (length cider-words-of-inspiration)) + cider-words-of-inspiration))) + +(defun cider-display-connected-message () + "Message displayed on successful connection." + (message "Connected. %s" (cider-random-words-of-inspiration))) + +(add-hook 'nrepl-connected-hook 'cider-display-connected-message) + +;;; Evaluation helpers +(defun cider-ns-form-p (form) + "Check if FORM is an ns form." + (string-match "^[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)" form)) + +(defun cider-eval (input callback &optional ns session) + "Send the request INPUT and register the CALLBACK as the response handler. +NS & SESSION specify the context in which to evaluate the request." + ;; namespace forms are always evaluated in the "user" namespace + (let ((ns (if (cider-ns-form-p input) + "user" + ns))) + ;; prevent forms from being evaluated in the wrong or a non-existing namespace + (when (and ns + (derived-mode-p 'clojure-mode) + (not (string= ns nrepl-buffer-ns)) + (not (cider-ns-form-p input))) + (cider-eval-ns-form)) + (nrepl-send-string input callback ns session))) + +(defun cider-tooling-eval (input callback &optional ns) + "Send the request INPUT and register the CALLBACK as the response handler. +NS specifies the namespace in which to evaluate the request." + ;; namespace forms are always evaluated in the "user" namespace + (cider-eval input callback ns (nrepl-current-tooling-session))) + +(defun cider-eval-sync (input &optional ns session) + "Send the INPUT to the nREPL server synchronously. +NS & SESSION specify the evaluation context." + (nrepl-send-string-sync input ns session)) + +(defun cider-eval-and-get-value (input &optional ns session) + "Send the INPUT to the nREPL server synchronously and return the value. +NS & SESSION specify the evaluation context." + (cider-get-value (cider-eval-sync input ns session))) + +(defun cider-tooling-eval-sync (input &optional ns) + "Send the INPUT to the nREPL server using a tooling session synchronously. +NS specifies the namespace in which to evaluate the request." + (cider-eval-sync input ns (nrepl-current-tooling-session))) + +(defun cider-get-raw-value (eval-result) + "Get the raw value (as string) from EVAL-RESULT." + (plist-get eval-result :value)) + +(defun cider-get-value (eval-result) + "Get the value from EVAL-RESULT." + (read (cider-get-raw-value eval-result))) + +(defun cider-send-op (op attributes handler) + "Send the specified OP with ATTRIBUTES and response HANDLER." + (nrepl-send-request (append + (list "op" op + "session" (nrepl-current-session) + "ns" nrepl-buffer-ns) + attributes) + handler)) + +(defun cider-send-load-file (file-contents file-path file-name) + "Perform the nREPL \"load-file\" op. +FILE-CONTENTS, FILE-PATH and FILE-NAME are details of the file to be +loaded." + (let ((buffer (current-buffer))) + (nrepl-send-request (list "op" "load-file" + "session" (nrepl-current-session) + "file" file-contents + "file-path" file-path + "file-name" file-name) + (cider-load-file-handler buffer)))) + +(defun cider-interrupt () + "Interrupt any pending evaluations." + (interactive) + (let ((pending-request-ids (cider-util--hash-keys nrepl-pending-requests))) + (dolist (request-id pending-request-ids) + (nrepl-send-interrupt request-id (cider-interrupt-handler (current-buffer)))))) + +(defun cider-current-repl-buffer () + "The current REPL buffer." + (when (nrepl-current-connection-buffer) + (buffer-local-value 'nrepl-repl-buffer + (get-buffer (nrepl-current-connection-buffer))))) + +(defun cider--dict-to-alist (val) + "Transforms a nREPL bdecoded dict VAL into an alist. +Simply returns it if it's not a dict." + (if (and (listp val) + (eq (car val) 'dict)) + (-map '-cons-to-list (cdr val)) + val)) + +(defun cider--dict-to-plist (val) + "Transforms a nREPL bdecoded dict VAL into a plist with symbol keys. +Simply returns it if it's not a dict." + (if (and (listp val) + (eq (car val) 'dict)) + (-interleave (-map 'intern (-map 'car (cdr val))) + (-map 'cdr (cdr val))) + val)) + +(defun cider--var-choice (var-info) + "Prompt to choose from among multiple VAR-INFO candidates, if required. +This is needed only when the symbol queried is an unqualified host platform +method, and multiple classes have a so-named member. If VAR-INFO does not +contain a `candidates' key, it is returned as is." + (let ((candidates (cdadr (assoc "candidates" var-info)))) + (if candidates + (let* ((classes (mapcar (lambda (x) (cdr (assoc "class" x))) candidates)) + (choice (completing-read "Member in class: " classes nil t)) + (info (cdr (assoc choice candidates)))) + (cider--dict-to-alist info)) + var-info))) + +(defun cider-var-info (var &optional all) + "Return VAR's info as an alist with list cdrs. + +When multiple matching vars are returned you'll be prompted to select one, +unless ALL is truthy." + (when (and var (not (string= var ""))) + (let ((val (plist-get (nrepl-send-request-sync + (list "op" "info" + "session" (nrepl-current-session) + "ns" (cider-current-ns) + "symbol" var)) + :value))) + (if all + (cider--dict-to-alist val) + (cider--var-choice + (cider--dict-to-alist val)))))) + +(defun cider-member-info (class member) + "Return the CLASS MEMBER's info as an alist with list cdrs." + (when (and class member) + (let ((val (plist-get (nrepl-send-request-sync + (list "op" "info" + "session" (nrepl-current-session) + "class" class + "member" member)) + :value))) + (cider--dict-to-alist val)))) + +(defun cider-get-var-attr (var-info attr) + "Return VAR-INFO's ATTR." + (cadr (assoc attr var-info))) + +(provide 'cider-client) + +;;; cider-client.el ends here diff --git a/elpa/cider-0.7.0/cider-client.elc b/elpa/cider-0.7.0/cider-client.elc new file mode 100644 index 000000000..87469b404 Binary files /dev/null and b/elpa/cider-0.7.0/cider-client.elc differ diff --git a/elpa/cider-0.7.0/cider-doc.el b/elpa/cider-0.7.0/cider-doc.el new file mode 100644 index 000000000..0c126f9b7 --- /dev/null +++ b/elpa/cider-0.7.0/cider-doc.el @@ -0,0 +1,377 @@ +;;; cider-doc.el --- CIDER documentation functionality -*- lexical-binding: t -*- + +;; Copyright © 2014 Jeff Valk + +;; Author: Jeff Valk + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Mode for formatting and presenting documentation + +;;; Code: + +(require 'cider-util) +(require 'org-table) +(require 'button) +(require 'dash) +(require 'easymenu) + + +;;; Variables + +(defgroup cider-doc nil + "Documentation for CIDER." + :prefix "cider-doc-" + :group 'cider) + + +(defvar cider-doc-map + (let (cider-doc-map) + (define-prefix-command 'cider-doc-map) + (define-key cider-doc-map (kbd "a") 'cider-apropos) + (define-key cider-doc-map (kbd "C-a") 'cider-apropos) + (define-key cider-doc-map (kbd "A") 'cider-apropos-documentation) + (define-key cider-doc-map (kbd "d") 'cider-doc) + (define-key cider-doc-map (kbd "C-d") 'cider-doc) + (define-key cider-doc-map (kbd "g") 'cider-grimoire) + (define-key cider-doc-map (kbd "C-g") 'cider-grimoire) + (define-key cider-doc-map (kbd "h") 'cider-grimoire-web) + (define-key cider-doc-map (kbd "j") 'cider-javadoc) + (define-key cider-doc-map (kbd "C-j") 'cider-javadoc) + cider-doc-map) + "CIDER documentation keymap.") + +(defvar cider-doc-menu + '("Documentation ..." + ["CiderDoc" cider-doc] + ["JavaDoc in browser" cider-javadoc] + ["Grimoire" cider-grimoire] + ["Grimoire in browser" cider-grimoire-web] + ["Search functions/vars" cider-apropos] + ["Search documentation" cider-apropos-documentation]) + "CIDER documentation submenu.") + + + +;;; cider-docview-mode + +(defgroup cider-docview-mode nil + "Formatting/fontifying documentation viewer." + :prefix "cider-docview-" + :group 'cider) + +(defcustom cider-docview-fill-column fill-column + "Fill column for docstrings in doc buffer." + :type 'list + :group 'cider-docview-mode + :package-version '(cider . "0.7.0")) + + + +;; Faces + +(defface cider-docview-emphasis-face + '((t (:inherit default :underline t))) + "Face for emphasized text" + :group 'cider-docview-mode + :package-version '(cider . "0.7.0")) + +(defface cider-docview-strong-face + '((t (:inherit default :underline t :weight bold))) + "Face for strongly emphasized text" + :group 'cider-docview-mode + :package-version '(cider . "0.7.0")) + +(defface cider-docview-literal-face + '((t (:inherit font-lock-string-face))) + "Face for literal text" + :group 'cider-docview-mode + :package-version '(cider . "0.7.0")) + +(defface cider-docview-table-border-face + '((t (:inherit shadow))) + "Face for table borders" + :group 'cider-docview-mode + :package-version '(cider . "0.7.0")) + + +;; Colors & Theme Support + +(defvar cider-docview-code-background-color + (cider-scale-background-color) + "Background color for code blocks.") + +(defadvice enable-theme (after cider-docview-adapt-to-theme activate) + "When theme is changed, update `cider-docview-code-background-color'." + (setq cider-docview-code-background-color (cider-scale-background-color))) + + +;; Mode & key bindings + +(defvar cider-docview-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "q" 'cider-popup-buffer-quit-function) + (define-key map "j" 'cider-docview-javadoc) + (define-key map (kbd "") 'backward-button) + (define-key map (kbd "TAB") 'forward-button) + + ;; VS[04-08-2014]: proposed keybindings for the docview mode + ;; (define-key map (kbd "") 'backward-button) + ;; (define-key map (kbd "TAB") 'forward-button) + ;; (define-key map (kbd "k") 'kill-this-buffer) + + ;; (define-key map (kbd "C-c C-d") 'cider-doc-map) + ;; (define-key map (kbd "a") 'cider-apropos) + ;; (define-key map (kbd "A") 'cider-apropos-documentation) + ;; (define-key map (kbd "d") 'cider-doc) + ;; (define-key map (kbd "g") 'cider-grimoire) + ;; (define-key map (kbd "h") 'cider-grimoire-web) + ;; (define-key map (kbd "j") 'cider-javadoc) + ;; (define-key map (kbd "J") 'cider-doc-javadoc) + + ;; (define-key map (kbd "M-.") 'cider-jump-to-var) + ;; (define-key map (kbd "M-,") 'cider-jump-back) + ;; (define-key map (kbd "C-c M-.") 'cider-jump-to-resource) + ;; (define-key map (kbd "i") 'cider-inspect) + ;; (define-key map (kbd "C-c M-i") 'cider-inspect) + ;; (define-key map (kbd "C-c C-z") 'cider-switch-to-repl-buffer) + + (easy-menu-define cider-docview-mode-menu map + "Menu for CIDER's doc mode" + `("CiderDoc" + ;; ,cider-doc-menu + ;; "--" + ;; ["Jump to source" cider-jump-to-var] + ;; ["Jump to resource" cider-jump-to-resource] + ;; ["Jump back" cider-jump-back] + ;; "--" + ;; ["Switch to REPL" cider-switch-to-repl-buffer] + ;; "--" + ;; ["Kill" kill-this-buffer] + ;; ["Quit" quit-window] + ["JavaDoc in browser" cider-docview-javadoc] + ["Quit" cider-popup-buffer-quit-function] + )) + map)) + +(define-derived-mode cider-docview-mode special-mode "Doc" + "Major mode for displaying CIDER documentation + +\\{cider-docview-mode-map}" + (setq buffer-read-only t) + (setq-local truncate-lines t) + (setq-local electric-indent-chars nil) + (setq-local cider-docview-symbol nil) + (setq-local cider-docview-javadoc-url nil)) + + +;;; Interactive functions + +(defun cider-docview-javadoc () + "Open the Javadoc for the current class, if available." + (interactive) + (if cider-docview-javadoc-url + (browse-url cider-docview-javadoc-url) + (message "No Javadoc available for %s" cider-docview-symbol))) + + +;;; Font Lock and Formatting + +(defun cider-docview-fontify-code-blocks (buffer mode) + "Font lock BUFFER code blocks using MODE and remove markdown characters. +This processes the triple backtick GFM markdown extension. An overlay is used +to shade the background. Blocks are marked to be ignored by other fonification +and line wrap." + (with-current-buffer buffer + (save-excursion + (while (search-forward-regexp "```\n" nil t) + (replace-match "") + (let ((beg (point)) + (bg `(:background ,cider-docview-code-background-color))) + (when (search-forward-regexp "```\n" nil t) + (replace-match "") + (cider-font-lock-region-as mode beg (point)) + (overlay-put (make-overlay beg (point)) 'face bg) + (put-text-property beg (point) 'block 'code))))))) + +(defun cider-docview-fontify-literals (buffer) + "Font lock BUFFER literal text and remove backtick markdown characters. +Preformatted code text blocks are ignored." + (with-current-buffer buffer + (save-excursion + (while (search-forward "`" nil t) + (if (eq (get-text-property (point) 'block) 'code) + (forward-char) + (progn + (replace-match "") + (let ((beg (point))) + (when (search-forward "`" (line-end-position) t) + (replace-match "") + (put-text-property beg (point) 'face 'cider-docview-literal-face))))))))) + +(defun cider-docview-fontify-emphasis (buffer) + "Font lock BUFFER emphasized text and remove markdown characters. +One '*' represents emphasis, multiple '**'s represent strong emphasis. +Preformatted code text blocks are ignored." + (with-current-buffer buffer + (save-excursion + (while (search-forward-regexp "\\(*+\\)\\(\\w\\)" nil t) + (if (eq (get-text-property (point) 'block) 'code) + (forward-char) + (progn + (replace-match "\\2") + (let ((beg (1- (point))) + (face (if (> (length (match-string 1)) 1) + 'cider-docview-strong-face + 'cider-docview-emphasis-face))) + (when (search-forward-regexp "\\(\\w\\)\\*+" (line-end-position) t) + (replace-match "\\1") + (put-text-property beg (point) 'face face))))))))) + +(defun cider-docview-format-tables (buffer) + "Align BUFFER tables and dim borders. +This processes the GFM table markdown extension using `org-table'. +Tables are marked to be ignored by line wrap." + (with-current-buffer buffer + (save-excursion + (let ((border 'cider-docview-table-border-face)) + (org-table-map-tables + (lambda () + (org-table-align) + (goto-char (org-table-begin)) + (while (search-forward-regexp "[+|-]" (org-table-end) t) + (put-text-property (match-beginning 0) (match-end 0) 'face border)) + (put-text-property (org-table-begin) (org-table-end) 'block 'table))))))) + +(defun cider-docview-wrap-text (buffer) + "For text in BUFFER not propertized as 'block', apply line wrap." + (with-current-buffer buffer + (save-excursion + (while (not (eobp)) + (unless (get-text-property (point) 'block) + (fill-region (point) (line-end-position))) + (forward-line))))) + + +;;; Rendering + +(defun cider-docview-render-java-doc (buffer text) + "Emit into BUFFER formatted doc TEXT for a Java class or member." + (with-current-buffer buffer + (let ((beg (point))) + (insert text) + (save-excursion + (goto-char beg) + (cider-docview-fontify-code-blocks buffer 'java-mode) ; left alone hereafter + (cider-docview-fontify-literals buffer) + (cider-docview-fontify-emphasis buffer) + (cider-docview-format-tables buffer) ; may contain literals, emphasis + (cider-docview-wrap-text buffer))))) ; ignores code, table blocks + +(defun cider-docview-render-info (buffer info) + "Emit into BUFFER formatted INFO for the Clojure or Java symbol." + (let* ((ns (cadr (assoc "ns" info))) + (name (cadr (assoc "name" info))) + (added (cadr (assoc "added" info))) + (depr (cadr (assoc "deprecated" info))) + (macro (cadr (assoc "macro" info))) + (special (cadr (assoc "special-form" info))) + (forms (cadr (assoc "forms-str" info))) + (args (cadr (assoc "arglists-str" info))) + (doc (cadr (assoc "doc" info))) + (url (cadr (assoc "url" info))) + (class (cadr (assoc "class" info))) + (member (cadr (assoc "member" info))) + (javadoc (cadr (assoc "javadoc" info))) + (super (cadr (assoc "super" info))) + (ifaces (cadr (assoc "interfaces" info))) + (clj-name (if ns (concat ns "/" name) name)) + (java-name (if member (concat class "/" member) class))) + (with-current-buffer buffer + (cl-flet ((emit (text &optional face) + (insert (if face + (propertize text 'font-lock-face face) + text)) + (newline))) + (emit (if class java-name clj-name) 'font-lock-function-name-face) + (when super + (emit (concat " Extends: " (cider-font-lock-as 'java-mode super)))) + (when ifaces + (emit (concat "Implements: " (cider-font-lock-as 'java-mode (car ifaces)))) + (dolist (iface (cdr ifaces)) + (emit (concat " "(cider-font-lock-as 'java-mode iface))))) + (when (or super ifaces) + (newline)) + (when (or forms args) + (emit (cider-font-lock-as-clojure (or forms args)))) + (when (or special macro) + (emit (if special "Special Form" "Macro") 'font-lock-comment-face)) + (when added + (emit (concat "Added in " added) 'font-lock-comment-face)) + (when depr + (emit (concat "Deprecated in " depr) 'font-lock-comment-face)) + (when doc + (if class + (cider-docview-render-java-doc (current-buffer) doc) + (emit (concat " " doc)))) + (when url + (newline) + (insert " Please see ") + (insert-text-button url + 'url url + 'follow-link t + 'action (lambda (x) + (browse-url (button-get x 'url)))) + (newline)) + (when javadoc + (newline) + (newline) + (insert "For additional documentation, see the ") + (insert-text-button "Javadoc" + 'url javadoc + 'follow-link t + 'action (lambda (x) + (browse-url (button-get x 'url)))) + (insert ".") + (newline)) + (let ((beg (point-min)) + (end (point-max))) + (dolist (x info) + (put-text-property beg end (car x) (cadr x))))) + (current-buffer)))) + +(defun cider-docview-render (buffer symbol info) + "Emit into BUFFER formatted documentation for SYMBOL's INFO." + (with-current-buffer buffer + (let ((javadoc (cadr (assoc "javadoc" info))) + (inhibit-read-only t)) + (cider-docview-mode) + + (setq-local cider-docview-symbol symbol) + (setq-local cider-docview-javadoc-url javadoc) + + (remove-overlays) + (cider-docview-render-info buffer info) + + (goto-char (point-min)) + (current-buffer)))) + + +(provide 'cider-doc) + +;;; cider-doc.el ends here diff --git a/elpa/cider-0.7.0/cider-doc.elc b/elpa/cider-0.7.0/cider-doc.elc new file mode 100644 index 000000000..68ee3aa24 Binary files /dev/null and b/elpa/cider-0.7.0/cider-doc.elc differ diff --git a/elpa/cider-0.7.0/cider-eldoc.el b/elpa/cider-0.7.0/cider-eldoc.el new file mode 100644 index 000000000..691aedc57 --- /dev/null +++ b/elpa/cider-0.7.0/cider-eldoc.el @@ -0,0 +1,134 @@ +;;; cider-eldoc.el --- eldoc support for Clojure -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; eldoc support for Clojure. + +;;; Code: + +(require 'cider-client) +(require 'cider-interaction) ; for cider-symbol-at-point + +(require 'eldoc) +(require 'dash) + +(defvar cider-extra-eldoc-commands '("yas-expand") + "Extra commands to be added to eldoc's safe commands list.") + +(defun cider-eldoc-format-thing (thing) + "Format the eldoc THING." + (propertize thing 'face 'font-lock-function-name-face)) + +(defun cider-highlight-args (arglist pos) + "Format the the function ARGLIST for eldoc. +POS is the index of the currently highlighted argument." + (let* ((rest-pos (cider--find-rest-args-position arglist)) + (i 0)) + (mapconcat + (lambda (arg) + (let ((argstr (format "%s" arg))) + (if (eq arg '&) + argstr + (prog1 + (if (or (= (1+ i) pos) + (and rest-pos (> (+ 1 i) rest-pos) + (> pos rest-pos))) + (propertize argstr 'face + 'eldoc-highlight-function-argument) + argstr) + (setq i (1+ i)))))) arglist " "))) + +(defun cider--find-rest-args-position (arglist) + "Find the position of & in the ARGLIST vector." + (-elem-index '& (append arglist ()))) + +(defun cider-highlight-arglist (arglist pos) + "Format the ARGLIST for eldoc. +POS is the index of the argument to highlight." + (concat "[" (cider-highlight-args arglist pos) "]")) + +(defun cider-eldoc-format-arglist (arglist pos) + "Format all the ARGLIST for eldoc. +POS is the index of current argument." + (concat "(" + (mapconcat (lambda (args) (cider-highlight-arglist args pos)) + arglist + " ") + ")")) + +(defun cider-eldoc-info-in-current-sexp () + "Return a list of the current sexp and the current argument index." + (save-excursion + (let ((argument-index (1- (eldoc-beginning-of-sexp)))) + ;; If we are at the beginning of function name, this will be -1. + (when (< argument-index 0) + (setq argument-index 0)) + ;; Don't do anything if current word is inside a string. + (if (= (or (char-after (1- (point))) 0) ?\") + nil + (list (cider-symbol-at-point) argument-index))))) + +(defun cider-eldoc--arglist-op-fn (thing) + "Return the arglist for THING using nREPL info op." + (let* ((var-info (cider-var-info thing t)) + (candidates (cdadr (assoc "candidates" var-info)))) + (if candidates + (->> candidates + (-map (lambda (x) (cdr (assoc "arglists-str" x)))) + (-map 'read) + -flatten + -distinct) + (let ((arglists (cider-get-var-attr var-info "arglists-str"))) + (when arglists + (read arglists)))))) + +(defun cider-eldoc-arglist (thing) + "Return the arglist for THING." + (when (nrepl-op-supported-p "info") + (cider-eldoc--arglist-op-fn thing))) + +(defun cider-eldoc () + "Backend function for eldoc to show argument list in the echo area." + (when (cider-connected-p) + (let* ((info (cider-eldoc-info-in-current-sexp)) + (thing (car info)) + (pos (cadr info)) + (value (cider-eldoc-arglist thing))) + (when value + (format "%s: %s" + (cider-eldoc-format-thing thing) + (cider-eldoc-format-arglist value pos)))))) + +(defun cider-turn-on-eldoc-mode () + "Turn on eldoc mode in the current buffer." + (setq-local eldoc-documentation-function 'cider-eldoc) + (apply 'eldoc-add-command cider-extra-eldoc-commands) + (eldoc-mode +1)) + +(provide 'cider-eldoc) + +;;; cider-eldoc.el ends here diff --git a/elpa/cider-0.7.0/cider-eldoc.elc b/elpa/cider-0.7.0/cider-eldoc.elc new file mode 100644 index 000000000..b1f78841d Binary files /dev/null and b/elpa/cider-0.7.0/cider-eldoc.elc differ diff --git a/elpa/cider-0.7.0/cider-inspector.el b/elpa/cider-0.7.0/cider-inspector.el new file mode 100644 index 000000000..7e58fb205 --- /dev/null +++ b/elpa/cider-0.7.0/cider-inspector.el @@ -0,0 +1,235 @@ +;;; cider-inspector.el --- Object inspector -*- lexical-binding: t -*- + +;; Copyright © 2013-2014 Vital Reactor, LLC +;; Copyright © 2014 Bozhidar Batsov + +;; Author: Ian Eslick +;; Bozhidar Batsov + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Clojure object inspector inspired by SLIME. + +;;; Code: + +(require 'cl-lib) +(require 'cider-interaction) + +;; =================================== +;; Inspector Key Map and Derived Mode +;; =================================== + +(defvar cider-inspector-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map cider-popup-buffer-mode-map) + (define-key map [return] 'cider-inspector-operate-on-point) + (define-key map "\C-m" 'cider-inspector-operate-on-point) + (define-key map [mouse-1] 'cider-inspector-operate-on-click) + (define-key map "l" 'cider-inspector-pop) + (define-key map "g" 'cider-inspector-refresh) + (define-key map [tab] 'cider-inspector-next-inspectable-object) + (define-key map "\C-i" 'cider-inspector-next-inspectable-object) + (define-key map [(shift tab)] 'cider-inspector-previous-inspectable-object) ; Emacs translates S-TAB + (define-key map [backtab] 'cider-inspector-previous-inspectable-object) ; to BACKTAB on X. + map)) + +(define-derived-mode cider-inspector-mode fundamental-mode "Inspector" + "Major mode for inspecting Clojure data structures. + +\\{cider-inspector-mode-map}" + (set-syntax-table clojure-mode-syntax-table) + (setq buffer-read-only t) + (setq-local electric-indent-chars nil) + (setq-local truncate-lines t)) + +;;;###autoload +(defun cider-inspect (expression) + "Eval the string EXPRESSION and inspect the result." + (interactive + (list (cider-read-from-minibuffer "Inspect value (evaluated): " + (cider-sexp-at-point)))) + (cider-ensure-op-supported "inspect-start") + (cider-inspect-sym expression (cider-current-ns))) + +;; Operations +(defun cider-render-response (buffer) + (nrepl-make-response-handler + buffer + (lambda (buffer str) + (cider-irender buffer str)) + '() + (lambda (buffer _str) + (cider-emit-into-popup-buffer buffer "Oops")) + '())) + +(defun cider-inspect-sym (sym ns) + (let ((buffer (cider-popup-buffer "*cider inspect*" t))) + (nrepl-send-request (list "op" "inspect-start" "sym" sym "ns" ns) + (cider-render-response buffer)))) + +(defun cider-inspector-pop () + (interactive) + (let ((buffer (cider-popup-buffer "*cider inspect*" t))) + (nrepl-send-request (list "op" "inspect-pop") + (cider-render-response buffer)))) + +(defun cider-inspector-push (idx) + (let ((buffer (cider-popup-buffer "*cider inspect*" t))) + (nrepl-send-request (list "op" "inspect-push" "idx" (number-to-string idx)) + (cider-render-response buffer)))) + +(defun cider-inspector-refresh () + (interactive) + (let ((buffer (cider-popup-buffer "*cider inspect*" t))) + (nrepl-send-request (list "op" "inspect-refresh") + (cider-render-response buffer)))) + +;; Render Inspector from Structured Values +(defun cider-irender (buffer str) + (with-current-buffer buffer + (cider-inspector-mode) + (let ((inhibit-read-only t)) + (condition-case nil + (cider-irender* (car (read-from-string str))) + (error (newline) (insert "Inspector error for: " str)))) + (goto-char (point-min)))) + +(defun cider-irender* (elements) + (dolist (el elements) + (cider-irender-el* el))) + +(defun cider-irender-el* (el) + (cond ((symbolp el) (insert (symbol-name el))) + ((stringp el) (insert el)) + ((and (consp el) (eq (car el) :newline)) + (newline)) + ((and (consp el) (eq (car el) :value)) + (cider-irender-value (cadr el) (caddr el))) + (t (message "Unrecognized inspector object: %s" el)))) + +(defun cider-irender-value (value idx) + (cider-propertize-region + (list 'cider-value-idx idx + 'mouse-face 'highlight + 'face 'font-lock-keyword-face) + (cider-irender-el* value))) + + +;; =================================================== +;; Inspector Navigation (lifted from SLIME inspector) +;; =================================================== + +(defun cider-find-inspectable-object (direction limit) + "Find the next/previous inspectable object. +DIRECTION can be either 'next or 'prev. +LIMIT is the maximum or minimum position in the current buffer. + +Return a list of two values: If an object could be found, the +starting position of the found object and T is returned; +otherwise LIMIT and NIL is returned." + (let ((finder (ecase direction + (next 'next-single-property-change) + (prev 'previous-single-property-change)))) + (let ((prop nil) (curpos (point))) + (while (and (not prop) (not (= curpos limit))) + (let ((newpos (funcall finder curpos 'cider-value-idx nil limit))) + (setq prop (get-text-property newpos 'cider-value-idx)) + (setq curpos newpos))) + (list curpos (and prop t))))) + +(defun cider-inspector-next-inspectable-object (arg) + "Move point to the next inspectable object. +With optional ARG, move across that many objects. +If ARG is negative, move backwards." + (interactive "p") + (let ((maxpos (point-max)) (minpos (point-min)) + (previously-wrapped-p nil)) + ;; Forward. + (while (> arg 0) + (cl-destructuring-bind (pos foundp) + (cider-find-inspectable-object 'next maxpos) + (if foundp + (progn (goto-char pos) (setq arg (1- arg)) + (setq previously-wrapped-p nil)) + (if (not previously-wrapped-p) ; cycle detection + (progn (goto-char minpos) (setq previously-wrapped-p t)) + (error "No inspectable objects"))))) + ;; Backward. + (while (< arg 0) + (cl-destructuring-bind (pos foundp) + (cider-find-inspectable-object 'prev minpos) + ;; CIDER-OPEN-INSPECTOR inserts the title of an inspector page + ;; as a presentation at the beginning of the buffer; skip + ;; that. (Notice how this problem can not arise in ``Forward.'') + (if (and foundp (/= pos minpos)) + (progn (goto-char pos) (setq arg (1+ arg)) + (setq previously-wrapped-p nil)) + (if (not previously-wrapped-p) ; cycle detection + (progn (goto-char maxpos) (setq previously-wrapped-p t)) + (error "No inspectable objects"))))))) + +(defun cider-inspector-previous-inspectable-object (arg) + "Move point to the previous inspectable object. +With optional ARG, move across that many objects. +If ARG is negative, move forwards." + (interactive "p") + (cider-inspector-next-inspectable-object (- arg))) + +(defun cider-inspector-property-at-point () + (let* ((properties '(cider-value-idx cider-range-button + cider-action-number)) + (find-property + (lambda (point) + (cl-loop for property in properties + for value = (get-text-property point property) + when value + return (list property value))))) + (or (funcall find-property (point)) + (funcall find-property (1- (point)))))) + +(defun cider-inspector-operate-on-point () + "Invoke the command for the text at point. +1. If point is on a value then recursivly call the inspector on +that value. +2. If point is on an action then call that action. +3. If point is on a range-button fetch and insert the range." + (interactive) + (cl-destructuring-bind (property value) + (cider-inspector-property-at-point) + (cl-case property + (cider-value-idx + (cider-inspector-push value)) + ;; TODO: range and action handlers + (t (error "No object at point"))))) + +(defun cider-inspector-operate-on-click (event) + "Move to EVENT's position and operate the part." + (interactive "@e") + (let ((point (posn-point (event-end event)))) + (cond ((and point + (or (get-text-property point 'cider-value-idx))) + ;; (get-text-property point 'cider-range-button) + ;; (get-text-property point 'cider-action-number))) + (goto-char point) + (cider-inspector-operate-on-point)) + (t + (error "No clickable part here"))))) + +(provide 'cider-inspector) + +;;; cider-inspector.el ends here diff --git a/elpa/cider-0.7.0/cider-inspector.elc b/elpa/cider-0.7.0/cider-inspector.elc new file mode 100644 index 000000000..2579e50c2 Binary files /dev/null and b/elpa/cider-0.7.0/cider-inspector.elc differ diff --git a/elpa/cider-0.7.0/cider-interaction.el b/elpa/cider-0.7.0/cider-interaction.el new file mode 100644 index 000000000..d173e0443 --- /dev/null +++ b/elpa/cider-0.7.0/cider-interaction.el @@ -0,0 +1,1697 @@ +;;; cider-interaction.el --- IDE for Clojure -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Provides an Emacs Lisp client to connect to Clojure nREPL servers. + +;;; Code: + +(require 'cider-client) +(require 'cider-util) +(require 'cider-stacktrace) +(require 'cider-test) +(require 'cider-doc) + +(require 'clojure-mode) +(require 'dash) +(require 'thingatpt) +(require 'etags) +(require 'arc-mode) +(require 'ansi-color) +(require 'cl-lib) +(require 'compile) +(require 'tramp) +(require 'button) +(require 'apropos) + +(defconst cider-error-buffer "*cider-error*") +(defconst cider-doc-buffer "*cider-doc*") +(defconst cider-result-buffer "*cider-result*") +(defconst cider-apropos-buffer "*cider-apropos*") + +(define-obsolete-variable-alias 'cider-use-local-resources + 'cider-prefer-local-resources "0.7.0") + +(defcustom cider-prefer-local-resources nil + "Prefer local resources to remote (tramp) ones when both are available." + :type 'boolean + :group 'cider) + +(defcustom cider-show-error-buffer t + "Control the popup behavior of cider stacktraces. +The following values are possible t or 'always, 'except-in-repl, +'only-in-repl. Any other value, including nil, will cause the stacktrace +not to be automatically shown. + +Irespective of the value of this variable, the `cider-error-buffer' is +always generated in the background. Use `cider-visit-error-buffer' to +navigate to this buffer." + :type '(choice (const :tag "always" t) + (const except-in-repl) + (const only-in-repl) + (const :tag "never" nil)) + :group 'cider) + +(define-obsolete-variable-alias 'cider-popup-stacktraces + 'cider-show-error-buffer "0.7.0") + +(defcustom cider-auto-jump-to-error t + "When non-nill automatically jump to error location during interactive compilation." + :type 'boolean + :group 'cider + :package-version '(cider . "0.7.0")) + +(defcustom cider-auto-select-error-buffer t + "Controls whether to auto-select the error popup buffer." + :type 'boolean + :group 'cider) + +(defcustom cider-interactive-eval-result-prefix "=> " + "The prefix displayed in the minibuffer before a result value." + :type 'string + :group 'cider + :package-version '(cider . "0.5.0")) + +(defcustom cider-switch-to-repl-command 'cider-switch-to-relevant-repl-buffer + "Select the command to be invoked when switching-to-repl. +The default option is `cider-switch-to-relevant-repl-buffer'. If +you'd like to not use smart matching of repl buffer based on +project directory, you can assign it to `cider-switch-to-current-repl-buffer' +which will use the default REPL connection." + :type 'symbol + :group 'cider) + +(defcustom cider-prompt-save-file-on-load t + "Controls whether to prompt to save the file when loading a buffer." + :type 'boolean + :group 'cider + :package-version '(cider . "0.6.0")) + +(defcustom cider-completion-use-context t + "When true, uses context at point to improve completion suggestions." + :type 'boolean + :group 'cider + :package-version '(cider . "0.7.0")) + +(defconst cider-output-buffer "*cider-out*") + +(defcustom cider-interactive-eval-output-destination 'repl-buffer + "The destination for stdout and stderr produced from interactive evaluation." + :type '(choice (const output-buffer) + (const repl-buffer)) + :group 'cider + :package-version '(cider . "0.7.0")) + +(defface cider-error-highlight-face + '((((supports :underline (:style wave))) + (:underline (:style wave :color "red") :inherit unspecified)) + (t (:inherit font-lock-warning-face :underline t))) + "Face used to highlight compilation errors in Clojure buffers." + :group 'cider) + +(defface cider-warning-highlight-face + '((((supports :underline (:style wave))) + (:underline (:style wave :color "yellow") :inherit unspecified)) + (t (:inherit font-lock-warning-face :underline (:color "yellow")))) + "Face used to highlight compilation warnings in Clojure buffers." + :group 'cider) + +(defvar cider-required-nrepl-ops + '("classpath" "complete" "info" + "inspect-start" "inspect-refresh" + "inspect-pop" "inspect-push" "inspect-reset" + "macroexpand" "macroexpand-1" "macroexpand-all" + "resource" "stacktrace" "toggle-trace") + "A list of nREPL ops required by CIDER to function properly. + +All of them are provided by CIDER's nREPL middleware(cider-nrepl).") + +(defun cider-ensure-op-supported (op) + "Check for support of middleware op OP. +Signal an error if it is not supported." + (unless (nrepl-op-supported-p op) + (error "Can't find nREPL middleware providing op \"%s\". Please, install (or update) cider-nrepl %s and restart CIDER" op cider-version))) + +(defun cider-verify-required-nrepl-ops () + "Check whether all required nREPL ops are present." + (let ((missing-ops (-remove 'nrepl-op-supported-p cider-required-nrepl-ops))) + (when missing-ops + (cider-repl-emit-interactive-output + (format "WARNING: The following required nREPL ops are not supported: \n%s\nPlease, install (or update) cider-nrepl %s and restart CIDER" + (cider-string-join missing-ops " ") + cider-version))))) + +;;; Connection info +(defun cider--java-version () + "Retrieve the underlying connection's Java version." + (cider-eval-and-get-value "(System/getProperty \"java.version\")")) + +(defun cider--clojure-version () + "Retrieve the underlying connection's Clojure version." + (cider-eval-and-get-value "(clojure-version)")) + +(defun cider--nrepl-version () + "Retrieve the underlying connection's nREPL version." + (cider-eval-and-get-value "(:version-string clojure.tools.nrepl/version)")) + +(defun cider--nrepl-middleware-version () + "Retrieve the underlying connection's CIDER nREPL version." + (cider-eval-and-get-value "(try (require 'cider.nrepl) + (:version-string @(resolve 'cider.nrepl/version)) + (catch Throwable _ \"not installed\"))")) + +(defun cider--connection-info (connection-buffer) + "Return info about CONNECTION-BUFFER. + +Info contains project name, current REPL namespace, host:port +endpoint and Clojure version." + (with-current-buffer (get-buffer connection-buffer) + (format "Active nREPL connection: %s:%s, %s:%s (Java %s, Clojure %s, nREPL %s, cider-nrepl %s)" + (or (nrepl--project-name nrepl-project-dir) "") + nrepl-buffer-ns + (car nrepl-endpoint) + (cadr nrepl-endpoint) + (cider--java-version) + (cider--clojure-version) + (cider--nrepl-version) + (cider--nrepl-middleware-version)))) + +(defun cider-display-current-connection-info () + "Display information about the current connection." + (interactive) + (message (cider--connection-info (nrepl-current-connection-buffer)))) + +(defun cider-rotate-connection () + "Rotate and display the current nREPL connection." + (interactive) + (cider-ensure-connected) + (setq nrepl-connection-list + (append (cdr nrepl-connection-list) + (list (car nrepl-connection-list)))) + (message (cider--connection-info (car nrepl-connection-list)))) + +(defun cider-extract-designation-from-current-repl-buffer () + "Extract the designation from the cider repl buffer name." + (let ((repl-buffer-name (cider-current-repl-buffer)) + (template (split-string nrepl-repl-buffer-name-template "%s"))) + (string-match (format "^%s\\(.*\\)%s" + (regexp-quote (concat (car template) nrepl-buffer-name-separator)) + (regexp-quote (cadr template))) + repl-buffer-name) + (or (match-string 1 repl-buffer-name) ""))) + +(defun cider-change-buffers-designation () + "Change the designation in cider buffer names. +Buffer names changed are cider-repl, nrepl-connection and nrepl-server." + (interactive) + (cider-ensure-connected) + (let* ((designation (read-string (format "Change CIDER buffer designation from '%s': " + (cider-extract-designation-from-current-repl-buffer)))) + (new-repl-buffer-name (nrepl-format-buffer-name-template + nrepl-repl-buffer-name-template designation))) + (with-current-buffer (cider-current-repl-buffer) + (rename-buffer new-repl-buffer-name)) + (with-current-buffer (nrepl-current-connection-buffer) + (setq-local nrepl-repl-buffer new-repl-buffer-name) + (let ((new-connection-buffer-name (nrepl-format-buffer-name-template + nrepl-connection-buffer-name-template designation))) + (rename-buffer new-connection-buffer-name) + (setq nrepl-connection-list + (cons new-connection-buffer-name (cdr nrepl-connection-list))) + (with-current-buffer (cider-current-repl-buffer) + (setq-local nrepl-connection-buffer new-connection-buffer-name)) + (when nrepl-server-buffer + (let ((new-server-buffer-name (nrepl-format-buffer-name-template + nrepl-server-buffer-name-template designation))) + (with-current-buffer nrepl-server-buffer + (rename-buffer new-server-buffer-name)) + (setq-local nrepl-server-buffer new-server-buffer-name))))) + (message "CIDER buffer designation changed to: %s" designation))) + +;;; Switching between REPL & source buffers +(defvar-local cider-last-clojure-buffer nil + "A buffer-local variable holding the last Clojure source buffer. +`cider-switch-to-last-clojure-buffer' uses this variable to jump +back to last Clojure source buffer.") + +(defvar cider-current-clojure-buffer nil + "This variable holds current buffer temporarily when connecting to a REPL. +It is set to current buffer when `cider' or `cider-jack-in' is called. +After the REPL buffer is created, the value of this variable is used +to call `cider-remember-clojure-buffer'.") + +(defun cider-remember-clojure-buffer (buffer) + "Try to remember the BUFFER from which the user jumps. +The BUFFER needs to be a Clojure buffer and current major mode needs +to be `cider-repl-mode'. The user can use `cider-switch-to-last-clojure-buffer' +to jump back to the last Clojure source buffer." + (when (and buffer + (with-current-buffer buffer + (derived-mode-p 'clojure-mode)) + (derived-mode-p 'cider-repl-mode)) + (setq cider-last-clojure-buffer buffer))) + +(defun cider-switch-to-repl-buffer (&optional arg) + "Invoke `cider-switch-to-repl-command'." + (interactive "p") + (funcall cider-switch-to-repl-command arg)) + +(defun cider-switch-to-current-repl-buffer (&optional arg) + "Select the REPL buffer, when possible in an existing window. + +Hint: You can use `display-buffer-reuse-frames' and +`special-display-buffer-names' to customize the frame in which +the buffer should appear. + +With a prefix ARG sets the namespace in the REPL buffer to that +of the namespace in the Clojure source buffer." + (interactive "p") + (cider-ensure-connected) + (let ((buffer (current-buffer))) + (when (eq 4 arg) + (cider-repl-set-ns (cider-current-ns))) + (pop-to-buffer (cider-find-or-create-repl-buffer)) + (cider-remember-clojure-buffer buffer) + (goto-char (point-max)))) + +(defun cider-find-connection-buffer-for-project-directory (project-directory) + "Find the relevant connection-buffer for the given PROJECT-DIRECTORY. + +A check is made to ensure that all connection buffers have a project-directory +otherwise there is ambiguity as to which connection buffer should be selected. + +If there are multiple connection buffers matching PROJECT-DIRECTORY there +is ambiguity, therefore nil is returned." + (unless (-filter + (lambda (conn) + (not + (with-current-buffer (get-buffer conn) + nrepl-project-dir))) + nrepl-connection-list) + (let ((matching-connections + (-filter + (lambda (conn) + (let ((conn-proj-dir (with-current-buffer (get-buffer conn) + nrepl-project-dir))) + (when conn-proj-dir + (equal (file-truename project-directory) + (file-truename conn-proj-dir))))) + nrepl-connection-list))) + (when (= 1 (length matching-connections)) + (car matching-connections))))) + +(defun cider-switch-to-relevant-repl-buffer (&optional arg) + "Select the REPL buffer, when possible in an existing window. +The buffer chosen is based on the file open in the current buffer. + +If the REPL buffer cannot be unambiguously determined, the REPL +buffer is chosen based on the current connection buffer and a +message raised informing the user. + +Hint: You can use `display-buffer-reuse-frames' and +`special-display-buffer-names' to customize the frame in which +the buffer should appear. + +With a prefix ARG sets the namespace in the REPL buffer to that +of the namespace in the Clojure source buffer. + +With a second prefix ARG the chosen REPL buffer is based on a +supplied project directory." + (interactive "p") + (cider-ensure-connected) + (let* ((project-directory + (or (when (eq 16 arg) (read-directory-name "Project: ")) + (nrepl-project-directory-for (nrepl-current-dir)))) + (connection-buffer + (or + (and (= 1 (length nrepl-connection-list)) (car nrepl-connection-list)) + (and project-directory + (cider-find-connection-buffer-for-project-directory project-directory))))) + (when connection-buffer + (setq nrepl-connection-list + (cons connection-buffer (delq connection-buffer nrepl-connection-list)))) + (cider-switch-to-current-repl-buffer arg) + (message + (format (if connection-buffer + "Switched to REPL: %s" + "Could not determine relevant nREPL connection, using: %s") + (with-current-buffer (nrepl-current-connection-buffer) + (format "%s:%s, %s:%s" + (or (nrepl--project-name nrepl-project-dir) "") + nrepl-buffer-ns + (car nrepl-endpoint) + (cadr nrepl-endpoint))))))) + +(defun cider-switch-to-last-clojure-buffer () + "Switch to the last Clojure buffer. +The default keybinding for this command is +the same as `cider-switch-to-repl-buffer', +so that it is very convenient to jump between a +Clojure buffer and the REPL buffer." + (interactive) + (if (and (derived-mode-p 'cider-repl-mode) + (buffer-live-p cider-last-clojure-buffer)) + (pop-to-buffer cider-last-clojure-buffer) + (message "Don't know the original Clojure buffer"))) + +(defun cider-find-and-clear-repl-buffer () + "Find the current REPL buffer and clear it. +Returns to the buffer in which the command was invoked." + (interactive) + (let ((origin-buffer (current-buffer))) + (switch-to-buffer (cider-current-repl-buffer)) + (cider-repl-clear-buffer) + (switch-to-buffer origin-buffer))) + +;;; Minibuffer eval +(defvar cider-minibuffer-history '() + "History list of expressions read from the minibuffer.") + +(defvar cider-minibuffer-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-map) + (define-key map "TAB" 'complete-symbol) + (define-key map "M-TAB" 'complete-symbol) + map) + "Minibuffer keymap used for reading Clojure expressions.") + +(defun cider-read-from-minibuffer (prompt &optional initial-value) + "Read a string from the minibuffer, prompting with PROMPT. +If INITIAL-VALUE is non-nil, it is inserted into the minibuffer before +reading input." + (minibuffer-with-setup-hook + (lambda () + (add-hook 'completion-at-point-functions + #'cider-complete-at-point nil t) + (run-hooks 'eval-expression-minibuffer-setup-hook)) + (read-from-minibuffer prompt initial-value + cider-minibuffer-map nil + cider-minibuffer-history))) + +(defun cider-read-and-eval () + "Read a sexp from the minibuffer and output its result to the echo area." + (interactive) + (cider-interactive-eval (cider-read-from-minibuffer "CIDER Eval: "))) + +;;; Eval +(defun cider-eval-region (start end) + "Evaluate the region. +The two arguments START and END are character positions; +they can be in either order." + (interactive "r") + (cider-interactive-eval (buffer-substring-no-properties start end))) + +(defun cider-eval-buffer () + "Evaluate the current buffer." + (interactive) + (cider-eval-region (point-min) (point-max))) + +(defun cider-defun-at-point () + "Return the text of the top-level sexp at point." + (apply #'buffer-substring-no-properties + (cider--region-for-defun-at-point))) + +(defun cider--region-for-defun-at-point () + "Return the start and end position of defun at point." + (save-excursion + (save-match-data + (end-of-defun) + (let ((end (point))) + (beginning-of-defun) + (list (point) end))))) + +(defun cider-eval-defun-at-point (&optional prefix) + "Evaluate the current toplevel form, and print result in the minibuffer. +With a PREFIX argument, print the result in the current buffer." + (interactive "P") + (let ((form (cider-defun-at-point))) + (if prefix + (cider-interactive-eval-print form) + (cider-interactive-eval form)))) + +(defun cider-ns-form () + "Retrieve the ns form." + (when (clojure-find-ns) + (save-excursion + (goto-char (match-beginning 0)) + (cider-defun-at-point)))) + +(defun cider-eval-ns-form () + "Evaluate the current buffer's namespace form." + (interactive) + (when (clojure-find-ns) + (save-excursion + (goto-char (match-beginning 0)) + (cider-eval-defun-at-point)))) + +(defun cider-bounds-of-sexp-at-point () + "Return the bounds sexp at point as a pair (or nil)." + (or (and (equal (char-after) ?\() + (member (char-before) '(?\' ?\, ?\@)) + ;; hide stuff before ( to avoid quirks with '( etc. + (save-restriction + (narrow-to-region (point) (point-max)) + (bounds-of-thing-at-point 'sexp))) + (bounds-of-thing-at-point 'sexp))) + +;; FIXME: This doesn't have properly at the beginning of the REPL prompt +(defun cider-symbol-at-point () + "Return the name of the symbol at point, otherwise nil." + (let ((str (substring-no-properties (or (thing-at-point 'symbol) "")))) + (if (equal str (concat (cider-find-ns) "> ")) + "" + str))) + +(defun cider-sexp-at-point () + "Return the sexp at point as a string, otherwise nil." + (let ((bounds (cider-bounds-of-sexp-at-point))) + (if bounds + (buffer-substring-no-properties (car bounds) + (cdr bounds))))) + +(defun cider-sexp-at-point-with-bounds () + "Return a list containing the sexp at point and its bounds." + (let ((bounds (cider-bounds-of-sexp-at-point))) + (if bounds + (let ((start (car bounds)) + (end (cdr bounds))) + (list (buffer-substring-no-properties start end) + (cons (set-marker (make-marker) start) + (set-marker (make-marker) end))))))) + +(defun cider-last-sexp () + "Return the sexp preceding the point." + (buffer-substring-no-properties + (save-excursion + (backward-sexp) + (point)) + (point))) + +;;; +(defun cider-tramp-prefix (&optional buffer) + "Use the filename for BUFFER to determine a tramp prefix. +Defaults to the current buffer. +Return the tramp prefix, or nil if BUFFER is local." + (let* ((buffer (or buffer (current-buffer))) + (name (buffer-file-name buffer))) + (when (tramp-tramp-file-p name) + (let ((vec (tramp-dissect-file-name name))) + (tramp-make-tramp-file-name (tramp-file-name-method vec) + (tramp-file-name-user vec) + (tramp-file-name-host vec) + nil))))) + +(defun cider--client-tramp-filename (name &optional buffer) + "Return the tramp filename for path NAME relative to BUFFER. +If BUFFER has a tramp prefix, it will be added as a prefix to NAME. +If the resulting path is an existing tramp file, it returns the path, +otherwise, nil." + (let* ((buffer (or buffer (current-buffer))) + (name (concat (cider-tramp-prefix buffer) name))) + (if (tramp-handle-file-exists-p name) + name))) + +(defun cider--server-filename (name) + "Return the nREPL server-relative filename for NAME." + (if (tramp-tramp-file-p name) + (with-parsed-tramp-file-name name nil + localname) + name)) + +(defun cider--file-path (path) + "Return PATH's local or tramp path using `cider-prefer-local-resources'. +If no local or remote file exists, return nil." + (let ((local-path path) + (tramp-path (and path (cider--client-tramp-filename path)))) + (cond ((equal path "") "") + ((and cider-prefer-local-resources (file-exists-p local-path)) + local-path) + ((file-exists-p tramp-path) + tramp-path) + ((file-exists-p local-path) + local-path)))) + +(defun cider--url-to-file (url) + "Return the filename from the resource URL. +Uses `url-generic-parse-url' to parse the url. The filename is extracted and +then url decoded. If the decoded filename has a Windows device letter followed +by a colon immediately after the leading '/' then the leading '/' is dropped to +create a valid path." + (let ((filename (url-unhex-string (url-filename (url-generic-parse-url url))))) + (if (string-match "^/\\([a-zA-Z]:/.*\\)" filename) + (match-string 1 filename) + filename))) + +(defun cider-find-file (url) + "Return a buffer visiting the file URL if it exists, or nil otherwise. +The argument should have a scheme prefix, and represent a fully-qualified file +path or an entry within a zip/jar archive." + (cond ((string-match "^file:\\(.+\\)" url) + (-when-let* ((file (cider--url-to-file (match-string 1 url))) + (path (cider--file-path file))) + (find-file-noselect path))) + ((string-match "^\\(jar\\|zip\\):\\(file:.+\\)!/\\(.+\\)" url) + (-when-let* ((entry (match-string 3 url)) + (file (cider--url-to-file (match-string 2 url))) + (path (cider--file-path file)) + (name (format "%s:%s" path entry))) + (or (get-file-buffer name) + (if (tramp-tramp-file-p path) + (progn + ;; Use emacs built in archiving + (find-file path) + (goto-char (point-min)) + ;; Make sure the file path is followed by a newline to + ;; prevent eg. clj matching cljs. + (search-forward (concat entry "\n")) + ;; moves up to matching line + (forward-line -1) + (let ((opened-buffer (current-buffer))) + (archive-extract) + (current-buffer))) + ;; Use external zip program to just extract the single file + (with-current-buffer (generate-new-buffer + (file-name-nondirectory entry)) + (archive-zip-extract path entry) + (set-visited-file-name name) + (setq-local default-directory (file-name-directory path)) + (setq-local buffer-read-only t) + (set-buffer-modified-p nil) + (set-auto-mode) + (current-buffer)))))))) + +(defun cider-find-var (var) + "Return a buffer visiting the definition for VAR, or nil if not found." + (cider-ensure-op-supported "info") + (-when-let* ((info (cider-var-info var)) + (file (cadr (assoc "file" info))) + (line (cadr (assoc "line" info))) + (buffer (cider-find-file file))) + (with-current-buffer buffer + (goto-line line) + buffer))) + +(defun cider-jump-to (buffer &optional line) + "Push current point onto marker ring, and jump to BUFFER, optionally at LINE. +`cider-mode' is enabled on BUFFER to ensure `cider-jump' and `cider-jump-back' +are available." + (ring-insert find-tag-marker-ring (point-marker)) + (with-current-buffer buffer + (goto-line (or line 1)) + (cider-mode +1)) + (switch-to-buffer buffer)) + +(defun cider-jump-to-resource (path &optional line) + "Jump to the resource at the relative PATH, optionally at a specific LINE. +When called interactively, this operates on point." + (interactive (list (thing-at-point 'filename))) + (cider-ensure-op-supported "resource") + (-if-let* ((resource (-> (list "op" "resource" "name" path) + (nrepl-send-request-sync) + (plist-get :value))) + (buffer (cider-find-file resource))) + (cider-jump-to buffer line) + (message "Cannot find resource %s" path))) + +(defun cider-jump-to-var (var &optional line) + "Jump to the definition of VAR, optionally at a specific LINE. +When called interactively, this operates on point, or falls back to a prompt." + (interactive (list (cider-read-symbol-name "Symbol: " 'identity))) + (cider-ensure-op-supported "info") + (-if-let (info (cider-var-info var)) + (-if-let* ((file (cadr (assoc "file" info))) + (line (or line (cadr (assoc "line" info)))) + (buffer (cider-find-file file))) + (cider-jump-to buffer line) + (message "No source available for %s" var)) + (message "Symbol %s not resolved" var))) + +(define-obsolete-function-alias 'cider-jump 'cider-jump-to-var "0.7.0") +(defalias 'cider-jump-back 'pop-tag-mark) + +(defvar cider-completion-last-context nil) + +(defun cider-completion-symbol-start-pos () + "Find the starting position of the symbol at point, unless inside a string." + (let ((sap (symbol-at-point))) + (when (and sap (not (in-string-p))) + (car (bounds-of-thing-at-point 'symbol))))) + +(defun cider-completion-get-context-at-point () + "Extract the context at point. +If point is not inside the list, returns nil; otherwise return top-level +form, with symbol at point replaced by __prefix__." + (when (save-excursion + (condition-case foo + (progn + (up-list) + (check-parens) + t) + (scan-error nil) + (user-error nil))) + (save-excursion + (let* ((pref-end (point)) + (pref-start (cider-completion-symbol-start-pos)) + (context (cider-defun-at-point)) + (_ (beginning-of-defun)) + (expr-start (point))) + (concat (substring context 0 (- pref-start expr-start)) + "__prefix__" + (substring context (- pref-end expr-start))))))) + +(defun cider-completion-get-context () + "Extract context depending on `cider-completion-use-context' and major mode." + (let ((context (if (and cider-completion-use-context + ;; Important because `beginning-of-defun' and + ;; `ending-of-defun' work incorrectly in the REPL + ;; buffer, so context extraction fails there. + (not (eq major-mode 'cider-repl-buffer))) + (or (cider-completion-get-context-at-point) + "nil") + "nil"))) + (if (string= cider-completion-last-context context) + ":same" + (setq cider-completion-last-context context) + context))) + +(defun cider-complete (str) + "Return a list of completions for STR using nREPL's \"complete\" op." + (cider-ensure-op-supported "complete") + (let ((strlst (plist-get + (nrepl-send-request-sync + (list "op" "complete" + "session" (nrepl-current-session) + "ns" nrepl-buffer-ns + "symbol" str + "context" (cider-completion-get-context))) + :value))) + (when strlst + strlst))) + +(defun cider-complete-at-point () + "Complete the symbol at point." + (let ((sap (symbol-at-point))) + (when (and sap (not (in-string-p))) + (let ((bounds (bounds-of-thing-at-point 'symbol))) + (list (car bounds) (cdr bounds) + (completion-table-dynamic #'cider-complete) + :company-doc-buffer #'cider-create-doc-buffer + :company-location #'cider-company-location + :company-docsig #'cider-company-docsig))))) + +(defun cider-company-location (var) + "Open VAR's definition in a buffer. + +Returns the cons of the buffer itself and the location of VAR's definition +in the buffer." + (-when-let (buffer (cider-find-var var)) + (with-current-buffer buffer + (cons buffer (point))))) + +(defun cider-company-docsig (thing) + "Return signature for THING." + (let ((arglist (cider-eldoc-arglist thing))) + (when arglist + (format "%s: %s" + (cider-eldoc-format-thing thing) + arglist)))) + +(defun cider-javadoc-handler (symbol-name) + "Invoke the nREPL \"info\" op on SYMBOL-NAME if available." + (when symbol-name + (cider-ensure-op-supported "info") + (let* ((info (cider-var-info symbol-name)) + (url (cadr (assoc "javadoc" info)))) + (if url + (browse-url url) + (error "No Javadoc available for %s" symbol-name))))) + +(defun cider-javadoc (query) + "Browse Javadoc on the Java symbol QUERY at point." + (interactive "P") + (cider-read-symbol-name "Javadoc for: " 'cider-javadoc-handler query)) + +(defun cider-stdin-handler (buffer) + "Make a stdin response handler for BUFFER." + (nrepl-make-response-handler buffer + (lambda (buffer value) + (cider-repl-emit-result buffer value t)) + (lambda (buffer out) + (cider-repl-emit-output buffer out t)) + (lambda (buffer err) + (cider-repl-emit-output buffer err t)) + nil)) + +(defun cider-insert-eval-handler (buffer) + "Make a nREPL evaluation handler for the BUFFER. +The handler simply inserts the result value in BUFFER." + (nrepl-make-response-handler buffer + (lambda (_buffer value) + (with-current-buffer buffer + (insert value))) + (lambda (_buffer out) + (cider-repl-emit-interactive-output out)) + (lambda (buffer err) + (cider-highlight-compilation-errors buffer err) + (cider-jump-to-error-maybe buffer err)) + '())) + +(defun cider-emit-interactive-eval-output (output) + "Emit standard or error output resulting from interactive code evaluation. + +The output can be send to either a dedicated output buffer or the current REPL buffer. +This is controlled via `cider-interactive-eval-output-destination'." + (pcase cider-interactive-eval-output-destination + (`output-buffer (let ((output-buffer (or (get-buffer cider-output-buffer) + (cider-popup-buffer cider-output-buffer t)))) + (cider-emit-into-popup-buffer output-buffer output) + (pop-to-buffer output-buffer))) + (`repl-buffer (cider-repl-emit-interactive-output output)) + (t (error "Unsupported value %s for `cider-interactive-eval-output'")))) + +(defun cider-interactive-eval-handler (buffer) + "Make an interactive eval handler for BUFFER." + (nrepl-make-response-handler buffer + (lambda (_buffer value) + (message "%s%s" + cider-interactive-eval-result-prefix + (cider-font-lock-as-clojure value))) + (lambda (_buffer out) + (cider-emit-interactive-eval-output out)) + (lambda (buffer err) + (cider-emit-interactive-eval-output err) + (cider-highlight-compilation-errors buffer err) + (cider-jump-to-error-maybe buffer err)) + '())) + +(defun cider-load-file-handler (buffer) + "Make a load file handler for BUFFER." + (nrepl-make-response-handler buffer + (lambda (buffer value) + (message "%s" value) + (with-current-buffer buffer + (setq nrepl-buffer-ns (clojure-find-ns)) + (run-hooks 'cider-file-loaded-hook))) + (lambda (_buffer value) + (cider-emit-interactive-eval-output value)) + (lambda (buffer err) + (cider-emit-interactive-eval-output err) + (cider-highlight-compilation-errors buffer err) + (cider-jump-to-error-maybe buffer err)) + '() + (lambda (buffer ex root-ex session) + (funcall nrepl-err-handler + buffer ex root-ex session)))) + +(defun cider-interactive-eval-print-handler (buffer) + "Make a handler for evaluating and printing result in BUFFER." + (nrepl-make-response-handler buffer + (lambda (buffer value) + (with-current-buffer buffer + (insert + (if (derived-mode-p 'cider-clojure-interaction-mode) + (format "\n%s\n" value) + value)))) + (lambda (_buffer out) + (cider-emit-interactive-eval-output out)) + (lambda (_buffer err) + (cider-emit-interactive-eval-output err)) + '())) + +(defun cider-popup-eval-print-handler (buffer) + "Make a handler for evaluating and printing result in popup BUFFER." + (nrepl-make-response-handler buffer + (lambda (buffer str) + (cider-emit-into-popup-buffer buffer str)) + '() + (lambda (buffer str) + (cider-emit-into-popup-buffer buffer str)) + '())) + +(defun cider-popup-eval-out-handler (buffer) + "Make a handler for evaluating and printing stdout/stderr in popup BUFFER. + +This is used by pretty-printing commands and intentionally discards their results." + (nrepl-make-response-handler buffer + '() + (lambda (buffer str) + (cider-emit-into-popup-buffer buffer str)) + (lambda (buffer str) + (cider-emit-into-popup-buffer buffer str)) + '())) + +(defun cider-visit-error-buffer () + "Visit the `cider-error-buffer' (usually *cider-error*) if it exists." + (interactive) + (let ((buffer (get-buffer cider-error-buffer))) + (if buffer + (cider-popup-buffer-display buffer cider-auto-select-error-buffer) + (error "No %s buffer" cider-error-buffer)))) + +(defun cider-find-property (property &optional backward) + "Find the next text region which has the specified PROPERTY. +If BACKWARD is t, then search backward. +Returns the position at which PROPERTY was found, or nil if not found." + (let ((p (if backward + (previous-single-char-property-change (point) property) + (next-single-char-property-change (point) property)))) + (when (and (not (= p (point-min))) (not (= p (point-max)))) + p))) + +(defun cider-jump-to-compilation-error (&optional _arg _reset) + "Jump to the line causing the current compilation error. + +_ARG and _RESET are ignored, as there is only ever one compilation error. +They exist for compatibility with `next-error'." + (interactive) + (cl-labels ((goto-next-note-boundary + () + (let ((p (or (cider-find-property 'cider-note-p) + (cider-find-property 'cider-note-p t)))) + (when p + (goto-char p) + (message (get-char-property p 'cider-note)))))) + ;; if we're already on a compilation error, first jump to the end of + ;; it, so that we find the next error. + (when (get-char-property (point) 'cider-note-p) + (goto-next-note-boundary)) + (goto-next-note-boundary))) + +(defun cider-default-err-eval-handler (buffer session) + "Display in BUFFER the last SESSION exception, without middleware support." + (cider-eval "(clojure.stacktrace/print-cause-trace *e)" + (lambda (response) + (nrepl-dbind-response response (out) + (when out + (with-current-buffer buffer + (cider-emit-into-color-buffer buffer out) + (compilation-minor-mode +1))))) + nil + session)) + +(defun cider-default-err-op-handler (buffer session) + "Display in BUFFER the last SESSION exception, with middleware support." + (let (causes) + (nrepl-send-request + (list "op" "stacktrace" "session" session) + (lambda (response) + (nrepl-dbind-response response (class status) + (cond (class (setq causes (cons response causes))) + (status (when causes + (cider-stacktrace-render buffer (reverse causes)))))))))) + +(defun cider--show-error-buffer-p (buffer) + "Return non-nil if stacktrace buffer must be shown on error. +Takes into account the current BUFFER and the value of `cider-show-error-buffer'." + (let ((replp (with-current-buffer buffer (derived-mode-p 'cider-repl-mode)))) + (memq cider-show-error-buffer + (if replp + '(t always only-in-repl) + '(t always except-in-repl))))) + +(defun cider-default-err-handler (buffer ex root-ex session) + "Make an error handler for BUFFER, EX, ROOT-EX and SESSION. +This function determines how the error buffer is shown, and then delegates +the actual error content to the eval or op handler." + (let* ((error-buffer (if (cider--show-error-buffer-p buffer) + (cider-popup-buffer cider-error-buffer + cider-auto-select-error-buffer) + (cider-make-popup-buffer cider-error-buffer)))) + (if (nrepl-op-supported-p "stacktrace") + (cider-default-err-op-handler error-buffer session) + (cider-default-err-eval-handler error-buffer session)))) + +(defvar cider-compilation-regexp + '("\\(?:.*\\(warning, \\)\\|.*?\\(, compiling\\):(\\)\\([^:]*\\):\\([[:digit:]]+\\)\\(?::\\([[:digit:]]+\\)\\)?\\(\\(?: - \\(.*\\)\\)\\|)\\)" 3 4 5 (1)) + "Specifications for matching errors and warnings in Clojure stacktraces. +See `compilation-error-regexp-alist' for help on their format.") + +(add-to-list 'compilation-error-regexp-alist-alist + (cons 'cider cider-compilation-regexp)) +(add-to-list 'compilation-error-regexp-alist 'cider) + +(defun cider-extract-error-info (regexp message) + "Extract error information with REGEXP against MESSAGE." + (let ((file (nth 1 regexp)) + (line (nth 2 regexp)) + (col (nth 3 regexp)) + (type (nth 4 regexp)) + (pat (car regexp))) + (when (string-match pat message) + ;; special processing for type (1.2) style + (setq type (if (consp type) + (or (and (car type) (match-end (car type)) 1) + (and (cdr type) (match-end (cdr type)) 0) + 2))) + (list + (when file + (let ((val (match-string-no-properties file message))) + (unless (string= val "NO_SOURCE_PATH") val))) + (when line (string-to-number (match-string-no-properties line message))) + (when col + (let ((val (match-string-no-properties col message))) + (when val (string-to-number val)))) + (aref [cider-warning-highlight-face + cider-warning-highlight-face + cider-error-highlight-face] + (or type 2)) + message)))) + +(defun cider--goto-expression-start () + "Go to the beginning a list, vector, map or set outside of a string. + +We do so by starting and the current position and proceeding backwards +until we find a delimiters that's not inside a string." + (while (or (not (looking-at "[({[]")) + (eq 'font-lock-string-face + (get-text-property (point) 'face))) + (backward-char))) + +(defun cider--find-last-error-location (buffer message) + "Return the location (begin . end) in BUFFER from the clojure error MESSAGE. +If location could not be found, return nil." + (save-excursion + (with-current-buffer buffer + (let ((info (cider-extract-error-info cider-compilation-regexp message))) + (when info + (let ((file (nth 0 info)) + (line (nth 1 info)) + (col (nth 2 info))) + (save-excursion + ;; when we don't have a filename or it's different from the one of + ;; the current buffer, the line number is relative to form start + (if (and file (equal (file-truename file) + (file-truename (buffer-file-name)))) + (goto-char (point-min)) ; start of file + (beginning-of-defun)) + (forward-line (1- line)) + (move-to-column (or col 0)) + (let ((begin (progn (if col (cider--goto-expression-start) (back-to-indentation)) + (point))) + (end (progn (if col (forward-list) (move-end-of-line nil)) + (point)))) + (cons begin end))))))))) + +(defun cider-highlight-compilation-errors (buffer message) + "Highlight compilation error line in BUFFER, using MESSAGE." + (-when-let* ((pos (cider--find-last-error-location buffer message)) + (overlay (make-overlay (car pos) (cdr pos) buffer)) + (info (cider-extract-error-info cider-compilation-regexp message))) + (let ((face (nth 3 info)) + (note (nth 4 info))) + (overlay-put overlay 'cider-note-p t) + (overlay-put overlay 'face face) + (overlay-put overlay 'cider-note note) + (overlay-put overlay 'help-echo note) + (overlay-put overlay 'modification-hooks + (list (lambda (o &rest args) (delete-overlay o))))))) + +(defun cider-jump-to-error-maybe (buffer err) + "If `cider-auto-jump-to-error' is non-nil, retrieve error location from ERR and jump to it." + (-when-let (pos (and cider-auto-jump-to-error + (cider--find-last-error-location buffer err))) + (with-current-buffer buffer + (goto-char (car pos))))) + + +(defun cider-need-input (buffer) + "Handle an need-input request from BUFFER." + (with-current-buffer buffer + (nrepl-send-stdin (concat (read-from-minibuffer "Stdin: ") "\n") + (cider-stdin-handler buffer)))) + + +;;;; Popup buffers +(define-minor-mode cider-popup-buffer-mode + "Mode for CIDER popup buffers" + nil + (" cider-tmp") + '(("q" . cider-popup-buffer-quit-function))) + +(defvar-local cider-popup-buffer-quit-function 'cider-popup-buffer-quit + "The function that is used to quit a temporary popup buffer.") + +(defun cider-popup-buffer-quit-function (&optional kill-buffer-p) + "Wrapper to invoke the function `cider-popup-buffer-quit-function'. +KILL-BUFFER-P is passed along." + (interactive) + (funcall cider-popup-buffer-quit-function kill-buffer-p)) + +(defun cider-popup-buffer (name &optional select major-mode) + "Create new popup buffer called NAME. +If SELECT is non-nil, select the newly created window. +If MAJOR-MODE is non-nil enabled it for the popup buffer." + (with-current-buffer (cider-make-popup-buffer name major-mode) + (cider-popup-buffer-display (current-buffer) select))) + +(defun cider-popup-buffer-display (popup-buffer &optional select) + "Display POPUP-BUFFER. +If SELECT is non-nil, select the newly created window" + (with-current-buffer popup-buffer + (let ((new-window (display-buffer (current-buffer)))) + (set-window-point new-window (point)) + (when select + (select-window new-window)) + (current-buffer)))) + +(defun cider-popup-buffer-quit (&optional kill-buffer-p) + "Quit the current (temp) window and bury its buffer using `quit-window'. +If prefix argument KILL-BUFFER-P is non-nil, kill the buffer instead of burying it." + (interactive) + (quit-window kill-buffer-p (selected-window))) + +(defun cider-make-popup-buffer (name &optional major-mode) + "Create a temporary buffer called NAME using MAJOR-mode (if specified)." + (with-current-buffer (get-buffer-create name) + (kill-all-local-variables) + (setq buffer-read-only nil) + (erase-buffer) + (when major-mode + (funcall major-mode)) + (setq-local cider-popup-output-marker (point-marker)) + (cider-popup-buffer-mode 1) + (setq buffer-read-only t) + (current-buffer))) + +(defun cider-emit-into-popup-buffer (buffer value) + "Emit into BUFFER the provided VALUE." + (with-current-buffer buffer + (let ((inhibit-read-only t) + (buffer-undo-list t) + (moving (= (point) cider-popup-output-marker))) + (save-excursion + (goto-char cider-popup-output-marker) + (insert (format "%s" value)) + (indent-sexp) + (set-marker cider-popup-output-marker (point))) + (when moving (goto-char cider-popup-output-marker))))) + +(defun cider-emit-into-color-buffer (buffer value) + "Emit into color BUFFER the provided VALUE." + (with-current-buffer buffer + (let ((inhibit-read-only t) + (buffer-undo-list t)) + (goto-char (point-max)) + (insert (format "%s" value)) + (ansi-color-apply-on-region (point-min) (point-max))) + (goto-char (point-min)))) + +;;; Namespace handling +(defun cider-find-ns () + "Return the ns of the current buffer. + +For Clojure buffers the ns is extracted from the ns header. If +it's missing \"user\" is used as fallback." + (cond + ((derived-mode-p 'clojure-mode) + (or (save-restriction + (widen) + (clojure-find-ns)) + "user")) + ((derived-mode-p 'cider-repl-mode) + nrepl-buffer-ns))) + +(defun cider-current-ns () + "Return the ns in the current context. +If `nrepl-buffer-ns' has a value then return that, otherwise +search for and read a `ns' form." + (let ((ns nrepl-buffer-ns)) + (or (and (string= ns "user") + (cider-find-ns)) + ns))) + + +;;; Evaluation +(defun cider-popup-eval-print (form) + "Evaluate the given FORM and print value in current buffer." + (let ((buffer (current-buffer))) + (cider-eval form + (cider-popup-eval-print-handler buffer) + (cider-current-ns)))) + +(defun cider-interactive-eval-print (form) + "Evaluate the given FORM and print value in current buffer." + (let ((buffer (current-buffer))) + (cider-eval form + (cider-interactive-eval-print-handler buffer) + (cider-current-ns)))) + +(defun cider-interactive-eval (form) + "Evaluate the given FORM and print value in minibuffer." + (remove-overlays (point-min) (point-max) 'cider-note-p t) + (let ((buffer (current-buffer))) + (cider-eval form + (cider-interactive-eval-handler buffer) + (cider-current-ns)))) + +(defun cider-interactive-eval-to-repl (form) + "Evaluate the given FORM and print it's value in REPL buffer." + (let ((buffer (cider-current-repl-buffer))) + (cider-eval form + (cider-insert-eval-handler buffer) + (cider-current-ns)))) + +(defun cider-eval-last-sexp (&optional prefix) + "Evaluate the expression preceding point. +If invoked with a PREFIX argument, print the result in the current buffer." + (interactive "P") + (if prefix + (cider-interactive-eval-print (cider-last-sexp)) + (cider-interactive-eval (cider-last-sexp)))) + +(defun cider-eval-last-sexp-and-replace () + "Evaluate the expression preceding point and replace it with its result." + (interactive) + (let ((last-sexp (cider-last-sexp))) + ;; we have to be sure the evaluation won't result in an error + (cider-eval-and-get-value last-sexp) + ;; seems like the sexp is valid, so we can safely kill it + (backward-kill-sexp) + (cider-interactive-eval-print last-sexp))) + +(defun cider-eval-last-sexp-to-repl (&optional prefix) + "Evaluate the expression preceding point and insert its result in the REPL. +If invoked with a PREFIX argument, switch to the REPL buffer." + (interactive "P") + (cider-interactive-eval-to-repl (cider-last-sexp)) + (when prefix + (cider-switch-to-repl-buffer))) + +(defun cider-eval-print-last-sexp () + "Evaluate the expression preceding point. +Print its value into the current buffer." + (interactive) + (cider-interactive-eval-print (cider-last-sexp))) + +(defun cider-pprint-eval-last-sexp () + "Evaluate the sexp preceding point and pprint its value in a popup buffer." + (interactive) + (let ((form (cider-last-sexp)) + (result-buffer (cider-popup-buffer cider-result-buffer nil 'clojure-mode))) + (cider-eval (cider-format-pprint-eval form) + (cider-popup-eval-out-handler result-buffer) + (cider-current-ns)))) + +(defun cider-pprint-eval-defun-at-point () + "Evaluate the top-level form at point and pprint its value in a popup buffer." + (interactive) + (let ((form (cider-defun-at-point)) + (result-buffer (cider-popup-buffer cider-result-buffer nil 'clojure-mode))) + (cider-eval (cider-format-pprint-eval form) + (cider-popup-eval-out-handler result-buffer) + (cider-current-ns)))) + +(defun cider-insert-in-repl (form eval) + "Insert FORM in the REPL buffer and switch to it. +If EVAL is non-nil the form will also be evaluated." + (let ((start-pos (point))) + (while (string-match "\\`[ \t\n\r]+\\|[ \t\n\r]+\\'" form) + (setq form (replace-match "" t t form))) + (with-current-buffer (cider-current-repl-buffer) + (insert form) + (indent-region start-pos (point)) + (when eval + (cider-repl-return)))) + (cider-switch-to-repl-buffer)) + +(defun cider-insert-last-sexp-in-repl (&optional arg) + "Insert the expression preceding point in the REPL buffer. +If invoked with a prefix ARG eval the expression after inserting it." + (interactive "P") + (cider-insert-in-repl (cider-last-sexp) arg)) + +(defun cider-insert-defun-in-repl (&optional arg) + "Insert the top-level form at point in the REPL buffer. +If invoked with a prefix ARG eval the expression after inserting it." + (interactive "P") + (cider-insert-in-repl (cider-defun-at-point) arg)) + +(defun cider-insert-ns-form-in-repl (&optional arg) + "Insert the current buffer's ns form in the REPL buffer. +If invoked with a prefix ARG eval the expression after inserting it." + (interactive "P") + (cider-insert-in-repl (cider-ns-form) arg)) + +(defun cider-ping () + "Check that communication with the server works." + (interactive) + (message "%s" (cider-eval-and-get-value "\"PONG\""))) + +(defun clojure-enable-cider () + "Turn on CIDER mode (see command `cider-mode'). +Useful in hooks." + (cider-mode 1) + (setq next-error-function 'cider-jump-to-compilation-error)) + +(defun clojure-disable-cider () + "Turn off CIDER mode (see command `cider-mode'). +Useful in hooks." + (cider-mode -1)) + +(defun cider-connected-p () + "Return t if CIDER is currently connected, nil otherwise." + (condition-case nil + (nrepl-current-connection-buffer) + (error nil))) + +(defun cider-ensure-connected () + "Ensure there is a cider connection present, otherwise +an error is signalled." + (unless (cider-connected-p) + (error "No active nREPL connection"))) + +(defun cider-enable-on-existing-clojure-buffers () + "Enable interaction mode on existing Clojure buffers. +See command `cider-mode'." + (interactive) + (add-hook 'clojure-mode-hook 'clojure-enable-cider) + (dolist (buffer (cider-util--clojure-buffers)) + (with-current-buffer buffer + (clojure-enable-cider)))) + +(defun cider-disable-on-existing-clojure-buffers () + "Disable `cider-mode' on existing Clojure buffers. +See command `cider-mode'." + (interactive) + (dolist (buffer (cider-util--clojure-buffers)) + (with-current-buffer buffer + (setq nrepl-buffer-ns "user") + (clojure-disable-cider)))) + +(defun cider-possibly-disable-on-existing-clojure-buffers () + "If not connected, disable `cider-mode' on existing Clojure buffers." + (unless (cider-connected-p) + (cider-disable-on-existing-clojure-buffers))) + +(defun cider-fetch-vars-form (ns) + "Construct a Clojure form to read vars inside for NS." + `(concat (if (find-ns (symbol ,ns)) + (map name (concat (keys (ns-interns (symbol ,ns))) + (keys (ns-refers (symbol ,ns)))))) + (if (not= "" ,ns) [".."]) + (->> (all-ns) + (map (fn [n] + (re-find (re-pattern (str "^" (if (not= ,ns "") + (str ,ns "\\.")) + "[^\\.]+")) + (str n)))) + (filter identity) + (map (fn [n] (str n "/"))) + (into (hash-set))))) + +(defun cider-parent-ns (ns) + "Go up a level of NS. +For example \"foo.bar.tar\" -> \"foo.bar\"." + (cider-string-join (butlast (split-string ns "\\.")) ".")) + +(defun cider-completing-read-var-select (prompt callback ns selected targets) + "Peform completing read using SELECTED and TARGETS. +If SELECTED is \"..\" then another selection is made for vars in the parent namespace of +NS using PROMPT. +If SELECTED is a namespace then another selection is made against that namespace +using PROMPT. +Once a selecton is made CALLBACK is called with SELECTED." + ;; TODO: immediate RET gives "" as selected for some reason + ;; this is an OK workaround though + (cond ((equal "" selected) + (cider-completing-read-var-select prompt callback ns (car targets) targets)) + ((equal "/" (substring selected -1)) ; selected a namespace + (cider-completing-read-var prompt (substring selected 0 -1) callback)) + ((equal ".." selected) + (cider-completing-read-var prompt (cider-parent-ns ns) callback)) + ;; non ido variable selection techniques don't return qualified symbols, so this shouldn't either + (t (funcall callback selected)))) + +(defun cider-completing-read-sym-handler (label completing-read-callback buffer) + "Create an nrepl response handler for BUFFER. +The handler will parse the response from nrepl to create targets for a completing read. +The result of the completing read will be passed to COMPLETING-READ-CALLBACK." + (nrepl-make-response-handler buffer + (lambda (buffer value) + ;; make sure to eval the callback in the buffer that the symbol was requested from so we get the right namespace + (with-current-buffer buffer + (let* ((targets (car (read-from-string value))) + (selected (completing-read label targets nil t))) + (funcall completing-read-callback selected targets)))) + nil nil nil)) + +(defun cider-completing-read-sym-form (label form callback) + "Eval the FORM and pass the result to the response handler." + (cider-tooling-eval form (cider-completing-read-sym-handler label callback (current-buffer)) + nrepl-buffer-ns)) + +(defun cider-completing-read-var (prompt ns callback) + "Perform completing read var in NS using CALLBACK." + (cider-completing-read-sym-form prompt (prin1-to-string (cider-fetch-vars-form ns)) + (lambda (selected targets) + (cider-completing-read-var-select prompt callback ns selected targets)))) + +(defun cider-fetch-fns-form (ns) + "Construct a Clojure form for reading fns using supplied NS." + (format "(let [fn-pred (fn [[k v]] (and (fn? (.get v)) + (not (re-find #\"clojure.\" (str v)))))] + (sort + (map (comp name key) + (filter fn-pred + (concat + (ns-interns '%s) + (ns-refers '%s))))))" ns ns)) + +(defun cider-load-fn-into-repl-buffer () + "Browse functions available in current repl buffer. +Once selected, the name of the fn will appear in the repl buffer in parens +ready to call." + (interactive) + (cider-completing-read-sym-form (format "Fn: %s/" nrepl-buffer-ns) + (cider-fetch-fns-form (cider-current-ns)) + (lambda (f _targets) + (with-current-buffer (cider-current-repl-buffer) + (cider-repl--replace-input (format "(%s)" f)) + (goto-char (- (point-max) 1)))))) + +(defun cider-read-symbol-name (prompt callback &optional query) + "Either read a symbol name using PROMPT or choose the one at point. +Use CALLBACK as the completing read var callback. +The user is prompted with PROMPT if a prefix argument is in effect, +if there is no symbol at point, or if QUERY is non-nil." + (let ((symbol-name (cider-symbol-at-point))) + (if (not (or current-prefix-arg + query + (not symbol-name) + (equal "" symbol-name))) + (funcall callback symbol-name) + (cider-completing-read-var prompt nrepl-buffer-ns callback)))) + +(defun cider-toggle-trace (query) + "Toggle tracing for the given QUERY. +Defaults to the symbol at point. With prefix arg or no symbol at +point, prompts for a var." + (interactive "P") + (cider-ensure-op-supported "toggle-trace") + (cider-read-symbol-name + "Toggle trace for var: " + (lambda (sym) + (nrepl-send-request + (list "op" "toggle-trace" + "ns" (cider-current-ns) + "var" sym) + (cider-interactive-eval-handler (current-buffer)))) + query)) + +(defun cider-create-doc-buffer (symbol) + "Populates *cider-doc* with the documentation for SYMBOL." + (-when-let (info (cider-var-info symbol)) + (cider-docview-render (cider-make-popup-buffer cider-doc-buffer) symbol info))) + +(defun cider-doc-lookup (symbol) + "Look up documentation for SYMBOL." + (-if-let (buffer (cider-create-doc-buffer symbol)) + (cider-popup-buffer-display buffer t) + (message "Symbol %s not resolved" symbol))) + +(defun cider-doc (query) + "Open a window with the docstring for the given QUERY. +Defaults to the symbol at point. With prefix arg or no symbol +under point, prompts for a var." + (interactive "P") + (cider-read-symbol-name "Symbol: " 'cider-doc-lookup query)) + +(defconst cider-grimoire-url "http://grimoire.arrdem.com/") + +(defun cider-grimoire-replace-special (name) + "Convert the dashes in NAME to a grimoire friendly format." + (->> name + (replace-regexp-in-string "\\?" "_QMARK_") + (replace-regexp-in-string "\\." "_DOT_") + (replace-regexp-in-string "\\/" "_SLASH_") + (replace-regexp-in-string "\\(\\`_\\)\\|\\(_\\'\\)" ""))) + +(defun cider-grimoire-url (name ns clojure-version) + "Generate a grimoire url from NAME, NS and CLOJURE-VERSION." + (let ((clojure-version (concat (substring clojure-version 0 4) "0")) + (base-url cider-grimoire-url)) + (if name + (concat base-url clojure-version "/" ns "/" (cider-grimoire-replace-special name) "/") + (concat base-url clojure-version "/" ns "/")))) + +(defun cider-grimoire-web-lookup (symbol) + "Look up the grimoire documentation for SYMBOL." + (-if-let (var-info (cider-var-info symbol)) + (let ((name (cider-get-var-attr var-info "name")) + (ns (cider-get-var-attr var-info "ns"))) + ;; TODO: add a whitelist of supported namespaces + (browse-url (cider-grimoire-url name ns (cider--clojure-version)))) + (message "Symbol %s not resolved" symbol))) + +(defun cider-grimoire-web (query) + "Open the grimoire documentation for QUERY in the default web browser." + (interactive "P") + (cider-read-symbol-name "Symbol: " 'cider-grimoire-web-lookup query)) + +(defun cider-create-grimoire-buffer (content) + "Create a new grimoire buffer with CONTENT." + (with-current-buffer (cider-popup-buffer "*cider grimoire*" t) + (read-only-mode -1) + (insert content) + (read-only-mode +1) + (goto-char (point-min)) + (current-buffer))) + +(defun cider-grimoire-lookup (symbol) + "Look up the grimoire documentation for SYMBOL." + (-if-let (var-info (cider-var-info symbol)) + (let ((name (cider-get-var-attr var-info "name")) + (ns (cider-get-var-attr var-info "ns")) + (url-request-method "GET") + (url-request-extra-headers `(("Content-Type" . "text/plain")))) + ;; TODO: add a whitelist of supported namespaces + (url-retrieve (cider-grimoire-url name ns (cider--clojure-version)) + (lambda (status) + ;; we need to strip the http header + (goto-char (point-min)) + (re-search-forward "^$") + (delete-region (point-min) (point)) + (delete-blank-lines) + ;; and create a new buffer with whatever is left + (pop-to-buffer (cider-create-grimoire-buffer (buffer-string)))))) + (message "Symbol %s not resolved" symbol))) + +(defun cider-grimoire (query) + "Open the grimoire documentation for QUERY in a popup buffer." + (interactive "P") + (cider-read-symbol-name "Symbol: " 'cider-grimoire-lookup query)) + +(defun cider-apropos-doc (button) + "Display documentation for the symbol represented at BUTTON." + (cider-doc-lookup (button-get button 'apropos-symbol))) + +(defun cider-apropos-summary (query ns docs-p include-private-p case-sensitive-p) + "Return a short description for the performed apropos search." + (concat (if case-sensitive-p "Case-sensitive " "") + (if docs-p "Documentation " "") + (format "Apropos for %S" query) + (if ns (format " in namespace %S" ns) "") + (if include-private-p + " (public and private symbols)" + " (public symbols only)"))) + +(defun cider-apropos-highlight (doc query) + "Return the DOC string propertized to highlight QUERY matches." + (let ((pos 0)) + (while (string-match query doc pos) + (setq pos (match-end 0)) + (put-text-property (match-beginning 0) + (match-end 0) + 'face apropos-match-face doc))) + doc) + +(defun cider-apropos-result (result query docs-p) + "Emit a RESULT matching QUERY into current buffer, formatted for DOCS-P." + (nrepl-dbind-response result (name type doc) + (let* ((label (capitalize (if (string= type "variable") "var" type))) + (help (concat "Display doc for this " (downcase label)))) + (cider-propertize-region (list 'apropos-symbol name + 'action 'cider-apropos-doc + 'help-echo help) + (insert-text-button name 'type 'apropos-symbol) + (insert "\n ") + (insert-text-button label 'type (intern (concat "apropos-" type))) + (insert ": ") + (let ((beg (point))) + (if docs-p + (progn (insert (cider-apropos-highlight doc query)) + (newline)) + (progn (insert doc) + (fill-region beg (point))))) + (newline))))) + +(defun cider-show-apropos (summary results query docs-p) + "Show SUMMARY and RESULTS for QUERY in a pop-up buffer, formatted for DOCS-P." + (with-current-buffer (cider-popup-buffer cider-apropos-buffer t) + (let ((inhibit-read-only t)) + (set-syntax-table clojure-mode-syntax-table) + (apropos-mode) + (cider-mode) + (if (boundp 'header-line-format) + (setq-local header-line-format summary) + (insert summary "\n\n")) + (dolist (result results) + (cider-apropos-result result query docs-p)) + (goto-char (point-min))))) + +(defun cider-apropos (query &optional ns docs-p privates-p case-sensitive-p) + "Show all symbols whose names match QUERY, a regular expression. +The search may be limited to the namespace NS, and may optionally search doc +strings, include private vars, and be case sensitive." + (interactive + (if current-prefix-arg + (list (read-string "Clojure Apropos: ") + (let ((ns (read-string "Namespace: "))) + (if (string= ns "") nil ns)) + (y-or-n-p "Search doc strings? ") + (y-or-n-p "Include private symbols? ") + (y-or-n-p "Case-sensitive? ")) + (list (read-string "Clojure Apropos: ")))) + (cider-ensure-op-supported "apropos") + (-if-let* ((summary (cider-apropos-summary + query ns docs-p privates-p case-sensitive-p)) + (results (-> `("op" "apropos" + "ns" ,(cider-current-ns) + "query" ,query + ,@(when ns `("search-ns" ,ns)) + ,@(when docs-p '("docs?" "t")) + ,@(when privates-p '("privates?" "t")) + ,@(when case-sensitive-p '("case-sensitive?" "t"))) + (nrepl-send-request-sync) + (plist-get :value)))) + (cider-show-apropos summary results query docs-p) + (message "No apropos matches for %S" query))) + +(defun cider-apropos-documentation () + "Shortcut for (cider-apropos nil t)." + (interactive) + (cider-apropos (read-string "Clojure documentation Apropos: ") nil t)) + +(defun cider-refresh () + "Refresh loaded code." + (interactive) + (cider-tooling-eval "(clojure.tools.namespace.repl/refresh)" + (cider-interactive-eval-handler (current-buffer)))) + +;; TODO: implement reloading ns +(defun cider-eval-load-file (form) + "Load FORM." + (let ((buffer (current-buffer))) + (cider-eval form (cider-interactive-eval-handler buffer)))) + +(defun cider-file-string (file) + "Read the contents of a FILE and return as a string." + (with-current-buffer (find-file-noselect file) + (substring-no-properties (buffer-string)))) + +(defun cider-load-file (filename) + "Load the Clojure file FILENAME." + (interactive (list + (read-file-name "Load file: " nil nil + nil (if (buffer-file-name) + (file-name-nondirectory + (buffer-file-name)))))) + (remove-overlays (point-min) (point-max) 'cider-note-p t) + (cider-send-load-file (cider-file-string filename) + (cider--server-filename filename) + (file-name-nondirectory filename)) + (message "Loading %s..." filename)) + +(defun cider-load-current-buffer () + "Load current buffer's file." + (interactive) + (check-parens) + (unless buffer-file-name + (error "Buffer %s is not associated with a file" (buffer-name))) + (when (and cider-prompt-save-file-on-load + (buffer-modified-p) + (y-or-n-p (format "Save file %s? " (buffer-file-name)))) + (save-buffer)) + (cider-load-file (buffer-file-name))) + +;;; interrupt evaluation +(defun cider-interrupt-handler (buffer) + "Create an interrupt response handler for BUFFER." + (nrepl-make-response-handler buffer nil nil nil nil)) + +;;; quiting +(defun cider--close-buffer (buffer) + "Close the BUFFER and kill its associated process (if any)." + (when (get-buffer-process buffer) + (delete-process (get-buffer-process buffer))) + (when (get-buffer buffer) + (kill-buffer buffer))) + +(defvar cider-ancilliary-buffers + (list cider-error-buffer + cider-apropos-buffer + cider-doc-buffer + cider-test-report-buffer + nrepl-message-buffer-name)) + +(defun cider-close-ancilliary-buffers () + "Close buffers that are shared across connections." + (interactive) + (dolist (buf-name cider-ancilliary-buffers) + (cider--close-buffer buf-name))) + +(defun cider-quit () + "Quit CIDER. + +Quitting closes all active nREPL connections and kills all CIDER buffers." + (interactive) + (when (y-or-n-p "Are you sure you want to quit CIDER? ") + (dolist (connection nrepl-connection-list) + (when connection + (nrepl-close connection))) + (message "All active nREPL connections were closed") + (cider-close-ancilliary-buffers))) + +(defun cider-restart (&optional prompt-project) + "Quit CIDER and restart it. +If PROMPT-PROJECT is t, then prompt for the project in which to +restart the server." + (interactive "P") + (cider-quit) + ;; Workaround for a nasty race condition https://github.com/clojure-emacs/cider/issues/439 + ;; TODO: Find a better way to ensure `cider-quit' has finished + (message "Waiting for CIDER to quit...") + (sleep-for 2) + (cider-jack-in prompt-project)) + +(add-hook 'nrepl-connected-hook 'cider-enable-on-existing-clojure-buffers) +(add-hook 'nrepl-disconnected-hook + 'cider-possibly-disable-on-existing-clojure-buffers) + +(provide 'cider-interaction) + +;;; cider-interaction.el ends here diff --git a/elpa/cider-0.7.0/cider-interaction.elc b/elpa/cider-0.7.0/cider-interaction.elc new file mode 100644 index 000000000..5d9852598 Binary files /dev/null and b/elpa/cider-0.7.0/cider-interaction.elc differ diff --git a/elpa/cider-0.7.0/cider-macroexpansion.el b/elpa/cider-0.7.0/cider-macroexpansion.el new file mode 100644 index 000000000..61042f8d4 --- /dev/null +++ b/elpa/cider-0.7.0/cider-macroexpansion.el @@ -0,0 +1,191 @@ +;;; cider-macroexpansion.el --- Macro expansion support -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Macro expansion support. + +;;; Code: + +(require 'cider-mode) + +(defconst cider-macroexpansion-buffer "*cider-macroexpansion*") + +(push cider-macroexpansion-buffer cider-ancilliary-buffers) + +(defcustom cider-macroexpansion-suppress-namespaces 'tidy + "Determines if namespaces are displayed in the macroexpansion buffer. +Possible values are: + + nil ;=> Vars are fully-qualified in the expansion + t ;=> Vars are displayed without namespace qualification + 'tidy ;=> Vars that are :refer-ed or defined in the current namespace are + displayed with their simple name, non-refered vars from other + namespaces are refered using the alias for that namespace (if + defined), other vars are displayed fully qualified." + :type '(choice (const :tag "Suppress namespaces" t) + (const :tag "Show namespaces" nil) + (const :tag "Show namespace aliases" tidy)) + :group 'cider + :package-version '(cider . "0.7.0")) + +(defun cider-macroexpand-undo (&optional arg) + "Undo the last macroexpansion, using `undo-only'. +ARG is passed along to `undo-only'." + (interactive) + (let ((inhibit-read-only t)) + (undo-only arg))) + +(defvar cider-last-macroexpand-expression nil + "Specify the last macroexpansion preformed. +This variable specifies both what was expanded and the expander.") + +(defun cider-macroexpansion (expander expr) + "Macroexpand, using EXPANDER, the given EXPR." + (cider-ensure-op-supported expander) + (plist-get (nrepl-send-request-sync + (list "op" expander + "code" expr + "ns" (cider-current-ns) + "suppress-namespaces" cider-macroexpansion-suppress-namespaces)) :value)) + +(defun cider-macroexpand-expr (expander expr) + "Macroexpand, use EXPANDER, the given EXPR." + (let* ((expansion (cider-macroexpansion expander expr))) + (setq cider-last-macroexpand-expression expr) + (cider-initialize-macroexpansion-buffer expansion (cider-current-ns)))) + +(defun cider-macroexpand-expr-inplace (expander) + "Substitute the form preceding point with its macroexpansion using EXPANDER." + (interactive) + (let* ((expansion (cider-macroexpansion expander (cider-last-sexp))) + (bounds (cons (save-excursion (backward-sexp) (point)) (point)))) + (cider-redraw-macroexpansion-buffer + expansion (current-buffer) (car bounds) (cdr bounds)))) + +(defun cider-macroexpand-again () + "Repeat the last macroexpansion." + (interactive) + (cider-initialize-macroexpansion-buffer cider-last-macroexpand-expression nrepl-buffer-ns)) + +;;;###autoload +(defun cider-macroexpand-1 (&optional prefix) + "Invoke 'macroexpand-1' on the expression preceding point. +If invoked with a PREFIX argument, use 'macroexpand' instead of +'macroexpand-1'." + (interactive "P") + (let ((expander (if prefix "macroexpand" "macroexpand-1"))) + (cider-macroexpand-expr expander (cider-last-sexp)))) + +(defun cider-macroexpand-1-inplace (&optional prefix) + "Perform inplace 'macroexpand-1' on the expression preceding point. +If invoked with a PREFIX argument, use 'macroexpand' instead of +'macroexpand-1'." + (interactive "P") + (let ((expander (if prefix "macroexpand" "macroexpand-1"))) + (cider-macroexpand-expr-inplace expander))) + +;;;###autoload +(defun cider-macroexpand-all () + "Invoke 'clojure.walk/macroexpand-all' on the expression preceding point." + (interactive) + (cider-macroexpand-expr "macroexpand-all" (cider-last-sexp))) + +(defun cider-macroexpand-all-inplace () + "Perform inplace 'clojure.walk/macroexpand-all' on the expression preceding point." + (interactive) + (cider-macroexpand-expr-inplace "macroexpand-all")) + +(defun cider-initialize-macroexpansion-buffer (expansion ns) + "Create a new Macroexpansion buffer with EXPANSION and namespace NS." + (pop-to-buffer (cider-create-macroexpansion-buffer)) + (setq nrepl-buffer-ns ns) + (setq buffer-undo-list nil) + (let ((inhibit-read-only t) + (buffer-undo-list t)) + (erase-buffer) + (insert (format "%s" expansion)) + (goto-char (point-max)) + (font-lock-fontify-buffer))) + +(defun cider-redraw-macroexpansion-buffer (expansion buffer start end) + "Redraw the macroexpansion with new EXPANSION. +Text in BUFFER from START to END is replaced with new expansion, +and point is placed after the expanded form." + (with-current-buffer buffer + (let ((buffer-read-only nil)) + (goto-char start) + (delete-region start end) + (insert (format "%s" expansion)) + (goto-char start) + (indent-sexp) + (forward-sexp)))) + +(defun cider-create-macroexpansion-buffer () + "Create a new macroexpansion buffer." + (with-current-buffer (cider-popup-buffer cider-macroexpansion-buffer t) + (clojure-mode) + (clojure-disable-cider) + (cider-macroexpansion-mode 1) + (current-buffer))) + +(defvar cider-macroexpansion-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "g") 'cider-macroexpand-again) + (define-key map (kbd "q") 'cider-popup-buffer-quit-function) + (define-key map (kbd "d") 'cider-doc) + (define-key map (kbd "j") 'cider-javadoc) + (define-key map (kbd ".") 'cider-jump-to-var) + (easy-menu-define cider-macroexpansion-mode-menu map + "Menu for CIDER's doc mode" + '("Macroexpansion" + ["Restart expansion" cider-macroexpand-again] + ["Macroexpand-1" cider-macroexpand-1-inplace] + ["Macroexpand-all" cider-macroexpand-all-inplace] + ["Go to source" cider-jump-to-var] + ["Go to doc" cider-doc] + ["Go to Javadoc" cider-docview-javadoc] + ["Quit" cider-popup-buffer-quit-function])) + (cl-labels ((redefine-key (from to) + (dolist (mapping (where-is-internal from cider-mode-map)) + (define-key map mapping to)))) + (redefine-key 'cider-macroexpand-1 'cider-macroexpand-1-inplace) + (redefine-key 'cider-macroexpand-all 'cider-macroexpand-all-inplace) + (redefine-key 'advertised-undo 'cider-macroexpand-undo) + (redefine-key 'undo 'cider-macroexpand-undo)) + map)) + +(define-minor-mode cider-macroexpansion-mode + "Minor mode for CIDER macroexpansion. + +\\{cider-macroexpansion-mode-map}" + nil + " Macroexpand" + cider-macroexpansion-mode-map) + +(provide 'cider-macroexpansion) + +;;; cider-macroexpansion.el ends here diff --git a/elpa/cider-0.7.0/cider-macroexpansion.elc b/elpa/cider-0.7.0/cider-macroexpansion.elc new file mode 100644 index 000000000..51e006907 Binary files /dev/null and b/elpa/cider-0.7.0/cider-macroexpansion.elc differ diff --git a/elpa/cider-0.7.0/cider-mode.el b/elpa/cider-0.7.0/cider-mode.el new file mode 100644 index 000000000..d92bff41a --- /dev/null +++ b/elpa/cider-0.7.0/cider-mode.el @@ -0,0 +1,154 @@ +;;; cider-mode.el --- Minor mode for REPL interactions -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Minor mode for REPL interactions. + +;;; Code: + +(require 'cider-interaction) + +;;;###autoload +(defcustom cider-mode-line + '(" cider" (:eval (format "[%s]" (cider-current-ns)))) + "Mode line ligher for `cider-mode'. + +The value of this variable is a mode line template as in +`mode-line-format'. See Info Node `(elisp)Mode Line Format' for +details about mode line templates. + +Customize this variable to change how `cider-mode' displays its +status in the mode line. The default value displays the current ns. +Set this variable to nil to disable the mode line +entirely." + :group 'cider + :type 'sexp + :risky t + :package-version '(cider "0.7.0")) + +(defvar cider-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-d") 'cider-doc-map) + (define-key map (kbd "M-.") 'cider-jump-to-var) + (define-key map (kbd "M-,") 'cider-jump-back) + (define-key map (kbd "C-c M-.") 'cider-jump-to-resource) + (define-key map (kbd "M-TAB") 'complete-symbol) + (define-key map (kbd "C-M-x") 'cider-eval-defun-at-point) + (define-key map (kbd "C-c C-c") 'cider-eval-defun-at-point) + (define-key map (kbd "C-x C-e") 'cider-eval-last-sexp) + (define-key map (kbd "C-c C-e") 'cider-eval-last-sexp) + (define-key map (kbd "C-c C-w") 'cider-eval-last-sexp-and-replace) + (define-key map (kbd "C-c M-e") 'cider-eval-last-sexp-to-repl) + (define-key map (kbd "C-c M-p") 'cider-insert-last-sexp-in-repl) + (define-key map (kbd "C-c C-p") 'cider-pprint-eval-last-sexp) + (define-key map (kbd "C-c C-f") 'cider-pprint-eval-defun-at-point) + (define-key map (kbd "C-c C-r") 'cider-eval-region) + (define-key map (kbd "C-c C-n") 'cider-eval-ns-form) + (define-key map (kbd "C-c M-:") 'cider-read-and-eval) + (define-key map (kbd "C-c C-m") 'cider-macroexpand-1) + (define-key map (kbd "C-c M-m") 'cider-macroexpand-all) + (define-key map (kbd "C-c M-n") 'cider-repl-set-ns) + (define-key map (kbd "C-c M-i") 'cider-inspect) + (define-key map (kbd "C-c M-t") 'cider-toggle-trace) + (define-key map (kbd "C-c C-z") 'cider-switch-to-repl-buffer) + (define-key map (kbd "C-c M-o") 'cider-find-and-clear-repl-buffer) + (define-key map (kbd "C-c C-k") 'cider-load-current-buffer) + (define-key map (kbd "C-c C-l") 'cider-load-file) + (define-key map (kbd "C-c C-b") 'cider-interrupt) + (define-key map (kbd "C-c ,") 'cider-test-run-tests) + (define-key map (kbd "C-c C-,") 'cider-test-rerun-tests) + (define-key map (kbd "C-c M-,") 'cider-test-run-test) + (define-key map (kbd "C-c C-t") 'cider-test-show-report) + (define-key map (kbd "C-c M-s") 'cider-selector) + (define-key map (kbd "C-c M-r") 'cider-rotate-connection) + (define-key map (kbd "C-c M-d") 'cider-display-current-connection-info) + (define-key map (kbd "C-c C-x") 'cider-refresh) + (define-key map (kbd "C-c C-q") 'cider-quit) + (easy-menu-define cider-mode-menu map + "Menu for CIDER mode" + `("CIDER" + ["Complete symbol" complete-symbol] + "--" + ,cider-doc-menu + "--" + ["Eval top-level sexp at point" cider-eval-defun-at-point] + ["Eval last sexp" cider-eval-last-sexp] + ["Eval last sexp in popup buffer" cider-pprint-eval-last-sexp] + ["Eval last sexp to REPL buffer" cider-eval-last-sexp-to-repl] + ["Eval last sexp and replace" cider-eval-last-sexp-and-replace] + ["Eval region" cider-eval-region] + ["Eval ns form" cider-eval-ns-form] + ["Insert last sexp in REPL" cider-insert-last-sexp-in-repl] + "--" + ["Load current buffer" cider-load-current-buffer] + ["Load file" cider-load-file] + "--" + ["Macroexpand-1" cider-macroexpand-1] + ["Macroexpand-all" cider-macroexpand-all] + "--" + ["Jump to source" cider-jump-to-var] + ["Jump to resource" cider-jump-to-resource] + ["Jump back" cider-jump-back] + "--" + ["Run test" cider-test-run-test] + ["Run all tests" cider-test-run-tests] + ["Rerun failed/erring tests" cider-test-rerun-tests] + ["Show test report" cider-test-show-report] + "--" + ["Inspect" cider-inspect] + "--" + ["Set ns" cider-repl-set-ns] + ["Switch to REPL" cider-switch-to-repl-buffer] + ["Switch to Relevant REPL" cider-switch-to-relevant-repl-buffer] + ["Toggle REPL Pretty Print" cider-repl-toggle-pretty-printing] + ["Clear REPL" cider-find-and-clear-repl-buffer] + ["Refresh loaded code" cider-refresh] + ["Interrupt" cider-interrupt] + ["Quit" cider-quit] + ["Restart" cider-restart] + "--" + ["Display nREPL connection" cider-display-current-connection-info] + ["Rotate nREPL connection" cider-rotate-connection] + "--" + ["Version info" cider-version])) + map)) + +;;;###autoload +(define-minor-mode cider-mode + "Minor mode for REPL interaction from a Clojure buffer. + +\\{cider-mode-map}" + nil + cider-mode-line + cider-mode-map + (make-local-variable 'completion-at-point-functions) + (add-to-list 'completion-at-point-functions + 'cider-complete-at-point)) + +(provide 'cider-mode) + +;;; cider-mode.el ends here diff --git a/elpa/cider-0.7.0/cider-mode.elc b/elpa/cider-0.7.0/cider-mode.elc new file mode 100644 index 000000000..612113c2f Binary files /dev/null and b/elpa/cider-0.7.0/cider-mode.elc differ diff --git a/elpa/cider-0.7.0/cider-pkg.el b/elpa/cider-0.7.0/cider-pkg.el new file mode 100644 index 000000000..8dacbc702 --- /dev/null +++ b/elpa/cider-0.7.0/cider-pkg.el @@ -0,0 +1,8 @@ +(define-package "cider" "0.7.0" "Clojure Integrated Development Environment and REPL" + '((clojure-mode "2.0.0") + (cl-lib "0.3") + (dash "2.4.1") + (pkg-info "0.4") + (emacs "24")) + :url "http://www.github.com/clojure-emacs/cider" :keywords + '("languages" "clojure" "cider")) diff --git a/elpa/cider-0.7.0/cider-pkg.elc b/elpa/cider-0.7.0/cider-pkg.elc new file mode 100644 index 000000000..d5a1c87ae Binary files /dev/null and b/elpa/cider-0.7.0/cider-pkg.elc differ diff --git a/elpa/cider-0.7.0/cider-repl.el b/elpa/cider-0.7.0/cider-repl.el new file mode 100644 index 000000000..9b0b965c1 --- /dev/null +++ b/elpa/cider-0.7.0/cider-repl.el @@ -0,0 +1,1082 @@ +;;; cider-repl.el --- REPL interactions -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; REPL interactions. + +;;; Code: + +(require 'cider-client) +(require 'cider-interaction) +(require 'cider-doc) +(require 'cider-eldoc) ; for cider-turn-on-eldoc-mode +(require 'cider-util) + +(require 'clojure-mode) +(require 'easymenu) + +(eval-when-compile + (defvar paredit-version) + (defvar paredit-space-for-delimiter-predicates)) + +(defgroup cider-repl nil + "Interaction with the REPL." + :prefix "cider-repl-" + :group 'cider) + +(defface cider-repl-prompt-face + '((t (:inherit font-lock-keyword-face))) + "Face for the prompt in the REPL buffer." + :group 'cider-repl) + +(defface cider-repl-output-face + '((t (:inherit font-lock-string-face))) + "Face for STDOUT output in the REPL buffer." + :group 'cider-repl) + +(defface cider-repl-err-output-face + '((t (:inherit font-lock-warning-face))) + "Face for STDERR output in the REPL buffer." + :group 'cider-repl + :package-version '(cider . "0.6.0")) + +(defface cider-repl-input-face + '((t (:bold t))) + "Face for previous input in the REPL buffer." + :group 'cider-repl) + +(defface cider-repl-result-face + '((t ())) + "Face for the result of an evaluation in the REPL buffer." + :group 'cider-repl) + +(defcustom cider-repl-pop-to-buffer-on-connect t + "Controls whether to pop to the REPL buffer on connect. + +When set to nil the buffer will only be created." + :type 'boolean + :group 'cider-repl) + +(defcustom cider-repl-display-in-current-window nil + "Controls whether the REPL buffer is displayed in the current window." + :type 'boolean + :group 'cider-repl) + +(defcustom cider-repl-use-pretty-printing nil + "Control whether the results in REPL are pretty-printed or not. +The `cider-toggle-pretty-printing' command can be used to interactively +change the setting's value." + :type 'boolean + :group 'cider-repl) + +(defcustom cider-repl-use-clojure-font-lock nil + "Non-nil means to use Clojure mode font-locking for input and result. +Nil means that `cider-repl-input-face' and `cider-repl-result-face' +will be used." + :type 'boolean + :group 'cider-repl + :package-version '(cider . "0.5.0")) + +(defcustom cider-repl-result-prefix "" + "The prefix displayed in the REPL before a result value." + :type 'string + :group 'cider + :package-version '(cider . "0.5.0")) + +(defcustom cider-repl-tab-command 'cider-repl-indent-and-complete-symbol + "Select the command to be invoked by the TAB key. +The default option is `cider-repl-indent-and-complete-symbol'. If +you'd like to use the default Emacs behavior use +`indent-for-tab-command'." + :type 'symbol + :group 'cider-repl) + +;;;; REPL buffer local variables +(defvar-local cider-repl-input-start-mark nil) + +(defvar-local cider-repl-prompt-start-mark nil) + +(defvar-local cider-repl-old-input-counter 0 + "Counter used to generate unique `cider-old-input' properties. +This property value must be unique to avoid having adjacent inputs be +joined together.") + +(defvar-local cider-repl-input-history '() + "History list of strings read from the REPL buffer.") + +(defvar-local cider-repl-input-history-items-added 0 + "Variable counting the items added in the current session.") + +(defvar-local cider-repl-output-start nil + "Marker for the start of output.") + +(defvar-local cider-repl-output-end nil + "Marker for the end of output.") + +(defun cider-repl-tab () + "Invoked on TAB keystrokes in `cider-repl-mode' buffers." + (interactive) + (funcall cider-repl-tab-command)) + +(defun cider-repl-reset-markers () + "Reset all REPL markers." + (dolist (markname '(cider-repl-output-start + cider-repl-output-end + cider-repl-prompt-start-mark + cider-repl-input-start-mark)) + (set markname (make-marker)) + (set-marker (symbol-value markname) (point)))) + +;;; REPL init +(defun cider-repl-buffer-name () + "Generate a REPL buffer name based on current connection buffer." + (with-current-buffer (get-buffer (nrepl-current-connection-buffer)) + (nrepl-buffer-name nrepl-repl-buffer-name-template))) + +(defun cider-create-repl-buffer () + "Create a REPL buffer." + (cider-init-repl-buffer + (let ((buffer-name (cider-repl-buffer-name))) + (if cider-repl-display-in-current-window + (add-to-list 'same-window-buffer-names buffer-name)) + (if cider-repl-pop-to-buffer-on-connect + (pop-to-buffer buffer-name) + (generate-new-buffer buffer-name)) + buffer-name))) + +(defun cider-make-repl (process) + "Make a REPL for the connection PROCESS." + (let ((connection-buffer (process-buffer process)) + (repl-buffer (cider-create-repl-buffer))) + (with-current-buffer repl-buffer + (setq nrepl-connection-buffer (buffer-name connection-buffer))) + (with-current-buffer connection-buffer + (setq nrepl-repl-buffer (buffer-name repl-buffer))))) + +(defun cider-repl--banner () + "Generate the welcome REPL buffer banner." + (format "; CIDER %s (Java %s, Clojure %s, nREPL %s, cider-nrepl %s)" + (cider--version) + (cider--java-version) + (cider--clojure-version) + (cider--nrepl-version) + (cider--nrepl-middleware-version))) + +(defun cider-repl--insert-banner-and-prompt (ns) + "Insert REPL banner and REPL prompt, taking into account NS." + (when (zerop (buffer-size)) + (insert (propertize (cider-repl--banner) 'face 'font-lock-comment-face))) + (let ((middleware-version (cider--nrepl-middleware-version))) + (unless (and middleware-version (equal cider-version middleware-version)) + (insert (propertize (format "\nWARNING: CIDER's version (%s) does not match cider-nrepl's version (%s)" cider-version middleware-version) 'face 'font-lock-warning-face)))) + (goto-char (point-max)) + (cider-repl--mark-output-start) + (cider-repl--mark-input-start) + (cider-repl--insert-prompt ns)) + +(defun cider-init-repl-buffer (buffer &optional noprompt) + "Initialize the REPL in BUFFER. +Insert a banner, unless NOPROMPT is non-nil." + (with-current-buffer buffer + (unless (eq major-mode 'cider-repl-mode) + (cider-repl-mode)) + (cider-repl-reset-markers) + ;; honor :init-ns from lein's :repl-options on startup + (setq nrepl-buffer-ns (cider-eval-and-get-value "(str *ns*)")) + (unless noprompt + (cider-repl--insert-banner-and-prompt nrepl-buffer-ns)) + (cider-remember-clojure-buffer cider-current-clojure-buffer) + (current-buffer))) + +(defun cider-find-or-create-repl-buffer () + "Return the REPL buffer, create it if necessary." + (let ((buffer (cider-current-repl-buffer))) + (if (null buffer) + (error "No active nREPL connection") + (let ((buffer (get-buffer buffer))) + (or (when (buffer-live-p buffer) buffer) + (let ((buffer (nrepl-current-connection-buffer))) + (if (null buffer) + (error "No active nREPL connection") + (cider-init-repl-buffer + (get-process buffer) + (get-buffer-create + (cider-repl-buffer-name)))))))))) + +;;; REPL interaction + +(defun cider-repl--in-input-area-p () + "Return t if in input area." + (<= cider-repl-input-start-mark (point))) + +(defun cider-repl--current-input (&optional until-point-p) + "Return the current input as string. +The input is the region from after the last prompt to the end of +buffer. If UNTIL-POINT-P is non-nil, the input is until the current +point." + (buffer-substring-no-properties cider-repl-input-start-mark + (if until-point-p + (point) + (point-max)))) + +(defun cider-repl-previous-prompt () + "Move backward to the previous prompt." + (interactive) + (cider-repl--find-prompt t)) + +(defun cider-repl-next-prompt () + "Move forward to the next prompt." + (interactive) + (cider-repl--find-prompt)) + +(defun cider-repl--find-prompt (&optional backward) + "Find the next prompt. +If BACKWARD is non-nil look backward." + (let ((origin (point)) + (prop 'cider-prompt)) + (while (progn + (cider-search-property-change prop backward) + (not (or (cider-end-of-proprange-p prop) (bobp) (eobp))))) + (unless (cider-end-of-proprange-p prop) + (goto-char origin)))) + +(defun cider-search-property-change (prop &optional backward) + "Search forward for a property change to PROP. +If BACKWARD is non-nil search backward." + (cond (backward + (goto-char (previous-single-char-property-change (point) prop))) + (t + (goto-char (next-single-char-property-change (point) prop))))) + +(defun cider-end-of-proprange-p (property) + "Return t if at the the end of a property range for PROPERTY." + (and (get-char-property (max 1 (1- (point))) property) + (not (get-char-property (point) property)))) + +(defun cider-repl--mark-input-start () + "Mark the input start." + (set-marker cider-repl-input-start-mark (point) (current-buffer))) + +(defun cider-repl--mark-output-start () + "Mark the output start." + (set-marker cider-repl-output-start (point)) + (set-marker cider-repl-output-end (point))) + +(defun cider-repl--mark-output-end () + "Mark the output end." + (add-text-properties cider-repl-output-start cider-repl-output-end + '(face cider-repl-output-face + rear-nonsticky (face)))) + +(defun cider-repl--same-line-p (pos1 pos2) + "Return t if buffer positions POS1 and POS2 are on the same line." + (save-excursion (goto-char (min pos1 pos2)) + (<= (max pos1 pos2) (line-end-position)))) + +(defun cider-repl--bol-internal () + "Go to the beginning of line or the prompt." + (cond ((and (>= (point) cider-repl-input-start-mark) + (cider-repl--same-line-p (point) cider-repl-input-start-mark)) + (goto-char cider-repl-input-start-mark)) + (t (beginning-of-line 1)))) + +(defun cider-repl-mode-beginning-of-defun (&optional arg) + (if (and arg (< arg 0)) + (cider-repl-mode-end-of-defun (- arg)) + (dotimes (i (or arg 1)) + (cider-repl-previous-prompt)))) + +(defun cider-repl-mode-end-of-defun (&optional arg) + (if (and arg (< arg 0)) + (cider-repl-mode-beginning-of-defun (- arg)) + (dotimes (i (or arg 1)) + (cider-repl-next-prompt)))) + +(defun cider-repl-beginning-of-defun () + "Move to beginning of defun." + (interactive) + ;; We call `beginning-of-defun' if we're at the start of a prompt + ;; already, to trigger `cider-repl-mode-beginning-of-defun' by means + ;; of the locally bound `beginning-of-defun-function', in order to + ;; jump to the start of the previous prompt. + (if (and (not (cider-repl--at-prompt-start-p)) + (cider-repl--in-input-area-p)) + (goto-char cider-repl-input-start-mark) + (beginning-of-defun))) + +(defun cider-repl-end-of-defun () + "Move to end of defun." + (interactive) + ;; C.f. `cider-repl-beginning-of-defun.' + (if (and (not (= (point) (point-max))) + (cider-repl--in-input-area-p)) + (goto-char (point-max)) + (end-of-defun))) + +(defun cider-repl-bol () + "Go to the beginning of line or the prompt." + (interactive) + (deactivate-mark) + (cider-repl--bol-internal)) + +(defun cider-repl-bol-mark () + "Set the mark and go to the beginning of line or the prompt." + (interactive) + (unless mark-active + (set-mark (point))) + (cider-repl--bol-internal)) + +(defun cider-repl--at-prompt-start-p () + "Return t if point is at the start of prompt. +This will not work on non-current prompts." + (= (point) cider-repl-input-start-mark)) + +(defun cider-repl--show-maximum-output () + "Put the end of the buffer at the bottom of the window." + (when (eobp) + (let ((win (get-buffer-window (current-buffer)))) + (when win + (with-selected-window win + (set-window-point win (point-max)) + (recenter -1)))))) + +(defmacro cider-save-marker (marker &rest body) + "Save MARKER and execute BODY." + (let ((pos (make-symbol "pos"))) + `(let ((,pos (marker-position ,marker))) + (prog1 (progn . ,body) + (set-marker ,marker ,pos))))) + +(put 'cider-save-marker 'lisp-indent-function 1) + +(defun cider-repl--insert-prompt (namespace) + "Insert the prompt (before markers!), taking into account NAMESPACE. +Set point after the prompt. +Return the position of the prompt beginning." + (goto-char cider-repl-input-start-mark) + (cider-save-marker cider-repl-output-start + (cider-save-marker cider-repl-output-end + (unless (bolp) (insert-before-markers "\n")) + (let ((prompt-start (point)) + (prompt (format "%s> " namespace))) + (cider-propertize-region + '(face cider-repl-prompt-face read-only t intangible t + cider-prompt t + rear-nonsticky (cider-prompt read-only face intangible)) + (insert-before-markers prompt)) + (set-marker cider-repl-prompt-start-mark prompt-start) + prompt-start)))) + +(defun cider-repl-emit-output-at-pos (buffer string output-face position &optional bol) + "Using BUFFER, insert STRING at POSITION and mark it as output. +If BOL is non-nil insert at the beginning of line." + (with-current-buffer buffer + (save-excursion + (cider-save-marker cider-repl-output-start + (cider-save-marker cider-repl-output-end + (goto-char position) + ;; TODO: Review the need for bol + (when (and bol (not (bolp))) (insert-before-markers "\n")) + (cider-propertize-region `(face ,output-face + rear-nonsticky (face)) + (insert-before-markers string) + (when (and (= (point) cider-repl-prompt-start-mark) + (not (bolp))) + (insert-before-markers "\n") + (set-marker cider-repl-output-end (1- (point)))))))) + (cider-repl--show-maximum-output))) + +(defun cider-repl-emit-interactive-output (string) + "Emit STRING as interactive output." + (with-current-buffer (cider-current-repl-buffer) + (let ((pos (1- (cider-repl--input-line-beginning-position)))) + (cider-repl-emit-output-at-pos (current-buffer) string 'cider-repl-output-face pos t) + (ansi-color-apply-on-region pos (point-max))))) + +(defun cider-repl-emit-output (buffer string &optional bol) + "Using BUFFER, emit STRING. +If BOL is non-nil, emit at the beginning of the line." + (with-current-buffer buffer + (let ((pos (1- (cider-repl--input-line-beginning-position)))) + (cider-repl-emit-output-at-pos buffer string 'cider-repl-output-face cider-repl-input-start-mark bol) + (ansi-color-apply-on-region pos (point-max))))) + +;; TODO: Factor out repeated code +(defun cider-repl-emit-err-output (buffer string &optional bol) + "Using BUFFER, emit STRING. +If BOL is non-nil, emit at the beginning of the line." + (with-current-buffer buffer + (let ((pos (1- (cider-repl--input-line-beginning-position)))) + (cider-repl-emit-output-at-pos buffer string 'cider-repl-err-output-face cider-repl-input-start-mark bol) + (ansi-color-apply-on-region pos (point-max))))) + +(defun cider-repl-emit-prompt (buffer) + "Emit the REPL prompt into BUFFER." + (with-current-buffer buffer + (save-excursion + (cider-save-marker cider-repl-output-start + (cider-save-marker cider-repl-output-end + (cider-repl--insert-prompt nrepl-buffer-ns)))) + (cider-repl--show-maximum-output))) + +(defun cider-repl-emit-result (buffer string &optional bol) + "Emit into BUFFER the result STRING and mark it as an evaluation result. +If BOL is non-nil insert at the beginning of the line." + (with-current-buffer buffer + (save-excursion + (cider-save-marker cider-repl-output-start + (cider-save-marker cider-repl-output-end + (goto-char cider-repl-input-start-mark) + (when (and bol (not (bolp))) + (insert-before-markers "\n")) + (insert-before-markers (propertize cider-repl-result-prefix 'face 'font-lock-comment-face)) + (if cider-repl-use-clojure-font-lock + (insert-before-markers (cider-font-lock-as-clojure string)) + (cider-propertize-region + '(face cider-repl-result-face rear-nonsticky (face)) + (insert-before-markers string)))))) + (cider-repl--show-maximum-output))) + +(defun cider-repl-newline-and-indent () + "Insert a newline, then indent the next line. +Restrict the buffer from the prompt for indentation, to avoid being +confused by strange characters (like unmatched quotes) appearing +earlier in the buffer." + (interactive) + (save-restriction + (narrow-to-region cider-repl-prompt-start-mark (point-max)) + (insert "\n") + (lisp-indent-line))) + +(defun cider-repl-indent-and-complete-symbol () + "Indent the current line and perform symbol completion. +First indent the line. If indenting doesn't move point, complete +the symbol." + (interactive) + (let ((pos (point))) + (lisp-indent-line) + (when (= pos (point)) + (if (save-excursion (re-search-backward "[^() \n\t\r]+\\=" nil t)) + (completion-at-point))))) + +(defun cider-repl-kill-input () + "Kill all text from the prompt to point." + (interactive) + (cond ((< (marker-position cider-repl-input-start-mark) (point)) + (kill-region cider-repl-input-start-mark (point))) + ((= (point) (marker-position cider-repl-input-start-mark)) + (cider-repl-delete-current-input)))) + +(defun cider-repl--input-complete-p (start end) + "Return t if the region from START to END is a complete sexp." + (save-excursion + (goto-char start) + (cond ((looking-at "\\s *[@'`#]?[(\"]") + (ignore-errors + (save-restriction + (narrow-to-region start end) + ;; Keep stepping over blanks and sexps until the end of + ;; buffer is reached or an error occurs. Tolerate extra + ;; close parens. + (loop do (skip-chars-forward " \t\r\n)") + until (eobp) + do (forward-sexp)) + t))) + (t t)))) + +(defun cider-repl-handler (buffer) + "Make a nREPL evaluation handler for the REPL BUFFER." + (nrepl-make-response-handler buffer + (lambda (buffer value) + (unless cider-repl-use-pretty-printing + (cider-repl-emit-result buffer value t))) + (lambda (buffer out) + (cider-repl-emit-output buffer out)) + (lambda (buffer err) + (cider-repl-emit-err-output buffer err)) + (lambda (buffer) + (cider-repl-emit-prompt buffer)))) + +(defun cider-repl--send-input (&optional newline) + "Go to the end of the input and send the current input. +If NEWLINE is true then add a newline at the end of the input." + (unless (cider-repl--in-input-area-p) + (error "No input at point")) + (goto-char (point-max)) + (let ((end (point))) ; end of input, without the newline + (cider-repl--add-to-input-history (buffer-substring cider-repl-input-start-mark end)) + (when newline + (insert "\n") + (cider-repl--show-maximum-output)) + (let ((inhibit-modification-hooks t)) + (add-text-properties cider-repl-input-start-mark + (point) + `(cider-old-input + ,(cl-incf cider-repl-old-input-counter)))) + (if cider-repl-use-clojure-font-lock + (let ((input-string (buffer-substring cider-repl-input-start-mark end))) + (save-excursion + ;; TODO: Think of a more efficient way to do that + (cider-repl-kill-input) + ;; replace the current input with a Clojure font-locked version of itself + (insert (cider-font-lock-as-clojure input-string) "\n"))) + (let ((overlay (make-overlay cider-repl-input-start-mark end))) + ;; These properties are on an overlay so that they won't be taken + ;; by kill/yank. + (overlay-put overlay 'read-only t) + (overlay-put overlay 'face 'cider-repl-input-face)))) + (let* ((input (cider-repl--current-input)) + (form (if (and (not (string-match "\\`[ \t\r\n]*\\'" input)) + cider-repl-use-pretty-printing) + (cider-format-pprint-eval input) + input))) + (goto-char (point-max)) + (cider-repl--mark-input-start) + (cider-repl--mark-output-start) + (cider-eval form (cider-repl-handler (current-buffer)) nrepl-buffer-ns))) + +(defun cider-repl-return (&optional end-of-input) + "Evaluate the current input string, or insert a newline. +Send the current input ony if a whole expression has been entered, +i.e. the parenthesis are matched. +When END-OF-INPUT is non-nil, send the input even if the parentheses +are not balanced." + (interactive "P") + (cond + (end-of-input + (cider-repl--send-input)) + ((and (get-text-property (point) 'cider-old-input) + (< (point) cider-repl-input-start-mark)) + (cider-repl--grab-old-input end-of-input) + (cider-repl--recenter-if-needed)) + ((cider-repl--input-complete-p cider-repl-input-start-mark (point-max)) + (cider-repl--send-input t)) + (t + (cider-repl-newline-and-indent) + (message "[input not complete]")))) + +(defun cider-repl--recenter-if-needed () + "Make sure that the point is visible." + (unless (pos-visible-in-window-p (point-max)) + (save-excursion + (goto-char (point-max)) + (recenter -1)))) + +(defun cider-repl--grab-old-input (replace) + "Resend the old REPL input at point. +If REPLACE is non-nil the current input is replaced with the old +input; otherwise the new input is appended. The old input has the +text property `cider-old-input'." + (multiple-value-bind (beg end) (cider-property-bounds 'cider-old-input) + (let ((old-input (buffer-substring beg end)) ;;preserve + ;;properties, they will be removed later + (offset (- (point) beg))) + ;; Append the old input or replace the current input + (cond (replace (goto-char cider-repl-input-start-mark)) + (t (goto-char (point-max)) + (unless (eq (char-before) ?\ ) + (insert " ")))) + (delete-region (point) (point-max)) + (save-excursion + (insert old-input) + (when (equal (char-before) ?\n) + (delete-char -1))) + (forward-char offset)))) + +(defun cider-repl-closing-return () + "Evaluate the current input string after closing all open lists." + (interactive) + (goto-char (point-max)) + (save-restriction + (narrow-to-region cider-repl-input-start-mark (point)) + (while (ignore-errors (save-excursion (backward-up-list 1)) t) + (insert ")"))) + (cider-repl-return)) + +(defun cider-repl-toggle-pretty-printing () + "Toggle pretty-printing in the REPL." + (interactive) + (setq cider-repl-use-pretty-printing (not cider-repl-use-pretty-printing)) + (message "Pretty printing in nREPL %s." + (if cider-repl-use-pretty-printing "enabled" "disabled"))) + +(defvar cider-repl-clear-buffer-hook) + +(defun cider-repl-clear-buffer () + "Delete the output generated by the Clojure process." + (interactive) + (let ((inhibit-read-only t)) + (delete-region (point-min) cider-repl-prompt-start-mark) + (delete-region cider-repl-output-start cider-repl-output-end) + (when (< (point) cider-repl-input-start-mark) + (goto-char cider-repl-input-start-mark)) + (recenter t)) + (run-hooks 'cider-repl-clear-buffer-hook)) + +(defun cider-repl--input-line-beginning-position () + "Return the position of the beginning of input." + (save-excursion + (goto-char cider-repl-input-start-mark) + (line-beginning-position))) + +(defun cider-repl-clear-output () + "Delete the output inserted since the last input." + (interactive) + (let ((start (save-excursion + (cider-repl-previous-prompt) + (ignore-errors (forward-sexp)) + (forward-line) + (point))) + (end (1- (cider-repl--input-line-beginning-position)))) + (when (< start end) + (let ((inhibit-read-only t)) + (delete-region start end) + (save-excursion + (goto-char start) + (insert + (propertize ";;; output cleared" 'face 'font-lock-comment-face))))))) + +(defun cider--all-ns () + "Get a list of the available namespaces." + (cider-eval-and-get-value + "(clojure.core/map clojure.core/str (clojure.core/all-ns))")) + +(defun cider-repl-set-ns (ns) + "Switch the namespace of the REPL buffer to NS. + +If invoked in a REPL buffer the command will prompt you for the name of the +namespace to switch to." + (interactive (list (if (derived-mode-p 'cider-repl-mode) + (completing-read "Switch to namespace: " + (cider--all-ns)) + (cider-current-ns)))) + (if ns + (with-current-buffer (cider-current-repl-buffer) + (cider-eval + (format "(in-ns '%s)" ns) + (cider-repl-handler (current-buffer)))) + (error "Cannot determine the current namespace"))) + +;;;;; History + +(defcustom cider-repl-wrap-history nil + "T to wrap history around when the end is reached." + :type 'boolean + :group 'cider-repl) + +;; These two vars contain the state of the last history search. We +;; only use them if `last-command' was `cider-repl--history-replace', +;; otherwise we reinitialize them. + +(defvar cider-repl-input-history-position -1 + "Newer items have smaller indices.") + +(defvar cider-repl-history-pattern nil + "The regexp most recently used for finding input history.") + +(defun cider-repl--add-to-input-history (string) + "Add STRING to the input history. +Empty strings and duplicates are ignored." + (unless (or (equal string "") + (equal string (car cider-repl-input-history))) + (push string cider-repl-input-history) + (cl-incf cider-repl-input-history-items-added))) + +(defun cider-repl-delete-current-input () + "Delete all text after the prompt." + (goto-char (point-max)) + (delete-region cider-repl-input-start-mark (point-max))) + +(defun cider-repl--replace-input (string) + "Replace the current REPL input with STRING." + (cider-repl-delete-current-input) + (insert-and-inherit string)) + +(defun cider-repl--position-in-history (start-pos direction regexp) + "Return the position of the history item starting at START-POS. +Search in DIRECTION for REGEXP. +Return -1 resp the length of the history if no item matches." + ;; Loop through the history list looking for a matching line + (let* ((step (ecase direction + (forward -1) + (backward 1))) + (history cider-repl-input-history) + (len (length history))) + (loop for pos = (+ start-pos step) then (+ pos step) + if (< pos 0) return -1 + if (<= len pos) return len + if (string-match regexp (nth pos history)) return pos))) + +(defun cider-repl--history-replace (direction &optional regexp) + "Replace the current input with the next line in DIRECTION. +DIRECTION is 'forward' or 'backward' (in the history list). +If REGEXP is non-nil, only lines matching REGEXP are considered." + (setq cider-repl-history-pattern regexp) + (let* ((min-pos -1) + (max-pos (length cider-repl-input-history)) + (pos0 (cond ((cider-history-search-in-progress-p) + cider-repl-input-history-position) + (t min-pos))) + (pos (cider-repl--position-in-history pos0 direction (or regexp ""))) + (msg nil)) + (cond ((and (< min-pos pos) (< pos max-pos)) + (cider-repl--replace-input (nth pos cider-repl-input-history)) + (setq msg (format "History item: %d" pos))) + ((not cider-repl-wrap-history) + (setq msg (cond ((= pos min-pos) "End of history") + ((= pos max-pos) "Beginning of history")))) + (cider-repl-wrap-history + (setq pos (if (= pos min-pos) max-pos min-pos)) + (setq msg "Wrapped history"))) + (when (or (<= pos min-pos) (<= max-pos pos)) + (when regexp + (setq msg (concat msg "; no matching item")))) + (message "%s%s" msg (cond ((not regexp) "") + (t (format "; current regexp: %s" regexp)))) + (setq cider-repl-input-history-position pos) + (setq this-command 'cider-repl--history-replace))) + +(defun cider-history-search-in-progress-p () + "Return t if a current history search is in progress." + (eq last-command 'cider-repl--history-replace)) + +(defun cider-terminate-history-search () + "Terminate the current history search." + (setq last-command this-command)) + +(defun cider-repl-previous-input () + "Cycle backwards through input history. +If the `last-command' was a history navigation command use the +same search pattern for this command. +Otherwise use the current input as search pattern." + (interactive) + (cider-repl--history-replace 'backward (cider-repl-history-pattern t))) + +(defun cider-repl-next-input () + "Cycle forwards through input history. +See `cider-previous-input'." + (interactive) + (cider-repl--history-replace 'forward (cider-repl-history-pattern t))) + +(defun cider-repl-forward-input () + "Cycle forwards through input history." + (interactive) + (cider-repl--history-replace 'forward (cider-repl-history-pattern))) + +(defun cider-repl-backward-input () + "Cycle backwards through input history." + (interactive) + (cider-repl--history-replace 'backward (cider-repl-history-pattern))) + +(defun cider-repl-previous-matching-input (regexp) + "Find the previous input matching REGEXP." + (interactive "sPrevious element matching (regexp): ") + (cider-terminate-history-search) + (cider-repl--history-replace 'backward regexp)) + +(defun cider-repl-next-matching-input (regexp) + "Find then next input matching REGEXP." + (interactive "sNext element matching (regexp): ") + (cider-terminate-history-search) + (cider-repl--history-replace 'forward regexp)) + +(defun cider-repl-history-pattern (&optional use-current-input) + "Return the regexp for the navigation commands. +If USE-CURRENT-INPUT is non-nil, use the current input." + (cond ((cider-history-search-in-progress-p) + cider-repl-history-pattern) + (use-current-input + (assert (<= cider-repl-input-start-mark (point))) + (let ((str (cider-repl--current-input t))) + (cond ((string-match "^[ \n]*$" str) nil) + (t (concat "^" (regexp-quote str)))))) + (t nil))) + +;;; persistent history +(defcustom cider-repl-history-size 500 + "The maximum number of items to keep in the REPL history." + :type 'integer + :safe 'integerp + :group 'cider-repl) + +(defcustom cider-repl-history-file nil + "File to save the persistent REPL history to." + :type 'string + :safe 'stringp + :group 'cider-repl) + +(defun cider-repl--history-read-filename () + "Ask the user which file to use, defaulting `cider-repl-history-file'." + (read-file-name "Use CIDER REPL history file: " + cider-repl-history-file)) + +(defun cider-repl--history-read (filename) + "Read history from FILENAME and return it. +It does not yet set the input history." + (if (file-readable-p filename) + (with-temp-buffer + (insert-file-contents filename) + (when (> (buffer-size (current-buffer)) 0) + (read (current-buffer)))) + '())) + +(defun cider-repl-history-load (&optional filename) + "Load history from FILENAME into current session. +FILENAME defaults to the value of `cider-repl-history-file' but user +defined filenames can be used to read special history files. + +The value of `cider-repl-input-history' is set by this function." + (interactive (list (cider-repl--history-read-filename))) + (let ((f (or filename cider-repl-history-file))) + ;; TODO: probably need to set cider-repl-input-history-position as well. + ;; in a fresh connection the newest item in the list is currently + ;; not available. After sending one input, everything seems to work. + (setq cider-repl-input-history (cider-repl--history-read f)))) + +(defun cider-repl--history-write (filename) + "Write history to FILENAME. +Currently coding system for writing the contents is hardwired to +utf-8-unix." + (let* ((mhist (cider-repl--histories-merge cider-repl-input-history + cider-repl-input-history-items-added + (cider-repl--history-read filename))) + ;; newest items are at the beginning of the list, thus 0 + (hist (cl-subseq mhist 0 (min (length mhist) cider-repl-history-size)))) + (unless (file-writable-p filename) + (error (format "History file not writable: %s" filename))) + (let ((print-length nil) (print-level nil)) + (with-temp-file filename + ;; TODO: really set cs for output + ;; TODO: does cs need to be customizable? + (insert ";; -*- coding: utf-8-unix -*-\n") + (insert ";; Automatically written history of CIDER REPL session\n") + (insert ";; Edit at your own risk\n\n") + (prin1 (mapcar #'substring-no-properties hist) (current-buffer)))))) + +(defun cider-repl-history-save (&optional filename) + "Save the current REPL input history to FILENAME. +FILENAME defaults to the value of `cider-repl-history-file'." + (interactive (list (cider-repl--history-read-filename))) + (let* ((file (or filename cider-repl-history-file))) + (cider-repl--history-write file))) + +(defun cider-repl-history-just-save () + "Just save the history to `cider-repl-history-file'. +This function is meant to be used in hooks to avoid lambda +constructs." + (cider-repl-history-save cider-repl-history-file)) + +;; SLIME has different semantics and will not save any duplicates. +;; we keep track of how many items were added to the history in the +;; current session in `cider-repl--add-to-input-history' and merge only the +;; new items with the current history found in the file, which may +;; have been changed in the meantime by another session. +(defun cider-repl--histories-merge (session-hist n-added-items file-hist) + "Merge histories from SESSION-HIST adding N-ADDED-ITEMS into FILE-HIST." + (append (cl-subseq session-hist 0 n-added-items) + file-hist)) + +;;; REPL shortcuts +(defcustom cider-repl-shortcut-dispatch-char ?\, + "Character used to distinguish REPL commands from Lisp forms." + :type '(character) + :group 'cider-repl) + +(defvar cider-repl-shortcuts (make-hash-table :test 'equal)) + +(defun cider-repl-add-shortcut (name handler) + "Add a REPL shortcut command, defined by NAME and HANDLER." + (puthash name handler cider-repl-shortcuts)) + +(cider-repl-add-shortcut "hasta la vista" 'cider-quit) +(cider-repl-add-shortcut "version" 'cider-version) +(cider-repl-add-shortcut "conn-info" 'cider-display-current-connection-info) +(cider-repl-add-shortcut "conn-rotate" 'cider-rotate-connection) +(cider-repl-add-shortcut "clear" 'cider-repl-clear-buffer) +(cider-repl-add-shortcut "ns" 'cider-repl-set-ns) +(cider-repl-add-shortcut "help" 'cider-repl-shortcuts-help) + +(defun cider-repl-shortcuts-help () + "Display a help buffer." + (interactive) + (ignore-errors (kill-buffer "*CIDER REPL Shortcuts Help*")) + (with-current-buffer (get-buffer-create "*CIDER REPL Shortcuts Help*") + (insert "CIDER REPL shortcuts:\n\n") + (maphash (lambda (k v) (insert (format "%s:\n\t%s\n" k v))) cider-repl-shortcuts) + (goto-char (point-min)) + (help-mode) + (display-buffer (current-buffer) t)) + (cider-repl-handle-shortcut) + (current-buffer)) + +(defun cider-repl--available-shortcuts () + "Return the available REPL shortcuts." + (cider-util--hash-keys cider-repl-shortcuts)) + +(defun cider-repl-handle-shortcut () + "Execute a REPL shortcut." + (interactive) + (if (> (point) cider-repl-input-start-mark) + (insert (string cider-repl-shortcut-dispatch-char)) + (let ((command (completing-read "Command: " + (cider-repl--available-shortcuts)))) + (if (not (equal command "")) + (call-interactively (gethash command cider-repl-shortcuts)) + (error "No command selected"))))) + + +;;;;; CIDER REPL mode + +;;; Prevent paredit from inserting some inappropriate spaces. +;;; C.f. clojure-mode.el +(defun cider-space-for-delimiter-p (endp delim) + "Hook for paredit's `paredit-space-for-delimiter-predicates'. + +Decides if paredit should insert a space after/before (if/unless +ENDP) DELIM." + (if (derived-mode-p 'cider-repl-mode) + (save-excursion + (backward-char) + (if (and (or (char-equal delim ?\() + (char-equal delim ?\") + (char-equal delim ?{)) + (not endp)) + (if (char-equal (char-after) ?#) + (and (not (bobp)) + (or (char-equal ?w (char-syntax (char-before))) + (char-equal ?_ (char-syntax (char-before))))) + t) + t)) + t)) + +(defvar cider-repl-mode-hook nil + "Hook executed when entering `cider-repl-mode'.") + +(defvar cider-repl-mode-syntax-table + (copy-syntax-table clojure-mode-syntax-table)) + +(defvar cider-repl-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map clojure-mode-map) + (define-key map (kbd "C-c C-d") 'cider-doc-map) + (define-key map (kbd "M-.") 'cider-jump) + (define-key map (kbd "M-,") 'cider-jump-back) + (define-key map (kbd "C-c M-.") 'cider-jump-to-resource) + (define-key map (kbd "RET") 'cider-repl-return) + (define-key map (kbd "TAB") 'cider-repl-tab) + (define-key map (kbd "C-") 'cider-repl-closing-return) + (define-key map (kbd "C-j") 'cider-repl-newline-and-indent) + (define-key map (kbd "C-c C-o") 'cider-repl-clear-output) + (define-key map (kbd "C-c M-o") 'cider-repl-clear-buffer) + (define-key map (kbd "C-c M-n") 'cider-repl-set-ns) + (define-key map (kbd "C-c C-u") 'cider-repl-kill-input) + (define-key map (kbd "C-a") 'cider-repl-bol) + (define-key map (kbd "C-S-a") 'cider-repl-bol-mark) + (define-key map [home] 'cider-repl-bol) + (define-key map [S-home] 'cider-repl-bol-mark) + (define-key map (kbd "C-") 'cider-repl-backward-input) + (define-key map (kbd "C-") 'cider-repl-forward-input) + (define-key map (kbd "M-p") 'cider-repl-previous-input) + (define-key map (kbd "M-n") 'cider-repl-next-input) + (define-key map (kbd "M-r") 'cider-repl-previous-matching-input) + (define-key map (kbd "M-s") 'cider-repl-next-matching-input) + (define-key map (kbd "C-c C-n") 'cider-repl-next-prompt) + (define-key map (kbd "C-c C-p") 'cider-repl-previous-prompt) + (define-key map (kbd "C-c C-b") 'cider-interrupt) + (define-key map (kbd "C-c C-c") 'cider-interrupt) + (define-key map (kbd "C-c C-m") 'cider-macroexpand-1) + (define-key map (kbd "C-c M-m") 'cider-macroexpand-all) + (define-key map (kbd "C-c C-z") 'cider-switch-to-last-clojure-buffer) + (define-key map (kbd "C-c M-s") 'cider-selector) + (define-key map (kbd "C-c M-f") 'cider-load-fn-into-repl-buffer) + (define-key map (kbd "C-c C-q") 'cider-quit) + (define-key map (kbd "C-c M-i") 'cider-inspect) + (define-key map (kbd "C-c M-t") 'cider-toggle-trace) + (define-key map (kbd "C-c C-x") 'cider-refresh) + (define-key map (kbd "C-x C-e") 'cider-eval-last-sexp) + (define-key map (kbd "C-c C-r") 'cider-eval-region) + (define-key map (string cider-repl-shortcut-dispatch-char) 'cider-repl-handle-shortcut) + (easy-menu-define cider-repl-mode-menu map + "Menu for CIDER's REPL mode" + `("REPL" + ["Complete symbol" complete-symbol] + "--" + ,cider-doc-menu + "--" + ["Jump to source" cider-jump] + ["Jump to resource" cider-jump-to-resource] + ["Jump back" cider-jump-back] + "--" + ["Inspect" cider-inspect] + "--" + ["Set REPL ns" cider-repl-set-ns] + ["Toggle pretty printing" cider-repl-toggle-pretty-printing] + ["Clear output" cider-repl-clear-output] + ["Clear buffer" cider-repl-clear-buffer] + ["Refresh loaded code" cider-refresh] + ["Kill input" cider-repl-kill-input] + ["Interrupt" cider-interrupt] + ["Quit" cider-quit] + ["Restart" cider-restart] + "--" + ["Version info" cider-version])) + map)) + +(define-derived-mode cider-repl-mode fundamental-mode "REPL" + "Major mode for Clojure REPL interactions. + +\\{cider-repl-mode-map}" + (setq-local lisp-indent-function 'clojure-indent-function) + (setq-local indent-line-function 'lisp-indent-line) + (make-local-variable 'completion-at-point-functions) + (add-to-list 'completion-at-point-functions + 'cider-complete-at-point) + (set-syntax-table cider-repl-mode-syntax-table) + (cider-turn-on-eldoc-mode) + ;; At the REPL, we define beginning-of-defun and end-of-defun to be + ;; the start of the previous prompt or next prompt respectively. + ;; Notice the interplay with `cider-repl-beginning-of-defun'. + (setq-local beginning-of-defun-function 'cider-repl-mode-beginning-of-defun) + (setq-local end-of-defun-function 'cider-repl-mode-end-of-defun) + (if (fboundp 'hack-dir-local-variables-non-file-buffer) + (hack-dir-local-variables-non-file-buffer)) + (when cider-repl-history-file + (cider-repl-history-load cider-repl-history-file) + (add-hook 'kill-buffer-hook 'cider-repl-history-just-save t t) + (add-hook 'kill-emacs-hook 'cider-repl-history-just-save)) + (add-hook 'paredit-mode-hook + (lambda () + (when (>= paredit-version 21) + (define-key cider-repl-mode-map "{" 'paredit-open-curly) + (define-key cider-repl-mode-map "}" 'paredit-close-curly) + (add-to-list 'paredit-space-for-delimiter-predicates + 'cider-space-for-delimiter-p))))) + + +(provide 'cider-repl) + +;;; cider-repl.el ends here diff --git a/elpa/cider-0.7.0/cider-repl.elc b/elpa/cider-0.7.0/cider-repl.elc new file mode 100644 index 000000000..335bf9ee9 Binary files /dev/null and b/elpa/cider-0.7.0/cider-repl.elc differ diff --git a/elpa/cider-0.7.0/cider-scratch.el b/elpa/cider-0.7.0/cider-scratch.el new file mode 100644 index 000000000..a5dfff755 --- /dev/null +++ b/elpa/cider-0.7.0/cider-scratch.el @@ -0,0 +1,71 @@ +;;; cider-scratch.el --- *scratch* buffer for Clojure -*- lexical-binding: t -*- + +;; Copyright © 2014 Bozhidar Batsov +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Imitate Emacs's *scratch* buffer. + +;;; Code: + +(require 'cider-interaction) +(require 'clojure-mode) + +(defvar cider-clojure-interaction-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map clojure-mode-map) + (define-key map (kbd "C-j") 'cider-eval-print-last-sexp) + map)) + +(defconst cider-scratch-buffer-name "*cider-scratch*") + +;;;###autoload +(defun cider-scratch () + "Create a scratch buffer." + (interactive) + (pop-to-buffer (cider-find-or-create-scratch-buffer))) + +(defun cider-find-or-create-scratch-buffer () + "Find or create the scratch buffer." + (or (get-buffer cider-scratch-buffer-name) + (cider-create-scratch-buffer))) + +(define-derived-mode cider-clojure-interaction-mode clojure-mode "Clojure Interaction" + "Major mode for typing and evaluating Clojure forms. +Like Lisp mode except that \\[cider-eval-print-last-sexp] evals the Lisp expression +before point, and prints its value into the buffer, advancing point. + +\\{cider-clojure-interaction-mode-map}") + +(defun cider-create-scratch-buffer () + "Create a new scratch buffer." + (with-current-buffer (get-buffer-create cider-scratch-buffer-name) + (cider-clojure-interaction-mode) + (insert ";; This buffer is for Clojure experiments and evaluation.\n" + ";; Press C-j to evaluate the last expression.\n\n") + (current-buffer))) + +(provide 'cider-scratch) + +;;; cider-scratch.el ends here diff --git a/elpa/cider-0.7.0/cider-scratch.elc b/elpa/cider-0.7.0/cider-scratch.elc new file mode 100644 index 000000000..edfcbc9c9 Binary files /dev/null and b/elpa/cider-0.7.0/cider-scratch.elc differ diff --git a/elpa/cider-0.7.0/cider-selector.el b/elpa/cider-0.7.0/cider-selector.el new file mode 100644 index 000000000..11e08d7a3 --- /dev/null +++ b/elpa/cider-0.7.0/cider-selector.el @@ -0,0 +1,160 @@ +;;; cider-selector.el --- Buffer selection command inspired by SLIME's selector -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Buffer selection command inspired by SLIME's selector. + +;;; Code: + +(require 'cider-client) +(require 'cider-interaction) +(require 'cider-repl) ; for cider-find-or-create-repl-buffer + +(defconst cider-selector-help-buffer "*Selector Help*" + "The name of the selector's help buffer.") + +(defvar cider-selector-methods nil + "List of buffer-selection methods for the `cider-selector' command. +Each element is a list (KEY DESCRIPTION FUNCTION). +DESCRIPTION is a one-line description of what the key selects.") + +(defvar cider-selector-other-window nil + "If non-nil use `switch-to-buffer-other-window'.") + +(defun cider--recently-visited-buffer (mode) + "Return the most recently visited buffer whose `major-mode' is MODE. +Only considers buffers that are not already visible." + (loop for buffer in (buffer-list) + when (and (with-current-buffer buffer (eq major-mode mode)) + (not (string-match "^ " (buffer-name buffer))) + (null (get-buffer-window buffer 'visible))) + return buffer + finally (error "Can't find unshown buffer in %S" mode))) + +;;;###autoload +(defun cider-selector (&optional other-window) + "Select a new buffer by type, indicated by a single character. +The user is prompted for a single character indicating the method by +which to choose a new buffer. The `?' character describes then +available methods. OTHER-WINDOW provides an optional target. + +See `def-cider-selector-method' for defining new methods." + (interactive) + (message "Select [%s]: " + (apply #'string (mapcar #'car cider-selector-methods))) + (let* ((cider-selector-other-window other-window) + (ch (save-window-excursion + (select-window (minibuffer-window)) + (read-char))) + (method (cl-find ch cider-selector-methods :key #'car))) + (cond (method + (funcall (cl-caddr method))) + (t + (message "No method for character: ?\\%c" ch) + (ding) + (sleep-for 1) + (discard-input) + (cider-selector))))) + +(defmacro def-cider-selector-method (key description &rest body) + "Define a new `cider-select' buffer selection method. + +KEY is the key the user will enter to choose this method. + +DESCRIPTION is a one-line sentence describing how the method +selects a buffer. + +BODY is a series of forms which are evaluated when the selector +is chosen. The returned buffer is selected with +`switch-to-buffer'." + (let ((method `(lambda () + (let ((buffer (progn ,@body))) + (cond ((not (get-buffer buffer)) + (message "No such buffer: %S" buffer) + (ding)) + ((get-buffer-window buffer) + (select-window (get-buffer-window buffer))) + (cider-selector-other-window + (switch-to-buffer-other-window buffer)) + (t + (switch-to-buffer buffer))))))) + `(setq cider-selector-methods + (cl-sort (cons (list ,key ,description ,method) + (cl-remove ,key cider-selector-methods :key #'car)) + #'< :key #'car)))) + +(def-cider-selector-method ?? "Selector help buffer." + (ignore-errors (kill-buffer cider-selector-help-buffer)) + (with-current-buffer (get-buffer-create cider-selector-help-buffer) + (insert "CIDER Selector Methods:\n\n") + (loop for (key line nil) in cider-selector-methods + do (insert (format "%c:\t%s\n" key line))) + (goto-char (point-min)) + (help-mode) + (display-buffer (current-buffer) t)) + (cider-selector) + (current-buffer)) + +(pushnew (list ?4 "Select in other window" (lambda () (cider-selector t))) + cider-selector-methods :key #'car) + +(def-cider-selector-method ?c + "Most recently visited clojure-mode buffer." + (cider--recently-visited-buffer 'clojure-mode)) + +(def-cider-selector-method ?e + "Most recently visited emacs-lisp-mode buffer." + (cider--recently-visited-buffer 'emacs-lisp-mode)) + +(def-cider-selector-method ?q "Abort." + (top-level)) + +(def-cider-selector-method ?r + "Current REPL buffer." + (cider-find-or-create-repl-buffer)) + +(def-cider-selector-method ?n + "Connections browser buffer." + (nrepl-connection-browser) + nrepl--connection-browser-buffer-name) + +(def-cider-selector-method ?m + "*nrepl-messages* buffer." + nrepl-message-buffer-name) + +(def-cider-selector-method ?x + "*cider-error* buffer." + cider-error-buffer) + +(def-cider-selector-method ?s + "Cycle to the next CIDER connection's REPL." + (cider-rotate-connection) + (cider-find-or-create-repl-buffer)) + +(provide 'cider-selector) + +;;; cider-selector.el ends here diff --git a/elpa/cider-0.7.0/cider-selector.elc b/elpa/cider-0.7.0/cider-selector.elc new file mode 100644 index 000000000..43bc5d16f Binary files /dev/null and b/elpa/cider-0.7.0/cider-selector.elc differ diff --git a/elpa/cider-0.7.0/cider-stacktrace.el b/elpa/cider-0.7.0/cider-stacktrace.el new file mode 100644 index 000000000..cc26735bb --- /dev/null +++ b/elpa/cider-0.7.0/cider-stacktrace.el @@ -0,0 +1,542 @@ +;;; cider-stacktrace.el --- Stacktrace navigator -*- lexical-binding: t -*- + +;; Copyright © 2014 Jeff Valk + +;; Author: Jeff Valk + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Stacktrace filtering and stack frame source navigation + +;;; Code: + +(require 'cl-lib) +(require 'button) +(require 'dash) +(require 'easymenu) + +;; Variables + +(defgroup cider-stacktrace nil + "Stacktrace filtering and navigation." + :prefix "cider-stacktrace-" + :group 'cider) + +(defcustom cider-stacktrace-fill-column t + "Fill column for error messages in stacktrace display. +If nil, messages will not be wrapped. If truthy but non-numeric, +`fill-column' will be used." + :type 'list + :group 'cider-stacktrace + :package-version '(cider . "0.7.0")) + +(defcustom cider-stacktrace-default-filters '(tooling dup) + "Frame types to omit from initial stacktrace display." + :type 'list + :group 'cider-stacktrace + :package-version '(cider . "0.6.0")) + +(defvar cider-stacktrace-detail-max 2 + "The maximum detail level for causes.") + +(defvar-local cider-stacktrace-hidden-frame-count 0) +(defvar-local cider-stacktrace-filters nil) +(defvar-local cider-stacktrace-prior-filters nil) +(defvar-local cider-stacktrace-cause-visibility nil) + + +;; Faces + +(defface cider-stacktrace-error-class-face + '((t (:inherit font-lock-warning-face))) + "Face for exception class names" + :group 'cider-stacktrace + :package-version '(cider . "0.6.0")) + +(defface cider-stacktrace-error-message-face + '((t (:inherit font-lock-doc-face))) + "Face for exception messages" + :group 'cider-stacktrace + :package-version '(cider . "0.7.0")) + +(defface cider-stacktrace-filter-shown-face + '((t (:inherit button :underline t :weight normal))) + "Face for filter buttons representing frames currently visible" + :group 'cider-stacktrace + :package-version '(cider . "0.6.0")) + +(defface cider-stacktrace-filter-hidden-face + '((t (:inherit button :underline nil :weight normal))) + "Face for filter buttons representing frames currently filtered out" + :group 'cider-stacktrace + :package-version '(cider . "0.6.0")) + +(defface cider-stacktrace-face + '((t (:inherit default))) + "Face for stack frame text" + :group 'cider-stacktrace + :package-version '(cider . "0.6.0")) + +(defface cider-stacktrace-ns-face + '((t (:inherit font-lock-comment-face))) + "Face for stack frame namespace name" + :group 'cider-stacktrace + :package-version '(cider . "0.6.0")) + +(defface cider-stacktrace-fn-face + '((t (:inherit default :weight bold))) + "Face for stack frame function name" + :group 'cider-stacktrace + :package-version '(cider . "0.6.0")) + + +;; Colors & Theme Support + +(defvar cider-stacktrace-frames-background-color + (cider-scale-background-color) + "Background color for stacktrace frames.") + +(defadvice enable-theme (after cider-stacktrace-adapt-to-theme activate) + "When theme is changed, update `cider-stacktrace-frames-background-color'." + (setq cider-stacktrace-frames-background-color (cider-scale-background-color))) + + +;; Mode & key bindings + +(defvar cider-stacktrace-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "M-p") 'cider-stacktrace-previous-cause) + (define-key map (kbd "M-n") 'cider-stacktrace-next-cause) + (define-key map (kbd "M-.") 'cider-stacktrace-jump) + (define-key map "q" 'cider-popup-buffer-quit-function) + (define-key map "j" 'cider-stacktrace-toggle-java) + (define-key map "c" 'cider-stacktrace-toggle-clj) + (define-key map "r" 'cider-stacktrace-toggle-repl) + (define-key map "t" 'cider-stacktrace-toggle-tooling) + (define-key map "d" 'cider-stacktrace-toggle-duplicates) + (define-key map "a" 'cider-stacktrace-toggle-all) + (define-key map "1" 'cider-stacktrace-cycle-cause-1) + (define-key map "2" 'cider-stacktrace-cycle-cause-2) + (define-key map "3" 'cider-stacktrace-cycle-cause-3) + (define-key map "4" 'cider-stacktrace-cycle-cause-4) + (define-key map "5" 'cider-stacktrace-cycle-cause-5) + (define-key map "0" 'cider-stacktrace-cycle-all-causes) + (define-key map [tab] 'cider-stacktrace-cycle-current-cause) + (define-key map [backtab] 'cider-stacktrace-cycle-all-causes) + (easy-menu-define cider-stacktrace-mode-menu map + "Menu for CIDER's stacktrace mode" + '("Stacktrace" + ["Previous cause" cider-stacktrace-previous-cause] + ["Next cause" cider-stacktrace-next-cause] + "--" + ["Jump to frame source" cider-stacktrace-jump] + "--" + ["Cycle current cause detail" cider-stacktrace-cycle-current-cause] + ["Cycle cause #1 detail" cider-stacktrace-cycle-cause-1] + ["Cycle cause #2 detail" cider-stacktrace-cycle-cause-2] + ["Cycle cause #3 detail" cider-stacktrace-cycle-cause-3] + ["Cycle cause #4 detail" cider-stacktrace-cycle-cause-4] + ["Cycle cause #5 detail" cider-stacktrace-cycle-cause-5] + ["Cycle all cause detail" cider-stacktrace-cycle-all-causes] + "--" + ["Show/hide Java frames" cider-stacktrace-toggle-java] + ["Show/hide Clojure frames" cider-stacktrace-toggle-clj] + ["Show/hide REPL frames" cider-stacktrace-toggle-repl] + ["Show/hide tooling frames" cider-stacktrace-toggle-tooling] + ["Show/hide duplicate frames" cider-stacktrace-toggle-duplicates] + ["Show/hide all frames" cider-stacktrace-toggle-all])) + map)) + +(define-derived-mode cider-stacktrace-mode fundamental-mode "Stacktrace" + "Major mode for filtering and navigating CIDER stacktraces. + +\\{cider-stacktrace-mode-map}" + (setq buffer-read-only t) + (setq-local truncate-lines t) + (setq-local electric-indent-chars nil) + (setq-local cider-stacktrace-prior-filters nil) + (setq-local cider-stacktrace-hidden-frame-count 0) + (setq-local cider-stacktrace-filters cider-stacktrace-default-filters) + (setq-local cider-stacktrace-cause-visibility (apply 'vector (-repeat 10 0)))) + + +;; Stacktrace filtering + +(defun cider-stacktrace-indicate-filters (filters) + "Update enabled state of filter buttons. + +Find buttons with a 'filter property; if filter is a member of FILTERS, or +if filter is nil ('show all') and the argument list is non-nil, fontify the +button as disabled. Upon finding text with a 'hidden-count property, stop +searching and update the hidden count text." + (with-current-buffer (get-buffer cider-error-buffer) + (save-excursion + (goto-char (point-min)) + (let ((inhibit-read-only t) + (get-face (lambda (hide) + (if hide + 'cider-stacktrace-filter-hidden-face + 'cider-stacktrace-filter-shown-face)))) + ;; Toggle buttons + (while (not (or (get-text-property (point) 'hidden-count) (eobp))) + (let ((button (button-at (point)))) + (when button + (let* ((filter (button-get button 'filter)) + (face (funcall get-face (if filter + (member filter filters) + filters)))) + (button-put button 'face face))) + (goto-char (or (next-property-change (point)) + (point-max))))) + ;; Update hidden count + (when (and (get-text-property (point) 'hidden-count) + (re-search-forward "[0-9]+" (line-end-position) t)) + (replace-match + (number-to-string cider-stacktrace-hidden-frame-count))))))) + +(defun cider-stacktrace-apply-filters (filters) + "Set visibility on stack frames using FILTERS. +Update `cider-stacktrace-hidden-frame-count' and indicate filters applied. +Currently collapsed stacktraces are ignored, and do not contribute to the +hidden count." + (with-current-buffer (get-buffer cider-error-buffer) + (save-excursion + (goto-char (point-min)) + (let ((inhibit-read-only t) + (hidden 0)) + (while (not (eobp)) + (unless (get-text-property (point) 'collapsed) + (let* ((flags (get-text-property (point) 'flags)) + (hide (if (-intersection filters flags) t nil))) + (when hide (setq hidden (+ 1 hidden))) + (put-text-property (point) (line-beginning-position 2) 'invisible hide))) + (forward-line 1)) + (setq cider-stacktrace-hidden-frame-count hidden))) + (cider-stacktrace-indicate-filters filters))) + +(defun cider-stacktrace-apply-cause-visibility () + "Apply `cider-stacktrace-cause-visibility' to causes and reapply filters." + (with-current-buffer (get-buffer cider-error-buffer) + (save-excursion + (goto-char (point-min)) + (cl-flet ((next-detail (end) + (-when-let (pos (next-single-property-change (point) 'detail)) + (when (< pos end) + (goto-char pos))))) + (let ((inhibit-read-only t)) + ;; For each cause... + (while (cider-stacktrace-next-cause) + (let* ((num (get-text-property (point) 'cause)) + (level (elt cider-stacktrace-cause-visibility num)) + (cause-end (cadr (cider-property-bounds 'cause)))) + ;; For each detail level within the cause, set visibility. + (while (next-detail cause-end) + (let* ((detail (get-text-property (point) 'detail)) + (detail-end (cadr (cider-property-bounds 'detail))) + (hide (if (> detail level) t nil))) + (add-text-properties (point) detail-end + (list 'invisible hide + 'collapsed hide)))))))) + (cider-stacktrace-apply-filters + cider-stacktrace-filters)))) + + +;; Interactive functions + +(defun cider-stacktrace-previous-cause () + "Move point to the previous exception cause, if one exists." + (interactive) + (with-current-buffer (get-buffer cider-error-buffer) + (-when-let (pos (previous-single-property-change (point) 'cause)) + (goto-char pos)))) + +(defun cider-stacktrace-next-cause () + "Move point to the next exception cause, if one exists." + (interactive) + (with-current-buffer (get-buffer cider-error-buffer) + (-when-let (pos (next-single-property-change (point) 'cause)) + (goto-char pos)))) + + +(defun cider-stacktrace-cycle-cause (num &optional level) + "Update element NUM of `cider-stacktrace-cause-visibility', optionally to LEVEL. +If LEVEL is not specified, its current value is incremented. When it reaches 3, +it wraps to 0." + (let ((level (or level (1+ (elt cider-stacktrace-cause-visibility num))))) + (aset cider-stacktrace-cause-visibility num (mod level 3)) + (cider-stacktrace-apply-cause-visibility))) + +(defun cider-stacktrace-cycle-all-causes () + "Cycle the visibility of all exception causes." + (interactive) + (with-current-buffer (get-buffer cider-error-buffer) + (save-excursion + ;; Find nearest cause. + (unless (get-text-property (point) 'cause) + (cider-stacktrace-next-cause) + (unless (get-text-property (point) 'cause) + (cider-stacktrace-previous-cause))) + ;; Cycle its level, and apply that to all causes. + (let* ((num (get-text-property (point) 'cause)) + (level (1+ (elt cider-stacktrace-cause-visibility num)))) + (setq-local cider-stacktrace-cause-visibility + (apply 'vector (-repeat 10 (mod level 3)))) + (cider-stacktrace-apply-cause-visibility))))) + +(defun cider-stacktrace-cycle-current-cause () + "Cycle the visibility of current exception at point, if any." + (interactive) + (with-current-buffer (get-buffer cider-error-buffer) + (-when-let (num (get-text-property (point) 'cause)) + (cider-stacktrace-cycle-cause num)))) + +(defun cider-stacktrace-cycle-cause-1 () + "Cycle the visibility of exception cause #1." + (interactive) + (cider-stacktrace-cycle-cause 1)) + +(defun cider-stacktrace-cycle-cause-2 () + "Cycle the visibility of exception cause #2." + (interactive) + (cider-stacktrace-cycle-cause 2)) + +(defun cider-stacktrace-cycle-cause-3 () + "Cycle the visibility of exception cause #3." + (interactive) + (cider-stacktrace-cycle-cause 3)) + +(defun cider-stacktrace-cycle-cause-4 () + "Cycle the visibility of exception cause #4." + (interactive) + (cider-stacktrace-cycle-cause 4)) + +(defun cider-stacktrace-cycle-cause-5 () + "Cycle the visibility of exception cause #5." + (interactive) + (cider-stacktrace-cycle-cause 5)) + + +(defun cider-stacktrace-toggle-all () + "Reset `cider-stacktrace-filters' if present; otherwise restore prior filters." + (interactive) + (when cider-stacktrace-filters + (setq-local cider-stacktrace-prior-filters + cider-stacktrace-filters)) + (cider-stacktrace-apply-filters + (setq cider-stacktrace-filters + (unless cider-stacktrace-filters ; when current filters are nil, + cider-stacktrace-prior-filters)))) ; reenable prior filter set + +(defun cider-stacktrace-toggle (flag) + "Update `cider-stacktrace-filters' to add or remove FLAG, and apply filters." + (cider-stacktrace-apply-filters + (setq cider-stacktrace-filters + (if (memq flag cider-stacktrace-filters) + (remq flag cider-stacktrace-filters) + (cons flag cider-stacktrace-filters))))) + +(defun cider-stacktrace-toggle-java () + "Toggle display of Java stack frames." + (interactive) + (cider-stacktrace-toggle 'java)) + +(defun cider-stacktrace-toggle-clj () + "Toggle display of Clojure stack frames." + (interactive) + (cider-stacktrace-toggle 'clj)) + +(defun cider-stacktrace-toggle-repl () + "Toggle display of REPL stack frames." + (interactive) + (cider-stacktrace-toggle 'repl)) + +(defun cider-stacktrace-toggle-tooling () + "Toggle display of Tooling stack frames (compiler, nREPL middleware, etc)." + (interactive) + (cider-stacktrace-toggle 'tooling)) + +(defun cider-stacktrace-toggle-duplicates () + "Toggle display of stack frames that are duplicates of their descendents." + (interactive) + (cider-stacktrace-toggle 'dup)) + + +;; Text button functions + +(defun cider-stacktrace-filter (button) + "Apply filter(s) indicated by the BUTTON." + (with-temp-message "Filters may also be toggled with the keyboard." + (let ((flag (button-get button 'filter))) + (if flag + (cider-stacktrace-toggle flag) + (cider-stacktrace-toggle-all))) + (sit-for 5))) + +(defun cider-stacktrace-navigate (button) + "Navigate to the stack frame source represented by the BUTTON." + (let ((var (button-get button 'var)) + (class (button-get button 'class)) + (method (button-get button 'method)) + (line (button-get button 'line))) + (-if-let* ((info (if var + (cider-var-info var) + (cider-member-info class method))) + (file (cadr (assoc "file" info))) + (buffer (cider-find-file file))) + (cider-jump-to buffer line) + (message "No source info")))) + +(defun cider-stacktrace-jump () + "Like `cider-jump', but uses the stack frame source at point, if available." + (interactive) + (let ((button (button-at (point)))) + (if (and button (button-get button 'line)) + (cider-stacktrace-navigate button) + (call-interactively 'cider-jump)))) + + +;; Rendering + +(defun cider-stacktrace-emit-indented (text indent &optional fill) + "Insert TEXT, and INDENT and optionally FILL the entire block." + (let ((beg (point))) + (insert text) + (goto-char beg) + (while (not (eobp)) + (insert indent) + (forward-line)) + (when (and fill cider-stacktrace-fill-column) + (when (and (numberp cider-stacktrace-fill-column)) + (setq-local fill-column cider-stacktrace-fill-column)) + (setq-local fill-prefix indent) + (fill-region beg (point))))) + +(defun cider-stacktrace-render-filters (buffer filters) + "Emit into BUFFER toggle buttons for each of the FILTERS." + (with-current-buffer buffer + (insert " Show: ") + (dolist (filter filters) + (insert-text-button (first filter) + 'filter (second filter) + 'follow-link t + 'action 'cider-stacktrace-filter + 'help-echo (format "Toggle %s stack frames" + (first filter))) + (insert " ")) + (let ((hidden "(0 frames hidden)")) + (put-text-property 0 (length hidden) 'hidden-count t hidden) + (insert " " hidden)) + (newline))) + +(defun cider-stacktrace-render-frame (buffer frame) + "Emit into BUFFER function call site info for the stack FRAME. +This associates text properties to enable filtering and source navigation." + (with-current-buffer buffer + (nrepl-dbind-response frame (file line flags class method name var ns fn) + (let ((flags (mapcar 'intern flags))) ; strings -> symbols + (insert-text-button (format "%30s:%5d %s/%s" + (if (member 'repl flags) "REPL" file) line + (if (member 'clj flags) ns class) + (if (member 'clj flags) fn method)) + 'var var 'class class 'method method + 'name name 'line line 'flags flags + 'follow-link t + 'action 'cider-stacktrace-navigate + 'help-echo "View source at this location" + 'face 'cider-stacktrace-face) + (save-excursion + (let ((p4 (point)) + (p1 (search-backward " ")) + (p2 (search-forward "/")) + (p3 (search-forward-regexp "[^/$]+"))) + (put-text-property p1 p4 'face 'cider-stacktrace-ns-face) + (put-text-property p2 p3 'face 'cider-stacktrace-fn-face))) + (newline))))) + +(defun cider-stacktrace-render-cause (buffer cause num note) + "Emit into BUFFER the CAUSE NUM, exception class, message, data, and NOTE." + (with-current-buffer buffer + (nrepl-dbind-response cause (class message data stacktrace) + (let ((indent " ") + (class-face 'cider-stacktrace-error-class-face) + (message-face 'cider-stacktrace-error-message-face)) + (cider-propertize-region `(cause ,num) + ;; Detail level 0: exception class + (cider-propertize-region '(detail 0) + (insert (format "%d. " num) + (propertize note 'face 'font-lock-comment-face) " " + (propertize class 'face class-face)) + (newline)) + ;; Detail level 1: message + ex-data + (cider-propertize-region '(detail 1) + (cider-stacktrace-emit-indented + (propertize (or message "(No message)") 'face message-face) indent t) + (newline) + (when data + (cider-stacktrace-emit-indented + (cider-font-lock-as-clojure data) indent nil))) + ;; Detail level 2: stacktrace + (cider-propertize-region '(detail 2) + (newline) + (let ((beg (point)) + (bg `(:background ,cider-stacktrace-frames-background-color))) + (dolist (frame stacktrace) + (cider-stacktrace-render-frame buffer frame)) + (overlay-put (make-overlay beg (point)) 'face bg))) + ;; Add line break between causes, even when collapsed. + (cider-propertize-region '(detail 0) + (newline))))))) + +(defun cider-stacktrace-initialize (causes) + "Set and apply CAUSES initial visibility, filters, and cursor position." + ;; Partially display outermost cause if it's a compiler exception (the + ;; description reports reader location of the error). + (nrepl-dbind-response (first causes) (class) + (when (equal class "clojure.lang.Compiler$CompilerException") + (cider-stacktrace-cycle-cause (length causes) 1))) + ;; Fully display innermost cause. This also applies visibility/filters. + (cider-stacktrace-cycle-cause 1 cider-stacktrace-detail-max) + ;; Move point to first stacktrace frame in displayed cause. + (goto-char (point-min)) + (while (cider-stacktrace-next-cause)) + (goto-char (next-single-property-change (point) 'flags))) + +(defun cider-stacktrace-render (buffer causes) + "Emit into BUFFER useful stacktrace information for the CAUSES." + (with-current-buffer buffer + (cider-stacktrace-mode) + (let ((inhibit-read-only t)) + (newline) + ;; Stacktrace filters + (cider-stacktrace-render-filters + buffer + `(("Clojure" clj) ("Java" java) ("REPL" repl) + ("Tooling" tooling) ("Duplicates" dup) ("All" ,nil))) + (newline) + ;; Stacktrace exceptions & frames + (let ((num (length causes))) + (dolist (cause causes) + (let ((note (if (= num (length causes)) "Unhandled" "Caused by"))) + (cider-stacktrace-render-cause buffer cause num note) + (setq num (1- num)))))) + (cider-stacktrace-initialize causes) + (font-lock-refresh-defaults))) + +(provide 'cider-stacktrace) + +;;; cider-stacktrace.el ends here diff --git a/elpa/cider-0.7.0/cider-stacktrace.elc b/elpa/cider-0.7.0/cider-stacktrace.elc new file mode 100644 index 000000000..c905d9c4d Binary files /dev/null and b/elpa/cider-0.7.0/cider-stacktrace.elc differ diff --git a/elpa/cider-0.7.0/cider-test.el b/elpa/cider-0.7.0/cider-test.el new file mode 100644 index 000000000..3a7552436 --- /dev/null +++ b/elpa/cider-0.7.0/cider-test.el @@ -0,0 +1,449 @@ +;;; cider-test.el --- Test result viewer -*- lexical-binding: t -*- + +;; Copyright © 2014 Jeff Valk + +;; Author: Jeff Valk + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; This provides execution, reporting, and navigation support for Clojure tests, +;; specifically using the `clojure.test' machinery. This functionality replaces +;; the venerable `clojure-test-mode' (deprecated in June 2014), and relies on +;; nREPL middleware for report running and session support. + +;;; Code: + +(require 'cider-util) +(require 'cider-stacktrace) +(require 'button) +(require 'dash) +(require 'easymenu) + +;;; Variables + +(defgroup cider-test nil + "Presentation and navigation for test results." + :prefix "cider-test-" + :group 'cider) + +(defvar cider-test-last-test-ns nil + "The namespace for which tests were last run.") + +(defvar cider-test-last-results nil + "The results of the last run test.") + +(defconst cider-test-report-buffer "*cider-test-report*" + "Buffer name in which to display test reports.") + + +;;; Faces +;; These are as defined in clojure-test-mode. + +(defface cider-test-failure-face + '((((class color) (background light)) + :background "orange red") + (((class color) (background dark)) + :background "firebrick")) + "Face for failed tests." + :group 'cider-test + :package-version '(cider . "0.7.0")) + +(defface cider-test-error-face + '((((class color) (background light)) + :background "orange1") + (((class color) (background dark)) + :background "orange4")) + "Face for erring tests." + :group 'cider-test + :package-version '(cider . "0.7.0")) + +(defface cider-test-success-face + '((((class color) (background light)) + :foreground "black" + :background "green") + (((class color) (background dark)) + :foreground "black" + :background "green")) + "Face for passing tests." + :group 'cider-test + :package-version '(cider . "0.7.0")) + + +;;; Report mode & key bindings +;; The primary mode of interacting with test results is the report buffer, which +;; allows navigation among tests, jumping to test definitions, expected/actual +;; diff-ing, and cause/stacktrace inspection for test errors. + +(defvar cider-test-report-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c ,") 'cider-test-run-tests) + (define-key map (kbd "C-c C-,") 'cider-test-rerun-tests) + (define-key map (kbd "C-c M-,") 'cider-test-run-test) + (define-key map (kbd "M-p") 'cider-test-previous-result) + (define-key map (kbd "M-n") 'cider-test-next-result) + (define-key map (kbd "M-.") 'cider-test-jump) + (define-key map (kbd "t") 'cider-test-jump) + (define-key map (kbd "d") 'cider-test-ediff) + (define-key map (kbd "e") 'cider-test-stacktrace) + (define-key map "q" 'cider-popup-buffer-quit-function) + (define-key map (kbd "") 'backward-button) + (define-key map (kbd "TAB") 'forward-button) + (easy-menu-define cider-test-report-mode-menu map + "Menu for CIDER's test result mode" + '("Test-Report" + ["Previous result" cider-test-previous-result] + ["Next result" cider-test-next-result] + "--" + ["Rerun current test" cider-test-run-test] + ["Rerun failed/erring tests" cider-test-rerun-tests] + ["Rerun all tests" cider-test-run-tests] + "--" + ["Jump to test definition" cider-test-jump] + ["Display test error" cider-test-stacktrace] + ["Display expected/actual diff" cider-test-ediff])) + map)) + +(define-derived-mode cider-test-report-mode fundamental-mode "Test Report" + "Major mode for presenting Clojure test results. + +\\{cider-test-report-mode-map}" + (setq buffer-read-only t) + (setq-local truncate-lines t) + (setq-local electric-indent-chars nil)) + +;; Report navigation + +(defun cider-test-show-report () + "Show the test report buffer, if one exists." + (interactive) + (-if-let (report-buffer (get-buffer cider-test-report-buffer)) + (switch-to-buffer report-buffer) + (message "No test report buffer"))) + +(defun cider-test-previous-result () + "Move point to the previous test result, if one exists." + (interactive) + (with-current-buffer (get-buffer cider-test-report-buffer) + (-when-let (pos (previous-single-property-change (point) 'type)) + (goto-char pos)))) + +(defun cider-test-next-result () + "Move point to the next test result, if one exists." + (interactive) + (with-current-buffer (get-buffer cider-test-report-buffer) + (-when-let (pos (next-single-property-change (point) 'type)) + (goto-char pos)))) + +(defun cider-test-jump () + "Like `cider-jump', but uses the test at point's definition, if available." + (interactive) + (let ((ns (get-text-property (point) 'ns)) + (var (get-text-property (point) 'var)) + (line (get-text-property (point) 'line))) + (if (and ns var) + (cider-jump-to-var (concat ns "/" var) line) + (call-interactively 'cider-jump)))) + + +;;; Error stacktraces + +(defun cider-test-stacktrace-for (ns var index) + "Display stacktrace for the erring NS VAR test with the assertion INDEX." + (let (causes) + (nrepl-send-request + (list "op" "test-stacktrace" "session" (nrepl-current-session) + "ns" ns "var" var "index" index) + (lambda (response) + (nrepl-dbind-response response (class status) + (cond (class (setq causes (cons response causes))) + (status (when causes + (cider-stacktrace-render + (cider-popup-buffer cider-error-buffer + cider-auto-select-error-buffer) + (reverse causes)))))))))) + +(defun cider-test-stacktrace (&optional button) + "Display stacktrace for the erring test at point, optionally from BUTTON." + (interactive) + (let ((ns (get-text-property (point) 'ns)) + (var (get-text-property (point) 'var)) + (index (get-text-property (point) 'index)) + (err (get-text-property (point) 'error))) + (if (and err ns var index) + (cider-test-stacktrace-for ns var index) + (message "No test error at point")))) + + +;;; Expected vs actual diffing + +(defvar cider-test-ediff-buffers nil + "The expected/actual buffers used to display diff.") + +(defun cider-test-ediff () + "Show diff of the expected vs actual value for the test at point. +With the actual value, the outermost '(not ...)' s-expression is removed." + (interactive) + (let ((expected (get-text-property (point) 'expected)) + (actual (get-text-property (point) 'actual))) + (if (and expected actual) + (let ((expected-buffer (generate-new-buffer " *expected*")) + (actual-buffer (generate-new-buffer " *actual*"))) + (with-current-buffer expected-buffer + (insert expected) + (clojure-mode)) + (with-current-buffer actual-buffer + (insert actual) + (goto-char (point-min)) + (forward-char) + (forward-sexp) + (forward-whitespace 1) + (let ((beg (point))) + (forward-sexp) + (let ((actual* (buffer-substring beg (point)))) + (erase-buffer) + (insert actual*))) + (clojure-mode)) + (apply 'ediff-buffers + (setq cider-test-ediff-buffers + (list (buffer-name expected-buffer) + (buffer-name actual-buffer))))) + (message "No test failure at point")))) + +(defun cider-test-ediff-cleanup () + "Cleanup expected/actual buffers used for diff." + (interactive) + (mapc (lambda (b) (when (get-buffer b) (kill-buffer b))) + cider-test-ediff-buffers)) + +(add-hook 'ediff-cleanup-hook 'cider-test-ediff-cleanup) + + +;;; Report rendering + +(defun cider-test-type-face (type) + "Return the font lock face for the test result TYPE." + (pcase type + ("pass" 'cider-test-success-face) + ("fail" 'cider-test-failure-face) + ("error" 'cider-test-error-face) + (t 'default))) + +(defun cider-test-render-summary (buffer summary) + "Emit into BUFFER the report SUMMARY statistics." + (with-current-buffer buffer + (nrepl-dbind-response summary (var test pass fail error) + (insert (format "Ran %d tests, in %d test functions\n" test var)) + (unless (zerop fail) + (cider-insert (format "%d failures" fail) 'cider-test-failure-face t)) + (unless (zerop error) + (cider-insert (format "%d errors" error) 'cider-test-error-face t)) + (when (= pass test) + (cider-insert (format "%d passed" pass) 'cider-test-success-face t)) + (newline) + (newline)))) + +(defun cider-test-render-assertion (buffer test) + "Emit into BUFFER report detail for the TEST assertion." + (with-current-buffer buffer + (nrepl-dbind-response test (var context type message expected actual error) + (cider-propertize-region (cider--dict-to-plist test) + (cider-insert (capitalize type) (cider-test-type-face type) nil " in ") + (cider-insert var 'font-lock-function-name-face t) + (when context (cider-insert context 'font-lock-doc-face t)) + (when message (cider-insert message 'font-lock-doc-string-face t)) + (when expected (cider-insert "expected: " 'font-lock-comment-face nil + (cider-font-lock-as-clojure expected))) + (when actual (cider-insert " actual: " 'font-lock-comment-face) + (if error + (progn (insert-text-button + error + 'follow-link t + 'action 'cider-test-stacktrace + 'help-echo "View causes and stacktrace") + (newline)) + (insert (cider-font-lock-as-clojure actual))))) + (newline)))) + +(defun cider-test-render-report (buffer ns summary results) + "Emit into BUFFER the report for the NS, SUMMARY, and test RESULTS." + (with-current-buffer buffer + (let ((inhibit-read-only t)) + (cider-test-report-mode) + (cider-insert "Test Summary" 'bold t) + (cider-insert ns 'font-lock-function-name-face t "\n") + (cider-test-render-summary buffer summary) + (nrepl-dbind-response summary (fail error) + (unless (zerop (+ fail error)) + (cider-insert "Results" 'bold t "\n") + (dolist (result (rest results)) + (let ((var (first result)) + (tests (rest result))) + (dolist (test tests) + (nrepl-dbind-response test (type) + (unless (equal "pass" type) + (cider-test-render-assertion buffer test)))))))) + (goto-char (point-min)) + (current-buffer)))) + + +;;; Summary echo + +(defun cider-test-echo-summary (summary) + "Echo SUMMARY statistics for a test run." + (nrepl-dbind-response summary (test fail error) + (message + (propertize + (format "Ran %s tests. %s failures, %s errors." test fail error) + 'face (cond ((not (zerop error)) 'cider-test-error-face) + ((not (zerop fail)) 'cider-test-failure-face) + (t 'cider-test-success-face)))))) + + +;;; Test definition highlighting +;; On receipt of test results, failing/erring test definitions are highlighted. +;; Highlights are cleared on the next report run, and may be cleared manually +;; by the user. + +;; NOTE If keybindings specific to test sources are desired, it would be +;; straightforward to turn this into a `cider-test-mode' minor mode, which we +;; enable on test sources, much like the legacy `clojure-test-mode'. At present, +;; though, there doesn't seem to be much value in this, since the report buffer +;; provides the primary means of interacting with test results. + +(defun cider-test-highlight-problem (buffer test) + "Highlight the BUFFER test definition for the non-passing TEST." + (with-current-buffer buffer + (nrepl-dbind-response test (type line message expected actual) + (save-excursion + (goto-line line) + (forward-whitespace 1) + (forward-char) + (let ((beg (point))) + (forward-sexp) + (let ((overlay (make-overlay beg (point)))) + (overlay-put overlay 'face (cider-test-type-face type)) + (overlay-put overlay 'type type) + (overlay-put overlay 'help-echo message) + (overlay-put overlay 'message message) + (overlay-put overlay 'expected expected) + (overlay-put overlay 'actual actual))))))) + +(defun cider-test-highlight-problems (ns results) + "Highlight all non-passing tests in the NS test RESULTS." + (dolist (result (rest results)) + (-when-let* ((var (first result)) + (tests (rest result)) + (buffer (cider-find-var (concat ns "/" var)))) + (dolist (test tests) + (nrepl-dbind-response test (type) + (unless (equal "pass" type) + (cider-test-highlight-problem buffer test))))))) + +(defun cider-test-clear-highlights () + "Clear highlighting of non-passing tests from the last test run." + (interactive) + (-when-let (ns cider-test-last-test-ns) + (dolist (result (rest cider-test-last-results)) + (-when-let* ((var (first result)) + (buffer (cider-find-var (concat ns "/" var)))) + (with-current-buffer buffer + (remove-overlays)))))) + + +;;; Test namespaces +;; Test namespace inference exists to enable DWIM test running functions: the +;; same "run-tests" function should be able to be used in a source file, and in +;; its corresponding test namespace. To provide this, we need to map the +;; relationship between those namespaces. + +(defvar cider-test-infer-test-ns 'cider-test-default-test-ns-fn + "Function to infer the test namespace for NS. +The default implementation uses the simple Leiningen convention of appending +'-test' to the namespace name.") + +(defun cider-test-default-test-ns-fn (ns) + "For a NS, return the test namespace, which may be the argument itself. +This uses the Leiningen convention of appending '-test' to the namespace name." + (when ns + (let ((suffix "-test")) + ;; string-suffix-p is only available in Emacs 24.4+ + (if (string-match (rx-to-string `(: ,suffix eos) t) ns) + ns + (concat ns suffix))))) + + +;;; Test execution + +(defun cider-test-execute (ns &optional retest tests) + "Run tests for NS; optionally RETEST failures or run only specified TESTS. +Upon test completion, results are echoed and a test report is optionally +displayed. When test failures/errors occur, their sources are highlighted." + (cider-test-clear-highlights) + (message "Testing...") + (nrepl-send-request + (list "ns" ns "op" (if retest "retest" "test") + "tests" tests "session" (nrepl-current-session)) + (lambda (response) + (nrepl-dbind-response response (summary results status) + (cond ((member "namespace-not-found" status) + (message "No tests namespace: %s" ns)) + (results + (progn + (setq cider-test-last-test-ns ns) + (setq cider-test-last-results results) + (cider-test-highlight-problems ns results) + (cider-test-echo-summary summary) + (cider-test-render-report + (cider-popup-buffer cider-test-report-buffer t) + ns summary results)))))))) + +(defun cider-test-rerun-tests () + "Rerun failed and erring tests from the last tested namespace." + (interactive) + (-if-let (ns cider-test-last-test-ns) + (cider-test-execute ns t) + (message "No namespace to retest"))) + +(defun cider-test-run-tests () + "Run all tests for the current Clojure source or test report context." + (interactive) + (-if-let (ns (or (funcall cider-test-infer-test-ns (clojure-find-ns)) + (when (eq major-mode 'cider-test-report-mode) + cider-test-last-test-ns))) + (cider-test-execute ns nil) + (message "No namespace to test in current context"))) + +(defun cider-test-run-test () + "Run the test at point. +The test ns/var exist as text properties on report items and on highlighted +failed/erred test definitions. When not found, a test definition at point +is searched." + (interactive) + (let ((ns (get-text-property (point) 'ns)) + (var (get-text-property (point) 'var))) + (if (and ns var) + (cider-test-execute ns nil (list var)) + (let ((ns (clojure-find-ns)) + (def (clojure-find-def))) + (if (and ns (member (first def) '("deftest" "defspec"))) + (cider-test-execute ns nil (rest def)) + (message "No test at point")))))) + +(provide 'cider-test) + +;;; cider-test.el ends here diff --git a/elpa/cider-0.7.0/cider-test.elc b/elpa/cider-0.7.0/cider-test.elc new file mode 100644 index 000000000..850ea4587 Binary files /dev/null and b/elpa/cider-0.7.0/cider-test.elc differ diff --git a/elpa/cider-0.7.0/cider-util.el b/elpa/cider-0.7.0/cider-util.el new file mode 100644 index 000000000..3f7f36d58 --- /dev/null +++ b/elpa/cider-0.7.0/cider-util.el @@ -0,0 +1,194 @@ +;;; cider-util.el --- Common utility functions that don't belong anywhere else -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Common utility functions that don't belong anywhere else + +;;; Code: + +(require 'dash) +(require 'cl-lib) + +;;; Compatibility +(eval-and-compile + ;; `defvar-local' for Emacs 24.2 and below + (unless (fboundp 'defvar-local) + (defmacro defvar-local (var val &optional docstring) + "Define VAR as a buffer-local variable with default value VAL. +Like `defvar' but additionally marks the variable as being automatically +buffer-local wherever it is set." + (declare (debug defvar) (doc-string 3)) + `(progn + (defvar ,var ,val ,docstring) + (make-variable-buffer-local ',var)))) + + ;; `setq-local' for Emacs 24.2 and below + (unless (fboundp 'setq-local) + (defmacro setq-local (var val) + "Set variable VAR to value VAL in current buffer." + `(set (make-local-variable ',var) ,val)))) + +(defun cider-util--hash-keys (hashtable) + "Return a list of keys in HASHTABLE." + (let ((keys '())) + (maphash (lambda (k _v) (setq keys (cons k keys))) hashtable) + keys)) + +(defun cider-util--clojure-buffers () + "Return a list of all existing `clojure-mode' buffers." + (-filter + (lambda (buffer) (with-current-buffer buffer (derived-mode-p 'clojure-mode))) + (buffer-list))) + +;;; Text properties + +(defmacro cider-propertize-region (props &rest body) + "Execute BODY and add PROPS to all the text it inserts. +More precisely, PROPS are added to the region between the point's +positions before and after executing BODY." + (let ((start (cl-gensym))) + `(let ((,start (point))) + (prog1 (progn ,@body) + (add-text-properties ,start (point) ,props))))) + +(put 'cider-propertize-region 'lisp-indent-function 1) + +(defun cider-property-bounds (prop) + "Return the the positions of the previous and next change to PROP. +PROP is the name of a text property." + (assert (get-text-property (point) prop)) + (let ((end (next-single-char-property-change (point) prop))) + (list (previous-single-char-property-change end prop) end))) + +(defun cider-insert (text &optional face break more-text) + "Insert TEXT with FACE, optionally followed by a line BREAK and MORE-TEXT." + (insert (if face (propertize text 'face face) text)) + (when more-text (insert more-text)) + (when break (insert "\n"))) + +;;; Font lock + +(defun cider-font-lock-as (mode string) + "Use MODE to font-lock the STRING." + (with-temp-buffer + (insert string) + ;; suppress major mode hooks as we care only about their font-locking + ;; otherwise modes like whitespace-mode and paredit might interfere + (let ((delay-mode-hooks t) + (delayed-mode-hooks nil)) + (funcall mode)) + (font-lock-fontify-buffer) + (buffer-string))) + +(defun cider-font-lock-region-as (mode beg end &optional buffer) + "Use MODE to font-lock text between BEG and END. + +Unless you specify a BUFFER it will default to the current one." + (with-current-buffer (or buffer (current-buffer)) + (let ((text (buffer-substring beg end))) + (delete-region beg end) + (goto-char beg) + (insert (cider-font-lock-as mode text))))) + +(defun cider-font-lock-as-clojure (string) + "Font-lock STRING as Clojure code." + (cider-font-lock-as 'clojure-mode string)) + +;; More efficient way to fontify a region, without having to delete it +;; Unfortunately still needs work, since the font-locking code in clojure-mode +;; is pretty convoluted +(defun cider-fontify-region + (beg end keywords syntax-table syntactic-keywords syntax-propertize-fn) + "Fontify a region between BEG and END using another mode's fontification. + +KEYWORDS, SYNTAX-TABLE, SYNTACTIC-KEYWORDS and +SYNTAX-PROPERTIZE-FN are the values of that mode's +`font-lock-keywords', `font-lock-syntax-table', +`font-lock-syntactic-keywords', and `syntax-propertize-function' +respectively." + (save-excursion + (save-match-data + (let ((font-lock-keywords keywords) + (font-lock-syntax-table syntax-table) + (font-lock-syntactic-keywords syntactic-keywords) + (syntax-propertize-function syntax-propertize-fn) + (font-lock-multiline 'undecided) + (font-lock-dont-widen t) + font-lock-keywords-only + font-lock-extend-region-functions + font-lock-keywords-case-fold-search) + (save-restriction + (narrow-to-region (1- beg) end) + ;; font-lock-fontify-region apparently isn't inclusive, + ;; so we have to move the beginning back one char + (font-lock-fontify-region (1- beg) end)))))) + +(defun cider-fontify-region-as-clojure (beg end) + "Use Clojure's font-lock variables to fontify the region between BEG and END." + (cider-fontify-region beg end + clojure-font-lock-keywords + clojure-mode-syntax-table + nil + nil)) + +;;; Colors + +(defun cider-scale-color (color scale) + "For a COLOR hex string or name, adjust intensity of RGB components by SCALE." + (let* ((rgb (color-values color)) + (scaled-rgb (mapcar (lambda (n) + (format "%04x" (round (+ n (* scale 65535))))) + rgb))) + (apply 'concat "#" scaled-rgb))) + +(defun cider-scale-background-color () + "Scale the current background color to get a slighted muted version." + (let ((color (frame-parameter nil 'background-color)) + (dark (eq (frame-parameter nil 'background-mode) 'dark))) + (cider-scale-color color (if dark 0.05 -0.05)))) + +(defun cider-format-pprint-eval (form) + "Return a string of Clojure code that will eval and pretty-print FORM." + (format "(let [x %s] (clojure.pprint/pprint x) x)" form)) + +(autoload 'pkg-info-version-info "pkg-info.el") + +(defun cider--version () + "Retrieve CIDER's version." + (condition-case nil + (pkg-info-version-info 'cider) + (error cider-version))) + +;;; Strings + +(defun cider-string-join (strings &optional separator) + "Join all STRINGS using SEPARATOR." + (mapconcat 'identity strings separator)) + +(provide 'cider-util) + +;;; cider-util.el ends here diff --git a/elpa/cider-0.7.0/cider-util.elc b/elpa/cider-0.7.0/cider-util.elc new file mode 100644 index 000000000..0dd5e3944 Binary files /dev/null and b/elpa/cider-0.7.0/cider-util.elc differ diff --git a/elpa/cider-0.7.0/cider.el b/elpa/cider-0.7.0/cider.el new file mode 100644 index 000000000..b83117b90 --- /dev/null +++ b/elpa/cider-0.7.0/cider.el @@ -0,0 +1,192 @@ +;;; cider.el --- Clojure Integrated Development Environment and REPL -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell +;; URL: http://www.github.com/clojure-emacs/cider +;; Version: 0.7.0 +;; Package-Requires: ((clojure-mode "2.0.0") (cl-lib "0.3") (dash "2.4.1") (pkg-info "0.4") (emacs "24")) +;; Keywords: languages, clojure, cider + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Provides a Clojure IDE and REPL for Emacs, built on top of nREPL. + +;;; Installation: + +;; Available as a package in marmalade-repo.org and melpa.milkbox.net. + +;; (add-to-list 'package-archives +;; '("marmalade" . "http://marmalade-repo.org/packages/")) +;; +;; or +;; +;; (add-to-list 'package-archives +;; '("melpa" . "http://melpa.milkbox.net/packages/") t) +;; +;; M-x package-install cider + +;;; Usage: + +;; M-x cider-jack-in + +;;; Code: + +(defgroup cider nil + "Clojure Integrated Development Environment and REPL." + :prefix "cider-" + :group 'applications + :link '(url-link :tag "Github" "https://github.com/clojure-emacs/cider") + :link '(emacs-commentary-link :tag "Commentary" "cider")) + +(require 'cider-client) +(require 'cider-interaction) +(require 'cider-eldoc) +(require 'cider-repl) +(require 'cider-mode) +(require 'cider-util) + +(defvar cider-version "0.7.0" + "Fallback version used when it cannot be extracted automatically. +Normally it won't be used, unless `pkg-info' fails to extract the +version from the CIDER package or library.") + +(defcustom cider-lein-command + "lein" + "The command used to execute Leiningen 2.x." + :type 'string + :group 'cider) + +(defcustom cider-lein-parameters + "repl :headless" + "Params passed to lein to start an nREPL server via `cider-jack-in'." + :type 'string + :group 'cider) + +(defcustom cider-known-endpoints nil + "Specify a list of custom endpoints where each endpoint is a list. +For example: '((\"label\" \"host\" \"port\")). +The label is optional so that '(\"host\" \"port\") will suffice. +This variable is used by `cider-connect'." + :type 'list + :group 'cider) + +;; TODO: Implement a check for `cider-lein-command' over tramp +(defun cider--lein-present-p () + "Check if `cider-lein-command' is on the `exec-path'. + +In case `default-directory' is non-local we assume the command is available." + (or (file-remote-p default-directory) + (executable-find cider-lein-command) + (executable-find (concat cider-lein-command ".bat")))) + +;;;###autoload +(defun cider-version () + "Display CIDER's version." + (interactive) + (message "CIDER %s" (cider--version))) + +;;;###autoload +(defun cider-jack-in (&optional prompt-project) + "Start a nREPL server for the current project and connect to it. +If PROMPT-PROJECT is t, then prompt for the project for which to +start the server." + (interactive "P") + (setq cider-current-clojure-buffer (current-buffer)) + (if (cider--lein-present-p) + (let* ((project (when prompt-project + (read-directory-name "Project: "))) + (project-dir (nrepl-project-directory-for + (or project (nrepl-current-dir)))) + (server-command (if prompt-project + (read-string (format "Server command: %s " cider-lein-command) cider-lein-parameters) + cider-lein-parameters))) + (when (nrepl-check-for-repl-buffer nil project-dir) + (let* ((nrepl-project-dir project-dir) + (cmd (format "%s %s" cider-lein-command cider-lein-parameters)) + (default-directory (or project-dir default-directory)) + (nrepl-buffer-name (generate-new-buffer-name + (nrepl-server-buffer-name))) + (process + (progn + ;; the buffer has to be created before the proc: + (get-buffer-create nrepl-buffer-name) + (start-file-process-shell-command + "nrepl-server" + nrepl-buffer-name + cmd)))) + (set-process-filter process 'nrepl-server-filter) + (set-process-sentinel process 'nrepl-server-sentinel) + (set-process-coding-system process 'utf-8-unix 'utf-8-unix) + (with-current-buffer (process-buffer process) + (setq nrepl-project-dir project-dir)) + (message "Starting nREPL server via %s..." + (propertize cmd 'face 'font-lock-keyword-face))))) + (message "The %s executable (specified by `cider-lein-command') isn't on your exec-path" cider-lein-command))) + +(defun cider-known-endpoint-candidates () + "Known endpoint candidates for establishing an nREPL connection. +A default will be included consisting of `nrepl-default-host' and +`nrepl-default-port'." + (-distinct + (mapcar (lambda (endpoint) + (cider-string-join endpoint " ")) + (cons (list (nrepl-current-host) (nrepl-default-port)) + cider-known-endpoints)))) + +(defun cider-select-known-endpoint () + "Select an endpoint from known endpoints. +The returned endpoint has the label removed." + (let ((selected-endpoint (split-string + (completing-read + "Host: " (cider-known-endpoint-candidates))))) + (if (= 3 (length selected-endpoint)) + (cdr selected-endpoint) + selected-endpoint))) + +;;;###autoload +(defun cider-connect (host port) + "Connect to an nREPL server identified by HOST and PORT." + (interactive (let ((known-endpoint (when cider-known-endpoints + (cider-select-known-endpoint)))) + (list (or (car known-endpoint) + (read-string "Host: " (nrepl-current-host) nil (nrepl-current-host))) + (string-to-number (let ((port (or (cadr known-endpoint) (nrepl-default-port)))) + (read-string "Port: " port nil port)))))) + (setq cider-current-clojure-buffer (current-buffer)) + (when (nrepl-check-for-repl-buffer `(,host ,port) nil) + (nrepl-connect host port))) + +(define-obsolete-function-alias + 'cider + 'cider-connect) + +;;;###autoload +(eval-after-load 'clojure-mode + '(progn + (define-key clojure-mode-map (kbd "C-c M-j") 'cider-jack-in) + (define-key clojure-mode-map (kbd "C-c M-c") 'cider-connect))) + +(provide 'cider) + +;;; cider.el ends here diff --git a/elpa/cider-0.7.0/cider.elc b/elpa/cider-0.7.0/cider.elc new file mode 100644 index 000000000..76262b706 Binary files /dev/null and b/elpa/cider-0.7.0/cider.elc differ diff --git a/elpa/cider-0.7.0/nrepl-client.el b/elpa/cider-0.7.0/nrepl-client.el new file mode 100644 index 000000000..5154a81d6 --- /dev/null +++ b/elpa/cider-0.7.0/nrepl-client.el @@ -0,0 +1,993 @@ +;;; nrepl-client.el --- Client for Clojure nREPL -*- lexical-binding: t -*- + +;; Copyright © 2012-2014 Tim King, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Provides an Emacs Lisp client to connect to Clojure nREPL servers. + +;;; Code: +(require 'clojure-mode) +(require 'dash) +(require 'thingatpt) +(require 'etags) +(require 'ansi-color) +(require 'ewoc) +(require 'cl-lib) +(require 'cider-util) + + +(defgroup nrepl nil + "Interaction with the Clojure nREPL Server." + :prefix "nrepl-" + :group 'applications) + +(defcustom nrepl-buffer-name-separator " " + "Used in constructing the REPL buffer name. +The `nrepl-buffer-name-separator' separates cider-repl from the project name." + :type '(string) + :group 'nrepl) + +(defcustom nrepl-buffer-name-show-port nil + "Show the connection port in the nrepl REPL buffer name, if set to t." + :type 'boolean + :group 'nrepl) + +(defcustom nrepl-connected-hook nil + "List of functions to call when connecting to the nREPL server." + :type 'hook + :group 'nrepl) + +(defcustom nrepl-disconnected-hook nil + "List of functions to call when disconnected from the nREPL server." + :type 'hook + :group 'nrepl) + +(defcustom nrepl-file-loaded-hook nil + "List of functions to call when a load file has completed." + :type 'hook + :group 'nrepl) + +(defcustom nrepl-host "127.0.0.1" + "The default hostname (or IP address) to connect to." + :type 'string + :group 'nrepl) + +(defcustom nrepl-port nil + "The default port to connect to." + :type 'string + :group 'nrepl) + +(defcustom nrepl-sync-request-timeout 10 + "The number of seconds to wait for a sync response. +Setting this to nil disables the timeout functionality." + :type 'integer + :group 'nrepl) + +(defcustom nrepl-connection-endpoint + 'nrepl-connection-ssh-tunnel + "A function that is called to determine command that will be run +once an nrepl server process is running. Used to set up an ssh tunnel +on remote connections. + +The arguments are dir and port. The return value +should be an `plist` of the form +(:proc-buffer-name \"*buf*\" :hostname \"hostname\" :port 1234)" + :type 'function + :group 'nrepl) + +(defvar-local nrepl-connection-buffer nil) +(defvar-local nrepl-server-buffer nil) +(defvar-local nrepl-repl-buffer nil) +(defvar-local nrepl-endpoint nil) +(defvar-local nrepl-project-dir nil) +(defvar-local nrepl-on-connection-buffer nil) + +(defconst nrepl-repl-buffer-name-template "*cider-repl%s*") +(defconst nrepl-connection-buffer-name-template "*nrepl-connection%s*") +(defconst nrepl-server-buffer-name-template "*nrepl-server%s*") +(defconst nrepl-on-connection-buffer-name-template "*nrepl-on-connection%s*") + +(defcustom nrepl-hide-special-buffers nil + "Control the display of some special buffers in buffer switching commands. +When true some special buffers like the connection and the server +buffer will be hidden.") + +(defun nrepl-apply-hide-special-buffers (buffer-name) + "Apply a prefix to BUFFER-NAME that will hide the buffer." + (concat (if nrepl-hide-special-buffers " " "") buffer-name)) + +(defun nrepl-format-buffer-name-template (buffer-name-template designation) + "Apply the DESIGNATION to the corresponding BUFFER-NAME-TEMPLATE." + (format buffer-name-template + (if (> (length designation) 0) + (concat nrepl-buffer-name-separator designation) + ""))) + +(defun nrepl-buffer-name (buffer-name-template) + "Generate a buffer name using BUFFER-NAME-TEMPLATE. + +The name will include the project name if available or the +endpoint host if it is not. The name will also include the +connection port if `nrepl-buffer-name-show-port' is true." + (generate-new-buffer-name + (let ((project-name (nrepl--project-name nrepl-project-dir)) + (nrepl-proj-port (cadr nrepl-endpoint))) + (nrepl-format-buffer-name-template + buffer-name-template + (concat (if project-name project-name (car nrepl-endpoint)) + (if (and nrepl-proj-port nrepl-buffer-name-show-port) + (format ":%s" nrepl-proj-port) "")))))) + +(defun nrepl-connection-buffer-name () + "Return the name of the connection buffer." + (nrepl-apply-hide-special-buffers + (nrepl-buffer-name nrepl-connection-buffer-name-template))) + +(defun nrepl-server-buffer-name () + "Return the name of the server buffer." + (nrepl-apply-hide-special-buffers + (nrepl-buffer-name nrepl-server-buffer-name-template))) + +(defun nrepl-on-connection-buffer-name () + "Return the name of the on-connection buffer." + (nrepl-apply-hide-special-buffers + (nrepl-buffer-name nrepl-on-connection-buffer-name-template))) + +;; buffer local declarations +(defvar-local nrepl-session nil + "Current nREPL session id.") + +(defvar-local nrepl-tooling-session nil + "Current nREPL tooling session id. +To be used for tooling calls (i.e. completion, eldoc, etc)") + +(defvar-local nrepl-request-counter 0 + "Continuation serial number counter.") + +(defvar-local nrepl-pending-requests (make-hash-table :test 'equal)) + +(defvar-local nrepl-completed-requests (make-hash-table :test 'equal)) + +(defvar-local nrepl-buffer-ns "user" + "Current Clojure namespace of this buffer.") + +(defvar-local nrepl-sync-response nil + "Result of the last sync request.") + +(defvar-local nrepl-sync-request-start-time nil + "The time when the last sync request was initiated.") + +(defvar nrepl-err-handler 'cider-default-err-handler + "Evaluation error handler.") + +(defvar-local nrepl-ops nil + "Available nREPL server ops (from describe).") + +;;; Bencode +;;; Adapted from http://www.emacswiki.org/emacs-en/bencode.el +;;; and modified to work with utf-8 +(defun nrepl-bdecode-buffer () + "Decode a bencoded string in the current buffer starting at point." + (cond ((looking-at "i\\(-?[0-9]+\\)e") + (goto-char (match-end 0)) + (string-to-number (match-string 1))) + ((looking-at "\\([0-9]+\\):") + (goto-char (match-end 0)) + (let ((start (point)) + (end (byte-to-position (+ (position-bytes (point)) + (string-to-number (match-string 1)))))) + (goto-char end) + (buffer-substring start end))) + ((looking-at "l") + (goto-char (match-end 0)) + (let (result item) + ;; check for the end sentinel, setq returns the value + (while (not (eq :end (setq item (nrepl-bdecode-buffer)))) + (setq result (cons item result))) + (nreverse result))) + ((looking-at "d") + (goto-char (match-end 0)) + (let (dict key item) + ;; check for the end sentinel, setq returns the value + (while (not (eq :end (setq item (nrepl-bdecode-buffer)))) + (if key + (setq dict (cons (cons key item) dict) + key nil) + (unless (stringp item) + (error "Dictionary keys have to be strings: %s" item)) + (setq key item))) + (cons 'dict (nreverse dict)))) + ((looking-at "e") + (goto-char (match-end 0)) + ;; This line used to return nil and checks above checked for + ;; falsiness to indicate the end of a list/dict, but that + ;; meant that nil/() was unable to pass through without + ;; shorting the algorithm. Now we return an :end keyword + ;; as a sentinel value and check for equality. + :end) + (t + (error "Cannot decode message: %s" (buffer-substring (point-min) (point-max)))))) + +(defun nrepl-decode (str) + "Decode bencoded STR." + (with-temp-buffer + (save-excursion + (insert str)) + (let ((result '())) + (while (not (eobp)) + (setq result (cons (nrepl-bdecode-buffer) result))) + (nreverse result)))) + +(defun nrepl-netstring (val) + "Encode VAL in bencode." + (cond + ((integerp val) (format "i%de" val)) + ((listp val) (format "l%se" (apply 'concat (-map 'nrepl-netstring val)))) + (t (format "%s:%s" (string-bytes val) val)))) + +(defun nrepl-bencode (message) + "Encode with bencode MESSAGE." + (concat "d" (apply 'concat (mapcar 'nrepl-netstring message)) "e")) + +;;; Response handlers +(defmacro nrepl-dbind-response (response keys &rest body) + "Destructure an nREPL RESPONSE dict. +Bind the value of the provided KEYS and execute BODY." + `(let ,(loop for key in keys + collect `(,key (cdr (assoc ,(format "%s" key) ,response)))) + ,@body)) + +(put 'nrepl-dbind-response 'lisp-indent-function 2) + +(defun nrepl-make-response-handler + (buffer value-handler stdout-handler stderr-handler done-handler + &optional eval-error-handler) + "Make a response handler for BUFFER. +Uses the specified VALUE-HANDLER, STDOUT-HANDLER, STDERR-HANDLER, +DONE-HANDLER, and EVAL-ERROR-HANDLER as appropriate." + (lambda (response) + (nrepl-dbind-response response (value ns out err status id ex root-ex + session) + (cond (value + (with-current-buffer buffer + (when ns (setq nrepl-buffer-ns ns))) + (when value-handler + (funcall value-handler buffer value))) + (out + (when stdout-handler + (funcall stdout-handler buffer out))) + (err + (when stderr-handler + (funcall stderr-handler buffer err))) + (status + (when (member "interrupted" status) + (message "Evaluation interrupted.")) + (when (member "eval-error" status) + (funcall (or eval-error-handler nrepl-err-handler) + buffer ex root-ex session)) + (when (member "namespace-not-found" status) + (message "Namespace not found.")) + (when (member "need-input" status) + (cider-need-input buffer)) + (when (member "done" status) + (puthash id (gethash id nrepl-pending-requests) nrepl-completed-requests) + (remhash id nrepl-pending-requests) + (when done-handler + (funcall done-handler buffer)))))))) + +;;; communication +(defun nrepl-default-handler () + "Default handler which is invoked when no handler is found. +Handles message contained in RESPONSE." + (nrepl-make-response-handler (cider-current-repl-buffer) + '() + (lambda (buffer out) + (cider-repl-emit-output buffer out)) + (lambda (buffer err) + (cider-repl-emit-err-output buffer err)) + '())) + +(defun nrepl-dispatch (response) + "Dispatch the RESPONSE to associated callback. + +First we check the list of pending requests for the callback to invoke +and afterwards we check the completed requests as well, since responses +could be received even for requests with status \"done\"." + (nrepl-log-message response) + (nrepl-dbind-response response (id) + (let ((callback (or (gethash id nrepl-pending-requests) + (gethash id nrepl-completed-requests)))) + (if callback + (funcall callback response) + (funcall (nrepl-default-handler) response))))) + +(defun nrepl-decode-current-buffer () + "Decode the data in the current buffer. +Remove the processed data from the buffer if the decode successful." + (let* ((start (point-min)) + (end (point-max)) + (data (buffer-substring-no-properties start end))) + (prog1 + (nrepl-decode data) + (delete-region start end)))) + +(defun nrepl-handle-process-output (process) + "Handle all complete messages from PROCESS." + (with-current-buffer (process-buffer process) + (let ((nrepl-connection-dispatch (current-buffer))) + ;; FIXME: An ugly fix for https://github.com/clojure-emacs/cider/issues/583 + (while (and (not (derived-mode-p 'cider-repl-mode)) (> (buffer-size) 1)) + (let ((responses (nrepl-decode-current-buffer))) + (dolist (r responses) + (nrepl-dispatch r))))))) + +(defvar nrepl-decode-timeout 0.01 + "Seconds to wait before decoding nREPL output.") + +(defun nrepl-net-filter (process string) + "Decode the message(s) from PROCESS contained in STRING and dispatch." + (with-current-buffer (process-buffer process) + (goto-char (point-max)) + (insert string)) + ;; end of the dict maybe? + (when (eq ?e (aref string (1- (length string)))) + ;; wait a bit to make sure we are at the real end + (unless (accept-process-output process nrepl-decode-timeout) + (nrepl-handle-process-output process)))) + +(defun nrepl-sentinel (process message) + "Handle sentinel events from PROCESS. +Display MESSAGE and if the process is closed kill the +process buffer and run the hook `nrepl-disconnected-hook'." + (message "nREPL connection closed: %s" message) + (if (equal (process-status process) 'closed) + (progn + (with-current-buffer (process-buffer process) + (when (get-buffer nrepl-repl-buffer) + (kill-buffer nrepl-repl-buffer)) + (kill-buffer (current-buffer))) + (run-hooks 'nrepl-disconnected-hook)))) + +(defun nrepl-write-message (process message) + "Send the PROCESS the MESSAGE." + (process-send-string process message)) + +;;; Log nREPL messages + +(defconst nrepl-message-buffer-name "*nrepl-messages*" + "Buffer for nREPL message logging.") + +(defcustom nrepl-log-messages nil + "Log protocol messages to the `nrepl-message-buffer-name' buffer." + :type 'boolean + :group 'nrepl) + +(define-obsolete-variable-alias 'nrepl-log-events 'nrepl-log-messages "0.7.0") + +(defconst nrepl-message-buffer-max-size 1000000 + "Maximum size for the nREPL message buffer. +Defaults to 1000000 characters, which should be an insignificant +memory burden, while providing reasonable history.") + +(defconst nrepl-message-buffer-reduce-denominator 4 + "Divisor by which to reduce message buffer size. +When the maximum size for the nREPL message buffer is exceed, the +size of the buffer is reduced by one over this value. Defaults +to 4, so that 1/4 of the buffer is removed, which should ensure +the buffer's maximum is reasonably utilised, while limiting the +number of buffer shrinking operations.") + +(defun nrepl-log-message (msg) + "Log the given MSG to the buffer given by `nrepl-message-buffer-name'." + (when nrepl-log-messages + (with-current-buffer (nrepl-messages-buffer) + (when (> (buffer-size) nrepl-message-buffer-max-size) + (goto-char (/ (buffer-size) nrepl-message-buffer-reduce-denominator)) + (re-search-forward "^(" nil t) + (delete-region (point-min) (- (point) 1))) + (goto-char (point-max)) + (pp msg (current-buffer))))) + +(defun nrepl-messages-buffer () + "Return or create the buffer given by `nrepl-message-buffer-name'. +The default buffer name is *nrepl-messages*." + (or (get-buffer nrepl-message-buffer-name) + (let ((buffer (get-buffer-create nrepl-message-buffer-name))) + (with-current-buffer buffer + (buffer-disable-undo) + (setq-local comment-start ";") + (setq-local comment-end "")) + buffer))) + +(defun nrepl-log-messages (&optional disable) + "Turn on message logging to `nrepl-message-buffer-name'. +With a prefix argument DISABLE, turn it off." + (interactive "P") + (if disable + (message "nREPL message logging disabled") + (message "nREPL message logging enabled")) + (setq nrepl-log-messages (not disable))) + +(define-obsolete-function-alias 'nrepl-log-events 'nrepl-log-messages "0.7.0") + + +;;; Connections + +;;; A connection is the communication between the nrepl.el client and an nrepl +;;; server. + +(defvar nrepl-connection-dispatch nil + "Bound to the connection a message was received on. +This is bound for the duration of the handling of that message") + +(defvar nrepl-connection-list nil + "A list of connections.") + + +(defun nrepl-current-host () + "Retrieve the current host." + (if (and (stringp buffer-file-name) + (file-remote-p buffer-file-name)) + tramp-current-host + nrepl-host)) + +(defun nrepl-make-connection-buffer () + "Create an nREPL connection buffer." + (let ((buffer (generate-new-buffer (nrepl-connection-buffer-name)))) + (with-current-buffer buffer + (buffer-disable-undo) + (setq-local kill-buffer-query-functions nil)) + buffer)) + +(defun nrepl-current-connection-buffer () + "The connection to use for nREPL interaction." + (or nrepl-connection-dispatch + nrepl-connection-buffer + (car (nrepl-connection-buffers)) + (error "No nREPL connection"))) + +(defun nrepl-connection-buffers () + "Clean up dead buffers from the `nrepl-connection-list'. +Return the connection list." + (nrepl--connection-list-purge) + nrepl-connection-list) + +(defun nrepl--connection-list-purge () + "Clean up dead buffers from the `nrepl-connection-list'." + (setq nrepl-connection-list + (-remove (lambda (buffer) + (not (buffer-live-p (get-buffer buffer)))) + nrepl-connection-list))) + +(defun nrepl-make-repl-connection-default (connection-buffer) + "Make the nREPL CONNECTION-BUFFER the default connection. +Moves CONNECITON-BUFFER to the front of `nrepl-connection-list'." + (interactive (list nrepl-connection-buffer)) + (if connection-buffer + ;; maintain the connection list in most recently used order + (let ((buf-name (buffer-name (get-buffer connection-buffer)))) + (setq nrepl-connection-list + (cons buf-name (delq buf-name nrepl-connection-list))) + (nrepl--connections-refresh)) + (message "Not in an nREPL REPL buffer."))) + +(defun nrepl--close-connection-buffer (connection-buffer) + "Closes CONNECTION-BUFFER, removing it from `nrepl-connection-list'. +Also closes associated REPL and server buffers." + (let ((nrepl-connection-dispatch connection-buffer)) + (let ((buffer (get-buffer connection-buffer))) + (setq nrepl-connection-list + (delq (buffer-name buffer) nrepl-connection-list)) + (when (buffer-live-p buffer) + (dolist (buf-name `(,(buffer-local-value 'nrepl-repl-buffer buffer) + ,(buffer-local-value 'nrepl-server-buffer buffer) + ,(buffer-local-value + 'nrepl-on-connection-buffer buffer) + ,buffer)) + (when buf-name + (cider--close-buffer buf-name))))))) + +;;; Connection browser +(defvar nrepl-connections-buffer-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "d" 'nrepl-connections-make-default) + (define-key map "g" 'nrepl-connection-browser) + (define-key map (kbd "C-k") 'nrepl-connections-close-connection) + (define-key map (kbd "RET") 'nrepl-connections-goto-connection) + map)) + +(define-derived-mode nrepl-connections-buffer-mode cider-popup-buffer-mode + "nREPL-Connections" + "nREPL Connections Buffer Mode. +\\{nrepl-connections-buffer-mode-map} +\\{cider-popup-buffer-mode-map}" + (setq-local truncate-lines t)) + +(defvar nrepl--connection-ewoc) +(defconst nrepl--connection-browser-buffer-name "*nrepl-connections*") + +(defun nrepl-connection-browser () + "Open a browser buffer for nREPL connections." + (interactive) + (let ((buffer (get-buffer nrepl--connection-browser-buffer-name))) + (if buffer + (progn + (nrepl--connections-refresh-buffer buffer) + (unless (get-buffer-window buffer) + (select-window (display-buffer buffer)))) + (nrepl--setup-connection-browser)))) + +(defun nrepl--connections-refresh () + "Refresh the connections buffer, if the buffer exists. +The connections buffer is determined by +`nrepl--connection-browser-buffer-name'" + (let ((buffer (get-buffer nrepl--connection-browser-buffer-name))) + (when buffer + (nrepl--connections-refresh-buffer buffer)))) + +(defun nrepl--connections-refresh-buffer (buffer) + "Refresh the connections BUFFER." + (nrepl--update-connections-display + (buffer-local-value 'nrepl--connection-ewoc buffer) + nrepl-connection-list)) + +(defun nrepl--setup-connection-browser () + "Create a browser buffer for nREPL connections." + (with-current-buffer (get-buffer-create nrepl--connection-browser-buffer-name) + (let ((ewoc (ewoc-create + 'nrepl--connection-pp + " Host Port Project\n"))) + (setq-local nrepl--connection-ewoc ewoc) + (nrepl--update-connections-display ewoc nrepl-connection-list) + (setq buffer-read-only t) + (nrepl-connections-buffer-mode) + (display-buffer (current-buffer))))) + +(defun nrepl--connection-pp (connection) + "Print an nREPL CONNECTION to the current buffer." + (let* ((buffer-read-only nil) + (buffer (get-buffer connection)) + (endpoint (buffer-local-value 'nrepl-endpoint buffer))) + (insert + (format "%s %-16s %5s %s" + (if (equal connection (car nrepl-connection-list)) "*" " ") + (car endpoint) + (prin1-to-string (cadr endpoint)) + (or (nrepl--project-name + (buffer-local-value 'nrepl-project-dir buffer)) + ""))))) + +(defun nrepl--project-name (path) + "Extracts a project name from PATH, possibly nil. +The project name is the final component of PATH if not nil." + (when path + (file-name-nondirectory (directory-file-name path)))) + +(defun nrepl--update-connections-display (ewoc connections) + "Update the connections EWOC to show CONNECTIONS." + (ewoc-filter ewoc (lambda (n) (member n connections))) + (let ((existing)) + (ewoc-map (lambda (n) (setq existing (cons n existing))) ewoc) + (let ((added (-difference connections existing))) + (mapc (apply-partially 'ewoc-enter-last ewoc) added) + (save-excursion (ewoc-refresh ewoc))))) + +(defun nrepl--ewoc-apply-at-point (f) + "Apply function F to the ewoc node at point. +F is a function of two arguments, the ewoc and the data at point." + (let* ((ewoc nrepl--connection-ewoc) + (node (and ewoc (ewoc-locate ewoc)))) + (when node + (funcall f ewoc (ewoc-data node))))) + +(defun nrepl-connections-make-default () + "Make default the connection at point in the connection browser." + (interactive) + (save-excursion + (nrepl--ewoc-apply-at-point #'nrepl--connections-make-default))) + +(defun nrepl--connections-make-default (ewoc data) + "Make the connection in EWOC specified by DATA default. +Refreshes EWOC." + (interactive) + (nrepl-make-repl-connection-default data) + (ewoc-refresh ewoc)) + +(defun nrepl-connections-close-connection () + "Close connection at point in the connection browser." + (interactive) + (nrepl--ewoc-apply-at-point #'nrepl--connections-close-connection)) + +(defun nrepl--connections-close-connection (ewoc data) + "Close the connection in EWOC specified by DATA." + (nrepl-close (get-buffer data)) + (nrepl--update-connections-display ewoc nrepl-connection-list)) + +(defun nrepl-connections-goto-connection () + "Goto connection at point in the connection browser." + (interactive) + (nrepl--ewoc-apply-at-point #'nrepl--connections-goto-connection)) + +(defun nrepl--connections-goto-connection (_ewoc data) + "Goto the REPL for the connection in _EWOC specified by DATA." + (let ((buffer (buffer-local-value 'nrepl-repl-buffer (get-buffer data)))) + (when buffer + (select-window (display-buffer buffer))))) + +;;; server messages + +(defun nrepl-current-session () + "Return the current session." + (with-current-buffer (nrepl-current-connection-buffer) + nrepl-session)) + +(defun nrepl-current-tooling-session () + "Return the current tooling session." + (with-current-buffer (nrepl-current-connection-buffer) + nrepl-tooling-session)) + +(defun nrepl-next-request-id () + "Return the next request id." + (with-current-buffer (nrepl-current-connection-buffer) + (number-to-string (cl-incf nrepl-request-counter)))) + +(defun nrepl-send-request (request callback) + "Send REQUEST and register response handler CALLBACK." + (let* ((request-id (nrepl-next-request-id)) + (request (append (list "id" request-id) request)) + (message (nrepl-bencode request))) + (nrepl-log-message request) + (puthash request-id callback nrepl-pending-requests) + (nrepl-write-message (nrepl-current-connection-buffer) message))) + +(defun nrepl-create-client-session (callback) + "Sent a request to create a new client session. +Response will be handled by CALLBACK." + (nrepl-send-request '("op" "clone") + callback)) + +(defun nrepl-send-stdin (input callback) + "Send a stdin message with INPUT. +Register CALLBACK as the response handler." + (nrepl-send-request (list "op" "stdin" + "stdin" input + "session" (nrepl-current-session)) + callback)) + +(defun nrepl-send-interrupt (pending-request-id callback) + "Send an interrupt message for PENDING-REQUEST-ID. +Register CALLBACK as the response handler." + (nrepl-send-request (list "op" "interrupt" + "session" (nrepl-current-session) + "interrupt-id" pending-request-id) + callback)) + +(defun nrepl-eval-request (input &optional ns session) + "Send a request to eval INPUT. +If NS is non-nil, include it in the request. +Use SESSION if it is non-nil, otherwise use the current session." + (append (if ns (list "ns" ns)) + (list + "op" "eval" + "session" (or session (nrepl-current-session)) + "code" input))) + +(defun nrepl-send-string (input callback &optional ns session) + "Send the request INPUT and register the CALLBACK as the response handler. +See command `nrepl-eval-request' for details on how NS and SESSION are processed." + (nrepl-send-request (nrepl-eval-request input ns session) callback)) + +(defun nrepl-sync-request-handler (buffer) + "Make a synchronous request handler for BUFFER." + (nrepl-make-response-handler buffer + (lambda (_buffer value) + (setq nrepl-sync-response + (plist-put nrepl-sync-response :value value))) + (lambda (_buffer out) + (let ((so-far (plist-get nrepl-sync-response :stdout))) + (setq nrepl-sync-response + (plist-put nrepl-sync-response + :stdout (concat so-far out))))) + (lambda (_buffer err) + (let ((so-far (plist-get nrepl-sync-response :stderr))) + (setq nrepl-sync-response + (plist-put nrepl-sync-response + :stderr (concat so-far err))))) + (lambda (_buffer) + (setq nrepl-sync-response + (plist-put nrepl-sync-response :done t))))) + +(defun nrepl-send-request-sync (request) + "Send REQUEST to the nREPL server synchronously (discouraged). +The result is a plist with keys :value, :stderr and :stdout." + (with-current-buffer (nrepl-current-connection-buffer) + (setq nrepl-sync-response nil) + (setq nrepl-sync-request-start-time (current-time)) + (nrepl-send-request request (nrepl-sync-request-handler (current-buffer))) + (while (or (null nrepl-sync-response) + (null (plist-get nrepl-sync-response :done))) + (accept-process-output nil 0.005) + ;; break out in case we don't receive a response for a while + (when nrepl-sync-request-timeout + (let ((seconds-ellapsed (cadr (time-subtract (current-time) nrepl-sync-request-start-time)))) + (if (> seconds-ellapsed nrepl-sync-request-timeout) + (keyboard-quit))))) + nrepl-sync-response)) + +(defun nrepl-send-string-sync (input &optional ns session) + "Send the INPUT to the nREPL server synchronously. +See command `nrepl-eval-request' for details about how NS and SESSION +are processed." + (nrepl-send-request-sync (nrepl-eval-request input ns session))) + +;;; server +(defun nrepl--default-endpoint (dir port) + "The endpoint for a repl in project DIR on PORT. +Return a plist with :hostname, :port and :proc keys." + (list :hostname (if (file-remote-p dir) + tramp-current-host + "localhost") + :port port + :proc-buffer-name nil)) + +(defun nrepl--endpoint-for-connection (dir port) + "Call any `nrepl-connection-endpoint' for DIR and PORT. +Return a plist with :hostname and :port values, specifying where +to connect, and a :proc-buffer-name key, specifying the name of a +process buffer to associate with the connection. When no +`nrepl-connection-endpoint' is specified, returns a plist with +the hostname associated with DIR, and PORT." + (if (functionp nrepl-connection-endpoint) + (funcall nrepl-connection-endpoint dir port) + (nrepl--default-endpoint dir port))) + +(defun nrepl-server-filter (process output) + "Process nREPL server output from PROCESS contained in OUTPUT." + (with-current-buffer (process-buffer process) + (save-excursion + (goto-char (point-max)) + (insert output))) + (when (string-match "nREPL server started on port \\([0-9]+\\)" output) + (let ((port (string-to-number (match-string 1 output)))) + (message (format "nREPL server started on %s" port)) + (with-current-buffer (process-buffer process) + (let* ((endpoint (nrepl--endpoint-for-connection + default-directory port)) + (hostname (plist-get endpoint :hostname)) + (port (plist-get endpoint :port)) + (proc-buffer-name (plist-get endpoint :proc-buffer-name))) + (let ((nrepl-process (nrepl-connect hostname port))) + (setq nrepl-connection-buffer + (buffer-name (process-buffer nrepl-process))) + (with-current-buffer (process-buffer nrepl-process) + (setq nrepl-server-buffer + (buffer-name (process-buffer process)) + nrepl-project-dir + (buffer-local-value + 'nrepl-project-dir (process-buffer process)) + nrepl-on-connection-buffer proc-buffer-name)))))))) + +(defun nrepl-server-sentinel (process event) + "Handle nREPL server PROCESS EVENT." + (let* ((nrepl-buffer (process-buffer process)) + (connection-buffer (buffer-local-value 'nrepl-connection-buffer nrepl-buffer)) + (problem (if (and nrepl-buffer (buffer-live-p nrepl-buffer)) + (with-current-buffer nrepl-buffer + (buffer-substring (point-min) (point-max))) + ""))) + (when nrepl-buffer + (kill-buffer nrepl-buffer)) + (cond + ((string-match "^killed" event) + nil) + ((string-match "^hangup" event) + (when connection-buffer + (nrepl-close connection-buffer))) + ((string-match "Wrong number of arguments to repl task" problem) + (error "Leiningen 2.x is required by CIDER")) + (t (error "Could not start nREPL server: %s" problem))))) + +(defun nrepl--ssh-tunnel-command (ssh dir port) + "Command string to open SSH tunnel to the host associated with DIR's PORT." + (with-parsed-tramp-file-name dir nil + (format-spec + "%s -v -N -L %p:localhost:%p %u'%h'" + `((?s . ,ssh) + (?p . ,port) + (?h . ,host) + (?u . ,(if user (format "-l '%s' " user) "")))))) + +(defun nrepl--ssh-tunnel-filter (port) + "Return a filter function for waiting on PORT to appear in output." + (let ((port-string (format "LOCALHOST:%s" port))) + (lambda (proc string) + (when (buffer-live-p (process-buffer proc)) + (with-current-buffer (process-buffer proc) + (let ((moving (= (point) (process-mark proc)))) + (save-excursion + (goto-char (process-mark proc)) + (insert string) + (set-marker (process-mark proc) (point))) + (if moving (goto-char (process-mark proc)))))) + (when (string-match port-string string) + (with-current-buffer (process-buffer proc) + (setq nrepl-wait-for-port nil)))))) + +(defun nrepl-connection-ssh-tunnel (dir port) + "Return an endpoint for SSH tunnel to project DIR path, and PORT port. +If DIR is remote, then attempt to open an SSH tunnel to port. If +the ssh executable is not found on the path, then fall back to +specifying a direct conneciton." + ;; this abuses the -v option for ssh to get output when the port + ;; forwarding is set up, which is used to synchronise on, so that + ;; the port forwarding is up when we try to connect. + (if (file-remote-p dir) + (let ((ssh (executable-find "ssh"))) + (if ssh + ;; run cmd in a local shell + (let* ((cmd (nrepl--ssh-tunnel-command ssh dir port)) + (on-connection-buffer-name (nrepl-on-connection-buffer-name)) + (proc (start-process-shell-command + "nrepl-on-connection" + on-connection-buffer-name + cmd)) + (on-connection-buffer (get-buffer + on-connection-buffer-name))) + (with-current-buffer on-connection-buffer-name + (setq-local nrepl-wait-for-port t)) + (set-process-filter proc (nrepl--ssh-tunnel-filter port)) + (while (and (buffer-local-value 'nrepl-wait-for-port + on-connection-buffer) + (process-live-p proc)) + (accept-process-output nil 0.005)) + (unless (process-live-p proc) + (message "SSH port forwarding failed")) + (list :hostname "localhost" :port port + :proc-buffer-name on-connection-buffer-name)) + (nrepl--default-endpoint dir port))) + (list :hostname "localhost" :port port :proc-buffer-name nil))) + +(defun nrepl-current-dir () + "Return the directory of the current buffer." + (let ((file-name (buffer-file-name (current-buffer)))) + (or (when file-name + (file-name-directory file-name)) + list-buffers-directory))) + +(defun nrepl-project-directory-for (dir-name) + "Return the project directory for the specified DIR-NAME." + (when dir-name + (locate-dominating-file dir-name "project.clj"))) + +(defun nrepl-check-for-repl-buffer (endpoint project-directory) + "Check whether a matching connection buffer already exists. +Looks for buffers where `nrepl-endpoint' matches ENDPOINT, +or `nrepl-project-dir' matches PROJECT-DIRECTORY. +If so ask the user for confirmation." + (if (cl-find-if + (lambda (buffer) + (let ((buffer (get-buffer buffer))) + (or (and endpoint + (equal endpoint + (buffer-local-value 'nrepl-endpoint buffer))) + (and project-directory + (equal project-directory + (buffer-local-value 'nrepl-project-dir buffer)))))) + (nrepl-connection-buffers)) + (y-or-n-p + "An nREPL connection buffer already exists. Do you really want to create a new one? ") + t)) + +(defun nrepl-close (connection-buffer) + "Close the nrepl connection for CONNECTION-BUFFER." + (interactive (list (nrepl-current-connection-buffer))) + (nrepl--close-connection-buffer connection-buffer) + (run-hooks 'nrepl-disconnected-hook) + (nrepl--connections-refresh)) + +;;; client +(defun nrepl-op-supported-p (op) + "Return t iff the given operation OP is supported by nREPL server." + (with-current-buffer (nrepl-current-connection-buffer) + (if (and nrepl-ops (assoc op nrepl-ops)) + t))) + +(defun nrepl-describe-handler (process-buffer) + "Return a handler to describe into PROCESS-BUFFER." + (lambda (response) + (nrepl-dbind-response response (ops) + (with-current-buffer process-buffer + (setq nrepl-ops ops))) + (cider-make-repl (get-buffer-process process-buffer)) + (nrepl-make-repl-connection-default process-buffer) + (cider-verify-required-nrepl-ops))) + +(defun nrepl-describe-session (process) + "Peform describe for the given server PROCESS." + (nrepl-send-request + (list "op" "describe") + (nrepl-describe-handler (process-buffer process)))) + +(defun nrepl-new-tooling-session-handler (process) + "Create a new tooling session handler for PROCESS." + (lambda (response) + (nrepl-dbind-response response (id new-session) + (with-current-buffer (process-buffer process) + (setq nrepl-tooling-session new-session) + (remhash id nrepl-pending-requests))))) + +(defun nrepl-new-session-handler (process) + "Create a new session handler for PROCESS." + (lambda (response) + (nrepl-dbind-response response (id new-session) + (remhash id nrepl-pending-requests) + (let ((connection-buffer (process-buffer process))) + (setq nrepl-session new-session + nrepl-connection-buffer connection-buffer) + (run-hooks 'nrepl-connected-hook))))) + +(defun nrepl-init-client-sessions (process) + "Initialize client sessions for PROCESS." + (nrepl-create-client-session (nrepl-new-session-handler process)) + (nrepl-create-client-session (nrepl-new-tooling-session-handler process))) + +(defun nrepl-connect (host port) + "Connect to a running nREPL server running on HOST and PORT." + (message "Connecting to nREPL server on %s:%s..." host port) + (let* ((nrepl-endpoint `(,host ,port)) + (process (open-network-stream "nrepl" + (nrepl-make-connection-buffer) + host + port))) + (set-process-filter process 'nrepl-net-filter) + (set-process-sentinel process 'nrepl-sentinel) + (set-process-coding-system process 'utf-8-unix 'utf-8-unix) + (with-current-buffer (process-buffer process) + (setq nrepl-endpoint `(,host ,port))) + (let ((nrepl-connection-dispatch (buffer-name (process-buffer process)))) + (nrepl-init-client-sessions process) + (nrepl-describe-session process)) + process)) + +(defun nrepl--port-from-file (file) + "Attempts to read port from a file named by FILE." + (let* ((dir (nrepl-project-directory-for (nrepl-current-dir))) + (f (expand-file-name file dir))) + (when (file-exists-p f) + (with-temp-buffer + (insert-file-contents f) + (buffer-string))))) + +(defun nrepl-default-port () + "Attempt to read port from .nrepl-port or target/repl-port. +Falls back to `nrepl-port' if not found." + (or (nrepl--port-from-file ".nrepl-port") + (nrepl--port-from-file "target/repl-port") + nrepl-port)) + +(provide 'nrepl-client) + +;;; nrepl-client.el ends here diff --git a/elpa/cider-0.7.0/nrepl-client.elc b/elpa/cider-0.7.0/nrepl-client.elc new file mode 100644 index 000000000..7f9b07bc3 Binary files /dev/null and b/elpa/cider-0.7.0/nrepl-client.elc differ diff --git a/elpa/cl-lib-0.5/cl-lib-autoloads.el b/elpa/cl-lib-0.5/cl-lib-autoloads.el new file mode 100644 index 000000000..96d739c36 --- /dev/null +++ b/elpa/cl-lib-0.5/cl-lib-autoloads.el @@ -0,0 +1,25 @@ +;;; cl-lib-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil "cl-lib" "cl-lib.el" (21477 61928 0 0)) +;;; Generated autoloads from cl-lib.el + (let ((d (file-name-directory #$))) + (when (member d load-path) + (setq load-path (append (remove d load-path) (list d))))) + +;;;*** + +;;;### (autoloads nil nil ("cl-lib-pkg.el") (21477 61928 222282 0)) + +;;;*** + +(provide 'cl-lib-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; cl-lib-autoloads.el ends here diff --git a/elpa/cl-lib-0.5/cl-lib-pkg.el b/elpa/cl-lib-0.5/cl-lib-pkg.el new file mode 100644 index 000000000..cbb73729a --- /dev/null +++ b/elpa/cl-lib-0.5/cl-lib-pkg.el @@ -0,0 +1 @@ +(define-package "cl-lib" "0.5" "Properly prefixed CL functions and macros" (quote nil)) diff --git a/elpa/cl-lib-0.5/cl-lib-pkg.elc b/elpa/cl-lib-0.5/cl-lib-pkg.elc new file mode 100644 index 000000000..98faa06cf Binary files /dev/null and b/elpa/cl-lib-0.5/cl-lib-pkg.elc differ diff --git a/elpa/cl-lib-0.5/cl-lib.el b/elpa/cl-lib-0.5/cl-lib.el new file mode 100644 index 000000000..ce11309fd --- /dev/null +++ b/elpa/cl-lib-0.5/cl-lib.el @@ -0,0 +1,410 @@ +;;; cl-lib.el --- Properly prefixed CL functions and macros -*- coding: utf-8 -*- + +;; Copyright (C) 2012, 2013, 2014 Free Software Foundation, Inc. + +;; Author: Stefan Monnier +;; vcomment: Emacs-24.3's version is 1.0 so this has to stay below. +;; Version: 0.5 + +;; 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 . + +;;; Commentary: + +;; This is a forward compatibility package, which provides (a subset of) the +;; features of the cl-lib package introduced in Emacs-24.3, for use on +;; previous emacsen. + +;; Make sure this is installed *late* in your `load-path`, i.e. after Emacs's +;; built-in .../lisp/emacs-lisp directory, so that if/when you upgrade to +;; Emacs-24.3, the built-in version of the file will take precedence, otherwise +;; you could get into trouble (although we try to hack our way around the +;; problem in case it happens). + +;; This code is largely copied from Emacs-24.3's cl.el, with the alias bindings +;; simply reversed. + +;;; Code: + +;; We need to handle the situation where this package is used with an Emacs +;; that comes with a real cl-lib (i.e. ≥24.3). + +;; First line of defense: try to make sure the built-in cl-lib comes earlier in +;; load-path so we never get loaded: +;;;###autoload (let ((d (file-name-directory #$))) +;;;###autoload (when (member d load-path) +;;;###autoload (setq load-path (append (remove d load-path) (list d))))) + +(when (functionp 'macroexp--compiler-macro) + ;; `macroexp--compiler-macro' was introduced as part of the big CL + ;; reorganization which moved/reimplemented some of CL into core (mostly the + ;; setf and compiler-macro support), so its presence indicates we're running + ;; in an Emacs that comes with the new cl-lib.el, where this file should + ;; never be loaded! + (message "Real cl-lib shadowed by compatibility cl-lib? (%s)" load-file-name) + (when load-file-name + ;; (message "Let's try to patch things up") + (let ((loaddir (file-name-directory load-file-name)) + load-path-dir) + ;; Find the problematic directory from load-path. + (dolist (dir load-path) + (if (equal loaddir (expand-file-name (file-name-as-directory dir))) + (setq load-path-dir dir))) + (when load-path-dir + ;; (message "Let's move the offending dir to the end") + (setq load-path (append (remove load-path-dir load-path) + (list load-path-dir))) + ;; Here we could manually load cl-lib and then return immediately. + ;; But Emacs currently doesn't provide any way for a file to "return + ;; immediately", so instead we make sure the rest of the file does not + ;; throw away any pre-existing definition. + )))) + +(require 'cl) + +;; Some of Emacs-24.3's cl.el definition are not just aliases, because either +;; the feature was dropped from cl-lib.el or because the cl-lib version is +;; not fully compatible. +;; Let's just not include them here, since it is very important that if code +;; works with this cl-lib.el it should also work with Emacs-24.3's cl-lib.el, +;; whereas the reverse is much less important. + +(dolist (var '( + ;; loop-result-var + ;; loop-result + ;; loop-initially + ;; loop-finally + ;; loop-bindings + ;; loop-args + ;; bind-inits + ;; bind-block + ;; lambda-list-keywords + float-negative-epsilon + float-epsilon + least-negative-normalized-float + least-positive-normalized-float + least-negative-float + least-positive-float + most-negative-float + most-positive-float + ;; custom-print-functions + )) + (let ((new (intern (format "cl-%s" var)))) + (unless (boundp new) (defvaralias new var)))) + +;; The following cl-lib functions were already defined in the old cl.el, +;; with a different meaning: +;; - cl-position and cl-delete-duplicates +;; the two meanings are clearly different, but we can distinguish which was +;; meant by looking at the arguments. +;; - cl-member +;; the old meaning hasn't been used for a long time and is a subset of the +;; new, so we can simply override it. +;; - cl-adjoin +;; the old meaning is actually the same as the new except for optimizations. + +(dolist (fun '( + (get* . cl-get) + (random* . cl-random) + (rem* . cl-rem) + (mod* . cl-mod) + (round* . cl-round) + (truncate* . cl-truncate) + (ceiling* . cl-ceiling) + (floor* . cl-floor) + (rassoc* . cl-rassoc) + (assoc* . cl-assoc) + ;; (member* . cl-member) ;Handle specially below. + (delete* . cl-delete) + (remove* . cl-remove) + (defsubst* . cl-defsubst) + (sort* . cl-sort) + (function* . cl-function) + (defmacro* . cl-defmacro) + (defun* . cl-defun) + (mapcar* . cl-mapcar) + + remprop + getf + tailp + list-length + nreconc + revappend + concatenate + subseq + random-state-p + make-random-state + signum + isqrt + lcm + gcd + notevery + notany + every + some + mapcon + mapcan + mapl + maplist + map + equalp + coerce + tree-equal + nsublis + sublis + nsubst-if-not + nsubst-if + nsubst + subst-if-not + subst-if + subsetp + nset-exclusive-or + set-exclusive-or + nset-difference + set-difference + nintersection + intersection + nunion + union + rassoc-if-not + rassoc-if + assoc-if-not + assoc-if + member-if-not + member-if + merge + stable-sort + search + mismatch + count-if-not + count-if + count + position-if-not + position-if + ;; position ;Handle specially via defadvice below. + find-if-not + find-if + find + nsubstitute-if-not + nsubstitute-if + nsubstitute + substitute-if-not + substitute-if + substitute + ;; delete-duplicates ;Handle specially via defadvice below. + remove-duplicates + delete-if-not + delete-if + remove-if-not + remove-if + replace + fill + reduce + compiler-macroexpand + define-compiler-macro + assert + check-type + typep + deftype + defstruct + callf2 + callf + letf* + letf + rotatef + shiftf + remf + psetf + declare + the + locally + multiple-value-setq + multiple-value-bind + symbol-macrolet + macrolet + progv + psetq + do-all-symbols + do-symbols + dotimes + dolist + do* + do + loop + return-from + return + block + etypecase + typecase + ecase + case + load-time-value + eval-when + destructuring-bind + gentemp + gensym + pairlis + acons + subst + ;; adjoin ;It's already defined. + copy-list + ldiff + list* + cddddr + cdddar + cddadr + cddaar + cdaddr + cdadar + cdaadr + cdaaar + cadddr + caddar + cadadr + cadaar + caaddr + caadar + caaadr + caaaar + cdddr + cddar + cdadr + cdaar + caddr + cadar + caadr + caaar + tenth + ninth + eighth + seventh + sixth + fifth + fourth + third + endp + rest + second + first + svref + copy-seq + evenp + oddp + minusp + plusp + floatp-safe + declaim + proclaim + nth-value + multiple-value-call + multiple-value-apply + multiple-value-list + values-list + values + pushnew + decf + incf + + dolist + dotimes + )) + (let ((new (if (consp fun) (prog1 (cdr fun) (setq fun (car fun))) + (intern (format "cl-%s" fun))))) + (if (fboundp new) + (unless (or (eq (symbol-function new) fun) + (eq new (and (symbolp fun) (fboundp fun) + (symbol-function fun)))) + (message "%S already defined, not rebinding" new)) + (defalias new fun)))) + +(unless (symbolp (symbol-function 'position)) + (autoload 'cl-position "cl-seq") + (defadvice cl-position (around cl-lib (cl-item cl-seq &rest cl-keys) activate) + (let ((argk (ad-get-args 2))) + (if (or (null argk) (keywordp (car argk))) + ;; This is a call to cl-lib's `cl-position'. + (setq ad-return-value + (apply #'position (ad-get-arg 0) (ad-get-arg 1) argk)) + ;; Must be a call to cl's old `cl-position'. + ad-do-it)))) + +(unless (symbolp (symbol-function 'delete-duplicates)) + (autoload 'cl-delete-duplicates "cl-seq") + (defadvice cl-delete-duplicates (around cl-lib (cl-seq &rest cl-keys) activate) + (let ((argk (ad-get-args 1))) + (if (or (null argk) (keywordp (car argk))) + ;; This is a call to cl-lib's `cl-delete-duplicates'. + (setq ad-return-value + (apply #'delete-duplicates (ad-get-arg 0) argk)) + ;; Must be a call to cl's old `cl-delete-duplicates'. + ad-do-it)))) + +(when (or (not (fboundp 'cl-member)) + (eq (symbol-function 'cl-member) #'memq)) + (defalias 'cl-member #'member*)) + +;; `cl-labels' is not 100% compatible with `labels' when using dynamic scoping +;; (mostly because it does not turn lambdas that refer to those functions into +;; closures). OTOH it is compatible when using lexical scoping. + +(unless (fboundp 'cl-labels) + (defmacro cl-labels (&rest args) + (unless (and (boundp 'lexical-binding) lexical-binding) + ;; We used to signal an error rather than a message, but in many uses of + ;; cl-labels, the value of lexical-binding doesn't actually matter. + ;; More importantly, the value of `lexical-binding' here is unreliable + ;; (it does not necessarily reflect faithfully whether the output of this + ;; macro will be interpreted as lexically bound code or not). + (message "This `cl-labels' requires `lexical-binding' to be non-nil")) + `(labels ,@args))) + +;;;; ChangeLog: + +;; 2014-02-25 Stefan Monnier +;; +;; Fixes: debbugs:16671 +;; +;; * cl-lib.el (cl-position, cl-delete-duplicate): Don't advise if >=24.3. +;; (load-path): Try to make sure we're at the end. +;; +;; 2014-01-25 Stefan Monnier +;; +;; * cl-lib.el: Resolve conflicts with old internal definitions +;; (bug#16353). +;; (dolist fun): Don't skip definitions silently. +;; (define-setf-expander): Remove, not in cl-lib. +;; (cl-position, cl-delete-duplicates): Add advice to distinguish the use +;; case. +;; (cl-member): Override old definition. +;; +;; 2013-05-22 Stefan Monnier +;; +;; * cl-lib.el (cl-labels): Demote error to message and improve it. +;; +;; 2012-11-30 Stefan Monnier +;; +;; * cl-lib.el: Try and patch things up in case we're hiding the real +;; cl-lib. +;; +;; 2012-11-22 Stefan Monnier +;; +;; Add cl-letf and cl-labels. +;; +;; 2012-11-16 Stefan Monnier +;; +;; * packages/cl-lib: New package. +;; + + +(provide 'cl-lib) +;;; cl-lib.el ends here diff --git a/elpa/cl-lib-0.5/cl-lib.elc b/elpa/cl-lib-0.5/cl-lib.elc new file mode 100644 index 000000000..e8b0f177f Binary files /dev/null and b/elpa/cl-lib-0.5/cl-lib.elc differ diff --git a/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-autoloads.el b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-autoloads.el new file mode 100644 index 000000000..b00f82878 --- /dev/null +++ b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-autoloads.el @@ -0,0 +1,29 @@ +;;; clojure-cheatsheet-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (clojure-cheatsheet) "clojure-cheatsheet" "clojure-cheatsheet.el" +;;;;;; (21478 8106 0 0)) +;;; Generated autoloads from clojure-cheatsheet.el + +(autoload 'clojure-cheatsheet "clojure-cheatsheet" "\ +Use helm to show a Clojure cheatsheet. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("clojure-cheatsheet-pkg.el") (21478 8106 +;;;;;; 389940 0)) + +;;;*** + +(provide 'clojure-cheatsheet-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; clojure-cheatsheet-autoloads.el ends here diff --git a/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-pkg.el b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-pkg.el new file mode 100644 index 000000000..8d5725270 --- /dev/null +++ b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-pkg.el @@ -0,0 +1 @@ +(define-package "clojure-cheatsheet" "20140316.1520" "The Clojure Cheatsheet for Emacs" (quote ((helm "1.5.3") (cider "0.1.8")))) diff --git a/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-pkg.elc b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-pkg.elc new file mode 100644 index 000000000..b6a531fdd Binary files /dev/null and b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet-pkg.elc differ diff --git a/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet.el b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet.el new file mode 100644 index 000000000..36b9b7aca --- /dev/null +++ b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet.el @@ -0,0 +1,602 @@ +;;; clojure-cheatsheet.el --- The Clojure Cheatsheet for Emacs +;; Copyright 2013 Kris Jenkins + +;; Author: Kris Jenkins +;; Maintainer: Kris Jenkins +;; Keywords: clojure nrepl cheatsheet helm +;; URL: https://github.com/krisajenkins/clojure-cheatsheet +;; Created: 7th August 2013 +;; Version: 20140316.1520 +;; X-Original-Version: 0.2.2 +;; Package-Requires: ((helm "1.5.3") (cider "0.1.8")) + +;;; Commentary: +;; +;; A quick reference system for Clojure. Fast, searchable & available offline. + +;;; Code: + +(require 'helm) +(require 'helm-match-plugin) +(require 'nrepl-client) +(require 'cider-interaction) + +(defconst clojure-cheatsheet-hierarchy + '(("Primitives" + ("Numbers" + ("Arithmetic" + (clojure.core + - * / quot rem mod dec inc max min)) + ("Compare" + (clojure.core = == not= < > <= >= compare)) + ("Bitwise" + (clojure.core bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor)) + ("Cast" + (clojure.core byte short long int float double bigdec bigint biginteger num rationalize)) + ("Test" + (clojure.core nil? identical? zero? pos? neg? even? odd?)) + ("Random" + (clojure.core rand rand-int)) + ("BigDecimal" + (clojure.core with-precision)) + ("Ratios" + (clojure.core numerator denominator ratio?)) + ("Arbitrary Precision Arithmetic" + (clojure.core +\' -\' *\' inc\' dec\')) + ("Unchecked" + (clojure.core *unchecked-math* + unchecked-add + unchecked-add-int + unchecked-byte + unchecked-char + unchecked-dec + unchecked-dec-int + unchecked-divide-int + unchecked-double + unchecked-float + unchecked-inc + unchecked-inc-int + unchecked-int + unchecked-long + unchecked-multiply + unchecked-multiply-int + unchecked-negate + unchecked-negate-int + unchecked-remainder-int + unchecked-short + unchecked-subtract + unchecked-subtract-int))) + + ("Strings" + ("Create" + (clojure.core str format)) + ("Use" + (clojure.core count get subs compare) + (clojure.string join escape split split-lines replace replace-first reverse re-quote-replacement)) + ("Regex" + (:url "Java's Regex Syntax" "http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html") + (clojure.core re-find re-seq re-matches re-pattern re-matcher re-groups) + (clojure.string replace replace-first re-quote-replacement)) + ("Letters" + (clojure.string capitalize lower-case upper-case)) + ("Trim" + (clojure.string trim trim-newline triml trimr)) + ("Test" + (clojure.core char char? string?) + (clojure.string blank?))) + + ("Other" + ("Characters" + (clojure.core char char-name-string char-escape-string)) + ("Keywords" + (clojure.core keyword keyword? find-keyword)) + ("Symbols" + (clojure.core symbol symbol? gensym)) + ("Data Readers" + (clojure.core *data-readers* default-data-readers *default-data-reader-fn*)))) + + ("Collections" + ("Generic Ops" + (clojure.core count empty not-empty into conj)) + ("Tree Walking" + (clojure.walk walk prewalk prewalk-demo prewalk-replace postwalk postwalk-demo postwalk-replace keywordize-keys stringify-keys)) + ("Content tests" + (clojure.core distinct? empty? every? not-every? some not-any?)) + ("Capabilities" + (clojure.core sequential? associative? sorted? counted? reversible?)) + ("Type tests" + (clojure.core type class coll? list? vector? set? map? seq? + number? integer? float? decimal? class? rational? ratio? + chunked-seq? reduced? special-symbol?)) + ("Lists" + ("Create" + (clojure.core list list*)) + ("Examine" + (clojure.core first nth peek)) + ("'Change'" + (clojure.core cons conj rest pop))) + + ("Vectors" + ("Create" + (clojure.core vec vector vector-of)) + ("Examine" + (clojure.core get peek)) + + ("'Change'" + (clojure.core assoc pop subvec replace conj rseq)) + ("Ops" + (clojure.core mapv filterv reduce-kv))) + + ("Sets" + ("Create" + (clojure.core set hash-set sorted-set sorted-set-by)) + ("Examine" + (clojure.core get contains?)) + ("'Change'" + (clojure.core conj disj)) + ("Relational Algebra" + (clojure.set join select project union difference intersection)) + ("Get map" + (clojure.set index rename-keys rename map-invert)) + ("Test" + (clojure.set subset? superset?))) + + ("Maps" + ("Create" + (clojure.core hash-map array-map zipmap sorted-map sorted-map-by bean frequencies group-by)) + ("Examine" + (clojure.core get get-in contains? find keys vals)) + ("'Change'" + (clojure.core assoc assoc-in dissoc merge merge-with select-keys update-in)) + ("Entry" + (clojure.core key val)) + ("Sorted Maps" + (clojure.core rseq subseq rsubseq)))) + + ("Functions" + ("Create" + (clojure.core fn defn defn- definline identity constantly comp complement partial juxt memfn memoize fnil every-pred some-fn trampoline)) + ("Call" + (clojure.core -> ->> some-> some->> as-> cond-> cond->>)) + ("Test" + (clojure.core fn? ifn?))) + + ("Other" + ("XML" + (clojure.core xml-seq) + (clojure.xml parse)) + ("REPL" + (clojure.core *1 *2 *3 *e *print-dup* *print-length* *print-level* *print-meta* *print-readably*)) + ("EDN" + (clojure.edn read read-string)) + ("Compiling Code & Class Generation" + (:url "Documentation" "http://clojure.org/compilation") + (clojure.core *compile-files* *compile-path* *file* *warn-on-reflection* compile gen-class gen-interface loaded-libs test)) + ("Misc" + (clojure.core eval force hash name *clojure-version* clojure-version *command-line-args*)) + ("Pretty Printing" + (clojure.pprint pprint print-table pp *print-right-margin*)) + ("Browser / Shell" + (clojure.java.browse browse-url) + (clojure.java.shell sh with-sh-dir with-sh-env))) + + ("Vars & Global Environment" + (:url "Documentation" "http://clojure.org/vars") + ("Def Variants" + (:special def) + (clojure.core defn defn- definline defmacro defmethod defmulti defonce defrecord)) + ("Interned Vars" + (:special var) + (clojure.core declare intern binding find-var)) + ("Var Objects" + (clojure.core with-local-vars var-get var-set alter-var-root var?)) + ("Var Validators" + (clojure.core set-validator! get-validator))) + + ("Abstractions" + ("Protocols" + (:url "Documentation" "http://clojure.org/protocols") + (clojure.core defprotocol extend extend-type extend-protocol reify extends? satisfies? extenders)) + ("Records & Types" + (:url "Documentation" "http://clojure.org/datatypes") + (clojure.core defrecord deftype)) + ("Multimethods" + (:url "Documentation" "http://clojure.org/multimethods") + ("Define" + (clojure.core defmulti defmethod)) + ("Dispatch" + (clojure.core get-method methods)) + ("Remove" + (clojure.core remove-method remove-all-methods)) + ("Prefer" + (clojure.core prefer-method prefers)) + ("Relation" + (clojure.core derive isa? parents ancestors descendants make-hierarchy)))) + + ("Macros" + (:url "Documentation" "http://clojure.org/macros") + ("Create" + (clojure.core defmacro definline)) + ("Debug" + (clojure.core macroexpand-1 macroexpand) + (clojure.walk macroexpand-all)) + ("Branch" + (clojure.core and or when when-not when-let when-first if-not if-let cond condp case)) + ("Loop" + (clojure.core for doseq dotimes while)) + ("Arrange" + (clojure.core .. doto ->)) + ("Scope" + (clojure.core binding locking time) + (clojure.core with-in-str with-local-vars with-open with-out-str with-precision with-redefs with-redefs-fn)) + ("Lazy" + (clojure.core lazy-cat lazy-seq delay delay?)) + ("Doc." + (clojure.core assert comment) + (clojure.repl doc dir dir-fn source-fn))) + + ("Java Interop" + (:url "Documentation" "http://clojure.org/java_interop") + ("General" + (:special new set!) + (clojure.core .. doto bean comparator enumeration-seq import iterator-seq memfn definterface supers bases)) + ("Cast" + (clojure.core boolean byte short char int long float double bigdec bigint num cast biginteger)) + ("Java Arrays" + ("Create" + (clojure.core boolean-array byte-array double-array char-array float-array int-array long-array make-array object-array short-array to-array)) + ("Manipulate" + (clojure.core aclone aget aset alength amap areduce aset-int aset-long aset-short aset-boolean aset-byte aset-char aset-double aset-float)) + ("Cast" + (clojure.core booleans bytes chars doubles floats ints longs shorts))) + ("Exceptions" + (:special throw try catch finally) + (clojure.core ex-info ex-data) + (clojure.repl pst))) + + ("Namespaces" + (:url "Documentation" "http://clojure.org/namespaces") + ("Current" + (clojure.core *ns*)) + ("Create Switch" + (clojure.core ns in-ns create-ns)) + ("Add" + (clojure.core alias import intern refer refer-clojure)) + ("Find" + (clojure.core all-ns find-ns)) + ("Examine" + (clojure.core ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers)) + ("From symbol" + (clojure.core resolve namespace ns-resolve the-ns)) + ("Remove" + (clojure.core ns-unalias ns-unmap remove-ns))) + ("Loading" + ("Load libs" + (clojure.core require use import refer)) + ("List Loaded" + (clojure.core loaded-libs)) + ("Load Misc" + (clojure.core load load-file load-reader load-string))) + + ("Concurrency" + (:url "Documentation" "http://clojure.org/atoms") + ("Atoms" + (clojure.core atom swap! reset! compare-and-set!)) + ("Futures" + (clojure.core future future-call future-cancel future-cancelled? future-done? future?)) + ("Threads" + (clojure.core bound-fn bound-fn* get-thread-bindings pop-thread-bindings push-thread-bindings)) + + ("Misc" + (clojure.core locking pcalls pvalues pmap seque promise deliver)) + + ("Refs & Transactions" + (:url "Documentation" "http://clojure.org/refs") + ("Create" + (clojure.core ref)) + ("Examine" + (clojure.core deref)) + ("Transaction" + (clojure.core sync dosync io!)) + ("In Transaction" + (clojure.core ensure ref-set alter commute)) + ("Validators" + (clojure.core get-validator set-validator!)) + ("History" + (clojure.core ref-history-count ref-max-history ref-min-history))) + + ("Agents & Asynchronous Actions" + (:url "Documentation" "http://clojure.org/agents") + ("Create" + (clojure.core agent)) + ("Examine" + (clojure.core agent-error)) + ("Change State" + (clojure.core send send-off restart-agent send-via set-agent-send-executor! set-agent-send-off-executor!)) + ("Block Waiting" + (clojure.core await await-for)) + ("Ref Validators" + (clojure.core get-validator set-validator!)) + ("Watchers" + (clojure.core add-watch remove-watch)) + ("Thread Handling" + (clojure.core shutdown-agents)) + ("Error" + (clojure.core error-handler set-error-handler! error-mode set-error-mode!)) + ("Misc" + (clojure.core *agent* release-pending-sends)))) + + ("Sequences" + ("Creating a Lazy Seq" + ("From Collection" + (clojure.core seq sequence keys vals rseq subseq rsubseq)) + ("From Producer Fn" + (clojure.core lazy-seq repeatedly iterate)) + ("From Constant" + (clojure.core repeat range)) + ("From Other" + (clojure.core file-seq line-seq resultset-seq re-seq tree-seq xml-seq iterator-seq enumeration-seq)) + ("From Seq" + (clojure.core keep keep-indexed))) + + ("Seq in, Seq out" + ("Get shorter" + (clojure.core distinct filter remove for)) + ("Get longer" + (clojure.core cons conj concat lazy-cat mapcat cycle interleave interpose))) + ("Tail-items" + (clojure.core rest nthrest fnext nnext drop drop-while take-last for)) + ("Head-items" + (clojure.core take take-nth take-while butlast drop-last for)) + ("'Change'" + (clojure.core conj concat distinct flatten group-by partition partition-all partition-by split-at split-with filter remove replace shuffle)) + ("Rearrange" + (clojure.core reverse sort sort-by compare)) + ("Process items" + (clojure.core map pmap map-indexed mapcat for replace seque)) + + ("Using a Seq" + ("Extract item" + (clojure.core first second last rest next ffirst nfirst fnext nnext nth nthnext rand-nth when-first max-key min-key)) + ("Construct coll" + (clojure.core zipmap into reduce reductions set vec into-array to-array-2d)) + ("Pass to fn" + (clojure.core apply)) + ("Search" + (clojure.core some filter)) + ("Force evaluation" + (clojure.core doseq dorun doall)) + ("Check for forced" + (clojure.core realized?)))) + + ("Zippers" + ("Create" + (clojure.zip zipper seq-zip vector-zip xml-zip)) + ("Get loc" + (clojure.zip up down left right leftmost rightmost)) + ("Get seq" + (clojure.zip lefts rights path children)) + ("'Change'" + (clojure.zip make-node replace edit insert-child insert-left insert-right append-child remove)) + ("Move" + (clojure.zip next prev)) + ("XML" + (clojure.data.zip.xml attr attr= seq-test tag= text text= xml-> xml1->)) + ("Misc" + (clojure.zip root node branch? end?))) + + ("Documentation" + ("REPL" + (clojure.repl doc find-doc apropos source pst) + (clojure.java.javadoc javadoc))) + + ("Transients" + (:url "Documentation" "http://clojure.org/transients") + ("Create") + (clojure.core transient persistent!) + ("Change") + (clojure.core conj! pop! assoc! dissoc! disj!)) + ("Misc" + ("Compare" + (clojure.core = == identical? not= not compare) + (clojure.data diff)) + ("Test" + (clojure.core true? false? nil? instance?))) + + ("IO" + ("To/from ..." + (clojure.core spit slurp)) + ("To *out*" + (clojure.core pr prn print printf println newline) + (clojure.pprint print-table)) + ("To writer" + (clojure.pprint pprint cl-format)) + ("To string" + (clojure.core format with-out-str pr-str prn-str print-str println-str)) + ("From *in*" + (clojure.core read-line read)) + ("From reader" + (clojure.core line-seq read)) + ("From string" + (clojure.core read-string with-in-str)) + ("Open" + (clojure.core with-open) + (clojure.java.io reader writer input-stream output-stream)) + ("Interop" + (clojure.java.io make-writer make-reader make-output-stream make-input-stream)) + ("Misc" + (clojure.core flush file-seq *in* *out* *err*) + (clojure.java.io file copy delete-file resource as-file as-url as-relative-path make-parents))) + + ("Metadata" + (clojure.core meta with-meta alter-meta! reset-meta! vary-meta)) + + ("Special Forms" + (:url "Documentation" "http://clojure.org/special_forms") + (:special def if do quote var recur throw try monitor-enter monitor-exit) + (clojure.core fn loop) + ("Binding / Destructuring" + (clojure.core let fn letfn defn defmacro loop for doseq if-let when-let))) + ("Async" + ("Main" + (clojure.core.async go go-loop ! >!! chan put! take take! close! timeout)) + ("Choice" + (clojure.core.async alt! alt!! alts! alts!! do-alts)) + ("Buffering" + (clojure.core.async buffer dropping-buffer sliding-buffer unblocking-buffer?)) + ("Threading" + (clojure.core.async thread thread-call)) + + ("Mixing" + (clojure.core.async admix solo-mode mix unmix unmix-all toggle merge pipe unique)) + ("Multiples" + (clojure.core.async mult tap untap untap-all)) + ("Publish/Subscribe" + (clojure.core.async pub sub unsub unsub-all)) + ("Higher Order" + (clojure.core.async filter< filter> map map< map> mapcat< mapcat> partition partition-by reduce remove< remove> split)) + ("Pre-Populate" + (clojure.core.async into onto-chan to-chan))) + ("Unit Tests" + ("Defining" + (clojure.test deftest deftest- testing is are)) + ("Running" + (clojure.test run-tests run-all-tests)) + ("Fixtures" + (clojure.test use-fixtures join-fixtures compose-fixtures)))) + "A data structure designed for the maintainer's convenience, which we +transform into the format that helm requires. + +It's a tree, where the head of each list determines the context of the rest of the list. +The head may be: + + A string, in which case it's a (sub)heading for the rest of the items. + A symbol, in which case it's the Clojure namespace of the symbols that follow it. + The keyword :special, in which case it's a Clojure special form - a symbol with no + Any other keyword, in which case it's a typed item that will be passed + through and handled in `clojure-cheatsheet/item-to-helm-source'.") + +;;; We could just make dash.el a dependency, but I'm not sure it's worth it for one utility macro. +(defmacro clojure-cheatsheet/->> + (&rest body) + (let ((result (pop body))) + (dolist (form body result) + (setq result (append (if (sequencep form) + form + (list form)) + (list result)))))) + +(defun clojure-cheatsheet/treewalk + (before after node) + "Walk a tree. Invoke BEFORE before the walk, and AFTER after it, on each NODE." + (clojure-cheatsheet/->> node + (funcall before) + ((lambda (new-node) + (if (listp new-node) + (mapcar (lambda (child) + (clojure-cheatsheet/treewalk before after child)) + new-node) + new-node))) + (funcall after))) + +(defun clojure-cheatsheet/symbol-qualifier + (namespace symbol) + "Given a (Clojure) namespace and a symbol, fully-qualify that symbol." + (intern (format "%s/%s" namespace symbol))) + +(defun clojure-cheatsheet/string-qualifier + (head subnode) + (cond + ((keywordp (car subnode)) (list head subnode)) + ((symbolp (car subnode)) (cons head subnode)) + ((stringp (car subnode)) (cons (format "%s : %s" head (car subnode)) + (cdr subnode))) + (t (mapcar (apply-partially 'clojure-cheatsheet/string-qualifier head) subnode)))) + +(defun clojure-cheatsheet/propagate-headings + (node) + (clojure-cheatsheet/treewalk + #'identity + (lambda (item) + (if (listp item) + (destructuring-bind (head &rest tail) item + (cond ((equal :special head) tail) + ((keywordp head) item) + ((symbolp head) (mapcar (apply-partially #'clojure-cheatsheet/symbol-qualifier head) tail)) + ((stringp head) (mapcar (apply-partially #'clojure-cheatsheet/string-qualifier head) tail)) + (t item))) + item)) + node)) + +(defun clojure-cheatsheet/flatten + (node) + "Flatten NODE, which is a tree structure, into a list of its leaves." + (cond + ((not (listp node)) node) + ((keywordp (car node)) node) + ((listp (car node)) (apply 'append (mapcar 'clojure-cheatsheet/flatten node))) + (t (list (mapcar 'clojure-cheatsheet/flatten node))))) + +(defun clojure-cheatsheet/group-by-head + (data) + "Group the DATA, which should be a list of lists, by the head of each list." + (let ((result '())) + (dolist (item data result) + (let* ((head (car item)) + (tail (cdr item)) + (current (cdr (assoc head result)))) + (if current + (setf (cdr (assoc head result)) + (append current tail)) + (setq result (append result (list item)))))))) + +(defun clojure-cheatsheet/lookup-doc + (symbol) + (if (nrepl-current-connection-buffer) + (cider-doc-lookup symbol) + (error "nREPL not connected!"))) + +(defun clojure-cheatsheet/lookup-src + (symbol) + (if (nrepl-current-connection-buffer) + (cider-src-handler symbol) + (error "nREPL not connected!"))) + +(defun clojure-cheatsheet/item-to-helm-source + (item) + "Turn ITEM, which will be (\"HEADING\" candidates...), into a helm-source." + (destructuring-bind (heading &rest entries) item + `((name . ,heading) + (candidates ,@(mapcar (lambda (item) + (if (and (listp item) + (keywordp (car item))) + (destructuring-bind (kind title value) item + (cons title + (list kind value))) + item)) + entries)) + (match . ((lambda (candidate) + (helm-mp-3-match (format "%s %s" candidate ,heading))))) + (action-transformer (lambda (action-list current-selection) + (if (and (listp current-selection) + (eq (car current-selection) :url)) + '(("Browse" . (lambda (item) + (helm-browse-url (cadr item))))) + '(("Lookup Docs" . clojure-cheatsheet/lookup-doc) + ("Lookup Source" . clojure-cheatsheet/lookup-src)))))))) + +(defvar helm-source-clojure-cheatsheet + (clojure-cheatsheet/->> clojure-cheatsheet-hierarchy + clojure-cheatsheet/propagate-headings + clojure-cheatsheet/flatten + clojure-cheatsheet/group-by-head + (mapcar 'clojure-cheatsheet/item-to-helm-source))) + +;;;###autoload +(defun clojure-cheatsheet () + "Use helm to show a Clojure cheatsheet." + (interactive) + (helm :sources helm-source-clojure-cheatsheet)) + +(provide 'clojure-cheatsheet) + +;;; clojure-cheatsheet.el ends here diff --git a/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet.elc b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet.elc new file mode 100644 index 000000000..b24871b68 Binary files /dev/null and b/elpa/clojure-cheatsheet-20140316.1520/clojure-cheatsheet.elc differ diff --git a/elpa/clojure-mode-20140804.823/clojure-mode-autoloads.el b/elpa/clojure-mode-20140804.823/clojure-mode-autoloads.el new file mode 100644 index 000000000..274b6e5e5 --- /dev/null +++ b/elpa/clojure-mode-20140804.823/clojure-mode-autoloads.el @@ -0,0 +1,33 @@ +;;; clojure-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (clojure-mode) "clojure-mode" "clojure-mode.el" +;;;;;; (21478 8071 0 0)) +;;; Generated autoloads from clojure-mode.el + +(autoload 'clojure-mode "clojure-mode" "\ +Major mode for editing Clojure code. + +\\{clojure-mode-map} + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.\\(clj[sx]?\\|dtm\\|edn\\)\\'" . clojure-mode)) + +;;;*** + +;;;### (autoloads nil nil ("clojure-mode-pkg.el") (21478 8071 339807 +;;;;;; 0)) + +;;;*** + +(provide 'clojure-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; clojure-mode-autoloads.el ends here diff --git a/elpa/clojure-mode-20140804.823/clojure-mode-pkg.el b/elpa/clojure-mode-20140804.823/clojure-mode-pkg.el new file mode 100644 index 000000000..a0d065845 --- /dev/null +++ b/elpa/clojure-mode-20140804.823/clojure-mode-pkg.el @@ -0,0 +1 @@ +(define-package "clojure-mode" "20140804.823" "Major mode for Clojure code" (quote nil)) diff --git a/elpa/clojure-mode-20140804.823/clojure-mode-pkg.elc b/elpa/clojure-mode-20140804.823/clojure-mode-pkg.elc new file mode 100644 index 000000000..875b3bcc1 Binary files /dev/null and b/elpa/clojure-mode-20140804.823/clojure-mode-pkg.elc differ diff --git a/elpa/clojure-mode-20140804.823/clojure-mode.el b/elpa/clojure-mode-20140804.823/clojure-mode.el new file mode 100644 index 000000000..1cd630684 --- /dev/null +++ b/elpa/clojure-mode-20140804.823/clojure-mode.el @@ -0,0 +1,1093 @@ +;;; clojure-mode.el --- Major mode for Clojure code + +;; Copyright © 2007-2014 Jeffrey Chu, Lennart Staflin, Phil Hagelberg +;; Copyright © 2013-2014 Bozhidar Batsov +;; +;; Authors: Jeffrey Chu +;; Lennart Staflin +;; Phil Hagelberg +;; Bozhidar Batsov +;; URL: http://github.com/clojure-emacs/clojure-mode +;; Version: 20140804.823 +;; X-Original-Version: 3.0.0-cvs +;; Keywords: languages, lisp + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Provides font-lock, indentation, and navigation for the Clojure +;; programming language (http://clojure.org). + +;; Users of older Emacs (pre-22) should get version 1.4: +;; http://github.com/clojure-emacs/clojure-mode/tree/1.4 + +;; Slime integration has been removed; see the 1.x releases if you need it. + +;; Using clojure-mode with paredit is highly recommended. Use paredit +;; as you would with any other minor mode; for instance: +;; +;; ;; require or autoload paredit-mode +;; (add-hook 'clojure-mode-hook 'paredit-mode) + +;; See CIDER (http://github.com/clojure-emacs/cider) for +;; better interaction with subprocesses via nREPL. + +;;; License: + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + + +;;; Compatibility +(eval-and-compile + ;; `setq-local' for Emacs 24.2 and below + (unless (fboundp 'setq-local) + (defmacro setq-local (var val) + "Set variable VAR to value VAL in current buffer." + `(set (make-local-variable ',var) ,val)))) + +(eval-when-compile + (defvar calculate-lisp-indent-last-sexp) + (defvar font-lock-beg) + (defvar font-lock-end) + (defvar paredit-space-for-delimiter-predicates) + (defvar paredit-version) + (defvar paredit-mode)) + +(require 'cl) +(require 'tramp) +(require 'inf-lisp) +(require 'imenu) + +(declare-function lisp-fill-paragraph "lisp-mode" (&optional justify)) + +(defgroup clojure nil + "A mode for Clojure" + :prefix "clojure-" + :group 'languages + :link '(url-link :tag "Github" "https://github.com/clojure-emacs/clojure-mode") + :link '(emacs-commentary-link :tag "Commentary" "clojure-mode")) + +(defface clojure-keyword-face + '((t (:inherit font-lock-constant-face))) + "Face used to font-lock Clojure keywords (:something)." + :group 'clojure + :package-version '(clojure-mode . "3.0.0")) + +(defface clojure-character-face + '((t (:inherit font-lock-string-face))) + "Face used to font-lock Clojure character literals." + :group 'clojure + :package-version '(clojure-mode . "3.0.0")) + +(defface clojure-interop-method-face + '((t (:inherit font-lock-preprocessor-face))) + "Face used to font-lock interop method names (camelCase)." + :group 'clojure + :package-version '(clojure-mode . "3.0.0")) + +(defcustom clojure-load-command "(clojure.core/load-file \"%s\")\n" + "Format-string for building a Clojure expression to load a file. +This format string should use `%s' to substitute a file name and +should result in a Clojure expression that will command the +inferior Clojure to load that file." + :type 'string + :group 'clojure + :safe 'stringp) + +(defcustom clojure-inf-lisp-command "lein repl" + "The command used by `inferior-lisp-program'." + :type 'string + :group 'clojure + :safe 'stringp) + +(defcustom clojure-defun-style-default-indent nil + "When non-nil, use default indenting for functions and macros. +Otherwise check `define-clojure-indent' and `put-clojure-indent'." + :type 'boolean + :group 'clojure + :safe 'booleanp) + +(defcustom clojure-use-backtracking-indent t + "When non-nil, enable context sensitive indentation." + :type 'boolean + :group 'clojure + :safe 'booleanp) + +(defcustom clojure-max-backtracking 3 + "Maximum amount to backtrack up a list to check for context." + :type 'integer + :group 'clojure + :safe 'integerp) + +(defcustom clojure-docstring-fill-column fill-column + "Value of `fill-column' to use when filling a docstring." + :type 'integer + :group 'clojure + :safe 'integerp) + +(defcustom clojure-docstring-fill-prefix-width 2 + "Width of `fill-prefix' when filling a docstring. +The default value conforms with the de facto convention for +Clojure docstrings, aligning the second line with the opening +double quotes on the third column." + :type 'integer + :group 'clojure + :safe 'integerp) + +(defcustom clojure-omit-space-between-tag-and-delimiters '(?\[ ?\{) + "Allowed opening delimiter characters after a reader literal tag. +For example, \[ is allowed in :db/id[:db.part/user]." + :type '(set (const :tag "[" ?\[) + (const :tag "{" ?\{) + (const :tag "(" ?\() + (const :tag "\"" ?\")) + :group 'clojure + :safe (lambda (value) + (and (listp value) + (every 'characterp value)))) + +(defvar clojure-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map lisp-mode-shared-map) + (define-key map (kbd "C-M-x") 'lisp-eval-defun) + (define-key map (kbd "C-x C-e") 'lisp-eval-last-sexp) + (define-key map (kbd "C-c C-e") 'lisp-eval-last-sexp) + (define-key map (kbd "C-c C-l") 'clojure-load-file) + (define-key map (kbd "C-c C-r") 'lisp-eval-region) + (define-key map (kbd "C-c C-z") 'clojure-display-inferior-lisp-buffer) + (define-key map (kbd "C-:") 'clojure-toggle-keyword-string) + (easy-menu-define clojure-mode-menu map "Clojure Mode menu" + '("Clojure" + ["Eval Top-Level Expression" lisp-eval-defun] + ["Eval Last Expression" lisp-eval-last-sexp] + ["Eval Region" lisp-eval-region] + "--" + ["Run Inferior Lisp" clojure-display-inferior-lisp-buffer] + ["Display Inferior Lisp Buffer" clojure-display-inferior-lisp-buffer] + ["Load File" clojure-load-file] + "--" + ["Toggle between string & keyword" clojure-toggle-keyword-string] + ["Mark string" clojure-mark-string] + ["Insert ns form at point" clojure-insert-ns-form-at-point] + ["Insert ns form at beginning" clojure-insert-ns-form] + ["Update ns form" clojure-update-ns] + "--" + ["Version" clojure-mode-display-version])) + map) + "Keymap for Clojure mode. Inherits from `lisp-mode-shared-map'.") + +(defvar clojure-mode-syntax-table + (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table))) + (modify-syntax-entry ?~ "' " table) + (modify-syntax-entry ?\{ "(}" table) + (modify-syntax-entry ?\} "){" table) + (modify-syntax-entry ?\[ "(]" table) + (modify-syntax-entry ?\] ")[" table) + (modify-syntax-entry ?^ "'" table) + ;; Make hash a usual word character + (modify-syntax-entry ?# "_ p" table) + table)) + +(defvar clojure-prev-l/c-dir/file nil + "Record last directory and file used in loading or compiling. +This holds a cons cell of the form `(DIRECTORY . FILE)' +describing the last `clojure-load-file' or `clojure-compile-file' command.") + +(defconst clojure-mode-version "3.0.0-snapshot" + "The current version of `clojure-mode'.") + +(defun clojure-mode-display-version () + "Display the current `clojure-mode-version' in the minibuffer." + (interactive) + (message "clojure-mode (version %s)" clojure-mode-version)) + +;; For compatibility with Emacs < 24, derive conditionally +(defalias 'clojure-parent-mode + (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) + +(defun clojure-space-for-delimiter-p (endp delim) + "Prevent paredit from inserting useless spaces. +See `paredit-space-for-delimiter-predicates' for the meaning of +ENDP and DELIM." + (if (derived-mode-p 'clojure-mode) + (save-excursion + (backward-char) + (if (and (or (char-equal delim ?\() + (char-equal delim ?\") + (char-equal delim ?{)) + (not endp)) + (if (char-equal (char-after) ?#) + (and (not (bobp)) + (or (char-equal ?w (char-syntax (char-before))) + (char-equal ?_ (char-syntax (char-before))))) + t) + t)) + t)) + +(defun clojure-no-space-after-tag (endp delimiter) + "Prevent inserting a space after a reader-literal tag? + +When a reader-literal tag is followed be an opening delimiter +listed in `clojure-omit-space-between-tag-and-delimiters', this +function returns t. + +This allows you to write things like #db/id[:db.part/user] +without inserting a space between the tag and the opening +bracket. + +See `paredit-space-for-delimiter-predicates' for the meaning of +ENDP and DELIMITER." + (if endp + t + (or (not (member delimiter clojure-omit-space-between-tag-and-delimiters)) + (save-excursion + (let ((orig-point (point))) + (not (and (re-search-backward + "#\\([a-zA-Z0-9._-]+/\\)?[a-zA-Z0-9._-]+" + (line-beginning-position) + t) + (= orig-point (match-end 0))))))))) + +;;;###autoload +(define-derived-mode clojure-mode clojure-parent-mode "Clojure" + "Major mode for editing Clojure code. + +\\{clojure-mode-map}" + (setq-local imenu-create-index-function + (lambda () + (imenu--generic-function '((nil clojure-match-next-def 0))))) + (setq-local indent-tabs-mode nil) + (lisp-mode-variables nil) + (setq fill-paragraph-function 'clojure-fill-paragraph) + (setq adaptive-fill-function 'clojure-adaptive-fill-function) + (setq-local normal-auto-fill-function 'clojure-auto-fill-function) + (setq-local comment-start-skip + "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") + (setq-local indent-line-function 'clojure-indent-line) + (setq-local lisp-indent-function 'clojure-indent-function) + (when (< emacs-major-version 24) + (setq-local forward-sexp-function 'clojure-forward-sexp)) + (setq-local lisp-doc-string-elt-property 'clojure-doc-string-elt) + (setq-local inferior-lisp-program clojure-inf-lisp-command) + (setq-local parse-sexp-ignore-comments t) + (clojure-mode-font-lock-setup) + (setq-local open-paren-in-column-0-is-defun-start nil) + (add-hook 'paredit-mode-hook + (lambda () + (when (>= paredit-version 21) + (define-key clojure-mode-map "{" 'paredit-open-curly) + (define-key clojure-mode-map "}" 'paredit-close-curly) + (add-to-list 'paredit-space-for-delimiter-predicates + 'clojure-space-for-delimiter-p) + (add-to-list 'paredit-space-for-delimiter-predicates + 'clojure-no-space-after-tag))))) + +(defsubst clojure-in-docstring-p () + "Check whether point is in a docstring." + (eq (get-text-property (1- (point-at-eol)) 'face) + 'font-lock-doc-face)) + +(defsubst clojure-docstring-fill-prefix () + "The prefix string used by `clojure-fill-paragraph'. + +It is simply `clojure-docstring-fill-prefix-width' number of spaces." + (make-string clojure-docstring-fill-prefix-width ? )) + +(defun clojure-adaptive-fill-function () + "Clojure adaptive fill function. +This only takes care of filling docstring correctly." + (when (clojure-in-docstring-p) + (clojure-docstring-fill-prefix))) + +(defun clojure-fill-paragraph (&optional justify) + "Like `fill-paragraph' but handle Clojure docstrings." + (if (clojure-in-docstring-p) + (let ((paragraph-start + (concat paragraph-start + "\\|\\s-*\\([(;:\"[]\\|~@\\|`(\\|#'(\\)")) + (paragraph-separate + (concat paragraph-separate "\\|\\s-*\".*[,\\.]$")) + (fill-column (or clojure-docstring-fill-column fill-column)) + (fill-prefix (clojure-docstring-fill-prefix))) + (fill-paragraph justify)) + (let ((paragraph-start (concat paragraph-start + "\\|\\s-*\\([(;:\"[]\\|`(\\|#'(\\)")) + (paragraph-separate + (concat paragraph-separate "\\|\\s-*\".*[,\\.[]$"))) + (or (fill-comment-paragraph justify) + (fill-paragraph justify)) + ;; Always return `t' + t))) + +(defun clojure-auto-fill-function () + "Clojure auto-fill function." + ;; Check if auto-filling is meaningful. + (let ((fc (current-fill-column))) + (when (and fc (> (current-column) fc)) + (let ((fill-column (if (clojure-in-docstring-p) + clojure-docstring-fill-column + fill-column)) + (fill-prefix (clojure-adaptive-fill-function))) + (do-auto-fill))))) + +(defun clojure-display-inferior-lisp-buffer () + "Display a buffer bound to `inferior-lisp-buffer'." + (interactive) + (if (and inferior-lisp-buffer (get-buffer inferior-lisp-buffer)) + (pop-to-buffer inferior-lisp-buffer t) + (run-lisp inferior-lisp-program))) + +(defun clojure-load-file (file-name) + "Load a Clojure file FILE-NAME into the inferior Clojure process." + (interactive (comint-get-source "Load Clojure file: " + clojure-prev-l/c-dir/file + '(clojure-mode) t)) + (comint-check-source file-name) ; Check to see if buffer needs saved. + (setq clojure-prev-l/c-dir/file (cons (file-name-directory file-name) + (file-name-nondirectory file-name))) + (comint-send-string (inferior-lisp-proc) + (format clojure-load-command file-name)) + (switch-to-lisp t)) + + + +(defun clojure-match-next-def () + "Scans the buffer backwards for the next top-level definition. +Called by `imenu--generic-function'." + (when (re-search-backward "^(def\\sw*" nil t) + (save-excursion + (let (found? + (start (point))) + (down-list) + (forward-sexp) + (while (not found?) + (forward-sexp) + (or (if (char-equal ?[ (char-after (point))) + (backward-sexp)) + (if (char-equal ?) (char-after (point))) + (backward-sexp))) + (destructuring-bind (def-beg . def-end) (bounds-of-thing-at-point 'sexp) + (if (char-equal ?^ (char-after def-beg)) + (progn (forward-sexp) (backward-sexp)) + (setq found? t) + (set-match-data (list def-beg def-end))))) + (goto-char start))))) + +(defconst clojure-font-lock-keywords + (eval-when-compile + `(;; Top-level variable definition + (,(concat "(\\(?:clojure.core/\\)?\\(" + (regexp-opt '("def" "defonce")) + ;; variable declarations + "\\)\\>" + ;; Any whitespace + "[ \r\n\t]*" + ;; Possibly type or metadata + "\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*" + "\\(\\sw+\\)?") + (1 font-lock-keyword-face) + (2 font-lock-variable-name-face nil t)) + ;; Type definition + (,(concat "(\\(?:clojure.core/\\)?\\(" + (regexp-opt '("defstruct" "deftype" "defprotocol" + "defrecord")) + ;; type declarations + "\\)\\>" + ;; Any whitespace + "[ \r\n\t]*" + ;; Possibly type or metadata + "\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*" + "\\(\\sw+\\)?") + (1 font-lock-keyword-face) + (2 font-lock-type-face nil t)) + ;; Function definition (anything that starts with def and is not + ;; listed above) + (,(concat "(\\(?:[a-z\.-]+/\\)?\\(def\[a-z\-\]*-?\\)" + ;; Function declarations + "\\>" + ;; Any whitespace + "[ \r\n\t]*" + ;; Possibly type or metadata + "\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*" + "\\(\\sw+\\)?") + (1 font-lock-keyword-face) + (2 font-lock-function-name-face nil t)) + ;; (fn name? args ...) + (,(concat "(\\(?:clojure.core/\\)?\\(fn\\)[ \t]+" + ;; Possibly type + "\\(?:#?^\\sw+[ \t]*\\)?" + ;; Possibly name + "\\(t\\sw+\\)?" ) + (1 font-lock-keyword-face) + (2 font-lock-function-name-face nil t)) + ;; lambda arguments - %, %1, %2, etc + ("\\<%[1-9]?" (0 font-lock-variable-name-face)) + ;; (ns namespace) + (,(concat "(\\(?:clojure.core/\\)?ns[ \t]+" + ;; namespace + "\\(\\sw+\\)" ) + (1 font-lock-type-face nil t)) + ;; Special forms & control structures + (,(concat + "(\\(?:clojure.core/\\)?" + (regexp-opt + '("let" "letfn" "do" + "case" "cond" "condp" + "for" "loop" "recur" + "when" "when-not" "when-let" "when-first" "when-some" + "if" "if-let" "if-not" "if-some" + "." ".." "->" "->>" "doto" + "and" "or" + "dosync" "doseq" "dotimes" "dorun" "doall" + "load" "import" "unimport" "ns" "in-ns" "refer" + "try" "catch" "finally" "throw" + "with-open" "with-local-vars" "binding" + "gen-class" "gen-and-load-class" "gen-and-save-class" + "handler-case" "handle" "var" "declare") t) + "\\>") + 1 font-lock-keyword-face) + (,(concat + "\\<" + (regexp-opt + '("*1" "*2" "*3" "*agent*" + "*allow-unresolved-vars*" "*assert*" "*clojure-version*" + "*command-line-args*" "*compile-files*" + "*compile-path*" "*e" "*err*" "*file*" "*flush-on-newline*" + "*in*" "*macro-meta*" "*math-context*" "*ns*" "*out*" + "*print-dup*" "*print-length*" "*print-level*" + "*print-meta*" "*print-readably*" + "*read-eval*" "*source-path*" + "*use-context-classloader*" "*warn-on-reflection*") + t) + "\\>") + 0 font-lock-builtin-face) + ;; Dynamic variables - *something* + ("\\<\\*[a-z-]*\\*\\>" 0 font-lock-variable-name-face) + ;; Global constants - nil, true, false + (,(concat + "\\<" + (regexp-opt + '("true" "false" "nil") t) + "\\>") + 0 font-lock-constant-face) + ;; Character literals - \1, \a, \newline, \u0000 + ;; FIXME: handle properly punctuations characters (commas after a character are problematic) + ("\\\\[a-z0-9]+\\>" 0 'clojure-character-face) + ;; Constant values (keywords), including as metadata e.g. ^:static + ("\\<^?\\(:\\(\\sw\\|\\s_\\)+\\(\\>\\|\\_>\\)\\)" 1 'clojure-keyword-face) + ;; cljx annotations (#+clj and #+cljs) + ("#\\+cljs?\\>" 0 font-lock-preprocessor-face) + ;; Java interop highlighting + ;; CONST SOME_CONST (optionally prefixed by /) + ("\\(?:\\<\\|/\\)\\([A-Z]+\\|\\([A-Z]+_[A-Z1-9_]+\\)\\)\\>" 1 font-lock-constant-face) + ;; .foo .barBaz .qux01 .-flibble .-flibbleWobble + ("\\<\\.-?[a-z][a-zA-Z0-9]*\\>" 0 'clojure-interop-method-face) + ;; Foo Bar$Baz Qux_ World_OpenUDP Foo. Babylon15. + ("\\(?:\\<\\|\\.\\|/\\|#?^\\)\\([A-Z][a-zA-Z0-9_]*[a-zA-Z0-9$_]+\\.?\\>\\)" 1 font-lock-type-face) + ;; foo.bar.baz + ("\\<[a-z][a-z0-9_-]+\\.\\([a-z][a-z0-9_-]+\\.?\\)+" 0 font-lock-type-face) + ;; foo/ Foo/ + ("\\<\\([a-zA-Z][a-z0-9_-]*\\)/" 1 font-lock-type-face) + ;; fooBar + ("\\(?:\\<\\|/\\)\\([a-z]+[A-Z]+[a-z][a-zA-Z0-9$]*\\>\\)" 1 'clojure-interop-method-face) + ;; Highlight grouping constructs in regular expressions + (clojure-mode-font-lock-regexp-groups + (1 'font-lock-regexp-grouping-construct prepend)))) + "Default expressions to highlight in Clojure mode.") + +(defun clojure-mode-font-lock-setup () + "Configures font-lock for editing Clojure code." + (interactive) + (setq-local font-lock-multiline t) + (add-to-list 'font-lock-extend-region-functions + 'clojure-font-lock-extend-region-def t) + (setq font-lock-defaults + '(clojure-font-lock-keywords ; keywords + nil nil + (("+-*/.<>=!?$%_&~^:@" . "w")) ; syntax alist + nil + (font-lock-mark-block-function . mark-defun) + (font-lock-syntactic-face-function + . lisp-font-lock-syntactic-face-function)))) + +(defun clojure-font-lock-def-at-point (point) + "Range between the top-most def* and the fourth element after POINT. +Note that this means that there is no guarantee of proper font +locking in def* forms that are not at top level." + (goto-char point) + (condition-case nil + (beginning-of-defun) + (error nil)) + + (let ((beg-def (point))) + (when (and (not (= point beg-def)) + (looking-at "(def")) + (condition-case nil + (progn + ;; move forward as much as possible until failure (or success) + (forward-char) + (dotimes (i 4) + (forward-sexp))) + (error nil)) + (cons beg-def (point))))) + +(defun clojure-font-lock-extend-region-def () + "Set region boundaries to include the first four elements of def* forms." + (let ((changed nil)) + (let ((def (clojure-font-lock-def-at-point font-lock-beg))) + (when def + (destructuring-bind (def-beg . def-end) def + (when (and (< def-beg font-lock-beg) + (< font-lock-beg def-end)) + (setq font-lock-beg def-beg + changed t))))) + (let ((def (clojure-font-lock-def-at-point font-lock-end))) + (when def + (destructuring-bind (def-beg . def-end) def + (when (and (< def-beg font-lock-end) + (< font-lock-end def-end)) + (setq font-lock-end def-end + changed t))))) + changed)) + +(defun clojure-mode-font-lock-regexp-groups (bound) + "Highlight grouping constructs in regular expression. + +BOUND denotes the maximum number of characters (relative to the +point) to check." + (catch 'found + (while (re-search-forward (concat + ;; A group may start using several alternatives: + "\\(\\(?:" + ;; 1. (? special groups + "(\\?\\(?:" + ;; a) non-capturing group (?:X) + ;; b) independent non-capturing group (?>X) + ;; c) zero-width positive lookahead (?=X) + ;; d) zero-width negative lookahead (?!X) + "[:=!>]\\|" + ;; e) zero-width positive lookbehind (?<=X) + ;; f) zero-width negative lookbehind (?X) + "<[[:alnum:]]+>" + "\\)\\|" ;; end of special groups + ;; 2. normal capturing groups ( + ;; 3. we also highlight alternative + ;; separarators |, and closing parens ) + "[|()]" + "\\)\\)") + bound t) + (let ((face (get-text-property (1- (point)) 'face))) + (when (and (or (and (listp face) + (memq 'font-lock-string-face face)) + (eq 'font-lock-string-face face)) + (clojure-string-start t)) + (throw 'found t)))))) + +;; Docstring positions +(put 'ns 'clojure-doc-string-elt 2) +(put 'def 'clojure-doc-string-elt 2) +(put 'defn 'clojure-doc-string-elt 2) +(put 'defn- 'clojure-doc-string-elt 2) +(put 'defmulti 'clojure-doc-string-elt 2) +(put 'defmacro 'clojure-doc-string-elt 2) +(put 'definline 'clojure-doc-string-elt 2) +(put 'defprotocol 'clojure-doc-string-elt 2) + + + +(defun clojure-forward-sexp (n) + "Move forward across one balanced Clojure expression (sexp). + +It treats record literals like #user.Foo[1] and #user.Foo{:size 1} +as a single sexp so that CIDER will send them properly. + +This behavior may not be intuitive when the user presses C-M-f, but +since these are single objects this behavior is okay." + (let ((dir (if (> n 0) 1 -1)) + (forward-sexp-function nil)) ; force the built-in version + (while (not (zerop n)) + (forward-sexp dir) + (when (save-excursion ; move back to see if we're in a record literal + (and + (condition-case nil + (progn (backward-sexp) 't) + ('scan-error nil)) + (looking-at "#\\w"))) + (forward-sexp dir)) ; if so, jump over it + (setq n (- n dir))))) + +(defun clojure-indent-line () + "Indent current line as Clojure code." + (if (clojure-in-docstring-p) + (save-excursion + (beginning-of-line) + (when (looking-at "^\\s-*") + (replace-match (clojure-docstring-fill-prefix)))) + (lisp-indent-line))) + +(defun clojure-indent-function (indent-point state) + "This function is the normal value of the variable `lisp-indent-function'. +It is used when indenting a line within a function call, to see if the +called function says anything special about how to indent the line. + +INDENT-POINT is the position where the user typed TAB, or equivalent. +Point is located at the point to indent under (for default indentation); +STATE is the `parse-partial-sexp' state for that position. + +If the current line is in a call to a Lisp function +which has a non-nil property `lisp-indent-function', +that specifies how to do the indentation. + +The property value can be + +- `defun', meaning indent `defun'-style; +- an integer N, meaning indent the first N arguments specially + like ordinary function arguments and then indent any further + arguments like a body; +- a function to call just as this function was called. + If that function returns nil, that means it doesn't specify + the indentation. + +This function also returns nil meaning don't specify the indentation." + (let ((normal-indent (current-column))) + (goto-char (1+ (elt state 1))) + (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t) + (if (and (elt state 2) + (not (looking-at "\\sw\\|\\s_"))) + ;; car of form doesn't seem to be a symbol + (progn + (if (not (> (save-excursion (forward-line 1) (point)) + calculate-lisp-indent-last-sexp)) + (progn (goto-char calculate-lisp-indent-last-sexp) + (beginning-of-line) + (parse-partial-sexp (point) + calculate-lisp-indent-last-sexp 0 t))) + ;; Indent under the list or under the first sexp on the same + ;; line as calculate-lisp-indent-last-sexp. Note that first + ;; thing on that line has to be complete sexp since we are + ;; inside the innermost containing sexp. + (backward-prefix-chars) + (if (and (eq (char-after (point)) ?\[) + (eq (char-after (elt state 1)) ?\()) + (+ (current-column) 2) ;; this is probably inside a defn + (current-column))) + (let* ((function (buffer-substring (point) + (progn (forward-sexp 1) (point)))) + (open-paren (elt state 1)) + (method nil) + (function-tail (first + (last + (split-string (substring-no-properties function) "/"))))) + (setq method (get (intern-soft function-tail) 'clojure-indent-function)) + (cond ((member (char-after open-paren) '(?\[ ?\{)) + (goto-char open-paren) + (1+ (current-column))) + ((or (eq method 'defun) + (and clojure-defun-style-default-indent + ;; largely to preserve useful alignment of :require, etc in ns + (not (string-match "^:" function)) + (not method)) + (and (null method) + (> (length function) 3) + (string-match "\\`\\(?:\\S +/\\)?\\(def\\|with-\\)" + function))) + (lisp-indent-defform state indent-point)) + ((integerp method) + (lisp-indent-specform method state + indent-point normal-indent)) + (method + (funcall method indent-point state)) + (clojure-use-backtracking-indent + (clojure-backtracking-indent + indent-point state normal-indent))))))) + +(defun clojure-backtracking-indent (indent-point state normal-indent) + "Experimental backtracking support. + +Will upwards in an sexp to check for contextual indenting." + (let (indent (path) (depth 0)) + (goto-char (elt state 1)) + (while (and (not indent) + (< depth clojure-max-backtracking)) + (let ((containing-sexp (point))) + (parse-partial-sexp (1+ containing-sexp) indent-point 1 t) + (when (looking-at "\\sw\\|\\s_") + (let* ((start (point)) + (fn (buffer-substring start (progn (forward-sexp 1) (point)))) + (meth (get (intern-soft fn) 'clojure-backtracking-indent))) + (let ((n 0)) + (when (< (point) indent-point) + (condition-case () + (progn + (forward-sexp 1) + (while (< (point) indent-point) + (parse-partial-sexp (point) indent-point 1 t) + (incf n) + (forward-sexp 1))) + (error nil))) + (push n path)) + (when meth + (let ((def meth)) + (dolist (p path) + (if (and (listp def) + (< p (length def))) + (setq def (nth p def)) + (if (listp def) + (setq def (car (last def))) + (setq def nil)))) + (goto-char (elt state 1)) + (when def + (setq indent (+ (current-column) def))))))) + (goto-char containing-sexp) + (condition-case () + (progn + (backward-up-list 1) + (incf depth)) + (error (setq depth clojure-max-backtracking))))) + indent)) + +;; clojure backtracking indent is experimental and the format for these +;; entries are subject to change +(put 'implement 'clojure-backtracking-indent '(4 (2))) +(put 'letfn 'clojure-backtracking-indent '((2) 2)) +(put 'proxy 'clojure-backtracking-indent '(4 4 (2))) +(put 'reify 'clojure-backtracking-indent '((2))) +(put 'deftype 'clojure-backtracking-indent '(4 4 (2))) +(put 'defrecord 'clojure-backtracking-indent '(4 4 (2))) +(put 'defprotocol 'clojure-backtracking-indent '(4 (2))) +(put 'extend-type 'clojure-backtracking-indent '(4 (2))) +(put 'extend-protocol 'clojure-backtracking-indent '(4 (2))) +(put 'specify 'clojure-backtracking-indent '(4 (2))) +(put 'specify! 'clojure-backtracking-indent '(4 (2))) + +(defun put-clojure-indent (sym indent) + (put sym 'clojure-indent-function indent)) + +(defmacro define-clojure-indent (&rest kvs) + `(progn + ,@(mapcar (lambda (x) `(put-clojure-indent + (quote ,(first x)) ,(second x))) + kvs))) + +(defun add-custom-clojure-indents (name value) + (custom-set-default name value) + (mapcar (lambda (x) + (put-clojure-indent x 'defun)) + value)) + +(defcustom clojure-defun-indents nil + "List of additional symbols with defun-style indentation in Clojure. + +You can use this to let Emacs indent your own macros the same way +that it indents built-in macros like with-open. To manually set +it from Lisp code, use (put-clojure-indent 'some-symbol 'defun)." + :type '(repeat symbol) + :group 'clojure + :set 'add-custom-clojure-indents) + +(define-clojure-indent + ;; built-ins + (ns 1) + (fn 'defun) + (def 'defun) + (defn 'defun) + (bound-fn 'defun) + (if 1) + (if-not 1) + (case 1) + (condp 2) + (when 1) + (while 1) + (when-not 1) + (when-first 1) + (do 0) + (future 0) + (comment 0) + (doto 1) + (locking 1) + (proxy 2) + (with-open 1) + (with-precision 1) + (with-local-vars 1) + + (reify 'defun) + (deftype 2) + (defrecord 2) + (defprotocol 1) + (extend 1) + (extend-protocol 1) + (extend-type 1) + + (try 0) + (catch 2) + (finally 0) + + ;; binding forms + (let 1) + (letfn 1) + (binding 1) + (loop 1) + (for 1) + (doseq 1) + (dotimes 1) + (when-let 1) + (if-let 1) + (when-some 1) + (if-some 1) + + ;; data structures + (defstruct 1) + (struct-map 1) + (assoc 1) + + (defmethod 'defun) + + ;; clojure.test + (testing 1) + (deftest 'defun) + (are 1) + (use-fixtures 'defun) + + ;; core.logic + (run 'defun) + (run* 'defun) + (fresh 'defun) + + ;; core.async + (alt! 0) + (alt!! 0) + (go 0) + (go-loop 1) + (thread 0)) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Better docstring filling for clojure-mode +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun clojure-string-start (&optional regex) + "Return the position of the \" that begins the string at point. +If REGEX is non-nil, return the position of the # that begins the +regex at point. If point is not inside a string or regex, return +nil." + (when (nth 3 (syntax-ppss)) ;; Are we really in a string? + (save-excursion + (save-match-data + ;; Find a quote that appears immediately after whitespace, + ;; beginning of line, hash, or an open paren, brace, or bracket + (re-search-backward "\\(\\s-\\|^\\|#\\|(\\|\\[\\|{\\)\\(\"\\)") + (let ((beg (match-beginning 2))) + (when beg + (if regex + (and (char-before beg) (char-equal ?# (char-before beg)) (1- beg)) + (when (not (char-equal ?# (char-before beg))) + beg)))))))) + +(defun clojure-char-at-point () + "Return the char at point or nil if at buffer end." + (when (not (= (point) (point-max))) + (buffer-substring-no-properties (point) (1+ (point))))) + +(defun clojure-char-before-point () + "Return the char before point or nil if at buffer beginning." + (when (not (= (point) (point-min))) + (buffer-substring-no-properties (point) (1- (point))))) + +;; TODO: Deal with the fact that when point is exactly at the +;; beginning of a string, it thinks that is the end. +(defun clojure-string-end () + "Return the position of the \" that ends the string at point. + +Note that point must be inside the string - if point is +positioned at the opening quote, incorrect results will be +returned." + (save-excursion + (save-match-data + ;; If we're at the end of the string, just return point. + (if (and (string= (clojure-char-at-point) "\"") + (not (string= (clojure-char-before-point) "\\"))) + (point) + ;; We don't want to get screwed by starting out at the + ;; backslash in an escaped quote. + (when (string= (clojure-char-at-point) "\\") + (backward-char)) + ;; Look for a quote not preceeded by a backslash + (re-search-forward "[^\\]\\\(\\\"\\)") + (match-beginning 1))))) + +(defun clojure-mark-string () + "Mark the string at point." + (interactive) + (goto-char (clojure-string-start)) + (forward-char) + (set-mark (clojure-string-end))) + +(defun clojure-toggle-keyword-string () + "Convert the string or keyword at (point) from string->keyword or keyword->string." + (interactive) + (let ((original-point (point))) + (while (and (> (point) 1) + (not (equal "\"" (buffer-substring-no-properties (point) (+ 1 (point))))) + (not (equal ":" (buffer-substring-no-properties (point) (+ 1 (point)))))) + (backward-char)) + (cond + ((equal 1 (point)) + (message "beginning of file reached, this was probably a mistake.")) + ((equal "\"" (buffer-substring-no-properties (point) (+ 1 (point)))) + (insert ":" (substring (clojure-delete-and-extract-sexp) 1 -1))) + ((equal ":" (buffer-substring-no-properties (point) (+ 1 (point)))) + (insert "\"" (substring (clojure-delete-and-extract-sexp) 1) "\""))) + (goto-char original-point))) + +(defun clojure-delete-and-extract-sexp () + "Delete the sexp and return it." + (interactive) + (let ((begin (point))) + (forward-sexp) + (let ((result (buffer-substring-no-properties begin (point)))) + (delete-region begin (point)) + result))) + + + +(defconst clojure-namespace-name-regex + (rx line-start + (zero-or-more whitespace) + "(" + (zero-or-one (group (regexp "clojure.core/"))) + (zero-or-one (submatch "in-")) + "ns" + (zero-or-one "+") + (one-or-more (any whitespace "\n")) + (zero-or-more (or (submatch (zero-or-one "#") + "^{" + (zero-or-more (not (any "}"))) + "}") + (zero-or-more "^:" + (one-or-more (not (any whitespace))))) + (one-or-more (any whitespace "\n"))) + ;; why is this here? oh (in-ns 'foo) or (ns+ :user) + (zero-or-one (any ":'")) + (group (one-or-more (not (any "()\"" whitespace))) word-end))) + +;; for testing clojure-namespace-name-regex, you can evaluate this code and make +;; sure foo (or whatever the namespace name is) shows up in results. some of +;; these currently fail. +;; (mapcar (lambda (s) (let ((n (string-match clojure-namespace-name-regex s))) +;; (if n (match-string 4 s)))) +;; '("(ns foo)" +;; "(ns +;; foo)" +;; "(ns foo.baz)" +;; "(ns ^:bar foo)" +;; "(ns ^:bar ^:baz foo)" +;; "(ns ^{:bar true} foo)" +;; "(ns #^{:bar true} foo)" +;; "(ns #^{:fail {}} foo)" +;; "(ns ^{:fail2 {}} foo.baz)" +;; "(ns ^{} foo)" +;; "(ns ^{:skip-wiki true} +;; aleph.netty +;; " +;; "(ns +;; foo)" +;; "foo")) + + + +(defun clojure-expected-ns () + "Return the namespace name that the file should have." + (let* ((project-dir (file-truename + (locate-dominating-file default-directory + "project.clj"))) + (relative (substring (file-truename (buffer-file-name)) + (length project-dir) + (- (length (file-name-extension (buffer-file-name) t)))))) + (replace-regexp-in-string + "_" "-" (mapconcat 'identity (cdr (split-string relative "/")) ".")))) + +(defun clojure-insert-ns-form-at-point () + "Insert a namespace form at point." + (interactive) + (insert (format "(ns %s)" (clojure-expected-ns)))) + +(defun clojure-insert-ns-form () + "Insert a namespace form at the beginning of the buffer." + (interactive) + (goto-char (point-min)) + (clojure-insert-ns-form-at-point)) + +(defun clojure-update-ns () + "Update the namespace of the current buffer. +Useful if a file has been renamed." + (interactive) + (let ((nsname (clojure-expected-ns))) + (when nsname + (save-restriction + (save-excursion + (save-match-data + (if (clojure-find-ns) + (replace-match nsname nil nil nil 4) + (error "Namespace not found")))))))) + +(defun clojure-find-ns () + "Find the namespace of the current Clojure buffer." + (let ((regexp clojure-namespace-name-regex)) + (save-restriction + (save-excursion + (goto-char (point-min)) + (when (re-search-forward regexp nil t) + (match-string-no-properties 4)))))) + +(defun clojure-find-def () + "Find the var declaration macro and symbol name of the current form. +Returns a list pair, e.g. (\"defn\" \"abc\") or (\"deftest\" \"some-test\")." + (let ((re (concat "(\\(?:\\(?:\\sw\\|\\s_\\)+/\\)?" + ;; Declaration + "\\(def\\sw*\\)\\>" + ;; Any whitespace + "[ \r\n\t]*" + ;; Possibly type or metadata + "\\(?:#?^\\(?:{[^}]*}\\|\\(?:\\sw\\|\\s_\\)+\\)[ \r\n\t]*\\)*" + ;; Symbol name + "\\(\\(?:\\sw\\|\\s_\\)+\\)"))) + (save-excursion + (unless (looking-at re) + (beginning-of-defun)) + (when (search-forward-regexp re nil t) + (list (match-string 1) + (match-string 2)))))) + +;;;###autoload +(add-to-list 'auto-mode-alist + '("\\.\\(clj[sx]?\\|dtm\\|edn\\)\\'" . clojure-mode)) + +(provide 'clojure-mode) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions) +;; indent-tabs-mode: nil +;; End: + +;;; clojure-mode.el ends here diff --git a/elpa/clojure-mode-20140804.823/clojure-mode.elc b/elpa/clojure-mode-20140804.823/clojure-mode.elc new file mode 100644 index 000000000..09554af77 Binary files /dev/null and b/elpa/clojure-mode-20140804.823/clojure-mode.elc differ diff --git a/elpa/clojurescript-mode-0.5/clojurescript-mode-autoloads.el b/elpa/clojurescript-mode-0.5/clojurescript-mode-autoloads.el new file mode 100644 index 000000000..558659d7c --- /dev/null +++ b/elpa/clojurescript-mode-0.5/clojurescript-mode-autoloads.el @@ -0,0 +1,31 @@ +;;; clojurescript-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (clojurescript-mode) "clojurescript-mode" "clojurescript-mode.el" +;;;;;; (21478 8069 0 0)) +;;; Generated autoloads from clojurescript-mode.el + +(autoload 'clojurescript-mode "clojurescript-mode" "\ +Major mode for ClojureScript + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.cljs$" . clojurescript-mode)) + +;;;*** + +;;;### (autoloads nil nil ("clojurescript-mode-pkg.el") (21478 8069 +;;;;;; 961812 0)) + +;;;*** + +(provide 'clojurescript-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; clojurescript-mode-autoloads.el ends here diff --git a/elpa/clojurescript-mode-0.5/clojurescript-mode-pkg.el b/elpa/clojurescript-mode-0.5/clojurescript-mode-pkg.el new file mode 100644 index 000000000..61180875a --- /dev/null +++ b/elpa/clojurescript-mode-0.5/clojurescript-mode-pkg.el @@ -0,0 +1 @@ +(define-package "clojurescript-mode" "0.5" "Major mode for ClojureScript code" (quote nil)) diff --git a/elpa/clojurescript-mode-0.5/clojurescript-mode-pkg.elc b/elpa/clojurescript-mode-0.5/clojurescript-mode-pkg.elc new file mode 100644 index 000000000..a37b869c8 Binary files /dev/null and b/elpa/clojurescript-mode-0.5/clojurescript-mode-pkg.elc differ diff --git a/elpa/clojurescript-mode-0.5/clojurescript-mode.el b/elpa/clojurescript-mode-0.5/clojurescript-mode.el new file mode 100644 index 000000000..456e4f78c --- /dev/null +++ b/elpa/clojurescript-mode-0.5/clojurescript-mode.el @@ -0,0 +1,79 @@ + +;;; clojurescript-mode.el --- Major mode for ClojureScript code + +;; Copyright (C) 2011 Luke Amdor +;; +;; Authors: Luke Amdor +;; URL: http://github.com/rubbish/clojurescript-mode +;; Version: 0.5 +;; Keywords: languages, lisp, javascript + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Provides an REPL to the +;; ClojureScript language. (http://github.com/clojure/clojurescript) + +;; For information on how to start up the REPL correctly see +;; https://github.com/clojure/clojurescript/tree/master/samples/repl +;; and +;; https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments + +;;; License: + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +(require 'clojure-mode) + +(defvar clojurescript-home + (getenv "CLOJURESCRIPT_HOME") + "Path to ClojureScript home directory") + +(defvar clojurescript-clj-repl + (when clojurescript-home + (expand-file-name "script/repl" clojurescript-home)) + "Path to the ClojureScript Clojure REPL") + +(defvar clojurescript-repl-interface + "cljs.repl.browser" + "Which ClojureScript REPL interface to use") + +(defun clojurescript-repl-init-commands () + (concat "(require 'cljs.repl)" "\n" + "(require '" clojurescript-repl-interface ")" "\n" + "(cljs.repl/repl (" clojurescript-repl-interface "/repl-env)" ")" "\n")) + +(defun clojurescript-start-cljs-repl () + ;; I know, I know; major facepalm. But that's the way it is. + (when (not clojurescript-home) + (error "CLOJURESCRIPT_HOME not configured. See ClojureScript docs.")) + (comint-send-string (inferior-lisp-proc) (clojurescript-repl-init-commands))) + +;;;###autoload +(define-derived-mode clojurescript-mode clojure-mode "ClojureScript" + "Major mode for ClojureScript" + + (set (make-local-variable 'inferior-lisp-program) clojurescript-clj-repl) + (add-hook 'inferior-lisp-mode-hook 'clojurescript-start-cljs-repl) + (when (functionp 'slime-mode) + (slime-mode -1))) + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.cljs$" . clojurescript-mode)) + +(provide 'clojurescript-mode) +;;; clojurescript-mode.el ends here diff --git a/elpa/clojurescript-mode-0.5/clojurescript-mode.elc b/elpa/clojurescript-mode-0.5/clojurescript-mode.elc new file mode 100644 index 000000000..e4c523ea4 Binary files /dev/null and b/elpa/clojurescript-mode-0.5/clojurescript-mode.elc differ diff --git a/elpa/dash-20140717.547/dash-autoloads.el b/elpa/dash-20140717.547/dash-autoloads.el new file mode 100644 index 000000000..0baa9f317 --- /dev/null +++ b/elpa/dash-20140717.547/dash-autoloads.el @@ -0,0 +1,18 @@ +;;; dash-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("dash-pkg.el" "dash.el") (21478 16688 +;;;;;; 918460 0)) + +;;;*** + +(provide 'dash-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; dash-autoloads.el ends here diff --git a/elpa/dash-20140717.547/dash-pkg.el b/elpa/dash-20140717.547/dash-pkg.el new file mode 100644 index 000000000..d62f3ab13 --- /dev/null +++ b/elpa/dash-20140717.547/dash-pkg.el @@ -0,0 +1 @@ +(define-package "dash" "20140717.547" "A modern list library for Emacs" (quote nil)) diff --git a/elpa/dash-20140717.547/dash-pkg.elc b/elpa/dash-20140717.547/dash-pkg.elc new file mode 100644 index 000000000..f9cf84587 Binary files /dev/null and b/elpa/dash-20140717.547/dash-pkg.elc differ diff --git a/elpa/dash-20140717.547/dash.el b/elpa/dash-20140717.547/dash.el new file mode 100644 index 000000000..afee9d511 --- /dev/null +++ b/elpa/dash-20140717.547/dash.el @@ -0,0 +1,1783 @@ +;;; dash.el --- A modern list library for Emacs + +;; Copyright (C) 2012 Magnar Sveen + +;; Author: Magnar Sveen +;; Version: 20140717.547 +;; X-Original-Version: 2.8.0 +;; Keywords: lists + +;; 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 . + +;;; Commentary: + +;; A modern list api for Emacs. +;; +;; See documentation on https://github.com/magnars/dash.el#functions + +;;; Code: + +(defgroup dash () + "Customize group for dash.el" + :group 'lisp + :prefix "dash-") + +(defun dash--enable-fontlock (symbol value) + (when value + (dash-enable-font-lock)) + (set-default symbol value)) + +(defcustom dash-enable-fontlock nil + "If non-nil, enable fontification of dash functions, macros and +special values." + :type 'boolean + :set 'dash--enable-fontlock + :group 'dash) + +(defmacro !cons (car cdr) + "Destructive: Set CDR to the cons of CAR and CDR." + `(setq ,cdr (cons ,car ,cdr))) + +(defmacro !cdr (list) + "Destructive: Set LIST to the cdr of LIST." + `(setq ,list (cdr ,list))) + +(defmacro --each (list &rest body) + "Anaphoric form of `-each'." + (declare (debug (form body)) + (indent 1)) + (let ((l (make-symbol "list"))) + `(let ((,l ,list) + (it-index 0)) + (while ,l + (let ((it (car ,l))) + ,@body) + (setq it-index (1+ it-index)) + (!cdr ,l))))) + +(defun -each (list fn) + "Call FN with every item in LIST. Return nil, used for side-effects only." + (--each list (funcall fn it))) + +(put '-each 'lisp-indent-function 1) + +(defmacro --each-while (list pred &rest body) + "Anaphoric form of `-each-while'." + (declare (debug (form form body)) + (indent 2)) + (let ((l (make-symbol "list")) + (c (make-symbol "continue"))) + `(let ((,l ,list) + (,c t) + (it-index 0)) + (while (and ,l ,c) + (let ((it (car ,l))) + (if (not ,pred) (setq ,c nil) ,@body)) + (setq it-index (1+ it-index)) + (!cdr ,l))))) + +(defun -each-while (list pred fn) + "Call FN with every item in LIST while (PRED item) is non-nil. +Return nil, used for side-effects only." + (--each-while list (funcall pred it) (funcall fn it))) + +(put '-each-while 'lisp-indent-function 2) + +(defmacro --dotimes (num &rest body) + "Repeatedly executes BODY (presumably for side-effects) with `it` bound to integers from 0 through NUM-1." + (declare (debug (form body)) + (indent 1)) + (let ((n (make-symbol "num"))) + `(let ((,n ,num) + (it 0)) + (while (< it ,n) + ,@body + (setq it (1+ it)))))) + +(defun -dotimes (num fn) + "Repeatedly calls FN (presumably for side-effects) passing in integers from 0 through NUM-1." + (--dotimes num (funcall fn it))) + +(put '-dotimes 'lisp-indent-function 1) + +(defun -map (fn list) + "Return a new list consisting of the result of applying FN to the items in LIST." + (mapcar fn list)) + +(defmacro --map (form list) + "Anaphoric form of `-map'." + (declare (debug (form form))) + `(mapcar (lambda (it) ,form) ,list)) + +(defmacro --reduce-from (form initial-value list) + "Anaphoric form of `-reduce-from'." + (declare (debug (form form form))) + `(let ((acc ,initial-value)) + (--each ,list (setq acc ,form)) + acc)) + +(defun -reduce-from (fn initial-value list) + "Return the result of applying FN to INITIAL-VALUE and the +first item in LIST, then applying FN to that result and the 2nd +item, etc. If LIST contains no items, return INITIAL-VALUE and +FN is not called. + +In the anaphoric form `--reduce-from', the accumulated value is +exposed as `acc`." + (--reduce-from (funcall fn acc it) initial-value list)) + +(defmacro --reduce (form list) + "Anaphoric form of `-reduce'." + (declare (debug (form form))) + (let ((lv (make-symbol "list-value"))) + `(let ((,lv ,list)) + (if ,lv + (--reduce-from ,form (car ,lv) (cdr ,lv)) + (let (acc it) ,form))))) + +(defun -reduce (fn list) + "Return the result of applying FN to the first 2 items in LIST, +then applying FN to that result and the 3rd item, etc. If LIST +contains no items, FN must accept no arguments as well, and +reduce return the result of calling FN with no arguments. If +LIST has only 1 item, it is returned and FN is not called. + +In the anaphoric form `--reduce', the accumulated value is +exposed as `acc`." + (if list + (-reduce-from fn (car list) (cdr list)) + (funcall fn))) + +(defun -reduce-r-from (fn initial-value list) + "Replace conses with FN, nil with INITIAL-VALUE and evaluate +the resulting expression. If LIST is empty, INITIAL-VALUE is +returned and FN is not called. + +Note: this function works the same as `-reduce-from' but the +operation associates from right instead of from left." + (if (not list) initial-value + (funcall fn (car list) (-reduce-r-from fn initial-value (cdr list))))) + +(defmacro --reduce-r-from (form initial-value list) + "Anaphoric version of `-reduce-r-from'." + (declare (debug (form form form))) + `(-reduce-r-from (lambda (&optional it acc) ,form) ,initial-value ,list)) + +(defun -reduce-r (fn list) + "Replace conses with FN and evaluate the resulting expression. +The final nil is ignored. If LIST contains no items, FN must +accept no arguments as well, and reduce return the result of +calling FN with no arguments. If LIST has only 1 item, it is +returned and FN is not called. + +The first argument of FN is the new item, the second is the +accumulated value. + +Note: this function works the same as `-reduce' but the operation +associates from right instead of from left." + (cond + ((not list) (funcall fn)) + ((not (cdr list)) (car list)) + (t (funcall fn (car list) (-reduce-r fn (cdr list)))))) + +(defmacro --reduce-r (form list) + "Anaphoric version of `-reduce-r'." + (declare (debug (form form))) + `(-reduce-r (lambda (&optional it acc) ,form) ,list)) + +(defmacro --filter (form list) + "Anaphoric form of `-filter'." + (declare (debug (form form))) + (let ((r (make-symbol "result"))) + `(let (,r) + (--each ,list (when ,form (!cons it ,r))) + (nreverse ,r)))) + +(defun -filter (pred list) + "Return a new list of the items in LIST for which PRED returns a non-nil value. + +Alias: `-select'" + (--filter (funcall pred it) list)) + +(defalias '-select '-filter) +(defalias '--select '--filter) + +(defmacro --remove (form list) + "Anaphoric form of `-remove'." + (declare (debug (form form))) + `(--filter (not ,form) ,list)) + +(defun -remove (pred list) + "Return a new list of the items in LIST for which PRED returns nil. + +Alias: `-reject'" + (--remove (funcall pred it) list)) + +(defalias '-reject '-remove) +(defalias '--reject '--remove) + +(defmacro --keep (form list) + "Anaphoric form of `-keep'." + (declare (debug (form form))) + (let ((r (make-symbol "result")) + (m (make-symbol "mapped"))) + `(let (,r) + (--each ,list (let ((,m ,form)) (when ,m (!cons ,m ,r)))) + (nreverse ,r)))) + +(defun -keep (fn list) + "Return a new list of the non-nil results of applying FN to the items in LIST." + (--keep (funcall fn it) list)) + +(defmacro --map-indexed (form list) + "Anaphoric form of `-map-indexed'." + (declare (debug (form form))) + (let ((r (make-symbol "result"))) + `(let (,r) + (--each ,list + (!cons ,form ,r)) + (nreverse ,r)))) + +(defun -map-indexed (fn list) + "Return a new list consisting of the result of (FN index item) for each item in LIST. + +In the anaphoric form `--map-indexed', the index is exposed as `it-index`." + (--map-indexed (funcall fn it-index it) list)) + +(defmacro --map-when (pred rep list) + "Anaphoric form of `-map-when'." + (declare (debug (form form form))) + (let ((r (make-symbol "result"))) + `(let (,r) + (--each ,list (!cons (if ,pred ,rep it) ,r)) + (nreverse ,r)))) + +(defun -map-when (pred rep list) + "Return a new list where the elements in LIST that does not match the PRED function +are unchanged, and where the elements in LIST that do match the PRED function are mapped +through the REP function. + +Alias: `-replace-where' + +See also: `-update-at'" + (--map-when (funcall pred it) (funcall rep it) list)) + +(defalias '-replace-where '-map-when) +(defalias '--replace-where '--map-when) + +(defun -replace (old new list) + "Replace all OLD items in LIST with NEW. + +Elements are compared using `equal'. + +See also: `-replace-at'" + (--map-when (equal it old) new list)) + +(defun -flatten (l) + "Take a nested list L and return its contents as a single, flat list. + +See also: `-flatten-n'" + (if (and (listp l) (listp (cdr l))) + (-mapcat '-flatten l) + (list l))) + +(defun -flatten-n (num list) + "Flatten NUM levels of a nested LIST. + +See also: `-flatten'" + (-last-item (--iterate (--mapcat (-list it) it) list (1+ num)))) + +(defun -concat (&rest lists) + "Return a new list with the concatenation of the elements in the supplied LISTS." + (apply 'append lists)) + +(defmacro --mapcat (form list) + "Anaphoric form of `-mapcat'." + (declare (debug (form form))) + `(apply 'append (--map ,form ,list))) + +(defun -mapcat (fn list) + "Return the concatenation of the result of mapping FN over LIST. +Thus function FN should return a list." + (--mapcat (funcall fn it) list)) + +(defalias '-copy 'copy-sequence + "Create a shallow copy of LIST.") + +(defun -splice (pred fun list) + "Splice lists generated by FUN in place of elements matching PRED in LIST. + +FUN takes the element matching PRED as input. + +This function can be used as replacement for `,@' in case you +need to splice several lists at marked positions (for example +with keywords). + +See also: `-splice-list', `-insert-at'" + (let (r) + (--each list + (if (funcall pred it) + (let ((new (funcall fun it))) + (--each new (!cons it r))) + (!cons it r))) + (nreverse r))) + +(defmacro --splice (pred form list) + "Anaphoric form of `-splice'." + `(-splice (lambda (it) ,pred) (lambda (it) ,form) ,list)) + +(defun -splice-list (pred new-list list) + "Splice NEW-LIST in place of elements matching PRED in LIST. + +See also: `-splice', `-insert-at'" + (-splice pred (lambda (_) new-list) list)) + +(defun --splice-list (pred new-list list) + "Anaphoric form of `-splice-list'." + `(-splice-list (lambda (it) ,pred) ,new-list ,list)) + +(defun -cons* (&rest args) + "Make a new list from the elements of ARGS. + +The last 2 members of ARGS are used as the final cons of the +result so if the final member of ARGS is not a list the result is +a dotted list." + (-reduce-r 'cons args)) + +(defun -snoc (list elem &rest elements) + "Append ELEM to the end of the list. + +This is like `cons', but operates on the end of list. + +If ELEMENTS is non nil, append these to the list as well." + (-concat list (list elem) elements)) + +(defmacro --first (form list) + "Anaphoric form of `-first'." + (declare (debug (form form))) + (let ((n (make-symbol "needle"))) + `(let (,n) + (--each-while ,list (not ,n) + (when ,form (setq ,n it))) + ,n))) + +(defun -first (pred list) + "Return the first x in LIST where (PRED x) is non-nil, else nil. + +To get the first item in the list no questions asked, use `car'. + +Alias: `-find'" + (--first (funcall pred it) list)) + +(defalias '-find '-first) +(defalias '--find '--first) + +(defmacro --last (form list) + "Anaphoric form of `-last'." + (declare (debug (form form))) + (let ((n (make-symbol "needle"))) + `(let (,n) + (--each ,list + (when ,form (setq ,n it))) + ,n))) + +(defun -last (pred list) + "Return the last x in LIST where (PRED x) is non-nil, else nil." + (--last (funcall pred it) list)) + +(defalias '-first-item 'car + "Return the first item of LIST, or nil on an empty list.") + +(defun -last-item (list) + "Return the last item of LIST, or nil on an empty list." + (car (last list))) + +(defun -butlast (list) + "Return a list of all items in list except for the last." + (let (result) + (while (cdr list) + (!cons (car list) result) + (!cdr list)) + (nreverse result))) + +(defmacro --count (pred list) + "Anaphoric form of `-count'." + (declare (debug (form form))) + (let ((r (make-symbol "result"))) + `(let ((,r 0)) + (--each ,list (when ,pred (setq ,r (1+ ,r)))) + ,r))) + +(defun -count (pred list) + "Counts the number of items in LIST where (PRED item) is non-nil." + (--count (funcall pred it) list)) + +(defun ---truthy? (val) + (not (null val))) + +(defmacro --any? (form list) + "Anaphoric form of `-any?'." + (declare (debug (form form))) + `(---truthy? (--first ,form ,list))) + +(defun -any? (pred list) + "Return t if (PRED x) is non-nil for any x in LIST, else nil. + +Alias: `-any-p', `-some?', `-some-p'" + (--any? (funcall pred it) list)) + +(defalias '-some? '-any?) +(defalias '--some? '--any?) +(defalias '-any-p '-any?) +(defalias '--any-p '--any?) +(defalias '-some-p '-any?) +(defalias '--some-p '--any?) + +(defmacro --all? (form list) + "Anaphoric form of `-all?'." + (declare (debug (form form))) + (let ((a (make-symbol "all"))) + `(let ((,a t)) + (--each-while ,list ,a (setq ,a ,form)) + (---truthy? ,a)))) + +(defun -all? (pred list) + "Return t if (PRED x) is non-nil for all x in LIST, else nil. + +Alias: `-all-p', `-every?', `-every-p'" + (--all? (funcall pred it) list)) + +(defalias '-every? '-all?) +(defalias '--every? '--all?) +(defalias '-all-p '-all?) +(defalias '--all-p '--all?) +(defalias '-every-p '-all?) +(defalias '--every-p '--all?) + +(defmacro --none? (form list) + "Anaphoric form of `-none?'." + (declare (debug (form form))) + `(--all? (not ,form) ,list)) + +(defun -none? (pred list) + "Return t if (PRED x) is nil for all x in LIST, else nil. + +Alias: `-none-p'" + (--none? (funcall pred it) list)) + +(defalias '-none-p '-none?) +(defalias '--none-p '--none?) + +(defmacro --only-some? (form list) + "Anaphoric form of `-only-some?'." + (declare (debug (form form))) + (let ((y (make-symbol "yes")) + (n (make-symbol "no"))) + `(let (,y ,n) + (--each-while ,list (not (and ,y ,n)) + (if ,form (setq ,y t) (setq ,n t))) + (---truthy? (and ,y ,n))))) + +(defun -only-some? (pred list) + "Return `t` if at least one item of LIST matches PRED and at least one item of LIST does not match PRED. +Return `nil` both if all items match the predicate or if none of the items match the predicate. + +Alias: `-only-some-p'" + (--only-some? (funcall pred it) list)) + +(defalias '-only-some-p '-only-some?) +(defalias '--only-some-p '--only-some?) + +(defun -slice (list from &optional to step) + "Return copy of LIST, starting from index FROM to index TO. + +FROM or TO may be negative. These values are then interpreted +modulo the length of the list. + +If STEP is a number, only each STEPth item in the resulting +section is returned. Defaults to 1." + (let ((length (length list)) + (new-list nil)) + ;; to defaults to the end of the list + (setq to (or to length)) + (setq step (or step 1)) + ;; handle negative indices + (when (< from 0) + (setq from (mod from length))) + (when (< to 0) + (setq to (mod to length))) + + ;; iterate through the list, keeping the elements we want + (--each-while list (< it-index to) + (when (and (>= it-index from) + (= (mod (- from it-index) step) 0)) + (push it new-list))) + (nreverse new-list))) + +(defun -take (n list) + "Return a new list of the first N items in LIST, or all items if there are fewer than N." + (let (result) + (--dotimes n + (when list + (!cons (car list) result) + (!cdr list))) + (nreverse result))) + +(defalias '-drop 'nthcdr "Return the tail of LIST without the first N items.") + +(defmacro --take-while (form list) + "Anaphoric form of `-take-while'." + (declare (debug (form form))) + (let ((r (make-symbol "result"))) + `(let (,r) + (--each-while ,list ,form (!cons it ,r)) + (nreverse ,r)))) + +(defun -take-while (pred list) + "Return a new list of successive items from LIST while (PRED item) returns a non-nil value." + (--take-while (funcall pred it) list)) + +(defmacro --drop-while (form list) + "Anaphoric form of `-drop-while'." + (declare (debug (form form))) + (let ((l (make-symbol "list"))) + `(let ((,l ,list)) + (while (and ,l (let ((it (car ,l))) ,form)) + (!cdr ,l)) + ,l))) + +(defun -drop-while (pred list) + "Return the tail of LIST starting from the first item for which (PRED item) returns nil." + (--drop-while (funcall pred it) list)) + +(defun -split-at (n list) + "Return a list of ((-take N LIST) (-drop N LIST)), in no more than one pass through the list." + (let (result) + (--dotimes n + (when list + (!cons (car list) result) + (!cdr list))) + (list (nreverse result) list))) + +(defun -rotate (n list) + "Rotate LIST N places to the right. With N negative, rotate to the left. +The time complexity is O(n)." + (if (> n 0) + (append (last list n) (butlast list n)) + (append (-drop (- n) list) (-take (- n) list)))) + +(defun -insert-at (n x list) + "Return a list with X inserted into LIST at position N. + +See also: `-splice', `-splice-list'" + (let ((split-list (-split-at n list))) + (nconc (car split-list) (cons x (cadr split-list))))) + +(defun -replace-at (n x list) + "Return a list with element at Nth position in LIST replaced with X. + +See also: `-replace'" + (let ((split-list (-split-at n list))) + (nconc (car split-list) (cons x (cdr (cadr split-list)))))) + +(defun -update-at (n func list) + "Return a list with element at Nth position in LIST replaced with `(func (nth n list))`. + +See also: `-map-when'" + (let ((split-list (-split-at n list))) + (nconc (car split-list) (cons (funcall func (car (cadr split-list))) (cdr (cadr split-list)))))) + +(defmacro --update-at (n form list) + "Anaphoric version of `-update-at'." + (declare (debug (form form form))) + `(-update-at ,n (lambda (it) ,form) ,list)) + +(defun -remove-at (n list) + "Return a list with element at Nth position in LIST removed. + +See also: `-remove-at-indices', `-remove'" + (-remove-at-indices (list n) list)) + +(defun -remove-at-indices (indices list) + "Return a list whose elements are elements from LIST without +elements selected as `(nth i list)` for all i +from INDICES. + +See also: `-remove-at', `-remove'" + (let* ((indices (-sort '< indices)) + (diffs (cons (car indices) (-map '1- (-zip-with '- (cdr indices) indices)))) + r) + (--each diffs + (let ((split (-split-at it list))) + (!cons (car split) r) + (setq list (cdr (cadr split))))) + (!cons list r) + (apply '-concat (nreverse r)))) + +(defmacro --split-with (pred list) + "Anaphoric form of `-split-with'." + (declare (debug (form form))) + (let ((l (make-symbol "list")) + (r (make-symbol "result")) + (c (make-symbol "continue"))) + `(let ((,l ,list) + (,r nil) + (,c t)) + (while (and ,l ,c) + (let ((it (car ,l))) + (if (not ,pred) + (setq ,c nil) + (!cons it ,r) + (!cdr ,l)))) + (list (nreverse ,r) ,l)))) + +(defun -split-with (pred list) + "Return a list of ((-take-while PRED LIST) (-drop-while PRED LIST)), in no more than one pass through the list." + (--split-with (funcall pred it) list)) + +(defmacro -split-on (item list) + "Split the LIST each time ITEM is found. + +Unlike `-partition-by', the ITEM is discarded from the results. +Empty lists are also removed from the result. + +Comparison is done by `equal'. + +See also `-split-when'" + (declare (debug (form form))) + `(-split-when (lambda (it) (equal it ,item)) ,list)) + +(defmacro --split-when (form list) + "Anaphoric version of `-split-when'." + (declare (debug (form form))) + `(-split-when (lambda (it) ,form) ,list)) + +(defun -split-when (fn list) + "Split the LIST on each element where FN returns non-nil. + +Unlike `-partition-by', the \"matched\" element is discarded from +the results. Empty lists are also removed from the result. + +This function can be thought of as a generalization of +`split-string'." + (let (r s) + (while list + (if (not (funcall fn (car list))) + (push (car list) s) + (when s (push (nreverse s) r)) + (setq s nil)) + (!cdr list)) + (when s (push (nreverse s) r)) + (nreverse r))) + +(defmacro --separate (form list) + "Anaphoric form of `-separate'." + (declare (debug (form form))) + (let ((y (make-symbol "yes")) + (n (make-symbol "no"))) + `(let (,y ,n) + (--each ,list (if ,form (!cons it ,y) (!cons it ,n))) + (list (nreverse ,y) (nreverse ,n))))) + +(defun -separate (pred list) + "Return a list of ((-filter PRED LIST) (-remove PRED LIST)), in one pass through the list." + (--separate (funcall pred it) list)) + +(defun ---partition-all-in-steps-reversed (n step list) + "Private: Used by -partition-all-in-steps and -partition-in-steps." + (when (< step 1) + (error "Step must be a positive number, or you're looking at some juicy infinite loops.")) + (let ((result nil) + (len 0)) + (while list + (!cons (-take n list) result) + (setq list (-drop step list))) + result)) + +(defun -partition-all-in-steps (n step list) + "Return a new list with the items in LIST grouped into N-sized sublists at offsets STEP apart. +The last groups may contain less than N items." + (nreverse (---partition-all-in-steps-reversed n step list))) + +(defun -partition-in-steps (n step list) + "Return a new list with the items in LIST grouped into N-sized sublists at offsets STEP apart. +If there are not enough items to make the last group N-sized, +those items are discarded." + (let ((result (---partition-all-in-steps-reversed n step list))) + (while (and result (< (length (car result)) n)) + (!cdr result)) + (nreverse result))) + +(defun -partition-all (n list) + "Return a new list with the items in LIST grouped into N-sized sublists. +The last group may contain less than N items." + (-partition-all-in-steps n n list)) + +(defun -partition (n list) + "Return a new list with the items in LIST grouped into N-sized sublists. +If there are not enough items to make the last group N-sized, +those items are discarded." + (-partition-in-steps n n list)) + +(defmacro --partition-by (form list) + "Anaphoric form of `-partition-by'." + (declare (debug (form form))) + (let ((r (make-symbol "result")) + (s (make-symbol "sublist")) + (v (make-symbol "value")) + (n (make-symbol "new-value")) + (l (make-symbol "list"))) + `(let ((,l ,list)) + (when ,l + (let* ((,r nil) + (it (car ,l)) + (,s (list it)) + (,v ,form) + (,l (cdr ,l))) + (while ,l + (let* ((it (car ,l)) + (,n ,form)) + (unless (equal ,v ,n) + (!cons (nreverse ,s) ,r) + (setq ,s nil) + (setq ,v ,n)) + (!cons it ,s) + (!cdr ,l))) + (!cons (nreverse ,s) ,r) + (nreverse ,r)))))) + +(defun -partition-by (fn list) + "Apply FN to each item in LIST, splitting it each time FN returns a new value." + (--partition-by (funcall fn it) list)) + +(defmacro --partition-by-header (form list) + "Anaphoric form of `-partition-by-header'." + (declare (debug (form form))) + (let ((r (make-symbol "result")) + (s (make-symbol "sublist")) + (h (make-symbol "header-value")) + (b (make-symbol "seen-body?")) + (n (make-symbol "new-value")) + (l (make-symbol "list"))) + `(let ((,l ,list)) + (when ,l + (let* ((,r nil) + (it (car ,l)) + (,s (list it)) + (,h ,form) + (,b nil) + (,l (cdr ,l))) + (while ,l + (let* ((it (car ,l)) + (,n ,form)) + (if (equal ,h ,n) + (when ,b + (!cons (nreverse ,s) ,r) + (setq ,s nil) + (setq ,b nil)) + (setq ,b t)) + (!cons it ,s) + (!cdr ,l))) + (!cons (nreverse ,s) ,r) + (nreverse ,r)))))) + +(defun -partition-by-header (fn list) + "Apply FN to the first item in LIST. That is the header +value. Apply FN to each item in LIST, splitting it each time FN +returns the header value, but only after seeing at least one +other value (the body)." + (--partition-by-header (funcall fn it) list)) + +(defmacro --group-by (form list) + "Anaphoric form of `-group-by'." + (declare (debug (form form))) + (let ((l (make-symbol "list")) + (v (make-symbol "value")) + (k (make-symbol "key")) + (r (make-symbol "result"))) + `(let ((,l ,list) + ,r) + ;; Convert `list' to an alist and store it in `r'. + (while ,l + (let* ((,v (car ,l)) + (it ,v) + (,k ,form) + (kv (assoc ,k ,r))) + (if kv + (setcdr kv (cons ,v (cdr kv))) + (push (list ,k ,v) ,r)) + (setq ,l (cdr ,l)))) + ;; Reverse lists in each group. + (let ((rest ,r)) + (while rest + (let ((kv (car rest))) + (setcdr kv (nreverse (cdr kv)))) + (setq rest (cdr rest)))) + ;; Reverse order of keys. + (nreverse ,r)))) + +(defun -group-by (fn list) + "Separate LIST into an alist whose keys are FN applied to the +elements of LIST. Keys are compared by `equal'." + (--group-by (funcall fn it) list)) + +(defun -interpose (sep list) + "Return a new list of all elements in LIST separated by SEP." + (let (result) + (when list + (!cons (car list) result) + (!cdr list)) + (while list + (setq result (cons (car list) (cons sep result))) + (!cdr list)) + (nreverse result))) + +(defun -interleave (&rest lists) + "Return a new list of the first item in each list, then the second etc." + (let (result) + (while (-none? 'null lists) + (--each lists (!cons (car it) result)) + (setq lists (-map 'cdr lists))) + (nreverse result))) + +(defmacro --zip-with (form list1 list2) + "Anaphoric form of `-zip-with'. + +The elements in list1 is bound as `it`, the elements in list2 as `other`." + (declare (debug (form form form))) + (let ((r (make-symbol "result")) + (l1 (make-symbol "list1")) + (l2 (make-symbol "list2"))) + `(let ((,r nil) + (,l1 ,list1) + (,l2 ,list2)) + (while (and ,l1 ,l2) + (let ((it (car ,l1)) + (other (car ,l2))) + (!cons ,form ,r) + (!cdr ,l1) + (!cdr ,l2))) + (nreverse ,r)))) + +(defun -zip-with (fn list1 list2) + "Zip the two lists LIST1 and LIST2 using a function FN. This +function is applied pairwise taking as first argument element of +LIST1 and as second argument element of LIST2 at corresponding +position. + +The anaphoric form `--zip-with' binds the elements from LIST1 as `it`, +and the elements from LIST2 as `other`." + (--zip-with (funcall fn it other) list1 list2)) + +(defun -zip (&rest lists) + "Zip LISTS together. Group the head of each list, followed by the +second elements of each list, and so on. The lengths of the returned +groupings are equal to the length of the shortest input list. + +If two lists are provided as arguments, return the groupings as a list +of cons cells. Otherwise, return the groupings as a list of lists. " + (let (results) + (while (-none? 'null lists) + (setq results (cons (mapcar 'car lists) results)) + (setq lists (mapcar 'cdr lists))) + (setq results (nreverse results)) + (if (= (length lists) 2) + ; to support backward compatability, return + ; a cons cell if two lists were provided + (--map (cons (car it) (cadr it)) results) + results))) + +(defun -zip-fill (fill-value &rest lists) + "Zip LISTS, with FILL-VALUE padded onto the shorter lists. The +lengths of the returned groupings are equal to the length of the +longest input list." + (apply '-zip (apply '-pad (cons fill-value lists)))) + +(defun -cycle (list) + "Return an infinite copy of LIST that will cycle through the +elements and repeat from the beginning." + (let ((newlist (-map 'identity list))) + (nconc newlist newlist))) + +(defun -pad (fill-value &rest lists) + "Appends FILL-VALUE to the end of each list in LISTS such that they +will all have the same length." + (let* ((annotations (-annotate 'length lists)) + (n (-max (-map 'car annotations)))) + (--map (append (cdr it) (-repeat (- n (car it)) fill-value)) annotations))) + +(defun -annotate (fn list) + "Return a list of cons cells where each cell is FN applied to each +element of LIST paired with the unmodified element of LIST." + (-zip (-map fn list) list)) + +(defmacro --annotate (form list) + "Anaphoric version of `-annotate'." + (declare (debug (form form))) + `(-annotate (lambda (it) ,form) ,list)) + +(defun dash--table-carry (lists restore-lists &optional re) + "Helper for `-table' and `-table-flat'. + +If a list overflows, carry to the right and reset the list. + +Return how many lists were re-seted." + (while (and (not (car lists)) + (not (equal lists '(nil)))) + (setcar lists (car restore-lists)) + (pop (cadr lists)) + (!cdr lists) + (!cdr restore-lists) + (when re + (push (nreverse (car re)) (cadr re)) + (setcar re nil) + (!cdr re)))) + +(defun -table (fn &rest lists) + "Compute outer product of LISTS using function FN. + +The function FN should have the same arity as the number of +supplied lists. + +The outer product is computed by applying fn to all possible +combinations created by taking one element from each list in +order. The dimension of the result is (length lists). + +See also: `-table-flat'" + (let ((restore-lists (copy-sequence lists)) + (last-list (last lists)) + (re (--map nil (number-sequence 1 (length lists))))) + (while (car last-list) + (let ((item (apply fn (-map 'car lists)))) + (push item (car re)) + (pop (car lists)) + (dash--table-carry lists restore-lists re))) + (nreverse (car (last re))))) + +(defun -table-flat (fn &rest lists) + "Compute flat outer product of LISTS using function FN. + +The function FN should have the same arity as the number of +supplied lists. + +The outer product is computed by applying fn to all possible +combinations created by taking one element from each list in +order. The results are flattened, ignoring the tensor structure +of the result. This is equivalent to calling: + + (-flatten-n (1- (length lists)) (-table fn lists)) + +but the implementation here is much more efficient. + +See also: `-flatten-n', `-table'" + (let ((restore-lists (copy-sequence lists)) + (last-list (last lists)) + re) + (while (car last-list) + (push (apply fn (-map 'car lists)) re) + (pop (car lists)) + (dash--table-carry lists restore-lists)) + (nreverse re))) + +(defun -partial (fn &rest args) + "Take a function FN and fewer than the normal arguments to FN, +and return a fn that takes a variable number of additional ARGS. +When called, the returned function calls FN with ARGS first and +then additional args." + (apply 'apply-partially fn args)) + +(defun -elem-index (elem list) + "Return the index of the first element in the given LIST which +is equal to the query element ELEM, or nil if there is no +such element." + (car (-elem-indices elem list))) + +(defun -elem-indices (elem list) + "Return the indices of all elements in LIST equal to the query +element ELEM, in ascending order." + (-find-indices (-partial 'equal elem) list)) + +(defun -find-indices (pred list) + "Return the indices of all elements in LIST satisfying the +predicate PRED, in ascending order." + (let ((i 0)) + (apply 'append (--map-indexed (when (funcall pred it) (list it-index)) list)))) + +(defmacro --find-indices (form list) + "Anaphoric version of `-find-indices'." + (declare (debug (form form))) + `(-find-indices (lambda (it) ,form) ,list)) + +(defun -find-index (pred list) + "Take a predicate PRED and a LIST and return the index of the +first element in the list satisfying the predicate, or nil if +there is no such element." + (car (-find-indices pred list))) + +(defmacro --find-index (form list) + "Anaphoric version of `-find-index'." + (declare (debug (form form))) + `(-find-index (lambda (it) ,form) ,list)) + +(defun -find-last-index (pred list) + "Take a predicate PRED and a LIST and return the index of the +last element in the list satisfying the predicate, or nil if +there is no such element." + (-last-item (-find-indices pred list))) + +(defmacro --find-last-index (form list) + "Anaphoric version of `-find-last-index'." + `(-find-last-index (lambda (it) ,form) ,list)) + +(defun -select-by-indices (indices list) + "Return a list whose elements are elements from LIST selected +as `(nth i list)` for all i from INDICES." + (let (r) + (--each indices + (!cons (nth it list) r)) + (nreverse r))) + +(defmacro -> (x &optional form &rest more) + "Thread the expr through the forms. Insert X as the second item +in the first form, making a list of it if it is not a list +already. If there are more forms, insert the first form as the +second item in second form, etc." + (cond + ((null form) x) + ((null more) (if (listp form) + `(,(car form) ,x ,@(cdr form)) + (list form x))) + (:else `(-> (-> ,x ,form) ,@more)))) + +(defmacro ->> (x form &rest more) + "Thread the expr through the forms. Insert X as the last item +in the first form, making a list of it if it is not a list +already. If there are more forms, insert the first form as the +last item in second form, etc." + (if (null more) + (if (listp form) + `(,(car form) ,@(cdr form) ,x) + (list form x)) + `(->> (->> ,x ,form) ,@more))) + +(defmacro --> (x form &rest more) + "Thread the expr through the forms. Insert X at the position +signified by the token `it' in the first form. If there are more +forms, insert the first form at the position signified by `it' in +in second form, etc." + (if (null more) + (if (listp form) + (--map-when (eq it 'it) x form) + (list form x)) + `(--> (--> ,x ,form) ,@more))) + +(put '-> 'lisp-indent-function 1) +(put '->> 'lisp-indent-function 1) +(put '--> 'lisp-indent-function 1) + +(defun -grade-up (comparator list) + "Grade elements of LIST using COMPARATOR relation, yielding a +permutation vector such that applying this permutation to LIST +sorts it in ascending order." + ;; ugly hack to "fix" lack of lexical scope + (let ((comp `(lambda (it other) (funcall ',comparator (car it) (car other))))) + (->> (--map-indexed (cons it it-index) list) + (-sort comp) + (-map 'cdr)))) + +(defun -grade-down (comparator list) + "Grade elements of LIST using COMPARATOR relation, yielding a +permutation vector such that applying this permutation to LIST +sorts it in descending order." + ;; ugly hack to "fix" lack of lexical scope + (let ((comp `(lambda (it other) (funcall ',comparator (car other) (car it))))) + (->> (--map-indexed (cons it it-index) list) + (-sort comp) + (-map 'cdr)))) + +(defmacro -when-let (var-val &rest body) + "If VAL evaluates to non-nil, bind it to VAR and execute body. +VAR-VAL should be a (VAR VAL) pair." + (declare (debug ((symbolp form) body)) + (indent 1)) + (let ((var (car var-val)) + (val (cadr var-val))) + `(let ((,var ,val)) + (when ,var + ,@body)))) + +(defmacro -when-let* (vars-vals &rest body) + "If all VALS evaluate to true, bind them to their corresponding +VARS and execute body. VARS-VALS should be a list of (VAR VAL) +pairs (corresponding to bindings of `let*')." + (declare (debug ((&rest (symbolp form)) body)) + (indent 1)) + (if (= (length vars-vals) 1) + `(-when-let ,(car vars-vals) + ,@body) + `(-when-let ,(car vars-vals) + (-when-let* ,(cdr vars-vals) + ,@body)))) + +(defmacro --when-let (val &rest body) + "If VAL evaluates to non-nil, bind it to `it' and execute +body." + (declare (debug (form body)) + (indent 1)) + `(let ((it ,val)) + (when it + ,@body))) + +(defmacro -if-let (var-val then &rest else) + "If VAL evaluates to non-nil, bind it to VAR and do THEN, +otherwise do ELSE. VAR-VAL should be a (VAR VAL) pair." + (declare (debug ((symbolp form) form body)) + (indent 2)) + (let ((var (car var-val)) + (val (cadr var-val))) + `(let ((,var ,val)) + (if ,var ,then ,@else)))) + +(defmacro -if-let* (vars-vals then &rest else) + "If all VALS evaluate to true, bind them to their corresponding +VARS and do THEN, otherwise do ELSE. VARS-VALS should be a list +of (VAR VAL) pairs (corresponding to the bindings of `let*')." + (declare (debug ((&rest (symbolp form)) form body)) + (indent 2)) + (let ((first-pair (car vars-vals)) + (rest (cdr vars-vals))) + (if (= (length vars-vals) 1) + `(-if-let ,first-pair ,then ,@else) + `(-if-let ,first-pair + (-if-let* ,rest ,then ,@else) + ,@else)))) + +(defmacro --if-let (val then &rest else) + "If VAL evaluates to non-nil, bind it to `it' and do THEN, +otherwise do ELSE." + (declare (debug (form form body)) + (indent 2)) + `(let ((it ,val)) + (if it ,then ,@else))) + +(defun -distinct (list) + "Return a new list with all duplicates removed. +The test for equality is done with `equal', +or with `-compare-fn' if that's non-nil. + +Alias: `-uniq'" + (let (result) + (--each list (unless (-contains? result it) (!cons it result))) + (nreverse result))) + +(defalias '-uniq '-distinct) + +(defun -union (list list2) + "Return a new list containing the elements of LIST1 and elements of LIST2 that are not in LIST1. +The test for equality is done with `equal', +or with `-compare-fn' if that's non-nil." + (let (result) + (--each list (!cons it result)) + (--each list2 (unless (-contains? result it) (!cons it result))) + (nreverse result))) + +(defun -intersection (list list2) + "Return a new list containing only the elements that are members of both LIST and LIST2. +The test for equality is done with `equal', +or with `-compare-fn' if that's non-nil." + (--filter (-contains? list2 it) list)) + +(defun -difference (list list2) + "Return a new list with only the members of LIST that are not in LIST2. +The test for equality is done with `equal', +or with `-compare-fn' if that's non-nil." + (--filter (not (-contains? list2 it)) list)) + +(defvar -compare-fn nil + "Tests for equality use this function or `equal' if this is nil. +It should only be set using dynamic scope with a let, like: + + (let ((-compare-fn =)) (-union numbers1 numbers2 numbers3)") + +(defun -contains? (list element) + "Return non-nil if LIST contains ELEMENT. + +The test for equality is done with `equal', or with `-compare-fn' +if that's non-nil. + +Alias: `-contains-p'" + (not + (null + (cond + ((null -compare-fn) (member element list)) + ((eq -compare-fn 'eq) (memq element list)) + ((eq -compare-fn 'eql) (memql element list)) + (t + (let ((lst list)) + (while (and lst + (not (funcall -compare-fn element (car lst)))) + (setq lst (cdr lst))) + lst)))))) + +(defalias '-contains-p '-contains?) + +(defun -same-items? (list list2) + "Return true if LIST and LIST2 has the same items. + +The order of the elements in the lists does not matter. + +Alias: `-same-items-p'" + (let ((length-a (length list)) + (length-b (length list2))) + (and + (= length-a length-b) + (= length-a (length (-intersection list list2)))))) + +(defalias '-same-items-p '-same-items?) + +(defun -is-prefix? (prefix list) + "Return non-nil if PREFIX is prefix of LIST. + +Alias: `-is-prefix-p'" + (--each-while list (equal (car prefix) it) + (!cdr prefix)) + (not prefix)) + +(defun -is-suffix? (suffix list) + "Return non-nil if SUFFIX is suffix of LIST. + +Alias: `-is-suffix-p'" + (-is-prefix? (nreverse suffix) (nreverse list))) + +(defun -is-infix? (infix list) + "Return non-nil if INFIX is infix of LIST. + +This operation runs in O(n^2) time + +Alias: `-is-infix-p'" + (let (done) + (while (and (not done) list) + (setq done (-is-prefix? infix list)) + (!cdr list)) + done)) + +(defalias '-is-prefix-p '-is-prefix?) +(defalias '-is-suffix-p '-is-suffix?) +(defalias '-is-infix-p '-is-infix?) + +(defun -sort (comparator list) + "Sort LIST, stably, comparing elements using COMPARATOR. +Return the sorted list. LIST is NOT modified by side effects. +COMPARATOR is called with two elements of LIST, and should return non-nil +if the first element should sort before the second." + (sort (copy-sequence list) comparator)) + +(defmacro --sort (form list) + "Anaphoric form of `-sort'." + (declare (debug (form form))) + `(-sort (lambda (it other) ,form) ,list)) + +(defun -list (&rest args) + "Return a list with ARGS. + +If first item of ARGS is already a list, simply return ARGS. If +not, return a list with ARGS as elements." + (let ((arg (car args))) + (if (listp arg) arg args))) + +(defun -repeat (n x) + "Return a list with X repeated N times. +Return nil if N is less than 1." + (let (ret) + (--dotimes n (!cons x ret)) + ret)) + +(defun -sum (list) + "Return the sum of LIST." + (apply '+ list)) + +(defun -product (list) + "Return the product of LIST." + (apply '* list)) + +(defun -max (list) + "Return the largest value from LIST of numbers or markers." + (apply 'max list)) + +(defun -min (list) + "Return the smallest value from LIST of numbers or markers." + (apply 'min list)) + +(defun -max-by (comparator list) + "Take a comparison function COMPARATOR and a LIST and return +the greatest element of the list by the comparison function. + +See also combinator `-on' which can transform the values before +comparing them." + (--reduce (if (funcall comparator it acc) it acc) list)) + +(defun -min-by (comparator list) + "Take a comparison function COMPARATOR and a LIST and return +the least element of the list by the comparison function. + +See also combinator `-on' which can transform the values before +comparing them." + (--reduce (if (funcall comparator it acc) acc it) list)) + +(defmacro --max-by (form list) + "Anaphoric version of `-max-by'. + +The items for the comparator form are exposed as \"it\" and \"other\"." + (declare (debug (form form))) + `(-max-by (lambda (it other) ,form) ,list)) + +(defmacro --min-by (form list) + "Anaphoric version of `-min-by'. + +The items for the comparator form are exposed as \"it\" and \"other\"." + (declare (debug (form form))) + `(-min-by (lambda (it other) ,form) ,list)) + +(defun -iterate (fun init n) + "Return a list of iterated applications of FUN to INIT. + +This means a list of form: + + (init (fun init) (fun (fun init)) ...) + +N is the length of the returned list." + (if (= n 0) nil + (let ((r (list init))) + (--dotimes (1- n) + (push (funcall fun (car r)) r)) + (nreverse r)))) + +(defmacro --iterate (form init n) + "Anaphoric version of `-iterate'." + (declare (debug (form form form))) + `(-iterate (lambda (it) ,form) ,init ,n)) + +(defun -unfold (fun seed) + "Build a list from SEED using FUN. + +This is \"dual\" operation to `-reduce-r': while -reduce-r +consumes a list to produce a single value, `-unfold' takes a +seed value and builds a (potentially infinite!) list. + +FUN should return `nil' to stop the generating process, or a +cons (A . B), where A will be prepended to the result and B is +the new seed." + (let ((last (funcall fun seed)) r) + (while last + (push (car last) r) + (setq last (funcall fun (cdr last)))) + (nreverse r))) + +(defmacro --unfold (form seed) + "Anaphoric version of `-unfold'." + (declare (debug (form form))) + `(-unfold (lambda (it) ,form) ,seed)) + +(defun -cons-pair? (con) + "Return non-nil if CON is true cons pair. +That is (A . B) where B is not a list." + (and (listp con) + (not (listp (cdr con))))) + +(defun -cons-to-list (con) + "Convert a cons pair to a list with `car' and `cdr' of the pair respectively." + (list (car con) (cdr con))) + +(defun -value-to-list (val) + "Convert a value to a list. + +If the value is a cons pair, make a list with two elements, `car' +and `cdr' of the pair respectively. + +If the value is anything else, wrap it in a list." + (cond + ((-cons-pair? val) (-cons-to-list val)) + (t (list val)))) + +(defun -tree-mapreduce-from (fn folder init-value tree) + "Apply FN to each element of TREE, and make a list of the results. +If elements of TREE are lists themselves, apply FN recursively to +elements of these nested lists. + +Then reduce the resulting lists using FOLDER and initial value +INIT-VALUE. See `-reduce-r-from'. + +This is the same as calling `-tree-reduce-from' after `-tree-map' +but is twice as fast as it only traverse the structure once." + (cond + ((not tree) nil) + ((-cons-pair? tree) (funcall fn tree)) + ((listp tree) + (-reduce-r-from folder init-value (mapcar (lambda (x) (-tree-mapreduce-from fn folder init-value x)) tree))) + (t (funcall fn tree)))) + +(defmacro --tree-mapreduce-from (form folder init-value tree) + "Anaphoric form of `-tree-mapreduce-from'." + (declare (debug (form form form form))) + `(-tree-mapreduce-from (lambda (it) ,form) (lambda (it acc) ,folder) ,init-value ,tree)) + +(defun -tree-mapreduce (fn folder tree) + "Apply FN to each element of TREE, and make a list of the results. +If elements of TREE are lists themselves, apply FN recursively to +elements of these nested lists. + +Then reduce the resulting lists using FOLDER and initial value +INIT-VALUE. See `-reduce-r-from'. + +This is the same as calling `-tree-reduce' after `-tree-map' +but is twice as fast as it only traverse the structure once." + (cond + ((not tree) nil) + ((-cons-pair? tree) (funcall fn tree)) + ((listp tree) + (-reduce-r folder (mapcar (lambda (x) (-tree-mapreduce fn folder x)) tree))) + (t (funcall fn tree)))) + +(defmacro --tree-mapreduce (form folder tree) + "Anaphoric form of `-tree-mapreduce'." + (declare (debug (form form form))) + `(-tree-mapreduce (lambda (it) ,form) (lambda (it acc) ,folder) ,tree)) + +(defun -tree-map (fn tree) + "Apply FN to each element of TREE while preserving the tree structure." + (cond + ((not tree) nil) + ((-cons-pair? tree) (funcall fn tree)) + ((listp tree) + (mapcar (lambda (x) (-tree-map fn x)) tree)) + (t (funcall fn tree)))) + +(defmacro --tree-map (form tree) + "Anaphoric form of `-tree-map'." + (declare (debug (form form))) + `(-tree-map (lambda (it) ,form) ,tree)) + +(defun -tree-reduce-from (fn init-value tree) + "Use FN to reduce elements of list TREE. +If elements of TREE are lists themselves, apply the reduction recursively. + +FN is first applied to INIT-VALUE and first element of the list, +then on this result and second element from the list etc. + +The initial value is ignored on cons pairs as they always contain +two elements." + (cond + ((not tree) nil) + ((-cons-pair? tree) tree) + ((listp tree) + (-reduce-r-from fn init-value (mapcar (lambda (x) (-tree-reduce-from fn init-value x)) tree))) + (t tree))) + +(defmacro --tree-reduce-from (form init-value tree) + "Anaphoric form of `-tree-reduce-from'." + (declare (debug (form form form))) + `(-tree-reduce-from (lambda (it acc) ,form) ,init-value ,tree)) + +(defun -tree-reduce (fn tree) + "Use FN to reduce elements of list TREE. +If elements of TREE are lists themselves, apply the reduction recursively. + +FN is first applied to first element of the list and second +element, then on this result and third element from the list etc. + +See `-reduce-r' for how exactly are lists of zero or one element handled." + (cond + ((not tree) nil) + ((-cons-pair? tree) tree) + ((listp tree) + (-reduce-r fn (mapcar (lambda (x) (-tree-reduce fn x)) tree))) + (t tree))) + +(defmacro --tree-reduce (form tree) + "Anaphoric form of `-tree-reduce'." + (declare (debug (form form))) + `(-tree-reduce (lambda (it acc) ,form) ,tree)) + +(defun -tree-map-nodes (pred fun tree) + "Call FUN on each node of TREE that satisfies PRED. + +If PRED returns nil, continue descending down this node. If PRED +returns non-nil, apply FUN to this node and do not descend +further." + (if (funcall pred tree) + (funcall fun tree) + (if (listp tree) + (-map (lambda (x) (-tree-map-nodes pred fun x)) tree) + tree))) + +(defmacro --tree-map-nodes (pred form tree) + "Anaphoric form of `-tree-map-nodes'." + `(-tree-map-nodes (lambda (it) ,pred) (lambda (it) ,form) ,tree)) + +(defun -tree-seq (branch children tree) + "Return a sequence of the nodes in TREE, in depth-first search order. + +BRANCH is a predicate of one argument that returns non-nil if the +passed argument is a branch, that is, a node that can have children. + +CHILDREN is a function of one argument that returns the children +of the passed branch node. + +Non-branch nodes are simply copied." + (cons tree + (when (funcall branch tree) + (-mapcat (lambda (x) (-tree-seq branch children x)) + (funcall children tree))))) + +(defmacro --tree-seq (branch children tree) + "Anaphoric form of `-tree-seq'." + `(-tree-seq (lambda (it) ,branch) (lambda (it) ,children) ,tree)) + +(defun -clone (list) + "Create a deep copy of LIST. +The new list has the same elements and structure but all cons are +replaced with new ones. This is useful when you need to clone a +structure such as plist or alist." + (-tree-map 'identity list)) + +(defun dash-enable-font-lock () + "Add syntax highlighting to dash functions, macros and magic values." + (eval-after-load "lisp-mode" + '(progn + (let ((new-keywords '( + "-each" + "--each" + "-each-while" + "--each-while" + "-dotimes" + "--dotimes" + "-map" + "--map" + "-reduce-from" + "--reduce-from" + "-reduce" + "--reduce" + "-reduce-r-from" + "--reduce-r-from" + "-reduce-r" + "--reduce-r" + "-filter" + "--filter" + "-select" + "--select" + "-remove" + "--remove" + "-reject" + "--reject" + "-keep" + "--keep" + "-map-indexed" + "--map-indexed" + "-splice" + "--splice" + "-splice-list" + "--splice-list" + "-map-when" + "--map-when" + "-replace-where" + "--replace-where" + "-replace" + "-flatten" + "-flatten-n" + "-concat" + "-mapcat" + "--mapcat" + "-copy" + "-cons*" + "-snoc" + "-first" + "--first" + "-find" + "--find" + "-last" + "--last" + "-first-item" + "-last-item" + "-butlast" + "-count" + "--count" + "-any?" + "--any?" + "-some?" + "--some?" + "-any-p" + "--any-p" + "-some-p" + "--some-p" + "-all?" + "--all?" + "-every?" + "--every?" + "-all-p" + "--all-p" + "-every-p" + "--every-p" + "-none?" + "--none?" + "-none-p" + "--none-p" + "-only-some?" + "--only-some?" + "-only-some-p" + "--only-some-p" + "-slice" + "-take" + "-drop" + "-take-while" + "--take-while" + "-drop-while" + "--drop-while" + "-split-at" + "-rotate" + "-insert-at" + "-replace-at" + "-update-at" + "--update-at" + "-remove-at" + "-remove-at-indices" + "-split-with" + "--split-with" + "-split-on" + "-split-when" + "--split-when" + "-separate" + "--separate" + "-partition-all-in-steps" + "-partition-in-steps" + "-partition-all" + "-partition" + "-partition-by" + "--partition-by" + "-partition-by-header" + "--partition-by-header" + "-group-by" + "--group-by" + "-interpose" + "-interleave" + "-zip-with" + "--zip-with" + "-zip" + "-zip-fill" + "-cycle" + "-pad" + "-annotate" + "--annotate" + "-table" + "-table-flat" + "-partial" + "-elem-index" + "-elem-indices" + "-find-indices" + "--find-indices" + "-find-index" + "--find-index" + "-find-last-index" + "--find-last-index" + "-select-by-indices" + "-grade-up" + "-grade-down" + "->" + "->>" + "-->" + "-when-let" + "-when-let*" + "--when-let" + "-if-let" + "-if-let*" + "--if-let" + "-distinct" + "-uniq" + "-union" + "-intersection" + "-difference" + "-contains?" + "-contains-p" + "-same-items?" + "-same-items-p" + "-is-prefix-p" + "-is-prefix?" + "-is-suffix-p" + "-is-suffix?" + "-is-infix-p" + "-is-infix?" + "-sort" + "--sort" + "-list" + "-repeat" + "-sum" + "-product" + "-max" + "-min" + "-max-by" + "--max-by" + "-min-by" + "--min-by" + "-iterate" + "--iterate" + "-unfold" + "--unfold" + "-cons-pair?" + "-cons-to-list" + "-value-to-list" + "-tree-mapreduce-from" + "--tree-mapreduce-from" + "-tree-mapreduce" + "--tree-mapreduce" + "-tree-map" + "--tree-map" + "-tree-reduce-from" + "--tree-reduce-from" + "-tree-reduce" + "--tree-reduce" + "-tree-seq" + "--tree-seq" + "-tree-map-nodes" + "--tree-map-nodes" + "-clone" + "-rpartial" + "-juxt" + "-applify" + "-on" + "-flip" + "-const" + "-cut" + "-orfn" + "-andfn" + "-iteratefn" + "-prodfn" + )) + (special-variables '( + "it" + "it-index" + "acc" + "other" + ))) + (font-lock-add-keywords 'emacs-lisp-mode `((,(concat "\\_<" (regexp-opt special-variables 'paren) "\\_>") + 1 font-lock-variable-name-face)) 'append) + (font-lock-add-keywords 'emacs-lisp-mode `((,(concat "(\\s-*" (regexp-opt new-keywords 'paren) "\\_>") + 1 font-lock-keyword-face)) 'append)) + (--each (buffer-list) + (with-current-buffer it + (when (and (eq major-mode 'emacs-lisp-mode) + (boundp 'font-lock-mode) + font-lock-mode) + (font-lock-refresh-defaults))))))) + +(provide 'dash) +;;; dash.el ends here diff --git a/elpa/dash-20140717.547/dash.elc b/elpa/dash-20140717.547/dash.elc new file mode 100644 index 000000000..30991000c Binary files /dev/null and b/elpa/dash-20140717.547/dash.elc differ diff --git a/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-autoloads.el b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-autoloads.el new file mode 100644 index 000000000..feab143bf --- /dev/null +++ b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-autoloads.el @@ -0,0 +1,58 @@ +;;; elisp-slime-nav-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (elisp-slime-nav-describe-elisp-thing-at-point +;;;;;; elisp-slime-nav-find-elisp-thing-at-point turn-on-elisp-slime-nav-mode +;;;;;; elisp-slime-nav-mode) "elisp-slime-nav" "elisp-slime-nav.el" +;;;;;; (21478 16687 0 0)) +;;; Generated autoloads from elisp-slime-nav.el + +(autoload 'elisp-slime-nav-mode "elisp-slime-nav" "\ +Enable Slime-style navigation of elisp symbols using M-. and M-, + +\(fn &optional ARG)" t nil) + +(autoload 'turn-on-elisp-slime-nav-mode "elisp-slime-nav" "\ +Explicitly enable `elisp-slime-nav-mode'. + +\(fn)" nil nil) + +(autoload 'elisp-slime-nav-find-elisp-thing-at-point "elisp-slime-nav" "\ +Find the elisp thing at point, be it a function, variable, library or face. + +With a prefix arg, or if there is no thing at point, prompt for +the symbol to jump to. + +Argument SYM-NAME is the thing to find. + +\(fn SYM-NAME)" t nil) + +(autoload 'elisp-slime-nav-describe-elisp-thing-at-point "elisp-slime-nav" "\ +Display the full documentation of the elisp thing at point. + +The named subject may be a function, variable, library or face. + +With a prefix arg, or if there is not \"thing\" at point, prompt +for the symbol to jump to. + +Argument SYM-NAME is the thing to find. + +\(fn SYM-NAME)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("elisp-slime-nav-pkg.el") (21478 16687 +;;;;;; 855002 0)) + +;;;*** + +(provide 'elisp-slime-nav-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; elisp-slime-nav-autoloads.el ends here diff --git a/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-pkg.el b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-pkg.el new file mode 100644 index 000000000..6c079d629 --- /dev/null +++ b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-pkg.el @@ -0,0 +1 @@ +(define-package "elisp-slime-nav" "20140619.254" "Make M-. and M-, work in elisp like they do in slime" (quote ((cl-lib "0.2")))) diff --git a/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-pkg.elc b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-pkg.elc new file mode 100644 index 000000000..576374eb4 Binary files /dev/null and b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav-pkg.elc differ diff --git a/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav.el b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav.el new file mode 100644 index 000000000..c5d93b755 --- /dev/null +++ b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav.el @@ -0,0 +1,116 @@ +;;; elisp-slime-nav.el --- Make M-. and M-, work in elisp like they do in slime +;; +;; Author: Steve Purcell +;; Keywords: navigation slime elisp emacs-lisp +;; URL: https://github.com/purcell/elisp-slime-nav +;; Version: 20140619.254 +;; X-Original-Version: DEV +;; Package-Requires: ((cl-lib "0.2")) +;; +;;; Commentary: +;; +;; This package provides Slime's convenient "M-." and "M-," navigation +;; in `emacs-lisp-mode', together with an elisp equivalent of +;; `slime-describe-symbol', bound by default to `C-c C-d d`. +;; +;; When the main functions are given a prefix argument, they will +;; prompt for the symbol upon which to operate. +;; +;; Usage: +;; +;; Enable the package in elisp and ielm modes as follows: +;; +;; (require 'elisp-slime-nav) ;; optional if installed via package.el +;; (dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook)) +;; (add-hook hook 'turn-on-elisp-slime-nav-mode)) +;; +;; Known issues: +;; +;; When navigating into Emacs' C source, "M-," will not be bound to +;; the same command, but "M-*" will typically do the trick. +;; +;;; Code: + +(eval-when-compile (require 'cl-lib)) +(require 'etags) +(require 'help-mode) + +(defvar elisp-slime-nav-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "M-.") 'elisp-slime-nav-find-elisp-thing-at-point) + (define-key map (kbd "M-,") 'pop-tag-mark) + (define-key map (kbd "C-c C-d d") 'elisp-slime-nav-describe-elisp-thing-at-point) + (define-key map (kbd "C-c C-d C-d") 'elisp-slime-nav-describe-elisp-thing-at-point) + map)) + +;;;###autoload +(define-minor-mode elisp-slime-nav-mode + "Enable Slime-style navigation of elisp symbols using M-. and M-," + nil " SliNav" elisp-slime-nav-mode-map) + +;;;###autoload +(defun turn-on-elisp-slime-nav-mode () + "Explicitly enable `elisp-slime-nav-mode'." + (elisp-slime-nav-mode 1)) + +(defun elisp-slime-nav--all-navigable-symbol-names () + "Return a list of strings for the symbols to which navigation is possible." + (cl-loop for x being the symbols + if (or (fboundp x) (boundp x) (symbol-plist x) (facep x)) + collect (symbol-name x))) + +(defun elisp-slime-nav--read-symbol-at-point () + "Return the symbol at point as a string. +If `current-prefix-arg' is not nil, the user is prompted for the symbol." + (let* ((sym-at-point (symbol-at-point)) + (at-point (and sym-at-point (symbol-name sym-at-point)))) + (if (or current-prefix-arg (null at-point)) + (completing-read "Symbol: " + (elisp-slime-nav--all-navigable-symbol-names) + nil t at-point) + at-point))) + +;;;###autoload +(defun elisp-slime-nav-find-elisp-thing-at-point (sym-name) + "Find the elisp thing at point, be it a function, variable, library or face. + +With a prefix arg, or if there is no thing at point, prompt for +the symbol to jump to. + +Argument SYM-NAME is the thing to find." + (interactive (list (elisp-slime-nav--read-symbol-at-point))) + (when sym-name + (let ((sym (intern sym-name))) + (message "Searching for %s..." (pp-to-string sym)) + (ring-insert find-tag-marker-ring (point-marker)) + (cond + ((fboundp sym) (find-function sym)) + ((boundp sym) (find-variable sym)) + ((or (featurep sym) (locate-library sym-name)) + (find-library sym-name)) + ((facep sym) + (find-face-definition sym)) + (:else + (progn + (pop-tag-mark) + (error "Don't know how to find '%s'" sym))))))) + +;;;###autoload +(defun elisp-slime-nav-describe-elisp-thing-at-point (sym-name) + "Display the full documentation of the elisp thing at point. + +The named subject may be a function, variable, library or face. + +With a prefix arg, or if there is not \"thing\" at point, prompt +for the symbol to jump to. + +Argument SYM-NAME is the thing to find." + (interactive (list (elisp-slime-nav--read-symbol-at-point))) + (help-xref-interned (intern sym-name))) + + +(provide 'elisp-slime-nav) +;; Local Variables: +;; indent-tabs-mode: nil +;; End: +;;; elisp-slime-nav.el ends here diff --git a/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav.elc b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav.elc new file mode 100644 index 000000000..100bd5b73 Binary files /dev/null and b/elpa/elisp-slime-nav-20140619.254/elisp-slime-nav.elc differ diff --git a/elpa/epl-20140620.218/epl-autoloads.el b/elpa/epl-20140620.218/epl-autoloads.el new file mode 100644 index 000000000..898586913 --- /dev/null +++ b/elpa/epl-20140620.218/epl-autoloads.el @@ -0,0 +1,18 @@ +;;; epl-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("epl-pkg.el" "epl.el") (21478 16686 294171 +;;;;;; 0)) + +;;;*** + +(provide 'epl-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; epl-autoloads.el ends here diff --git a/elpa/epl-20140620.218/epl-pkg.el b/elpa/epl-20140620.218/epl-pkg.el new file mode 100644 index 000000000..577642688 --- /dev/null +++ b/elpa/epl-20140620.218/epl-pkg.el @@ -0,0 +1 @@ +(define-package "epl" "20140620.218" "Emacs Package Library" (quote ((cl-lib "0.3")))) diff --git a/elpa/epl-20140620.218/epl-pkg.elc b/elpa/epl-20140620.218/epl-pkg.elc new file mode 100644 index 000000000..a820b7512 Binary files /dev/null and b/elpa/epl-20140620.218/epl-pkg.elc differ diff --git a/elpa/epl-20140620.218/epl.el b/elpa/epl-20140620.218/epl.el new file mode 100644 index 000000000..6b8365f6c --- /dev/null +++ b/elpa/epl-20140620.218/epl.el @@ -0,0 +1,566 @@ +;;; epl.el --- Emacs Package Library -*- lexical-binding: t; -*- + +;; Copyright (C) 2013, 2014 Sebastian Wiesner + +;; Author: Sebastian Wiesner +;; Maintainer: Johan Andersson +;; Sebastian Wiesner +;; Version: 20140620.218 +;; X-Original-Version: 0.7-cvs +;; Package-Requires: ((cl-lib "0.3")) +;; Keywords: convenience +;; URL: http://github.com/cask/epl + +;; 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 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 . + +;;; Commentary: + +;; A package management library for Emacs, based on package.el. + +;; The purpose of this library is to wrap all the quirks and hassle of +;; package.el into a sane API. + +;; The following functions comprise the public interface of this library: + +;;; Package directory selection + +;; `epl-package-dir' gets the directory of packages. + +;; `epl-default-package-dir' gets the default package directory. + +;; `epl-change-package-dir' changes the directory of packages. + +;;; Package system management + +;; `epl-initialize' initializes the package system and activates all +;; packages. + +;; `epl-reset' resets the package system. + +;; `epl-refresh' refreshes all package archives. + +;; `epl-add-archive' adds a new package archive. + +;;; Package objects + +;; Struct `epl-requirement' describes a requirement of a package with `name' and +;; `version' slots. + +;; `epl-requirement-version-string' gets a requirement version as string. + +;; Struct `epl-package' describes an installed or installable package with a +;; `name' and some internal `description'. + +;; `epl-package-version' gets the version of a package. + +;; `epl-package-version-string' gets the version of a package as string. + +;; `epl-package-summary' gets the summary of a package. + +;; `epl-package-requirements' gets the requirements of a package. + +;; `epl-package-directory' gets the installation directory of a package. + +;; `epl-package-from-buffer' creates a package object for the package contained +;; in the current buffer. + +;; `epl-package-from-file' creates a package object for a package file, either +;; plain lisp or tarball. + +;; `epl-package-from-descriptor-file' creates a package object for a package +;; description (i.e. *-pkg.el) file. + +;;; Package database access + +;; `epl-package-installed-p' determines whether a package is installed. + +;; `epl-installed-packages' and `epl-available-packages' get all packages +;; installed and available for installation respectively. + +;; `epl-find-installed-package' and `epl-find-available-packages' find installed +;; and available packages by name. + +;; `epl-find-upgrades' finds all upgradable packages. + +;; `epl-built-in-p' return true if package is built-in to Emacs. + +;;; Package operations + +;; `epl-install-file' installs a package file. + +;; `epl-package-install' installs a package. + +;; `epl-package-delete' deletes a package. + +;; `epl-upgrade' upgrades packages. + +;;; Code: + +(require 'cl-lib) +(require 'package) + +(defun epl--package-desc-p (package) + "Whether PACKAGE is a `package-desc' object. + +Like `package-desc-p', but return nil, if `package-desc-p' is not +defined as function." + (and (fboundp 'package-desc-p) (package-desc-p package))) + + +;;; Package directory +(defun epl-package-dir () + "Get the directory of packages." + package-user-dir) + +(defun epl-default-package-dir () + "Get the default directory of packages." + (eval (car (get 'package-user-dir 'standard-value)))) + +(defun epl-change-package-dir (directory) + "Change the directory of packages to DIRECTORY." + (setq package-user-dir directory) + (epl-initialize)) + + +;;; Package system management +(defvar epl--load-path-before-initialize nil + "Remember the load path for `epl-reset'.") + +(defun epl-initialize (&optional no-activate) + "Load Emacs Lisp packages and activate them. + +With NO-ACTIVATE non-nil, do not activate packages." + (setq epl--load-path-before-initialize load-path) + (package-initialize no-activate)) + +(defalias 'epl-refresh 'package-refresh-contents) + +(defun epl-add-archive (name url) + "Add a package archive with NAME and URL." + (add-to-list 'package-archives (cons name url))) + +(defun epl-reset () + "Reset the package system. + +Clear the list of installed and available packages, the list of +package archives and reset the package directory." + (setq package-alist nil + package-archives nil + package-archive-contents nil + load-path epl--load-path-before-initialize) + (when (boundp 'package-obsolete-alist) ; Legacy package.el + (setq package-obsolete-alist nil)) + (epl-change-package-dir (epl-default-package-dir))) + + +;;; Package structures +(cl-defstruct (epl-requirement + (:constructor epl-requirement-create)) + "Structure describing a requirement. + +Slots: + +`name' The name of the required package, as symbol. + +`version' The version of the required package, as version list." + name + version) + +(defun epl-requirement-version-string (requirement) + "The version of a REQUIREMENT, as string." + (package-version-join (epl-requirement-version requirement))) + +(cl-defstruct (epl-package (:constructor epl-package-create)) + "Structure representing a package. + +Slots: + +`name' The package name, as symbol. + +`description' The package description. + +The format package description varies between package.el +variants. For `package-desc' variants, it is simply the +corresponding `package-desc' object. For legacy variants, it is +a vector `[VERSION REQS DOCSTRING]'. + +Do not access `description' directly, but instead use the +`epl-package' accessors." + name + description) + +(defmacro epl-package-as-description (var &rest body) + "Cast VAR to a package description in BODY. + +VAR is a symbol, bound to an `epl-package' object. This macro +casts this object to the `description' object, and binds the +description to VAR in BODY." + (declare (indent 1)) + (unless (symbolp var) + (signal 'wrong-type-argument (list #'symbolp var))) + `(if (epl-package-p ,var) + (let ((,var (epl-package-description ,var))) + ,@body) + (signal 'wrong-type-argument (list #'epl-package-p ,var)))) + +(defun epl-package--package-desc-p (package) + "Whether the description of PACKAGE is a `package-desc'." + (epl--package-desc-p (epl-package-description package))) + +(defun epl-package-version (package) + "Get the version of PACKAGE, as version list." + (epl-package-as-description package + (cond + ((fboundp 'package-desc-version) (package-desc-version package)) + ;; Legacy + ((fboundp 'package-desc-vers) + (let ((version (package-desc-vers package))) + (if (listp version) version (version-to-list version)))) + (:else (error "Cannot get version from %S" package))))) + +(defun epl-package-version-string (package) + "Get the version from a PACKAGE, as string." + (package-version-join (epl-package-version package))) + +(defun epl-package-summary (package) + "Get the summary of PACKAGE, as string." + (epl-package-as-description package + (cond + ((fboundp 'package-desc-summary) (package-desc-summary package)) + ((fboundp 'package-desc-doc) (package-desc-doc package)) ; Legacy + (:else (error "Cannot get summary from %S" package))))) + +(defun epl-requirement--from-req (req) + "Create a `epl-requirement' from a `package-desc' REQ." + (cl-destructuring-bind (name version) req + (epl-requirement-create :name name + :version (if (listp version) version + (version-to-list version))))) + +(defun epl-package-requirements (package) + "Get the requirements of PACKAGE. + +The requirements are a list of `epl-requirement' objects." + (epl-package-as-description package + (mapcar #'epl-requirement--from-req (package-desc-reqs package)))) + +(defun epl-package-directory (package) + "Get the directory PACKAGE is installed to. + +Return the absolute path of the installation directory of +PACKAGE, or nil, if PACKAGE is not installed." + (cond + ((fboundp 'package-desc-dir) + (package-desc-dir (epl-package-description package))) + ((fboundp 'package--dir) + (package--dir (symbol-name (epl-package-name package)) + (epl-package-version-string package))) + (:else (error "Cannot get package directory from %S" package)))) + +(defun epl-package-->= (pkg1 pkg2) + "Determine whether PKG1 is before PKG2 by version." + (not (version-list-< (epl-package-version pkg1) + (epl-package-version pkg2)))) + +(defun epl-package--from-package-desc (package-desc) + "Create an `epl-package' from a PACKAGE-DESC. + +PACKAGE-DESC is a `package-desc' object, from recent package.el +variants." + (if (and (fboundp 'package-desc-name) + (epl--package-desc-p package-desc)) + (epl-package-create :name (package-desc-name package-desc) + :description package-desc) + (signal 'wrong-type-argument (list 'epl--package-desc-p package-desc)))) + +(defun epl-package--parse-info (info) + "Parse a package.el INFO." + (if (epl--package-desc-p info) + (epl-package--from-package-desc info) + ;; For legacy package.el, info is a vector [NAME REQUIRES DESCRIPTION + ;; VERSION COMMENTARY]. We need to re-shape this vector into the + ;; `package-alist' format [VERSION REQUIRES DESCRIPTION] to attach it to the + ;; new `epl-package'. + (let ((name (intern (aref info 0))) + (info (vector (aref info 3) (aref info 1) (aref info 2)))) + (epl-package-create :name name :description info)))) + +(defun epl-package-from-buffer (&optional buffer) + "Create an `epl-package' object from BUFFER. + +BUFFER defaults to the current buffer." + (let ((info (with-current-buffer (or buffer (current-buffer)) + (package-buffer-info)))) + (epl-package--parse-info info))) + +(defun epl-package-from-lisp-file (file-name) + "Parse the package headers the file at FILE-NAME. + +Return an `epl-package' object with the header metadata." + (with-temp-buffer + (insert-file-contents file-name) + (epl-package-from-buffer (current-buffer)))) + +(defun epl-package-from-tar-file (file-name) + "Parse the package tarball at FILE-NAME. + +Return a `epl-package' object with the meta data of the tarball +package in FILE-NAME." + (condition-case nil + ;; In legacy package.el, `package-tar-file-info' takes the name of the tar + ;; file to parse as argument. In modern package.el, it has no arguments + ;; and works on the current buffer. Hence, we just try to call the legacy + ;; version, and if that fails because of a mismatch between formal and + ;; actual arguments, we use the modern approach. To avoid spurious + ;; signature warnings by the byte compiler, we suppress warnings when + ;; calling the function. + (epl-package--parse-info (with-no-warnings + (package-tar-file-info file-name))) + (wrong-number-of-arguments + (with-temp-buffer + (insert-file-contents-literally file-name) + ;; Switch to `tar-mode' to enable extraction of the file. Modern + ;; `package-tar-file-info' relies on `tar-mode', and signals an error if + ;; called in a buffer with a different mode. + (tar-mode) + (epl-package--parse-info (with-no-warnings + (package-tar-file-info))))))) + +(defun epl-package-from-file (file-name) + "Parse the package at FILE-NAME. + +Return an `epl-package' object with the meta data of the package +at FILE-NAME." + (if (string-match-p (rx ".tar" string-end) file-name) + (epl-package-from-tar-file file-name) + (epl-package-from-lisp-file file-name))) + +(defun epl-package--parse-descriptor-requirement (requirement) + "Parse a REQUIREMENT in a package descriptor." + ;; This function is only called on legacy package.el. On package-desc + ;; package.el, we just let package.el do the work. + (cl-destructuring-bind (name version-string) requirement + (list name (version-to-list version-string)))) + +(defun epl-package-from-descriptor-file (descriptor-file) + "Load a `epl-package' from a package DESCRIPTOR-FILE. + +A package descriptor is a file defining a new package. Its name +typically ends with -pkg.el." + (with-temp-buffer + (insert-file-contents descriptor-file) + (goto-char (point-min)) + (let ((sexp (read (current-buffer)))) + (unless (eq (car sexp) 'define-package) + (error "%S is no valid package descriptor" descriptor-file)) + (if (and (fboundp 'package-desc-from-define) + (fboundp 'package-desc-name)) + ;; In Emacs snapshot, we can conveniently call a function to parse the + ;; descriptor + (let ((desc (apply #'package-desc-from-define (cdr sexp)))) + (epl-package-create :name (package-desc-name desc) + :description desc)) + ;; In legacy package.el, we must manually deconstruct the descriptor, + ;; because the load function has eval's the descriptor and has a lot of + ;; global side-effects. + (cl-destructuring-bind + (name version-string summary requirements) (cdr sexp) + (epl-package-create + :name (intern name) + :description + (vector (version-to-list version-string) + (mapcar #'epl-package--parse-descriptor-requirement + ;; Strip the leading `quote' from the package list + (cadr requirements)) + summary))))))) + + +;;; Package database access +(defun epl-package-installed-p (package) + "Determine whether a PACKAGE is installed. + +PACKAGE is either a package name as symbol, or a package object." + (let ((name (if (epl-package-p package) + (epl-package-name package) + package)) + (version (when (epl-package-p package) + (epl-package-version package)))) + (package-installed-p name version))) + +(defun epl--parse-package-list-entry (entry) + "Parse a list of packages from ENTRY. + +ENTRY is a single entry in a package list, e.g. `package-alist', +`package-archive-contents', etc. Typically it is a cons cell, +but the exact format varies between package.el versions. This +function tries to parse all known variants. + +Return a list of `epl-package' objects parsed from ENTRY." + (let ((descriptions (cdr entry))) + (cond + ((listp descriptions) + (sort (mapcar #'epl-package--from-package-desc descriptions) + #'epl-package-->=)) + ;; Legacy package.el has just a single package in an entry, which is a + ;; standard description vector + ((vectorp descriptions) + (list (epl-package-create :name (car entry) + :description descriptions))) + (:else (error "Cannot parse entry %S" entry))))) + +(defun epl-installed-packages () + "Get all installed packages. + +Return a list of package objects." + (apply #'append (mapcar #'epl--parse-package-list-entry package-alist))) + +(defun epl--find-package-in-list (name list) + "Find a package by NAME in a package LIST. + +Return a list of corresponding `epl-package' objects." + (let ((entry (assq name list))) + (when entry + (epl--parse-package-list-entry entry)))) + +(defun epl-find-installed-package (name) + "Find an installed package by NAME. + +NAME is a package name, as symbol. + +Return the installed package as `epl-package' object, or nil, if +no package with NAME is installed." + ;; FIXME: We must return *all* installed packages here + (car (epl--find-package-in-list name package-alist))) + +(defun epl-available-packages () + "Get all packages available for installed. + +Return a list of package objects." + (apply #'append (mapcar #'epl--parse-package-list-entry + package-archive-contents))) + +(defun epl-find-available-packages (name) + "Find available packages for NAME. + +NAME is a package name, as symbol. + +Return a list of available packages for NAME, sorted by version +number in descending order. Return nil, if there are no packages +for NAME." + (epl--find-package-in-list name package-archive-contents)) + +(cl-defstruct (epl-upgrade + (:constructor epl-upgrade-create)) + "Structure describing an upgradable package. +Slots: + +`installed' The installed package + +`available' The package available for installation." + installed + available) + +(defun epl-find-upgrades (&optional packages) + "Find all upgradable PACKAGES. + +PACKAGES is a list of package objects to upgrade, defaulting to +all installed packages. + +Return a list of `epl-upgrade' objects describing all upgradable +packages." + (let ((packages (or packages (epl-installed-packages))) + upgrades) + (dolist (pkg packages) + (let* ((version (epl-package-version pkg)) + (name (epl-package-name pkg)) + ;; Find the latest available package for NAME + (available-pkg (car (epl-find-available-packages name))) + (available-version (when available-pkg + (epl-package-version available-pkg)))) + (when (and available-version (version-list-< version available-version)) + (push (epl-upgrade-create :installed pkg + :available available-pkg) + upgrades)))) + (nreverse upgrades))) + +(defalias 'epl-built-in-p 'package-built-in-p) + + +;;; Package operations + +(defalias 'epl-install-file 'package-install-file) + +(defun epl-package-install (package &optional force) + "Install a PACKAGE. + +PACKAGE is a `epl-package' object. If FORCE is given and +non-nil, install PACKAGE, even if it is already installed." + (when (or force (not (epl-package-installed-p package))) + (if (epl-package--package-desc-p package) + (package-install (epl-package-description package)) + ;; The legacy API installs by name. We have no control over versioning, + ;; etc. + (package-install (epl-package-name package))))) + +(defun epl-package-delete (package) + "Delete a PACKAGE. + +PACKAGE is a `epl-package' object to delete." + ;; package-delete allows for packages being trashed instead of fully deleted. + ;; Let's prevent his silly behavior + (let ((delete-by-moving-to-trash nil)) + ;; The byte compiler will warn us that we are calling `package-delete' with + ;; the wrong number of arguments, since it can't infer that we guarantee to + ;; always call the correct version. Thus we suppress all warnings when + ;; calling `package-delete'. I wish there was a more granular way to + ;; disable just that specific warning, but it is what it is. + (if (epl-package--package-desc-p package) + (with-no-warnings + (package-delete (epl-package-description package))) + ;; The legacy API deletes by name (as string!) and version instead by + ;; descriptor. Hence `package-delete' takes two arguments. For some + ;; insane reason, the arguments are strings here! + (let ((name (symbol-name (epl-package-name package))) + (version (epl-package-version-string package))) + (with-no-warnings + (package-delete name version)) + ;; Legacy package.el does not remove the deleted package + ;; from the `package-alist', so we do it manually here. + (let ((pkg (assq (epl-package-name package) package-alist))) + (when pkg + (setq package-alist (delq pkg package-alist)))))))) + +(defun epl-upgrade (&optional packages preserve-obsolete) + "Upgrade PACKAGES. + +PACKAGES is a list of package objects to upgrade, defaulting to +all installed packages. + +The old versions of the updated packages are deleted, unless +PRESERVE-OBSOLETE is non-nil. + +Return a list of all performed upgrades, as a list of +`epl-upgrade' objects." + (let ((upgrades (epl-find-upgrades packages))) + (dolist (upgrade upgrades) + (epl-package-install (epl-upgrade-available upgrade) 'force) + (unless preserve-obsolete + (epl-package-delete (epl-upgrade-installed upgrade)))) + upgrades)) + +(provide 'epl) + +;;; epl.el ends here diff --git a/elpa/epl-20140620.218/epl.elc b/elpa/epl-20140620.218/epl.elc new file mode 100644 index 000000000..b14cb2e28 Binary files /dev/null and b/elpa/epl-20140620.218/epl.elc differ diff --git a/elpa/find-file-in-project-20140603.1619/find-file-in-project-autoloads.el b/elpa/find-file-in-project-20140603.1619/find-file-in-project-autoloads.el new file mode 100644 index 000000000..ecf5361bb --- /dev/null +++ b/elpa/find-file-in-project-20140603.1619/find-file-in-project-autoloads.el @@ -0,0 +1,47 @@ +;;; find-file-in-project-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (find-file-in-project) "find-file-in-project" "find-file-in-project.el" +;;;;;; (21478 16685 0 0)) +;;; Generated autoloads from find-file-in-project.el + +(autoload 'find-file-in-project "find-file-in-project" "\ +Prompt with a completing list of all files in the project to find one. + +The project's scope is defined as the first directory containing +an `.emacs-project' file. You can override this by locally +setting the variable `ffip-project-root'. + +\(fn)" t nil) + +(defalias 'ffip 'find-file-in-project) + +(put 'ffip-patterns 'safe-local-variable 'listp) + +(put 'ffip-find-options 'safe-local-variable 'stringp) + +(put 'ffip-project-file 'safe-local-variable 'stringp) + +(put 'ffip-project-root 'safe-local-variable 'stringp) + +(put 'ffip-project-root-function 'safe-local-variable 'functionp) + +(put 'ffip-limit 'safe-local-variable 'integerp) + +;;;*** + +;;;### (autoloads nil nil ("find-file-in-project-pkg.el") (21478 +;;;;;; 16685 397729 0)) + +;;;*** + +(provide 'find-file-in-project-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; find-file-in-project-autoloads.el ends here diff --git a/elpa/find-file-in-project-20140603.1619/find-file-in-project-pkg.el b/elpa/find-file-in-project-20140603.1619/find-file-in-project-pkg.el new file mode 100644 index 000000000..2156193ed --- /dev/null +++ b/elpa/find-file-in-project-20140603.1619/find-file-in-project-pkg.el @@ -0,0 +1 @@ +(define-package "find-file-in-project" "20140603.1619" "Find files in a project quickly." (quote nil)) diff --git a/elpa/find-file-in-project-20140603.1619/find-file-in-project-pkg.elc b/elpa/find-file-in-project-20140603.1619/find-file-in-project-pkg.elc new file mode 100644 index 000000000..508e94e31 Binary files /dev/null and b/elpa/find-file-in-project-20140603.1619/find-file-in-project-pkg.elc differ diff --git a/elpa/find-file-in-project-20140603.1619/find-file-in-project.el b/elpa/find-file-in-project-20140603.1619/find-file-in-project.el new file mode 100644 index 000000000..757b13c72 --- /dev/null +++ b/elpa/find-file-in-project-20140603.1619/find-file-in-project.el @@ -0,0 +1,184 @@ +;;; find-file-in-project.el --- Find files in a project quickly. + +;; Copyright (C) 2006-2009, 2011-2012 +;; Phil Hagelberg, Doug Alcorn, and Will Farrington + +;; Author: Phil Hagelberg, Doug Alcorn, and Will Farrington +;; URL: http://www.emacswiki.org/cgi-bin/wiki/FindFileInProject +;; Git: git://github.com/technomancy/find-file-in-project.git +;; Version: 20140603.1619 +;; X-Original-Version: 3.3 +;; Created: 2008-03-18 +;; Keywords: project, convenience +;; EmacsWiki: FindFileInProject + +;; This file is NOT part of GNU Emacs. + +;;; License: + +;; 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, 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; This library provides a couple methods for quickly finding any file +;; in a given project. It depends on GNU find. + +;; A project is found by searching up the directory tree until a file +;; is found that matches `ffip-project-file'. (".git" by default.) +;; You can set `ffip-project-root-function' to provide an alternate +;; function to search for the project root. By default, it looks only +;; for files whose names match `ffip-patterns', + +;; If you have so many files that it becomes unwieldy, you can set +;; `ffip-find-options' to a string which will be passed to the `find' +;; invocation in order to exclude irrelevant subdirectories. For +;; instance, in a Ruby on Rails project, you may be interested in all +;; .rb files that don't exist in the "vendor" directory. In that case +;; you could set `ffip-find-options' to "-not -regex \".*vendor.*\"". + +;; All these variables may be overridden on a per-directory basis in +;; your .dir-locals.el. See (info "(Emacs) Directory Variables") for +;; details. + +;; Recommended binding: (global-set-key (kbd "C-x f") 'find-file-in-project) + +;;; TODO: + +;; Add compatibility with BSD find (PDI; I can't virtualize OS X) + +;;; Code: + +(require 'cl) + +(defvar ffip-project-file ".git" + "The file that should be used to define a project root. + +May be set using .dir-locals.el. Checks each entry if set to a list.") + +(defvar ffip-patterns + '("*.html" "*.org" "*.txt" "*.md" "*.el" "*.clj" "*.py" "*.rb" "*.js" "*.pl" + "*.sh" "*.erl" "*.hs" "*.ml") + "List of patterns to look for with `find-file-in-project'.") + +(defvar ffip-prune-patterns + '(".git") + "List of directory patterns to not decend into when listing files in `find-file-in-project'.") + +(defvar ffip-find-options "" + "Extra options to pass to `find' when using `find-file-in-project'. + +Use this to exclude portions of your project: \"-not -regex \\\".*svn.*\\\"\".") + +(defvar ffip-project-root nil + "If non-nil, overrides the project root directory location.") + +(defvar ffip-project-root-function nil + "If non-nil, this function is called to determine the project root. + +This overrides variable `ffip-project-root' when set.") + +(defvar ffip-limit 512 + "Limit results to this many files.") + +(defvar ffip-full-paths nil + "If non-nil, show fully project-relative paths.") + +(defun ffip-project-root () + "Return the root of the project." + (let ((project-root (or ffip-project-root + (if (functionp ffip-project-root-function) + (funcall ffip-project-root-function) + (if (listp ffip-project-file) + (some (apply-partially 'locate-dominating-file + default-directory) + ffip-project-file) + (locate-dominating-file default-directory + ffip-project-file)))))) + (or project-root + (progn (message "No project was defined for the current file.") + nil)))) + +(defun ffip-uniqueify (file-cons) + "Set the car of FILE-CONS to include the directory name plus the file name." + (setcar file-cons + (concat (cadr (reverse (split-string (cdr file-cons) "/"))) "/" + (car file-cons)))) + +(defun ffip-join-patterns () + "Turn `ffip-patterns' into a string that `find' can use." + (mapconcat (lambda (pat) (format "-name \"%s\"" pat)) + ffip-patterns " -or ")) + +(defun ffip-prune-patterns () + "Turn `ffip-prune-patterns' into a string that `find' can use." + (mapconcat (lambda (pat) (format "-name \"%s\"" pat)) + ffip-prune-patterns " -or ")) + + +(defun ffip-project-files () + "Return an alist of all filenames in the project and their path. + +Files with duplicate filenames are suffixed with the name of the +directory they are found in so that they are unique." + (let ((file-alist nil) + (root (expand-file-name (or ffip-project-root (ffip-project-root) + (error "No project root found"))))) + (mapcar (lambda (file) + (if ffip-full-paths + (cons (substring (expand-file-name file) (length root)) + (expand-file-name file)) + (let ((file-cons (cons (file-name-nondirectory file) + (expand-file-name file)))) + (when (assoc (car file-cons) file-alist) + (ffip-uniqueify (assoc (car file-cons) file-alist)) + (ffip-uniqueify file-cons)) + (add-to-list 'file-alist file-cons) + file-cons))) + (split-string (shell-command-to-string + (format "find %s -type d -a \\( %s \\) -prune -o -type f \\( %s \\) -print %s | head -n %s" + root (ffip-prune-patterns) (ffip-join-patterns) + ffip-find-options ffip-limit)))))) + +;;;###autoload +(defun find-file-in-project () + "Prompt with a completing list of all files in the project to find one. + +The project's scope is defined as the first directory containing +an `.emacs-project' file. You can override this by locally +setting the variable `ffip-project-root'." + (interactive) + (let* ((project-files (ffip-project-files)) + (files (mapcar 'car project-files)) + (file (if (and (boundp 'ido-mode) ido-mode) + (ido-completing-read "Find file in project: " files) + (completing-read "Find file in project: " files)))) + (find-file (cdr (assoc file project-files))))) + +;;;###autoload +(defalias 'ffip 'find-file-in-project) + +;; safe locals +;;;###autoload +(progn + (put 'ffip-patterns 'safe-local-variable 'listp) + (put 'ffip-find-options 'safe-local-variable 'stringp) + (put 'ffip-project-file 'safe-local-variable 'stringp) + (put 'ffip-project-root 'safe-local-variable 'stringp) + (put 'ffip-project-root-function 'safe-local-variable 'functionp) + (put 'ffip-limit 'safe-local-variable 'integerp)) + +(provide 'find-file-in-project) +;;; find-file-in-project.el ends here diff --git a/elpa/find-file-in-project-20140603.1619/find-file-in-project.elc b/elpa/find-file-in-project-20140603.1619/find-file-in-project.elc new file mode 100644 index 000000000..eb1e9bfdc Binary files /dev/null and b/elpa/find-file-in-project-20140603.1619/find-file-in-project.elc differ diff --git a/elpa/git-commit-mode-20140605.520/git-commit-mode-autoloads.el b/elpa/git-commit-mode-20140605.520/git-commit-mode-autoloads.el new file mode 100644 index 000000000..ef100ad46 --- /dev/null +++ b/elpa/git-commit-mode-20140605.520/git-commit-mode-autoloads.el @@ -0,0 +1,35 @@ +;;; git-commit-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (git-commit-mode) "git-commit-mode" "git-commit-mode.el" +;;;;;; (21478 16665 0 0)) +;;; Generated autoloads from git-commit-mode.el + +(autoload 'git-commit-mode "git-commit-mode" "\ +Major mode for editing git commit messages. + +This mode helps with editing git commit messages both by +providing commands to do common tasks, and by highlighting the +basic structure of and errors in git commit messages. + +\(fn)" t nil) + +(dolist (pattern '("/COMMIT_EDITMSG\\'" "/NOTES_EDITMSG\\'" "/MERGE_MSG\\'" "/TAG_EDITMSG\\'" "/PULLREQ_EDITMSG\\'")) (add-to-list 'auto-mode-alist (cons pattern 'git-commit-mode))) + +;;;*** + +;;;### (autoloads nil nil ("git-commit-mode-pkg.el") (21478 16665 +;;;;;; 755550 0)) + +;;;*** + +(provide 'git-commit-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; git-commit-mode-autoloads.el ends here diff --git a/elpa/git-commit-mode-20140605.520/git-commit-mode-pkg.el b/elpa/git-commit-mode-20140605.520/git-commit-mode-pkg.el new file mode 100644 index 000000000..329a1c371 --- /dev/null +++ b/elpa/git-commit-mode-20140605.520/git-commit-mode-pkg.el @@ -0,0 +1 @@ +(define-package "git-commit-mode" "20140605.520" "Major mode for editing git commit messages" (quote nil)) diff --git a/elpa/git-commit-mode-20140605.520/git-commit-mode-pkg.elc b/elpa/git-commit-mode-20140605.520/git-commit-mode-pkg.elc new file mode 100644 index 000000000..3a0207e70 Binary files /dev/null and b/elpa/git-commit-mode-20140605.520/git-commit-mode-pkg.elc differ diff --git a/elpa/git-commit-mode-20140605.520/git-commit-mode.el b/elpa/git-commit-mode-20140605.520/git-commit-mode.el new file mode 100644 index 000000000..f08c28eb2 --- /dev/null +++ b/elpa/git-commit-mode-20140605.520/git-commit-mode.el @@ -0,0 +1,662 @@ +;;; git-commit-mode.el --- Major mode for editing git commit messages -*- lexical-binding: t; -*- +;; Version: 20140605.520 + +;; Copyright (c) 2010-2012 Florian Ragwitz +;; Copyright (c) 2012-2013 Sebastian Wiesner +;; Copyright (C) 2010-2014 The Magit Project Developers + +;; Authors: Jonas Bernoulli +;; Sebastian Wiesner +;; Florian Ragwitz +;; Maintainer: Jonas Bernoulli +;; Homepage: https://github.com/magit/git-modes +;; Keywords: convenience vc git + +;; This file is not part of GNU Emacs. + +;; This file 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, or (at your option) +;; any later version. + +;; This file 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 file. If not, see . + +;;; Commentary: + +;; A major mode for editing Git commit messages. + +;;;; Formatting + +;; Highlight the formatting of git commit messages and indicate errors according +;; to the guidelines for commit messages (see +;; http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). +;; +;; Highlight the first line (aka "summary") specially if it exceeds 50 +;; characters (configurable using `git-commit-summary-max-length'). +;; +;; Enable `auto-fill-mode' and set the `fill-column' to 72 according to the +;; aforementioned guidelines (configurable using `git-commit-fill-column'). + +;;;; Headers + +;; Provide commands to insert standard headers into commit messages. +;; +;; - C-c C-s inserts Signed-off-by (`git-commit-signoff'). +;; - C-C C-a inserts Acked-by (`git-commit-ack'). +;; - C-c C-t inserts Tested-by (`git-commit-test'). +;; - C-c C-r inserts Reviewed-by (`git-commit-review'). +;; - C-c C-o inserts Cc (`git-commit-cc'). +;; - C-c C-p inserts Reported-by (`git-commit-reported'). + +;;;; Committing + +;; C-c C-c finishes a commit. +;; +;; Check a buffer for stylistic errors before committing, and ask for +;; confirmation before committing with style errors. + +;;; Code: + +(require 'log-edit) +(require 'ring) +(require 'server) + +;;; Options +;;;; Variables + +(defgroup git-commit nil + "Edit Git commit messages." + :prefix "git-commit-" + :group 'tools) + +(defcustom git-commit-confirm-commit nil + "Whether to ask for confirmation before committing. + +If t, ask for confirmation before creating a commit with style +errors, unless the commit is forced. If nil, never ask for +confirmation before committing." + :group 'git-commit + :type '(choice (const :tag "On style errors" t) + (const :tag "Never" nil))) + +(defcustom git-commit-mode-hook '(turn-on-auto-fill flyspell-mode) + "Hook run when entering Git Commit mode." + :options '(turn-on-auto-fill flyspell-mode git-commit-save-message) + :type 'hook + :group 'git-commit) + +(defcustom git-commit-kill-buffer-hook '(git-commit-save-message) + "Hook run when killing a Git Commit mode buffer. +This hook is run by both `git-commit-commit' +and `git-commit-abort'." + :options '(git-commit-save-message) + :type 'hook + :group 'git-commit) + +(defcustom git-commit-summary-max-length 50 + "Fontify characters beyond this column in summary lines as errors." + :group 'git-commit + :type 'number) + +(defcustom git-commit-fill-column 72 + "Automatically wrap commit message lines beyond this column." + :group 'git-commit + :type 'number) + +(defcustom git-commit-known-pseudo-headers + '("Signed-off-by" "Acked-by" "Cc" + "Suggested-by" "Reported-by" "Tested-by" "Reviewed-by") + "A list of git pseudo headers to be highlighted." + :group 'git-commit + :type '(repeat string)) + +;;;; Faces + +(defgroup git-commit-faces nil + "Faces for highlighting Git commit messages." + :prefix "git-commit-" + :group 'git-commit + :group 'faces) + +(defface git-commit-summary-face + '((t :inherit font-lock-type-face)) + "Face used to highlight the summary in git commit messages" + :group 'git-commit-faces) + +(defface git-commit-overlong-summary-face + '((t :inherit font-lock-warning-face)) + "Face used to highlight overlong parts of git commit message summaries" + :group 'git-commit-faces) + +(defface git-commit-nonempty-second-line-face + '((t :inherit font-lock-warning-face)) + "Face used to highlight text on the second line of git commit messages" + :group 'git-commit-faces) + +(defface git-commit-note-face + '((t :inherit font-lock-string-face)) + "Face used to highlight notes in git commit messages" + :group 'git-commit-faces) + +(defface git-commit-pseudo-header-face + '((t :inherit font-lock-string-face)) + "Font used to hightlight pseudo headers in git commit messages" + :group 'git-commit-faces) + +(defface git-commit-known-pseudo-header-face + '((t :inherit font-lock-keyword-face)) + "Face used to hightlight common pseudo headers in git commit messages" + :group 'git-commit-faces) + +(defface git-commit-branch-face + '((t :inherit font-lock-variable-name-face)) + "Face used to highlight the branch name in comments in git commit messages" + :group 'git-commit-faces) + +(defface git-commit-no-branch-face + '((t :inherit git-commit-branch-face)) + "Face used when a commit is going to be made outside of any branches" + :group 'git-commit-faces) + +(defface git-commit-comment-heading-face + '((t :inherit git-commit-known-pseudo-header-face)) + "Face used to highlight section headings in the default +comments in git commit messages" + :group 'git-commit-faces) + +(defface git-commit-comment-file-face + '((t :inherit git-commit-pseudo-header-face)) + "Face used to highlight file names in the default comments in +git commit messages" + :group 'git-commit-faces) + +(defface git-commit-comment-action-face + '((t :inherit git-commit-branch-face)) + "Face used to highlight what has happened to files in the +default comments in git commit messages" + :group 'git-commit-faces) + +;;; Keymap + +(defvar git-commit-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-c") 'git-commit-commit) + (define-key map (kbd "C-c C-k") 'git-commit-abort) + (define-key map (kbd "C-c C-s") 'git-commit-signoff) + (define-key map (kbd "C-c C-a") 'git-commit-ack) + (define-key map (kbd "C-c C-t") 'git-commit-test) + (define-key map (kbd "C-c C-r") 'git-commit-review) + (define-key map (kbd "C-c C-o") 'git-commit-cc) + (define-key map (kbd "C-c C-p") 'git-commit-reported) + (define-key map (kbd "C-c C-i") 'git-commit-suggested) + (define-key map (kbd "C-c M-s") 'git-commit-save-message) + (define-key map (kbd "M-p") 'git-commit-prev-message) + (define-key map (kbd "M-n") 'git-commit-next-message) + (define-key map [remap server-edit] 'git-commit-commit) + (define-key map [remap kill-buffer] 'git-commit-abort) + (define-key map [remap ido-kill-buffer] 'git-commit-abort) + (define-key map [remap iswitchb-kill-buffer] 'git-commit-abort) + ;; Old bindings to avoid confusion + (define-key map (kbd "C-c C-x s") 'git-commit-signoff) + (define-key map (kbd "C-c C-x a") 'git-commit-ack) + (define-key map (kbd "C-c C-x t") 'git-commit-test) + (define-key map (kbd "C-c C-x r") 'git-commit-review) + (define-key map (kbd "C-c C-x o") 'git-commit-cc) + (define-key map (kbd "C-c C-x p") 'git-commit-reported) + map) + "Key map used by `git-commit-mode'.") + +;;; Menu + +(require 'easymenu) +(easy-menu-define git-commit-mode-menu git-commit-mode-map + "Git Commit Mode Menu" + '("Commit" + ["Previous" git-commit-prev-message t] + ["Next" git-commit-next-message t] + "-" + ["Ack" git-commit-ack :active t + :help "Insert an 'Acked-by' header"] + ["Sign-Off" git-commit-signoff :active t + :help "Insert a 'Signed-off-by' header"] + ["Tested-by" git-commit-test :active t + :help "Insert a 'Tested-by' header"] + ["Reviewed-by" git-commit-review :active t + :help "Insert a 'Reviewed-by' header"] + ["CC" git-commit-cc t + :help "Insert a 'Cc' header"] + ["Reported" git-commit-reported :active t + :help "Insert a 'Reported-by' header"] + ["Suggested" git-commit-suggested t + :help "Insert a 'Suggested-by' header"] + "-" + ["Save" git-commit-save-message t] + ["Cancel" git-commit-abort t] + ["Commit" git-commit-commit t])) + +;;; Committing + +(defvar git-commit-commit-hook nil + "Hook run by `git-commit-commit' unless clients exist. +Only use this if you know what you are doing.") + +(defvar git-commit-previous-winconf nil) + +(defmacro git-commit-restore-previous-winconf (&rest body) + "Run BODY and then restore `git-commit-previous-winconf'. +When `git-commit-previous-winconf' is nil or was created from +another frame do nothing." + (declare (indent 0)) + (let ((winconf (make-symbol "winconf")) + (frame (make-symbol "frame"))) + `(let ((,winconf git-commit-previous-winconf) + (,frame (selected-frame))) + ,@body + (when (and ,winconf + (equal ,frame (window-configuration-frame ,winconf))) + (set-window-configuration ,winconf) + (setq git-commit-previous-winconf nil))))) + +(defun git-commit-commit (&optional force) + "Finish editing the commit message and commit. + +Check for stylistic errors in the current commit, and ask the +user for confirmation depending on `git-commit-confirm-commit'. +If FORCE is non-nil or if a raw prefix arg is given, commit +immediately without asking. + +Return t, if the commit was successful, or nil otherwise." + (interactive "P") + (if (and git-commit-confirm-commit + (git-commit-has-style-errors-p) + (not force) + (not (y-or-n-p "Commit despite stylistic errors?"))) + (message "Commit canceled due to stylistic errors.") + (save-buffer) + (run-hooks 'git-commit-kill-buffer-hook) + (remove-hook 'kill-buffer-query-functions + 'git-commit-kill-buffer-noop t) + (git-commit-restore-previous-winconf + (if (git-commit-buffer-clients) + (server-edit) + (run-hook-with-args 'git-commit-commit-hook) + (kill-buffer))))) + +(defun git-commit-abort () + "Abort the commit. +The commit message is saved to the kill ring." + (interactive) + (when (< emacs-major-version 24) + ;; Emacsclient doesn't exit with non-zero when -error is used. + ;; Instead cause Git to error out by feeding it an empty file. + (erase-buffer)) + (save-buffer) + (run-hooks 'git-commit-kill-buffer-hook) + (remove-hook 'kill-buffer-hook 'server-kill-buffer t) + (remove-hook 'kill-buffer-query-functions 'git-commit-kill-buffer-noop t) + (git-commit-restore-previous-winconf + (let ((buffer (current-buffer)) + (clients (git-commit-buffer-clients))) + (if clients + (progn + (dolist (client clients) + (ignore-errors + (server-send-string client "-error Commit aborted by user")) + (delete-process client)) + (when (buffer-live-p buffer) + (kill-buffer buffer))) + (kill-buffer)))) + (accept-process-output nil 0.1) + (message (concat "Commit aborted." + (when (memq 'git-commit-save-message + git-commit-kill-buffer-hook) + " Message saved to `log-edit-comment-ring'.")))) + +(defun git-commit-buffer-clients () + (and (fboundp 'server-edit) + (boundp 'server-buffer-clients) + server-buffer-clients)) + +;;; History + +(defun git-commit-save-message () + "Save current message to `log-edit-comment-ring'." + (interactive) + (let ((message (buffer-substring + (point-min) + (git-commit-find-pseudo-header-position)))) + (when (and (string-match "^\\s-*\\sw" message) + (or (ring-empty-p log-edit-comment-ring) + (not (ring-member log-edit-comment-ring message)))) + ;; if index is nil, we end up cycling back to message we just saved! + (unless log-edit-comment-ring-index + (setq log-edit-comment-ring-index 0)) + (ring-insert log-edit-comment-ring message)))) + +(defun git-commit-prev-message (arg) + "Cycle backward through message history, after saving current message. +With a numeric prefix ARG, go back ARG comments." + (interactive "*p") + (git-commit-save-message) + (save-restriction + (narrow-to-region (point-min) (git-commit-find-pseudo-header-position)) + (log-edit-previous-comment arg))) + +(defun git-commit-next-message (arg) + "Cycle forward through message history, after saving current message. +With a numeric prefix ARG, go forward ARG comments." + (interactive "*p") + (git-commit-prev-message (- arg))) + +;;; Headers + +(defun git-commit-find-pseudo-header-position () + "Find the position at which commit pseudo headers should be inserted. + +Those headers usually live at the end of a commit message, but +before any trailing comments git or the user might have +inserted." + (save-excursion + (goto-char (point-max)) + (if (re-search-backward "^[^#\n]" nil t) + ;; we found last non-empty non-comment line, headers go after + (forward-line 1) + ;; there's only blanks & comments, headers go before comments + (goto-char (point-min)) + (and (re-search-forward "^#" nil t) (forward-line 0))) + (skip-chars-forward "\n") + (point))) + +(defun git-commit-determine-pre-for-pseudo-header () + "Find the characters to insert before the pseudo header. +Returns either zero, one or two newlines after computation. + +`point' either points to an empty line (with a non-empty previous +line) or the end of a non-empty line." + (let ((pre "") + (prev-line nil)) + (if (not (eq (point) (point-at-bol))) + (progn + (setq pre (concat pre "\n")) + (setq prev-line (thing-at-point 'line))) + ;; else: (point) is at an empty line + (when (not (eq (point) (point-min))) + (setq prev-line + (save-excursion + (forward-line -1) + (thing-at-point 'line))))) + + ;; we have prev-line now; if it doesn't match any known pseudo + ;; header, add a newline + (when prev-line + (if (not (delq nil (mapcar (lambda (pseudo-header) + (string-match pseudo-header prev-line)) + git-commit-known-pseudo-headers))) + (setq pre (concat pre "\n")))) + pre)) + +(defun git-commit-insert-header (type name email) + "Insert a header into the commit message. +The inserted header has the format 'TYPE: NAME '. + +The header is inserted at the position returned by +`git-commit-find-pseudo-header-position'. When this position +isn't after an existing header or a newline, an extra newline is +inserted before the header." + (let ((header-at (git-commit-find-pseudo-header-position))) + (save-excursion + (goto-char header-at) + (let ((pre (git-commit-determine-pre-for-pseudo-header))) + (insert (format "%s%s: %s <%s>\n" pre type name email)))))) + +(defun git-commit-insert-header-as-self (type) + "Insert a header with the name and email of the current user. +The inserted header has the format 'TYPE: NAME '. +Also see `git-commit-insert-header'." + (git-commit-insert-header + type + (or (getenv "GIT_AUTHOR_NAME") + (getenv "GIT_COMMITTER_NAME") + (ignore-errors (car (process-lines "git" "config" "user.name"))) + user-full-name) + (or (getenv "GIT_AUTHOR_EMAIL") + (getenv "GIT_COMMITTER_EMAIL") + (getenv "EMAIL") + (ignore-errors (car (process-lines "git" "config" "user.email"))) + user-mail-address))) + +(defmacro git-define-git-commit-self (action header) + "Create function git-commit-ACTION. +ACTION will be part of the function name. +HEADER is the actual header to be inserted into the comment." + (let ((func-name (intern (concat "git-commit-" action)))) + `(defun ,func-name () + ,(format "Insert a '%s' header at the end of the commit message. + +The author name and email address used for the header are +retrieved automatically with the same mechanism git uses." + header) + (interactive) + (git-commit-insert-header-as-self ,header)))) + +(git-define-git-commit-self "ack" "Acked-by") +(git-define-git-commit-self "review" "Reviewed-by") +(git-define-git-commit-self "signoff" "Signed-off-by") +(git-define-git-commit-self "test" "Tested-by") + +(defmacro git-define-git-commit (action header) + "Create interactive function git-commit-ACTION. +ACTION will be part of the function name. +HEADER is the actual header to be inserted into the comment." + (let ((func-name (intern (concat "git-commit-" action)))) + `(defun ,func-name (name email) + ,(format "Insert a '%s' header at the end of the commit message. +The value of the header is determined by NAME and EMAIL. + +When called interactively, both NAME and EMAIL are read from the +minibuffer." + header) + (interactive + (list (read-string "Name: ") + (read-string "Email: "))) + (git-commit-insert-header ,header name email)))) + +(git-define-git-commit "cc" "Cc") +(git-define-git-commit "reported" "Reported-by") +(git-define-git-commit "suggested" "Suggested-by") + +(defconst git-commit-comment-headings-alist + '(("Not currently on any branch." . git-commit-no-branch-face) + ("Changes to be committed:" . git-commit-comment-heading-face) + ("Untracked files:" . git-commit-comment-heading-face) + ("Changed but not updated:" . git-commit-comment-heading-face) + ("Changes not staged for commit:" . git-commit-comment-heading-face) + ("Unmerged paths:" . git-commit-comment-heading-face)) + "Headings in message comments. + +The `car' of each cell is the heading text, the `cdr' the face to +use for fontification.") + +(defun git-commit-summary-regexp () + (concat + ;; Skip empty lines or comments before the summary + "\\`\\(?:^\\(?:\\s-*\\|\\s<.*\\)\n\\)*" + ;; The summary line + (format "\\(.\\{0,%d\\}\\)\\(.*\\)" git-commit-summary-max-length) + ;; Non-empty non-comment second line + ;; + ;; For instant highlighting of non-empty second lines in font-lock, + ;; the last capturing group must capture the empty string ("") in + ;; "summary line\n". + ;; That's why the simpler regex "\\(?:\n\\([^\n#].*\\)\\)?", + ;; which captures 'nil', can't be used. + "\\(?:\n\\#\\|\n\\(.*\\)\\)?")) + +(defun git-commit-has-style-errors-p () + "Check whether the current buffer has style errors. + +Return t, if the current buffer has style errors, or nil +otherwise." + (save-excursion + (goto-char (point-min)) + (when (re-search-forward (git-commit-summary-regexp) nil t) + (or (string-match-p ".+" (or (match-string 2) "")) + (string-match-p "^.+$" (or (match-string 3) "")))))) + +;;; Font-Lock + +(defun git-commit-mode-summary-font-lock-keywords (&optional errors) + "Create font lock keywords to fontify the Git summary. + +If ERRORS is non-nil create keywords that highlight errors in the +summary line, not the summary line itself." + (if errors + `(,(git-commit-summary-regexp) + (2 'git-commit-overlong-summary-face t t) + (3 'git-commit-nonempty-second-line-face t t)) + `(,(git-commit-summary-regexp) + (1 'git-commit-summary-face t)))) + +(defun git-commit-mode-heading-keywords () + "Create font lock keywords to fontify comment headings. + +Known comment headings are provided by `git-commit-comment-headings'." + (mapcar (lambda (cell) `(,(format "^\\s<\\s-+\\(%s\\)$" + (regexp-quote (car cell))) + (1 ',(cdr cell) t))) + git-commit-comment-headings-alist)) + +(defun git-commit-mode-font-lock-keywords () + (append + `(("^\\s<.*$" . 'font-lock-comment-face) + ("^\\s<\\s-On branch \\(.*\\)$" (1 'git-commit-branch-face t)) + ("^\\s<\t\\(?:\\([^:]+\\):\\s-+\\)?\\(.*\\)$" + (1 'git-commit-comment-action-face t t) + (2 'git-commit-comment-file-face t)) + (,(concat "^\\(" + (regexp-opt git-commit-known-pseudo-headers) + ":\\)\\(\s.*\\)$") + (1 'git-commit-known-pseudo-header-face) + (2 'git-commit-pseudo-header-face)) + ("^\\<\\S-+:\\s-.*$" . 'git-commit-pseudo-header-face) + (eval . (git-commit-mode-summary-font-lock-keywords)) + ("\\[[^\n]+?\\]" (0 'git-commit-note-face t)) ; Notes override summary line + ;; Warnings from overlong lines and nonempty second line override + ;; everything + (eval . (git-commit-mode-summary-font-lock-keywords t))) + (git-commit-mode-heading-keywords))) + +(defun git-commit-font-lock-diff () + "Add font lock on diff." + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^diff --git" nil t) + (let ((beg (match-beginning 0))) + (let* ((buffer (current-buffer)) + (font-lock-verbose nil) + (font-lock-support-mode nil) + (text (with-temp-buffer + (insert + (with-current-buffer buffer + (buffer-substring-no-properties beg (point-max)))) + (diff-mode) + (font-lock-fontify-buffer) + (let ((pos (point-min)) + next) + (while (setq next (next-single-property-change pos 'face)) + (put-text-property pos next 'font-lock-face + (get-text-property pos 'face)) + (setq pos next))) + (buffer-string)))) + (delete-region beg (point-max)) + (insert text)))))) + +;;; Mode + +(defvar git-commit-mode-syntax-table + (let ((table (make-syntax-table text-mode-syntax-table))) + (modify-syntax-entry ?# "<" table) + (modify-syntax-entry ?\n ">" table) + (modify-syntax-entry ?\r ">" table) + table) + "Syntax table used by `git-commit-mode'.") + +;;;###autoload +(define-derived-mode git-commit-mode text-mode "Git Commit" + "Major mode for editing git commit messages. + +This mode helps with editing git commit messages both by +providing commands to do common tasks, and by highlighting the +basic structure of and errors in git commit messages." + ;; Font locking + (setq font-lock-defaults (list (git-commit-mode-font-lock-keywords) t)) + (set (make-local-variable 'font-lock-multiline) t) + (git-commit-font-lock-diff) + ;; Filling according to the guidelines + (setq fill-column git-commit-fill-column) + ;; Recognize changelog-style paragraphs + (set (make-local-variable 'paragraph-start) + (concat paragraph-start "\\|*\\|(")) + ;; Treat lines starting with a hash/pound as comments + (set (make-local-variable 'comment-start) "#") + (set (make-local-variable 'comment-start-skip) + (concat "^" (regexp-quote comment-start) "+" + "\\s-*")) + (set (make-local-variable 'comment-use-syntax) nil) + ;; Do not remember point location in commit messages + (when (boundp 'save-place) + (setq save-place nil)) + ;; If the commit summary is empty, insert a newline after point + (when (string= "" (buffer-substring-no-properties + (line-beginning-position) + (line-end-position))) + (open-line 1)) + ;; Make sure `git-commit-abort' cannot be by-passed + (add-hook 'kill-buffer-query-functions + 'git-commit-kill-buffer-noop nil t) + ;; Make the wrong usage info from `server-execute' go way + (run-with-timer 0.01 nil (lambda (m) (message "%s" m)) + (substitute-command-keys + (concat "Type \\[git-commit-commit] " + (let ((n (buffer-file-name))) + (cond ((equal n "TAG_EDITMSG") "to tag") + ((or (equal n "NOTES_EDITMSG") + (equal n "PULLREQ_EDITMSG")) + "when done") + (t "to commit"))) + " (\\[git-commit-abort] to abort).")))) + +(defun git-commit-kill-buffer-noop () + (message + (substitute-command-keys + "Don't kill this buffer. Instead abort using \\[git-commit-abort].")) + nil) + +(defun git-commit-mode-flyspell-verify () + (not (nth 4 (syntax-ppss)))) ; not inside a comment + +(eval-after-load 'flyspell + '(put 'git-commit-mode 'flyspell-mode-predicate + 'git-commit-mode-flyspell-verify)) + +;;;###autoload +(dolist (pattern '("/COMMIT_EDITMSG\\'" "/NOTES_EDITMSG\\'" + "/MERGE_MSG\\'" "/TAG_EDITMSG\\'" + "/PULLREQ_EDITMSG\\'")) + (add-to-list 'auto-mode-alist (cons pattern 'git-commit-mode))) + +(defun git-commit-auto-mode-enable () + (message "git-commit-auto-mode-enable is obsolete and doesn't do anything")) +(make-obsolete 'git-commit-auto-mode-enable "This mode is a noop now" "") + +(provide 'git-commit-mode) +;; Local Variables: +;; indent-tabs-mode: nil +;; End: +;;; git-commit-mode.el ends here diff --git a/elpa/git-commit-mode-20140605.520/git-commit-mode.elc b/elpa/git-commit-mode-20140605.520/git-commit-mode.elc new file mode 100644 index 000000000..a9fe641f8 Binary files /dev/null and b/elpa/git-commit-mode-20140605.520/git-commit-mode.elc differ diff --git a/elpa/git-rebase-mode-20140605.520/git-rebase-mode-autoloads.el b/elpa/git-rebase-mode-20140605.520/git-rebase-mode-autoloads.el new file mode 100644 index 000000000..62421532f --- /dev/null +++ b/elpa/git-rebase-mode-20140605.520/git-rebase-mode-autoloads.el @@ -0,0 +1,36 @@ +;;; git-rebase-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (git-rebase-mode) "git-rebase-mode" "git-rebase-mode.el" +;;;;;; (21478 16664 0 0)) +;;; Generated autoloads from git-rebase-mode.el + +(autoload 'git-rebase-mode "git-rebase-mode" "\ +Major mode for editing of a Git rebase file. + +Rebase files are generated when you run 'git rebase -i' or run +`magit-interactive-rebase'. They describe how Git should perform +the rebase. See the documentation for git-rebase (e.g., by +running 'man git-rebase' at the command line) for details. + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("/git-rebase-todo\\'" . git-rebase-mode)) + +;;;*** + +;;;### (autoloads nil nil ("git-rebase-mode-pkg.el") (21478 16664 +;;;;;; 210710 0)) + +;;;*** + +(provide 'git-rebase-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; git-rebase-mode-autoloads.el ends here diff --git a/elpa/git-rebase-mode-20140605.520/git-rebase-mode-pkg.el b/elpa/git-rebase-mode-20140605.520/git-rebase-mode-pkg.el new file mode 100644 index 000000000..5a2ebcbc2 --- /dev/null +++ b/elpa/git-rebase-mode-20140605.520/git-rebase-mode-pkg.el @@ -0,0 +1 @@ +(define-package "git-rebase-mode" "20140605.520" "Major mode for editing git rebase files" (quote nil)) diff --git a/elpa/git-rebase-mode-20140605.520/git-rebase-mode-pkg.elc b/elpa/git-rebase-mode-20140605.520/git-rebase-mode-pkg.elc new file mode 100644 index 000000000..d8c8a2260 Binary files /dev/null and b/elpa/git-rebase-mode-20140605.520/git-rebase-mode-pkg.elc differ diff --git a/elpa/git-rebase-mode-20140605.520/git-rebase-mode.el b/elpa/git-rebase-mode-20140605.520/git-rebase-mode.el new file mode 100644 index 000000000..ae4d78bdd --- /dev/null +++ b/elpa/git-rebase-mode-20140605.520/git-rebase-mode.el @@ -0,0 +1,378 @@ +;;; git-rebase-mode.el --- Major mode for editing git rebase files +;; Version: 20140605.520 + +;; Copyright (C) 2010-2014 The Magit Project Developers + +;; Author: Phil Jackson +;; Maintainer: Jonas Bernoulli +;; Homepage: https://github.com/magit/git-modes +;; Keywords: convenience vc git + +;; This file is not part of GNU Emacs. + +;; This file 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, or (at your option) +;; any later version. + +;; This file 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 file. If not, see . + +;;; Commentary: + +;; Allows the editing of a git rebase file (which you might get when +;; using 'git rebase -i' or hitting 'E' in Magit). Assumes editing is +;; happening in a server. + +;;; Code: + +(require 'easymenu) +(require 'server) +(require 'thingatpt) + +;;; Options +;;;; Variables + +(defgroup git-rebase nil + "Edit Git rebase sequences." + :group 'tools) + +(defcustom git-rebase-auto-advance nil + "If non-nil, moves point forward a line after running an action." + :group 'git-rebase + :type 'boolean) + +(defcustom git-rebase-remove-instructions nil + "Whether to remove the instructions from the rebase buffer. +Because you have seen them before and can still remember." + :group 'git-rebase + :type 'boolean) + +;;;; Faces + +(defgroup git-rebase-faces nil + "Faces used by Git-Rebase mode." + :group 'faces + :group 'git-rebase) + +(defface git-rebase-hash + '((((class color) (background light)) + :foreground "firebrick") + (((class color) (background dark)) + :foreground "tomato")) + "Face for commit hashes." + :group 'git-rebase-faces) + +(defface git-rebase-description nil + "Face for commit descriptions." + :group 'git-rebase-faces) + +(defface git-rebase-killed-action + '((((class color)) + :inherit font-lock-comment-face + :strike-through t)) + "Face for commented action and exec lines." + :group 'git-rebase-faces) + +(define-obsolete-face-alias 'git-rebase-description-face + 'git-rebase-description "1.0.0") +(define-obsolete-face-alias 'git-rebase-killed-action-face + 'git-rebase-killed-action "1.0.0") + +;;; Regexps + +(defconst git-rebase-action-line-re + (concat "^#?" + "\\([efprs]\\|pick\\|reword\\|edit\\|squash\\|fixup\\) " + "\\([a-z0-9]\\{4,40\\}\\) " + "\\(.*\\)") + "Regexp matching action lines in rebase buffers.") + +(defconst git-rebase-exec-line-re + "^#?\\(x\\|exec\\)[[:space:]]\\(.*\\)" + "Regexp matching exec lines in rebase buffer.") + +(defconst git-rebase-dead-line-re + (format "^#\\(?:%s\\|%s\\)" + (substring git-rebase-action-line-re 1) + (substring git-rebase-exec-line-re 1)) + "Regexp matching commented action and exex lines in rebase buffers.") + +;;; Keymaps + +(defvar git-rebase-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map special-mode-map) + (define-key map (kbd "q") 'git-rebase-server-edit) + (define-key map (kbd "C-c C-c") 'git-rebase-server-edit) + (define-key map (kbd "a") 'git-rebase-abort) + (define-key map (kbd "C-c C-k") 'git-rebase-abort) + (define-key map [remap undo] 'git-rebase-undo) + (define-key map (kbd "RET") 'git-rebase-show-commit) + (define-key map (kbd "x") 'git-rebase-exec) + (define-key map (kbd "c") 'git-rebase-pick) + (define-key map (kbd "r") 'git-rebase-reword) + (define-key map (kbd "e") 'git-rebase-edit) + (define-key map (kbd "s") 'git-rebase-squash) + (define-key map (kbd "f") 'git-rebase-fixup) + (define-key map (kbd "k") 'git-rebase-kill-line) + (define-key map (kbd "C-k") 'git-rebase-kill-line) + (define-key map (kbd "p") 'git-rebase-backward-line) + (define-key map (kbd "n") 'forward-line) + (define-key map (kbd "M-p") 'git-rebase-move-line-up) + (define-key map (kbd "M-n") 'git-rebase-move-line-down) + (define-key map (kbd "M-") 'git-rebase-move-line-up) + (define-key map (kbd "M-") 'git-rebase-move-line-down) + map) + "Keymap for Git-Rebase mode.") + +(easy-menu-define git-rebase-mode-menu git-rebase-mode-map + "Git-Rebase mode menu" + '("Rebase" + ["Pick" git-rebase-pick t] + ["Reword" git-rebase-reword t] + ["Edit" git-rebase-edit t] + ["Squash" git-rebase-squash t] + ["Fixup" git-rebase-fixup t] + ["Kill" git-rebase-kill-line t] + ["Move Down" git-rebase-move-line-down t] + ["Move Up" git-rebase-move-line-up t] + ["Execute" git-rebase-exec t] + "---" + ["Abort" git-rebase-abort t] + ["Done" git-rebase-server-edit t])) + +;;; Utilities + +(defun git-rebase-edit-line (change-to) + (when (git-rebase-looking-at-action) + (let ((buffer-read-only nil) + (start (point))) + (goto-char (point-at-bol)) + (delete-region (point) (progn (forward-word 1) (point))) + (insert change-to) + (goto-char start) + (when git-rebase-auto-advance + (forward-line))))) + +(defmacro git-rebase-define-action (sym) + (declare (indent defun)) + (let ((fn (intern (format "git-rebase-%s" sym)))) + `(progn + (defun ,fn () + (interactive) + (git-rebase-edit-line ,(symbol-name sym))) + (put ',fn 'definition-name ',sym)))) + +(defun git-rebase-looking-at-action () + "Return non-nil if looking at an action line." + (save-excursion + (goto-char (point-at-bol)) + (looking-at git-rebase-action-line-re))) + +(defun git-rebase-looking-at-action-or-exec () + "Return non-nil if looking at an action line or exec line." + (save-excursion + (goto-char (point-at-bol)) + (or (looking-at git-rebase-action-line-re) + (looking-at git-rebase-exec-line-re)))) + +(defun git-rebase-looking-at-exec () + "Return non-nil if cursor is on an exec line." + (string-match git-rebase-exec-line-re (thing-at-point 'line))) + +(defun git-rebase-looking-at-killed-exec () + "Return non-nil if looking at an exec line that has been commented out." + (let ((line (thing-at-point 'line))) + (and (eq (aref line 0) ?#) + (string-match git-rebase-exec-line-re line)))) + +;;; Commands + +(git-rebase-define-action pick) +(git-rebase-define-action reword) +(git-rebase-define-action edit) +(git-rebase-define-action squash) +(git-rebase-define-action fixup) + +(defun git-rebase-move-line-up () + "Move the current action line up." + (interactive) + (when (git-rebase-looking-at-action-or-exec) + (let ((buffer-read-only nil) + (col (current-column))) + (goto-char (point-at-bol)) + (unless (bobp) + (transpose-lines 1) + (forward-line -2)) + (move-to-column col)))) + +(defun git-rebase-move-line-down () + "Assuming the next line is also an action line, move the current line down." + (interactive) + ;; if we're on an action and the next line is also an action + (when (and (git-rebase-looking-at-action-or-exec) + (save-excursion + (forward-line) + (git-rebase-looking-at-action-or-exec))) + (let ((buffer-read-only nil) + (col (current-column))) + (forward-line 1) + (transpose-lines 1) + (forward-line -1) + (move-to-column col)))) + +(defun git-rebase-server-edit () + "Save the action buffer and end the session." + (interactive) + (save-buffer) + (server-edit)) + +(defun git-rebase-abort () + "Abort this rebase. +This is dune by emptying the buffer, saving and closing server +connection." + (interactive) + (when (or (not (buffer-modified-p)) + (y-or-n-p "Abort this rebase? ")) + (let ((buffer-read-only nil)) + (erase-buffer) + (save-buffer) + (server-edit)))) + +(defun git-rebase-kill-line () + "Kill the current action line." + (interactive) + (when (and (not (eq (char-after (point-at-bol)) ?#)) + (git-rebase-looking-at-action-or-exec)) + (beginning-of-line) + (let ((inhibit-read-only t)) + (insert "#")) + (forward-line))) + +(defun git-rebase-exec (edit) + "Prompt the user for a shell command to be executed, and +add it to the todo list. + +If the cursor is on a commented-out exec line, uncomment the +current line instead of prompting. + +When the prefix argument EDIT is non-nil and the cursor is on an +exec line, edit that line instead of inserting a new one. If the +exec line was commented out, also uncomment it." + (interactive "P") + (cond + ((and edit (git-rebase-looking-at-exec)) + (let ((new-line (git-rebase-read-exec-line + (match-string-no-properties 2 (thing-at-point 'line)))) + (inhibit-read-only t)) + (delete-region (point-at-bol) (point-at-eol)) + (if (not (equal "" new-line)) + (insert "exec " new-line) + (delete-char -1) + (forward-line)) + (move-beginning-of-line nil))) + ((git-rebase-looking-at-killed-exec) + (save-excursion + (beginning-of-line) + (let ((buffer-read-only nil)) + (delete-char 1)))) + (t + (let ((inhibit-read-only t) + (line (git-rebase-read-exec-line))) + (unless (equal "" line) + (move-end-of-line nil) + (newline) + (insert (concat "exec " line)))) + (move-beginning-of-line nil)))) + +(defun git-rebase-read-exec-line (&optional initial-line) + (read-shell-command "Execute: " initial-line)) + +(defun git-rebase-undo (&optional arg) + "A thin wrapper around `undo', which allows undoing in read-only buffers." + (interactive "P") + (let ((inhibit-read-only t)) + (undo arg))) + +(defun git-rebase-show-commit (&optional arg) + "Show the commit on the current line if any." + (interactive "P") + (save-excursion + (goto-char (point-at-bol)) + (when (looking-at git-rebase-action-line-re) + (let ((commit (match-string 2))) + (if (fboundp 'magit-show-commit) + (let ((default-directory (expand-file-name "../../"))) + (magit-show-commit commit)) + (shell-command (concat "git show " commit))))))) + +(defun git-rebase-backward-line (&optional n) + "Move N lines backward (forward if N is negative). +Like `forward-line' but go into the opposite direction." + (interactive "p") + (forward-line (* n -1))) + +;;; Mode + +;;;###autoload +(define-derived-mode git-rebase-mode special-mode "Git Rebase" + "Major mode for editing of a Git rebase file. + +Rebase files are generated when you run 'git rebase -i' or run +`magit-interactive-rebase'. They describe how Git should perform +the rebase. See the documentation for git-rebase (e.g., by +running 'man git-rebase' at the command line) for details." + (setq font-lock-defaults '(git-rebase-mode-font-lock-keywords t t)) + (when git-rebase-remove-instructions + (let ((inhibit-read-only t)) + (flush-lines "^\\($\\|#\\)")))) + +(defvar git-rebase-mode-font-lock-keywords + `((,git-rebase-action-line-re + (1 font-lock-keyword-face) + (2 'git-rebase-hash) + (3 'git-rebase-description)) + (,git-rebase-exec-line-re 1 font-lock-keyword-face) + ("^#.*" 0 font-lock-comment-face) + (,git-rebase-dead-line-re 0 'git-rebase-killed-action t)) + "Font lock keywords for Git-Rebase mode.") + +(defun git-rebase-mode-show-keybindings () + "Modify the \"Commands:\" section of the comment Git generates +at the bottom of the file so that in place of the one-letter +abbreviation for the command, it shows the command's keybinding. +By default, this is the same except for the \"pick\" command." + (save-excursion + (goto-char (point-min)) + (while (search-forward-regexp "^# \\(.\\), \\([[:alpha:]]+\\) = " nil t) + (let ((start (match-beginning 1)) + (end (match-end 1)) + (command (intern (concat "git-rebase-" (match-string 2))))) + (when (fboundp command) + (let ((overlay (make-overlay start end))) + (overlay-put + overlay 'display + (key-description (where-is-internal command nil t))))))))) + +(add-hook 'git-rebase-mode-hook 'git-rebase-mode-show-keybindings t) + +(defun git-rebase-mode-disable-before-save-hook () + (set (make-local-variable 'before-save-hook) nil)) + +(add-hook 'git-rebase-mode-hook 'git-rebase-mode-disable-before-save-hook) + +;;;###autoload +(add-to-list 'auto-mode-alist + '("/git-rebase-todo\\'" . git-rebase-mode)) + +(provide 'git-rebase-mode) +;; Local Variables: +;; indent-tabs-mode: nil +;; End: +;;; git-rebase-mode.el ends here diff --git a/elpa/git-rebase-mode-20140605.520/git-rebase-mode.elc b/elpa/git-rebase-mode-20140605.520/git-rebase-mode.elc new file mode 100644 index 000000000..256a63e47 Binary files /dev/null and b/elpa/git-rebase-mode-20140605.520/git-rebase-mode.elc differ diff --git a/elpa/helm-20140808.2300/emacs-helm.sh b/elpa/helm-20140808.2300/emacs-helm.sh new file mode 100755 index 000000000..3bfc6d662 --- /dev/null +++ b/elpa/helm-20140808.2300/emacs-helm.sh @@ -0,0 +1,78 @@ +#!/bin/bash + + +## Copyright (C) 2012 Thierry Volpiatto +## +## 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 . + +## Commentary: + +# Preconfigured Emacs with a basic helm configuration. +# Useful to start quickly an emacs -Q with helm. +# Run it from this directory. + +TMP="/tmp/helm-cfg.el" +LOADPATH=$(readlink -f $0 | xargs dirname) +EMACS=emacs + +case $1 in + -P) + shift 1 + declare EMACS=$1 + shift 1 + ;; + -h) + echo "Usage: ${0##*/} [-P} Emacs path [-h} help [--] EMACS ARGS" + exit 2 + ;; +esac + +cat > $TMP <\`helm-find-files'\n\ +;; - \`occur'(M-s o) =>\`helm-occur'\n\ +;; - \`list-buffers'(C-x C-b) =>\`helm-buffers-list'\n\ +;; - \`completion-at-point'(M-tab) =>\`helm-lisp-completion-at-point'[1]\n\ +;; - \`dabbrev-expand'(M-/) =>\`helm-dabbrev'\n\n\ +;; Some others native emacs commands are \"helmized\" by \`helm-mode'.\n\ +;; [1] Coming with emacs-24.4 \`completion-at-point' is \"helmized\" by \`helm-mode'\n\ +;; which provide helm completion in many other places like \`shell-mode'.\n\ +;; You will find embeded help for most helm commands with \`C-c ?'.\n\ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n")) + +(setq default-frame-alist '((vertical-scroll-bars . nil) + (tool-bar-lines . 0) + (menu-bar-lines . 0) + (fullscreen . nil))) +(blink-cursor-mode -1) +(add-to-list 'load-path (expand-file-name "$LOADPATH")) +(require 'helm-config) +(helm-mode 1) +(define-key global-map [remap find-file] 'helm-find-files) +(define-key global-map [remap occur] 'helm-occur) +(define-key global-map [remap list-buffers] 'helm-buffers-list) +(define-key global-map [remap dabbrev-expand] 'helm-dabbrev) +(unless (boundp 'completion-in-region-function) + (define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point) + (define-key emacs-lisp-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)) +(add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "$TMP") (delete-file "$TMP")))) +EOF + +$EMACS -Q -l $TMP $@ diff --git a/elpa/helm-20140808.2300/helm-adaptive.el b/elpa/helm-20140808.2300/helm-adaptive.el new file mode 100644 index 000000000..053247483 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-adaptive.el @@ -0,0 +1,243 @@ +;;; helm-adaptive.el --- Adaptive Sorting of Candidates. -*- lexical-binding: t -*- + +;; Original Author: Tamas Patrovics + +;; Copyright (C) 2007 Tamas Patrovics +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) + + +(defgroup helm-adapt nil + "Adaptative sorting of candidates for Helm." + :group 'helm) + +(defcustom helm-adaptive-history-file + "~/.emacs.d/helm-adaptive-history" + "Path of file where history information is stored." + :type 'string + :group 'helm-adapt) + +(defcustom helm-adaptive-history-length 50 + "Maximum number of candidates stored for a source." + :type 'number + :group 'helm-adapt) + + +;; Internal +(defvar helm-adaptive-done nil + "nil if history information is not yet stored for the current +selection.") + +(defvar helm-adaptive-history nil + "Contains the stored history information. +Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) ...)") + +(defun helm-adaptive-done-reset () + (setq helm-adaptive-done nil)) + +(define-minor-mode helm-adaptive-mode + "Toggle adaptive sorting in all sources." + :group 'helm-adapt + :require 'helm-adaptive + :global t + (if helm-adaptive-mode + (progn + (unless helm-adaptive-history + (helm-adaptive-maybe-load-history)) + (add-hook 'kill-emacs-hook 'helm-adaptive-save-history) + ;; Should run at beginning of `helm-initial-setup'. + (add-hook 'helm-before-initialize-hook 'helm-adaptive-done-reset) + ;; Should run at beginning of `helm-exit-minibuffer'. + (add-hook 'helm-before-action-hook 'helm-adaptive-store-selection) + ;; Should run at beginning of `helm-select-action'. + (add-hook 'helm-select-action-hook 'helm-adaptive-store-selection)) + (helm-adaptive-save-history) + (setq helm-adaptive-history nil) + (remove-hook 'kill-emacs-hook 'helm-adaptive-save-history) + (remove-hook 'helm-before-initialize-hook 'helm-adaptive-done-reset) + (remove-hook 'helm-before-action-hook 'helm-adaptive-store-selection) + (remove-hook 'helm-select-action-hook 'helm-adaptive-store-selection))) + +(defun helm-adapt-use-adaptive-p (&optional source-name) + "Return current source only if it use adaptive history, nil otherwise." + (when helm-adaptive-mode + (let* ((source (or source-name (helm-get-current-source))) + (adapt-source (or (assoc-default 'filtered-candidate-transformer + (assoc (assoc-default 'type source) + helm-type-attributes)) + (assoc-default 'candidate-transformer + (assoc (assoc-default 'type source) + helm-type-attributes)) + (assoc-default 'filtered-candidate-transformer source) + (assoc-default 'candidate-transformer source)))) + (if (listp adapt-source) + (and (member 'helm-adaptive-sort adapt-source) source) + (and (eq adapt-source 'helm-adaptive-sort) source))))) + +(defun helm-adaptive-store-selection () + "Store history information for the selected candidate." + (unless helm-adaptive-done + (setq helm-adaptive-done t) + (let ((source (helm-adapt-use-adaptive-p))) + (when source + (let* ((source-name (or (assoc-default 'type source) + (assoc-default 'name source))) + (source-info (or (assoc source-name helm-adaptive-history) + (progn + (push (list source-name) helm-adaptive-history) + (car helm-adaptive-history)))) + (selection (helm-get-selection)) + (selection-info (progn + (setcdr source-info + (cons + (let ((found (assoc selection (cdr source-info)))) + (if (not found) + ;; new entry + (list selection) + ;; move entry to the beginning of the + ;; list, so that it doesn't get + ;; trimmed when the history is + ;; truncated + (setcdr source-info + (delete found (cdr source-info))) + found)) + (cdr source-info))) + (cadr source-info))) + (pattern-info (progn + (setcdr selection-info + (cons + (let ((found (assoc helm-pattern (cdr selection-info)))) + (if (not found) + ;; new entry + (cons helm-pattern 0) + + ;; move entry to the beginning of the + ;; list, so if two patterns used the + ;; same number of times then the one + ;; used last appears first in the list + (setcdr selection-info + (delete found (cdr selection-info))) + found)) + (cdr selection-info))) + (cadr selection-info)))) + + ;; increase usage count + (setcdr pattern-info (1+ (cdr pattern-info))) + + ;; truncate history if needed + (if (> (length (cdr selection-info)) helm-adaptive-history-length) + (setcdr selection-info + (cl-subseq (cdr selection-info) 0 helm-adaptive-history-length)))))))) + +(defun helm-adaptive-maybe-load-history () + "Load `helm-adaptive-history-file' which contain `helm-adaptive-history'. +Returns nil if `helm-adaptive-history-file' doesn't exist." + (when (file-readable-p helm-adaptive-history-file) + (load-file helm-adaptive-history-file))) + +(defun helm-adaptive-save-history (&optional arg) + "Save history information to file given by `helm-adaptive-history-file'." + (interactive "p") + (with-temp-buffer + (insert + ";; -*- mode: emacs-lisp -*-\n" + ";; History entries used for helm adaptive display.\n") + (prin1 `(setq helm-adaptive-history ',helm-adaptive-history) + (current-buffer)) + (insert ?\n) + (write-region (point-min) (point-max) helm-adaptive-history-file nil + (unless arg 'quiet)))) + +(defun helm-adaptive-sort (candidates source) + "Sort the CANDIDATES for SOURCE by usage frequency. +This is a filtered candidate transformer you can use with the +`filtered-candidate-transformer' attribute." + (let* ((source-name (or (assoc-default 'type source) + (assoc-default 'name source))) + (source-info (assoc source-name helm-adaptive-history))) + (if source-info + (let ((usage + ;; ... assemble a list containing the (CANIDATE . USAGE-COUNT) + ;; pairs + (mapcar (lambda (candidate-info) + (let ((count 0)) + (cl-dolist (pattern-info (cdr candidate-info)) + (if (not (equal (car pattern-info) + helm-pattern)) + (cl-incf count (cdr pattern-info)) + + ;; if current pattern is equal to the previously + ;; used one then this candidate has priority + ;; (that's why its count is boosted by 10000) and + ;; it only has to compete with other candidates + ;; which were also selected with the same pattern + (setq count (+ 10000 (cdr pattern-info))) + (cl-return))) + (cons (car candidate-info) count))) + (cdr source-info)))) + (if (and usage (consp usage)) + ;; sort the list in descending order, so candidates with highest + ;; priorty come first + (progn + (setq usage (sort usage (lambda (first second) + (> (cdr first) (cdr second))))) + + ;; put those candidates first which have the highest usage count + (cl-loop for (info . _freq) in usage + for member = (cl-member info candidates + :test 'helm-adaptive-compare) + when member collect (car member) into sorted + and do + (setq candidates (cl-remove info candidates + :test 'helm-adaptive-compare)) + finally return (append sorted candidates))) + (message "Your `%s' is maybe corrupted or too old, \ +you should reinitialize it with `helm-reset-adaptive-history'" + helm-adaptive-history-file) + (sit-for 1) + candidates)) + ;; if there is no information stored for this source then do nothing + candidates))) + +;;;###autoload +(defun helm-reset-adaptive-history () + "Delete all `helm-adaptive-history' and his file. +Useful when you have a old or corrupted `helm-adaptive-history-file'." + (interactive) + (when (y-or-n-p "Really delete all your `helm-adaptive-history'? ") + (setq helm-adaptive-history nil) + (delete-file helm-adaptive-history-file))) + +(defun helm-adaptive-compare (x y) + "Compare candidates X and Y taking into account that the +candidate can be in (DISPLAY . REAL) format." + (equal (if (listp x) (cdr x) x) + (if (listp y) (cdr y) y))) + + +(provide 'helm-adaptive) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-adaptive.el ends here diff --git a/elpa/helm-20140808.2300/helm-adaptive.elc b/elpa/helm-20140808.2300/helm-adaptive.elc new file mode 100644 index 000000000..a5dbb1c62 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-adaptive.elc differ diff --git a/elpa/helm-20140808.2300/helm-aliases.el b/elpa/helm-20140808.2300/helm-aliases.el new file mode 100644 index 000000000..f43eb0353 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-aliases.el @@ -0,0 +1,921 @@ +;;; helm-aliases.el --- Helm aliases for helm obsoletes functions. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) + + +;;; Helper functions to create aliases with old helm definitions +;; prefixed with "helm-c-" +;; +(defun helm-alias-p (sym) + (cond ((boundp sym) + (not (eq (indirect-variable sym) sym))) + ((fboundp sym) + (symbolp (symbol-function sym))) + (t nil))) + +(defun helm-check-conflicting-prefixes () + (cl-loop for s in (all-completions "helm-c-" obarray) + for rep = (replace-regexp-in-string "helm-c-" "helm-" s) + when (or (and (not (helm-alias-p (intern s))) (fboundp (intern rep))) + (and (not (helm-alias-p (intern s))) (boundp (intern rep)))) + collect rep)) + +(defun helm-collect-functions-with-bad-prefix () + (cl-loop for s in (all-completions "helm-c-" obarray) + for sym = (intern s) + when (and (not (helm-alias-p sym)) (fboundp sym)) + collect s)) + +(defun helm-collect-vars-with-bad-prefix () + (cl-loop for s in (all-completions "helm-c-" obarray) + for sym = (intern s) + when (and (not (helm-alias-p sym)) (boundp sym)) + collect s)) + +(defun helm-insert-fn-aliases () + (cl-loop for s in (helm-collect-functions-with-bad-prefix) + for rep = (replace-regexp-in-string "helm-c-" "helm-" s) + do (insert (format "(defalias '%s '%s)\n(make-obsolete '%s '%s \"1.5.1\")\n" s rep s rep)))) + +(defun helm-insert-var-aliases () + (cl-loop for s in (helm-collect-vars-with-bad-prefix) + for rep = (replace-regexp-in-string "helm-c-" "helm-" s) + do (insert (format "(defvaralias '%s '%s)\n(make-obsolete-variable '%s '%s \"1.5.1\")\n" s rep s rep)))) + + +;;; Alias old functions prefixed with "helm-c-" +;; +;; +(defalias 'helm-c-etags-default-action 'helm-etags-default-action) +(make-obsolete 'helm-c-etags-default-action 'helm-etags-default-action "1.5.1") +(defalias 'helm-c-simple-call-tree-candidates 'helm-simple-call-tree-candidates) +(make-obsolete 'helm-c-simple-call-tree-candidates 'helm-simple-call-tree-candidates "1.5.1") +(defalias 'helm-c-show-info-in-mode-line 'helm-show-info-in-mode-line) +(make-obsolete 'helm-c-show-info-in-mode-line 'helm-show-info-in-mode-line "1.5.1") +(defalias 'helm-c-gentoo-eshell-action 'helm-gentoo-eshell-action) +(make-obsolete 'helm-c-gentoo-eshell-action 'helm-gentoo-eshell-action "1.5.1") +(defalias 'helm-c-grep-highlight-match 'helm-grep-highlight-match) +(make-obsolete 'helm-c-grep-highlight-match 'helm-grep-highlight-match "1.5.1") +(defalias 'helm-c-apropos 'helm-apropos) +(make-obsolete 'helm-c-apropos 'helm-apropos "1.5.1") +(defalias 'helm-c-grep-guess-extensions 'helm-grep-guess-extensions) +(make-obsolete 'helm-c-grep-guess-extensions 'helm-grep-guess-extensions "1.5.1") +(defalias 'helm-c-highlight-w3m-bookmarks 'helm-highlight-w3m-bookmarks) +(make-obsolete 'helm-c-highlight-w3m-bookmarks 'helm-highlight-w3m-bookmarks "1.5.1") +(defalias 'helm-c-emms-files-modifier 'helm-emms-files-modifier) +(make-obsolete 'helm-c-emms-files-modifier 'helm-emms-files-modifier "1.5.1") +(defalias 'helm-c-apt-reinstall 'helm-apt-reinstall) +(make-obsolete 'helm-c-apt-reinstall 'helm-apt-reinstall "1.5.1") +(defalias 'helm-c-bbdb-compose-mail 'helm-bbdb-compose-mail) +(make-obsolete 'helm-c-bbdb-compose-mail 'helm-bbdb-compose-mail "1.5.1") +(defalias 'helm-c-gentoo-init-list 'helm-gentoo-init-list) +(make-obsolete 'helm-c-gentoo-init-list 'helm-gentoo-init-list "1.5.1") +(defalias 'helm-c-gentoo-get-world 'helm-gentoo-get-world) +(make-obsolete 'helm-c-gentoo-get-world 'helm-gentoo-get-world "1.5.1") +(defalias 'helm-c-reset-adaptive-history 'helm-reset-adaptive-history) +(make-obsolete 'helm-c-reset-adaptive-history 'helm-reset-adaptive-history "1.5.1") +(defalias 'helm-adaptative-mode 'helm-adaptive-mode) +(make-obsolete 'helm-adaptative-mode 'helm-adaptive-mode "1.6.2") +(defalias 'helm-c-highlight-bookmark 'helm-highlight-bookmark) +(make-obsolete 'helm-c-highlight-bookmark 'helm-highlight-bookmark "1.5.1") +(defalias 'helm-c-locate-init 'helm-locate-init) +(make-obsolete 'helm-c-locate-init 'helm-locate-init "1.5.1") +(defalias 'helm-c-delete-file 'helm-delete-file) +(make-obsolete 'helm-c-delete-file 'helm-delete-file "1.5.1") +(defalias 'helm-c-regexp-persistent-action 'helm-regexp-persistent-action) +(make-obsolete 'helm-c-regexp-persistent-action 'helm-regexp-persistent-action "1.5.1") +(defalias 'helm-c-grep-split-line 'helm-grep-split-line) +(make-obsolete 'helm-c-grep-split-line 'helm-grep-split-line "1.5.1") +(defalias 'helm-c-filtered-candidate-transformer-file-line-1 'helm-filtered-candidate-transformer-file-line-1) +(make-obsolete 'helm-c-filtered-candidate-transformer-file-line-1 'helm-filtered-candidate-transformer-file-line-1 "1.5.1") +(defalias 'helm-c-info-display-to-real 'helm-info-display-to-real) +(make-obsolete 'helm-c-info-display-to-real 'helm-info-display-to-real "1.5.1") +(defalias 'helm-c-symbolify 'helm-symbolify) +(make-obsolete 'helm-c-symbolify 'helm-symbolify "1.5.1") +(defalias 'helm-c-zgrep-buffers 'helm-zgrep-buffers) +(make-obsolete 'helm-c-zgrep-buffers 'helm-zgrep-buffers "1.5.1") +(defalias 'helm-c-apt-persistent-action 'helm-apt-persistent-action) +(make-obsolete 'helm-c-apt-persistent-action 'helm-apt-persistent-action "1.5.1") +(defalias 'helm-c-pdfgrep-init 'helm-pdfgrep-init) +(make-obsolete 'helm-c-pdfgrep-init 'helm-pdfgrep-init "1.5.1") +(defalias 'helm-c-walk-directory 'helm-walk-directory) +(make-obsolete 'helm-c-walk-directory 'helm-walk-directory "1.5.1") +(defalias 'helm-c-grep-init 'helm-grep-init) +(make-obsolete 'helm-c-grep-init 'helm-grep-init "1.5.1") +(defalias 'helm-c-ucs-forward-char 'helm-ucs-forward-char) +(make-obsolete 'helm-c-ucs-forward-char 'helm-ucs-forward-char "1.5.1") +(defalias 'helm-c-complete-file-name-at-point 'helm-complete-file-name-at-point) +(make-obsolete 'helm-c-complete-file-name-at-point 'helm-complete-file-name-at-point "1.5.1") +(defalias 'helm-c-timer-real-to-display 'helm-timer-real-to-display) +(make-obsolete 'helm-c-timer-real-to-display 'helm-timer-real-to-display "1.5.1") +(defalias 'helm-c-ucs-init 'helm-ucs-init) +(make-obsolete 'helm-c-ucs-init 'helm-ucs-init "1.5.1") +(defalias 'helm-c-bookmark-run-delete 'helm-bookmark-run-delete) +(make-obsolete 'helm-c-bookmark-run-delete 'helm-bookmark-run-delete "1.5.1") +(defalias 'helm-c-uniq-list 'helm-uniq-list) +(make-obsolete 'helm-c-uniq-list 'helm-uniq-list "1.5.1") +(defalias 'helm-c-pp-bookmarks 'helm-pp-bookmarks) +(make-obsolete 'helm-c-pp-bookmarks 'helm-pp-bookmarks "1.5.1") +(defalias 'helm-c-gentoo-get-url 'helm-gentoo-get-url) +(make-obsolete 'helm-c-gentoo-get-url 'helm-gentoo-get-url "1.5.1") +(defalias 'helm-c-top-sh-persistent-action 'helm-top-sh-persistent-action) +(make-obsolete 'helm-c-top-sh-persistent-action 'helm-top-sh-persistent-action "1.5.1") +(defalias 'helm-c-gentoo-get-use 'helm-gentoo-get-use) +(make-obsolete 'helm-c-gentoo-get-use 'helm-gentoo-get-use "1.5.1") +(defalias 'helm-c-grep-action 'helm-grep-action) +(make-obsolete 'helm-c-grep-action 'helm-grep-action "1.5.1") +(defalias 'helm-c-file-buffers 'helm-file-buffers) +(make-obsolete 'helm-c-file-buffers 'helm-file-buffers "1.5.1") +(defalias 'helm-c-google-suggest-fetch 'helm-google-suggest-fetch) +(make-obsolete 'helm-c-google-suggest-fetch 'helm-google-suggest-fetch "1.5.1") +(defalias 'helm-c-arrange-type-attribute 'helm-arrange-type-attribute) +(make-obsolete 'helm-c-arrange-type-attribute 'helm-arrange-type-attribute "1.5.1") +(defalias 'helm-c-bookmark-w3m-setup-alist 'helm-bookmark-w3m-setup-alist) +(make-obsolete 'helm-c-bookmark-w3m-setup-alist 'helm-bookmark-w3m-setup-alist "1.5.1") +(defalias 'helm-c-yahoo-suggest-action 'helm-yahoo-suggest-action) +(make-obsolete 'helm-c-yahoo-suggest-action 'helm-yahoo-suggest-action "1.5.1") +(defalias 'helm-c-buffer-query-replace-1 'helm-buffer-query-replace-1) +(make-obsolete 'helm-c-buffer-query-replace-1 'helm-buffer-query-replace-1 "1.5.1") +(defalias 'helm-c-make-info-source 'helm-make-info-source) +(make-obsolete 'helm-c-make-info-source 'helm-make-info-source "1.5.1") +(defalias 'helm-c-open-dired 'helm-open-dired) +(make-obsolete 'helm-c-open-dired 'helm-open-dired "1.5.1") +(defalias 'helm-c-w3m-bookmarks-get-value 'helm-w3m-bookmarks-get-value) +(make-obsolete 'helm-c-w3m-bookmarks-get-value 'helm-w3m-bookmarks-get-value "1.5.1") +(defalias 'helm-c-kill-ring-transformer 'helm-kill-ring-transformer) +(make-obsolete 'helm-c-kill-ring-transformer 'helm-kill-ring-transformer "1.5.1") +(defalias 'helm-c-etags-init 'helm-etags-init) +(make-obsolete 'helm-c-etags-init 'helm-etags-init "1.5.1") +(defalias 'helm-c-w3m-rename-bookmark 'helm-w3m-rename-bookmark) +(make-obsolete 'helm-c-w3m-rename-bookmark 'helm-w3m-rename-bookmark "1.5.1") +(defalias 'helm-c-advice-update-current-display-string 'helm-advice-update-current-display-string) +(make-obsolete 'helm-c-advice-update-current-display-string 'helm-advice-update-current-display-string "1.5.1") +(defalias 'helm-c-regexp-get-line 'helm-regexp-get-line) +(make-obsolete 'helm-c-regexp-get-line 'helm-regexp-get-line "1.5.1") +(defalias 'helm-c-grep-run-other-window-action 'helm-grep-run-other-window-action) +(make-obsolete 'helm-c-grep-run-other-window-action 'helm-grep-run-other-window-action "1.5.1") +(defalias 'helm-c-regexp-kill-new 'helm-regexp-kill-new) +(make-obsolete 'helm-c-regexp-kill-new 'helm-regexp-kill-new "1.5.1") +(defalias 'helm-c-goto-line-with-adjustment 'helm-goto-line-with-adjustment) +(make-obsolete 'helm-c-goto-line-with-adjustment 'helm-goto-line-with-adjustment "1.5.1") +(defalias 'helm-c-grep-run-default-action 'helm-grep-run-default-action) +(make-obsolete 'helm-c-grep-run-default-action 'helm-grep-run-default-action "1.5.1") +(defalias 'helm-c-define-info-index-sources 'helm-define-info-index-sources) +(make-obsolete 'helm-c-define-info-index-sources 'helm-define-info-index-sources "1.5.1") +(defalias 'helm-c-transform-file-browse-url 'helm-transform-file-browse-url) +(make-obsolete 'helm-c-transform-file-browse-url 'helm-transform-file-browse-url "1.5.1") +(defalias 'helm-c-shell-command-if-needed 'helm-shell-command-if-needed) +(make-obsolete 'helm-c-shell-command-if-needed 'helm-shell-command-if-needed "1.5.1") +(defalias 'helm-c-kill-regexp-as-sexp 'helm-kill-regexp-as-sexp) +(make-obsolete 'helm-c-kill-regexp-as-sexp 'helm-kill-regexp-as-sexp "1.5.1") +(defalias 'helm-c-goto-next-or-prec-file 'helm-goto-next-or-prec-file) +(make-obsolete 'helm-c-goto-next-or-prec-file 'helm-goto-next-or-prec-file "1.5.1") +(defalias 'helm-c-simple-call-tree-functions-callers-init 'helm-simple-call-tree-functions-callers-init) +(make-obsolete 'helm-c-simple-call-tree-functions-callers-init 'helm-simple-call-tree-functions-callers-init "1.5.1") +(defalias 'helm-c-insert-file-name-completion-at-point 'helm-insert-file-name-completion-at-point) +(make-obsolete 'helm-c-insert-file-name-completion-at-point 'helm-insert-file-name-completion-at-point "1.5.1") +(defalias 'helm-c-point-file-in-dired 'helm-point-file-in-dired) +(make-obsolete 'helm-c-point-file-in-dired 'helm-point-file-in-dired "1.5.1") +(defalias 'helm-c-action-file-line-goto 'helm-action-file-line-goto) +(make-obsolete 'helm-c-action-file-line-goto 'helm-action-file-line-goto "1.5.1") +(defalias 'helm-c-info-goto 'helm-info-goto) +(make-obsolete 'helm-c-info-goto 'helm-info-goto "1.5.1") +(defalias 'helm-c-apt-install 'helm-apt-install) +(make-obsolete 'helm-c-apt-install 'helm-apt-install "1.5.1") +(defalias 'helm-c-skip-boring-buffers 'helm-skip-boring-buffers) +(make-obsolete 'helm-c-skip-boring-buffers 'helm-skip-boring-buffers "1.5.1") +(defalias 'helm-c-register-candidates 'helm-register-candidates) +(make-obsolete 'helm-c-register-candidates 'helm-register-candidates "1.5.1") +(defalias 'helm-c-find-function 'helm-find-function) +(make-obsolete 'helm-c-find-function 'helm-find-function "1.5.1") +(defalias 'helm-c-simple-call-tree-find-definition 'helm-simple-call-tree-find-definition) +(make-obsolete 'helm-c-simple-call-tree-find-definition 'helm-simple-call-tree-find-definition "1.5.1") +(defalias 'helm-c-apt-display-to-real 'helm-apt-display-to-real) +(make-obsolete 'helm-c-apt-display-to-real 'helm-apt-display-to-real "1.5.1") +(defalias 'helm-c-yaoddmuse-action-transformer 'helm-yaoddmuse-action-transformer) +(make-obsolete 'helm-c-yaoddmuse-action-transformer 'helm-yaoddmuse-action-transformer "1.5.1") +(defalias 'helm-c-org-keywords-init 'helm-org-keywords-init) +(make-obsolete 'helm-c-org-keywords-init 'helm-org-keywords-init "1.5.1") +(defalias 'helm-c-xrandr-screen 'helm-xrandr-screen) +(make-obsolete 'helm-c-xrandr-screen 'helm-xrandr-screen "1.5.1") +(defalias 'helm-c-simple-call-tree-persistent-action 'helm-simple-call-tree-persistent-action) +(make-obsolete 'helm-c-simple-call-tree-persistent-action 'helm-simple-call-tree-persistent-action "1.5.1") +(defalias 'helm-c-position 'helm-position) +(make-obsolete 'helm-c-position 'helm-position "1.5.1") +(defalias 'helm-c-imenu-candidates 'helm-imenu-candidates) +(make-obsolete 'helm-c-imenu-candidates 'helm-imenu-candidates "1.5.1") +(defalias 'helm-c-bbdb-candidates 'helm-bbdb-candidates) +(make-obsolete 'helm-c-bbdb-candidates 'helm-bbdb-candidates "1.5.1") +(defalias 'helm-c-ucs-persistent-forward 'helm-ucs-persistent-forward) +(make-obsolete 'helm-c-ucs-persistent-forward 'helm-ucs-persistent-forward "1.5.1") +(defalias 'helm-c-basename 'helm-basename) +(make-obsolete 'helm-c-basename 'helm-basename "1.5.1") +(defalias 'helm-c-files-in-all-dired-candidates 'helm-files-in-all-dired-candidates) +(make-obsolete 'helm-c-files-in-all-dired-candidates 'helm-files-in-all-dired-candidates "1.5.1") +(defalias 'helm-c-action-line-goto 'helm-action-line-goto) +(make-obsolete 'helm-c-action-line-goto 'helm-action-line-goto "1.5.1") +(defalias 'helm-c-grep-other-window 'helm-grep-other-window) +(make-obsolete 'helm-c-grep-other-window 'helm-grep-other-window "1.5.1") +(defalias 'helm-c-yahoo-suggest-fetch 'helm-yahoo-suggest-fetch) +(make-obsolete 'helm-c-yahoo-suggest-fetch 'helm-yahoo-suggest-fetch "1.5.1") +(defalias 'helm-c-external-commands-list-1 'helm-external-commands-list-1) +(make-obsolete 'helm-c-external-commands-list-1 'helm-external-commands-list-1 "1.5.1") +(defalias 'helm-c-buffers-list-persistent-action 'helm-buffers-list-persistent-action) +(make-obsolete 'helm-c-buffers-list-persistent-action 'helm-buffers-list-persistent-action "1.5.1") +(defalias 'helm-c-show-completion-init-overlay 'helm-show-completion-init-overlay) +(make-obsolete 'helm-c-show-completion-init-overlay 'helm-show-completion-init-overlay "1.5.1") +(defalias 'helm-c-shadow-boring-files 'helm-shadow-boring-files) +(make-obsolete 'helm-c-shadow-boring-files 'helm-shadow-boring-files "1.5.1") +(defalias 'helm-c-bookmark-local-files-setup-alist 'helm-bookmark-local-files-setup-alist) +(make-obsolete 'helm-c-bookmark-local-files-setup-alist 'helm-bookmark-local-files-setup-alist "1.5.1") +(defalias 'helm-c-highlight-local-use 'helm-highlight-local-use) +(make-obsolete 'helm-c-highlight-local-use 'helm-highlight-local-use "1.5.1") +(defalias 'helm-c-w3m-delete-bookmark 'helm-w3m-delete-bookmark) +(make-obsolete 'helm-c-w3m-delete-bookmark 'helm-w3m-delete-bookmark "1.5.1") +(defalias 'helm-c-skip-current-file 'helm-skip-current-file) +(make-obsolete 'helm-c-skip-current-file 'helm-skip-current-file "1.5.1") +(defalias 'helm-c-goto-next-file 'helm-goto-next-file) +(make-obsolete 'helm-c-goto-next-file 'helm-goto-next-file "1.5.1") +(defalias 'helm-c-info-init 'helm-info-init) +(make-obsolete 'helm-c-info-init 'helm-info-init "1.5.1") +(defalias 'helm-c-query-replace-args 'helm-query-replace-args) +(make-obsolete 'helm-c-query-replace-args 'helm-query-replace-args "1.5.1") +(defalias 'helm-c-bookmark-info-setup-alist 'helm-bookmark-info-setup-alist) +(make-obsolete 'helm-c-bookmark-info-setup-alist 'helm-bookmark-info-setup-alist "1.5.1") +(defalias 'helm-c-ratpoison-commands-execute 'helm-ratpoison-commands-execute) +(make-obsolete 'helm-c-ratpoison-commands-execute 'helm-ratpoison-commands-execute "1.5.1") +(defalias 'helm-c-ucs-persistent-backward 'helm-ucs-persistent-backward) +(make-obsolete 'helm-c-ucs-persistent-backward 'helm-ucs-persistent-backward "1.5.1") +(defalias 'helm-c-info-pages-init 'helm-info-pages-init) +(make-obsolete 'helm-c-info-pages-init 'helm-info-pages-init "1.5.1") +(defalias 'helm-c-grep-save-results 'helm-grep-save-results) +(make-obsolete 'helm-c-grep-save-results 'helm-grep-save-results "1.5.1") +(defalias 'helm-c-simple-call-tree-callers-functions-init 'helm-simple-call-tree-callers-functions-init) +(make-obsolete 'helm-c-simple-call-tree-callers-functions-init 'helm-simple-call-tree-callers-functions-init "1.5.1") +(defalias 'helm-c-read-file-name 'helm-read-file-name) +(make-obsolete 'helm-c-read-file-name 'helm-read-file-name "1.5.1") +(defalias 'helm-c-org-keywords-insert 'helm-org-keywords-insert) +(make-obsolete 'helm-c-org-keywords-insert 'helm-org-keywords-insert "1.5.1") +(defalias 'helm-c-call-interactively 'helm-call-interactively) +(make-obsolete 'helm-c-call-interactively 'helm-call-interactively "1.5.1") +(defalias 'helm-c-adaptative-compare 'helm-adaptive-compare) +(make-obsolete 'helm-c-adaptative-compare 'helm-adaptive-compare "1.5.1") +(defalias 'helm-c-filtered-candidate-transformer-file-line 'helm-filtered-candidate-transformer-file-line) +(make-obsolete 'helm-c-filtered-candidate-transformer-file-line 'helm-filtered-candidate-transformer-file-line "1.5.1") +(defalias 'helm-c-buffer-list 'helm-buffer-list) +(make-obsolete 'helm-c-buffer-list 'helm-buffer-list "1.5.1") +(defalias 'helm-c-gentoo-get-local-use 'helm-gentoo-get-local-use) +(make-obsolete 'helm-c-gentoo-get-local-use 'helm-gentoo-get-local-use "1.5.1") +(defalias 'helm-c-thing-before-point 'helm-thing-before-point) +(make-obsolete 'helm-c-thing-before-point 'helm-thing-before-point "1.5.1") +(defalias 'helm-c-ratpoison-commands-display-to-real 'helm-ratpoison-commands-display-to-real) +(make-obsolete 'helm-c-ratpoison-commands-display-to-real 'helm-ratpoison-commands-display-to-real "1.5.1") +(defalias 'helm-c-imenu-default-action 'helm-imenu-default-action) +(make-obsolete 'helm-c-imenu-default-action 'helm-imenu-default-action "1.5.1") +(defalias 'helm-c-describe-function 'helm-describe-function) +(make-obsolete 'helm-c-describe-function 'helm-describe-function "1.5.1") +(defalias 'helm-c-colors-get-name 'helm-colors-get-name) +(make-obsolete 'helm-c-colors-get-name 'helm-colors-get-name "1.5.1") +(defalias 'helm-c-bookmark-help 'helm-bookmark-help) +(make-obsolete 'helm-c-bookmark-help 'helm-bookmark-help "1.5.1") +(defalias 'helm-c-ucs-persistent-delete 'helm-ucs-persistent-delete) +(make-obsolete 'helm-c-ucs-persistent-delete 'helm-ucs-persistent-delete "1.5.1") +(defalias 'helm-c-set-variable 'helm-set-variable) +(make-obsolete 'helm-c-set-variable 'helm-set-variable "1.5.1") +(defalias 'helm-c-w3m-browse-bookmark 'helm-w3m-browse-bookmark) +(make-obsolete 'helm-c-w3m-browse-bookmark 'helm-w3m-browse-bookmark "1.5.1") +(defalias 'helm-c-grep-save-results-1 'helm-grep-save-results-1) +(make-obsolete 'helm-c-grep-save-results-1 'helm-grep-save-results-1 "1.5.1") +(defalias 'helm-c-adaptative-maybe-load-history 'helm-adaptive-maybe-load-history) +(make-obsolete 'helm-c-adaptative-maybe-load-history 'helm-adaptive-maybe-load-history "1.5.1") +(defalias 'helm-c-w32-pathname-transformer 'helm-w32-pathname-transformer) +(make-obsolete 'helm-c-w32-pathname-transformer 'helm-w32-pathname-transformer "1.5.1") +(defalias 'helm-c-top-display-to-real 'helm-top-display-to-real) +(make-obsolete 'helm-c-top-display-to-real 'helm-top-display-to-real "1.5.1") +(defalias 'helm-c-open-file-externally 'helm-open-file-externally) +(make-obsolete 'helm-c-open-file-externally 'helm-open-file-externally "1.5.1") +(defalias 'helm-c-colors-get-rgb 'helm-colors-get-rgb) +(make-obsolete 'helm-c-colors-get-rgb 'helm-colors-get-rgb "1.5.1") +(defalias 'helm-c-org-headline-refile 'helm-org-headline-refile) +(make-obsolete 'helm-c-org-headline-refile 'helm-org-headline-refile "1.5.1") +(defalias 'helm-c-stumpwm-commands-init 'helm-stumpwm-commands-init) +(make-obsolete 'helm-c-stumpwm-commands-init 'helm-stumpwm-commands-init "1.5.1") +(defalias 'helm-c-highlight-world 'helm-highlight-world) +(make-obsolete 'helm-c-highlight-world 'helm-highlight-world "1.5.1") +(defalias 'helm-c-top-sh 'helm-top-sh) +(make-obsolete 'helm-c-top-sh 'helm-top-sh "1.5.1") +(defalias 'helm-c-bbdb-get-record 'helm-bbdb-get-record) +(make-obsolete 'helm-c-bbdb-get-record 'helm-bbdb-get-record "1.5.1") +(defalias 'helm-c-persistent-xfont-action 'helm-persistent-xfont-action) +(make-obsolete 'helm-c-persistent-xfont-action 'helm-persistent-xfont-action "1.5.1") +(defalias 'helm-c-latex-math-candidates 'helm-latex-math-candidates) +(make-obsolete 'helm-c-latex-math-candidates 'helm-latex-math-candidates "1.5.1") +(defalias 'helm-c-ucs-backward-char 'helm-ucs-backward-char) +(make-obsolete 'helm-c-ucs-backward-char 'helm-ucs-backward-char "1.5.1") +(defalias 'helm-c-calculate-ucs-max-len 'helm-calculate-ucs-max-len) +(make-obsolete 'helm-c-calculate-ucs-max-len 'helm-calculate-ucs-max-len "1.5.1") +(defalias 'helm-c-etags-mtime 'helm-etags-mtime) +(make-obsolete 'helm-c-etags-mtime 'helm-etags-mtime "1.5.1") +(defalias 'helm-c-google-suggest-action 'helm-google-suggest-action) +(make-obsolete 'helm-c-google-suggest-action 'helm-google-suggest-action "1.5.1") +(defalias 'helm-c-org-headline-insert-link-to-headline 'helm-org-headline-insert-link-to-headline) +(make-obsolete 'helm-c-org-headline-insert-link-to-headline 'helm-org-headline-insert-link-to-headline "1.5.1") +(defalias 'helm-c-bbdb-create-contact 'helm-bbdb-create-contact) +(make-obsolete 'helm-c-bbdb-create-contact 'helm-bbdb-create-contact "1.5.1") +(defalias 'helm-c-elisp-library-scan-init 'helm-elisp-library-scan-init) +(make-obsolete 'helm-c-elisp-library-scan-init 'helm-elisp-library-scan-init "1.5.1") +(defalias 'helm-c-apt-refresh 'helm-apt-refresh) +(make-obsolete 'helm-c-apt-refresh 'helm-apt-refresh "1.5.1") +(defalias 'helm-c-kill-regexp 'helm-kill-regexp) +(make-obsolete 'helm-c-kill-regexp 'helm-kill-regexp "1.5.1") +(defalias 'helm-c-gentoo-default-action 'helm-gentoo-default-action) +(make-obsolete 'helm-c-gentoo-default-action 'helm-gentoo-default-action "1.5.1") +(defalias 'helm-c-grep-buffers-1 'helm-grep-buffers-1) +(make-obsolete 'helm-c-grep-buffers-1 'helm-grep-buffers-1 "1.5.1") +(defalias 'helm-c-adaptative-store-selection 'helm-adaptive-store-selection) +(make-obsolete 'helm-c-adaptative-store-selection 'helm-adaptive-store-selection "1.5.1") +(defalias 'helm-c-browse-url 'helm-browse-url) +(make-obsolete 'helm-c-browse-url 'helm-browse-url "1.5.1") +(defalias 'helm-c-google-suggest-emacs-lisp 'helm-google-suggest-emacs-lisp) +(make-obsolete 'helm-c-google-suggest-emacs-lisp 'helm-google-suggest-emacs-lisp "1.5.1") +(defalias 'helm-c-ucs-persistent-insert 'helm-ucs-persistent-insert) +(make-obsolete 'helm-c-ucs-persistent-insert 'helm-ucs-persistent-insert "1.5.1") +(defalias 'helm-c-xrandr-output 'helm-xrandr-output) +(make-obsolete 'helm-c-xrandr-output 'helm-xrandr-output "1.5.1") +(defalias 'helm-c-kill-ring-action 'helm-kill-ring-action) +(make-obsolete 'helm-c-kill-ring-action 'helm-kill-ring-action "1.5.1") +(defalias 'helm-c-org-keywords-candidates 'helm-org-keywords-candidates) +(make-obsolete 'helm-c-org-keywords-candidates 'helm-org-keywords-candidates "1.5.1") +(defalias 'helm-c-bookmark-jump 'helm-bookmark-jump) +(make-obsolete 'helm-c-bookmark-jump 'helm-bookmark-jump "1.5.1") +(defalias 'helm-c-shadow-boring-buffers 'helm-shadow-boring-buffers) +(make-obsolete 'helm-c-shadow-boring-buffers 'helm-shadow-boring-buffers "1.5.1") +(defalias 'helm-c-buffer-match-major-mode 'helm-buffer-match-major-mode) +(make-obsolete 'helm-c-buffer-match-major-mode 'helm-buffer-match-major-mode "1.5.1") +(defalias 'helm-c-highlight-bookmark-su 'helm-highlight-bookmark-su) +(make-obsolete 'helm-c-highlight-bookmark-su 'helm-highlight-bookmark-su "1.5.1") +(defalias 'helm-c-grep-other-frame 'helm-grep-other-frame) +(make-obsolete 'helm-c-grep-other-frame 'helm-grep-other-frame "1.5.1") +(defalias 'helm-c-jabber-online-contacts 'helm-jabber-online-contacts) +(make-obsolete 'helm-c-jabber-online-contacts 'helm-jabber-online-contacts "1.5.1") +(defalias 'helm-c-apt-purge 'helm-apt-purge) +(make-obsolete 'helm-c-apt-purge 'helm-apt-purge "1.5.1") +(defalias 'helm-c-adaptative-sort 'helm-adaptive-sort) +(make-obsolete 'helm-c-adaptative-sort 'helm-adaptive-sort "1.5.1") +(defalias 'helm-c-bmkext-addressbook-setup-alist 'helm-bmkext-addressbook-setup-alist) +(make-obsolete 'helm-c-bmkext-addressbook-setup-alist 'helm-bmkext-addressbook-setup-alist "1.5.1") +(defalias 'helm-c-bbdb-collect-mail-addresses 'helm-bbdb-collect-mail-addresses) +(make-obsolete 'helm-c-bbdb-collect-mail-addresses 'helm-bbdb-collect-mail-addresses "1.5.1") +(defalias 'helm-c-bmkext-filter-setup-alist 'helm-bmkext-filter-setup-alist) +(make-obsolete 'helm-c-bmkext-filter-setup-alist 'helm-bmkext-filter-setup-alist "1.5.1") +(defalias 'helm-c-grep-buffers 'helm-grep-buffers) +(make-obsolete 'helm-c-grep-buffers 'helm-grep-buffers "1.5.1") +(defalias 'helm-c-apt-init 'helm-apt-init) +(make-obsolete 'helm-c-apt-init 'helm-apt-init "1.5.1") +(defalias 'helm-c-grep-run-save-buffer 'helm-grep-run-save-buffer) +(make-obsolete 'helm-c-grep-run-save-buffer 'helm-grep-run-save-buffer "1.5.1") +(defalias 'helm-c-simple-call-tree-init-base 'helm-simple-call-tree-init-base) +(make-obsolete 'helm-c-simple-call-tree-init-base 'helm-simple-call-tree-init-base "1.5.1") +(defalias 'helm-c-ggs-set-number-result 'helm-ggs-set-number-result) +(make-obsolete 'helm-c-ggs-set-number-result 'helm-ggs-set-number-result "1.5.1") +(defalias 'helm-c-grep-prepare-candidates 'helm-grep-prepare-candidates) +(make-obsolete 'helm-c-grep-prepare-candidates 'helm-grep-prepare-candidates "1.5.1") +(defalias 'helm-c-grep-jump-elscreen 'helm-grep-jump-elscreen) +(make-obsolete 'helm-c-grep-jump-elscreen 'helm-grep-jump-elscreen "1.5.1") +(defalias 'helm-c-show-completion-display-function 'helm-show-completion-display-function) +(make-obsolete 'helm-c-show-completion-display-function 'helm-show-completion-display-function "1.5.1") +(defalias 'helm-c-find-variable 'helm-find-variable) +(make-obsolete 'helm-c-find-variable 'helm-find-variable "1.5.1") +(defalias 'helm-c-build-elvi-list 'helm-build-elvi-list) +(make-obsolete 'helm-c-build-elvi-list 'helm-build-elvi-list "1.5.1") +(defalias 'helm-c-advice-toggle 'helm-advice-toggle) +(make-obsolete 'helm-c-advice-toggle 'helm-advice-toggle "1.5.1") +(defalias 'helm-c-buffers-persistent-kill 'helm-buffers-persistent-kill) +(make-obsolete 'helm-c-buffers-persistent-kill 'helm-buffers-persistent-kill "1.5.1") +(defalias 'helm-c-simple-call-tree-analyze-maybe 'helm-simple-call-tree-analyze-maybe) +(make-obsolete 'helm-c-simple-call-tree-analyze-maybe 'helm-simple-call-tree-analyze-maybe "1.5.1") +(defalias 'helm-c-register-action-transformer 'helm-register-action-transformer) +(make-obsolete 'helm-c-register-action-transformer 'helm-register-action-transformer "1.5.1") +(defalias 'helm-c-kill-ring-candidates 'helm-kill-ring-candidates) +(make-obsolete 'helm-c-kill-ring-candidates 'helm-kill-ring-candidates "1.5.1") +(defalias 'helm-c-bbdb-view-person-action 'helm-bbdb-view-person-action) +(make-obsolete 'helm-c-bbdb-view-person-action 'helm-bbdb-view-person-action "1.5.1") +(defalias 'helm-c-generic-browser 'helm-generic-browser) +(make-obsolete 'helm-c-generic-browser 'helm-generic-browser "1.5.1") +(defalias 'helm-c-top-init 'helm-top-init) +(make-obsolete 'helm-c-top-init 'helm-top-init "1.5.1") +(defalias 'helm-c-ucs-delete-backward 'helm-ucs-delete-backward) +(make-obsolete 'helm-c-ucs-delete-backward 'helm-ucs-delete-backward "1.5.1") +(defalias 'helm-c-firefox-bookmarks-get-value 'helm-firefox-bookmarks-get-value) +(make-obsolete 'helm-c-firefox-bookmarks-get-value 'helm-firefox-bookmarks-get-value "1.5.1") +(defalias 'helm-c-apt-generic-action 'helm-apt-generic-action) +(make-obsolete 'helm-c-apt-generic-action 'helm-apt-generic-action "1.5.1") +(defalias 'helm-c-pdfgrep-action-1 'helm-pdfgrep-action-1) +(make-obsolete 'helm-c-pdfgrep-action-1 'helm-pdfgrep-action-1 "1.5.1") +(defalias 'helm-c-buffer-query-replace-regexp 'helm-buffer-query-replace-regexp) +(make-obsolete 'helm-c-buffer-query-replace-regexp 'helm-buffer-query-replace-regexp "1.5.1") +(defalias 'helm-c-apropos-init 'helm-apropos-init) +(make-obsolete 'helm-c-apropos-init 'helm-apropos-init "1.5.1") +(defalias 'helm-c-emms-play-current-playlist 'helm-emms-play-current-playlist) +(make-obsolete 'helm-c-emms-play-current-playlist 'helm-emms-play-current-playlist "1.5.1") +(defalias 'helm-c-kill-new 'helm-kill-new) +(make-obsolete 'helm-c-kill-new 'helm-kill-new "1.5.1") +(defalias 'helm-c-bookmark-gnus-setup-alist 'helm-bookmark-gnus-setup-alist) +(make-obsolete 'helm-c-bookmark-gnus-setup-alist 'helm-bookmark-gnus-setup-alist "1.5.1") +(defalias 'helm-c-quit-and-execute-action 'helm-quit-and-execute-action) +(make-obsolete 'helm-c-quit-and-execute-action 'helm-quit-and-execute-action "1.5.1") +(defalias 'helm-c-build-info-index-command 'helm-build-info-index-command) +(make-obsolete 'helm-c-build-info-index-command 'helm-build-info-index-command "1.5.1") +(defalias 'helm-c-gentoo-setup-cache 'helm-gentoo-setup-cache) +(make-obsolete 'helm-c-gentoo-setup-cache 'helm-gentoo-setup-cache "1.5.1") +(defalias 'helm-c-ratpoison-commands-init 'helm-ratpoison-commands-init) +(make-obsolete 'helm-c-ratpoison-commands-init 'helm-ratpoison-commands-init "1.5.1") +(defalias 'helm-c-etags-select 'helm-etags-select) +(make-obsolete 'helm-c-etags-select 'helm-etags-select "1.5.1") +(defalias 'helm-c-etags-create-buffer 'helm-etags-create-buffer) +(make-obsolete 'helm-c-etags-create-buffer 'helm-etags-create-buffer "1.5.1") +(defalias 'helm-c-yahoo-suggest-set-candidates 'helm-yahoo-suggest-set-candidates) +(make-obsolete 'helm-c-yahoo-suggest-set-candidates 'helm-yahoo-suggest-set-candidates "1.5.1") +(defalias 'helm-c-org-keywords-show-help 'helm-org-keywords-show-help) +(make-obsolete 'helm-c-org-keywords-show-help 'helm-org-keywords-show-help "1.5.1") +(defalias 'helm-c-highlight-files 'helm-highlight-files) +(make-obsolete 'helm-c-highlight-files 'helm-highlight-files "1.5.1") +(defalias 'helm-c-get-pid-from-process-name 'helm-get-pid-from-process-name) +(make-obsolete 'helm-c-get-pid-from-process-name 'helm-get-pid-from-process-name "1.5.1") +(defalias 'helm-c-insert-latex-math 'helm-insert-latex-math) +(make-obsolete 'helm-c-insert-latex-math 'helm-insert-latex-math "1.5.1") +(defalias 'helm-c-buffer-query-replace 'helm-buffer-query-replace) +(make-obsolete 'helm-c-buffer-query-replace 'helm-buffer-query-replace "1.5.1") +(defalias 'helm-c-bmkext-run-edit 'helm-bmkext-run-edit) +(make-obsolete 'helm-c-bmkext-run-edit 'helm-bmkext-run-edit "1.5.1") +(defalias 'helm-c-skip-boring-files 'helm-skip-boring-files) +(make-obsolete 'helm-c-skip-boring-files 'helm-skip-boring-files "1.5.1") +(defalias 'helm-c-transform-file-load-el 'helm-transform-file-load-el) +(make-obsolete 'helm-c-transform-file-load-el 'helm-transform-file-load-el "1.5.1") +(defalias 'helm-c-ucs-insert-char 'helm-ucs-insert-char) +(make-obsolete 'helm-c-ucs-insert-char 'helm-ucs-insert-char "1.5.1") +(defalias 'helm-c-gentoo-setup-use-flags-cache 'helm-gentoo-setup-use-flags-cache) +(make-obsolete 'helm-c-gentoo-setup-use-flags-cache 'helm-gentoo-setup-use-flags-cache "1.5.1") +(defalias 'helm-c-buffer-help 'helm-buffer-help) +(make-obsolete 'helm-c-buffer-help 'helm-buffer-help "1.5.1") +(defalias 'helm-c-current-directory 'helm-current-directory) +(make-obsolete 'helm-c-current-directory 'helm-current-directory "1.5.1") +(defalias 'helm-c-highlight-firefox-bookmarks 'helm-highlight-firefox-bookmarks) +(make-obsolete 'helm-c-highlight-firefox-bookmarks 'helm-highlight-firefox-bookmarks "1.5.1") +(defalias 'helm-c-find-file-or-marked 'helm-find-file-or-marked) +(make-obsolete 'helm-c-find-file-or-marked 'helm-find-file-or-marked "1.5.1") +(defalias 'helm-c-query-replace-regexp 'helm-query-replace-regexp) +(make-obsolete 'helm-c-query-replace-regexp 'helm-query-replace-regexp "1.5.1") +(defalias 'helm-c-describe-variable 'helm-describe-variable) +(make-obsolete 'helm-c-describe-variable 'helm-describe-variable "1.5.1") +(defalias 'helm-c-advice-persistent-action 'helm-advice-persistent-action) +(make-obsolete 'helm-c-advice-persistent-action 'helm-advice-persistent-action "1.5.1") +(defalias 'helm-c-show-completion 'helm-show-completion) +(make-obsolete 'helm-c-show-completion 'helm-show-completion "1.5.1") +(defalias 'helm-c-google-suggest-set-candidates 'helm-google-suggest-set-candidates) +(make-obsolete 'helm-c-google-suggest-set-candidates 'helm-google-suggest-set-candidates "1.5.1") +(defalias 'helm-c-grep-persistent-action 'helm-grep-persistent-action) +(make-obsolete 'helm-c-grep-persistent-action 'helm-grep-persistent-action "1.5.1") +(defalias 'helm-c-open-file-with-default-tool 'helm-open-file-with-default-tool) +(make-obsolete 'helm-c-open-file-with-default-tool 'helm-open-file-with-default-tool "1.5.1") +(defalias 'helm-c-run-external-command 'helm-run-external-command) +(make-obsolete 'helm-c-run-external-command 'helm-run-external-command "1.5.1") +(defalias 'helm-c-bookmark-images-setup-alist 'helm-bookmark-images-setup-alist) +(make-obsolete 'helm-c-bookmark-images-setup-alist 'helm-bookmark-images-setup-alist "1.5.1") +(defalias 'helm-c-apt-candidate-transformer 'helm-apt-candidate-transformer) +(make-obsolete 'helm-c-apt-candidate-transformer 'helm-apt-candidate-transformer "1.5.1") +(defalias 'helm-c-grep-run-persistent-action 'helm-grep-run-persistent-action) +(make-obsolete 'helm-c-grep-run-persistent-action 'helm-grep-run-persistent-action "1.5.1") +(defalias 'helm-c-highlight-buffers 'helm-highlight-buffers) +(make-obsolete 'helm-c-highlight-buffers 'helm-highlight-buffers "1.5.1") +(defalias 'helm-c-man-default-action 'helm-man-default-action) +(make-obsolete 'helm-c-man-default-action 'helm-man-default-action "1.5.1") +(defalias 'helm-c-advice-candidates 'helm-advice-candidates) +(make-obsolete 'helm-c-advice-candidates 'helm-advice-candidates "1.5.1") +(defalias 'helm-c-stumpwm-commands-execute 'helm-stumpwm-commands-execute) +(make-obsolete 'helm-c-stumpwm-commands-execute 'helm-stumpwm-commands-execute "1.5.1") +(defalias 'helm-c-ucs-help 'helm-ucs-help) +(make-obsolete 'helm-c-ucs-help 'helm-ucs-help "1.5.1") +(defalias 'helm-c-apt-uninstall 'helm-apt-uninstall) +(make-obsolete 'helm-c-apt-uninstall 'helm-apt-uninstall "1.5.1") +(defalias 'helm-c-bookmark-run-jump-other-window 'helm-bookmark-run-jump-other-window) +(make-obsolete 'helm-c-bookmark-run-jump-other-window 'helm-bookmark-run-jump-other-window "1.5.1") +(defalias 'helm-c-elisp-library-scan-list 'helm-elisp-library-scan-list) +(make-obsolete 'helm-c-elisp-library-scan-list 'helm-elisp-library-scan-list "1.5.1") +(defalias 'helm-c-switch-to-buffer 'helm-switch-to-buffer) +(make-obsolete 'helm-c-switch-to-buffer 'helm-switch-to-buffer "1.5.1") +(defalias 'helm-c-bookmark-man-setup-alist 'helm-bookmark-man-setup-alist) +(make-obsolete 'helm-c-bookmark-man-setup-alist 'helm-bookmark-man-setup-alist "1.5.1") +(defalias 'helm-c-etags-find-tag-file-directory 'helm-etags-find-tag-file-directory) +(make-obsolete 'helm-c-etags-find-tag-file-directory 'helm-etags-find-tag-file-directory "1.5.1") +(defalias 'helm-c-xrandr-info 'helm-xrandr-info) +(make-obsolete 'helm-c-xrandr-info 'helm-xrandr-info "1.5.1") +(defalias 'helm-c-stringify 'helm-stringify) +(make-obsolete 'helm-c-stringify 'helm-stringify "1.5.1") +(defalias 'helm-c-goto-precedent-file 'helm-goto-precedent-file) +(make-obsolete 'helm-c-goto-precedent-file 'helm-goto-precedent-file "1.5.1") +(defalias 'helm-c-apt-cache-show 'helm-apt-cache-show) +(make-obsolete 'helm-c-apt-cache-show 'helm-apt-cache-show "1.5.1") +(defalias 'helm-c-etags-file-modified-p 'helm-etags-file-modified-p) +(make-obsolete 'helm-c-etags-file-modified-p 'helm-etags-file-modified-p "1.5.1") +(defalias 'helm-c-display-to-real-numbered-line 'helm-display-to-real-numbered-line) +(make-obsolete 'helm-c-display-to-real-numbered-line 'helm-display-to-real-numbered-line "1.5.1") +(defalias 'helm-c-etags-get-tag-file 'helm-etags-get-tag-file) +(make-obsolete 'helm-c-etags-get-tag-file 'helm-etags-get-tag-file "1.5.1") +(defalias 'helm-c-highlight-not-logged 'helm-highlight-not-logged) +(make-obsolete 'helm-c-highlight-not-logged 'helm-highlight-not-logged "1.5.1") +(defalias 'helm-c-pdfgrep-action 'helm-pdfgrep-action) +(make-obsolete 'helm-c-pdfgrep-action 'helm-pdfgrep-action "1.5.1") +(defalias 'helm-c-adaptative-save-history 'helm-adaptive-save-history) +(make-obsolete 'helm-c-adaptative-save-history 'helm-adaptive-save-history "1.5.1") +(defalias 'helm-c-get-first-line-documentation 'helm-get-first-line-documentation) +(make-obsolete 'helm-c-get-first-line-documentation 'helm-get-first-line-documentation "1.5.1") +(defalias 'helm-approximate-candidate-number 'helm-get-candidate-number) +(make-obsolete 'helm-approximate-candidate-number 'helm-get-candidate-number "1.5.5") + + +;;; variables +;; +;; +(defvaralias 'helm-c-bbdb-name 'helm-bbdb-name) +(make-obsolete-variable 'helm-c-bbdb-name 'helm-bbdb-name "1.5.1") +(defvaralias 'helm-c-pdfgrep-default-command 'helm-pdfgrep-default-command) +(make-obsolete-variable 'helm-c-pdfgrep-default-command 'helm-pdfgrep-default-command "1.5.1") +(defvaralias 'helm-c-source-time-world 'helm-source-time-world) +(make-obsolete-variable 'helm-c-source-time-world 'helm-source-time-world "1.5.1") +(defvaralias 'helm-c-grep-default-command 'helm-grep-default-command) +(make-obsolete-variable 'helm-c-grep-default-command 'helm-grep-default-command "1.5.1") +(defvaralias 'helm-c-default-info-index-list 'helm-default-info-index-list) +(make-obsolete-variable 'helm-c-default-info-index-list 'helm-default-info-index-list "1.5.1") +(defvaralias 'helm-c-etags-tag-file-dir 'helm-etags-tag-file-dir) +(make-obsolete-variable 'helm-c-etags-tag-file-dir 'helm-etags-tag-file-dir "1.5.1") +(defvaralias 'helm-c-source-man-pages 'helm-source-man-pages) +(make-obsolete-variable 'helm-c-source-man-pages 'helm-source-man-pages "1.5.1") +(defvaralias 'helm-c-source-bookmark-info 'helm-source-bookmark-info) +(make-obsolete-variable 'helm-c-source-bookmark-info 'helm-source-bookmark-info "1.5.1") +(defvaralias 'helm-c-file-cache-files 'helm-file-cache-files) +(make-obsolete-variable 'helm-c-file-cache-files 'helm-file-cache-files "1.5.1") +(defvaralias 'helm-c-ucs-map 'helm-ucs-map) +(make-obsolete-variable 'helm-c-ucs-map 'helm-ucs-map "1.5.1") +(defvaralias 'helm-c-show-completion-min-window-height 'helm-show-completion-min-window-height) +(make-obsolete-variable 'helm-c-show-completion-min-window-height 'helm-show-completion-min-window-height "1.5.1") +(defvaralias 'helm-c-adaptative-history 'helm-adaptive-history) +(make-obsolete-variable 'helm-c-adaptative-history 'helm-adaptive-history "1.5.1") +(defvaralias 'helm-c-source-bookmarks-local 'helm-source-bookmarks-local) +(make-obsolete-variable 'helm-c-source-bookmarks-local 'helm-source-bookmarks-local "1.5.1") +(defvaralias 'helm-c-grep-map 'helm-grep-map) +(make-obsolete-variable 'helm-c-grep-map 'helm-grep-map "1.5.1") +(defvaralias 'helm-c-source-session 'helm-source-session) +(make-obsolete-variable 'helm-c-source-session 'helm-source-session "1.5.1") +(defvaralias 'helm-c-source-org-headline 'helm-source-org-headline) +(make-obsolete-variable 'helm-c-source-org-headline 'helm-source-org-headline "1.5.1") +(defvaralias 'helm-c-source-minibuffer-history 'helm-source-minibuffer-history) +(make-obsolete-variable 'helm-c-source-minibuffer-history 'helm-source-minibuffer-history "1.5.1") +(defvaralias 'helm-c-source-files-in-current-dir 'helm-source-files-in-current-dir) +(make-obsolete-variable 'helm-c-source-files-in-current-dir 'helm-source-files-in-current-dir "1.5.1") +(defvaralias 'helm-c-source-etags-select 'helm-source-etags-select) +(make-obsolete-variable 'helm-c-source-etags-select 'helm-source-etags-select "1.5.1") +(defvaralias 'helm-c-gentoo-use-flags 'helm-gentoo-use-flags) +(make-obsolete-variable 'helm-c-gentoo-use-flags 'helm-gentoo-use-flags "1.5.1") +(defvaralias 'helm-c-show-completion-overlay 'helm-show-completion-overlay) +(make-obsolete-variable 'helm-c-show-completion-overlay 'helm-show-completion-overlay "1.5.1") +(defvaralias 'helm-c-buffer-help-message 'helm-buffer-help-message) +(make-obsolete-variable 'helm-c-buffer-help-message 'helm-buffer-help-message "1.5.1") +(defvaralias 'helm-c-ucs-max-len 'helm-ucs-max-len) +(make-obsolete-variable 'helm-c-ucs-max-len 'helm-ucs-max-len "1.5.1") +(defvaralias 'helm-c-imenu-index-filter 'helm-imenu-index-filter) +(make-obsolete-variable 'helm-c-imenu-index-filter 'helm-imenu-index-filter "1.5.1") +(defvaralias 'helm-c-org-keywords-info-location 'helm-org-keywords-info-location) +(make-obsolete-variable 'helm-c-org-keywords-info-location 'helm-org-keywords-info-location "1.5.1") +(defvaralias 'helm-c-kill-ring-max-lines-number 'helm-kill-ring-max-lines-number) +(make-obsolete-variable 'helm-c-kill-ring-max-lines-number 'helm-kill-ring-max-lines-number "1.5.1") +(defvaralias 'helm-c-source-apt 'helm-source-apt) +(make-obsolete-variable 'helm-c-source-apt 'helm-source-apt "1.5.1") +(defvaralias 'helm-c-bookmark-map 'helm-bookmark-map) +(make-obsolete-variable 'helm-c-bookmark-map 'helm-bookmark-map "1.5.1") +(defvaralias 'helm-c-source-xfonts 'helm-source-xfonts) +(make-obsolete-variable 'helm-c-source-xfonts 'helm-source-xfonts "1.5.1") +(defvaralias 'helm-c-source-kill-ring 'helm-source-kill-ring) +(make-obsolete-variable 'helm-c-source-kill-ring 'helm-source-kill-ring "1.5.1") +(defvaralias 'helm-c-home-url 'helm-home-url) +(make-obsolete-variable 'helm-c-home-url 'helm-home-url "1.5.1") +(defvaralias 'helm-c-etags-cache 'helm-etags-cache) +(make-obsolete-variable 'helm-c-etags-cache 'helm-etags-cache "1.5.1") +(defvaralias 'helm-c-source-latex-math 'helm-source-latex-math) +(make-obsolete-variable 'helm-c-source-latex-math 'helm-source-latex-math "1.5.1") +(defvaralias 'helm-c-source-bookmark-files&dirs 'helm-source-bookmark-files&dirs) +(make-obsolete-variable 'helm-c-source-bookmark-files&dirs 'helm-source-bookmark-files&dirs "1.5.1") +(defvaralias 'helm-c-source-emms-dired 'helm-source-emms-dired) +(make-obsolete-variable 'helm-c-source-emms-dired 'helm-source-emms-dired "1.5.1") +(defvaralias 'helm-c-source-firefox-bookmarks 'helm-source-firefox-bookmarks) +(make-obsolete-variable 'helm-c-source-firefox-bookmarks 'helm-source-firefox-bookmarks "1.5.1") +(defvaralias 'helm-c-source-ratpoison-commands 'helm-source-ratpoison-commands) +(make-obsolete-variable 'helm-c-source-ratpoison-commands 'helm-source-ratpoison-commands "1.5.1") +(defvaralias 'helm-c-apt-show-command 'helm-apt-show-command) +(make-obsolete-variable 'helm-c-apt-show-command 'helm-apt-show-command "1.5.1") +(defvaralias 'helm-c-pdfgrep-default-function 'helm-pdfgrep-default-function) +(make-obsolete-variable 'helm-c-pdfgrep-default-function 'helm-pdfgrep-default-function "1.5.1") +(defvaralias 'helm-c-simple-call-tree-tick 'helm-simple-call-tree-tick) +(make-obsolete-variable 'helm-c-simple-call-tree-tick 'helm-simple-call-tree-tick "1.5.1") +(defvaralias 'helm-c-source-register 'helm-source-register) +(make-obsolete-variable 'helm-c-source-register 'helm-source-register "1.5.1") +(defvaralias 'helm-c-boring-buffer-regexp-list 'helm-boring-buffer-regexp-list) +(make-obsolete-variable 'helm-c-boring-buffer-regexp-list 'helm-boring-buffer-regexp-list "1.5.1") +(defvaralias 'helm-c-source-locate 'helm-source-locate) +(make-obsolete-variable 'helm-c-source-locate 'helm-source-locate "1.5.1") +(defvaralias 'helm-c-source-advice 'helm-source-advice) +(make-obsolete-variable 'helm-c-source-advice 'helm-source-advice "1.5.1") +(defvaralias 'helm-c-source-yaoddmuse-emacswiki-edit-or-view 'helm-source-yaoddmuse-emacswiki-edit-or-view) +(make-obsolete-variable 'helm-c-source-yaoddmuse-emacswiki-edit-or-view 'helm-source-yaoddmuse-emacswiki-edit-or-view "1.5.1") +(defvaralias 'helm-c-ucs-mode-line-string 'helm-ucs-mode-line-string) +(make-obsolete-variable 'helm-c-ucs-mode-line-string 'helm-ucs-mode-line-string "1.5.1") +(defvaralias 'helm-c-xfonts-cache 'helm-xfonts-cache) +(make-obsolete-variable 'helm-c-xfonts-cache 'helm-xfonts-cache "1.5.1") +(defvaralias 'helm-c-source-yahoo-suggest 'helm-source-yahoo-suggest) +(make-obsolete-variable 'helm-c-source-yahoo-suggest 'helm-source-yahoo-suggest "1.5.1") +(defvaralias 'helm-c-rzgrep-cache 'helm-rzgrep-cache) +(make-obsolete-variable 'helm-c-rzgrep-cache 'helm-rzgrep-cache "1.5.1") +(defvaralias 'helm-c-source-org-keywords 'helm-source-org-keywords) +(make-obsolete-variable 'helm-c-source-org-keywords 'helm-source-org-keywords "1.5.1") +(defvaralias 'helm-c-pdfgrep-map 'helm-pdfgrep-map) +(make-obsolete-variable 'helm-c-pdfgrep-map 'helm-pdfgrep-map "1.5.1") +(defvaralias 'helm-c-source-lacarte 'helm-source-lacarte) +(make-obsolete-variable 'helm-c-source-lacarte 'helm-source-lacarte "1.5.1") +(defvaralias 'helm-c-apt-search-command 'helm-apt-search-command) +(make-obsolete-variable 'helm-c-apt-search-command 'helm-apt-search-command "1.5.1") +(defvaralias 'helm-c-default-external-file-browser 'helm-default-external-file-browser) +(make-obsolete-variable 'helm-c-default-external-file-browser 'helm-default-external-file-browser "1.5.1") +(defvaralias 'helm-c-source-evaluation-result 'helm-source-evaluation-result) +(make-obsolete-variable 'helm-c-source-evaluation-result 'helm-source-evaluation-result "1.5.1") +(defvaralias 'helm-c-yahoo-suggest-search-url 'helm-yahoo-suggest-search-url) +(make-obsolete-variable 'helm-c-yahoo-suggest-search-url 'helm-yahoo-suggest-search-url "1.5.1") +(defvaralias 'helm-c-source-occur 'helm-source-occur) +(make-obsolete-variable 'helm-c-source-occur 'helm-source-occur "1.5.1") +(defvaralias 'helm-c-source-calculation-result 'helm-source-calculation-result) +(make-obsolete-variable 'helm-c-source-calculation-result 'helm-source-calculation-result "1.5.1") +(defvaralias 'helm-c-default-zgrep-command 'helm-default-zgrep-command) +(make-obsolete-variable 'helm-c-default-zgrep-command 'helm-default-zgrep-command "1.5.1") +(defvaralias 'helm-c-show-info-in-mode-line-delay 'helm-show-info-in-mode-line-delay) +(make-obsolete-variable 'helm-c-show-info-in-mode-line-delay 'helm-show-info-in-mode-line-delay "1.5.1") +(defvaralias 'helm-c-source-ido-virtual-buffers 'helm-source-ido-virtual-buffers) +(make-obsolete-variable 'helm-c-source-ido-virtual-buffers 'helm-source-ido-virtual-buffers "1.5.1") +(defvaralias 'helm-c-source-yaoddmuse-emacswiki-post-library 'helm-source-yaoddmuse-emacswiki-post-library) +(make-obsolete-variable 'helm-c-source-yaoddmuse-emacswiki-post-library 'helm-source-yaoddmuse-emacswiki-post-library "1.5.1") +(defvaralias 'helm-c-source-top 'helm-source-top) +(make-obsolete-variable 'helm-c-source-top 'helm-source-top "1.5.1") +(defvaralias 'helm-c-source-colors 'helm-source-colors) +(make-obsolete-variable 'helm-c-source-colors 'helm-source-colors "1.5.1") +(defvaralias 'helm-c-read-file-map 'helm-read-file-map) +(make-obsolete-variable 'helm-c-read-file-map 'helm-read-file-map "1.5.1") +(defvaralias 'helm-c-source-file-cache 'helm-source-file-cache) +(make-obsolete-variable 'helm-c-source-file-cache 'helm-source-file-cache "1.5.1") +(defvaralias 'helm-c-google-suggest-default-browser-function 'helm-google-suggest-default-browser-function) +(make-obsolete-variable 'helm-c-google-suggest-default-browser-function 'helm-google-suggest-default-browser-function "1.5.1") +(defvaralias 'helm-c-external-programs-associations 'helm-external-programs-associations) +(make-obsolete-variable 'helm-c-external-programs-associations 'helm-external-programs-associations "1.5.1") +(defvaralias 'helm-c-source-complex-command-history 'helm-source-complex-command-history) +(make-obsolete-variable 'helm-c-source-complex-command-history 'helm-source-complex-command-history "1.5.1") +(defvaralias 'helm-c-cached-imenu-candidates 'helm-cached-imenu-candidates) +(make-obsolete-variable 'helm-c-cached-imenu-candidates 'helm-cached-imenu-candidates "1.5.1") +(defvaralias 'helm-c-gentoo-buffer 'helm-gentoo-buffer) +(make-obsolete-variable 'helm-c-gentoo-buffer 'helm-gentoo-buffer "1.5.1") +(defvaralias 'helm-c-source-simple-call-tree-callers-functions 'helm-source-simple-call-tree-callers-functions) +(make-obsolete-variable 'helm-c-source-simple-call-tree-callers-functions 'helm-source-simple-call-tree-callers-functions "1.5.1") +(defvaralias 'helm-c-external-commands-list 'helm-external-commands-list) +(make-obsolete-variable 'helm-c-external-commands-list 'helm-external-commands-list "1.5.1") +(defvaralias 'helm-c-source-ucs 'helm-source-ucs) +(make-obsolete-variable 'helm-c-source-ucs 'helm-source-ucs "1.5.1") +(defvaralias 'helm-c-adaptative-history-length 'helm-adaptive-history-length) +(make-obsolete-variable 'helm-c-adaptative-history-length 'helm-adaptive-history-length "1.5.1") +(defvaralias 'helm-c-source-customize-face 'helm-source-customize-face) +(make-obsolete-variable 'helm-c-source-customize-face 'helm-source-customize-face "1.5.1") +(defvaralias 'helm-c-source-bookmarks-ssh 'helm-source-bookmarks-ssh) +(make-obsolete-variable 'helm-c-source-bookmarks-ssh 'helm-source-bookmarks-ssh "1.5.1") +(defvaralias 'helm-c-eldoc-in-minibuffer-show-fn 'helm-eldoc-in-minibuffer-show-fn) +(make-obsolete-variable 'helm-c-eldoc-in-minibuffer-show-fn 'helm-eldoc-in-minibuffer-show-fn "1.5.1") +(defvaralias 'helm-c-google-suggest-search-url 'helm-google-suggest-search-url) +(make-obsolete-variable 'helm-c-google-suggest-search-url 'helm-google-suggest-search-url "1.5.1") +(defvaralias 'helm-c-source-bmkext-addressbook 'helm-source-bmkext-addressbook) +(make-obsolete-variable 'helm-c-source-bmkext-addressbook 'helm-source-bmkext-addressbook "1.5.1") +(defvaralias 'helm-c-source-ctags 'helm-source-ctags) +(make-obsolete-variable 'helm-c-source-ctags 'helm-source-ctags "1.5.1") +(defvaralias 'helm-c-source-eev-anchor 'helm-source-eev-anchor) +(make-obsolete-variable 'helm-c-source-eev-anchor 'helm-source-eev-anchor "1.5.1") +(defvaralias 'helm-c-apt-installed-packages 'helm-apt-installed-packages) +(make-obsolete-variable 'helm-c-apt-installed-packages 'helm-apt-installed-packages "1.5.1") +(defvaralias 'helm-c-apt-all-packages 'helm-apt-all-packages) +(make-obsolete-variable 'helm-c-apt-all-packages 'helm-apt-all-packages "1.5.1") +(defvaralias 'helm-c-find-files-doc-header 'helm-find-files-doc-header) +(make-obsolete-variable 'helm-c-find-files-doc-header 'helm-find-files-doc-header "1.5.1") +(defvaralias 'helm-c-source-imenu 'helm-source-imenu) +(make-obsolete-variable 'helm-c-source-imenu 'helm-source-imenu "1.5.1") +(defvaralias 'helm-c-grep-default-function 'helm-grep-default-function) +(make-obsolete-variable 'helm-c-grep-default-function 'helm-grep-default-function "1.5.1") +(defvaralias 'helm-c-top-command 'helm-top-command) +(make-obsolete-variable 'helm-c-top-command 'helm-top-command "1.5.1") +(defvaralias 'helm-c-source-bookmark-man 'helm-source-bookmark-man) +(make-obsolete-variable 'helm-c-source-bookmark-man 'helm-source-bookmark-man "1.5.1") +(defvaralias 'helm-c-source-stumpwm-commands 'helm-source-stumpwm-commands) +(make-obsolete-variable 'helm-c-source-stumpwm-commands 'helm-source-stumpwm-commands "1.5.1") +(defvaralias 'helm-c-source-idle-time-timers 'helm-source-idle-time-timers) +(make-obsolete-variable 'helm-c-source-idle-time-timers 'helm-source-idle-time-timers "1.5.1") +(defvaralias 'helm-c-turn-on-show-completion 'helm-turn-on-show-completion) +(make-obsolete-variable 'helm-c-turn-on-show-completion 'helm-turn-on-show-completion "1.5.1") +(defvaralias 'helm-c-esh-help-message 'helm-esh-help-message) +(make-obsolete-variable 'helm-c-esh-help-message 'helm-esh-help-message "1.5.1") +(defvaralias 'helm-c-register-max-offset 'helm-register-max-offset) +(make-obsolete-variable 'helm-c-register-max-offset 'helm-register-max-offset "1.5.1") +(defvaralias 'helm-c-source-bookmark-set 'helm-source-bookmark-set) +(make-obsolete-variable 'helm-c-source-bookmark-set 'helm-source-bookmark-set "1.5.1") +(defvaralias 'helm-c-source-file-name-history 'helm-source-file-name-history) +(make-obsolete-variable 'helm-c-source-file-name-history 'helm-source-file-name-history "1.5.1") +(defvaralias 'helm-c-file-cache-initialized-p 'helm-file-cache-initialized-p) +(make-obsolete-variable 'helm-c-file-cache-initialized-p 'helm-file-cache-initialized-p "1.5.1") +(defvaralias 'helm-c-grep-max-length-history 'helm-grep-max-length-history) +(make-obsolete-variable 'helm-c-grep-max-length-history 'helm-grep-max-length-history "1.5.1") +(defvaralias 'helm-c-source-jabber-contacts 'helm-source-jabber-contacts) +(make-obsolete-variable 'helm-c-source-jabber-contacts 'helm-source-jabber-contacts "1.5.1") +(defvaralias 'helm-c-grep-use-ioccur-style-keys 'helm-grep-use-ioccur-style-keys) +(make-obsolete-variable 'helm-c-grep-use-ioccur-style-keys 'helm-grep-use-ioccur-style-keys "1.5.1") +(defvaralias 'helm-c-ctags-modes 'helm-ctags-modes) +(make-obsolete-variable 'helm-c-ctags-modes 'helm-ctags-modes "1.5.1") +(defvaralias 'helm-c-source-moccur 'helm-source-moccur) +(make-obsolete-variable 'helm-c-source-moccur 'helm-source-moccur "1.5.1") +(defvaralias 'helm-c-source-w3m-bookmarks 'helm-source-w3m-bookmarks) +(make-obsolete-variable 'helm-c-source-w3m-bookmarks 'helm-source-w3m-bookmarks "1.5.1") +(defvaralias 'helm-c-locate-command 'helm-locate-command) +(make-obsolete-variable 'helm-c-locate-command 'helm-locate-command "1.5.1") +(defvaralias 'helm-c-etags-tag-file-name 'helm-etags-tag-file-name) +(make-obsolete-variable 'helm-c-etags-tag-file-name 'helm-etags-tag-file-name "1.5.1") +(defvaralias 'helm-c-source-bookmarks-su 'helm-source-bookmarks-su) +(make-obsolete-variable 'helm-c-source-bookmarks-su 'helm-source-bookmarks-su "1.5.1") +(defvaralias 'helm-c-source-emms-streams 'helm-source-emms-streams) +(make-obsolete-variable 'helm-c-source-emms-streams 'helm-source-emms-streams "1.5.1") +(defvaralias 'helm-c-buffer-map 'helm-buffer-map) +(make-obsolete-variable 'helm-c-buffer-map 'helm-buffer-map "1.5.1") +(defvaralias 'helm-c-source-files-in-all-dired 'helm-source-files-in-all-dired) +(make-obsolete-variable 'helm-c-source-files-in-all-dired 'helm-source-files-in-all-dired "1.5.1") +(defvaralias 'helm-c-source-eshell-history 'helm-source-eshell-history) +(make-obsolete-variable 'helm-c-source-eshell-history 'helm-source-eshell-history "1.5.1") +(defvaralias 'helm-c-source-absolute-time-timers 'helm-source-absolute-time-timers) +(make-obsolete-variable 'helm-c-source-absolute-time-timers 'helm-source-absolute-time-timers "1.5.1") +(defvaralias 'helm-c-source-findutils 'helm-source-findutils) +(make-obsolete-variable 'helm-c-source-findutils 'helm-source-findutils "1.5.1") +(defvaralias 'helm-c-ucs-help-message 'helm-ucs-help-message) +(make-obsolete-variable 'helm-c-ucs-help-message 'helm-ucs-help-message "1.5.1") +(defvaralias 'helm-c-source-find-files 'helm-source-find-files) +(make-obsolete-variable 'helm-c-source-find-files 'helm-source-find-files "1.5.1") +(defvaralias 'helm-c-source-recentf 'helm-source-recentf) +(make-obsolete-variable 'helm-c-source-recentf 'helm-source-recentf "1.5.1") +(defvaralias 'helm-c-cache-world 'helm-cache-world) +(make-obsolete-variable 'helm-c-cache-world 'helm-cache-world "1.5.1") +(defvaralias 'helm-c-source-picklist 'helm-source-picklist) +(make-obsolete-variable 'helm-c-source-picklist 'helm-source-picklist "1.5.1") +(defvaralias 'helm-c-source-buffer-not-found 'helm-source-buffer-not-found) +(make-obsolete-variable 'helm-c-source-buffer-not-found 'helm-source-buffer-not-found "1.5.1") +(defvaralias 'helm-c-source-xrandr-change-resolution 'helm-source-xrandr-change-resolution) +(make-obsolete-variable 'helm-c-source-xrandr-change-resolution 'helm-source-xrandr-change-resolution "1.5.1") +(defvaralias 'helm-c-source-bookmark-w3m 'helm-source-bookmark-w3m) +(make-obsolete-variable 'helm-c-source-bookmark-w3m 'helm-source-bookmark-w3m "1.5.1") +(defvaralias 'helm-c-google-suggest-url 'helm-google-suggest-url) +(make-obsolete-variable 'helm-c-google-suggest-url 'helm-google-suggest-url "1.5.1") +(defvaralias 'helm-c-source-semantic 'helm-source-semantic) +(make-obsolete-variable 'helm-c-source-semantic 'helm-source-semantic "1.5.1") +(defvaralias 'helm-c-source-mark-ring 'helm-source-mark-ring) +(make-obsolete-variable 'helm-c-source-mark-ring 'helm-source-mark-ring "1.5.1") +(defvaralias 'helm-c-source-fixme 'helm-source-fixme) +(make-obsolete-variable 'helm-c-source-fixme 'helm-source-fixme "1.5.1") +(defvaralias 'helm-c-grep-preferred-ext 'helm-grep-preferred-ext) +(make-obsolete-variable 'helm-c-grep-preferred-ext 'helm-grep-preferred-ext "1.5.1") +(defvaralias 'helm-c-source-gentoo 'helm-source-gentoo) +(make-obsolete-variable 'helm-c-source-gentoo 'helm-source-gentoo "1.5.1") +(defvaralias 'helm-c-source-bookmarks 'helm-source-bookmarks) +(make-obsolete-variable 'helm-c-source-bookmarks 'helm-source-bookmarks "1.5.1") +(defvaralias 'helm-c-source-elisp-library-scan 'helm-source-elisp-library-scan) +(make-obsolete-variable 'helm-c-source-elisp-library-scan 'helm-source-elisp-library-scan "1.5.1") +(defvaralias 'helm-c-source-info-pages 'helm-source-info-pages) +(make-obsolete-variable 'helm-c-source-info-pages 'helm-source-info-pages "1.5.1") +(defvaralias 'helm-c-source-bookmark-gnus 'helm-source-bookmark-gnus) +(make-obsolete-variable 'helm-c-source-bookmark-gnus 'helm-source-bookmark-gnus "1.5.1") +(defvaralias 'helm-c-source-elscreen 'helm-source-elscreen) +(make-obsolete-variable 'helm-c-source-elscreen 'helm-source-elscreen "1.5.1") +(defvaralias 'helm-c-source-emacs-source-defun 'helm-source-emacs-source-defun) +(make-obsolete-variable 'helm-c-source-emacs-source-defun 'helm-source-emacs-source-defun "1.5.1") +(defvaralias 'helm-c-source-emacs-lisp-toplevels 'helm-source-emacs-lisp-toplevels) +(make-obsolete-variable 'helm-c-source-emacs-lisp-toplevels 'helm-source-emacs-lisp-toplevels "1.5.1") +(defvaralias 'helm-c-etags-mtime-alist 'helm-etags-mtime-alist) +(make-obsolete-variable 'helm-c-etags-mtime-alist 'helm-etags-mtime-alist "1.5.1") +(defvaralias 'helm-c-info-pages 'helm-info-pages) +(make-obsolete-variable 'helm-c-info-pages 'helm-info-pages "1.5.1") +(defvaralias 'helm-c-grep-default-recurse-command 'helm-grep-default-recurse-command) +(make-obsolete-variable 'helm-c-grep-default-recurse-command 'helm-grep-default-recurse-command "1.5.1") +(defvaralias 'helm-c-yaoddmuse-ew-cache 'helm-yaoddmuse-ew-cache) +(make-obsolete-variable 'helm-c-yaoddmuse-ew-cache 'helm-yaoddmuse-ew-cache "1.5.1") +(defvaralias 'helm-c-source-google-suggest 'helm-source-google-suggest) +(make-obsolete-variable 'helm-c-source-google-suggest 'helm-source-google-suggest "1.5.1") +(defvaralias 'helm-c-etags-tag-file-search-limit 'helm-etags-tag-file-search-limit) +(make-obsolete-variable 'helm-c-etags-tag-file-search-limit 'helm-etags-tag-file-search-limit "1.5.1") +(defvaralias 'helm-c-w3m-bookmarks-alist 'helm-w3m-bookmarks-alist) +(make-obsolete-variable 'helm-c-w3m-bookmarks-alist 'helm-w3m-bookmarks-alist "1.5.1") +(defvaralias 'helm-c-source-ff-file-name-history 'helm-source-ff-file-name-history) +(make-obsolete-variable 'helm-c-source-ff-file-name-history 'helm-source-ff-file-name-history "1.5.1") +(defvaralias 'helm-c-source-buffers-list 'helm-source-buffers-list) +(make-obsolete-variable 'helm-c-source-buffers-list 'helm-source-buffers-list "1.5.1") +(defvaralias 'helm-c-source-simple-call-tree-functions-callers 'helm-source-simple-call-tree-functions-callers) +(make-obsolete-variable 'helm-c-source-simple-call-tree-functions-callers 'helm-source-simple-call-tree-functions-callers "1.5.1") +(defvaralias 'helm-c-cached-imenu-alist 'helm-cached-imenu-alist) +(make-obsolete-variable 'helm-c-cached-imenu-alist 'helm-cached-imenu-alist "1.5.1") +(defvaralias 'helm-c-source-emacs-lisp-expectations 'helm-source-emacs-lisp-expectations) +(make-obsolete-variable 'helm-c-source-emacs-lisp-expectations 'helm-source-emacs-lisp-expectations "1.5.1") +(defvaralias 'helm-c-source-rd-headline 'helm-source-rd-headline) +(make-obsolete-variable 'helm-c-source-rd-headline 'helm-source-rd-headline "1.5.1") +(defvaralias 'helm-c-source-tracker-search 'helm-source-tracker-search) +(make-obsolete-variable 'helm-c-source-tracker-search 'helm-source-tracker-search "1.5.1") +(defvaralias 'helm-c-simple-call-tree-related-functions 'helm-simple-call-tree-related-functions) +(make-obsolete-variable 'helm-c-simple-call-tree-related-functions 'helm-simple-call-tree-related-functions "1.5.1") +(defvaralias 'helm-c-yaoddmuse-cache-file 'helm-yaoddmuse-cache-file) +(make-obsolete-variable 'helm-c-yaoddmuse-cache-file 'helm-yaoddmuse-cache-file "1.5.1") +(defvaralias 'helm-c-google-suggest-default-function 'helm-google-suggest-default-function) +(make-obsolete-variable 'helm-c-google-suggest-default-function 'helm-google-suggest-default-function "1.5.1") +(defvaralias 'helm-c-imenu-delimiter 'helm-imenu-delimiter) +(make-obsolete-variable 'helm-c-imenu-delimiter 'helm-imenu-delimiter "1.5.1") +(defvaralias 'helm-c-source-emacs-process 'helm-source-emacs-process) +(make-obsolete-variable 'helm-c-source-emacs-process 'helm-source-emacs-process "1.5.1") +(defvaralias 'helm-c-firefox-bookmarks-alist 'helm-firefox-bookmarks-alist) +(make-obsolete-variable 'helm-c-firefox-bookmarks-alist 'helm-firefox-bookmarks-alist "1.5.1") +(defvaralias 'helm-c-simple-call-tree-function-index 'helm-simple-call-tree-function-index) +(make-obsolete-variable 'helm-c-simple-call-tree-function-index 'helm-simple-call-tree-function-index "1.5.1") +(defvaralias 'helm-c-etags-map 'helm-etags-map) +(make-obsolete-variable 'helm-c-etags-map 'helm-etags-map "1.5.1") +(defvaralias 'helm-c-grep-history 'helm-grep-history) +(make-obsolete-variable 'helm-c-grep-history 'helm-grep-history "1.5.1") +(defvaralias 'helm-c-cached-imenu-tick 'helm-cached-imenu-tick) +(make-obsolete-variable 'helm-c-cached-imenu-tick 'helm-cached-imenu-tick "1.5.1") +(defvaralias 'helm-c-source-esh 'helm-source-esh) +(make-obsolete-variable 'helm-c-source-esh 'helm-source-esh "1.5.1") +(defvaralias 'helm-c-source-global-mark-ring 'helm-source-global-mark-ring) +(make-obsolete-variable 'helm-c-source-global-mark-ring 'helm-source-global-mark-ring "1.5.1") +(defvaralias 'helm-c-man-pages 'helm-man-pages) +(make-obsolete-variable 'helm-c-man-pages 'helm-man-pages "1.5.1") +(defvaralias 'helm-c-adaptative-done 'helm-adaptive-done) +(make-obsolete-variable 'helm-c-adaptative-done 'helm-adaptive-done "1.5.1") +(defvaralias 'helm-c-source-bbdb 'helm-source-bbdb) +(make-obsolete-variable 'helm-c-source-bbdb 'helm-source-bbdb "1.5.1") +(defvaralias 'helm-c-source-regexp 'helm-source-regexp) +(make-obsolete-variable 'helm-c-source-regexp 'helm-source-regexp "1.5.1") +(defvaralias 'helm-c-boring-file-regexp-list 'helm-boring-file-regexp-list) +(make-obsolete-variable 'helm-c-boring-file-regexp-list 'helm-boring-file-regexp-list "1.5.1") +(defvaralias 'helm-c-show-completion-use-special-display 'helm-show-completion-use-special-display) +(make-obsolete-variable 'helm-c-show-completion-use-special-display 'helm-show-completion-use-special-display "1.5.1") +(defvaralias 'helm-c-apt-query 'helm-apt-query) +(make-obsolete-variable 'helm-c-apt-query 'helm-apt-query "1.5.1") +(defvaralias 'helm-c-pdfgrep-default-read-command 'helm-pdfgrep-default-read-command) +(make-obsolete-variable 'helm-c-pdfgrep-default-read-command 'helm-pdfgrep-default-read-command "1.5.1") +(defvaralias 'helm-c-source-bookmark-images 'helm-source-bookmark-images) +(make-obsolete-variable 'helm-c-source-bookmark-images 'helm-source-bookmark-images "1.5.1") +(defvaralias 'helm-c-source-mac-spotlight 'helm-source-mac-spotlight) +(make-obsolete-variable 'helm-c-source-mac-spotlight 'helm-source-mac-spotlight "1.5.1") +(defvaralias 'helm-c-yahoo-suggest-url 'helm-yahoo-suggest-url) +(make-obsolete-variable 'helm-c-yahoo-suggest-url 'helm-yahoo-suggest-url "1.5.1") +(defvaralias 'helm-c-source-oddmuse-headline 'helm-source-oddmuse-headline) +(make-obsolete-variable 'helm-c-source-oddmuse-headline 'helm-source-oddmuse-headline "1.5.1") +(defvaralias 'helm-c-cache-gentoo 'helm-cache-gentoo) +(make-obsolete-variable 'helm-c-cache-gentoo 'helm-cache-gentoo "1.5.1") +(defvaralias 'helm-c-zgrep-recurse-flag 'helm-zgrep-recurse-flag) +(make-obsolete-variable 'helm-c-zgrep-recurse-flag 'helm-zgrep-recurse-flag "1.5.1") +(defvaralias 'helm-c-source-use-flags 'helm-source-use-flags) +(make-obsolete-variable 'helm-c-source-use-flags 'helm-source-use-flags "1.5.1") +(defvaralias 'helm-c-moccur-map 'helm-moccur-map) +(make-obsolete-variable 'helm-c-moccur-map 'helm-moccur-map "1.5.1") +(defvaralias 'helm-c-adaptative-history-file 'helm-adaptive-history-file) +(make-obsolete-variable 'helm-c-adaptative-history-file 'helm-adaptive-history-file "1.5.1") +(defvaralias 'helm-c-grep-default-directory-fn 'helm-grep-default-directory-fn) +(make-obsolete-variable 'helm-c-grep-default-directory-fn 'helm-grep-default-directory-fn "1.5.1") +(defvaralias 'helm-c-apt-input-history 'helm-apt-input-history) +(make-obsolete-variable 'helm-c-apt-input-history 'helm-apt-input-history "1.5.1") +(defvaralias 'helm-c-source-emms-files 'helm-source-emms-files) +(make-obsolete-variable 'helm-c-source-emms-files 'helm-source-emms-files "1.5.1") +(defvaralias 'helm-async-be-async 'dired-async-be-async) +(make-obsolete-variable 'helm-async-be-async 'dired-async-be-async "1.5.9") + + +(provide 'helm-aliases) + +;;; helm-aliases.el ends here diff --git a/elpa/helm-20140808.2300/helm-aliases.elc b/elpa/helm-20140808.2300/helm-aliases.elc new file mode 100644 index 000000000..1e23a7c5a Binary files /dev/null and b/elpa/helm-20140808.2300/helm-aliases.elc differ diff --git a/elpa/helm-20140808.2300/helm-apt.el b/elpa/helm-20140808.2300/helm-apt.el new file mode 100644 index 000000000..bd9bd1b2a --- /dev/null +++ b/elpa/helm-20140808.2300/helm-apt.el @@ -0,0 +1,272 @@ +;;; helm-apt.el --- Helm interface for Debian/Ubuntu packages (apt-*) -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) +(require 'helm-external) + +(declare-function term-line-mode "term") +(declare-function term-char-mode "term") +(declare-function term-send-input "term") +(declare-function term-send-eof "term") + + +(defgroup helm-apt nil + "Apt related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-apt-cache-show-function 'helm-apt-cache-show-1 + "Function of one argument used to show apt package. +Default is `helm-apt-cache-show-1' but you can use `apt-utils-show-package-1' +from `apt-utils.el' to have something more enhanced. +If nil default `helm-apt-cache-show-1' will be used." + :type 'function + :group 'helm-apt) + +(defface helm-apt-installed + '((t (:foreground "green"))) + "Face used for apt installed candidates." + :group 'helm-apt) + +(defface helm-apt-deinstalled + '((t (:foreground "DimGray"))) + "Face used for apt deinstalled candidates." + :group 'helm-apt) + + +(defvar helm-apt-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-apt-help) + (define-key map (kbd "M-I") 'helm-apt-show-only-installed) + (define-key map (kbd "M-U") 'helm-apt-show-only-not-installed) + (define-key map (kbd "M-D") 'helm-apt-show-only-deinstalled) + (define-key map (kbd "M-A") 'helm-apt-show-all) + map)) + + +(defvar helm-source-apt + `((name . "APT") + (init . helm-apt-init) + (candidates-in-buffer) + (candidate-transformer . helm-apt-candidate-transformer) + (display-to-real . helm-apt-display-to-real) + (update . helm-apt-refresh) + (keymap . ,helm-apt-map) + (mode-line . helm-apt-mode-line) + (action + ("Show package description" . helm-apt-cache-show) + ("Install package" . helm-apt-install) + ("Reinstall package" . helm-apt-reinstall) + ("Remove package" . helm-apt-uninstall) + ("Purge package" . helm-apt-purge)) + (persistent-action . helm-apt-persistent-action) + (persistent-help . "Show package description"))) + +(defvar helm-apt-search-command "apt-cache search '%s'") +(defvar helm-apt-show-command "apt-cache show '%s'") +(defvar helm-apt-installed-packages nil) +(defvar helm-apt-all-packages nil) +(defvar helm-apt-input-history nil) +(defvar helm-apt-show-only 'all) +(defvar helm-apt-term-buffer nil) + +(defun helm-apt-refresh () + "Refresh installed candidates list." + (setq helm-apt-installed-packages nil) + (setq helm-apt-all-packages nil)) + +(defun helm-apt-persistent-action (candidate) + "Persistent action for APT source." + (helm-apt-cache-show candidate)) + +(defun helm-apt-candidate-transformer (candidates) + "Show installed CANDIDATES and the ones to deinstall in a different color." + (cl-loop for cand in candidates + for name = (helm-apt-display-to-real cand) + for deinstall = (string= + (assoc-default name helm-apt-installed-packages) + "deinstall") + for install = (string= + (assoc-default name helm-apt-installed-packages) + "install") + for show = (cond ((and deinstall + (memq helm-apt-show-only '(all deinstalled))) + (propertize cand 'face 'helm-apt-deinstalled)) + ((and install + (memq helm-apt-show-only '(all installed))) + (propertize cand 'face 'helm-apt-installed)) + ((and (eq helm-apt-show-only 'noinstalled) + (not install)) cand) + ((eq helm-apt-show-only 'all) cand)) + when show collect show)) + +(defun helm-apt-show-only-installed () + (interactive) + (when helm-alive-p + (setq helm-apt-show-only 'installed) + (helm-update))) + +(defun helm-apt-show-only-not-installed () + (interactive) + (when helm-alive-p + (setq helm-apt-show-only 'noinstalled) + (helm-update))) + +(defun helm-apt-show-only-deinstalled () + (interactive) + (when helm-alive-p + (setq helm-apt-show-only 'deinstalled) + (helm-update))) + +(defun helm-apt-show-all () + (interactive) + (when helm-alive-p + (setq helm-apt-show-only 'all) + (helm-update))) + +(defun helm-apt-init () + "Initialize list of debian packages." + (let ((query "")) + (setq helm-apt-show-only 'all) + (unless (and helm-apt-installed-packages + helm-apt-all-packages) + (message "Loading package list...") + (setq helm-apt-installed-packages + (with-temp-buffer + (call-process-shell-command "dpkg --get-selections" + nil (current-buffer)) + (cl-loop for i in (split-string (buffer-string) "\n" t) + for p = (split-string i) + collect (cons (car p) (cadr p))))) + (helm-init-candidates-in-buffer + 'global + (setq helm-apt-all-packages + (with-temp-buffer + (call-process-shell-command + (format helm-apt-search-command query) + nil (current-buffer)) + (buffer-string)))) + (message "Loading package list done") + (sit-for 0.5)))) + +(defun helm-apt-display-to-real (line) + "Return only name of a debian package. +LINE is displayed like: +package name - description." + (car (split-string line " - "))) + +(defvar helm-apt-show-current-package nil) +(define-derived-mode helm-apt-show-mode + special-mode "helm-apt-show" + "Mode to display infos on apt packages.") + +(defun helm-apt-cache-show (package) + "Show information on apt package PACKAGE." + (if (and (functionp helm-apt-cache-show-function) + (not (eq helm-apt-cache-show-function + 'helm-apt-cache-show))) + ;; A function, call it. + (funcall helm-apt-cache-show-function package) + ;; nil or whatever use default. + (helm-apt-cache-show-1 package))) + +(defun helm-apt-cache-show-1 (package) + (let* ((command (format helm-apt-show-command package)) + (buf (get-buffer-create "*helm apt show*"))) + (helm-switch-to-buffer buf) + (unless (string= package helm-apt-show-current-package) + (let ((inhibit-read-only t)) + (erase-buffer) + (save-excursion + (call-process-shell-command + command nil (current-buffer) t)))) + (helm-apt-show-mode) + (set (make-local-variable 'helm-apt-show-current-package) + package))) + +(defun helm-apt-install (_package) + "Run 'apt-get install' shell command on PACKAGE." + (helm-apt-generic-action :action 'install)) + +(defun helm-apt-reinstall (_package) + "Run 'apt-get install --reinstall' shell command on PACKAGE." + (helm-apt-generic-action :action 'reinstall)) + +(defun helm-apt-uninstall (_package) + "Run 'apt-get remove' shell command on PACKAGE." + (helm-apt-generic-action :action 'uninstall)) + +(defun helm-apt-purge (_package) + "Run 'apt-get purge' shell command on PACKAGE." + (helm-apt-generic-action :action 'purge)) + +(cl-defun helm-apt-generic-action (&key action) + "Run 'apt-get ACTION'. +Support install, remove and purge actions." + (if (and helm-apt-term-buffer + (buffer-live-p (get-buffer helm-apt-term-buffer))) + (switch-to-buffer helm-apt-term-buffer) + (ansi-term (getenv "SHELL") "term apt") + (setq helm-apt-term-buffer (buffer-name))) + (term-line-mode) + (let ((command (cl-case action + (install "sudo apt-get install ") + (reinstall "sudo apt-get install --reinstall ") + (uninstall "sudo apt-get remove ") + (purge "sudo apt-get purge ") + (t (error "Unknown action")))) + (beg (point)) + end + (cand-list (mapconcat #'(lambda (x) (format "'%s'" x)) + (helm-marked-candidates) " "))) + (goto-char (point-max)) + (insert (concat command cand-list)) + (setq end (point)) + (if (y-or-n-p (format "%s package(s)" (symbol-name action))) + (progn + (setq helm-external-commands-list nil) + (setq helm-apt-installed-packages nil) + (term-char-mode) (term-send-input)) + (delete-region beg end)))) + +;;;###autoload +(defun helm-apt (arg) + "Preconfigured `helm' : frontend of APT package manager. +With a prefix arg reload cache." + (interactive "P") + (let ((query (read-string "Search Package: " nil 'helm-apt-input-history))) + (when arg (helm-apt-refresh)) + (helm :sources 'helm-source-apt + :prompt "Search Package: " + :input query + :buffer "*helm apt*" + :history 'helm-apt-input-history))) + + +(provide 'helm-apt) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-apt.el ends here diff --git a/elpa/helm-20140808.2300/helm-apt.elc b/elpa/helm-20140808.2300/helm-apt.elc new file mode 100644 index 000000000..255e31d94 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-apt.elc differ diff --git a/elpa/helm-20140808.2300/helm-autoloads.el b/elpa/helm-20140808.2300/helm-autoloads.el new file mode 100644 index 000000000..9690cf909 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-autoloads.el @@ -0,0 +1,1379 @@ +;;; helm-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (helm-other-buffer helm helm-debug-open-last-log +;;;;;; helm-define-key-with-subkeys helm-multi-key-defun helm-define-multi-key) +;;;;;; "helm" "helm.el" (21478 8076 0 0)) +;;; Generated autoloads from helm.el + +(autoload 'helm-define-multi-key "helm" "\ +In KEYMAP, define key sequence KEY for function list FUNCTIONS. +Each function run sequentialy each time the key KEY is pressed. +If DELAY is specified switch back to initial function of FUNCTIONS list +after DELAY seconds. +The functions in FUNCTIONS list are functions with no args. +e.g + (defun foo () + (message \"Run foo\")) + (defun bar () + (message \"Run bar\")) + (defun baz () + (message \"Run baz\")) + +\(helm-define-multi-key global-map \" q\" '(foo bar baz) 2) + +Each time \" q\" is pressed the next function is executed, if you wait +More than 2 seconds, next hit will run again the first function and so on. + +\(fn KEYMAP KEY FUNCTIONS &optional DELAY)" nil nil) + +(autoload 'helm-multi-key-defun "helm" "\ +Define NAME as a multi-key command running FUNS. +After DELAY seconds the FUNS list is reinitialised. +See `helm-define-multi-key'. + +\(fn NAME DOCSTRING FUNS &optional DELAY)" nil t) + +(put 'helm-multi-key-defun 'lisp-indent-function '2) + +(autoload 'helm-define-key-with-subkeys "helm" "\ +Allow defining a KEY without having to type its prefix again on next calls. +Arg MAP is the keymap to use, SUBKEY is the initial long keybinding to +call COMMAND. +Arg OTHER-SUBKEYS is an unquoted alist specifying other short keybindings +to use once started. +e.g: + +\(helm-define-key-with-subkeys global-map + (kbd \"C-x v n\") ?n 'git-gutter:next-hunk ((?p . 'git-gutter:previous-hunk))) + + +In this example, `C-x v n' will run `git-gutter:next-hunk' subsequent hit on \"n\" +will run this command again and subsequent hit on \"p\" will run `git-gutter:previous-hunk'. + +Arg MENU is a string to display in minibuffer to describe SUBKEY and OTHER-SUBKEYS. +Arg EXIT-FN specify a function to run on exit. + +Any other keys pressed run their assigned command defined in MAP and exit the loop. + +\(fn MAP KEY SUBKEY COMMAND &optional OTHER-SUBKEYS MENU EXIT-FN)" nil t) + +(autoload 'helm-debug-open-last-log "helm" "\ +Open helm log file of last helm session. +If `helm-last-log-file' is nil, switch to `helm-debug-buffer' . + +\(fn)" t nil) + +(autoload 'helm "helm" "\ +Main function to execute helm sources. + +Keywords supported: +:sources :input :prompt :resume :preselect +:buffer :keymap :default :history :allow-nest + +Extra LOCAL-VARS keywords are supported, see below. + +PLIST is a list like (:key1 val1 :key2 val2 ...) or +\(&optional sources input prompt resume + preselect buffer keymap default history). + +Basic keywords are the following: + +:sources + +A list of sources used for this session. It also accepts a +symbol, interpreted as a variable of a helm source +i.e (a symbol can be passed instead of a list of sources). +It also accepts an alist representing a helm source, which is +detected by (assq 'name ANY-SOURCES). +NOTE: In this case the source is embedded in the helm command and +have no symbol name, so it is not reachable from outside. +It will be referenced in `helm-sources' as a whole alist. + +:input + +Temporary value of `helm-pattern', ie. initial input of minibuffer. + +:prompt + +Prompt other than \"pattern: \". + +:resume + +If t, Resurrect previously instance of `helm'. Skip the initialization. +If 'noresume, this instance of `helm' cannot be resumed. + +:preselect + +Initially selected candidate. Specified by exact candidate or a regexp. + +:buffer + +`helm-buffer' instead of *helm*. + +:keymap + +`helm-map' for current `helm' session. + +:default + +A default argument that will be inserted in minibuffer with \\\\[next-history-element]. +When nil or not present `thing-at-point' will be used instead. +If `helm-maybe-use-default-as-input' is non--nil display will be +updated using :default arg as input unless :input is specified, +which in this case will take precedence on :default +This is a string or a list, in this case the car of the list will +be used as initial default input, but you will be able to cycle in this +list with \\\\[next-history-element]. + +:history + +By default all minibuffer input is pushed to `minibuffer-history', +if an argument HISTORY is provided, input will be pushed to HISTORY. +History element should be a symbol. + +:allow-nest + +Allow running this helm command within a running helm session. + +Of course, conventional arguments are supported, the two are same. + +\(helm :sources sources :input input :prompt prompt :resume resume + :preselect preselect :buffer buffer :keymap keymap :default default + :history history) + +and + +\(helm sources input prompt resume preselect buffer keymap default history) + +are the same. + +However the use of non keyword args is deprecated and should not be used. + +Other keywords are interpreted as local variables of this helm session. +The `helm-' prefix can be omitted. For example, + +\(helm :sources 'helm-source-buffers-list + :buffer \"*buffers*\" :candidate-number-limit 10) + +means starting helm session with `helm-source-buffers' +source in *buffers* buffer and set variable `helm-candidate-number-limit' +to 10 as session local variable. + +\(fn &key SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT HISTORY ALLOW-NEST OTHER-LOCAL-VARS)" nil nil) + +(autoload 'helm-other-buffer "helm" "\ +Simplified interface of `helm' with other `helm-buffer'. +Call `helm' with only ANY-SOURCES and ANY-BUFFER as args. + +\(fn ANY-SOURCES ANY-BUFFER)" nil nil) + +;;;*** + +;;;### (autoloads (helm-reset-adaptive-history) "helm-adaptive" "helm-adaptive.el" +;;;;;; (21478 8075 0 0)) +;;; Generated autoloads from helm-adaptive.el + +(autoload 'helm-reset-adaptive-history "helm-adaptive" "\ +Delete all `helm-adaptive-history' and his file. +Useful when you have a old or corrupted `helm-adaptive-history-file'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-apt) "helm-apt" "helm-apt.el" (21478 8075 +;;;;;; 0 0)) +;;; Generated autoloads from helm-apt.el + +(autoload 'helm-apt "helm-apt" "\ +Preconfigured `helm' : frontend of APT package manager. +With a prefix arg reload cache. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads (helm-bbdb) "helm-bbdb" "helm-bbdb.el" (21478 8075 +;;;;;; 0 0)) +;;; Generated autoloads from helm-bbdb.el + +(autoload 'helm-bbdb "helm-bbdb" "\ +Preconfigured `helm' for BBDB. + +Needs BBDB. + +http://bbdb.sourceforge.net/ + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-filtered-bookmarks helm-pp-bookmarks helm-bookmarks) +;;;;;; "helm-bookmark" "helm-bookmark.el" (21478 8075 0 0)) +;;; Generated autoloads from helm-bookmark.el + +(autoload 'helm-bookmarks "helm-bookmark" "\ +Preconfigured `helm' for bookmarks. + +\(fn)" t nil) + +(autoload 'helm-pp-bookmarks "helm-bookmark" "\ +Preconfigured `helm' for bookmarks (pretty-printed). + +\(fn)" t nil) + +(autoload 'helm-filtered-bookmarks "helm-bookmark" "\ +Preconfigured helm for bookmarks (filtered by category). +Optional source `helm-source-bookmark-addressbook' is loaded +only if external library addressbook-bookmark.el is available. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-buffers-list) "helm-buffers" "helm-buffers.el" +;;;;;; (21478 8076 0 0)) +;;; Generated autoloads from helm-buffers.el + +(autoload 'helm-buffers-list "helm-buffers" "\ +Preconfigured `helm' to list buffers. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-simple-call-tree) "helm-call-tree" "helm-call-tree.el" +;;;;;; (21478 8076 0 0)) +;;; Generated autoloads from helm-call-tree.el + +(autoload 'helm-simple-call-tree "helm-call-tree" "\ +Preconfigured `helm' for simple-call-tree. List function relationships. + +Needs simple-call-tree.el. +http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-colors) "helm-color" "helm-color.el" (21478 +;;;;;; 8076 0 0)) +;;; Generated autoloads from helm-color.el + +(autoload 'helm-colors "helm-color" "\ +Preconfigured `helm' for color. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-M-x) "helm-command" "helm-command.el" (21478 +;;;;;; 8075 0 0)) +;;; Generated autoloads from helm-command.el + +(autoload 'helm-M-x "helm-command" "\ +Preconfigured `helm' for Emacs commands. +It is `helm' replacement of regular `M-x' `execute-extended-command'. + +Unlike regular `M-x' emacs vanilla `execute-extended-command' command, +the prefix args if needed, are passed AFTER starting `helm-M-x'. + +You can get help on each command by persistent action. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-configuration) "helm-config" "helm-config.el" +;;;;;; (21478 8075 0 0)) +;;; Generated autoloads from helm-config.el + +(autoload 'helm-configuration "helm-config" "\ +Customize `helm'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-dabbrev) "helm-dabbrev" "helm-dabbrev.el" +;;;;;; (21478 8076 0 0)) +;;; Generated autoloads from helm-dabbrev.el + +(autoload 'helm-dabbrev "helm-dabbrev" "\ + + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-complex-command-history helm-timers helm-locate-library +;;;;;; helm-manage-advice helm-apropos helm-lisp-completion-or-file-name-at-point +;;;;;; helm-lisp-indent helm-complete-file-name-at-point helm-lisp-completion-at-point) +;;;;;; "helm-elisp" "helm-elisp.el" (21478 8075 0 0)) +;;; Generated autoloads from helm-elisp.el + +(autoload 'helm-lisp-completion-at-point "helm-elisp" "\ +Helm lisp symbol completion at point. + +\(fn)" t nil) + +(autoload 'helm-complete-file-name-at-point "helm-elisp" "\ +Complete file name at point. + +\(fn &optional FORCE)" t nil) + +(autoload 'helm-lisp-indent "helm-elisp" "\ + + +\(fn)" t nil) + +(autoload 'helm-lisp-completion-or-file-name-at-point "helm-elisp" "\ +Complete lisp symbol or filename at point. +Filename completion happen if string start after or between a double quote. + +\(fn)" t nil) + +(autoload 'helm-apropos "helm-elisp" "\ +Preconfigured helm to describe commands, functions, variables and faces. + +\(fn)" t nil) + +(autoload 'helm-manage-advice "helm-elisp" "\ +Preconfigured `helm' to disable/enable function advices. + +\(fn)" t nil) + +(autoload 'helm-locate-library "helm-elisp" "\ + + +\(fn)" t nil) + +(autoload 'helm-timers "helm-elisp" "\ +Preconfigured `helm' for timers. + +\(fn)" t nil) + +(autoload 'helm-complex-command-history "helm-elisp" "\ + + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-list-elisp-packages) "helm-elisp-package" +;;;;;; "helm-elisp-package.el" (21478 8075 0 0)) +;;; Generated autoloads from helm-elisp-package.el + +(autoload 'helm-list-elisp-packages "helm-elisp-package" "\ + + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads (helm-elscreen) "helm-elscreen" "helm-elscreen.el" +;;;;;; (21478 8075 0 0)) +;;; Generated autoloads from helm-elscreen.el + +(autoload 'helm-elscreen "helm-elscreen" "\ +Preconfigured helm to list elscreen. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-emms) "helm-emms" "helm-emms.el" (21478 8075 +;;;;;; 0 0)) +;;; Generated autoloads from helm-emms.el + +(autoload 'helm-emms "helm-emms" "\ +Preconfigured `helm' for emms sources. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-eshell-history helm-esh-pcomplete) "helm-eshell" +;;;;;; "helm-eshell.el" (21478 8076 0 0)) +;;; Generated autoloads from helm-eshell.el + +(autoload 'helm-esh-pcomplete "helm-eshell" "\ +Preconfigured helm to provide helm completion in eshell. + +\(fn)" t nil) + +(autoload 'helm-eshell-history "helm-eshell" "\ +Preconfigured helm for eshell history. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-calcul-expression helm-eval-expression-with-eldoc +;;;;;; helm-eval-expression) "helm-eval" "helm-eval.el" (21478 8075 +;;;;;; 0 0)) +;;; Generated autoloads from helm-eval.el + +(autoload 'helm-eval-expression "helm-eval" "\ +Preconfigured helm for `helm-source-evaluation-result'. + +\(fn ARG)" t nil) + +(autoload 'helm-eval-expression-with-eldoc "helm-eval" "\ +Preconfigured helm for `helm-source-evaluation-result' with `eldoc' support. + +\(fn)" t nil) + +(autoload 'helm-calcul-expression "helm-eval" "\ +Preconfigured helm for `helm-source-calculation-result'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-run-external-command) "helm-external" "helm-external.el" +;;;;;; (21478 8076 0 0)) +;;; Generated autoloads from helm-external.el + +(autoload 'helm-run-external-command "helm-external" "\ +Preconfigured `helm' to run External PROGRAM asyncronously from Emacs. +If program is already running exit with error. +You can set your own list of commands with +`helm-external-commands-list'. + +\(fn PROGRAM)" t nil) + +;;;*** + +;;;### (autoloads (helm-recentf helm-for-files helm-find-files helm-find +;;;;;; helm-browse-project) "helm-files" "helm-files.el" (21478 +;;;;;; 8075 0 0)) +;;; Generated autoloads from helm-files.el + +(autoload 'helm-browse-project "helm-files" "\ +Browse files and see status of project with its vcs. +Only hg and git are supported for now. +Fall back to `helm-find-files' if directory is not under +control of one of those vcs. +Need dependencies: + +and +. + +\(fn)" t nil) + +(autoload 'helm-find "helm-files" "\ +Preconfigured `helm' for the find shell command. + +\(fn ARG)" t nil) + +(autoload 'helm-find-files "helm-files" "\ +Preconfigured `helm' for helm implementation of `find-file'. +Called with a prefix arg show history if some. +Don't call it from programs, use `helm-find-files-1' instead. +This is the starting point for nearly all actions you can do on files. + +\(fn ARG)" t nil) + +(autoload 'helm-for-files "helm-files" "\ +Preconfigured `helm' for opening files. +Run all sources defined in `helm-for-files-preferred-list'. + +\(fn)" t nil) + +(autoload 'helm-recentf "helm-files" "\ +Preconfigured `helm' for `recentf'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-firefox-bookmarks) "helm-firefox" "helm-firefox.el" +;;;;;; (21478 8076 0 0)) +;;; Generated autoloads from helm-firefox.el + +(autoload 'helm-firefox-bookmarks "helm-firefox" "\ +Preconfigured `helm' for firefox bookmark. +You will have to enable html bookmarks in firefox: +open about:config in firefox and double click on this line to enable value to true: + +user_pref(\"browser.bookmarks.autoExportHTML\", false); + +You should have now: + +user_pref(\"browser.bookmarks.autoExportHTML\", true); + +After closing firefox, you will be able to browse you bookmarks. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-ucs helm-select-xfont) "helm-font" "helm-font.el" +;;;;;; (21478 8075 0 0)) +;;; Generated autoloads from helm-font.el + +(autoload 'helm-select-xfont "helm-font" "\ +Preconfigured `helm' to select Xfont. + +\(fn)" t nil) + +(autoload 'helm-ucs "helm-font" "\ +Preconfigured helm for `ucs-names' math symbols. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-gentoo) "helm-gentoo" "helm-gentoo.el" (21478 +;;;;;; 8076 0 0)) +;;; Generated autoloads from helm-gentoo.el + +(autoload 'helm-gentoo "helm-gentoo" "\ +Preconfigured `helm' for gentoo linux. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-do-pdfgrep helm-do-zgrep helm-do-grep helm-grep-mode-jump-other-window +;;;;;; helm-grep-mode-jump-other-window-backward helm-grep-mode-jump-other-window-forward +;;;;;; helm-grep-mode-jump helm-gm-precedent-file helm-gm-next-file +;;;;;; helm-grep-mode helm-grep-run-save-buffer helm-goto-next-file +;;;;;; helm-goto-precedent-file) "helm-grep" "helm-grep.el" (21478 +;;;;;; 8075 0 0)) +;;; Generated autoloads from helm-grep.el + +(autoload 'helm-goto-precedent-file "helm-grep" "\ +Go to precedent file in helm grep/etags buffers. + +\(fn)" t nil) + +(autoload 'helm-goto-next-file "helm-grep" "\ +Go to precedent file in helm grep/etags buffers. + +\(fn)" t nil) + +(autoload 'helm-grep-run-save-buffer "helm-grep" "\ +Run grep save results action from `helm-do-grep-1'. + +\(fn)" t nil) + +(autoload 'helm-grep-mode "helm-grep" "\ +Major mode to provide actions in helm grep saved buffer. + +Special commands: +\\{helm-grep-mode-map} + +\(fn)" t nil) + +(autoload 'helm-gm-next-file "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-gm-precedent-file "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-mode-jump "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-mode-jump-other-window-forward "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-mode-jump-other-window-backward "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-mode-jump-other-window "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-do-grep "helm-grep" "\ +Preconfigured helm for grep. +Contrarily to Emacs `grep', no default directory is given, but +the full path of candidates in ONLY. +That allow to grep different files not only in `default-directory' but anywhere +by marking them (C-). If one or more directory is selected +grep will search in all files of these directories. +You can also use wildcard in the base name of candidate. +If a prefix arg is given use the -r option of grep (recurse). +The prefix arg can be passed before or after start file selection. +See also `helm-do-grep-1'. + +\(fn)" t nil) + +(autoload 'helm-do-zgrep "helm-grep" "\ +Preconfigured helm for zgrep. + +\(fn)" t nil) + +(autoload 'helm-do-pdfgrep "helm-grep" "\ +Preconfigured helm for pdfgrep. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-describe-helm-attribute helm-semantic-help +;;;;;; helm-color-help helm-imenu-help helm-M-x-help helm-el-package-help +;;;;;; helm-apt-help helm-top-help helm-moccur-help helm-buffers-ido-virtual-help +;;;;;; helm-esh-help helm-bookmark-help helm-ucs-help helm-etags-help +;;;;;; helm-pdfgrep-help helm-grep-help helm-generic-file-help helm-read-file-name-help +;;;;;; helm-ff-help helm-buffer-help helm-help) "helm-help" "helm-help.el" +;;;;;; (21478 8075 0 0)) +;;; Generated autoloads from helm-help.el + +(autoload 'helm-help "helm-help" "\ +Help of `helm'. + +\(fn)" t nil) + +(autoload 'helm-buffer-help "helm-help" "\ +Help command for helm buffers. + +\(fn)" t nil) + +(autoload 'helm-ff-help "helm-help" "\ +Help command for `helm-find-files'. + +\(fn)" t nil) + +(autoload 'helm-read-file-name-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-generic-file-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-pdfgrep-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-etags-help "helm-help" "\ +The help function for etags. + +\(fn)" t nil) + +(autoload 'helm-ucs-help "helm-help" "\ +Help command for `helm-ucs'. + +\(fn)" t nil) + +(autoload 'helm-bookmark-help "helm-help" "\ +Help command for bookmarks. + +\(fn)" t nil) + +(autoload 'helm-esh-help "helm-help" "\ +Help command for `helm-find-files-eshell-command-on-file'. + +\(fn)" t nil) + +(autoload 'helm-buffers-ido-virtual-help "helm-help" "\ +Help command for ido virtual buffers. + +\(fn)" t nil) + +(autoload 'helm-moccur-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-top-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-apt-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-el-package-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-M-x-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-imenu-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-color-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-semantic-help "helm-help" "\ + + +\(fn)" t nil) + +(defvar helm-buffer-mode-line-string '("Buffer(s)" "\\\\[helm-buffer-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "String displayed in mode-line in `helm-source-buffers-list'")) + +(defvar helm-color-mode-line-string '("Colors" "\\\\[helm-color-help]:Help/\\[helm-color-run-insert-name]:Insert name/\\[helm-color-run-insert-rgb]:Insert RGB/with shift: Kill")) + +(defvar helm-buffers-ido-virtual-mode-line-string '("Killed Buffer(s)" "\\\\[helm-buffers-ido-virtual-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "String displayed in mode-line in `helm-source-buffers-list'")) + +(defvar helm-ff-mode-line-string "\\\\[helm-ff-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "\ +String displayed in mode-line in `helm-source-find-files'") + +(defvar helm-read-file-name-mode-line-string "\\\\[helm-read-file-name-help]:Help \\[helm-cr-empty-string]:Empty \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "\ +String displayed in mode-line in `helm-source-find-files'.") + +(defvar helm-generic-file-mode-line-string "\\\\[helm-generic-file-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend" "\ +String displayed in mode-line in Locate.") + +(defvar helm-grep-mode-line-string "\\\\[helm-grep-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend" "\ +String displayed in mode-line in `helm-do-grep'.") + +(defvar helm-pdfgrep-mode-line-string "\\\\[helm-pdfgrep-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend" "\ +String displayed in mode-line in `helm-do-pdfgrep'.") + +(defvar helm-etags-mode-line-string "\\\\[helm-etags-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "\ +String displayed in mode-line in `helm-etags-select'.") + +(defvar helm-ucs-mode-line-string "\\\\[helm-ucs-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "\ +String displayed in mode-line in `helm-ucs'.") + +(defvar helm-bookmark-mode-line-string '("Bookmark(s)" "\\\\[helm-bookmark-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct") "\ +String displayed in mode-line in `helm-source-buffers-list'") + +(defvar helm-occur-mode-line "\\\\[helm-help]:Help \\\\[helm-occur-run-query-replace-regexp]:Query replace regexp \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-moccur-mode-line "\\\\[helm-moccur-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-comp-read-mode-line "\\\\[helm-cr-empty-string]:Empty \\\\[helm-help]:Help \\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct") + +(defvar helm-top-mode-line "\\\\[helm-top-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-apt-mode-line "\\\\[helm-apt-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-el-package-mode-line "\\\\[helm-el-package-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-M-x-mode-line "\\\\[helm-M-x-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-imenu-mode-line "\\\\[helm-imenu-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-semantic-mode-line "\\\\[helm-semantic-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(autoload 'helm-describe-helm-attribute "helm-help" "\ +Display the full documentation of HELM-ATTRIBUTE. +HELM-ATTRIBUTE should be a symbol. + +\(fn HELM-ATTRIBUTE)" t nil) + +;;;*** + +;;;### (autoloads (helm-imenu) "helm-imenu" "helm-imenu.el" (21478 +;;;;;; 8075 0 0)) +;;; Generated autoloads from helm-imenu.el + +(autoload 'helm-imenu "helm-imenu" "\ +Preconfigured `helm' for `imenu'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-info-at-point) "helm-info" "helm-info.el" +;;;;;; (21478 8075 0 0)) +;;; Generated autoloads from helm-info.el + +(autoload 'helm-info-at-point "helm-info" "\ +Preconfigured `helm' for searching info at point. +With a prefix-arg insert symbol at point. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-locate helm-locate-read-file-name) "helm-locate" +;;;;;; "helm-locate.el" (21478 8075 0 0)) +;;; Generated autoloads from helm-locate.el + +(autoload 'helm-locate-read-file-name "helm-locate" "\ + + +\(fn PROMPT)" nil nil) + +(autoload 'helm-locate "helm-locate" "\ +Preconfigured `helm' for Locate. +Note: you can add locate options after entering pattern. +See 'man locate' for valid options and also `helm-locate-command'. + +You can specify a local database with prefix argument ARG. +With two prefix arg, refresh the current local db or create it +if it doesn't exists. +Many databases can be used: navigate and mark them. +See also `helm-locate-with-db'. + +To create a user specific db, use +\"updatedb -l 0 -o db_path -U directory\". +Where db_path is a filename matched by +`helm-locate-db-file-regexp'. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads (helm-man-woman) "helm-man" "helm-man.el" (21478 +;;;;;; 8076 0 0)) +;;; Generated autoloads from helm-man.el + +(autoload 'helm-man-woman "helm-man" "\ +Preconfigured `helm' for Man and Woman pages. +With a prefix arg reinitialize the cache. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads (helm-match-plugin-mode) "helm-match-plugin" "helm-match-plugin.el" +;;;;;; (21478 8076 0 0)) +;;; Generated autoloads from helm-match-plugin.el + +(defvar helm-match-plugin-mode nil "\ +Non-nil if Helm-Match-Plugin mode is enabled. +See the command `helm-match-plugin-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `helm-match-plugin-mode'.") + +(custom-autoload 'helm-match-plugin-mode "helm-match-plugin" nil) + +(autoload 'helm-match-plugin-mode "helm-match-plugin" "\ +Add more flexible regexp matching for helm. +See `helm-mp-matching-method' for the behavior of each method. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads (helm-comint-input-ring helm-minibuffer-history +;;;;;; helm-mini helm-stumpwm-commands helm-ratpoison-commands helm-eev-anchors +;;;;;; helm-insert-latex-math helm-world-time helm-browse-menubar) +;;;;;; "helm-misc" "helm-misc.el" (21478 8076 0 0)) +;;; Generated autoloads from helm-misc.el + +(autoload 'helm-browse-menubar "helm-misc" "\ +Helm interface to the menubar using lacarte.el. + +\(fn)" t nil) + +(autoload 'helm-world-time "helm-misc" "\ +Preconfigured `helm' to show world time. + +\(fn)" t nil) + +(autoload 'helm-insert-latex-math "helm-misc" "\ +Preconfigured helm for latex math symbols completion. + +\(fn)" t nil) + +(autoload 'helm-eev-anchors "helm-misc" "\ +Preconfigured `helm' for eev anchors. + +\(fn)" t nil) + +(autoload 'helm-ratpoison-commands "helm-misc" "\ +Preconfigured `helm' to execute ratpoison commands. + +\(fn)" t nil) + +(autoload 'helm-stumpwm-commands "helm-misc" "\ + + +\(fn)" t nil) + +(autoload 'helm-mini "helm-misc" "\ +Preconfigured `helm' lightweight version (buffer -> recentf). + +\(fn)" t nil) + +(autoload 'helm-minibuffer-history "helm-misc" "\ +Preconfigured `helm' for `minibuffer-history'. + +\(fn)" t nil) + +(autoload 'helm-comint-input-ring "helm-misc" "\ +Predefined `helm' that provide completion of `comint' history. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-mode helm-comp-read) "helm-mode" "helm-mode.el" +;;;;;; (21478 8076 0 0)) +;;; Generated autoloads from helm-mode.el + +(autoload 'helm-comp-read "helm-mode" "\ +Read a string in the minibuffer, with helm completion. + +It is helm `completing-read' equivalent. + +- PROMPT is the prompt name to use. + +- COLLECTION can be a list, vector, obarray or hash-table. + It can be also a function that receives three arguments: + the values string, predicate and t. See `all-completions' for more details. + +Keys description: + +- TEST: A predicate called with one arg i.e candidate. + +- INITIAL-INPUT: Same as input arg in `helm'. + +- PRESELECT: See preselect arg of `helm'. + +- DEFAULT: This option is used only for compatibility with regular + Emacs `completing-read' (Same as DEFAULT arg of `completing-read'). + +- BUFFER: Name of helm-buffer. + +- MUST-MATCH: Candidate selected must be one of COLLECTION. + +- REVERSE-HISTORY: When non--nil display history source after current + source completion. + +- REQUIRES-PATTERN: Same as helm attribute, default is 0. + +- HISTORY: A list containing specific history, default is nil. + When it is non--nil, all elements of HISTORY are displayed in + a special source before COLLECTION. + +- INPUT-HISTORY: A symbol. the minibuffer input history will be + stored there, if nil or not provided, `minibuffer-history' + will be used instead. + +- CASE-FOLD: Same as `helm-case-fold-search'. + +- DEL-INPUT: Boolean, when non--nil (default) remove the partial + minibuffer input from HISTORY is present. + +- PERSISTENT-ACTION: A function called with one arg i.e candidate. + +- PERSISTENT-HELP: A string to document PERSISTENT-ACTION. + +- MODE-LINE: A string or list to display in mode line. + Default is `helm-comp-read-mode-line'. + +- KEYMAP: A keymap to use in this `helm-comp-read'. + (the keymap will be shared with history source) + +- NAME: The name related to this local source. + +- EXEC-WHEN-ONLY-ONE: Bound `helm-execute-action-at-once-if-one' + to non--nil. (possibles values are t or nil). + +- VOLATILE: Use volatile attribute (enabled by default). + +- SORT: A predicate to give to `sort' e.g `string-lessp'. + +- FC-TRANSFORMER: A `filtered-candidate-transformer' function. + +- MARKED-CANDIDATES: If non--nil return candidate or marked candidates as a list. + +- NOMARK: When non--nil don't allow marking candidates. + +- ALISTP: (default is non--nil) See `helm-comp-read-get-candidates'. + +- CANDIDATES-IN-BUFFER: when non--nil use a source build with + `helm-candidates-in-buffer' which is much faster. + Argument VOLATILE have no effect when CANDIDATES-IN-BUFFER is non--nil. + +Any prefix args passed during `helm-comp-read' invocation will be recorded +in `helm-current-prefix-arg', otherwise if prefix args were given before +`helm-comp-read' invocation, the value of `current-prefix-arg' will be used. +That's mean you can pass prefix args before or after calling a command +that use `helm-comp-read' See `helm-M-x' for example. + +\(fn PROMPT COLLECTION &key TEST INITIAL-INPUT DEFAULT PRESELECT (buffer \"*Helm Completions*\") MUST-MATCH REVERSE-HISTORY (requires-pattern 0) HISTORY INPUT-HISTORY (case-fold helm-comp-read-case-fold-search) (del-input t) (persistent-action nil) (persistent-help \"DoNothing\") (mode-line helm-comp-read-mode-line) (keymap helm-comp-read-map) (name \"Helm Completions\") CANDIDATES-IN-BUFFER EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND (volatile t) SORT (fc-transformer (quote helm-cr-default-transformer)) MARKED-CANDIDATES NOMARK (alistp t))" nil nil) + +(defvar helm-mode nil "\ +Non-nil if Helm mode is enabled. +See the command `helm-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `helm-mode'.") + +(custom-autoload 'helm-mode "helm-mode" nil) + +(autoload 'helm-mode "helm-mode" "\ +Toggle generic helm completion. + +All functions in Emacs that use `completing-read' +or `read-file-name' and friends will use helm interface +when this mode is turned on. +However you can modify this behavior for functions of your choice +with `helm-completing-read-handlers-alist'. + +Called with a positive arg, turn on unconditionally, with a +negative arg turn off. +You can turn it on with `helm-mode'. + +Some crap emacs functions may not be supported, +e.g `ffap-alternate-file' and maybe others +You can add such functions to `helm-completing-read-handlers-alist' +with a nil value. + +Note: This mode is incompatible with Emacs23. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads (helm-wikipedia-suggest helm-yahoo-suggest helm-google-suggest +;;;;;; helm-surfraw) "helm-net" "helm-net.el" (21478 8075 0 0)) +;;; Generated autoloads from helm-net.el + +(autoload 'helm-surfraw "helm-net" "\ +Preconfigured `helm' to search PATTERN with search ENGINE. + +\(fn PATTERN ENGINE)" t nil) + +(autoload 'helm-google-suggest "helm-net" "\ +Preconfigured `helm' for google search with google suggest. + +\(fn)" t nil) + +(autoload 'helm-yahoo-suggest "helm-net" "\ +Preconfigured `helm' for Yahoo searching with Yahoo suggest. + +\(fn)" t nil) + +(autoload 'helm-wikipedia-suggest "helm-net" "\ +Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-org-headlines helm-org-keywords) "helm-org" +;;;;;; "helm-org.el" (21478 8075 0 0)) +;;; Generated autoloads from helm-org.el + +(autoload 'helm-org-keywords "helm-org" "\ +Preconfigured `helm' for org keywords. + +\(fn)" t nil) + +(autoload 'helm-org-headlines "helm-org" "\ +Preconfigured helm to show org headlines. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-multi-occur-from-isearch helm-multi-occur +;;;;;; helm-occur-from-isearch helm-occur helm-regexp helm-moccur-mode +;;;;;; helm-moccur-run-save-buffer helm-occur-match-plugin-mode) +;;;;;; "helm-regexp" "helm-regexp.el" (21478 8075 0 0)) +;;; Generated autoloads from helm-regexp.el + +(defvar helm-occur-match-plugin-mode t "\ +Non-nil if Helm-Occur-Match-Plugin mode is enabled. +See the command `helm-occur-match-plugin-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `helm-occur-match-plugin-mode'.") + +(custom-autoload 'helm-occur-match-plugin-mode "helm-regexp" nil) + +(autoload 'helm-occur-match-plugin-mode "helm-regexp" "\ +Turn On/Off `helm-match-plugin-mode' only for `helm-m/occur'. + +\(fn &optional ARG)" t nil) + +(autoload 'helm-moccur-run-save-buffer "helm-regexp" "\ +Run grep save results action from `helm-do-grep-1'. + +\(fn)" t nil) + +(autoload 'helm-moccur-mode "helm-regexp" "\ +Major mode to provide actions in helm moccur saved buffer. + +Special commands: +\\{helm-moccur-mode-map} + +\(fn)" t nil) + +(autoload 'helm-regexp "helm-regexp" "\ +Preconfigured helm to build regexps. +`query-replace-regexp' can be run from there against found regexp. + +\(fn)" t nil) + +(autoload 'helm-occur "helm-regexp" "\ +Preconfigured helm for Occur. + +\(fn)" t nil) + +(autoload 'helm-occur-from-isearch "helm-regexp" "\ +Invoke `helm-occur' from isearch. + +\(fn)" t nil) + +(autoload 'helm-multi-occur "helm-regexp" "\ +Preconfigured helm for multi occur. + + BUFFERS is a list of buffers to search through. +With a prefix arg, reverse the behavior of +`helm-moccur-always-search-in-current'. +The prefix arg can be set before calling `helm-multi-occur' +or during the buffer selection. + +\(fn BUFFERS)" t nil) + +(autoload 'helm-multi-occur-from-isearch "helm-regexp" "\ +Invoke `helm-multi-occur' from isearch. + +With a prefix arg, reverse the behavior of +`helm-moccur-always-search-in-current'. +The prefix arg can be set before calling +`helm-multi-occur-from-isearch' or during the buffer selection. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads (helm-show-kill-ring helm-register helm-all-mark-rings +;;;;;; helm-global-mark-ring helm-mark-ring) "helm-ring" "helm-ring.el" +;;;;;; (21478 8075 0 0)) +;;; Generated autoloads from helm-ring.el + +(autoload 'helm-mark-ring "helm-ring" "\ +Preconfigured `helm' for `helm-source-mark-ring'. + +\(fn)" t nil) + +(autoload 'helm-global-mark-ring "helm-ring" "\ +Preconfigured `helm' for `helm-source-global-mark-ring'. + +\(fn)" t nil) + +(autoload 'helm-all-mark-rings "helm-ring" "\ +Preconfigured `helm' for `helm-source-global-mark-ring' and `helm-source-mark-ring'. + +\(fn)" t nil) + +(autoload 'helm-register "helm-ring" "\ +Preconfigured `helm' for Emacs registers. + +\(fn)" t nil) + +(autoload 'helm-show-kill-ring "helm-ring" "\ +Preconfigured `helm' for `kill-ring'. +It is drop-in replacement of `yank-pop'. + +First call open the kill-ring browser, next calls move to next line. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-semantic-or-imenu helm-semantic) "helm-semantic" +;;;;;; "helm-semantic.el" (21478 8076 0 0)) +;;; Generated autoloads from helm-semantic.el + +(autoload 'helm-semantic "helm-semantic" "\ +Preconfigured `helm' for `semantic'. + +\(fn)" t nil) + +(autoload 'helm-semantic-or-imenu "helm-semantic" "\ +Run `helm' with `semantic' or `imenu'. + +If `semantic-mode' is active in the current buffer, then use +semantic for generating tags, otherwise fall back to `imenu'. +Fill in the symbol at point by default. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-xrandr-set helm-list-emacs-process helm-top +;;;;;; helm-top-run-sort-by-user helm-top-run-sort-by-mem helm-top-run-sort-by-cpu +;;;;;; helm-top-run-sort-by-com) "helm-sys" "helm-sys.el" (21478 +;;;;;; 8075 0 0)) +;;; Generated autoloads from helm-sys.el + +(autoload 'helm-top-run-sort-by-com "helm-sys" "\ + + +\(fn)" t nil) + +(autoload 'helm-top-run-sort-by-cpu "helm-sys" "\ + + +\(fn)" t nil) + +(autoload 'helm-top-run-sort-by-mem "helm-sys" "\ + + +\(fn)" t nil) + +(autoload 'helm-top-run-sort-by-user "helm-sys" "\ + + +\(fn)" t nil) + +(autoload 'helm-top "helm-sys" "\ +Preconfigured `helm' for top command. + +\(fn)" t nil) + +(autoload 'helm-list-emacs-process "helm-sys" "\ +Preconfigured `helm' for emacs process. + +\(fn)" t nil) + +(autoload 'helm-xrandr-set "helm-sys" "\ + + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-etags-select) "helm-tags" "helm-tags.el" +;;;;;; (21478 8076 0 0)) +;;; Generated autoloads from helm-tags.el + +(autoload 'helm-etags-select "helm-tags" "\ +Preconfigured helm for etags. +If called with a prefix argument or if any of the tag files have +been modified, reinitialize cache. + +This function aggregates three sources of tag files: + + 1) An automatically located file in the parent directories, by `helm-etags-get-tag-file'. + 2) `tags-file-name', which is commonly set by `find-tag' command. + 3) `tags-table-list' which is commonly set by `visit-tags-table' command. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads (helm-yank-text-at-point helm-w32-shell-execute-open-file +;;;;;; helm-quit-and-find-file helm-display-all-sources helm-show-all-in-this-source-only) +;;;;;; "helm-utils" "helm-utils.el" (21478 8075 0 0)) +;;; Generated autoloads from helm-utils.el + +(autoload 'helm-show-all-in-this-source-only "helm-utils" "\ +Show only current source of this helm session with all its candidates. +With a numeric prefix arg show only the ARG number of candidates. + +\(fn ARG)" t nil) + +(autoload 'helm-display-all-sources "helm-utils" "\ +Display all sources previously hidden by `helm-set-source-filter'. + +\(fn)" t nil) + +(autoload 'helm-quit-and-find-file "helm-utils" "\ +Drop into `helm-find-files' from `helm'. +If current selection is a buffer or a file, `helm-find-files' +from its directory. + +\(fn)" t nil) + +(autoload 'helm-w32-shell-execute-open-file "helm-utils" "\ + + +\(fn FILE)" t nil) + +(autoload 'helm-yank-text-at-point "helm-utils" "\ +Yank text at point in `helm-current-buffer' into minibuffer. +If `helm-yank-symbol-first' is non--nil the first yank +grabs the entire symbol. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-w3m-bookmarks) "helm-w3m" "helm-w3m.el" (21478 +;;;;;; 8076 0 0)) +;;; Generated autoloads from helm-w3m.el + +(autoload 'helm-w3m-bookmarks "helm-w3m" "\ +Preconfigured `helm' for w3m bookmark. + +Needs w3m and emacs-w3m. + +http://w3m.sourceforge.net/ +http://emacs-w3m.namazu.org/ + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads (helm-yaoddmuse-emacswiki-post-library helm-yaoddmuse-emacswiki-edit-or-view +;;;;;; helm-yaoddmuse-cache-pages) "helm-yaoddmuse" "helm-yaoddmuse.el" +;;;;;; (21478 8075 0 0)) +;;; Generated autoloads from helm-yaoddmuse.el + +(autoload 'helm-yaoddmuse-cache-pages "helm-yaoddmuse" "\ +Fetch the list of files on emacswiki and create cache file. +If load is non--nil load the file and feed `yaoddmuse-pages-hash'. + +\(fn &optional LOAD)" t nil) + +(autoload 'helm-yaoddmuse-emacswiki-edit-or-view "helm-yaoddmuse" "\ +Preconfigured `helm' to edit or view EmacsWiki page. + +Needs yaoddmuse.el. + +http://www.emacswiki.org/emacs/download/yaoddmuse.el + +\(fn)" t nil) + +(autoload 'helm-yaoddmuse-emacswiki-post-library "helm-yaoddmuse" "\ +Preconfigured `helm' to post library to EmacsWiki. + +Needs yaoddmuse.el. + +http://www.emacswiki.org/emacs/download/yaoddmuse.el + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("helm-aliases.el" "helm-pkg.el" "helm-plugin.el") +;;;;;; (21478 8076 587905 0)) + +;;;*** + +(provide 'helm-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; helm-autoloads.el ends here diff --git a/elpa/helm-20140808.2300/helm-bbdb.el b/elpa/helm-20140808.2300/helm-bbdb.el new file mode 100644 index 000000000..abe00a5dd --- /dev/null +++ b/elpa/helm-20140808.2300/helm-bbdb.el @@ -0,0 +1,185 @@ +;;; helm-bbdb.el --- Helm interface for bbdb -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-mode) + +(defvar bbdb-records) +(defvar bbdb-buffer-name) + +(declare-function bbdb "ext:bbdb-com") +(declare-function bbdb-current-record "ext:bbdb-com") +(declare-function bbdb-redisplay-one-record "ext:bbdb-com") +(declare-function bbdb-record-net "ext:bbdb-com" (string) t) +(declare-function bbdb-current-record "ext:bbdb-com") +(declare-function bbdb-dwim-net-address "ext:bbdb-com") +(declare-function bbdb-records "ext:bbdb-com" + (&optional dont-check-disk already-in-db-buffer)) +(declare-function bbdb-label-completion-list "ext:bbdb" (field)) + +(defgroup helm-bbdb nil + "Commands and function for bbdb." + :group 'helm) + +(defun helm-bbdb-candidates () + "Return a list of all names in the bbdb database. +The format is \"Firstname Lastname\"." + (mapcar (lambda (bbdb-record) + (replace-regexp-in-string + "\\s-+$" "" + (concat (aref bbdb-record 0) " " (aref bbdb-record 1)))) + (bbdb-records))) + +(defun helm-bbdb-read-phone () + "Return a list of vector address objects. +See docstring of `bbdb-create-internal' for more info on address entries." + (cl-loop with loc-list = (cons "[Exit when no more]" + (bbdb-label-completion-list "phones")) + with loc ; Defer count + do (setq loc (helm-comp-read (format "Phone location[%s]: " count) + loc-list + :must-match 'confirm + :default "")) + while (not (string= loc "[Exit when no more]")) + for count from 1 + for phone-number = (helm-read-string (format "Phone number (%s): " loc)) + collect (vector loc phone-number) into phone-list + do (setq loc-list (remove loc loc-list)) + finally return phone-list)) + +;; TODO move this to helm-utils when finish +(defun helm-read-repeat-string (bbdb--prompt &optional count) + "Prompt as many time PROMPT is not empty. +If COUNT is non--nil add a number after each prompt." + (cl-loop with elm + while (not (string= elm "")) + for n from 1 + do (when count + (setq bbdb--prompt (concat bbdb--prompt (int-to-string n) ": "))) + collect (setq elm (helm-read-string bbdb--prompt)) into lis + finally return (remove "" lis))) + +(defun helm-bbdb-read-address () + "Return a list of vector address objects. +See docstring of `bbdb-create-internal' for more info on address entries." + (cl-loop with loc-list = (cons "[Exit when no more]" + (bbdb-label-completion-list "addresses")) + with loc ; Defer count + do (setq loc (helm-comp-read + (format "Address description[%s]: " + (int-to-string count)) + loc-list + :must-match 'confirm + :default "")) + while (not (string= loc "[Exit when no more]")) + for count from 1 + ;; Create vector + for lines = (helm-read-repeat-string "Line" t) + for city = (helm-read-string "City: ") + for state = (helm-read-string "State: ") + for zip = (helm-read-string "ZipCode: ") + for country = (helm-read-string "Country: ") + collect (vector loc lines city state zip country) into address-list + do (setq loc-list (remove loc loc-list)) + finally return address-list)) + +(defun helm-bbdb-create-contact (actions candidate) + "Action transformer for `helm-source-bbdb'. +Returns only an entry to add the current `helm-pattern' as new contact. +All other actions are removed." + (if (string= candidate "*Add to contacts*") + '(("Add to contacts" + . (lambda (actions) + (bbdb-create-internal + (read-from-minibuffer "Name: " helm-bbdb-name) + (read-from-minibuffer "Company: ") + (helm-read-repeat-string "Email " t) + (helm-bbdb-read-address) + (helm-bbdb-read-phone) + (read-from-minibuffer "Note: "))))) + actions)) + +(defun helm-bbdb-get-record (candidate) + "Return record that match CANDIDATE." + (bbdb candidate nil) + (set-buffer "*BBDB*") + (bbdb-current-record)) + +(defvar helm-bbdb-name nil + "Only for internal use.") + +(defvar helm-source-bbdb + '((name . "BBDB") + (candidates . helm-bbdb-candidates) + (action . (("Send a mail" . helm-bbdb-compose-mail) + ("View person's data" . helm-bbdb-view-person-action))) + (filtered-candidate-transformer . (lambda (candidates _source) + (setq helm-bbdb-name helm-pattern) + (if (not candidates) + (list "*Add to contacts*") + candidates))) + (action-transformer . (lambda (actions candidate) + (helm-bbdb-create-contact actions candidate)))) + "Needs BBDB. + +http://bbdb.sourceforge.net/") + +(defvar bbdb-append-records) +(defun helm-bbdb-view-person-action (candidate) + "View BBDB data of single CANDIDATE or marked candidates." + (helm-aif (helm-marked-candidates) + (let ((bbdb-append-records (length it))) + (cl-dolist (i it) + (bbdb-redisplay-one-record (helm-bbdb-get-record i)))) + (bbdb-redisplay-one-record (helm-bbdb-get-record candidate)))) + +(defun helm-bbdb-collect-mail-addresses () + "Return a list of all mail addresses of records in bbdb buffer." + (with-current-buffer bbdb-buffer-name + (cl-loop for i in bbdb-records + if (bbdb-record-net (car i)) + collect (bbdb-dwim-net-address (car i))))) + +(defun helm-bbdb-compose-mail (candidate) + "Compose a mail with all records of bbdb buffer." + (helm-bbdb-view-person-action candidate) + (let* ((address-list (helm-bbdb-collect-mail-addresses)) + (address-str (mapconcat 'identity address-list ",\n "))) + (compose-mail address-str))) + +;;;###autoload +(defun helm-bbdb () + "Preconfigured `helm' for BBDB. + +Needs BBDB. + +http://bbdb.sourceforge.net/" + (interactive) + (helm-other-buffer 'helm-source-bbdb "*helm bbdb*")) + +(provide 'helm-bbdb) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-bbdb ends here diff --git a/elpa/helm-20140808.2300/helm-bbdb.elc b/elpa/helm-20140808.2300/helm-bbdb.elc new file mode 100644 index 000000000..60e09cb8d Binary files /dev/null and b/elpa/helm-20140808.2300/helm-bbdb.elc differ diff --git a/elpa/helm-20140808.2300/helm-bookmark.el b/elpa/helm-20140808.2300/helm-bookmark.el new file mode 100644 index 000000000..e503c643f --- /dev/null +++ b/elpa/helm-20140808.2300/helm-bookmark.el @@ -0,0 +1,799 @@ +;;; helm-bookmark.el --- Helm for Emacs regular Bookmarks. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'bookmark) +(require 'helm) +(require 'helm-utils) +(require 'helm-info) +(require 'helm-adaptive) + +(declare-function addressbook-bookmark-edit "ext:addressbook-bookmark.el" (bookmark)) + + +(defgroup helm-bookmark nil + "Predefined configurations for `helm.el'." + :group 'helm) + +(defcustom helm-bookmark-show-location nil + "Show location of bookmark on display." + :group 'helm-bookmark + :type 'boolean) + + +(defface helm-bookmark-info + '((t (:foreground "green"))) + "Face used for W3m Emacs bookmarks (not w3m bookmarks)." + :group 'helm-bookmark) + +(defface helm-bookmark-w3m + '((t (:foreground "yellow"))) + "Face used for W3m Emacs bookmarks (not w3m bookmarks)." + :group 'helm-bookmark) + +(defface helm-bookmark-gnus + '((t (:foreground "magenta"))) + "Face used for Gnus bookmarks." + :group 'helm-bookmark) + +(defface helm-bookmark-man + '((t (:foreground "Orange4"))) + "Face used for Woman/man bookmarks." + :group 'helm-bookmark) + +(defface helm-bookmark-file + '((t (:foreground "Deepskyblue2"))) + "Face used for file bookmarks." + :group 'helm-bookmark) + +(defface helm-bookmark-directory + '((t (:inherit helm-ff-directory))) + "Face used for file bookmarks." + :group 'helm-bookmark) + +(defface helm-bookmark-addressbook + '((t (:foreground "tomato"))) + "Face used for addressbook bookmarks." + :group 'helm-bookmark) + + +(defvar helm-bookmark-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c o") 'helm-bookmark-run-jump-other-window) + (define-key map (kbd "C-d") 'helm-bookmark-run-delete) + (define-key map (kbd "C-]") 'helm-bookmark-toggle-filename) + (define-key map (kbd "M-e") 'helm-bookmark-run-edit) + (when (locate-library "bookmark-extensions") + (define-key map (kbd "M-F") 'helm-bmkext-run-sort-by-frequency) + (define-key map (kbd "M-V") 'helm-bmkext-run-sort-by-last-visit) + (define-key map (kbd "M-A") 'helm-bmkext-run-sort-alphabetically)) + (define-key map (kbd "C-c ?") 'helm-bookmark-help) + (delq nil map)) + "Generic Keymap for emacs bookmark sources.") + +(defvar helm-bookmarks-cache nil) +(defvar helm-source-bookmarks + '((name . "Bookmarks") + (init . (lambda () + (require 'bookmark) + (setq helm-bookmark-mode-line-string + (list (car helm-bookmark-mode-line-string) + (replace-regexp-in-string "Sort:\\[.*\\] " "" + (cadr helm-bookmark-mode-line-string)))) + (setq helm-bookmarks-cache + (bookmark-all-names)))) + (candidates . helm-bookmarks-cache) + (filtered-candidate-transformer . helm-bookmark-transformer) + (match . helm-bookmark-match-fn) + (type . bookmark)) + "See (info \"(emacs)Bookmarks\").") + +(defun helm-bookmark-transformer (candidates _source) + (cl-loop for i in candidates + for loc = (bookmark-location i) + for len = (string-width i) + for trunc = (if (> len bookmark-bmenu-file-column) + (helm-substring i bookmark-bmenu-file-column) + i) + for sep = (make-string (- (+ bookmark-bmenu-file-column 2) + (length trunc)) + ? ) + if helm-bookmark-show-location + collect (cons (concat trunc sep (if (listp loc) (car loc) loc)) i) + else collect i)) + +(defun helm-bookmark-match-fn (candidate) + "Match function for bookmark sources using `candidates'." + (if helm-bookmark-show-location + ;; match only location, match-plugin will match also name. + (string-match helm-pattern (bookmark-location candidate)) + (string-match helm-pattern candidate))) + +(defun helm-bookmark-toggle-filename () + "Toggle bookmark location visibility." + (interactive) + (with-helm-alive-p + (let* ((real (helm-get-selection helm-buffer)) + (trunc (if (> (string-width real) bookmark-bmenu-file-column) + (helm-substring real bookmark-bmenu-file-column) + real)) + (loc (bookmark-location real))) + (setq helm-bookmark-show-location (not helm-bookmark-show-location)) + (helm-force-update (if helm-bookmark-show-location + (concat (regexp-quote trunc) + " +" + (regexp-quote + (if (listp loc) (car loc) loc))) + real))))) + +(defun helm-bookmark-jump (candidate) + "Jump to bookmark from keyboard." + (let ((current-prefix-arg helm-current-prefix-arg) + non-essential) + (bookmark-jump candidate))) + +(defun helm-bookmark-jump-other-window (candidate) + (let (non-essential) + (bookmark-jump-other-window candidate))) + + +;;; bookmark-set +;; +(defvar helm-source-bookmark-set + '((name . "Set Bookmark") + (dummy) + (action . bookmark-set)) + "See (info \"(emacs)Bookmarks\").") + + +;;; Colorize bookmarks by category +;; +(defvar helm-source-pp-bookmarks + '((name . "PP-Bookmarks") + (init . (lambda () + (require 'bookmark) + (setq helm-bookmark-mode-line-string + (list (car helm-bookmark-mode-line-string) + (replace-regexp-in-string "Sort:\\[.*\\] " "" + (cadr helm-bookmark-mode-line-string)))) + (helm-init-candidates-in-buffer + 'global (cl-loop for b in (bookmark-all-names) collect + (propertize b 'location (bookmark-location b)))))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (type . bookmark)) + "See (info \"(emacs)Bookmarks\").") + +(defun helm-bookmark-search-fn (pattern) + "Search function for bookmark sources using `candidates-in-buffer'. +Should be used with `helm-pp-bookmark-match-fn' as `match-part' function." + (if helm-bookmark-show-location + (helm-aif (next-single-property-change (point) 'location) + (goto-char it)) + (re-search-forward pattern nil t))) + +(defun helm-pp-bookmark-match-fn (candidate) + "Search function for bookmark sources using `candidates-in-buffer'. +Should be used with `helm-bookmark-search-fn' as `search' function." + (helm-aif (and helm-bookmark-show-location + (bookmark-location candidate)) + ;; Match against bookmark-name and location. + (concat candidate " " it) + ;; Match against bookmark-name. + candidate)) + + +;;; Predicates +;; +(defconst helm-bookmark--non-file-filename " - no file -" + "Name to use for `filename' entry, for non-file bookmarks.") + +(defun helm-bookmark-gnus-bookmark-p (bookmark) + "Return non-nil if BOOKMARK is a Gnus bookmark. +BOOKMARK is a bookmark name or a bookmark record." + (or (eq (bookmark-get-handler bookmark) 'bmkext-jump-gnus) + (eq (bookmark-get-handler bookmark) 'gnus-summary-bookmark-jump) + (eq (bookmark-get-handler bookmark) 'bookmarkp-jump-gnus))) + +(defun helm-bookmark-w3m-bookmark-p (bookmark) + "Return non-nil if BOOKMARK is a W3m bookmark. +BOOKMARK is a bookmark name or a bookmark record." + (or (eq (bookmark-get-handler bookmark) 'bmkext-jump-w3m) + (eq (bookmark-get-handler bookmark) 'bookmark-w3m-bookmark-jump) + (eq (bookmark-get-handler bookmark) 'bookmarkp-jump-w3m))) + +(defun helm-bookmark-woman-bookmark-p (bookmark) + "Return non-nil if BOOKMARK is a Woman bookmark. +BOOKMARK is a bookmark name or a bookmark record." + (or (eq (bookmark-get-handler bookmark) 'bmkext-jump-woman) + (eq (bookmark-get-handler bookmark) 'woman-bookmark-jump) + (eq (bookmark-get-handler bookmark) 'bookmarkp-jump-woman))) + +(defun helm-bookmark-man-bookmark-p (bookmark) + "Return non-nil if BOOKMARK is a Man bookmark. +BOOKMARK is a bookmark name or a bookmark record." + (or (eq (bookmark-get-handler bookmark) 'bmkext-jump-man) + (eq (bookmark-get-handler bookmark) 'Man-bookmark-jump) + (eq (bookmark-get-handler bookmark) 'bookmarkp-jump-man))) + +(defun helm-bookmark-woman-man-bookmark-p (bookmark) + "Return non-nil if BOOKMARK is a Man or Woman bookmark. +BOOKMARK is a bookmark name or a bookmark record." + (or (helm-bookmark-man-bookmark-p bookmark) + (helm-bookmark-woman-bookmark-p bookmark))) + +(defun helm-bookmark-info-bookmark-p (bookmark) + "Return non-nil if BOOKMARK is an Info bookmark. +BOOKMARK is a bookmark name or a bookmark record." + (eq (bookmark-get-handler bookmark) 'Info-bookmark-jump)) + +(defun helm-bookmark-image-bookmark-p (bookmark) + "Return non-nil if BOOKMARK bookmarks an image file." + (if (stringp bookmark) + (assoc 'image-type (assoc bookmark bookmark-alist)) + (assoc 'image-type bookmark))) + +(defun helm-bookmark-file-p (bookmark) + "Return non-nil if BOOKMARK bookmarks a file or directory. +BOOKMARK is a bookmark name or a bookmark record. +This excludes bookmarks of a more specific kind (Info, Gnus, and W3m)." + (let* ((filename (bookmark-get-filename bookmark)) + (isnonfile (equal filename helm-bookmark--non-file-filename))) + (and filename (not isnonfile) (not (bookmark-get-handler bookmark))))) + +(defun helm-bookmark-addressbook-p (bookmark) + "Return non--nil if BOOKMARK is a contact recorded with addressbook-bookmark. +BOOKMARK is a bookmark name or a bookmark record." + (if (listp bookmark) + (string= (assoc-default 'type bookmark) "addressbook") + (string= (assoc-default + 'type (assoc bookmark bookmark-alist)) "addressbook"))) + +(defun helm-bookmark-uncategorized-bookmark-p (bookmark) + "Return non--nil if BOOKMARK match no known category." + (and (not (helm-bookmark-addressbook-p bookmark)) + (not (helm-bookmark-gnus-bookmark-p bookmark)) + (not (helm-bookmark-w3m-bookmark-p bookmark)) + (not (helm-bookmark-woman-man-bookmark-p bookmark)) + (not (helm-bookmark-info-bookmark-p bookmark)) + (not (helm-bookmark-image-bookmark-p bookmark)) + (not (helm-bookmark-file-p bookmark)) + (not (helm-bookmark-addressbook-p bookmark)))) + +(defun helm-bookmark-filter-setup-alist (fn) + "Return a filtered `bookmark-alist' sorted alphabetically." + (cl-loop with alist = (cl-loop for b in bookmark-alist + when (funcall fn b) collect b) + for bmk in alist + for name = (car bmk) + collect (propertize name 'location (bookmark-location name)))) + + +;;; Bookmark handlers +;; +(defvar w3m-async-exec) +(defun helm-bookmark-jump-w3m (bookmark) + "Jump to W3m bookmark BOOKMARK, setting a new tab. +If `browse-url-browser-function' is set to something else +than `w3m-browse-url' use it." + (require 'helm-net) + (let ((file (or (bookmark-prop-get bookmark 'filename) + (bookmark-prop-get bookmark 'url))) + (buf (generate-new-buffer-name "*w3m*")) + (w3m-async-exec nil) + (really-use-w3m (equal browse-url-browser-function 'w3m-browse-url))) + (helm-browse-url file really-use-w3m) + (when really-use-w3m + (bookmark-default-handler + `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))) + +;; All bookmarks recorded with the handler provided with w3m +;; (`bookmark-w3m-bookmark-jump') will use our handler which open +;; the bookmark in a new tab or in an external browser depending +;; on `browse-url-browser-function'. +(defalias 'bookmark-w3m-bookmark-jump 'helm-bookmark-jump-w3m) + +;; Provide compatibility with old handlers provided in external +;; packages bookmark-extensions.el and bookmark+. +(defalias 'bmkext-jump-woman 'woman-bookmark-jump) +(defalias 'bmkext-jump-man 'Man-bookmark-jump) +(defalias 'bmkext-jump-w3m 'helm-bookmark-jump-w3m) +(defalias 'bmkext-jump-gnus 'gnus-summary-bookmark-jump) +(defalias 'bookmarkp-jump-gnus 'gnus-summary-bookmark-jump) +(defalias 'bookmarkp-jump-w3m 'helm-bookmark-jump-w3m) +(defalias 'bookmarkp-jump-woman 'woman-bookmark-jump) +(defalias 'bookmarkp-jump-man 'Man-bookmark-jump) + + +;;;; Filtered bookmark sources + +;;; W3m bookmarks. +;; +(defvar helm-source-bookmark-w3m + '((name . "Bookmark W3m") + (init . (lambda () + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global (helm-bookmark-w3m-setup-alist)))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (type . bookmark))) + +(defun helm-bookmark-w3m-setup-alist () + "Specialized filter function for bookmarks w3m." + (helm-bookmark-filter-setup-alist 'helm-bookmark-w3m-bookmark-p)) + +;;; Images +;; +(defvar helm-source-bookmark-images + '((name . "Bookmark Images") + (init . (lambda () + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global (helm-bookmark-images-setup-alist)))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (type . bookmark))) + +(defun helm-bookmark-images-setup-alist () + "Specialized filter function for images bookmarks." + (helm-bookmark-filter-setup-alist 'helm-bookmark-image-bookmark-p)) + +;;; Woman Man +;; +(defvar helm-source-bookmark-man + '((name . "Bookmark Woman&Man") + (init . (lambda () + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global (helm-bookmark-man-setup-alist)))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (type . bookmark))) + +(defun helm-bookmark-man-setup-alist () + "Specialized filter function for bookmarks w3m." + (helm-bookmark-filter-setup-alist 'helm-bookmark-woman-man-bookmark-p)) + +;;; Gnus +;; +(defvar helm-source-bookmark-gnus + '((name . "Bookmark Gnus") + (init . (lambda () + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global (helm-bookmark-gnus-setup-alist)))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (type . bookmark))) + +(defun helm-bookmark-gnus-setup-alist () + "Specialized filter function for bookmarks gnus." + (helm-bookmark-filter-setup-alist 'helm-bookmark-gnus-bookmark-p)) + +;;; Info +;; +(defvar helm-source-bookmark-info + '((name . "Bookmark Info") + (init . (lambda () + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global (helm-bookmark-info-setup-alist)))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (type . bookmark))) + +(defun helm-bookmark-info-setup-alist () + "Specialized filter function for bookmarks info." + (helm-bookmark-filter-setup-alist 'helm-bookmark-info-bookmark-p)) + +;;; Files and directories +;; +(defvar helm-source-bookmark-files&dirs + '((name . "Bookmark Files&Directories") + (init . (lambda () + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global (helm-bookmark-local-files-setup-alist)))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (type . bookmark))) + +(defun helm-bookmark-local-files-setup-alist () + "Specialized filter function for bookmarks locals files." + (helm-bookmark-filter-setup-alist 'helm-bookmark-file-p)) + +;;; Addressbook. +;; +;; +(defvar helm-source-bookmark-addressbook + '((name . "Bookmark Addressbook") + (init . (lambda () + (require 'addressbook-bookmark nil t) + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global + (helm-bookmark-addressbook-setup-alist)))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (persistent-action + . (lambda (candidate) + (let ((bmk (helm-bookmark-get-bookmark-from-name + candidate))) + (bookmark--jump-via bmk 'switch-to-buffer)))) + (persistent-help . "Show contact - Prefix with C-u to append") + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (action . (("Show Contact(s)" + . (lambda (candidate) + (let* ((contacts (helm-marked-candidates)) + (current-prefix-arg helm-current-prefix-arg)) + (bookmark-jump + (helm-bookmark-get-bookmark-from-name (car contacts))) + (helm-aif (cdr contacts) + (let ((current-prefix-arg '(4))) + (cl-loop for bmk in it do + (bookmark-jump + (helm-bookmark-get-bookmark-from-name bmk)))))))) + ("Send Mail" + . (lambda (candidate) + (let* ((contacts (helm-marked-candidates)) + (bmk (helm-bookmark-get-bookmark-from-name + (car contacts))) + (append (message-buffers))) + (if append + (addressbook-set-mail-buffer1 bmk 'append) + (addressbook-set-mail-buffer1 bmk)) + (setq contacts (cdr contacts)) + (when contacts + (cl-loop for bmk in contacts do + (addressbook-set-mail-buffer1 bmk 'append)))))) + ("Edit Bookmark" + . (lambda (candidate) + (let ((bmk (helm-bookmark-get-bookmark-from-name + candidate))) + (addressbook-bookmark-edit + (assoc bmk bookmark-alist))))) + ("Delete bookmark(s)" . helm-delete-marked-bookmarks) + ("Insert Email at point" + . (lambda (candidate) + (let* ((bmk (helm-bookmark-get-bookmark-from-name + candidate)) + (mlist (split-string + (assoc-default + 'email (assoc bmk bookmark-alist)) + ", "))) + (insert + (if (> (length mlist) 1) + (helm-comp-read + "Insert Mail Address: " mlist :must-match t) + (car mlist)))))) + ("Show annotation" + . (lambda (candidate) + (let ((bmk (helm-bookmark-get-bookmark-from-name + candidate))) + (bookmark-show-annotation bmk)))) + ("Edit annotation" + . (lambda (candidate) + (let ((bmk (helm-bookmark-get-bookmark-from-name + candidate))) + (bookmark-edit-annotation bmk)))) + ("Show Google map" + . (lambda (candidate) + (let* ((bmk (helm-bookmark-get-bookmark-from-name + candidate)) + (full-bmk (assoc bmk bookmark-alist))) + (addressbook-google-map full-bmk)))))))) + +(defun helm-bookmark-addressbook-setup-alist () + "Specialized filter function for addressbook bookmarks." + (helm-bookmark-filter-setup-alist 'helm-bookmark-addressbook-p)) + +(defvar helm-source-bookmark-uncategorized + '((name . "Bookmark uncategorized") + (init . (lambda () + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global (helm-bookmark-uncategorized-setup-alist)))) + (candidates-in-buffer) + (search helm-bookmark-search-fn) + (match-part . helm-pp-bookmark-match-fn) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-bookmark) + (type . bookmark))) + +(defun helm-bookmark-uncategorized-setup-alist () + "Specialized filter function for uncategorized bookmarks." + (helm-bookmark-filter-setup-alist 'helm-bookmark-uncategorized-bookmark-p)) + +;;; Transformer +;; + +(defun helm-highlight-bookmark (bookmarks _source) + "Used as `filtered-candidate-transformer' to colorize bookmarks. +Work both with standard Emacs bookmarks and bookmark-extensions.el." + (let ((non-essential t)) + (cl-loop for i in bookmarks + for isfile = (bookmark-get-filename i) + for handlerp = (and (fboundp 'bookmark-get-handler) + (bookmark-get-handler i)) + for isw3m = (and (fboundp 'helm-bookmark-w3m-bookmark-p) + (helm-bookmark-w3m-bookmark-p i)) + for isgnus = (and (fboundp 'helm-bookmark-gnus-bookmark-p) + (helm-bookmark-gnus-bookmark-p i)) + for isman = (and (fboundp 'helm-bookmark-man-bookmark-p) ; Man + (helm-bookmark-man-bookmark-p i)) + for iswoman = (and (fboundp 'helm-bookmark-woman-bookmark-p) ; Woman + (helm-bookmark-woman-bookmark-p i)) + for isannotation = (bookmark-get-annotation i) + for isabook = (string= (bookmark-prop-get i 'type) + "addressbook") + for isinfo = (eq handlerp 'Info-bookmark-jump) + for loc = (bookmark-location i) + for len = (string-width i) + for trunc = (if (and helm-bookmark-show-location + (> len bookmark-bmenu-file-column)) + (helm-substring + i bookmark-bmenu-file-column) + i) + ;; Add a * if bookmark have annotation + if (and isannotation (not (string-equal isannotation ""))) + do (setq trunc (concat "*" (if helm-bookmark-show-location trunc i))) + for sep = (and helm-bookmark-show-location + (make-string (- (+ bookmark-bmenu-file-column 2) + (string-width trunc)) + ? )) + for bmk = (cond ( ;; info buffers + isinfo + (propertize trunc 'face 'helm-bookmark-info + 'help-echo isfile)) + ( ;; w3m buffers + isw3m + (propertize trunc 'face 'helm-bookmark-w3m + 'help-echo isfile)) + ( ;; gnus buffers + isgnus + (propertize trunc 'face 'helm-bookmark-gnus + 'help-echo isfile)) + ( ;; Man Woman + (or iswoman isman) + (propertize trunc 'face 'helm-bookmark-man + 'help-echo isfile)) + ( ;; Addressbook + isabook + (propertize trunc 'face 'helm-bookmark-addressbook)) + ( ;; directories + (and isfile + ;; This is needed because `non-essential' + ;; is not working on Emacs-24.2 and the behavior + ;; of tramp seems to have changed since previous + ;; versions (Need to reenter password even if a + ;; first connection have been established, + ;; probably when host is named differently + ;; i.e machine/localhost) + (not (file-remote-p isfile)) + (file-directory-p isfile)) + (propertize trunc 'face 'helm-bookmark-directory + 'help-echo isfile)) + ( ;; regular files + t + (propertize trunc 'face 'helm-bookmark-file + 'help-echo isfile))) + collect (if helm-bookmark-show-location + (cons (concat bmk sep (if (listp loc) (car loc) loc)) + i) + (cons bmk i))))) + +(defun helm-bookmark-edit-bookmark (bookmark-name) + "Edit bookmark's name and file name, and maybe save them. +BOOKMARK-NAME is the current (old) name of the bookmark to be renamed." + (let ((bmk (helm-bookmark-get-bookmark-from-name bookmark-name)) + (handler (bookmark-prop-get bookmark-name 'handler))) + (if (eq handler 'addressbook-bookmark-jump) + (addressbook-bookmark-edit + (assoc bmk bookmark-alist)) + (helm-bookmark-edit-bookmark-1 bookmark-name handler)))) + +(defun helm-bookmark-edit-bookmark-1 (bookmark-name handler) + (let* ((bookmark-fname (bookmark-get-filename bookmark-name)) + (bookmark-loc (bookmark-prop-get bookmark-name 'location)) + (new-name (read-from-minibuffer "Name: " bookmark-name)) + (new-loc (read-from-minibuffer "FileName or Location: " + (or bookmark-fname + (if (consp bookmark-loc) + (car bookmark-loc) + bookmark-loc)))) + (docid (and (eq handler 'mu4e-bookmark-jump) + (read-number "Docid: " (cdr bookmark-loc))))) + (when docid + (setq new-loc (cons new-loc docid))) + (when (and (not (equal new-name "")) (not (equal new-loc "")) + (y-or-n-p "Save changes? ")) + (if bookmark-fname + (progn + (helm-bookmark-rename bookmark-name new-name 'batch) + (bookmark-set-filename new-name new-loc)) + (bookmark-prop-set + (bookmark-get-bookmark bookmark-name) 'location new-loc) + (helm-bookmark-rename bookmark-name new-name 'batch)) + (helm-bookmark-maybe-save-bookmark) + (list new-name new-loc)))) + +(defun helm-bookmark-maybe-save-bookmark () + "Increment save counter and maybe save `bookmark-alist'." + (setq bookmark-alist-modification-count (1+ bookmark-alist-modification-count)) + (when (bookmark-time-to-save-p) (bookmark-save))) + +(defun helm-bookmark-rename (old &optional new batch) + "Change bookmark's name from OLD to NEW. +Interactively: + If called from the keyboard, then prompt for OLD. + If called from the menubar, select OLD from a menu. +If NEW is nil, then prompt for its string value. + +If BATCH is non-nil, then do not rebuild the menu list. + +While the user enters the new name, repeated `C-w' inserts consecutive +words from the buffer into the new bookmark name." + (interactive (list (bookmark-completing-read "Old bookmark name"))) + (bookmark-maybe-historicize-string old) + (bookmark-maybe-load-default-file) + (save-excursion (skip-chars-forward " ") (setq bookmark-yank-point (point))) + (setq bookmark-current-buffer (current-buffer)) + (let ((newname (or new (read-from-minibuffer + "New name: " nil + (let ((now-map (copy-keymap minibuffer-local-map))) + (define-key now-map "\C-w" 'bookmark-yank-word) + now-map) + nil 'bookmark-history)))) + (bookmark-set-name old newname) + (setq bookmark-current-bookmark newname) + (unless batch (bookmark-bmenu-surreptitiously-rebuild-list)) + (helm-bookmark-maybe-save-bookmark) newname)) + +(defun helm-bookmark-run-edit () + "Run `helm-bookmark-edit-bookmark' from keyboard." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-bookmark-edit-bookmark))) + + +;;; Bookmarks attributes +;; +(define-helm-type-attribute 'bookmark + `((coerce . helm-bookmark-get-bookmark-from-name) + (action + ("Jump to bookmark" . helm-bookmark-jump) + ("Jump to BM other window" . helm-bookmark-jump-other-window) + ("Bookmark edit annotation" . bookmark-edit-annotation) + ("Bookmark show annotation" . bookmark-show-annotation) + ("Delete bookmark(s)" . helm-delete-marked-bookmarks) + ("Edit Bookmark" . helm-bookmark-edit-bookmark) + ("Rename bookmark" . helm-bookmark-rename) + ("Relocate bookmark" . bookmark-relocate)) + (keymap . ,helm-bookmark-map) + (mode-line . helm-bookmark-mode-line-string)) + "Bookmark name.") + + +(defun helm-bookmark-run-jump-other-window () + "Jump to bookmark from keyboard." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'bookmark-jump-other-window))) + +(defun helm-bookmark-run-delete () + "Delete bookmark from keyboard." + (interactive) + (with-helm-alive-p + (when (y-or-n-p "Delete bookmark(s)?") + (helm-quit-and-execute-action 'helm-delete-marked-bookmarks)))) + +(defun helm-bookmark-get-bookmark-from-name (bmk) + "Return bookmark name even if it is a bookmark with annotation. +e.g prepended with *." + (let ((bookmark (replace-regexp-in-string "\\*" "" bmk))) + (if (assoc bookmark bookmark-alist) bookmark bmk))) + +(defun helm-delete-marked-bookmarks (_ignore) + "Delete this bookmark or all marked bookmarks." + (cl-dolist (i (helm-marked-candidates)) + (bookmark-delete (helm-bookmark-get-bookmark-from-name i) + 'batch))) + + +;;;###autoload +(defun helm-bookmarks () + "Preconfigured `helm' for bookmarks." + (interactive) + (helm :sources '(helm-source-bookmarks + helm-source-bookmark-set) + :buffer "*helm bookmarks*" + :default (buffer-name helm-current-buffer))) + +;;;###autoload +(defun helm-pp-bookmarks () + "Preconfigured `helm' for bookmarks (pretty-printed)." + (interactive) + (helm :sources '(helm-source-pp-bookmarks + helm-source-bookmark-set) + :buffer "*helm pp bookmarks*" + :default (buffer-name helm-current-buffer))) + +;;;###autoload +(defun helm-filtered-bookmarks () + "Preconfigured helm for bookmarks (filtered by category). +Optional source `helm-source-bookmark-addressbook' is loaded +only if external library addressbook-bookmark.el is available." + (interactive) + (helm :sources (append '(helm-source-bookmark-files&dirs + helm-source-bookmark-info + helm-source-bookmark-gnus + helm-source-bookmark-man + helm-source-bookmark-images + helm-source-bookmark-w3m) + (and (locate-library "addressbook-bookmark") + (list 'helm-source-bookmark-addressbook)) + (list helm-source-bookmark-uncategorized + 'helm-source-bookmark-set)) + :prompt "Search Bookmark: " + :buffer "*helm filtered bookmarks*" + :default (list (thing-at-point 'symbol) + (buffer-name helm-current-buffer)))) + +(provide 'helm-bookmark) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-bookmark.el ends here diff --git a/elpa/helm-20140808.2300/helm-bookmark.elc b/elpa/helm-20140808.2300/helm-bookmark.elc new file mode 100644 index 000000000..dc9e987d1 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-bookmark.elc differ diff --git a/elpa/helm-20140808.2300/helm-buffers.el b/elpa/helm-20140808.2300/helm-buffers.el new file mode 100644 index 000000000..9bfcd1c43 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-buffers.el @@ -0,0 +1,784 @@ +;;; helm-buffers.el --- helm support for buffers. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) +(require 'helm-elscreen) +(require 'helm-grep) +(require 'helm-regexp) + +(declare-function ido-make-buffer-list "ido" (default)) + +(defgroup helm-buffers nil + "Buffers related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-boring-buffer-regexp-list + '("\\` " "\\*helm" "\\*helm-mode" "\\*Echo Area" "\\*Minibuf") + "The regexp list that match boring buffers. +Buffer candidates matching these regular expression will be +filtered from the list of candidates if the +`helm-skip-boring-buffers' candidate transformer is used." + :type '(repeat (choice regexp)) + :group 'helm-buffers) + +(defcustom helm-buffers-favorite-modes '(lisp-interaction-mode + emacs-lisp-mode + text-mode + org-mode) + "List of preferred mode to open new buffers with." + :type '(repeat (choice function)) + :group 'helm-buffers) + +(defcustom helm-buffer-max-length 20 + "Max length of buffer names before truncate. +When disabled (nil) use the longest buffer-name length found." + :group 'helm-buffers + :type '(choice (const :tag "Disabled" nil) + (integer :tag "Length before truncate"))) + +(defcustom helm-buffer-details-flag t + "Always show details in buffer list when non--nil." + :group 'helm-buffers + :type 'boolean) + +(defcustom helm-buffers-fuzzy-matching nil + "Fuzzy matching buffer names when non--nil. +Only buffer names are fuzzy matched when this is enabled, +`major-mode' matching is not affected by this." + :group 'helm-buffers + :type 'boolean) + + +;;; Faces +;; +;; +(defface helm-buffer-saved-out + '((t (:foreground "red" :background "black"))) + "Face used for buffer files modified outside of emacs." + :group 'helm-buffers) + +(defface helm-buffer-not-saved + '((t (:foreground "Indianred2"))) + "Face used for buffer files not already saved on disk." + :group 'helm-buffers) + +(defface helm-buffer-size + '((((background dark)) :foreground "RosyBrown") + (((background light)) :foreground "SlateGray")) + "Face used for buffer size." + :group 'helm-buffers) + +(defface helm-buffer-process + '((t (:foreground "Sienna3"))) + "Face used for process status in buffer." + :group 'helm-buffers) + +(defface helm-buffer-directory + '((t (:foreground "DarkRed" :background "LightGray"))) + "Face used for directories in `helm-buffers-list'." + :group 'helm-buffers) + + +;;; Buffers keymap +;; +(defvar helm-buffer-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-buffer-help) + ;; No need to have separate command for grep and zgrep + ;; as we don't use recursivity for buffers. + ;; So use zgrep for both as it is capable to handle non--compressed files. + (define-key map (kbd "M-g s") 'helm-buffer-run-zgrep) + (define-key map (kbd "C-s") 'helm-buffers-run-multi-occur) + (define-key map (kbd "C-c o") 'helm-buffer-switch-other-window) + (define-key map (kbd "C-c C-o") 'helm-buffer-switch-other-frame) + (define-key map (kbd "C-c =") 'helm-buffer-run-ediff) + (define-key map (kbd "M-=") 'helm-buffer-run-ediff-merge) + (define-key map (kbd "C-=") 'helm-buffer-diff-persistent) + (define-key map (kbd "M-U") 'helm-buffer-revert-persistent) + (define-key map (kbd "C-c d") 'helm-buffer-run-kill-persistent) + (define-key map (kbd "M-D") 'helm-buffer-run-kill-buffers) + (define-key map (kbd "C-x C-s") 'helm-buffer-save-persistent) + (define-key map (kbd "C-M-%") 'helm-buffer-run-query-replace-regexp) + (define-key map (kbd "M-%") 'helm-buffer-run-query-replace) + (define-key map (kbd "M-m") 'helm-toggle-all-marks) + (define-key map (kbd "M-a") 'helm-mark-all) + (define-key map (kbd "C-]") 'helm-toggle-buffers-details) + (define-key map (kbd "C-c a") 'helm-buffers-toggle-show-hidden-buffers) + (define-key map (kbd "") 'helm-buffers-mark-similar-buffers) + map) + "Keymap for buffer sources in helm.") + +(defvar helm-buffers-ido-virtual-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-buffers-ido-virtual-help) + (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window) + (define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame) + (define-key map (kbd "M-g s") 'helm-ff-run-grep) + (define-key map (kbd "M-g z") 'helm-ff-run-zgrep) + (define-key map (kbd "M-D") 'helm-ff-run-delete-file) + (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally) + map)) + + +(defvar helm-buffers-list-cache nil) +(defvar helm-buffer-max-len-mode nil) +(defvar helm-source-buffers-list + `((name . "Buffers") + (init . (lambda () + ;; Issue #51 Create the list before `helm-buffer' creation. + (setq helm-buffers-list-cache (helm-buffer-list)) + (let ((result (cl-loop for b in helm-buffers-list-cache + maximize (length b) into len-buf + maximize (length (with-current-buffer b + (symbol-name major-mode))) + into len-mode + finally return (cons len-buf len-mode)))) + (unless helm-buffer-max-length + (setq helm-buffer-max-length (car result))) + (unless helm-buffer-max-len-mode + ;; If a new buffer is longer that this value + ;; this value will be updated + (setq helm-buffer-max-len-mode (cdr result)))))) + (candidates . helm-buffers-list-cache) + (no-matchplugin) + (type . buffer) + (match helm-buffers-list--match-fn) + (persistent-action . helm-buffers-list-persistent-action) + (keymap . ,helm-buffer-map) + (volatile) + (mode-line . helm-buffer-mode-line-string) + (persistent-help + . "Show this buffer / C-u \\[helm-execute-persistent-action]: Kill this buffer"))) + +(defvar helm-source-buffer-not-found + `((name . "Create buffer") + (keymap . ,helm-map) + (dummy) + (action . (lambda (candidate) + (let ((mjm (and helm-current-prefix-arg + (intern-soft (helm-comp-read + "Major-mode: " + helm-buffers-favorite-modes)))) + (buffer (get-buffer-create candidate))) + (if mjm + (with-current-buffer buffer (funcall mjm)) + (set-buffer-major-mode buffer)) + (helm-switch-to-buffer buffer)))))) + +(defvar ido-temp-list) +(defvar ido-ignored-list) +(defvar ido-process-ignore-lists) + +(defvar helm-source-ido-virtual-buffers + `((name . "Ido virtual buffers") + (candidates . (lambda () + (let (ido-temp-list + ido-ignored-list + (ido-process-ignore-lists t)) + (when ido-use-virtual-buffers + (ido-add-virtual-buffers-to-list) + ido-virtual-buffers)))) + (keymap . ,helm-buffers-ido-virtual-map) + (mode-line . helm-buffers-ido-virtual-mode-line-string) + (action . (("Find file" . helm-find-many-files) + ("Find file other window" . find-file-other-window) + ("Find file other frame" . find-file-other-frame) + ("Find file as root" . helm-find-file-as-root) + ("Grep File(s) `C-u recurse'" . helm-find-files-grep) + ("Zgrep File(s) `C-u Recurse'" . helm-ff-zgrep) + ("View file" . view-file) + ("Delete file(s)" . helm-delete-marked-files) + ("Open file externally (C-u to choose)" + . helm-open-file-externally))))) + + +(defvar ido-use-virtual-buffers) +(defun helm-buffer-list () + "Return the current list of buffers. +Currently visible buffers are put at the end of the list. +See `ido-make-buffer-list' for more infos." + (require 'ido) + (let ((ido-process-ignore-lists t) + ido-ignored-list + ido-use-virtual-buffers) + (ido-make-buffer-list nil))) + +(defun helm-buffer-size (buffer) + "Return size of BUFFER." + (with-current-buffer buffer + (save-restriction + (widen) + (helm-file-human-size + (- (position-bytes (point-max)) + (position-bytes (point-min))))))) + +(defun helm-buffer--show-details (buf-name prefix help-echo + size mode dir face1 face2 + proc details type) + (append + (list + (concat prefix + (propertize buf-name 'face face1 + 'help-echo help-echo + 'type type))) + (and details + (list size mode + (propertize + (if proc + (format "(%s %s in `%s')" + (process-name proc) + (process-status proc) dir) + (format "(in `%s')" dir)) + 'face face2))))) + +(defun helm-buffer--details (buffer &optional details) + (let* ((mode (with-current-buffer buffer (format-mode-line mode-name))) + (buf (get-buffer buffer)) + (size (propertize (helm-buffer-size buf) + 'face 'helm-buffer-size)) + (proc (get-buffer-process buf)) + (dir (with-current-buffer buffer (abbreviate-file-name default-directory))) + (file-name (helm-aif (buffer-file-name buf) (abbreviate-file-name it))) + (name (buffer-name buf)) + (name-prefix (when (file-remote-p dir) + (propertize "@ " 'face 'helm-ff-prefix)))) + (cond + ( ;; A dired buffer. + (rassoc buf dired-buffers) + (helm-buffer--show-details + name name-prefix dir size mode dir + 'helm-buffer-directory 'helm-buffer-process nil details 'dired)) + ;; A buffer file modified somewhere outside of emacs.=>red + ((and file-name (file-exists-p file-name) + (not (verify-visited-file-modtime buf))) + (helm-buffer--show-details + name name-prefix file-name size mode dir + 'helm-buffer-saved-out 'helm-buffer-process nil details 'modout)) + ;; A new buffer file not already saved on disk.=>indianred2 + ((and file-name (not (verify-visited-file-modtime buf))) + (helm-buffer--show-details + name name-prefix file-name size mode dir + 'helm-buffer-not-saved 'helm-buffer-process nil details 'notsaved)) + ;; A buffer file modified and not saved on disk.=>orange + ((and file-name (buffer-modified-p buf)) + (helm-buffer--show-details + name name-prefix file-name size mode dir + 'helm-ff-symlink 'helm-buffer-process nil details 'mod)) + ;; A buffer file not modified and saved on disk.=>green + (file-name + (helm-buffer--show-details + name name-prefix file-name size mode dir + 'font-lock-type-face 'helm-buffer-process nil details 'filebuf)) + ;; Any non--file buffer.=>grey italic + (t + (helm-buffer--show-details + name (and proc name-prefix) dir size mode dir + 'italic 'helm-buffer-process proc details 'nofile))))) + +(defun helm-highlight-buffers (buffers _source) + "Transformer function to highlight BUFFERS list. +Should be called after others transformers i.e (boring buffers)." + (cl-loop for i in buffers + for (name size mode meta) = (if helm-buffer-details-flag + (helm-buffer--details i 'details) + (helm-buffer--details i)) + for truncbuf = (if (> (string-width name) helm-buffer-max-length) + (helm-substring-by-width + name helm-buffer-max-length) + (concat name (make-string + (- (+ helm-buffer-max-length 3) + (string-width name)) ? ))) + for len = (length mode) + when (> len helm-buffer-max-len-mode) + do (setq helm-buffer-max-len-mode len) + for fmode = (concat (make-string + (- (max helm-buffer-max-len-mode len) len) ? ) + mode) + ;; The max length of a number should be 1023.9X where X is the + ;; units, this is 7 characters. + for formatted-size = (and size (format "%7s" size)) + collect (cons (if helm-buffer-details-flag + (concat truncbuf "\t" formatted-size + " " fmode " " meta) + name) + i))) + +(defun helm-buffer--get-preselection (buffer-name) + (concat "^" + (if (and (null helm-buffer-details-flag) + (numberp helm-buffer-max-length) + (> (string-width buffer-name) + helm-buffer-max-length)) + (regexp-quote + (helm-substring-by-width + buffer-name helm-buffer-max-length)) + (concat (regexp-quote buffer-name) + (if helm-buffer-details-flag + "$" "[[:blank:]]+"))))) + +(defun helm-toggle-buffers-details () + (interactive) + (let ((preselect (helm-buffer--get-preselection + (helm-get-selection)))) + (when helm-alive-p + (setq helm-buffer-details-flag (not helm-buffer-details-flag)) + (helm-force-update preselect)))) + +(defun helm-buffers-sort-transformer (candidates _source) + (if (string= helm-pattern "") + candidates + (sort candidates + #'(lambda (s1 s2) + (< (string-width s1) (string-width s2)))))) + +(defun helm-buffers-mark-similar-buffers-1 () + (with-helm-window + (let ((type (get-text-property + 0 'type (helm-get-selection nil 'withprop)))) + (save-excursion + (goto-char (helm-get-previous-header-pos)) + (helm-next-line) + (let* ((next-head (helm-get-next-header-pos)) + (end (and next-head + (save-excursion + (goto-char next-head) + (forward-line -1) + (point)))) + (maxpoint (or end (point-max)))) + (while (< (point) maxpoint) + (helm-mark-current-line) + (let ((cand (helm-get-selection nil 'withprop))) + (when (and (not (helm-this-visible-mark)) + (eq (get-text-property 0 'type cand) type)) + (helm-make-visible-mark))) + (forward-line 1) (end-of-line)))) + (helm-mark-current-line) + (message "%s candidates marked" (length helm-marked-candidates))))) + +(defun helm-buffers-mark-similar-buffers () + "Mark All buffers that have same property `type' than current. +i.e same color." + (interactive) + (let ((marked (helm-marked-candidates))) + (if (and (>= (length marked) 1) + (with-helm-window helm-visible-mark-overlays)) + (helm-unmark-all) + (helm-buffers-mark-similar-buffers-1)))) + + +;;; match functions +;; +(defun helm-buffer--match-mjm (pattern mjm) + (when (string-match "\\`\\*" pattern) + (setq pattern (split-string (substring pattern 1) ",")) + (cl-loop for pat in pattern + if (string-match "\\`!" pat) + collect (string-match (substring pat 1) mjm) into neg + else collect (string-match pat mjm) into pos + finally return + (or (and pos (cl-loop for i in pos + thereis (numberp i))) + (and neg (not (cl-loop for i in neg + thereis (numberp i)))))))) + +(defun helm-buffer--match-pattern (pattern candidate) + (let ((fun (if (and helm-buffers-fuzzy-matching + (not (string-match "\\`\\^" pattern))) + #'helm--mapconcat-candidate + #'identity))) + (if (string-match "\\`!" pattern) + (not (string-match (funcall fun (substring pattern 1)) + candidate)) + (string-match (funcall fun pattern) candidate)))) + +(defun helm-buffers-list--match-fn (candidate) + "Match maybe buffer by major-mode. +If you give a major-mode or partial major-mode, +it will list all buffers of this major-mode and/or buffers with name +matching this major-mode. +If you add a space after major-mode and then a space, +it will match all buffers of the major-mode +before space matching pattern after space. +If you give a pattern which doesn't match a major-mode, it will search buffer +with name matching pattern." + (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate)) + (buf (get-buffer cand)) + (buf-fname (buffer-file-name buf))) + (when buf + (with-current-buffer buf + (let ((mjm (format-mode-line mode-name)) + (split (split-string helm-pattern))) + (cond ((string-match "^@" helm-pattern) ; match inside. + (or (helm-buffers-match-inside cand split) + (helm-buffer--match-pattern helm-pattern cand))) + ;; Continue showing buffer after mjm matching and a space. + ((string-match "\\`\\*.*\\s-$" helm-pattern) + (helm-buffer--match-mjm (car split) mjm)) + ((and (string-match "\\s-[@]" helm-pattern) (cdr split)) + (and (or (helm-buffer--match-mjm (car split) mjm) + (and buf-fname + (string-match "\\`/" helm-pattern) + (string-match + (substring (car split) 1) + (helm-basedir buf-fname))) + (helm-buffer--match-pattern (car split) cand)) + (helm-buffers-match-inside cand (cdr split)))) + ;; Continue showing buffers after entering @ after a space. + ((string-match "\\s-[@]" helm-pattern) + (or (helm-buffer--match-mjm (car split) mjm) + (and buf-fname + (string-match "\\`/" helm-pattern) + (string-match + (substring (car split) 1) + (helm-basedir buf-fname))) + (helm-buffer--match-pattern (car split) cand))) + ;; Match on major-mode and multiple patterns. + ((and (string-match "\\`\\*" helm-pattern) (cdr split)) + (and (helm-buffer--match-mjm (car split) mjm) + (cl-loop for i in (cdr split) always + (helm-buffer--match-pattern i cand)))) + ;; Match only on major-mode. + ((string-match "\\`\\*" helm-pattern) + (helm-buffer--match-mjm (car split) mjm)) + ;; Match on dir of buffer-file-name and multiple patterns. + ((and (string-match "\\`/" helm-pattern) buf-fname (cdr split)) + ;; Exact match for this is better to match end of dir [1]. + (and (string-match + (substring (car split) 1) (helm-basedir buf-fname)) + (cl-loop for i in (cdr split) always + (helm-buffer--match-pattern i cand)))) + ;; Match only on dir of buffer-file-name. + ((and (string-match "\\`/" helm-pattern) buf-fname) + ;; [1] same. + (string-match + (substring (car split) 1) (helm-basedir buf-fname))) + ;; Normal string matching on multiple patterns. + ((string-match "\\s-" helm-pattern) + (cl-loop for i in split always + (helm-buffer--match-pattern i cand))) + ;; Normal string matching. + (t (helm-buffer--match-pattern helm-pattern cand)))))))) + +(defun helm-buffers-match-inside (candidate lst) + (cl-loop for i in lst always + (cond ((string-match "\\`[\\]@" i) + (helm-buffer--match-pattern i candidate)) + ((string-match "\\`@\\(.*\\)" i) + (save-excursion + (let ((str (match-string 1 i))) + (goto-char (point-min)) + (re-search-forward str nil t)))) + (t (helm-buffer--match-pattern i candidate))))) + + +(defun helm-buffer-query-replace-1 (&optional regexp-flag) + "Query replace in marked buffers. +If REGEXP-FLAG is given use `query-replace-regexp'." + (let ((fn (if regexp-flag 'query-replace-regexp 'query-replace)) + (prompt (if regexp-flag "Query replace regexp" "Query replace")) + (bufs (helm-marked-candidates)) + (helm--reading-passwd-or-string t)) + (cl-loop with replace = (query-replace-read-from prompt regexp-flag) + with tostring = (unless (consp replace) + (query-replace-read-to + replace prompt regexp-flag)) + for buf in bufs + do + (save-window-excursion + (helm-switch-to-buffer buf) + (save-excursion + (let ((case-fold-search t)) + (goto-char (point-min)) + (if (consp replace) + (apply fn (list (car replace) (cdr replace))) + (apply fn (list replace tostring))))))))) + +(defun helm-buffer-query-replace-regexp (_candidate) + (helm-buffer-query-replace-1 'regexp)) + +(defun helm-buffer-query-replace (_candidate) + (helm-buffer-query-replace-1)) + +(defun helm-buffer-toggle-diff (candidate) + "Toggle diff buffer CANDIDATE with it's file." + (let (helm-persistent-action-use-special-display) + (helm-aif (get-buffer-window "*Diff*") + (progn (kill-buffer "*Diff*") + (set-window-buffer it helm-current-buffer)) + (diff-buffer-with-file (get-buffer candidate))))) + +(defun helm-buffer-diff-persistent () + "Toggle diff buffer without quitting helm." + (interactive) + (with-helm-alive-p + (helm-attrset 'diff-action 'helm-buffer-toggle-diff) + (helm-execute-persistent-action 'diff-action))) + +(defun helm-revert-buffer (candidate) + (with-current-buffer candidate + (when (buffer-file-name) (revert-buffer t t)))) + +(defun helm-revert-marked-buffers (_ignore) + (mapc 'helm-revert-buffer (helm-marked-candidates))) + +(defun helm-buffer-revert-and-update (_candidate) + (let ((marked (helm-marked-candidates)) + (preselect (helm-get-selection nil t))) + (cl-loop for buf in marked do (helm-revert-buffer buf)) + (when (> (length marked) 1) (helm-unmark-all)) + (helm-force-update (regexp-quote preselect)))) + +(defun helm-buffer-revert-persistent () + "Revert buffer without quitting helm." + (interactive) + (with-helm-alive-p + (helm-attrset 'revert-action '(helm-buffer-revert-and-update . never-split)) + (helm-execute-persistent-action 'revert-action))) + +(defun helm-buffer-save-and-update (_candidate) + (let ((marked (helm-marked-candidates)) + (preselect (helm-get-selection nil t)) + (enable-recursive-minibuffers t)) + (cl-loop for buf in marked do + (with-current-buffer (get-buffer buf) + (when (buffer-file-name) (save-buffer)))) + (when (> (length marked) 1) (helm-unmark-all)) + (helm-force-update (regexp-quote preselect)))) + +(defun helm-buffer-save-persistent () + "Save buffer without quitting helm." + (interactive) + (with-helm-alive-p + (helm-attrset 'save-action '(helm-buffer-save-and-update . never-split)) + (helm-execute-persistent-action 'save-action))) + +(defun helm-buffer-run-kill-persistent () + "Kill buffer without quitting helm." + (interactive) + (with-helm-alive-p + (helm-attrset 'kill-action '(helm-buffers-persistent-kill . never-split)) + (helm-execute-persistent-action 'kill-action))) + +(defun helm-kill-marked-buffers (_ignore) + (mapc 'kill-buffer (helm-marked-candidates))) + +(defun helm-buffer-run-kill-buffers () + "Run kill buffer action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-kill-marked-buffers))) + +(defun helm-buffer-run-grep () + "Run Grep action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-grep-buffers))) + +(defun helm-buffer-run-zgrep () + "Run Grep action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-zgrep-buffers))) + +(defun helm-buffer-run-query-replace-regexp () + "Run Query replace regexp action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-buffer-query-replace-regexp))) + +(defun helm-buffer-run-query-replace () + "Run Query replace action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-buffer-query-replace))) + +(defun helm-buffer-switch-other-window () + "Run switch to other window action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'switch-to-buffer-other-window))) + +(defun helm-buffer-switch-other-frame () + "Run switch to other frame action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'switch-to-buffer-other-frame))) + +(defun helm-buffer-switch-to-elscreen () + "Run switch to elscreen action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-buffer-on-elscreen))) + +(defun helm-buffer-run-ediff () + "Run ediff action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ediff-marked-buffers))) + +(defun helm-buffer-run-ediff-merge () + "Run ediff action from `helm-source-buffers-list'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ediff-marked-buffers-merge))) + +(defun helm-buffers-persistent-kill (buffer) + "Persistent action to kill buffer." + (with-current-buffer (get-buffer buffer) + (if (and (buffer-modified-p) + (buffer-file-name (current-buffer))) + (progn + (save-buffer) + (kill-buffer buffer)) + (kill-buffer buffer))) + (helm-delete-current-selection) + (when (helm-empty-source-p) (helm-next-source)) + (with-helm-temp-hook 'helm-after-persistent-action-hook + (helm-force-update (regexp-quote (helm-get-selection nil t))))) + +(defun helm-buffers-list-persistent-action (candidate) + (if current-prefix-arg + (helm-buffers-persistent-kill candidate) + (helm-switch-to-buffer candidate))) + +(defun helm-ediff-marked-buffers (_candidate &optional merge) + "Ediff 2 marked buffers or CANDIDATE and `helm-current-buffer'. +With optional arg MERGE call `ediff-merge-buffers'." + (let ((lg-lst (length (helm-marked-candidates))) + buf1 buf2) + (cl-case lg-lst + (0 + (error "Error:You have to mark at least 1 buffer")) + (1 + (setq buf1 helm-current-buffer + buf2 (cl-first (helm-marked-candidates)))) + (2 + (setq buf1 (cl-first (helm-marked-candidates)) + buf2 (cl-second (helm-marked-candidates)))) + (t + (error "Error:To much buffers marked!"))) + (if merge + (ediff-merge-buffers buf1 buf2) + (ediff-buffers buf1 buf2)))) + +(defun helm-ediff-marked-buffers-merge (candidate) + "Ediff merge `helm-current-buffer' with CANDIDATE. +See `helm-ediff-marked-buffers'." + (helm-ediff-marked-buffers candidate t)) + +(defun helm-multi-occur-as-action (_candidate) + "Multi occur action for `helm-source-buffers-list'. +Can be used by any source that list buffers." + (let ((helm-moccur-always-search-in-current + (if helm-current-prefix-arg + (not helm-moccur-always-search-in-current) + helm-moccur-always-search-in-current)) + (buffers (helm-marked-candidates)) + (input (cl-loop for i in (split-string helm-pattern " " t) + thereis (and (string-match "\\`@\\(.*\\)" i) + (match-string 1 i))))) + (helm-multi-occur-1 buffers input))) + +(defun helm-buffers-run-multi-occur () + "Run `helm-multi-occur-as-action' by key." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-multi-occur-as-action))) + +(defun helm-buffers-toggle-show-hidden-buffers () + (interactive) + (with-helm-alive-p + (let ((filter-attrs (helm-attr 'filtered-candidate-transformer + helm-source-buffers-list))) + (if (memq 'helm-shadow-boring-buffers filter-attrs) + (helm-attrset 'filtered-candidate-transformer + (cons 'helm-skip-boring-buffers + (remove 'helm-shadow-boring-buffers + filter-attrs)) + helm-source-buffers-list t) + (helm-attrset 'filtered-candidate-transformer + (cons 'helm-shadow-boring-buffers + (remove 'helm-skip-boring-buffers + filter-attrs)) + helm-source-buffers-list t)) + (helm-force-update)))) + + +;;; Candidate Transformers +;; +;; +(defun helm-skip-boring-buffers (buffers _source) + (helm-skip-entries buffers helm-boring-buffer-regexp-list)) + +(defun helm-shadow-boring-buffers (buffers _source) + "Buffers matching `helm-boring-buffer-regexp' will be +displayed with the `file-name-shadow' face if available." + (helm-shadow-entries buffers helm-boring-buffer-regexp-list)) + + +(define-helm-type-attribute 'buffer + `((action + ("Switch to buffer" . helm-switch-to-buffer) + ,(and (locate-library "popwin") '("Switch to buffer in popup window" . popwin:popup-buffer)) + ("Switch to buffer other window" . switch-to-buffer-other-window) + ("Switch to buffer other frame" . switch-to-buffer-other-frame) + ,(and (locate-library "elscreen") '("Display buffer in Elscreen" . helm-find-buffer-on-elscreen)) + ("Query replace regexp" . helm-buffer-query-replace-regexp) + ("Query replace" . helm-buffer-query-replace) + ("View buffer" . view-buffer) + ("Display buffer" . display-buffer) + ("Grep buffers (C-u grep all buffers)" . helm-zgrep-buffers) + ("Multi occur buffer(s)" . helm-multi-occur-as-action) + ("Revert buffer(s)" . helm-revert-marked-buffers) + ("Insert buffer" . insert-buffer) + ("Kill buffer(s)" . helm-kill-marked-buffers) + ("Diff with file" . diff-buffer-with-file) + ("Ediff Marked buffers" . helm-ediff-marked-buffers) + ("Ediff Merge marked buffers" . (lambda (candidate) + (helm-ediff-marked-buffers candidate t)))) + (persistent-help . "Show this buffer") + (filtered-candidate-transformer helm-skip-boring-buffers + helm-buffers-sort-transformer + helm-highlight-buffers)) + "Buffer or buffer name.") + +;;;###autoload +(defun helm-buffers-list () + "Preconfigured `helm' to list buffers." + (interactive) + (helm :sources '(helm-source-buffers-list + helm-source-ido-virtual-buffers + helm-source-buffer-not-found) + :buffer "*helm buffers*" + :keymap helm-buffer-map + :truncate-lines t)) + +(provide 'helm-buffers) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-buffers.el ends here diff --git a/elpa/helm-20140808.2300/helm-buffers.elc b/elpa/helm-20140808.2300/helm-buffers.elc new file mode 100644 index 000000000..1d4340cfa Binary files /dev/null and b/elpa/helm-20140808.2300/helm-buffers.elc differ diff --git a/elpa/helm-20140808.2300/helm-call-tree.el b/elpa/helm-20140808.2300/helm-call-tree.el new file mode 100644 index 000000000..55aa32a89 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-call-tree.el @@ -0,0 +1,128 @@ +;;; helm-call-tree.el --- Helm interface of `simple-call-tree.el'. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;; + +;;; Code: + +(require 'cl-lib) +(require 'helm) + +(declare-function simple-call-tree-analyze "ext:simple-call-tree.el" (&optional test)) + +;; Function is called by +(defvar helm-source-simple-call-tree-functions-callers + '((name . "Function is called by") + (init . helm-simple-call-tree-functions-callers-init) + (multiline) + (candidates . helm-simple-call-tree-candidates) + (persistent-action . helm-simple-call-tree-persistent-action) + (persistent-help . "Show function definitions by rotation") + (action ("Find definition selected by persistent-action" . + helm-simple-call-tree-find-definition))) + "Needs simple-call-tree.el. +http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el") + +(defvar helm-simple-call-tree-tick nil) +(make-variable-buffer-local 'helm-simple-call-tree-tick) +(defun helm-simple-call-tree-analyze-maybe () + (unless (eq (buffer-chars-modified-tick) helm-simple-call-tree-tick) + (simple-call-tree-analyze) + (setq helm-simple-call-tree-tick (buffer-chars-modified-tick)))) + +(defun helm-simple-call-tree-init-base (function message) + (require 'simple-call-tree) + (with-no-warnings + (when (helm-current-buffer-is-modified) + (helm-simple-call-tree-analyze-maybe) + (let ((list (funcall function simple-call-tree-alist))) + (with-current-buffer (helm-candidate-buffer 'local) + (cl-dolist (entry list) + (let ((funcs (concat " " (mapconcat #'identity (cdr entry) "\n ")))) + (insert (car entry) message + (if (string= funcs " ") + " no functions." + funcs) + "\n\n")))))))) + +(defun helm-simple-call-tree-functions-callers-init () + (helm-simple-call-tree-init-base 'simple-call-tree-invert + " is called by\n")) + +(defun helm-simple-call-tree-candidates () + (with-current-buffer (helm-candidate-buffer) + (split-string (buffer-string) "\n\n"))) + +(defvar helm-simple-call-tree-related-functions nil) +(defvar helm-simple-call-tree-function-index 0) +(defun helm-simple-call-tree-persistent-action (candidate) + (unless (eq last-command 'helm-execute-persistent-action) + (setq helm-simple-call-tree-related-functions + (delete "no functions." + (split-string + (replace-regexp-in-string " \\| is called by\\| calls " + "" candidate) + "\n"))) + (setq helm-simple-call-tree-function-index -1)) + (cl-incf helm-simple-call-tree-function-index) + (helm-simple-call-tree-find-definition candidate)) + +(defun helm-simple-call-tree-find-definition (_candidate) + (find-function + (intern + (nth (mod helm-simple-call-tree-function-index + (length helm-simple-call-tree-related-functions)) + helm-simple-call-tree-related-functions)))) + + +;;; Function calls +(defvar helm-source-simple-call-tree-callers-functions + '((name . "Function calls") + (init . helm-simple-call-tree-callers-functions-init) + (multiline) + (candidates . helm-simple-call-tree-candidates) + (persistent-action . helm-simple-call-tree-persistent-action) + (persistent-help . "Show function definitions by rotation") + (action ("Find definition selected by persistent-action" . + helm-simple-call-tree-find-definition))) + "Needs simple-call-tree.el. +http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el") + +(defun helm-simple-call-tree-callers-functions-init () + (helm-simple-call-tree-init-base 'identity " calls \n")) + +;;;###autoload +(defun helm-simple-call-tree () + "Preconfigured `helm' for simple-call-tree. List function relationships. + +Needs simple-call-tree.el. +http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el" + (interactive) + (helm-other-buffer + '(helm-source-simple-call-tree-functions-callers + helm-source-simple-call-tree-callers-functions) + "*helm simple-call-tree*")) + +(provide 'helm-call-tree) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-call-tree.el ends here diff --git a/elpa/helm-20140808.2300/helm-call-tree.elc b/elpa/helm-20140808.2300/helm-call-tree.elc new file mode 100644 index 000000000..61c005876 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-call-tree.elc differ diff --git a/elpa/helm-20140808.2300/helm-color.el b/elpa/helm-20140808.2300/helm-color.el new file mode 100644 index 000000000..e7f751de9 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-color.el @@ -0,0 +1,163 @@ +;;; helm-color.el --- colors and faces -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) + +;;; Customize Face +;; +;; +(defun helm-custom-faces-init () + "Initialize buffer for `helm-source-customize-face'." + (unless (helm-candidate-buffer) + (save-selected-window + (list-faces-display) + (message nil)) + (helm-init-candidates-in-buffer + 'global + (with-current-buffer (get-buffer "*Faces*") + (buffer-substring + (next-single-char-property-change (point-min) 'face) + (point-max)))) + (kill-buffer "*Faces*"))) + +(defvar helm-source-customize-face + '((name . "Customize Face") + (init . helm-custom-faces-init) + (candidates-in-buffer) + (get-line . buffer-substring) + (action . (("Customize" + . (lambda (line) + (customize-face (intern (car (split-string line)))))) + ("Copy name" + . (lambda (line) + (kill-new (car (split-string line " " t)))))))) + "See (info \"(emacs)Faces\")") + +;;; Colors browser +;; +;; +(defun helm-colors-init () + (unless (helm-candidate-buffer) + (save-selected-window + (list-colors-display) + (message nil)) + (helm-init-candidates-in-buffer + 'global + (with-current-buffer (get-buffer "*Colors*") + (buffer-string))) + (kill-buffer "*Colors*"))) + +(defun helm-color-insert-name (candidate) + (with-helm-current-buffer + (insert (helm-colors-get-name candidate)))) + +(defun helm-color-kill-name (candidate) + (kill-new (helm-colors-get-name candidate))) + +(defun helm-color-insert-rgb (candidate) + (with-helm-current-buffer + (insert (helm-colors-get-rgb candidate)))) + +(defun helm-color-kill-rgb (candidate) + (kill-new (helm-colors-get-rgb candidate))) + +(defun helm-color-run-insert-name () + "Insert name of color from `helm-source-colors'" + (interactive) + (with-helm-alive-p (helm-quit-and-execute-action 'helm-color-insert-name))) + +(defun helm-color-run-kill-name () + "Kill name of color from `helm-source-colors'" + (interactive) + (with-helm-alive-p (helm-quit-and-execute-action 'helm-color-kill-name))) + +(defun helm-color-run-insert-rgb () + "Insert RGB of color from `helm-source-colors'" + (interactive) + (with-helm-alive-p (helm-quit-and-execute-action 'helm-color-insert-rgb))) + +(defun helm-color-run-kill-rgb () + "Kill RGB of color from `helm-source-colors'" + (interactive) + (with-helm-alive-p (helm-quit-and-execute-action 'helm-color-kill-rgb))) + +(defvar helm-color-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c n") 'helm-color-run-insert-name) + (define-key map (kbd "C-c N") 'helm-color-run-kill-name) + (define-key map (kbd "C-c r") 'helm-color-run-insert-rgb) + (define-key map (kbd "C-c R") 'helm-color-run-kill-rgb) + (define-key map (kbd "C-c ?") 'helm-color-help) + map)) + +(defvar helm-source-colors + `((name . "Colors") + (init . helm-colors-init) + (candidates-in-buffer) + (get-line . buffer-substring) + (keymap . ,helm-color-map) + (persistent-help . "Kill entry in RGB format.") + (persistent-action . helm-color-kill-rgb) + (mode-line . helm-color-mode-line-string) + (action + ("Copy Name (C-c N)" . helm-color-kill-name) + ("Copy RGB (C-c R)" . helm-color-kill-rgb) + ("Insert Name (C-c n)" . helm-color-insert-name) + ("Insert RGB (C-c r)" . helm-color-insert-rgb)))) + +(defun helm-colors-get-name (candidate) + "Get color name." + (replace-regexp-in-string + " " "" + (with-temp-buffer + (insert (capitalize candidate)) + (goto-char (point-min)) + (search-forward-regexp "\\s-\\{2,\\}") + (delete-region (point) (point-max)) + (buffer-string)))) + +(defun helm-colors-get-rgb (candidate) + "Get color RGB." + (replace-regexp-in-string + " " "" + (with-temp-buffer + (insert (capitalize candidate)) + (goto-char (point-max)) + (search-backward-regexp "\\s-\\{2,\\}") + (delete-region (point) (point-min)) + (buffer-string)))) + +;;;###autoload +(defun helm-colors () + "Preconfigured `helm' for color." + (interactive) + (helm-other-buffer + '(helm-source-colors helm-source-customize-face) + "*helm colors*")) + +(provide 'helm-color) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-color.el ends here diff --git a/elpa/helm-20140808.2300/helm-color.elc b/elpa/helm-20140808.2300/helm-color.elc new file mode 100644 index 000000000..6ac06d250 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-color.elc differ diff --git a/elpa/helm-20140808.2300/helm-command.el b/elpa/helm-20140808.2300/helm-command.el new file mode 100644 index 000000000..57631cd7c --- /dev/null +++ b/elpa/helm-20140808.2300/helm-command.el @@ -0,0 +1,200 @@ +;;; helm-command.el --- Helm execute-exended-command. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-mode) +(require 'helm-elisp) + + +(defgroup helm-command nil + "Emacs command related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-M-x-requires-pattern 0 + "Value of requires-pattern for `helm-M-x'. +Show all candidates on startup when 0 (default)." + :group 'helm-command + :type 'boolean) + +(defcustom helm-M-x-always-save-history nil + "`helm-M-x' Save command in `extended-command-history' even when it fail." + :group 'helm-command + :type 'boolean) + +(defcustom helm-M-x-reverse-history nil + "The history source of `helm-M-x' appear in second position when non--nil." + :group 'helm-command + :type 'boolean) + + +;;; Faces +;; +;; +(defface helm-M-x-key '((t (:foreground "orange" :underline t))) + "Face used in helm-M-x to show keybinding." + :group 'helm-command) + + +(defvar helm-M-x-input-history nil) + +(defvar helm-M-x-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-M-x-help) + map) + "Keymap for `helm-M-x'.") + + +(cl-defun helm-M-x-get-major-mode-command-alist (mode-map) + "Return alist of MODE-MAP." + (cl-loop for key being the key-seqs of mode-map using (key-bindings com) + for str-key = (key-description key) + for ismenu = (string-match "" str-key) + unless ismenu collect (cons str-key com))) + +(defun helm-get-mode-map-from-mode (mode) + "Guess the mode-map name according to MODE. +Some modes don't use conventional mode-map name +so we need to guess mode-map name. e.g python-mode ==> py-mode-map. +Return nil if no mode-map found." + (cl-loop ;; Start with a conventional mode-map name. + with mode-map = (intern-soft (format "%s-map" mode)) + with mode-string = (symbol-name mode) + with mode-name = (replace-regexp-in-string "-mode" "" mode-string) + while (not mode-map) + for count downfrom (length mode-name) + ;; Return when no result after parsing entire string. + when (eq count 0) return nil + for sub-name = (substring mode-name 0 count) + do (setq mode-map (intern-soft (format "%s-map" (concat sub-name "-mode")))) + finally return mode-map)) + +(defun helm-M-x-current-mode-map-alist () + "Return mode-map alist of current `major-mode'." + (let ((map (helm-get-mode-map-from-mode major-mode))) + (when (and map (boundp map)) + (helm-M-x-get-major-mode-command-alist (symbol-value map))))) + + +(defun helm-M-x-transformer (candidates _source) + "filtered-candidate-transformer to show bindings in emacs commands. +Show global bindings and local bindings according to current `major-mode'." + (with-helm-current-buffer + (cl-loop with local-map = (helm-M-x-current-mode-map-alist) + for cand in candidates + for local-key = (car (rassq cand local-map)) + for key = (substitute-command-keys (format "\\[%s]" cand)) + collect + (cons (cond ((and (string-match "^M-x" key) local-key) + (format "%s (%s)" + cand (propertize + local-key + 'face 'helm-M-x-key))) + ((string-match "^M-x" key) cand) + (t (format "%s (%s)" + cand (propertize + key + 'face 'helm-M-x-key)))) + cand) + into ls + finally return + (sort ls #'helm-generic-sort-fn)))) + +(defun helm-M-x--notify-prefix-arg () + ;; Notify a prefix-arg set AFTER calling M-x. + (when prefix-arg + (with-helm-window + (helm-display-mode-line (helm-get-current-source) 'force)))) + +;;;###autoload +(defun helm-M-x () + "Preconfigured `helm' for Emacs commands. +It is `helm' replacement of regular `M-x' `execute-extended-command'. + +Unlike regular `M-x' emacs vanilla `execute-extended-command' command, +the prefix args if needed, are passed AFTER starting `helm-M-x'. + +You can get help on each command by persistent action." + (interactive) + (let* ((history (cl-loop for i in extended-command-history + when (commandp (intern i)) collect i)) + command sym-com in-help help-cand + (helm--mode-line-display-prefarg t) + (pers-help #'(lambda (candidate) + (let ((hbuf (get-buffer (help-buffer)))) + (if (and in-help (string= candidate help-cand) + (null helm-persistent-action-use-special-display)) + (progn + ;; When M-x is started from a help buffer, + ;; Don't kill it as it is helm-current-buffer. + (unless (equal hbuf helm-current-buffer) + (kill-buffer hbuf) + (set-window-buffer (get-buffer-window hbuf) + helm-current-buffer)) + (setq in-help nil)) + (helm-describe-function candidate) + (setq in-help t)) + (setq help-cand candidate)))) + (tm (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg))) + (setq current-prefix-arg nil) + (unwind-protect + (setq command (helm-comp-read + "M-x " obarray + :test 'commandp + :requires-pattern helm-M-x-requires-pattern + :name "Emacs Commands" + :buffer "*helm M-x*" + :persistent-action pers-help + :persistent-help "Describe this command" + :history history + :reverse-history helm-M-x-reverse-history + :del-input nil + :mode-line helm-M-x-mode-line + :must-match t + :nomark t + :keymap helm-M-x-map + :candidates-in-buffer t + :fc-transformer 'helm-M-x-transformer)) + (cancel-timer tm) + (setq helm--mode-line-display-prefarg nil)) + (setq sym-com (intern command)) + (setq current-prefix-arg helm-current-prefix-arg) + ;; Avoid having `this-command' set to *exit-minibuffer. + (setq this-command sym-com + ;; Handle C-x z (repeat) Issue #322 + real-this-command sym-com) + (let ((prefix-arg current-prefix-arg)) + ;; This ugly construct is to save history even on error. + (unless helm-M-x-always-save-history + (command-execute sym-com 'record)) + (setq extended-command-history + (cons command (delete command history))) + (when helm-M-x-always-save-history + (command-execute sym-com 'record))))) + +(provide 'helm-command) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-command.el ends here diff --git a/elpa/helm-20140808.2300/helm-command.elc b/elpa/helm-20140808.2300/helm-command.elc new file mode 100644 index 000000000..6f45e57f2 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-command.elc differ diff --git a/elpa/helm-20140808.2300/helm-config.el b/elpa/helm-20140808.2300/helm-config.el new file mode 100644 index 000000000..155a6be8a --- /dev/null +++ b/elpa/helm-20140808.2300/helm-config.el @@ -0,0 +1,1557 @@ +;;; helm-config.el --- Applications library for `helm.el' -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + + +;;; Require +;; +;; +(require 'easymenu) +(require 'helm-aliases) + + +(defgroup helm-config nil + "Various configurations for Helm." + :group 'helm) + +(defcustom helm-command-prefix-key "C-x c" + "The key `helm-command-prefix' is bound to in the global map." + :type '(choice (string :tag "Key") (const :tag "no binding")) + :group 'helm-config + :set + (lambda (var key) + (when (and (boundp var) (symbol-value var)) + (define-key (current-global-map) + (read-kbd-macro (symbol-value var)) nil)) + (when key + (define-key (current-global-map) + (read-kbd-macro key) 'helm-command-prefix)) + (set var key))) + +(defcustom helm-minibuffer-history-key "C-r" + "The key `helm-minibuffer-history' is bound to in minibuffer local maps." + :type '(choice (string :tag "Key") (const :tag "no binding")) + :group 'helm-config + :set + (lambda (var key) + (cl-dolist (map '(minibuffer-local-completion-map + minibuffer-local-filename-completion-map + minibuffer-local-filename-must-match-map ; Emacs 23.1.+ + minibuffer-local-isearch-map + minibuffer-local-map + minibuffer-local-must-match-filename-map ; Older Emacsen + minibuffer-local-must-match-map + minibuffer-local-ns-map)) + (when (and (boundp map) (keymapp (symbol-value map))) + (when (and (boundp var) (symbol-value var)) + (define-key (symbol-value map) + (read-kbd-macro (symbol-value var)) nil)) + (when key + (define-key (symbol-value map) + (read-kbd-macro key) 'helm-minibuffer-history)))) + (set var key))) + +;;; Command Keymap +;; +;; +(defvar helm-command-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "a") 'helm-apropos) + (define-key map (kbd "e") 'helm-etags-select) + (define-key map (kbd "l") 'helm-locate) + (define-key map (kbd "s") 'helm-surfraw) + (define-key map (kbd "r") 'helm-regexp) + (define-key map (kbd "w") 'helm-w3m-bookmarks) + (define-key map (kbd "x") 'helm-firefox-bookmarks) + (define-key map (kbd "#") 'helm-emms) + (define-key map (kbd "m") 'helm-man-woman) + (define-key map (kbd "t") 'helm-top) + (define-key map (kbd "/") 'helm-find) + (define-key map (kbd "i") 'helm-semantic-or-imenu) + (define-key map (kbd "") 'helm-lisp-completion-at-point) + (define-key map (kbd "p") 'helm-list-emacs-process) + (define-key map (kbd "C-x r b") 'helm-filtered-bookmarks) + (define-key map (kbd "M-y") 'helm-show-kill-ring) + (define-key map (kbd "C-c ") 'helm-all-mark-rings) + (define-key map (kbd "C-x C-f") 'helm-find-files) + (define-key map (kbd "f") 'helm-for-files) + (define-key map (kbd "C-:") 'helm-eval-expression-with-eldoc) + (define-key map (kbd "C-,") 'helm-calcul-expression) + (define-key map (kbd "M-x") 'helm-M-x) + (define-key map (kbd "M-s o") 'helm-occur) + (define-key map (kbd "M-g s") 'helm-do-grep) + (define-key map (kbd "c") 'helm-colors) + (define-key map (kbd "F") 'helm-select-xfont) + (define-key map (kbd "8") 'helm-ucs) + (define-key map (kbd "C-c f") 'helm-recentf) + (define-key map (kbd "C-c g") 'helm-google-suggest) + (define-key map (kbd "h i") 'helm-info-at-point) + (define-key map (kbd "h r") 'helm-info-emacs) + (define-key map (kbd "h g") 'helm-info-gnus) + (define-key map (kbd "C-x C-b") 'helm-buffers-list) + (define-key map (kbd "C-x r i") 'helm-register) + (define-key map (kbd "C-c C-x") 'helm-run-external-command) + (define-key map (kbd "b") 'helm-resume) + map)) + +;; Don't override the keymap we just defined with an empty +;; keymap. This also protect bindings changed by the user. +(defvar helm-command-prefix) +(define-prefix-command 'helm-command-prefix) +(fset 'helm-command-prefix helm-command-map) +(setq helm-command-prefix helm-command-map) + + +;;; Menu +;; +;; +(easy-menu-add-item + nil '("Tools") + '("Helm" + ["Find any Files/Buffers" helm-for-files t] + ["Helm Everywhere (Toggle)" helm-mode t] + ["Helm resume" helm-resume t] + "----" + ("Files" + ["Find files" helm-find-files t] + ["Recent Files" helm-recentf t] + ["Locate" helm-locate t] + ["Search Files with find" helm-find t] + ["Bookmarks" helm-filtered-bookmarks t]) + ("Buffers" + ["Find buffers" helm-buffers-list t]) + ("Commands" + ["Emacs Commands" helm-M-x t] + ["Externals Commands" helm-run-external-command t]) + ("Help" + ["Helm Apropos" helm-apropos t]) + ("Info" + ["Info at point" helm-info-at-point t] + ["Emacs Manual index" helm-info-emacs t] + ["Gnus Manual index" helm-info-gnus t]) + ("Org" + ["Org keywords" helm-org-keywords t] + ["Org headlines" helm-org-headlines t]) + ("Tools" + ["Occur" helm-occur t] + ["Grep" helm-do-grep t] + ["Etags" helm-etags-select t] + ["Lisp complete at point" helm-lisp-completion-at-point t] + ["Browse Kill ring" helm-show-kill-ring t] + ["Browse register" helm-register t] + ["Mark Ring" helm-all-mark-rings t] + ["Regexp handler" helm-regexp t] + ["Colors & Faces" helm-colors t] + ["Show xfonts" helm-select-xfont t] + ["Ucs Symbols" helm-ucs t] + ["Imenu" helm-imenu t] + ["Semantic or Imenu" helm-semantic-or-imenu t] + ["Google Suggest" helm-google-suggest t] + ["Eval expression" helm-eval-expression-with-eldoc t] + ["Calcul expression" helm-calcul-expression t] + ["Man pages" helm-man-woman t] + ["Top externals process" helm-top t] + ["Emacs internals process" helm-list-emacs-process t]) + "----" + ["Preferred Options" helm-configuration t]) + "Spell Checking") + +(easy-menu-add-item nil '("Tools") '("----") "Spell Checking") + +;;;###autoload +(defun helm-configuration () + "Customize `helm'." + (interactive) + (customize-group "helm")) + +;;; Fontlock +(cl-dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) + (font-lock-add-keywords + mode + '(("(\\<\\(with-helm-after-update-hook\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-temp-hook\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-window\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-quittable\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-current-buffer\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-buffer\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-show-completion\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-default-directory\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-display-same-window\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(with-helm-restore-variables\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(define-helm-type-attribute\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(helm-multi-key-defun\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(helm-while-no-input\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(helm-aif\\)\\>" 1 font-lock-keyword-face)))) + +;;; Compatibility emacs-24.4+ +;; Inlined from Emacs trunk. +(defalias 'function-put + ;; We don't want people to just use `put' because we can't conveniently + ;; hook into `put' to remap old properties to new ones. But for now, there's + ;; no such remapping, so we just call `put'. + #'(lambda (f prop value) (put f prop value)) + "Set function F's property PROP to VALUE. +The namespace for PROP is shared with symbols. +So far, F can only be a symbol, not a lambda expression.") + + +;;; Start of automatically extracted autoloads. + + +;;;### (autoloads nil "helm" "helm.el" (21464 47958 567939 782000)) +;;; Generated autoloads from helm.el + +(autoload 'helm-define-multi-key "helm" "\ +In KEYMAP, define key sequence KEY for function list FUNCTIONS. +Each function run sequentialy each time the key KEY is pressed. +If DELAY is specified switch back to initial function of FUNCTIONS list +after DELAY seconds. +The functions in FUNCTIONS list are functions with no args. +e.g + (defun foo () + (message \"Run foo\")) + (defun bar () + (message \"Run bar\")) + (defun baz () + (message \"Run baz\")) + +\(helm-define-multi-key global-map \" q\" '(foo bar baz) 2) + +Each time \" q\" is pressed the next function is executed, if you wait +More than 2 seconds, next hit will run again the first function and so on. + +\(fn KEYMAP KEY FUNCTIONS &optional DELAY)" nil nil) + +(autoload 'helm-multi-key-defun "helm" "\ +Define NAME as a multi-key command running FUNS. +After DELAY seconds the FUNS list is reinitialised. +See `helm-define-multi-key'. + +\(fn NAME DOCSTRING FUNS &optional DELAY)" nil t) + +(put 'helm-multi-key-defun 'lisp-indent-function '2) + +(autoload 'helm-define-key-with-subkeys "helm" "\ +Allow defining a KEY without having to type its prefix again on next calls. +Arg MAP is the keymap to use, SUBKEY is the initial long keybinding to +call COMMAND. +Arg OTHER-SUBKEYS is an unquoted alist specifying other short keybindings +to use once started. +e.g: + +\(helm-define-key-with-subkeys global-map + (kbd \"C-x v n\") ?n 'git-gutter:next-hunk ((?p . 'git-gutter:previous-hunk))) + + +In this example, `C-x v n' will run `git-gutter:next-hunk' subsequent hit on \"n\" +will run this command again and subsequent hit on \"p\" will run `git-gutter:previous-hunk'. + +Arg MENU is a string to display in minibuffer to describe SUBKEY and OTHER-SUBKEYS. +Arg EXIT-FN specify a function to run on exit. + +Any other keys pressed run their assigned command defined in MAP and exit the loop. + +\(fn MAP KEY SUBKEY COMMAND &optional OTHER-SUBKEYS MENU EXIT-FN)" nil t) + +(autoload 'helm-debug-open-last-log "helm" "\ +Open helm log file of last helm session. +If `helm-last-log-file' is nil, switch to `helm-debug-buffer' . + +\(fn)" t nil) + +(autoload 'helm "helm" "\ +Main function to execute helm sources. + +Keywords supported: +:sources :input :prompt :resume :preselect +:buffer :keymap :default :history :allow-nest + +Extra LOCAL-VARS keywords are supported, see below. + +PLIST is a list like (:key1 val1 :key2 val2 ...) or +\(&optional sources input prompt resume + preselect buffer keymap default history). + +Basic keywords are the following: + +:sources + +A list of sources used for this session. It also accepts a +symbol, interpreted as a variable of a helm source +i.e (a symbol can be passed instead of a list of sources). +It also accepts an alist representing a helm source, which is +detected by (assq 'name ANY-SOURCES). +NOTE: In this case the source is embedded in the helm command and +have no symbol name, so it is not reachable from outside. +It will be referenced in `helm-sources' as a whole alist. + +:input + +Temporary value of `helm-pattern', ie. initial input of minibuffer. + +:prompt + +Prompt other than \"pattern: \". + +:resume + +If t, Resurrect previously instance of `helm'. Skip the initialization. +If 'noresume, this instance of `helm' cannot be resumed. + +:preselect + +Initially selected candidate. Specified by exact candidate or a regexp. + +:buffer + +`helm-buffer' instead of *helm*. + +:keymap + +`helm-map' for current `helm' session. + +:default + +A default argument that will be inserted in minibuffer with \\\\[next-history-element]. +When nil or not present `thing-at-point' will be used instead. +If `helm-maybe-use-default-as-input' is non--nil display will be +updated using :default arg as input unless :input is specified, +which in this case will take precedence on :default +This is a string or a list, in this case the car of the list will +be used as initial default input, but you will be able to cycle in this +list with \\\\[next-history-element]. + +:history + +By default all minibuffer input is pushed to `minibuffer-history', +if an argument HISTORY is provided, input will be pushed to HISTORY. +History element should be a symbol. + +:allow-nest + +Allow running this helm command within a running helm session. + +Of course, conventional arguments are supported, the two are same. + +\(helm :sources sources :input input :prompt prompt :resume resume + :preselect preselect :buffer buffer :keymap keymap :default default + :history history) + +and + +\(helm sources input prompt resume preselect buffer keymap default history) + +are the same. + +However the use of non keyword args is deprecated and should not be used. + +Other keywords are interpreted as local variables of this helm session. +The `helm-' prefix can be omitted. For example, + +\(helm :sources 'helm-source-buffers-list + :buffer \"*buffers*\" :candidate-number-limit 10) + +means starting helm session with `helm-source-buffers' +source in *buffers* buffer and set variable `helm-candidate-number-limit' +to 10 as session local variable. + +\(fn &key SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT HISTORY ALLOW-NEST OTHER-LOCAL-VARS)" nil nil) + +(autoload 'helm-other-buffer "helm" "\ +Simplified interface of `helm' with other `helm-buffer'. +Call `helm' with only ANY-SOURCES and ANY-BUFFER as args. + +\(fn ANY-SOURCES ANY-BUFFER)" nil nil) + +;;;*** + +;;;### (autoloads nil "helm-adaptive" "helm-adaptive.el" (21430 15697 +;;;;;; 745354 26000)) +;;; Generated autoloads from helm-adaptive.el + +(autoload 'helm-reset-adaptive-history "helm-adaptive" "\ +Delete all `helm-adaptive-history' and his file. +Useful when you have a old or corrupted `helm-adaptive-history-file'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-apt" "helm-apt.el" (21406 64798 644023 +;;;;;; 263000)) +;;; Generated autoloads from helm-apt.el + +(autoload 'helm-apt "helm-apt" "\ +Preconfigured `helm' : frontend of APT package manager. +With a prefix arg reload cache. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-bbdb" "helm-bbdb.el" (21430 15697 565354 +;;;;;; 24000)) +;;; Generated autoloads from helm-bbdb.el + +(autoload 'helm-bbdb "helm-bbdb" "\ +Preconfigured `helm' for BBDB. + +Needs BBDB. + +http://bbdb.sourceforge.net/ + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-bookmark" "helm-bookmark.el" (21430 15697 +;;;;;; 577354 25000)) +;;; Generated autoloads from helm-bookmark.el + +(autoload 'helm-bookmarks "helm-bookmark" "\ +Preconfigured `helm' for bookmarks. + +\(fn)" t nil) + +(autoload 'helm-pp-bookmarks "helm-bookmark" "\ +Preconfigured `helm' for bookmarks (pretty-printed). + +\(fn)" t nil) + +(autoload 'helm-filtered-bookmarks "helm-bookmark" "\ +Preconfigured helm for bookmarks (filtered by category). +Optional source `helm-source-bookmark-addressbook' is loaded +only if external library addressbook-bookmark.el is available. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-buffers" "helm-buffers.el" (21435 58357 +;;;;;; 591422 470000)) +;;; Generated autoloads from helm-buffers.el + +(autoload 'helm-buffers-list "helm-buffers" "\ +Preconfigured `helm' to list buffers. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-call-tree" "helm-call-tree.el" (21341 +;;;;;; 6020 974577 405000)) +;;; Generated autoloads from helm-call-tree.el + +(autoload 'helm-simple-call-tree "helm-call-tree" "\ +Preconfigured `helm' for simple-call-tree. List function relationships. + +Needs simple-call-tree.el. +http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-color" "helm-color.el" (21430 15697 597354 +;;;;;; 25000)) +;;; Generated autoloads from helm-color.el + +(autoload 'helm-colors "helm-color" "\ +Preconfigured `helm' for color. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-command" "helm-command.el" (21430 15697 +;;;;;; 601354 25000)) +;;; Generated autoloads from helm-command.el + +(autoload 'helm-M-x "helm-command" "\ +Preconfigured `helm' for Emacs commands. +It is `helm' replacement of regular `M-x' `execute-extended-command'. + +Unlike regular `M-x' emacs vanilla `execute-extended-command' command, +the prefix args if needed, are passed AFTER starting `helm-M-x'. + +You can get help on each command by persistent action. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-dabbrev" "helm-dabbrev.el" (21341 6020 +;;;;;; 974577 405000)) +;;; Generated autoloads from helm-dabbrev.el + +(autoload 'helm-dabbrev "helm-dabbrev" "\ + + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-elisp" "helm-elisp.el" (21465 387 2705 +;;;;;; 912000)) +;;; Generated autoloads from helm-elisp.el + +(autoload 'helm-lisp-completion-at-point "helm-elisp" "\ +Helm lisp symbol completion at point. + +\(fn)" t nil) + +(autoload 'helm-complete-file-name-at-point "helm-elisp" "\ +Complete file name at point. + +\(fn &optional FORCE)" t nil) + +(autoload 'helm-lisp-indent "helm-elisp" "\ + + +\(fn)" t nil) + +(autoload 'helm-lisp-completion-or-file-name-at-point "helm-elisp" "\ +Complete lisp symbol or filename at point. +Filename completion happen if string start after or between a double quote. + +\(fn)" t nil) + +(autoload 'helm-apropos "helm-elisp" "\ +Preconfigured helm to describe commands, functions, variables and faces. + +\(fn)" t nil) + +(autoload 'helm-manage-advice "helm-elisp" "\ +Preconfigured `helm' to disable/enable function advices. + +\(fn)" t nil) + +(autoload 'helm-locate-library "helm-elisp" "\ + + +\(fn)" t nil) + +(autoload 'helm-timers "helm-elisp" "\ +Preconfigured `helm' for timers. + +\(fn)" t nil) + +(autoload 'helm-complex-command-history "helm-elisp" "\ + + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-elisp-package" "helm-elisp-package.el" +;;;;;; (21430 15697 613354 25000)) +;;; Generated autoloads from helm-elisp-package.el + +(autoload 'helm-list-elisp-packages "helm-elisp-package" "\ + + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-elscreen" "helm-elscreen.el" (21341 6020 +;;;;;; 974577 405000)) +;;; Generated autoloads from helm-elscreen.el + +(autoload 'helm-elscreen "helm-elscreen" "\ +Preconfigured helm to list elscreen. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-emms" "helm-emms.el" (21430 15697 641354 +;;;;;; 25000)) +;;; Generated autoloads from helm-emms.el + +(autoload 'helm-emms "helm-emms" "\ +Preconfigured `helm' for emms sources. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-eshell" "helm-eshell.el" (21341 6020 +;;;;;; 974577 405000)) +;;; Generated autoloads from helm-eshell.el + +(autoload 'helm-esh-pcomplete "helm-eshell" "\ +Preconfigured helm to provide helm completion in eshell. + +\(fn)" t nil) + +(autoload 'helm-eshell-history "helm-eshell" "\ +Preconfigured helm for eshell history. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-eval" "helm-eval.el" (21341 6020 974577 +;;;;;; 405000)) +;;; Generated autoloads from helm-eval.el + +(autoload 'helm-eval-expression "helm-eval" "\ +Preconfigured helm for `helm-source-evaluation-result'. + +\(fn ARG)" t nil) + +(autoload 'helm-eval-expression-with-eldoc "helm-eval" "\ +Preconfigured helm for `helm-source-evaluation-result' with `eldoc' support. + +\(fn)" t nil) + +(autoload 'helm-calcul-expression "helm-eval" "\ +Preconfigured helm for `helm-source-calculation-result'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-external" "helm-external.el" (21430 15697 +;;;;;; 641354 25000)) +;;; Generated autoloads from helm-external.el + +(autoload 'helm-run-external-command "helm-external" "\ +Preconfigured `helm' to run External PROGRAM asyncronously from Emacs. +If program is already running exit with error. +You can set your own list of commands with +`helm-external-commands-list'. + +\(fn PROGRAM)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-files" "helm-files.el" (21464 47958 303939 +;;;;;; 780000)) +;;; Generated autoloads from helm-files.el + +(autoload 'helm-browse-project "helm-files" "\ +Browse files and see status of project with its vcs. +Only hg and git are supported for now. +Fall back to `helm-find-files' if directory is not under +control of one of those vcs. +Need dependencies: + +and +. + +\(fn)" t nil) + +(autoload 'helm-find "helm-files" "\ +Preconfigured `helm' for the find shell command. + +\(fn ARG)" t nil) + +(autoload 'helm-find-files "helm-files" "\ +Preconfigured `helm' for helm implementation of `find-file'. +Called with a prefix arg show history if some. +Don't call it from programs, use `helm-find-files-1' instead. +This is the starting point for nearly all actions you can do on files. + +\(fn ARG)" t nil) + +(autoload 'helm-for-files "helm-files" "\ +Preconfigured `helm' for opening files. +Run all sources defined in `helm-for-files-preferred-list'. + +\(fn)" t nil) + +(autoload 'helm-recentf "helm-files" "\ +Preconfigured `helm' for `recentf'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-firefox" "helm-firefox.el" (21430 15697 +;;;;;; 657354 25000)) +;;; Generated autoloads from helm-firefox.el + +(autoload 'helm-firefox-bookmarks "helm-firefox" "\ +Preconfigured `helm' for firefox bookmark. +You will have to enable html bookmarks in firefox: +open about:config in firefox and double click on this line to enable value to true: + +user_pref(\"browser.bookmarks.autoExportHTML\", false); + +You should have now: + +user_pref(\"browser.bookmarks.autoExportHTML\", true); + +After closing firefox, you will be able to browse you bookmarks. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-font" "helm-font.el" (21341 6020 974577 +;;;;;; 405000)) +;;; Generated autoloads from helm-font.el + +(autoload 'helm-select-xfont "helm-font" "\ +Preconfigured `helm' to select Xfont. + +\(fn)" t nil) + +(autoload 'helm-ucs "helm-font" "\ +Preconfigured helm for `ucs-names' math symbols. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-gentoo" "helm-gentoo.el" (21341 6020 +;;;;;; 974577 405000)) +;;; Generated autoloads from helm-gentoo.el + +(autoload 'helm-gentoo "helm-gentoo" "\ +Preconfigured `helm' for gentoo linux. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-grep" "helm-grep.el" (21464 47958 343939 +;;;;;; 781000)) +;;; Generated autoloads from helm-grep.el + +(autoload 'helm-goto-precedent-file "helm-grep" "\ +Go to precedent file in helm grep/etags buffers. + +\(fn)" t nil) + +(autoload 'helm-goto-next-file "helm-grep" "\ +Go to precedent file in helm grep/etags buffers. + +\(fn)" t nil) + +(autoload 'helm-grep-run-save-buffer "helm-grep" "\ +Run grep save results action from `helm-do-grep-1'. + +\(fn)" t nil) + +(autoload 'helm-grep-mode "helm-grep" "\ +Major mode to provide actions in helm grep saved buffer. + +Special commands: +\\{helm-grep-mode-map} + +\(fn)" t nil) + +(autoload 'helm-gm-next-file "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-gm-precedent-file "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-mode-jump "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-mode-jump-other-window-forward "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-mode-jump-other-window-backward "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-mode-jump-other-window "helm-grep" "\ + + +\(fn)" t nil) + +(autoload 'helm-do-grep "helm-grep" "\ +Preconfigured helm for grep. +Contrarily to Emacs `grep', no default directory is given, but +the full path of candidates in ONLY. +That allow to grep different files not only in `default-directory' but anywhere +by marking them (C-). If one or more directory is selected +grep will search in all files of these directories. +You can also use wildcard in the base name of candidate. +If a prefix arg is given use the -r option of grep (recurse). +The prefix arg can be passed before or after start file selection. +See also `helm-do-grep-1'. + +\(fn)" t nil) + +(autoload 'helm-do-zgrep "helm-grep" "\ +Preconfigured helm for zgrep. + +\(fn)" t nil) + +(autoload 'helm-do-pdfgrep "helm-grep" "\ +Preconfigured helm for pdfgrep. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-help" "helm-help.el" (21458 29137 663428 +;;;;;; 241000)) +;;; Generated autoloads from helm-help.el + +(autoload 'helm-help "helm-help" "\ +Help of `helm'. + +\(fn)" t nil) + +(autoload 'helm-buffer-help "helm-help" "\ +Help command for helm buffers. + +\(fn)" t nil) + +(autoload 'helm-ff-help "helm-help" "\ +Help command for `helm-find-files'. + +\(fn)" t nil) + +(autoload 'helm-read-file-name-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-generic-file-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-grep-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-pdfgrep-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-etags-help "helm-help" "\ +The help function for etags. + +\(fn)" t nil) + +(autoload 'helm-ucs-help "helm-help" "\ +Help command for `helm-ucs'. + +\(fn)" t nil) + +(autoload 'helm-bookmark-help "helm-help" "\ +Help command for bookmarks. + +\(fn)" t nil) + +(autoload 'helm-esh-help "helm-help" "\ +Help command for `helm-find-files-eshell-command-on-file'. + +\(fn)" t nil) + +(autoload 'helm-buffers-ido-virtual-help "helm-help" "\ +Help command for ido virtual buffers. + +\(fn)" t nil) + +(autoload 'helm-moccur-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-top-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-apt-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-el-package-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-M-x-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-imenu-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-color-help "helm-help" "\ + + +\(fn)" t nil) + +(autoload 'helm-semantic-help "helm-help" "\ + + +\(fn)" t nil) + +(defvar helm-buffer-mode-line-string '("Buffer(s)" "\\\\[helm-buffer-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "String displayed in mode-line in `helm-source-buffers-list'")) + +(defvar helm-color-mode-line-string '("Colors" "\\\\[helm-color-help]:Help/\\[helm-color-run-insert-name]:Insert name/\\[helm-color-run-insert-rgb]:Insert RGB/with shift: Kill")) + +(defvar helm-buffers-ido-virtual-mode-line-string '("Killed Buffer(s)" "\\\\[helm-buffers-ido-virtual-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "String displayed in mode-line in `helm-source-buffers-list'")) + +(defvar helm-ff-mode-line-string "\\\\[helm-ff-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "\ +String displayed in mode-line in `helm-source-find-files'") + +(defvar helm-read-file-name-mode-line-string "\\\\[helm-read-file-name-help]:Help \\[helm-cr-empty-string]:Empty \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "\ +String displayed in mode-line in `helm-source-find-files'.") + +(defvar helm-generic-file-mode-line-string "\\\\[helm-generic-file-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend" "\ +String displayed in mode-line in Locate.") + +(defvar helm-grep-mode-line-string "\\\\[helm-grep-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend" "\ +String displayed in mode-line in `helm-do-grep'.") + +(defvar helm-pdfgrep-mode-line-string "\\\\[helm-pdfgrep-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend" "\ +String displayed in mode-line in `helm-do-pdfgrep'.") + +(defvar helm-etags-mode-line-string "\\\\[helm-etags-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "\ +String displayed in mode-line in `helm-etags-select'.") + +(defvar helm-ucs-mode-line-string "\\\\[helm-ucs-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct" "\ +String displayed in mode-line in `helm-ucs'.") + +(defvar helm-bookmark-mode-line-string '("Bookmark(s)" "\\\\[helm-bookmark-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct") "\ +String displayed in mode-line in `helm-source-buffers-list'") + +(defvar helm-occur-mode-line "\\\\[helm-help]:Help \\\\[helm-occur-run-query-replace-regexp]:Query replace regexp \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-moccur-mode-line "\\\\[helm-moccur-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-comp-read-mode-line "\\\\[helm-cr-empty-string]:Empty \\\\[helm-help]:Help \\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct") + +(defvar helm-top-mode-line "\\\\[helm-top-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-apt-mode-line "\\\\[helm-apt-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-el-package-mode-line "\\\\[helm-el-package-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-M-x-mode-line "\\\\[helm-M-x-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-imenu-mode-line "\\\\[helm-imenu-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(defvar helm-semantic-mode-line "\\\\[helm-semantic-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend") + +(autoload 'helm-describe-helm-attribute "helm-help" "\ +Display the full documentation of HELM-ATTRIBUTE. +HELM-ATTRIBUTE should be a symbol. + +\(fn HELM-ATTRIBUTE)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-imenu" "helm-imenu.el" (21436 11223 435576 +;;;;;; 850000)) +;;; Generated autoloads from helm-imenu.el + +(autoload 'helm-imenu "helm-imenu" "\ +Preconfigured `helm' for `imenu'. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-info" "helm-info.el" (21430 15697 685354 +;;;;;; 25000)) +;;; Generated autoloads from helm-info.el + +(autoload 'helm-info-at-point "helm-info" "\ +Preconfigured `helm' for searching info at point. +With a prefix-arg insert symbol at point. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-locate" "helm-locate.el" (21464 47958 +;;;;;; 387939 781000)) +;;; Generated autoloads from helm-locate.el + +(autoload 'helm-locate-read-file-name "helm-locate" "\ + + +\(fn PROMPT)" nil nil) + +(autoload 'helm-locate "helm-locate" "\ +Preconfigured `helm' for Locate. +Note: you can add locate options after entering pattern. +See 'man locate' for valid options and also `helm-locate-command'. + +You can specify a local database with prefix argument ARG. +With two prefix arg, refresh the current local db or create it +if it doesn't exists. +Many databases can be used: navigate and mark them. +See also `helm-locate-with-db'. + +To create a user specific db, use +\"updatedb -l 0 -o db_path -U directory\". +Where db_path is a filename matched by +`helm-locate-db-file-regexp'. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-man" "helm-man.el" (21341 6020 978577 +;;;;;; 405000)) +;;; Generated autoloads from helm-man.el + +(autoload 'helm-man-woman "helm-man" "\ +Preconfigured `helm' for Man and Woman pages. +With a prefix arg reinitialize the cache. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-match-plugin" "helm-match-plugin.el" +;;;;;; (21341 6020 978577 405000)) +;;; Generated autoloads from helm-match-plugin.el + +(defvar helm-match-plugin-mode nil "\ +Non-nil if Helm-Match-Plugin mode is enabled. +See the command `helm-match-plugin-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `helm-match-plugin-mode'.") + +(custom-autoload 'helm-match-plugin-mode "helm-match-plugin" nil) + +(autoload 'helm-match-plugin-mode "helm-match-plugin" "\ +Add more flexible regexp matching for helm. +See `helm-mp-matching-method' for the behavior of each method. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-misc" "helm-misc.el" (21341 6020 978577 +;;;;;; 405000)) +;;; Generated autoloads from helm-misc.el + +(autoload 'helm-browse-menubar "helm-misc" "\ +Helm interface to the menubar using lacarte.el. + +\(fn)" t nil) + +(autoload 'helm-world-time "helm-misc" "\ +Preconfigured `helm' to show world time. + +\(fn)" t nil) + +(autoload 'helm-insert-latex-math "helm-misc" "\ +Preconfigured helm for latex math symbols completion. + +\(fn)" t nil) + +(autoload 'helm-eev-anchors "helm-misc" "\ +Preconfigured `helm' for eev anchors. + +\(fn)" t nil) + +(autoload 'helm-ratpoison-commands "helm-misc" "\ +Preconfigured `helm' to execute ratpoison commands. + +\(fn)" t nil) + +(autoload 'helm-stumpwm-commands "helm-misc" "\ + + +\(fn)" t nil) + +(autoload 'helm-mini "helm-misc" "\ +Preconfigured `helm' lightweight version (buffer -> recentf). + +\(fn)" t nil) + +(autoload 'helm-minibuffer-history "helm-misc" "\ +Preconfigured `helm' for `minibuffer-history'. + +\(fn)" t nil) + +(autoload 'helm-comint-input-ring "helm-misc" "\ +Predefined `helm' that provide completion of `comint' history. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-mode" "helm-mode.el" (21458 20740 105265 +;;;;;; 165000)) +;;; Generated autoloads from helm-mode.el + +(autoload 'helm-comp-read "helm-mode" "\ +Read a string in the minibuffer, with helm completion. + +It is helm `completing-read' equivalent. + +- PROMPT is the prompt name to use. + +- COLLECTION can be a list, vector, obarray or hash-table. + It can be also a function that receives three arguments: + the values string, predicate and t. See `all-completions' for more details. + +Keys description: + +- TEST: A predicate called with one arg i.e candidate. + +- INITIAL-INPUT: Same as input arg in `helm'. + +- PRESELECT: See preselect arg of `helm'. + +- DEFAULT: This option is used only for compatibility with regular + Emacs `completing-read' (Same as DEFAULT arg of `completing-read'). + +- BUFFER: Name of helm-buffer. + +- MUST-MATCH: Candidate selected must be one of COLLECTION. + +- REVERSE-HISTORY: When non--nil display history source after current + source completion. + +- REQUIRES-PATTERN: Same as helm attribute, default is 0. + +- HISTORY: A list containing specific history, default is nil. + When it is non--nil, all elements of HISTORY are displayed in + a special source before COLLECTION. + +- INPUT-HISTORY: A symbol. the minibuffer input history will be + stored there, if nil or not provided, `minibuffer-history' + will be used instead. + +- CASE-FOLD: Same as `helm-case-fold-search'. + +- DEL-INPUT: Boolean, when non--nil (default) remove the partial + minibuffer input from HISTORY is present. + +- PERSISTENT-ACTION: A function called with one arg i.e candidate. + +- PERSISTENT-HELP: A string to document PERSISTENT-ACTION. + +- MODE-LINE: A string or list to display in mode line. + Default is `helm-comp-read-mode-line'. + +- KEYMAP: A keymap to use in this `helm-comp-read'. + (the keymap will be shared with history source) + +- NAME: The name related to this local source. + +- EXEC-WHEN-ONLY-ONE: Bound `helm-execute-action-at-once-if-one' + to non--nil. (possibles values are t or nil). + +- VOLATILE: Use volatile attribute (enabled by default). + +- SORT: A predicate to give to `sort' e.g `string-lessp'. + +- FC-TRANSFORMER: A `filtered-candidate-transformer' function. + +- MARKED-CANDIDATES: If non--nil return candidate or marked candidates as a list. + +- NOMARK: When non--nil don't allow marking candidates. + +- ALISTP: (default is non--nil) See `helm-comp-read-get-candidates'. + +- CANDIDATES-IN-BUFFER: when non--nil use a source build with + `helm-candidates-in-buffer' which is much faster. + Argument VOLATILE have no effect when CANDIDATES-IN-BUFFER is non--nil. + +Any prefix args passed during `helm-comp-read' invocation will be recorded +in `helm-current-prefix-arg', otherwise if prefix args were given before +`helm-comp-read' invocation, the value of `current-prefix-arg' will be used. +That's mean you can pass prefix args before or after calling a command +that use `helm-comp-read' See `helm-M-x' for example. + +\(fn PROMPT COLLECTION &key TEST INITIAL-INPUT DEFAULT PRESELECT (buffer \"*Helm Completions*\") MUST-MATCH REVERSE-HISTORY (requires-pattern 0) HISTORY INPUT-HISTORY (case-fold helm-comp-read-case-fold-search) (del-input t) (persistent-action nil) (persistent-help \"DoNothing\") (mode-line helm-comp-read-mode-line) (keymap helm-comp-read-map) (name \"Helm Completions\") CANDIDATES-IN-BUFFER EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND (volatile t) SORT (fc-transformer (quote helm-cr-default-transformer)) MARKED-CANDIDATES NOMARK (alistp t))" nil nil) + +(defvar helm-mode nil "\ +Non-nil if Helm mode is enabled. +See the command `helm-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `helm-mode'.") + +(custom-autoload 'helm-mode "helm-mode" nil) + +(autoload 'helm-mode "helm-mode" "\ +Toggle generic helm completion. + +All functions in Emacs that use `completing-read' +or `read-file-name' and friends will use helm interface +when this mode is turned on. +However you can modify this behavior for functions of your choice +with `helm-completing-read-handlers-alist'. + +Called with a positive arg, turn on unconditionally, with a +negative arg turn off. +You can turn it on with `helm-mode'. + +Some crap emacs functions may not be supported, +e.g `ffap-alternate-file' and maybe others +You can add such functions to `helm-completing-read-handlers-alist' +with a nil value. + +Note: This mode is incompatible with Emacs23. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-net" "helm-net.el" (21435 58357 603422 +;;;;;; 471000)) +;;; Generated autoloads from helm-net.el + +(autoload 'helm-surfraw "helm-net" "\ +Preconfigured `helm' to search PATTERN with search ENGINE. + +\(fn PATTERN ENGINE)" t nil) + +(autoload 'helm-google-suggest "helm-net" "\ +Preconfigured `helm' for google search with google suggest. + +\(fn)" t nil) + +(autoload 'helm-yahoo-suggest "helm-net" "\ +Preconfigured `helm' for Yahoo searching with Yahoo suggest. + +\(fn)" t nil) + +(autoload 'helm-wikipedia-suggest "helm-net" "\ +Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-org" "helm-org.el" (21464 47958 427939 +;;;;;; 781000)) +;;; Generated autoloads from helm-org.el + +(autoload 'helm-org-keywords "helm-org" "\ +Preconfigured `helm' for org keywords. + +\(fn)" t nil) + +(autoload 'helm-org-headlines "helm-org" "\ +Preconfigured helm to show org headlines. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-regexp" "helm-regexp.el" (21448 61607 +;;;;;; 655322 985000)) +;;; Generated autoloads from helm-regexp.el + +(defvar helm-occur-match-plugin-mode t "\ +Non-nil if Helm-Occur-Match-Plugin mode is enabled. +See the command `helm-occur-match-plugin-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `helm-occur-match-plugin-mode'.") + +(custom-autoload 'helm-occur-match-plugin-mode "helm-regexp" nil) + +(autoload 'helm-occur-match-plugin-mode "helm-regexp" "\ +Turn On/Off `helm-match-plugin-mode' only for `helm-m/occur'. + +\(fn &optional ARG)" t nil) + +(autoload 'helm-moccur-run-save-buffer "helm-regexp" "\ +Run grep save results action from `helm-do-grep-1'. + +\(fn)" t nil) + +(autoload 'helm-moccur-mode "helm-regexp" "\ +Major mode to provide actions in helm moccur saved buffer. + +Special commands: +\\{helm-moccur-mode-map} + +\(fn)" t nil) + +(autoload 'helm-regexp "helm-regexp" "\ +Preconfigured helm to build regexps. +`query-replace-regexp' can be run from there against found regexp. + +\(fn)" t nil) + +(autoload 'helm-occur "helm-regexp" "\ +Preconfigured helm for Occur. + +\(fn)" t nil) + +(autoload 'helm-occur-from-isearch "helm-regexp" "\ +Invoke `helm-occur' from isearch. + +\(fn)" t nil) + +(autoload 'helm-multi-occur "helm-regexp" "\ +Preconfigured helm for multi occur. + + BUFFERS is a list of buffers to search through. +With a prefix arg, reverse the behavior of +`helm-moccur-always-search-in-current'. +The prefix arg can be set before calling `helm-multi-occur' +or during the buffer selection. + +\(fn BUFFERS)" t nil) + +(autoload 'helm-multi-occur-from-isearch "helm-regexp" "\ +Invoke `helm-multi-occur' from isearch. + +With a prefix arg, reverse the behavior of +`helm-moccur-always-search-in-current'. +The prefix arg can be set before calling +`helm-multi-occur-from-isearch' or during the buffer selection. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-ring" "helm-ring.el" (21341 6020 978577 +;;;;;; 405000)) +;;; Generated autoloads from helm-ring.el + +(autoload 'helm-mark-ring "helm-ring" "\ +Preconfigured `helm' for `helm-source-mark-ring'. + +\(fn)" t nil) + +(autoload 'helm-global-mark-ring "helm-ring" "\ +Preconfigured `helm' for `helm-source-global-mark-ring'. + +\(fn)" t nil) + +(autoload 'helm-all-mark-rings "helm-ring" "\ +Preconfigured `helm' for `helm-source-global-mark-ring' and `helm-source-mark-ring'. + +\(fn)" t nil) + +(autoload 'helm-register "helm-ring" "\ +Preconfigured `helm' for Emacs registers. + +\(fn)" t nil) + +(autoload 'helm-show-kill-ring "helm-ring" "\ +Preconfigured `helm' for `kill-ring'. +It is drop-in replacement of `yank-pop'. + +First call open the kill-ring browser, next calls move to next line. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-semantic" "helm-semantic.el" (21436 11223 +;;;;;; 515576 851000)) +;;; Generated autoloads from helm-semantic.el + +(autoload 'helm-semantic "helm-semantic" "\ +Preconfigured `helm' for `semantic'. + +\(fn)" t nil) + +(autoload 'helm-semantic-or-imenu "helm-semantic" "\ +Run `helm' with `semantic' or `imenu'. + +If `semantic-mode' is active in the current buffer, then use +semantic for generating tags, otherwise fall back to `imenu'. +Fill in the symbol at point by default. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-sys" "helm-sys.el" (21341 6020 978577 +;;;;;; 405000)) +;;; Generated autoloads from helm-sys.el + +(autoload 'helm-top-run-sort-by-com "helm-sys" "\ + + +\(fn)" t nil) + +(autoload 'helm-top-run-sort-by-cpu "helm-sys" "\ + + +\(fn)" t nil) + +(autoload 'helm-top-run-sort-by-mem "helm-sys" "\ + + +\(fn)" t nil) + +(autoload 'helm-top-run-sort-by-user "helm-sys" "\ + + +\(fn)" t nil) + +(autoload 'helm-top "helm-sys" "\ +Preconfigured `helm' for top command. + +\(fn)" t nil) + +(autoload 'helm-list-emacs-process "helm-sys" "\ +Preconfigured `helm' for emacs process. + +\(fn)" t nil) + +(autoload 'helm-xrandr-set "helm-sys" "\ + + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-tags" "helm-tags.el" (21464 47958 527939 +;;;;;; 782000)) +;;; Generated autoloads from helm-tags.el + +(autoload 'helm-etags-select "helm-tags" "\ +Preconfigured helm for etags. +If called with a prefix argument or if any of the tag files have +been modified, reinitialize cache. + +This function aggregates three sources of tag files: + + 1) An automatically located file in the parent directories, by `helm-etags-get-tag-file'. + 2) `tags-file-name', which is commonly set by `find-tag' command. + 3) `tags-table-list' which is commonly set by `visit-tags-table' command. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-utils" "helm-utils.el" (21452 52791 223493 +;;;;;; 3000)) +;;; Generated autoloads from helm-utils.el + +(autoload 'helm-show-all-in-this-source-only "helm-utils" "\ +Show only current source of this helm session with all its candidates. +With a numeric prefix arg show only the ARG number of candidates. + +\(fn ARG)" t nil) + +(autoload 'helm-display-all-sources "helm-utils" "\ +Display all sources previously hidden by `helm-set-source-filter'. + +\(fn)" t nil) + +(autoload 'helm-quit-and-find-file "helm-utils" "\ +Drop into `helm-find-files' from `helm'. +If current selection is a buffer or a file, `helm-find-files' +from its directory. + +\(fn)" t nil) + +(autoload 'helm-w32-shell-execute-open-file "helm-utils" "\ + + +\(fn FILE)" t nil) + +(autoload 'helm-yank-text-at-point "helm-utils" "\ +Yank text at point in `helm-current-buffer' into minibuffer. +If `helm-yank-symbol-first' is non--nil the first yank +grabs the entire symbol. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-w3m" "helm-w3m.el" (21430 15697 737354 +;;;;;; 26000)) +;;; Generated autoloads from helm-w3m.el + +(autoload 'helm-w3m-bookmarks "helm-w3m" "\ +Preconfigured `helm' for w3m bookmark. + +Needs w3m and emacs-w3m. + +http://w3m.sourceforge.net/ +http://emacs-w3m.namazu.org/ + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-yaoddmuse" "helm-yaoddmuse.el" (21341 +;;;;;; 6020 982577 405000)) +;;; Generated autoloads from helm-yaoddmuse.el + +(autoload 'helm-yaoddmuse-cache-pages "helm-yaoddmuse" "\ +Fetch the list of files on emacswiki and create cache file. +If load is non--nil load the file and feed `yaoddmuse-pages-hash'. + +\(fn &optional LOAD)" t nil) + +(autoload 'helm-yaoddmuse-emacswiki-edit-or-view "helm-yaoddmuse" "\ +Preconfigured `helm' to edit or view EmacsWiki page. + +Needs yaoddmuse.el. + +http://www.emacswiki.org/emacs/download/yaoddmuse.el + +\(fn)" t nil) + +(autoload 'helm-yaoddmuse-emacswiki-post-library "helm-yaoddmuse" "\ +Preconfigured `helm' to post library to EmacsWiki. + +Needs yaoddmuse.el. + +http://www.emacswiki.org/emacs/download/yaoddmuse.el + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("helm-aliases.el" "helm-pkg.el" "helm-plugin.el") +;;;;;; (21465 418 463922 118000)) + +;;;*** + +;;; End of automatically extracted autoloads. + +(provide 'helm-config) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-config.el ends here diff --git a/elpa/helm-20140808.2300/helm-config.elc b/elpa/helm-20140808.2300/helm-config.elc new file mode 100644 index 000000000..e2c7e4933 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-config.elc differ diff --git a/elpa/helm-20140808.2300/helm-dabbrev.el b/elpa/helm-20140808.2300/helm-dabbrev.el new file mode 100644 index 000000000..b97d9f4a9 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-dabbrev.el @@ -0,0 +1,311 @@ +;;; helm-dabbrev.el --- Helm implementation of dabbrev. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'helm) +(require 'helm-elisp) ; For show-completion. + +(defgroup helm-dabbrev nil + "Dabbrev related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-dabbrev-always-search-all t + "Always search in all buffers when non--nil." + :group 'helm-dabbrev + :type 'boolean) + +(defcustom helm-dabbrev-max-length-result 20 + "Max length of candidates before searching in all buffers. +If number of candidates found in current-buffer is <= to this, +search in all buffers. +Have no effect when `helm-dabbrev-always-search-all' is non--nil." + :group 'helm-dabbrev + :type 'integer) + +(defcustom helm-dabbrev-ignored-buffers-regexps + '("\\*helm" "\\*Messages" "\\*Echo Area" "\\*Buffer List") + "List of regexps matching names of buffers that helm-dabbrev should not check." + :group 'helm-dabbrev + :type '(repeat regexp)) + +(defcustom helm-dabbrev-major-mode-assoc + '((emacs-lisp-mode . lisp-interaction-mode)) + "Major mode association alist. +This allow helm-dabbrev searching in buffers with the associated `major-mode'. +e.g \(emacs-lisp-mode . lisp-interaction-mode\) +will allow searching in the lisp-interaction-mode buffer when `current-buffer' +is an `emacs-lisp-mode' buffer and vice versa i.e +no need to provide \(lisp-interaction-mode . emacs-lisp-mode\) association." + :type '(alist :key-type symbol :value-type symbol) + :group 'helm-dabbrev) + +(defcustom helm-dabbrev-lineno-around 30 + "Search first in this number of lines before an after point." + :group 'helm-dabbrev + :type 'integer) + +(defcustom helm-dabbrev-cycle-thresold nil + "Number of time helm-dabbrev cycle before displaying helm completion. +When nil or 0 disable cycling." + :group 'helm-dabbrev + :type '(choice (const :tag "Cycling disabled" nil) integer)) + +(defcustom helm-dabbrev-case-fold-search 'smart + "Set `case-fold-search' in `helm-dabbrev'. +Same as `helm-case-fold-search' but for `helm-dabbrev'. +Note that this is not affecting searching in helm buffer, +but the initial search for all candidates in buffer(s)." + :group 'helm-dabbrev + :type '(choice (const :tag "Ignore case" t) + (const :tag "Respect case" nil) + (other :tag "Smart" 'smart))) + + +(defvar helm-dabbrev-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-/") 'helm-next-line) + (define-key map (kbd "M-:") 'helm-previous-line) + map)) + +;; Internal +(defvar helm-dabbrev--exclude-current-buffer-flag nil) +(defvar helm-dabbrev--cache nil) +(defvar helm-dabbrev--data nil) +(defvar helm-dabbrev--regexp "\\s-\\|\t\\|[(\[\{\"'`=<$;]\\|\\s\\\\|^") +(cl-defstruct helm-dabbrev-info dabbrev limits iterator) + + +(defun helm-dabbrev--buffer-list () + (cl-loop with lst = (buffer-list) + for buf in (if helm-dabbrev--exclude-current-buffer-flag + (cdr lst) lst) + unless (cl-loop for r in helm-dabbrev-ignored-buffers-regexps + thereis (string-match r (buffer-name buf))) + collect buf)) + +(defun helm-dabbrev--same-major-mode-p (start-buffer) + ;; START-BUFFER is the current-buffer where we start searching. + ;; Determine the major-mode of START-BUFFER as `cur-maj-mode'. + ;; Each time the loop go in another buffer we try to find if its + ;; `major-mode' is: + ;; - same as the `cur-maj-mode' + ;; - derived from `cur-maj-mode' + ;; - have an assoc entry (major-mode . cur-maj-mode) + ;; - have an rassoc entry (cur-maj-mode . major-mode) + ;; - check if one of these entries inherit from another one in + ;; `helm-dabbrev-major-mode-assoc'. + (let* ((cur-maj-mode (with-current-buffer start-buffer major-mode)) + (c-assoc-mode (assq cur-maj-mode helm-dabbrev-major-mode-assoc)) + (c-rassoc-mode (rassq cur-maj-mode helm-dabbrev-major-mode-assoc)) + (o-assoc-mode (assq major-mode helm-dabbrev-major-mode-assoc)) + (o-rassoc-mode (rassq major-mode helm-dabbrev-major-mode-assoc)) + (cdr-c-assoc-mode (cdr c-assoc-mode)) + (cdr-o-assoc-mode (cdr o-assoc-mode))) + (or (eq major-mode cur-maj-mode) + (derived-mode-p cur-maj-mode) + (or (eq cdr-c-assoc-mode major-mode) + (eq (car c-rassoc-mode) major-mode) + (eq (cdr (assq cdr-c-assoc-mode helm-dabbrev-major-mode-assoc)) + major-mode) + (eq (car (rassq cdr-c-assoc-mode helm-dabbrev-major-mode-assoc)) + major-mode)) + (or (eq cdr-o-assoc-mode cur-maj-mode) + (eq (car o-rassoc-mode) cur-maj-mode) + (eq (cdr (assq cdr-o-assoc-mode helm-dabbrev-major-mode-assoc)) + cur-maj-mode) + (eq (car (rassq cdr-o-assoc-mode helm-dabbrev-major-mode-assoc)) + cur-maj-mode))))) + +(defun helm-dabbrev--collect (str limit ignore-case all) + (let* ((case-fold-search ignore-case) + (buffer1 (current-buffer)) ; start buffer. + (minibuf (minibufferp buffer1)) + result pos-before pos-after + (search-and-store + #'(lambda (pattern direction) + (while (cl-case direction + (1 (search-forward pattern nil t)) + (-1 (search-backward pattern nil t)) + (2 (let ((pos + (save-excursion + (forward-line + helm-dabbrev-lineno-around) + (point)))) + (setq pos-after pos) + (search-forward pattern pos t))) + (-2 (let ((pos + (save-excursion + (forward-line + (- helm-dabbrev-lineno-around)) + (point)))) + (setq pos-before pos) + (search-backward pattern pos t)))) + (let* ((match-1 (helm-aif (thing-at-point 'symbol) + (substring-no-properties it))) + (match-2 (helm-aif (thing-at-point 'filename) + (substring-no-properties it))) + (lst (if (string= match-1 match-2) + (list match-1) + (list match-1 match-2)))) + (cl-loop for match in lst + unless (or (string= str match) + (member match result)) + do (push match result))))))) + (cl-loop for buf in (if all (helm-dabbrev--buffer-list) + (list (current-buffer))) + + do (with-current-buffer buf + (when (or minibuf ; check against all buffers when in minibuffer. + (helm-dabbrev--same-major-mode-p buffer1)) + (save-excursion + ;; Start searching before thing before point. + (goto-char (- (point) (length str))) + ;; Search the last 30 lines before point. + (funcall search-and-store str -2)) ; store pos [1] + (save-excursion + ;; Search the next 30 lines after point. + (funcall search-and-store str 2)) ; store pos [2] + (save-excursion + ;; Search all before point. + (goto-char pos-before) ; start from [1] + (funcall search-and-store str -1)) + (save-excursion + ;; Search all after point. + (goto-char pos-after) ; start from [2] + (funcall search-and-store str 1)))) + when (> (length result) limit) return (nreverse result) + finally return (nreverse result)))) + +(defun helm-dabbrev--get-candidates (abbrev) + (cl-assert abbrev nil "[No Match]") + (with-current-buffer (current-buffer) + (let* ((dabbrev-get #'(lambda (str all-bufs) + (helm-dabbrev--collect + str helm-candidate-number-limit + (cl-case helm-dabbrev-case-fold-search + (smart (helm-set-case-fold-search-1 abbrev)) + (t helm-dabbrev-case-fold-search)) + all-bufs))) + (lst (funcall dabbrev-get abbrev helm-dabbrev-always-search-all))) + (if (and (not helm-dabbrev-always-search-all) + (<= (length lst) helm-dabbrev-max-length-result)) + ;; Search all but don't recompute current-buffer. + (let ((helm-dabbrev--exclude-current-buffer-flag t)) + (append lst (funcall dabbrev-get abbrev 'all-bufs))) + lst)))) + +(defvar helm-source-dabbrev + `((name . "Dabbrev Expand") + (init . (lambda () + (helm-init-candidates-in-buffer 'global + helm-dabbrev--cache))) + (candidates-in-buffer) + (persistent-action . (lambda (_candidate) (ignore))) + (persistent-help . "DoNothing") + (keymap . ,helm-dabbrev-map) + (action . helm-dabbrev-default-action))) + +(defun helm-dabbrev-default-action (candidate) + (with-helm-current-buffer + (let* ((limits (helm-bounds-of-thing-before-point + helm-dabbrev--regexp)) + (beg (car limits)) + (end (point))) + (run-with-timer + 0.01 nil + 'helm-insert-completion-at-point + beg end candidate)))) + +;;;###autoload +(defun helm-dabbrev () + (interactive) + (let ((dabbrev (helm-thing-before-point nil helm-dabbrev--regexp)) + (limits (helm-bounds-of-thing-before-point helm-dabbrev--regexp)) + (enable-recursive-minibuffers t) + (cycling-disabled-p (or (null helm-dabbrev-cycle-thresold) + (zerop helm-dabbrev-cycle-thresold))) + (helm-execute-action-at-once-if-one t) + (helm-quit-if-no-candidate + #'(lambda () + (message "[Helm-dabbrev: No expansion found]")))) + (cl-assert (and (stringp dabbrev) (not (string= dabbrev ""))) + nil "[Helm-dabbrev: Nothing found before point]") + (when (and + ;; have been called at least once. + (helm-dabbrev-info-p helm-dabbrev--data) + ;; But user have moved with some other command + ;; in the meaning time. + (not (eq last-command 'helm-dabbrev))) + (setq helm-dabbrev--data nil)) + (when cycling-disabled-p + (setq helm-dabbrev--cache (helm-dabbrev--get-candidates dabbrev))) + (unless (or cycling-disabled-p + (helm-dabbrev-info-p helm-dabbrev--data)) + (setq helm-dabbrev--cache (helm-dabbrev--get-candidates dabbrev)) + (setq helm-dabbrev--data (make-helm-dabbrev-info + :dabbrev dabbrev + :limits limits + :iterator + (helm-iter-list + (cl-loop for i in helm-dabbrev--cache when + (and i (string-match + (concat "^" (regexp-quote dabbrev)) i)) + collect i into selection + when (and selection + (= (length selection) + helm-dabbrev-cycle-thresold)) + ;; When selection len reach + ;; `helm-dabbrev-cycle-thresold' + ;; return selection. + return selection + ;; selection len never reach + ;; `helm-dabbrev-cycle-thresold' + ;; return selection. + finally return selection))))) + (let ((iter (and (helm-dabbrev-info-p helm-dabbrev--data) + (helm-dabbrev-info-iterator helm-dabbrev--data))) + deactivate-mark) + (helm-aif (and iter (helm-iter-next iter)) + (progn + (helm-insert-completion-at-point (car limits) (cdr limits) it) + ;; Move already tried candidates to end of list. + (setq helm-dabbrev--cache (append (remove it helm-dabbrev--cache) + (list it)))) + (unless cycling-disabled-p + (delete-region (car limits) (point)) + (setq dabbrev (helm-dabbrev-info-dabbrev helm-dabbrev--data) + limits (helm-dabbrev-info-limits helm-dabbrev--data)) + (setq helm-dabbrev--data nil) + (insert dabbrev)) + (with-helm-show-completion (car limits) (cdr limits) + (helm :sources 'helm-source-dabbrev + :buffer "*helm dabbrev*" + :input (concat "^" dabbrev " ") + :resume 'noresume + :allow-nest t)))))) + +(provide 'helm-dabbrev) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-dabbrev.el ends here diff --git a/elpa/helm-20140808.2300/helm-dabbrev.elc b/elpa/helm-20140808.2300/helm-dabbrev.elc new file mode 100644 index 000000000..61e02c6e1 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-dabbrev.elc differ diff --git a/elpa/helm-20140808.2300/helm-elisp-package.el b/elpa/helm-20140808.2300/helm-elisp-package.el new file mode 100644 index 000000000..c20010ba7 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-elisp-package.el @@ -0,0 +1,170 @@ +;;; helm-elisp-package.el --- helm interface for package.el -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'package) + +;; internals vars +(defvar helm-el-package--show-only 'all) +(defvar helm-el-package--initialized-p nil) + +(defun helm-el-package--init () + (when (null package-alist) + (setq helm-el-package--show-only 'all)) + (save-selected-window + (list-packages helm-el-package--initialized-p) + (setq helm-el-package--initialized-p t) + (message nil)) + (helm-init-candidates-in-buffer + 'global + (with-current-buffer (get-buffer "*Packages*") + (buffer-string))) + (setq helm-el-package--show-only 'all) + (kill-buffer "*Packages*")) + +(defun helm-el-package-describe (candidate) + (let ((id (get-text-property 0 'tabulated-list-id candidate))) + (describe-package (if (fboundp 'package-desc-name) + (package-desc-name id) + (car id))))) + +(defun helm-el-package-install (_candidate) + (cl-loop with mkd = (helm-marked-candidates) + for p in mkd + for id = (get-text-property 0 'tabulated-list-id p) + do (package-install + (if (fboundp 'package-desc-name) + (package-desc-name id) + (car id))) + and collect (if (fboundp 'package-desc-full-name) + id + (car id)) + into installed-list + finally do (if (fboundp 'package-desc-full-name) + (message (format "%d packages installed:\n(%s)" + (length installed-list) + (mapconcat #'package-desc-full-name + installed-list ", "))) + (message (format "%d packages installed:\n(%s)" + (length installed-list) + (mapconcat 'symbol-name installed-list ", ")))))) + +(defun helm-el-package-uninstall (_candidate) + (cl-loop with mkd = (helm-marked-candidates) + for p in mkd + for id = (get-text-property 0 'tabulated-list-id p) + do + (condition-case-unless-debug err + (with-no-warnings + (if (fboundp 'package-desc-full-name) + ;; emacs 24.4 + (package-delete id) + ;; emacs 24.3 + (package-delete (symbol-name (car id)) + (package-version-join (cdr id))))) + (error (message (cadr err)))) + and collect (if (fboundp 'package-desc-full-name) + id + (cons (symbol-name (car id)) + (package-version-join (cdr id)))) + into delete-list + finally do (if (fboundp 'package-desc-full-name) + ;; emacs 24.4 + (message (format "%d packages deleted:\n(%s)" + (length delete-list) + (mapconcat #'package-desc-full-name + delete-list ", "))) + ;; emacs 24.3 + (message (format "%d packages deleted:\n(%s)" + (length delete-list) + (mapconcat (lambda (x) + (concat (car x) "-" (cdr x))) + delete-list ", "))) + ;; emacs 24.3 doesn't update + ;; its `package-alist' after deleting. + (cl-loop for p in package-alist + when (assq (symbol-name (car p)) delete-list) + do (setq package-alist (delete p package-alist)))))) + +(defun helm-el-package--transformer (candidates _source) + (cl-loop for c in candidates + for id = (get-text-property 0 'tabulated-list-id c) + for installed-p = (assq (if (fboundp 'package-desc-name) + (package-desc-name id) + (car id)) + package-alist) + for cand = (cons c (car (split-string c))) + when (or (and installed-p + (eq helm-el-package--show-only 'installed)) + (and (not installed-p) + (eq helm-el-package--show-only 'uninstalled)) + (eq helm-el-package--show-only 'all)) + collect cand)) + +(defun helm-el-package-show-installed () + (interactive) + (with-helm-alive-p + (setq helm-el-package--show-only 'installed) + (helm-update))) + +(defun helm-el-package-show-all () + (interactive) + (with-helm-alive-p + (setq helm-el-package--show-only 'all) + (helm-update))) + +(defun helm-el-package-show-uninstalled () + (interactive) + (with-helm-alive-p + (setq helm-el-package--show-only 'uninstalled) + (helm-update))) + +(defvar helm-el-package-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-I") 'helm-el-package-show-installed) + (define-key map (kbd "M-U") 'helm-el-package-show-uninstalled) + (define-key map (kbd "M-A") 'helm-el-package-show-all) + (define-key map (kbd "C-c ?") 'helm-el-package-help) + map)) + +(defvar helm-source-list-el-package + `((name . "list packages") + (init . helm-el-package--init) + (get-line . buffer-substring) + (match-part . (lambda (c) (car (split-string c)))) + (filtered-candidate-transformer . helm-el-package--transformer) + (candidates-in-buffer) + (mode-line . helm-el-package-mode-line) + (keymap . ,helm-el-package-map) + (candidate-number-limit . 9999) + (action . (("Describe" . helm-el-package-describe) + ("Install" . helm-el-package-install) + ("Uninstall" . helm-el-package-uninstall))))) + +;;;###autoload +(defun helm-list-elisp-packages (arg) + (interactive "P") + (when arg (setq helm-el-package--initialized-p nil)) + (helm :sources 'helm-source-list-el-package + :buffer "*helm list packages*")) + +(provide 'helm-elisp-package) + +;;; helm-elisp-package.el ends here diff --git a/elpa/helm-20140808.2300/helm-elisp-package.elc b/elpa/helm-20140808.2300/helm-elisp-package.elc new file mode 100644 index 000000000..cbea6e1a8 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-elisp-package.elc differ diff --git a/elpa/helm-20140808.2300/helm-elisp.el b/elpa/helm-20140808.2300/helm-elisp.el new file mode 100644 index 000000000..a3a04fdb3 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-elisp.el @@ -0,0 +1,752 @@ +;;; helm-elisp.el --- Elisp symbols completion for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) +(require 'helm-info) +(require 'helm-eval) +(require 'helm-files) +(require 'advice) + + +(defgroup helm-elisp nil + "Elisp related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-turn-on-show-completion t + "Display candidate in buffer while moving selection when non--nil." + :group 'helm-elisp + :type 'boolean) + +(defcustom helm-show-completion-use-special-display t + "A special display will be used in lisp completion if non--nil. +All functions that are wrapped in macro `with-helm-show-completion' +will be affected." + :group 'helm-elisp + :type 'boolean) + +(defcustom helm-show-completion-min-window-height 7 + "Minimum completion window height used in show completion. +This is used in macro `with-helm-show-completion'." + :group 'helm-elisp + :type 'integer) + +(defcustom helm-lisp-quoted-function-list + '(funcall apply mapc cl-mapc mapcar cl-mapcar + callf callf2 cl-callf cl-callf2 fset + fboundp fmakunbound symbol-function) + "List of function where quoted function completion happen. +e.g give only function names after \(funcall '." + :group 'helm-elisp + :type '(repeat (choice symbol))) + +(defcustom helm-lisp-unquoted-function-list + '(function defadvice) + "List of function where unquoted function completion happen. +e.g give only function names after \(function ." + :group 'helm-elisp + :type '(repeat (choice symbol))) + + +;;; Faces +;; +;; +(defface helm-lisp-show-completion + '((t (:background "DarkSlateGray"))) + "Face used for showing candidates in `helm-lisp-completion'." + :group 'helm-elisp) + +(defface helm-lisp-completion-info + '((t (:foreground "red"))) + "Face used for showing info in `helm-lisp-completion'." + :group 'helm-elisp) + + +;;; Show completion. +;; +;; Provide show completion with macro `with-helm-show-completion'. + +(defvar helm-show-completion-overlay nil) +;; Called each time cursor move in helm-buffer. +(defun helm-show-completion () + (with-helm-current-buffer + (overlay-put helm-show-completion-overlay + 'display (helm-get-selection)))) + +(defun helm-show-completion-init-overlay (beg end) + (when (and helm-turn-on-show-completion beg end) + (setq helm-show-completion-overlay (make-overlay beg end)) + (overlay-put helm-show-completion-overlay + 'face 'helm-lisp-show-completion))) + +(defun helm-show-completion-display-function (buffer &rest _args) + "A special resized helm window is used depending on position in BUFFER." + (with-selected-window (selected-window) + (if (window-dedicated-p) + (helm-default-display-buffer buffer) + (let* ((screen-size (+ (count-screen-lines (window-start) (point) t) + 1 ; mode-line + (if header-line-format 1 0))) ; header-line + (def-size (- (window-height) + helm-show-completion-min-window-height)) + (upper-height (max window-min-height (min screen-size def-size))) + split-window-keep-point) + (recenter -1) + (set-window-buffer (if (active-minibuffer-window) + (minibuffer-selected-window) + (split-window nil upper-height)) + buffer))))) + +(defmacro with-helm-show-completion (beg end &rest body) + "Show helm candidate in an overlay at point. +BEG and END are the beginning and end position of the current completion +in `helm-current-buffer'. +BODY is an helm call where we want to enable show completion. +If `helm-turn-on-show-completion' is nil just do nothing." + (declare (indent 2) (debug t)) + `(let ((helm-move-selection-after-hook + (and helm-turn-on-show-completion + (append (list 'helm-show-completion) + helm-move-selection-after-hook)))) + (with-helm-temp-hook 'helm-after-initialize-hook + (with-helm-buffer + (set (make-local-variable 'helm-display-function) + (if helm-show-completion-use-special-display + 'helm-show-completion-display-function + 'helm-default-display-buffer)))) + (unwind-protect + (progn + (helm-show-completion-init-overlay ,beg ,end) + ,@body) + (when (and helm-turn-on-show-completion + helm-show-completion-overlay + (overlayp helm-show-completion-overlay)) + (delete-overlay helm-show-completion-overlay))))) + + +;;; Lisp symbol completion. +;; +;; +(defun helm-lisp-completion--predicate-at-point (beg) + ;; Return a predicate for `all-completions'. + (let ((fn-sym-p (lambda () + (or + (and (eq (char-before) ?\ ) + (save-excursion + (skip-syntax-backward " " (point-at-bol)) + (memq (symbol-at-point) + helm-lisp-unquoted-function-list))) + (and (eq (char-before) ?\') + (save-excursion + (forward-char -1) + (eq (char-before) ?\#))))))) + (save-excursion + (goto-char beg) + (if (or + ;; Complete on all symbols in non--lisp modes (logs mail etc..) + (not (memq major-mode '(emacs-lisp-mode + lisp-interaction-mode + inferior-emacs-lisp-mode))) + (not (or (funcall fn-sym-p) + (and (eq (char-before) ?\') + (save-excursion + (forward-char (if (funcall fn-sym-p) -2 -1)) + (skip-syntax-backward " " (point-at-bol)) + (memq (symbol-at-point) + helm-lisp-quoted-function-list))) + (eq (char-before) ?\())) ; no paren before str. + ;; Looks like we are in a let statement. + (condition-case nil + (progn (up-list -2) (forward-char 1) + (eq (char-after) ?\()) + (error nil))) + (lambda (sym) + (or (boundp sym) (fboundp sym) (symbol-plist sym))) + #'fboundp)))) + +(defun helm-thing-before-point (&optional limits regexp) + "Return symbol name before point. +If REGEXP is specified return what REGEXP find before point. +By default match the beginning of symbol before point. +With LIMITS arg specified return the beginning and end position +of symbol before point." + (save-excursion + (let (beg + (end (point)) + (boundary (field-beginning nil nil (point-at-bol)))) + (if (re-search-backward (or regexp "\\_<") boundary t) + (setq beg (match-end 0)) + (setq beg boundary)) + (unless (= beg end) + (if limits + (cons beg end) + (buffer-substring-no-properties beg end)))))) + +(defun helm-bounds-of-thing-before-point (&optional regexp) + "Get the beginning and end position of `helm-thing-before-point'. +Return a cons \(beg . end\)." + (helm-thing-before-point 'limits regexp)) + +(defun helm-insert-completion-at-point (beg end str) + ;; When there is no space after point + ;; we are completing inside a symbol or + ;; after a partial symbol with the next arg aside + ;; without space, in this case mark the region. + ;; deleting it would remove the + ;; next arg which is unwanted. + (delete-region beg end) + (insert str) + (let ((pos (cdr (or (bounds-of-thing-at-point 'symbol) + ;; needed for helm-dabbrev. + (bounds-of-thing-at-point 'filename))))) + (when (and pos (< (point) pos)) + (push-mark pos t t)))) + +(defvar helm-lisp-completion--cache nil) +(defvar helm-lgst-len nil) +;;;###autoload +(defun helm-lisp-completion-at-point () + "Helm lisp symbol completion at point." + (interactive) + (setq helm-lgst-len 0) + (let* ((target (helm-thing-before-point)) + (beg (car (helm-bounds-of-thing-before-point))) + (end (point)) + (pred (and beg (helm-lisp-completion--predicate-at-point beg))) + (loc-vars (and (fboundp 'lisp--local-variables) + (ignore-errors + (mapcar #'symbol-name (lisp--local-variables))))) + (glob-syms (and target pred (all-completions target obarray pred))) + (candidates (append loc-vars glob-syms)) + (helm-quit-if-no-candidate t) + (helm-execute-action-at-once-if-one t) + (enable-recursive-minibuffers t) + (helm-match-plugin-enabled + (member 'helm-compile-source--match-plugin + helm-compile-source-functions))) + (setq helm-lisp-completion--cache (cl-loop for sym in candidates + for len = (length sym) + when (> len helm-lgst-len) + do (setq helm-lgst-len len) + collect sym)) + (if candidates + (with-helm-show-completion beg end + ;; Overlay is initialized now in helm-current-buffer. + (helm + :sources `((name . "Lisp completion") + (init . (lambda () + (helm-init-candidates-in-buffer 'global + helm-lisp-completion--cache))) + (candidates-in-buffer) + (persistent-action . helm-lisp-completion-persistent-action) + (nomark) + (persistent-help . "Show brief doc in mode-line") + (filtered-candidate-transformer . helm-lisp-completion-transformer) + (action . (lambda (candidate) + (with-helm-current-buffer + (run-with-timer + 0.01 nil + 'helm-insert-completion-at-point + ,beg ,end candidate))))) + :input (if helm-match-plugin-enabled (concat target " ") target) + :resume 'noresume + :buffer "*helm lisp completion*" + :allow-nest t)) + (message "[No Match]")))) + +(defun helm-lisp-completion-persistent-action (candidate) + (let ((cursor-in-echo-area t) + mode-line-in-non-selected-windows) + (helm-show-info-in-mode-line + (propertize + (helm-get-first-line-documentation + (intern candidate)) + 'face 'helm-lisp-completion-info)))) + +(defun helm-lisp-completion-transformer (candidates _source) + "Helm candidates transformer for lisp completion." + (cl-loop for c in candidates + for sym = (intern c) + for annot = (cl-typecase sym + (command " (Com)") + (fbound " (Fun)") + (bound " (Var)") + (face " (Face)")) + for spaces = (make-string (- helm-lgst-len (length c)) ? ) + collect (cons (concat c spaces annot) c) into lst + finally return (sort lst #'helm-generic-sort-fn))) + +(defun helm-get-first-line-documentation (sym) + "Return first line documentation of symbol SYM. +If SYM is not documented, return \"Not documented\"." + (let ((doc (cond ((fboundp sym) + (documentation sym t)) + ((boundp sym) + (documentation-property sym 'variable-documentation t)) + ((facep sym) + (face-documentation sym)) + (t nil)))) + (if (and doc (not (string= doc "")) + ;; `documentation' return "\n\n(args...)" + ;; for CL-style functions. + (not (string-match-p "^\n\n" doc))) + (car (split-string doc "\n")) + "Not documented"))) + +;;; File completion. +;; +;; Complete file name at point. + +;;;###autoload +(defun helm-complete-file-name-at-point (&optional force) + "Complete file name at point." + (interactive) + (require 'helm-mode) + (let* ((tap (thing-at-point 'filename)) + beg + (init (and tap + (or force + (save-excursion + (end-of-line) + (search-backward tap (point-at-bol) t) + (setq beg (point)) + (looking-back "[^'`( ]"))) + (expand-file-name + (substring-no-properties tap)))) + (end (point)) + (helm-quit-if-no-candidate t) + (helm-execute-action-at-once-if-one t) + completion) + (with-helm-show-completion beg end + (setq completion (helm-read-file-name "FileName: " + :initial-input init))) + (when (and completion (not (string= completion ""))) + (delete-region beg end) (insert (if (string-match "^~" tap) + (abbreviate-file-name completion) + completion))))) + +;;;###autoload +(defun helm-lisp-indent () + ;; It is meant to use with `helm-define-multi-key' which + ;; does not support args for functions yet, so use `current-prefix-arg' + ;; for now instead of (interactive "P"). + (interactive) + (let ((tab-always-indent (or (eq tab-always-indent 'complete) + tab-always-indent))) + (indent-for-tab-command current-prefix-arg))) + +;;;###autoload +(defun helm-lisp-completion-or-file-name-at-point () + "Complete lisp symbol or filename at point. +Filename completion happen if string start after or between a double quote." + (interactive) + (let* ((tap (thing-at-point 'filename))) + (if (and tap (save-excursion + (end-of-line) + (search-backward tap (point-at-bol) t) + (looking-back "[^'`( ]"))) + (helm-complete-file-name-at-point) + (helm-lisp-completion-at-point)))) + +(helm-multi-key-defun helm-multi-lisp-complete-at-point + "Multi key function for completion in emacs lisp buffers. +First call indent, second complete symbol, third complete fname." + '(helm-lisp-indent + helm-lisp-completion-at-point + helm-complete-file-name-at-point) + 0.3) + + +;;; Apropos +;; +;; +(defun helm-apropos-init (test default) + "Init candidates buffer for `helm-apropos' sources." + (require 'helm-help) + (with-current-buffer (helm-candidate-buffer 'global) + (goto-char (point-min)) + (let ((default-symbol (and (stringp default) + (intern-soft default)))) + (when (and default-symbol (funcall test default-symbol)) + (insert (concat default "\n"))) + (cl-loop with all = (all-completions "" obarray test) + for sym in all + for s = (intern sym) + unless (or (and default (string= sym default)) + (keywordp s)) + do (insert (concat sym "\n")))))) + +(defun helm-def-source--emacs-variables (&optional default) + `((name . "Variables") + (init . (lambda () + (helm-apropos-init 'boundp ,default))) + (candidates-in-buffer) + (nomark) + (action . (("Describe Variable" . helm-describe-variable) + ("Find Variable" . helm-find-variable) + ("Info lookup" . helm-info-lookup-symbol) + ("Set variable" . helm-set-variable))))) + +(defun helm-def-source--emacs-faces (&optional default) + `((name . "Faces") + (init . (lambda () + (helm-apropos-init 'facep ,default))) + (candidates-in-buffer) + (nomark) + (filtered-candidate-transformer . (lambda (candidates _source) + (cl-loop for c in candidates + collect (propertize c 'face (intern c))))) + (action . (lambda (candidate) + (describe-face (intern candidate)))))) + +(defun helm-def-source--helm-attributes (&optional _default) + `((name . "Helm attributes") + (candidates . (lambda () + (mapcar 'symbol-name helm-attributes))) + (nomark) + (action . (lambda (candidate) + (let (special-display-buffer-names + special-display-regexps + helm-persistent-action-use-special-display) + (with-output-to-temp-buffer "*Help*" + (princ (get (intern candidate) 'helm-attrdoc)))))))) + +(defun helm-def-source--emacs-commands (&optional default) + `((name . "Commands") + (init . (lambda () + (helm-apropos-init 'commandp ,default))) + (candidates-in-buffer) + (nomark) + (action . (("Describe Function" . helm-describe-function) + ("Find Function" . helm-find-function) + ("Info lookup" . helm-info-lookup-symbol))))) + +(defun helm-def-source--emacs-functions (&optional default) + `((name . "Functions") + (init . (lambda () + (helm-apropos-init #'(lambda (x) (and (fboundp x) + (not (commandp x)))) + ,default))) + (nomark) + (candidates-in-buffer) + (action . (("Describe Function" . helm-describe-function) + ("Find Function" . helm-find-function) + ("Info lookup" . helm-info-lookup-symbol))))) + +(defun helm-info-lookup-symbol (candidate) + (let ((helm-execute-action-at-once-if-one t) + (helm-quit-if-no-candidate + `(lambda () + (message "`%s' Not Documented as a symbol" ,candidate)))) + (helm :sources '(helm-source-info-elisp + helm-source-info-cl + helm-source-info-eieio) + :resume 'noresume + :buffer "*helm lookup*" + :input candidate))) + +;;;###autoload +(defun helm-apropos () + "Preconfigured helm to describe commands, functions, variables and faces." + (interactive) + (let ((default (thing-at-point 'symbol))) + (helm :sources + (mapcar (lambda (func) + (funcall func default)) + '(helm-def-source--emacs-commands + helm-def-source--emacs-functions + helm-def-source--emacs-variables + helm-def-source--emacs-faces + helm-def-source--helm-attributes)) + :buffer "*helm apropos*" + :preselect (and default (concat "\\_<" (regexp-quote default) "\\_>"))))) + + +;;; Advices +;; +;; +(defvar helm-source-advice + '((name . "Function Advice") + (candidates . helm-advice-candidates) + (action ("Toggle Enable/Disable" . helm-advice-toggle)) + (persistent-action . helm-advice-persistent-action) + (nomark) + (multiline) + (persistent-help . "Describe function / C-u C-j: Toggle advice"))) + +(defun helm-advice-candidates () + (cl-loop for (fname) in ad-advised-functions + for function = (intern fname) + append + (cl-loop for class in ad-advice-classes append + (cl-loop for advice in (ad-get-advice-info-field function class) + for enabled = (ad-advice-enabled advice) + collect + (cons (format + "%s %s %s" + (if enabled "Enabled " "Disabled") + (propertize fname 'face 'font-lock-function-name-face) + (ad-make-single-advice-docstring advice class nil)) + (list function class advice)))))) + +(defun helm-advice-persistent-action (func-class-advice) + (if current-prefix-arg + (helm-advice-toggle func-class-advice) + (describe-function (car func-class-advice)))) + +(defun helm-advice-toggle (func-class-advice) + (cl-destructuring-bind (function _class advice) func-class-advice + (cond ((ad-advice-enabled advice) + (ad-advice-set-enabled advice nil) + (message "Disabled")) + (t + (ad-advice-set-enabled advice t) + (message "Enabled"))) + (ad-activate function) + (and helm-in-persistent-action + (helm-advice-update-current-display-string)))) + +(defun helm-advice-update-current-display-string () + (helm-edit-current-selection + (let ((newword (cond ((looking-at "Disabled") "Enabled") + ((looking-at "Enabled") "Disabled")))) + (when newword + (delete-region (point) (progn (forward-word 1) (point))) + (insert newword))))) + +;;;###autoload +(defun helm-manage-advice () + "Preconfigured `helm' to disable/enable function advices." + (interactive) + (helm-other-buffer 'helm-source-advice "*helm advice*")) + + +;;; Locate elisp library +;; +;; +(defvar helm-source-locate-library + `((name . "Elisp libraries (Scan)") + (init . (helm-locate-library-scan-init)) + (candidates-in-buffer) + (candidate-number-limit . 9999) + (keymap . ,helm-generic-files-map) + (type . file))) + +(defun helm-locate-library-scan-init () + "Init helm buffer status." + (helm-init-candidates-in-buffer + 'global (helm-locate-library-scan-list))) + +(defun helm-locate-library-scan-list () + (cl-loop for dir in load-path + when (file-directory-p dir) + append (directory-files dir t (concat (regexp-opt (get-load-suffixes)) + "\\'")) + into lst + finally return (helm-fast-remove-dups lst :test 'equal))) + +;;;###autoload +(defun helm-locate-library () + (interactive) + (helm :sources 'helm-source-locate-library + :buffer "*helm locate library*")) + +(defun helm-set-variable (var) + "Set value to VAR interactively." + (let ((sym (helm-symbolify var))) + (set sym (eval-minibuffer (format "Set %s: " var) + (prin1-to-string (symbol-value sym)))))) + + +;;; Type attributes +;; +;; +(let ((actions '(("Describe command" . describe-function) + ("Add command to kill ring" . helm-kill-new) + ("Go to command's definition" . find-function) + ("Debug on entry" . debug-on-entry) + ("Cancel debug on entry" . cancel-debug-on-entry) + ("Trace function" . trace-function) + ("Trace function (background)" . trace-function-background) + ("Untrace function" . untrace-function)))) + (define-helm-type-attribute 'command + `((action ("Call interactively" . helm-call-interactively) + ,@actions) + (coerce . helm-symbolify) + (persistent-action . describe-function)) + "Command. (string or symbol)") + + (define-helm-type-attribute 'function + `((action . ,actions) + (action-transformer helm-transform-function-call-interactively) + (candidate-transformer helm-mark-interactive-functions) + (coerce . helm-symbolify)) + "Function. (string or symbol)")) + +(define-helm-type-attribute 'variable + '((action + ("Describe variable" . describe-variable) + ("Add variable to kill ring" . helm-kill-new) + ("Go to variable's definition" . find-variable) + ("Set variable" . helm-set-variable)) + (coerce . helm-symbolify)) + "Variable.") + +(defun helm-btf--usable-p () + "Return t if current version of `backtrace-frame' accept 2 arguments." + (condition-case nil + (and (backtrace-frame 1 'condition-case) t) + (wrong-number-of-arguments nil))) + +(if (helm-btf--usable-p) ; Check if BTF accept more than one arg. + ;; Emacs 24.4. + (dont-compile + (defvar helm-sexp--last-sexp nil) + ;; This wont work compiled. + (defun helm-sexp-eval-1 () + (interactive) + (unwind-protect + (progn + ;; Trick called-interactively-p into thinking that `cand' is + ;; an interactive call, See `repeat-complex-command'. + (add-hook 'called-interactively-p-functions + #'helm-complex-command-history--called-interactively-skip) + (eval (read helm-sexp--last-sexp))) + (remove-hook 'called-interactively-p-functions + #'helm-complex-command-history--called-interactively-skip))) + + (defun helm-complex-command-history--called-interactively-skip (i _frame1 frame2) + (and (eq 'eval (cadr frame2)) + (eq 'helm-sexp-eval-1 + (cadr (backtrace-frame (+ i 2) #'called-interactively-p))) + 1)) + + (defun helm-sexp-eval (_candidate) + (call-interactively #'helm-sexp-eval-1))) + ;; Emacs 24.3 + (defun helm-sexp-eval (cand) + (let ((sexp (read cand))) + (condition-case err + (if (> (length (remove nil sexp)) 1) + (eval sexp) + (apply 'call-interactively sexp)) + (error (message "Evaluating gave an error: %S" err) + nil))))) + +(define-helm-type-attribute 'sexp + '((action + ("Eval" . (lambda (candidate) + (and (boundp 'helm-sexp--last-sexp) + (setq helm-sexp--last-sexp candidate)) + (helm-run-after-quit 'helm-sexp-eval candidate))) + ("Edit and eval" . + (lambda (cand) + (minibuffer-with-setup-hook + (lambda () (insert cand)) + (call-interactively #'eval-expression))))) + (persistent-action . helm-sexp-eval)) + "Sexp.") + +(define-helm-type-attribute 'timer + '((action + ("Cancel Timer" . (lambda (_timer) + (let ((mkd (helm-marked-candidates))) + (cl-loop for timer in mkd + do (cancel-timer timer))))) + ("Describe Function" . (lambda (tm) (describe-function (timer--function tm)))) + ("Find Function" . (lambda (tm) (find-function (timer--function tm))))) + (persistent-action . (lambda (tm) (describe-function (timer--function tm)))) + (persistent-help . "Describe Function")) + "Timer.") + + +;;; Elisp Timers. +;; +;; +(defvar helm-source-absolute-time-timers + '((name . "Absolute Time Timers") + (candidates . timer-list) + (filtered-candidate-transformer + . (lambda (candidates _source) + (cl-loop for timer in candidates + collect (cons (helm-elisp--format-timer timer) timer)))) + (allow-dups) + (volatile) + (type . timer))) + +(defvar helm-source-idle-time-timers + '((name . "Idle Time Timers") + (candidates . timer-idle-list) + (allow-dups) + (volatile) + (filtered-candidate-transformer + . (lambda (candidates _source) + (cl-loop for timer in candidates + collect (cons (helm-elisp--format-timer timer) timer)))) + (type . timer))) + +(defun helm-elisp--format-timer (timer) + (format "%s repeat=%s %s(%s)" + (let ((time (timer--time timer))) + (if (timer--idle-delay timer) + (format-time-string "idle-for=%5s" time) + (format-time-string "%m/%d %T" time))) + (or (timer--repeat-delay timer) "nil") + (mapconcat 'identity (split-string + (prin1-to-string (timer--function timer)) + "\n") " ") + (mapconcat 'prin1-to-string (timer--args timer) " "))) + +;;;###autoload +(defun helm-timers () + "Preconfigured `helm' for timers." + (interactive) + (helm-other-buffer '(helm-source-absolute-time-timers + helm-source-idle-time-timers) + "*helm timers*")) + + +;;; Complex command history +;; +;; +(defvar helm-source-complex-command-history + '((name . "Complex Command History") + (candidates . (lambda () + ;; Use cdr to avoid adding + ;; `helm-complex-command-history' here. + (cl-loop for i in command-history + unless (equal i '(helm-complex-command-history)) + collect (prin1-to-string i)))) + (type . sexp))) + +;;;###autoload +(defun helm-complex-command-history () + (interactive) + (helm :sources 'helm-source-complex-command-history + :buffer "*helm complex commands*")) + +(provide 'helm-elisp) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-elisp.el ends here diff --git a/elpa/helm-20140808.2300/helm-elisp.elc b/elpa/helm-20140808.2300/helm-elisp.elc new file mode 100644 index 000000000..7823d5fde Binary files /dev/null and b/elpa/helm-20140808.2300/helm-elisp.elc differ diff --git a/elpa/helm-20140808.2300/helm-elscreen.el b/elpa/helm-20140808.2300/helm-elscreen.el new file mode 100644 index 000000000..92fa5a747 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-elscreen.el @@ -0,0 +1,79 @@ +;;; helm-elscreen.el -- Elscreen support -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) + +(declare-function elscreen-find-screen-by-buffer "ext:elscreen.el" (buffer &optional create)) +(declare-function elscreen-find-file "ext:elscreen.el" (filename)) +(declare-function elscreen-goto "ext:elscreen.el" (screen)) + +(defun helm-find-buffer-on-elscreen (candidate) + "Open buffer in new screen, if marked buffers open all in elscreens." + (helm-require-or-error 'elscreen 'helm-find-buffer-on-elscreen) + (helm-aif (helm-marked-candidates) + (cl-dolist (i it) + (let ((target-screen (elscreen-find-screen-by-buffer + (get-buffer i) 'create))) + (elscreen-goto target-screen))) + (let ((target-screen (elscreen-find-screen-by-buffer + (get-buffer candidate) 'create))) + (elscreen-goto target-screen)))) + +(defun helm-elscreen-find-file (file) + (helm-require-or-error 'elscreen 'helm-elscreen-find-file) + (elscreen-find-file file)) + +(defvar helm-source-elscreen + '((name . "Elscreen") + (candidates + . (lambda () + (if (cdr (elscreen-get-screen-to-name-alist)) + (sort + (cl-loop for sname in (elscreen-get-screen-to-name-alist) + append (list (format "[%d] %s" (car sname) (cdr sname)))) + #'(lambda (a b) (compare-strings a nil nil b nil nil)))))) + (action + . (("Change Screen" . + (lambda (candidate) + (elscreen-goto (- (aref candidate 1) (aref "0" 0))))) + ("Kill Screen(s)" . + (lambda (candidate) + (cl-dolist (i (helm-marked-candidates)) + (elscreen-goto (- (aref i 1) (aref "0" 0))) + (elscreen-kill)))) + ("Only Screen" . + (lambda (candidate) + (elscreen-goto (- (aref candidate 1) (aref "0" 0))) + (elscreen-kill-others))))))) + +;;;###autoload +(defun helm-elscreen () + "Preconfigured helm to list elscreen." + (interactive) + (helm-other-buffer 'helm-source-elscreen "*Helm Elscreen*")) + +(provide 'helm-elscreen) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-elscreen.el ends here diff --git a/elpa/helm-20140808.2300/helm-elscreen.elc b/elpa/helm-20140808.2300/helm-elscreen.elc new file mode 100644 index 000000000..a4af31d3e Binary files /dev/null and b/elpa/helm-20140808.2300/helm-elscreen.elc differ diff --git a/elpa/helm-20140808.2300/helm-emms.el b/elpa/helm-20140808.2300/helm-emms.el new file mode 100644 index 000000000..a4b35dea5 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-emms.el @@ -0,0 +1,186 @@ +;;; helm-emms.el --- Emms for Helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) + +(declare-function emms-streams "ext:emms-streams") +(declare-function emms-stream-delete-bookmark "ext:emms-streams") +(declare-function emms-stream-add-bookmark "ext:emms-streams" (name url fd type)) +(declare-function emms-stream-save-bookmarks-file "ext:emms-streams") +(declare-function emms-stream-quit "ext:emms-streams") +(declare-function with-current-emms-playlist "ext:emms" (&rest body)) +(declare-function emms-playlist-tracks-in-region "ext:emms" (beg end)) +(declare-function emms-playlist-first "ext:emms") +(declare-function emms-playlist-mode-play-smart "ext:emms-playlist-mode") + + +(defgroup helm-emms nil + "Predefined configurations for `helm.el'." + :group 'helm) + +(defface helm-emms-playlist + '((t (:foreground "Springgreen4" :underline t))) + "Face used for tracks in current emms playlist." + :group 'helm-emms) + + +(defvar emms-stream-list) +(defun helm-emms-stream-edit-bookmark (elm) + "Change the information of current emms-stream bookmark from helm." + (let* ((cur-buf helm-current-buffer) + (bookmark (assoc elm emms-stream-list)) + (name (read-from-minibuffer "Description: " + (nth 0 bookmark))) + (url (read-from-minibuffer "URL: " + (nth 1 bookmark))) + (fd (read-from-minibuffer "Feed Descriptor: " + (int-to-string (nth 2 bookmark)))) + (type (read-from-minibuffer "Type (url, streamlist, or lastfm): " + (format "%s" (car (last bookmark)))))) + (save-window-excursion + (emms-streams) + (when (re-search-forward (concat "^" name) nil t) + (forward-line 0) + (emms-stream-delete-bookmark) + (emms-stream-add-bookmark name url (string-to-number fd) type) + (emms-stream-save-bookmarks-file) + (emms-stream-quit) + (helm-switch-to-buffer cur-buf))))) + +(defun helm-emms-stream-delete-bookmark (_candidate) + "Delete emms-streams bookmarks from helm." + (let* ((cands (helm-marked-candidates)) + (bmks (cl-loop for bm in cands collect + (car (assoc bm emms-stream-list)))) + (bmk-reg (mapconcat 'regexp-quote bmks "\\|^"))) + (when (y-or-n-p (format "Really delete radios\n -%s: ? " + (mapconcat 'identity bmks "\n -"))) + (save-window-excursion + (emms-streams) + (goto-char (point-min)) + (cl-loop while (re-search-forward bmk-reg nil t) + do (progn (forward-line 0) + (emms-stream-delete-bookmark)) + finally do (progn + (emms-stream-save-bookmarks-file) + (emms-stream-quit))))))) + +(defvar helm-source-emms-streams + '((name . "Emms Streams") + (init . (lambda () + (emms-stream-init))) + (candidates . (lambda () + (mapcar 'car emms-stream-list))) + (action . (("Play" . (lambda (elm) + (let* ((stream (assoc elm emms-stream-list)) + (fn (intern (concat "emms-play-" (symbol-name (car (last stream)))))) + (url (cl-second stream))) + (funcall fn url)))) + ("Delete" . helm-emms-stream-delete-bookmark) + ("Edit" . helm-emms-stream-edit-bookmark))) + (filtered-candidate-transformer . helm-adaptive-sort))) + +;; Don't forget to set `emms-source-file-default-directory' +(defvar helm-source-emms-dired + '((name . "Music Directory") + (candidates . (lambda () + (cddr (directory-files emms-source-file-default-directory)))) + (action . + (("Play Directory" . (lambda (item) + (emms-play-directory + (expand-file-name + item + emms-source-file-default-directory)))) + ("Open dired in file's directory" . (lambda (item) + (helm-open-dired + (expand-file-name + item + emms-source-file-default-directory)))))) + (filtered-candidate-transformer . helm-adaptive-sort))) + +(defvar helm-emms-current-playlist nil) +(defun helm-emms-files-modifier (candidates _source) + (cl-loop for i in candidates + if (member (cdr i) helm-emms-current-playlist) + collect (cons (propertize (car i) + 'face 'helm-emms-playlist) + (cdr i)) + into lis + else collect i into lis + finally return (reverse lis))) + +(defun helm-emms-play-current-playlist () + "Play current playlist." + (emms-playlist-first) + (emms-playlist-mode-play-smart)) + +(defvar helm-source-emms-files + '((name . "Emms files") + (init . (lambda () + (setq helm-emms-current-playlist + (with-current-emms-playlist + (cl-loop with cur-list = (emms-playlist-tracks-in-region + (point-min) (point-max)) + for i in cur-list + for name = (assoc-default 'name i) + when name + collect name))))) + (candidates . (lambda () + (cl-loop for v being the hash-values in emms-cache-db + for name = (assoc-default 'name v) + for artist = (or (assoc-default 'info-artist v) "unknown") + for genre = (or (assoc-default 'info-genre v) "unknown") + for tracknum = (or (assoc-default 'info-tracknumber v) "unknown") + for song = (or (assoc-default 'info-title v) "unknown") + for info = (concat artist " - " genre " - " tracknum ": " song) + unless (string-match "^\\(http\\|mms\\):" name) + collect (cons info name)))) + (filtered-candidate-transformer . helm-emms-files-modifier) + (candidate-number-limit . 9999) + (action . (("Play file" . emms-play-file) + ("Add to Playlist and play (C-u clear current)" + . (lambda (candidate) + (with-current-emms-playlist + (when helm-current-prefix-arg + (emms-playlist-current-clear)) + (emms-playlist-new) + (mapc 'emms-add-playlist-file (helm-marked-candidates)) + (unless emms-player-playing-p + (helm-emms-play-current-playlist))))))))) + +;;;###autoload +(defun helm-emms () + "Preconfigured `helm' for emms sources." + (interactive) + (helm :sources '(helm-source-emms-streams + helm-source-emms-files + helm-source-emms-dired) + :buffer "*Helm Emms*")) + + +(provide 'helm-emms) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-emms ends here diff --git a/elpa/helm-20140808.2300/helm-emms.elc b/elpa/helm-20140808.2300/helm-emms.elc new file mode 100644 index 000000000..0de281b39 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-emms.elc differ diff --git a/elpa/helm-20140808.2300/helm-eshell.el b/elpa/helm-20140808.2300/helm-eshell.el new file mode 100644 index 000000000..d79bdeb57 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-eshell.el @@ -0,0 +1,236 @@ +;;; helm-eshell.el --- pcomplete and eshell completion for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;; Enable like this in .emacs: +;; +;; (add-hook 'eshell-mode-hook +;; #'(lambda () +;; (define-key eshell-mode-map [remap pcomplete] 'helm-esh-pcomplete))) +;; + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'helm-elisp) +(require 'helm-regexp) + +(declare-function eshell-read-aliases-list "em-alias") +(declare-function eshell-send-input "esh-mode" (&optional use-region queue-p no-newline)) +(declare-function eshell-bol "esh-mode") +(declare-function eshell-parse-arguments "esh-arg" (beg end)) + +(defvar helm-eshell-history-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-p") 'helm-next-line) + map) + "Keymap for `helm-eshell-history'.") + +(defvar helm-esh-completion-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "TAB") 'helm-next-line) + map) + "Keymap for `helm-esh-pcomplete'.") + +(defvar helm-source-esh + '((name . "Eshell completions") + (init . (lambda () + (setq pcomplete-current-completions nil + pcomplete-last-completion-raw nil) + ;; Eshell-command add this hook in all minibuffers + ;; Remove it for the helm one. (Fixed in Emacs24) + (remove-hook 'minibuffer-setup-hook 'eshell-mode))) + (candidates . helm-esh-get-candidates) + (nomark) + (persistent-action . ignore) + (filtered-candidate-transformer + (lambda (candidates _sources) + (cl-loop for i in (sort candidates 'helm-generic-sort-fn) + collect + (cond ((string-match "\\`~/?" helm-ec-target) + (abbreviate-file-name i)) + ((string-match "\\`/" helm-ec-target) i) + (t + (file-relative-name i)))))) + (action . helm-ec-insert)) + "Helm source for Eshell completion.") + +;; Internal. +(defvar helm-ec-target "") +(defun helm-ec-insert (candidate) + "Replace text at point with CANDIDATE. +The function that call this should set `helm-ec-target' to thing at point." + (let ((pt (point))) + (when (and helm-ec-target + (search-backward helm-ec-target nil t) + (string= (buffer-substring (point) pt) helm-ec-target)) + (delete-region (point) pt))) + (cond ((string-match "\\`~/?" helm-ec-target) + (insert (helm-quote-whitespace (abbreviate-file-name candidate)))) + ((string-match "\\`/" helm-ec-target) + (insert (helm-quote-whitespace candidate))) + (t + (insert (concat (and (string-match "\\`[.]/" helm-ec-target) "./") + (helm-quote-whitespace + (file-relative-name candidate))))))) + +(defun helm-esh-get-candidates () + "Get candidates for eshell completion using `pcomplete'." + (catch 'pcompleted + (with-helm-current-buffer + (let* ((pcomplete-stub) + pcomplete-seen pcomplete-norm-func + pcomplete-args pcomplete-last pcomplete-index + (pcomplete-autolist pcomplete-autolist) + (pcomplete-suffix-list pcomplete-suffix-list) + (table (pcomplete-completions)) + (entry (or (try-completion helm-pattern + (pcomplete-entries)) + helm-pattern))) + (cl-loop ;; expand entry too to be able to compare it with file-cand. + with exp-entry = (and (stringp entry) + (not (string= entry "")) + (file-name-as-directory + (expand-file-name entry default-directory))) + for i in (all-completions pcomplete-stub table) + ;; Transform the related names to abs names. + for file-cand = (and exp-entry + (if (file-remote-p i) i + (expand-file-name + i (file-name-directory entry)))) + ;; Compare them to avoid dups. + for file-entry-p = (and (stringp exp-entry) + (stringp file-cand) + ;; Fix :/tmp/foo/ $ cd foo + (not (file-directory-p file-cand)) + (file-equal-p exp-entry file-cand)) + if (and file-cand (or (file-remote-p file-cand) + (file-exists-p file-cand)) + (not file-entry-p)) + collect file-cand into ls + else + ;; Avoid adding entry here. + unless file-entry-p collect i into ls + finally return + (if (and exp-entry + (file-directory-p exp-entry) + ;; If the car of completion list is + ;; an executable, probably we are in + ;; command completion, so don't add a + ;; possible file related entry here. + (and ls (not (executable-find (car ls)))) + ;; Don't add entry if already in prompt. + (not (file-equal-p exp-entry pcomplete-stub))) + (append (list exp-entry) + ;; Entry should not be here now but double check. + (remove entry ls)) + ls)))))) + +;;; Eshell history. +;; +;; +(defvar helm-source-eshell-history + `((name . "Eshell history") + (init . (lambda () + (let (eshell-hist-ignoredups) + (eshell-write-history eshell-history-file-name t) + (with-current-buffer (helm-candidate-buffer 'global) + (insert-file-contents eshell-history-file-name))) + ;; Same comment as in `helm-source-esh' + (remove-hook 'minibuffer-setup-hook 'eshell-mode))) + (candidates-in-buffer) + (nomark) + (keymap . ,helm-eshell-history-map) + (filtered-candidate-transformer . (lambda (candidates sources) + (reverse candidates))) + (candidate-number-limit . 9999) + (action . (lambda (candidate) + (eshell-kill-input) + (insert candidate)))) + "Helm source for Eshell history.") + +;;;###autoload +(defun helm-esh-pcomplete () + "Preconfigured helm to provide helm completion in eshell." + (interactive) + (let* ((helm-quit-if-no-candidate t) + (helm-execute-action-at-once-if-one t) + (end (point-marker)) + (beg (save-excursion (eshell-bol) (point))) + (args (catch 'eshell-incomplete + (eshell-parse-arguments beg end))) + ;; Use thing-at-point instead of last args value + ;; to exclude possible delimiters e.g "(". + (target (thing-at-point 'symbol)) + (first (car args)) ; Maybe lisp delimiter "(". + last) ; Will be the last but parsed by pcomplete. + (setq helm-ec-target (or target " ") + end (point) + ;; Reset beg for `with-helm-show-completion'. + beg (or (and target (- end (length target))) + ;; Nothing at point. + (progn (insert " ") (point)))) + (cond ((eq first ?\() + (helm-lisp-completion-or-file-name-at-point)) + ;; In eshell `pcomplete-parse-arguments' is called + ;; with `pcomplete-parse-arguments-function' + ;; locally bound to `eshell-complete-parse-arguments' + ;; which is calling `lisp-complete-symbol', + ;; calling it before would popup the + ;; *completions* buffer. + (t (setq last (car (last (ignore-errors + (pcomplete-parse-arguments))))) + (with-helm-show-completion beg end + (helm :sources 'helm-source-esh + :buffer "*helm pcomplete*" + :keymap helm-esh-completion-map + :resume 'noresume + :input (and (stringp last) + (helm-ff-set-pattern last)))))))) + +;;;###autoload +(defun helm-eshell-history () + "Preconfigured helm for eshell history." + (interactive) + (let* ((end (point)) + (beg (save-excursion (eshell-bol) (point))) + (input (buffer-substring beg end)) + flag-empty) + (when (eq beg end) + (insert " ") + (setq flag-empty t) + (setq end (point))) + (unwind-protect + (with-helm-show-completion beg end + (helm :sources 'helm-source-eshell-history + :buffer "*helm eshell history*" + :resume 'noresume + :input input)) + (when (and flag-empty + (looking-back " ")) + (delete-char -1))))) + +(provide 'helm-eshell) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-eshell ends here diff --git a/elpa/helm-20140808.2300/helm-eshell.elc b/elpa/helm-20140808.2300/helm-eshell.elc new file mode 100644 index 000000000..b52a79532 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-eshell.elc differ diff --git a/elpa/helm-20140808.2300/helm-eval.el b/elpa/helm-20140808.2300/helm-eval.el new file mode 100644 index 000000000..9fbf0eee4 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-eval.el @@ -0,0 +1,177 @@ +;;; helm-eval.el --- eval expressions from helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'eldoc) + + +(defgroup helm-eval nil + "Eval related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-eldoc-in-minibuffer-show-fn + 'helm-show-info-in-mode-line + "A function to display eldoc info. +Should take one arg: the string to display." + :group 'helm-eval + :type 'symbol) + +(defcustom helm-show-info-in-mode-line-delay 12 + "Eldoc will show info in mode-line during this delay if user is idle." + :type 'integer + :group 'helm-eval) + + +(declare-function eldoc-current-symbol "eldoc") +(declare-function eldoc-get-fnsym-args-string "eldoc" (sym &optional index)) +(declare-function eldoc-get-var-docstring "eldoc" (sym)) +(declare-function eldoc-fnsym-in-current-sexp "eldoc") + +;;; Evaluation Result +;; +;; +;; Internal +(defvar helm-eldoc-active-minibuffers-list nil) + +(defvar helm-eval-expression-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "") 'helm-eval-new-line-and-indent) + (define-key map (kbd "") 'lisp-indent-line) + (define-key map (kbd "") 'helm-lisp-completion-at-point) + (define-key map (kbd "C-p") 'previous-line) + (define-key map (kbd "C-n") 'next-line) + (define-key map (kbd "") 'previous-line) + (define-key map (kbd "") 'next-line) + (define-key map (kbd "") 'forward-char) + (define-key map (kbd "") 'backward-char) + map)) + +(defvar helm-source-evaluation-result + '((name . "Evaluation Result") + (init . (lambda () (require 'edebug))) + (dummy) + (multiline) + (mode-line . "C-RET: nl-and-indent, tab: reindent, C-tab:complete, C-p/n: next/prec-line.") + (filtered-candidate-transformer . (lambda (candidates _source) + (list + (condition-case nil + (with-helm-current-buffer + (pp-to-string + (if edebug-active + (edebug-eval-expression + (read helm-pattern)) + (eval (read helm-pattern))))) + (error "Error"))))) + (action . (("Copy result to kill-ring" . (lambda (candidate) + (kill-new + (replace-regexp-in-string + "\n" "" candidate)))) + ("copy sexp to kill-ring" . (lambda (candidate) + (kill-new helm-input))))))) + +(defun helm-eval-new-line-and-indent () + (interactive) + (newline) (lisp-indent-line)) + +(defun helm-eldoc-store-minibuffer () + "Store minibuffer buffer name in `helm-eldoc-active-minibuffers-list'." + (with-selected-window (minibuffer-window) + (push (current-buffer) helm-eldoc-active-minibuffers-list))) + +(defun helm-eldoc-show-in-eval () + "Return eldoc in mode-line for current minibuffer input." + (let ((buf (window-buffer (active-minibuffer-window)))) + (condition-case err + (when (member buf helm-eldoc-active-minibuffers-list) + (with-current-buffer buf + (let* ((sym (save-excursion + (unless (looking-back ")\\|\"") + (forward-char -1)) + (eldoc-current-symbol))) + (info-fn (eldoc-fnsym-in-current-sexp)) + (doc (or (eldoc-get-var-docstring sym) + (eldoc-get-fnsym-args-string + (car info-fn) (cadr info-fn))))) + (when doc (funcall helm-eldoc-in-minibuffer-show-fn doc))))) + (error (message "Eldoc in minibuffer error: %S" err) nil)))) + +(defun helm-show-info-in-mode-line (str) + "Display string STR in mode-line." + (save-selected-window + (with-current-buffer helm-buffer + (let ((mode-line-format (concat " " str))) + (force-mode-line-update) + (sit-for helm-show-info-in-mode-line-delay)) + (force-mode-line-update)))) + +;;; Calculation Result +;; +;; +(defvar helm-source-calculation-result + '((name . "Calculation Result") + (dummy) + (filtered-candidate-transformer . (lambda (candidates _source) + (list + (condition-case nil + (calc-eval helm-pattern) + (error "error"))))) + (action ("Copy result to kill-ring" . kill-new)))) + +;;;###autoload +(defun helm-eval-expression (arg) + "Preconfigured helm for `helm-source-evaluation-result'." + (interactive "P") + (helm :sources 'helm-source-evaluation-result + :input (when arg (thing-at-point 'sexp)) + :buffer "*helm eval*" + :history 'read-expression-history + :keymap helm-eval-expression-map)) + +(defvar eldoc-idle-delay) +;;;###autoload +(defun helm-eval-expression-with-eldoc () + "Preconfigured helm for `helm-source-evaluation-result' with `eldoc' support. " + (interactive) + (let ((timer (run-with-idle-timer + eldoc-idle-delay 'repeat + 'helm-eldoc-show-in-eval))) + (unwind-protect + (minibuffer-with-setup-hook + 'helm-eldoc-store-minibuffer + (call-interactively 'helm-eval-expression)) + (and timer (cancel-timer timer)) + (setq helm-eldoc-active-minibuffers-list + (cdr helm-eldoc-active-minibuffers-list))))) + +;;;###autoload +(defun helm-calcul-expression () + "Preconfigured helm for `helm-source-calculation-result'." + (interactive) + (helm-other-buffer 'helm-source-calculation-result "*helm calcul*")) + +(provide 'helm-eval) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-eval.el ends here diff --git a/elpa/helm-20140808.2300/helm-eval.elc b/elpa/helm-20140808.2300/helm-eval.elc new file mode 100644 index 000000000..e7b20516e Binary files /dev/null and b/elpa/helm-20140808.2300/helm-eval.elc differ diff --git a/elpa/helm-20140808.2300/helm-external.el b/elpa/helm-20140808.2300/helm-external.el new file mode 100644 index 000000000..bb02a7c6b --- /dev/null +++ b/elpa/helm-20140808.2300/helm-external.el @@ -0,0 +1,215 @@ +;;; helm-external.el --- Run Externals commands within Emacs with helm completion. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) + + +(defgroup helm-external nil + "External related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-raise-command nil + "A shell command to jump to a window running specific program. +Need external program wmctrl. +This will be use with `format', so use something like \"wmctrl -xa %s\"." + :type 'string + :group 'helm-external) + +(defcustom helm-external-programs-associations nil + "Alist to store externals programs associated with file extension. +This variable overhide setting in .mailcap file. +e.g : '\(\(\"jpg\" . \"gqview\"\) (\"pdf\" . \"xpdf\"\)\) " + :type '(alist :key-type string :value-type string) + :group 'helm-external) + +(defcustom helm-default-external-file-browser "nautilus" + "Default external file browser for your system. +Directories will be opened externally with it when +opening file externally in `helm-find-files'. +Set to nil if you do not have external file browser +or do not want to use it. +Windows users should set that to \"explorer.exe\"." + :group 'helm-external + :type 'string) + + +;;; Internals +(defvar helm-external-command-history nil) +(defvar helm-external-commands-list nil + "A list of all external commands the user can execute. +If this variable is not set by the user, it will be calculated +automatically.") + +(defun helm-external-commands-list-1 (&optional sort) + "Returns a list of all external commands the user can execute. +If `helm-external-commands-list' is non-nil it will +return its contents. Else it calculates all external commands +and sets `helm-external-commands-list'." + (helm-aif helm-external-commands-list + it + (setq helm-external-commands-list + (cl-loop + for dir in (split-string (getenv "PATH") path-separator) + when (and (file-exists-p dir) (file-accessible-directory-p dir)) + for lsdir = (cl-loop for i in (directory-files dir t) + for bn = (file-name-nondirectory i) + when (and (not (member bn completions)) + (not (file-directory-p i)) + (file-executable-p i)) + collect bn) + append lsdir into completions + finally return + (if sort (sort completions 'string-lessp) completions))))) + +(defun helm-run-or-raise (exe &optional file) + "Generic command that run asynchronously EXE. +If EXE is already running just jump to his window if `helm-raise-command' +is non--nil. +When FILE argument is provided run EXE with FILE. +In this case EXE must be provided as \"EXE %s\"." + (let* ((real-com (car (split-string (replace-regexp-in-string + "%s" "" exe)))) + (proc (if file (concat real-com " " file) real-com)) + process-connection-type) + (if (get-process proc) + (if helm-raise-command + (shell-command (format helm-raise-command real-com)) + (error "Error: %s is already running" real-com)) + (when (cl-loop for i in helm-external-commands-list thereis (string= real-com i)) + (message "Starting %s..." real-com) + (if file + (start-process-shell-command + proc nil (format exe (shell-quote-argument + (if (eq system-type 'windows-nt) + (helm-w32-prepare-filename file) + file)))) + (start-process-shell-command proc nil real-com)) + (set-process-sentinel + (get-process proc) + #'(lambda (process event) + (when (and (string= event "finished\n") + helm-raise-command + (not (helm-get-pid-from-process-name real-com))) + (shell-command (format helm-raise-command "emacs"))) + (message "%s process...Finished." process)))) + (setq helm-external-commands-list + (cons real-com + (delete real-com helm-external-commands-list)))))) + +(defun helm-get-mailcap-for-file (filename) + "Get the command to use for FILENAME from mailcap files. +The command is like and is meant to use with `format'." + (mailcap-parse-mailcaps) + (let* ((ext (file-name-extension filename)) + (mime (when ext (mailcap-extension-to-mime ext))) + (result (when mime (mailcap-mime-info mime)))) + ;; If elisp file have no associations in .mailcap + ;; `mailcap-maybe-eval' is returned, in this case just return nil. + (when (stringp result) result))) + +(defun helm-get-default-program-for-file (filename) + "Try to find a default program to open FILENAME. +Try first in `helm-external-programs-associations' and then in mailcap file +if nothing found return nil." + (let* ((ext (file-name-extension filename)) + (def-prog (assoc-default ext helm-external-programs-associations))) + (cond ((and def-prog (not (string= def-prog ""))) + (concat def-prog " %s")) + ((and helm-default-external-file-browser + (file-directory-p filename)) + (concat helm-default-external-file-browser " %s")) + (t (helm-get-mailcap-for-file filename))))) + +(defun helm-open-file-externally (file) + "Open FILE with an external program. +Try to guess which program to use with `helm-get-default-program-for-file'. +If not found or a prefix arg is given query the user which tool to use." + (let* ((fname (expand-file-name file)) + (collection (helm-external-commands-list-1 'sort)) + (def-prog (helm-get-default-program-for-file fname)) + (real-prog-name (if (or helm-current-prefix-arg (not def-prog)) + ;; Prefix arg or no default program. + (prog1 + (helm-comp-read + "Program: " collection + :must-match t + :name "Open file Externally" + :del-input nil + :history helm-external-command-history) + ;; Always prompt to set this program as default. + (setq def-prog nil)) + ;; No prefix arg or default program exists. + (replace-regexp-in-string " %s\\| '%s'" "" def-prog))) + (program (concat real-prog-name " %s"))) + (unless (or def-prog ; Association exists, no need to record it. + ;; Don't try to record non--filenames associations (e.g urls). + (not (file-exists-p fname))) + (when + (y-or-n-p + (format + "Do you want to make `%s' the default program for this kind of files? " + real-prog-name)) + (helm-aif (assoc (file-name-extension fname) + helm-external-programs-associations) + (setq helm-external-programs-associations + (delete it helm-external-programs-associations))) + (push (cons (file-name-extension fname) + (helm-read-string + "Program (Add args maybe and confirm): " real-prog-name)) + helm-external-programs-associations) + (customize-save-variable 'helm-external-programs-associations + helm-external-programs-associations))) + (helm-run-or-raise program file) + (setq helm-external-command-history + (cons real-prog-name + (delete real-prog-name + (cl-loop for i in helm-external-command-history + when (executable-find i) collect i)))))) + +;;;###autoload +(defun helm-run-external-command (program) + "Preconfigured `helm' to run External PROGRAM asyncronously from Emacs. +If program is already running exit with error. +You can set your own list of commands with +`helm-external-commands-list'." + (interactive (list + (helm-comp-read + "RunProgram: " + (helm-external-commands-list-1 'sort) + :must-match t + :del-input nil + :name "External Commands" + :history helm-external-command-history))) + (helm-run-or-raise program) + (setq helm-external-command-history + (cons program (delete program + (cl-loop for i in helm-external-command-history + when (executable-find i) collect i))))) + + +(provide 'helm-external) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-external ends here diff --git a/elpa/helm-20140808.2300/helm-external.elc b/elpa/helm-20140808.2300/helm-external.elc new file mode 100644 index 000000000..15d6d1235 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-external.elc differ diff --git a/elpa/helm-20140808.2300/helm-files.el b/elpa/helm-20140808.2300/helm-files.el new file mode 100644 index 000000000..2c9ccf45a --- /dev/null +++ b/elpa/helm-20140808.2300/helm-files.el @@ -0,0 +1,2882 @@ +;;; helm-files.el --- helm file browser and related. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) +(require 'helm-external) +(require 'helm-grep) +(require 'helm-match-plugin) +(require 'helm-help) +(require 'helm-locate) +(require 'helm-bookmark) +(require 'helm-tags) +(require 'helm-buffers) +(require 'thingatpt) +(require 'ffap) +(require 'dired-aux) +(require 'dired-x) +(require 'tramp) +(require 'image-dired) + +(declare-function find-library-name "find-func.el" (library)) +(declare-function secure-hash "ext:fns.c" (algorithm object &optional start end binary)) +(declare-function w32-shell-execute "ext:w32fns.c" (operation document &optional parameters show-flag)) +(declare-function gnus-dired-attach "ext:gnus-dired.el" (files-to-attach)) +(declare-function image-dired-display-image "image-dired.el" (file &optional original-size)) +(declare-function image-dired-update-property "image-dired.el" (prop value)) +(declare-function eshell-read-aliases-list "em-alias") +(declare-function eshell-send-input "esh-mode" (&optional use-region queue-p no-newline)) +(declare-function eshell-kill-input "esh-mode") +(declare-function eshell-bol "esh-mode") +(declare-function helm-ls-git-ls "ext:helm-ls-git") +(declare-function helm-hg-find-files-in-project "ext:helm-ls-hg") + + +;;; Type attributes +;; +;; +(define-helm-type-attribute 'file + `((action + ("Find file" . helm-find-many-files) + ("Find file as root" . helm-find-file-as-root) + ("Find file other window" . find-file-other-window) + ("Find file other frame" . find-file-other-frame) + ("Open dired in file's directory" . helm-open-dired) + ("Grep File(s) `C-u recurse'" . helm-find-files-grep) + ("Zgrep File(s) `C-u Recurse'" . helm-ff-zgrep) + ("Pdfgrep File(s)" . helm-ff-pdfgrep) + ("Insert as org link" . helm-files-insert-as-org-link) + ("Checksum File" . helm-ff-checksum) + ("Ediff File" . helm-find-files-ediff-files) + ("Ediff Merge File" . helm-find-files-ediff-merge-files) + ("Etags `M-., C-u tap, C-u C-u reload tag file'" . helm-ff-etags-select) + ("View file" . view-file) + ("Insert file" . insert-file) + ("Delete file(s)" . helm-delete-marked-files) + ("Open file externally (C-u to choose)" . helm-open-file-externally) + ("Open file with default tool" . helm-open-file-with-default-tool) + ("Find file in hex dump" . hexl-find-file)) + (persistent-help . "Show this file") + (action-transformer helm-transform-file-load-el + helm-transform-file-browse-url) + (candidate-transformer helm-skip-boring-files + helm-highlight-files + helm-w32-pathname-transformer)) + "File name.") + + + +(defgroup helm-files nil + "Files applications and libraries for Helm." + :group 'helm) + +(defcustom helm-boring-file-regexp-list + (mapcar (lambda (f) + (concat + (rx-to-string + (replace-regexp-in-string + "/$" "" f) t) "$")) + completion-ignored-extensions) + "The regexp list matching boring files." + :group 'helm-files + :type '(repeat (choice regexp))) + +(defcustom helm-for-files-preferred-list + '(helm-source-buffers-list + helm-source-recentf + helm-source-bookmarks + helm-source-file-cache + helm-source-files-in-current-dir + helm-source-locate) + "Your preferred sources to find files." + :type '(repeat (choice symbol)) + :group 'helm-files) + +(defcustom helm-tramp-verbose 0 + "Just like `tramp-verbose' but specific to helm. +When set to 0 don't show tramp messages in helm. +If you want to have the default tramp messages set it to 3." + :type 'integer + :group 'helm-files) + +(defcustom helm-ff-auto-update-initial-value nil + "Auto update when only one candidate directory is matched. +Default value when starting `helm-find-files' is nil because +it prevent using to delete char backward and by the way +confuse beginners. +For a better experience with `helm-find-files' set this to non--nil +and use C- to toggle it." + :group 'helm-files + :type 'boolean) + +(defcustom helm-ff-lynx-style-map t + "Use arrow keys to navigate with `helm-find-files'. +You will have to restart Emacs or reeval `helm-find-files-map' +and `helm-read-file-map' for this take effect." + :group 'helm-files + :type 'boolean) + +(defcustom helm-ff-history-max-length 100 + "Number of elements shown in `helm-find-files' history." + :group 'helm-files + :type 'integer) + +(defcustom helm-ff-smart-completion t + "Try to complete filenames smarter when non--nil. +See `helm-ff--transform-pattern-for-completion' for more info." + :group 'helm-files + :type 'boolean) + +(defcustom helm-ff-tramp-not-fancy t + "No colors when listing remote files when set to non--nil. +This make listing much faster, specially on slow machines." + :group 'helm-files + :type 'boolean) + +(defcustom helm-ff-exif-data-program "exiftran" + "Program used to extract exif data of an image file." + :group 'helm-files + :type 'string) + +(defcustom helm-ff-exif-data-program-args "-d" + "Arguments used for `helm-ff-exif-data-program'." + :group 'helm-files + :type 'string) + +(defcustom helm-ff-newfile-prompt-p t + "Whether Prompt or not when creating new file. +This set `ffap-newfile-prompt'." + :type 'boolean + :group 'helm-files) + +(defcustom helm-ff-avfs-directory "~/.avfs" + "The default avfs directory, usually '~/.avfs'. +When this is set you will be able to expand archive filenames with `C-j' +inside an avfs directory mounted with mountavfs. +See ." + :type 'string + :group 'helm-files) + +(defcustom helm-ff-file-compressed-list '("gz" "bz2" "zip" "7z") + "Minimal list of compressed files extension." + :type '(repeat (choice string)) + :group 'helm-files) + +(defcustom helm-ff-printer-list nil + "A list of available printers on your system. +When non--nil let you choose a printer to print file. +Otherwise when nil the variable `printer-name' will be used. +On Unix based systems (lpstat command needed) you don't need to set this, +`helm-ff-find-printers' will find a list of available printers for you." + :type '(repeat (choice string)) + :group 'helm-files) + +(defcustom helm-ff-transformer-show-only-basename t + "Show only basename of candidates in `helm-find-files'. +This can be toggled at anytime from `helm-find-files' with \ +\\\\[helm-ff-run-toggle-basename]." + :type 'boolean + :group 'helm-files) + +(defcustom helm-ff-signal-error-on-dot-files t + "Signal error when file is `.' or `..' on file deletion when non--nil. +Default is non--nil. +WARNING: Setting this to nil is unsafe and can cause deletion of a whole tree." + :group 'helm-files + :type 'boolean) + +(defcustom helm-ff-search-library-in-sexp nil + "Search for library in `require' and `declare-function' sexp." + :group 'helm-files + :type 'boolean) + +(defcustom helm-tooltip-hide-delay 25 + "Hide tooltips automatically after this many seconds." + :group 'helm-files + :type 'integer) + +(defcustom helm-ff-file-name-history-use-recentf nil + "Use `recentf-list' instead of `file-name-history' in `helm-find-files'." + :group 'helm-files + :type 'boolean) + +(defcustom helm-ff-skip-boring-files nil + "Non--nil to skip files matching regexps in `helm-boring-file-regexp-list'. +This take effect in `helm-find-files' and file completion used by `helm-mode' +i.e `helm-read-file-name'." + :group 'helm-files + :type 'boolean) + +(defcustom helm-findutils-skip-boring-files t + "Ignore files matching regexps in `completion-ignored-extensions'." + :group 'helm-files + :type 'boolean) + +(defcustom helm-findutils-find-program "find" + "The program used for the Unix shell command 'find'." + :group 'helm-files + :type 'string) + +(defcustom helm-findutils-search-full-path nil + "Search in full path with shell command find when non--nil. +I.e use the -path/ipath arguments of find instead of -name/iname." + :group 'helm-files + :type 'boolean) + +(defcustom helm-files-save-history-extra-sources '("Find" "Locate") + "Extras source that save candidate to `file-name-history'." + :group 'helm-files + :type '(repeat (choice string))) + +;;; Faces +;; +;; +(defface helm-ff-prefix + '((t (:background "yellow" :foreground "black"))) + "Face used to prefix new file or url paths in `helm-find-files'." + :group 'helm-files) + +(defface helm-ff-executable + '((t (:foreground "green"))) + "Face used for executable files in `helm-find-files'." + :group 'helm-files) + +(defface helm-ff-directory + '((t (:foreground "DarkRed" :background "LightGray"))) + "Face used for directories in `helm-find-files'." + :group 'helm-files) + +(defface helm-ff-symlink + '((t (:foreground "DarkOrange"))) + "Face used for symlinks in `helm-find-files'." + :group 'helm-files) + +(defface helm-ff-invalid-symlink + '((t (:foreground "black" :background "red"))) + "Face used for invalid symlinks in `helm-find-files'." + :group 'helm-files) + +(defface helm-ff-file + '((t (:inherit font-lock-builtin-face))) + "Face used for file names in `helm-find-files'." + :group 'helm-files) + +(defface helm-history-deleted + '((t (:inherit helm-ff-invalid-symlink))) + "Face used for deleted files in `file-name-history'." + :group 'helm-files) + +(defface helm-history-remote + '((t (:foreground "Indianred1"))) + "Face used for remote files in `file-name-history'." + :group 'helm-files) + + +;;; Helm-find-files - The helm file browser. +;; +;; Keymaps +(defvar helm-find-files-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) + (define-key map (kbd "C-x C-f") 'helm-ff-run-locate) + (define-key map (kbd "C-x C-d") 'helm-ff-run-browse-project) + (define-key map (kbd "C-s") 'helm-ff-run-grep) + (define-key map (kbd "M-g s") 'helm-ff-run-grep) + (define-key map (kbd "M-g p") 'helm-ff-run-pdfgrep) + (define-key map (kbd "M-g z") 'helm-ff-run-zgrep) + (define-key map (kbd "M-.") 'helm-ff-run-etags) + (define-key map (kbd "M-R") 'helm-ff-run-rename-file) + (define-key map (kbd "M-C") 'helm-ff-run-copy-file) + (define-key map (kbd "M-B") 'helm-ff-run-byte-compile-file) + (define-key map (kbd "M-L") 'helm-ff-run-load-file) + (define-key map (kbd "M-S") 'helm-ff-run-symlink-file) + (define-key map (kbd "M-H") 'helm-ff-run-hardlink-file) + (define-key map (kbd "M-D") 'helm-ff-run-delete-file) + (define-key map (kbd "M-K") 'helm-ff-run-kill-buffer-persistent) + (define-key map (kbd "C-c d") 'helm-ff-persistent-delete) + (define-key map (kbd "M-e") 'helm-ff-run-switch-to-eshell) + (define-key map (kbd "C-c i") 'helm-ff-run-complete-fn-at-point) + (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window) + (define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame) + (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally) + (define-key map (kbd "C-c X") 'helm-ff-run-open-file-with-default-tool) + (define-key map (kbd "M-!") 'helm-ff-run-eshell-command-on-file) + (define-key map (kbd "M-%") 'helm-ff-run-query-replace-on-marked) + (define-key map (kbd "C-=") 'helm-ff-run-ediff-file) + (define-key map (kbd "C-c =") 'helm-ff-run-ediff-merge-file) + (define-key map (kbd "M-p") 'helm-ff-run-switch-to-history) + (define-key map (kbd "C-c h") 'helm-ff-file-name-history) + (define-key map (kbd "M-i") 'helm-ff-properties-persistent) + (define-key map (kbd "C-c ?") 'helm-ff-help) + (define-key map (kbd "C-}") 'helm-narrow-window) + (define-key map (kbd "C-{") 'helm-enlarge-window) + (define-key map (kbd "C-") 'helm-ff-run-toggle-auto-update) + (define-key map (kbd "C-c ") 'helm-ff-run-toggle-auto-update) + (define-key map (kbd "C-c C-a") 'helm-ff-run-gnus-attach-files) + (define-key map (kbd "C-c p") 'helm-ff-run-print-file) + (define-key map (kbd "C-c /") 'helm-ff-run-find-sh-command) + ;; Next 2 have no effect if candidate is not an image file. + (define-key map (kbd "M-l") 'helm-ff-rotate-left-persistent) + (define-key map (kbd "M-r") 'helm-ff-rotate-right-persistent) + (define-key map (kbd "C-.") 'helm-find-files-up-one-level) + (define-key map (kbd "C-l") 'helm-find-files-up-one-level) + (define-key map (kbd "C-h C-b") 'helm-send-bug-report-from-helm) + (define-key map (kbd "C-x @") 'helm-ff-run-find-file-as-root) + (define-key map (kbd "C-c @") 'helm-ff-run-insert-org-link) + (helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward + nil nil 'helm-ff-delete-char-backward--exit-fn) + (when helm-ff-lynx-style-map + (define-key map (kbd "") 'helm-find-files-up-one-level) + (define-key map (kbd "") 'helm-execute-persistent-action)) + (delq nil map)) + "Keymap for `helm-find-files'.") + +(defvar helm-read-file-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "") 'helm-cr-empty-string) + (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) + (define-key map (kbd "C-.") 'helm-find-files-up-one-level) + (define-key map (kbd "C-l") 'helm-find-files-up-one-level) + (define-key map (kbd "C-c h") 'helm-ff-file-name-history) + (define-key map (kbd "C-") 'helm-ff-run-toggle-auto-update) + (define-key map (kbd "C-c ?") 'helm-read-file-name-help) + (helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward + nil nil 'helm-ff-delete-char-backward--exit-fn) + (when helm-ff-lynx-style-map + (define-key map (kbd "") 'helm-find-files-up-one-level) + (define-key map (kbd "") 'helm-execute-persistent-action) + (define-key map (kbd "C-o") nil) + (define-key map (kbd "") 'helm-previous-source) + (define-key map (kbd "") 'helm-next-source)) + (delq nil map)) + "Keymap for `helm-read-file-name'.") + +(defvar helm-esh-on-file-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-esh-help) + map) + "Keymap for `helm-find-files-eshell-command-on-file'.") + + +;; Internal. +(defvar helm-find-files-doc-header " (`C-l': Go up one level)" + "*The doc that is inserted in the Name header of a find-files or dired source.") +(defvar helm-ff-auto-update-flag nil + "Internal, flag to turn on/off auto-update in `helm-find-files'. +Don't set it directly, use instead `helm-ff-auto-update-initial-value'.") +(defvar helm-ff-last-expanded nil + "Store last expanded directory or file.") +(defvar helm-ff-default-directory nil) +(defvar helm-ff-history nil) +(defvar helm-ff-cand-to-mark nil) +(defvar helm-ff-url-regexp + "\\`\\(news\\(post\\)?:\\|nntp:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\):/?/?\\).*" + "Same as `ffap-url-regexp' but match earlier possible url.") +(defvar helm-tramp-file-name-regexp "\\`/\\([^[/:]+\\|[^/]+]\\):") +(defvar helm-marked-buffer-name "*helm marked*") +(defvar helm-ff--auto-update-state nil) +(defvar helm-ff--deleting-char-backward nil) + + +;;; Helm-find-files +;; +;; +(defvar helm-source-find-files + `((name . "Find Files") + (header-name . (lambda (name) + (concat name helm-find-files-doc-header))) + (init . (lambda () + (setq helm-ff-auto-update-flag + helm-ff-auto-update-initial-value) + (setq helm-ff--auto-update-state + helm-ff-auto-update-flag) + (helm-set-local-variable 'helm-in-file-completion-p t))) + (candidates . helm-find-files-get-candidates) + (filtered-candidate-transformer . helm-ff-sort-candidates) + (filter-one-by-one . helm-ff-filter-candidate-one-by-one) + (persistent-action . helm-find-files-persistent-action) + (persistent-help . "Hit1 Expand Candidate, Hit2 or (C-u) Find file") + (mode-line . helm-ff-mode-line-string) + (volatile) + (keymap . ,helm-find-files-map) + (nohighlight) + (candidate-number-limit . 9999) + (action-transformer . helm-find-files-action-transformer) + (action + . ,(delq + nil + `(("Find File" . helm-find-file-or-marked) + ("Find file in Dired" . helm-point-file-in-dired) + ,(and (locate-library "elscreen") + '("Find file in Elscreen" . helm-elscreen-find-file)) + ("View file" . view-file) + ("Checksum File" . helm-ff-checksum) + ("Query replace on marked" . helm-ff-query-replace-on-marked) + ("Serial rename files" . helm-ff-serial-rename) + ("Serial rename by symlinking files" . helm-ff-serial-rename-by-symlink) + ("Serial rename by copying files" . helm-ff-serial-rename-by-copying) + ("Open file with default tool" . helm-open-file-with-default-tool) + ("Find file in hex dump" . hexl-find-file) + ("Complete at point `C-c i'" + . helm-insert-file-name-completion-at-point) + ("Insert as org link `C-c @'" . helm-files-insert-as-org-link) + ("Find shell command `C-c /'" . helm-ff-find-sh-command) + ("Open file externally `C-c C-x, C-u to choose'" + . helm-open-file-externally) + ("Grep File(s) `C-s, C-u Recurse'" . helm-find-files-grep) + ("Zgrep File(s) `M-g z, C-u Recurse'" . helm-ff-zgrep) + ("Switch to Eshell `M-e'" . helm-ff-switch-to-eshell) + ("Etags `M-., C-u reload tag file'" . helm-ff-etags-select) + ("Eshell command on file(s) `M-!, C-u take all marked as arguments.'" + . helm-find-files-eshell-command-on-file) + ("Find file as root `C-x @'" . helm-find-file-as-root) + ("Ediff File `C-='" . helm-find-files-ediff-files) + ("Ediff Merge File `C-c ='" . helm-find-files-ediff-merge-files) + ("Delete File(s) `M-D'" . helm-delete-marked-files) + ("Copy file(s) `M-C, C-u to follow'" . helm-find-files-copy) + ("Rename file(s) `M-R, C-u to follow'" . helm-find-files-rename) + ("Symlink files(s) `M-S, C-u to follow'" . helm-find-files-symlink) + ("Relsymlink file(s) `C-u to follow'" . helm-find-files-relsymlink) + ("Hardlink file(s) `M-H, C-u to follow'" . helm-find-files-hardlink) + ("Find file other window `C-c o'" . find-file-other-window) + ("Switch to history `M-p'" . helm-find-files-switch-to-hist) + ("Find file other frame `C-c C-o'" . find-file-other-frame) + ("Print File `C-c p, C-u to refresh'" . helm-ff-print) + ("Locate `C-x C-f, C-u to specify locate db'" . helm-ff-locate))))) + "The main source to browse files. +Should not be used among other sources.") + +(defun helm-dwim-target-directory () + "Return value of `default-directory' of buffer in other window. +If there is only one window return the value ot `default-directory' +for current buffer." + (with-helm-current-buffer + (let ((num-windows (length (remove (get-buffer-window helm-marked-buffer-name) + (window-list))))) + (if (> num-windows 1) + (save-selected-window + (other-window 1) + default-directory) + (car helm-ff-history))))) + +(defun helm-find-files-do-action (action) + "Generic function for creating actions from `helm-source-find-files'. +ACTION must be an action supported by `helm-dired-action'." + (let* ((ifiles (mapcar 'expand-file-name ; Allow modify '/foo/.' -> '/foo' + (helm-marked-candidates :with-wildcard t))) + (cand (helm-get-selection)) ; Target + (prompt (format "%s %s file(s) to: " + (capitalize (symbol-name action)) + (length ifiles))) + (helm-always-two-windows t) + (helm-reuse-last-window-split-state t) + (helm-split-window-default-side + (eq helm-split-window-default-side 'same)) + helm-split-window-in-side-p + (parg helm-current-prefix-arg) + helm-display-source-at-screen-top ; prevent setting window-start. + helm-ff-auto-update-initial-value + (dest (with-helm-display-marked-candidates + helm-marked-buffer-name + (mapcar #'(lambda (f) + (if (file-directory-p f) + (concat (helm-basename f) "/") + (helm-basename f))) + ifiles) + (with-helm-current-buffer + (helm-read-file-name + prompt + :preselect (if helm-ff-transformer-show-only-basename + (helm-basename cand) cand) + :initial-input (helm-dwim-target-directory) + :history (helm-find-files-history :comp-read nil)))))) + (helm-dired-action + dest :files ifiles :action action :follow parg))) + +(defun helm-find-files-copy (_candidate) + "Copy files from `helm-find-files'." + (helm-find-files-do-action 'copy)) + +(defun helm-find-files-rename (_candidate) + "Rename files from `helm-find-files'." + (helm-find-files-do-action 'rename)) + +(defun helm-find-files-symlink (_candidate) + "Symlink files from `helm-find-files'." + (helm-find-files-do-action 'symlink)) + +(defun helm-find-files-relsymlink (_candidate) + "Relsymlink files from `helm-find-files'." + (helm-find-files-do-action 'relsymlink)) + +(defun helm-find-files-hardlink (_candidate) + "Hardlink files from `helm-find-files'." + (helm-find-files-do-action 'hardlink)) + +(defun helm-find-files-byte-compile (_candidate) + "Byte compile elisp files from `helm-find-files'." + (let ((files (helm-marked-candidates :with-wildcard t)) + (parg helm-current-prefix-arg)) + (cl-loop for fname in files + do (byte-compile-file fname parg)))) + +(defun helm-find-files-load-files (_candidate) + "Load elisp files from `helm-find-files'." + (let ((files (helm-marked-candidates :with-wildcard t))) + (cl-loop for fname in files + do (load fname)))) + +(defun helm-find-files-ediff-files-1 (candidate &optional merge) + "Generic function to ediff/merge files in `helm-find-files'." + (let* ((bname (helm-basename candidate)) + (marked (helm-marked-candidates :with-wildcard t)) + (prompt (if merge "Ediff Merge `%s' With File: " + "Ediff `%s' With File: ")) + (fun (if merge 'ediff-merge-files 'ediff-files)) + (input (helm-dwim-target-directory)) + (presel (if helm-ff-transformer-show-only-basename + (helm-basename candidate) + (expand-file-name + (helm-basename candidate) + input)))) + (if (= (length marked) 2) + (funcall fun (car marked) (cadr marked)) + (funcall fun candidate (helm-read-file-name + (format prompt bname) + :initial-input input + :preselect presel))))) + +(defun helm-find-files-ediff-files (candidate) + (helm-find-files-ediff-files-1 candidate)) + +(defun helm-find-files-ediff-merge-files (candidate) + (helm-find-files-ediff-files-1 candidate 'merge)) + +(defun helm-find-files-grep (_candidate) + "Default action to grep files from `helm-find-files'." + (apply 'run-with-timer 0.01 nil + #'helm-do-grep-1 + (helm-marked-candidates :with-wildcard t) + helm-current-prefix-arg)) + +(defun helm-ff-zgrep (_candidate) + "Default action to zgrep files from `helm-find-files'." + (helm-ff-zgrep-1 (helm-marked-candidates :with-wildcard t) helm-current-prefix-arg)) + +(defun helm-ff-pdfgrep (_candidate) + "Default action to pdfgrep files from `helm-find-files'." + (let ((cands (cl-loop for file in (helm-marked-candidates :with-wildcard t) + if (or (string= (file-name-extension file) "pdf") + (string= (file-name-extension file) "PDF")) + collect file)) + (helm-pdfgrep-default-function 'helm-pdfgrep-init)) + (when cands + (helm-do-pdfgrep-1 cands)))) + +(defun helm-ff-etags-select (candidate) + "Default action to jump to etags from `helm-find-files'." + (when (get-buffer helm-action-buffer) + (kill-buffer helm-action-buffer)) + (let* ((source-name (assoc-default 'name (helm-get-current-source))) + (default-directory (if (string= source-name "Find Files") + helm-ff-default-directory + (file-name-directory candidate)))) + (helm-etags-select helm-current-prefix-arg))) + +(defun helm-find-files-switch-to-hist (_candidate) + "Switch to helm-find-files history." + (helm-find-files t)) + +(defvar eshell-command-aliases-list nil) +(defvar helm-eshell-command-on-file-input-history nil) +(defun helm-find-files-eshell-command-on-file-1 (&optional map) + "Run `eshell-command' on CANDIDATE or marked candidates. +This is done possibly with an eshell alias, if no alias found, you can type in +an eshell command. + +Basename of CANDIDATE can be a wild-card. +e.g you can do \"eshell-command command *.el\" +Where \"*.el\" is the CANDIDATE. + +It is possible to do eshell-command command +like this: \"command %s some more args\". + +If MAP is given run `eshell-command' on all marked files at once, +Otherwise, run `eshell-command' on each marked files. +In other terms, with a prefix arg do on the three marked files +\"foo\" \"bar\" \"baz\": + +\"eshell-command command foo bar baz\" + +otherwise do + +\"eshell-command command foo\" +\"eshell-command command bar\" +\"eshell-command command baz\" + +Note: +If `eshell' or `eshell-command' have not been run once, +or if you have no eshell aliases `eshell-command-aliases-list' +will not be loaded first time you use this." + (when (or eshell-command-aliases-list + (y-or-n-p "Eshell is not loaded, run eshell-command without alias anyway? ")) + (and eshell-command-aliases-list (eshell-read-aliases-list)) + (let* ((cand-list (helm-marked-candidates :with-wildcard t)) + (default-directory (or helm-ff-default-directory + ;; If candidate is an url *-ff-default-directory is nil + ;; so keep value of default-directory. + default-directory)) + (command (helm-comp-read + "Command: " + (cl-loop for (a . c) in eshell-command-aliases-list + when (string-match "\\(\\$1\\|\\$\\*\\)$" (car c)) + collect (propertize a 'help-echo (car c)) into ls + finally return (sort ls 'string<)) + :buffer "*helm eshell on file*" + :name "Eshell command" + :keymap helm-esh-on-file-map + :mode-line + '("Eshell alias" + "C-c ?: Help, \\[universal-argument]: Insert output at point") + :input-history + 'helm-eshell-command-on-file-input-history)) + (alias-value (car (assoc-default command eshell-command-aliases-list)))) + (when (and (= (length cand-list) 1) + (string-match "[*]" (helm-basename (car cand-list)))) + (setq cand-list (file-expand-wildcards (car cand-list) t))) + (if (or (equal helm-current-prefix-arg '(16)) + (equal map '(16))) + ;; Two time C-u from `helm-comp-read' mean print to current-buffer. + ;; i.e `eshell-command' will use this value. + (setq current-prefix-arg '(16)) + ;; Else reset the value of `current-prefix-arg' + ;; to avoid printing in current-buffer. + (setq current-prefix-arg nil)) + (if (and (or + ;; One prefix-arg have been passed before `helm-comp-read'. + ;; If map have been set with C-u C-u (value == '(16)) + ;; ignore it. + (and map (equal map '(4))) + ;; One C-u from `helm-comp-read'. + (equal helm-current-prefix-arg '(4)) + ;; An alias that finish with $* + (and alias-value + ;; If command is an alias be sure it accept + ;; more than one arg i.e $*. + (string-match "\\$\\*$" alias-value))) + (cdr cand-list)) + + ;; Run eshell-command with ALL marked files as arguments. + ;; This wont work on remote files, because tramp handlers depends + ;; on `default-directory' (limitation). + (let ((mapfiles (mapconcat 'shell-quote-argument cand-list " "))) + (if (string-match "'%s'\\|\"%s\"\\|%s" command) + (eshell-command (format command mapfiles)) ; See [1] + (eshell-command (format "%s %s" command mapfiles)))) + + ;; Run eshell-command on EACH marked files. + ;; To work with tramp handler we have to call + ;; COMMAND on basename of each file, using + ;; its basedir as `default-directory'. + (cl-loop for f in cand-list + for dir = (and (not (string-match ffap-url-regexp f)) + (helm-basedir f)) + for file = (format "'%s'" (if (and dir (file-remote-p dir)) + (helm-basename f) f)) + for com = (if (string-match "'%s'\\|\"%s\"\\|%s" command) + ;; [1] This allow to enter other args AFTER filename + ;; i.e + (format command file) + (format "%s %s" command file)) + do (let ((default-directory (or dir default-directory))) + (eshell-command com))))))) + +(defun helm-find-files-eshell-command-on-file (_candidate) + "Run `eshell-command' on CANDIDATE or marked candidates. +See `helm-find-files-eshell-command-on-file-1' for more info." + (helm-find-files-eshell-command-on-file-1 helm-current-prefix-arg)) + +(defun helm-ff-switch-to-eshell (_candidate) + "Switch to eshell and cd to `helm-ff-default-directory'." + (let ((cd-eshell #'(lambda () + (eshell-kill-input) + (goto-char (point-max)) + (insert + (format "cd '%s'" helm-ff-default-directory)) + (eshell-send-input)))) + (if (get-buffer "*eshell*") + (helm-switch-to-buffer "*eshell*") + (call-interactively 'eshell)) + (unless (get-buffer-process (current-buffer)) + (funcall cd-eshell)))) + +(defun helm-ff-serial-rename-action (method) + "Rename all marked files to `helm-ff-default-directory' with METHOD. +See `helm-ff-serial-rename-1'." + (let* ((cands (helm-marked-candidates :with-wildcard t)) + (def-name (car cands)) + (name (helm-read-string "NewName: " + (replace-regexp-in-string + "[0-9]+$" "" + (helm-basename + def-name + (file-name-extension def-name))))) + (start (read-number "StartAtNumber: ")) + (extension (helm-read-string "Extension: " + (file-name-extension (car cands)))) + (dir (expand-file-name + (helm-read-file-name + "Serial Rename to directory: " + :initial-input + (expand-file-name helm-ff-default-directory) + :test 'file-directory-p + :must-match t))) + done) + (with-helm-display-marked-candidates + helm-marked-buffer-name (mapcar 'helm-basename cands) + (if (y-or-n-p + (format "Rename %s file(s) to <%s> like this ?\n%s " + (length cands) dir (format "%s <-> %s%s.%s" + (helm-basename (car cands)) + name start extension))) + (progn + (helm-ff-serial-rename-1 + dir cands name start extension :method method) + (setq done t) + (message nil)))) + (if done + (with-helm-current-buffer (helm-find-files-1 dir)) + (message "Operation aborted")))) + +(defun helm-ff-member-directory-p (file directory) + (let ((dir-file (expand-file-name + (file-name-as-directory (file-name-directory file)))) + (cur-dir (expand-file-name (file-name-as-directory directory)))) + (string= dir-file cur-dir))) + +(cl-defun helm-ff-serial-rename-1 + (directory collection new-name start-at-num extension &key (method 'rename)) + "rename files in COLLECTION to DIRECTORY with the prefix name NEW-NAME. +Rename start at number START-AT-NUM - ex: prefixname-01.jpg. +EXTENSION is the file extension to use, in empty prompt, +reuse the original extension of file. +METHOD can be one of rename, copy or symlink. +Files will be renamed if they are files of current directory, otherwise they +will be treated with METHOD. +Default METHOD is rename." + ;; Maybe remove directories selected by error in collection. + (setq collection (cl-remove-if 'file-directory-p collection)) + (let* ((tmp-dir (file-name-as-directory + (concat (file-name-as-directory directory) + (symbol-name (cl-gensym "tmp"))))) + (fn (cl-case method + (copy 'copy-file) + (symlink 'make-symbolic-link) + (rename 'rename-file) + (t (error "Error: Unknown method %s" method))))) + (make-directory tmp-dir) + (unwind-protect + (progn + ;; Rename all files to tmp-dir with new-name. + ;; If files are not from start directory, use method + ;; to move files to tmp-dir. + (cl-loop for i in collection + for count from start-at-num + for fnum = (if (< count 10) "0%s" "%s") + for nname = (concat tmp-dir new-name (format fnum count) + (if (not (string= extension "")) + (format ".%s" (replace-regexp-in-string + "[.]" "" extension)) + (file-name-extension i 'dot))) + do (if (helm-ff-member-directory-p i directory) + (rename-file i nname) + (funcall fn i nname))) + ;; Now move all from tmp-dir to destination. + (cl-loop with dirlist = (directory-files + tmp-dir t directory-files-no-dot-files-regexp) + for f in dirlist do + (if (file-symlink-p f) + (make-symbolic-link (file-truename f) + (concat (file-name-as-directory directory) + (helm-basename f))) + (rename-file f directory)))) + (delete-directory tmp-dir t)))) + +(defun helm-ff-serial-rename (_candidate) + "Serial rename all marked files to `helm-ff-default-directory'. +Rename only file of current directory, and symlink files coming from +other directories. +See `helm-ff-serial-rename-1'." + (helm-ff-serial-rename-action 'rename)) + +(defun helm-ff-serial-rename-by-symlink (_candidate) + "Serial rename all marked files to `helm-ff-default-directory'. +Rename only file of current directory, and symlink files coming from +other directories. +See `helm-ff-serial-rename-1'." + (helm-ff-serial-rename-action 'symlink)) + +(defun helm-ff-serial-rename-by-copying (_candidate) + "Serial rename all marked files to `helm-ff-default-directory'. +Rename only file of current directory, and copy files coming from +other directories. +See `helm-ff-serial-rename-1'." + (helm-ff-serial-rename-action 'copy)) + +(defun helm-ff-query-replace-on-marked-1 (candidates) + (with-helm-display-marked-candidates + helm-marked-buffer-name + (mapcar 'helm-basename candidates) + (let* ((regexp (read-string "Replace regexp on filename(s): ")) + (str (read-string (format "Replace regexp `%s' with: " regexp)))) + (cl-loop with query = "y" + with count = 0 + for old in candidates + for new = (concat (helm-basedir old) + (replace-regexp-in-string + regexp str + (helm-basename old))) + ;; If `regexp' is not matched in `old' + ;; `replace-regexp-in-string' will + ;; return `old' unmodified. + unless (string= old new) + do (progn + (unless (string= query "!") + (while (not (member + (setq query + (string + (read-key + (propertize + (format + "Replace `%s' by `%s' [!,y,n,q]" + old new) + 'face 'minibuffer-prompt)))) + '("y" "!" "n" "q"))) + (message "Please answer by y,n,! or q") (sit-for 1))) + (when (string= query "q") + (cl-return (message "Operation aborted"))) + (unless (string= query "n") + (rename-file old new) + (cl-incf count))) + finally (message "%d Files renamed" count)))) + ;; This fix the emacs bug where "Emacs-Lisp:" is sent + ;; in minibuffer (not the echo area). + (sit-for 0.1) + (with-current-buffer (window-buffer (minibuffer-window)) + (delete-minibuffer-contents))) + +;; The action. +(defun helm-ff-query-replace-on-marked (_candidate) + (let ((marked (helm-marked-candidates))) + (helm-run-after-quit #'helm-ff-query-replace-on-marked-1 marked))) + +;; The command for `helm-find-files-map'. +(defun helm-ff-run-query-replace-on-marked () + (interactive) + (helm-ff-query-replace-on-marked nil)) + +(defun helm-ff-toggle-auto-update (_candidate) + (setq helm-ff-auto-update-flag (not helm-ff-auto-update-flag)) + (setq helm-ff--auto-update-state helm-ff-auto-update-flag) + (message "[Auto expansion %s]" + (if helm-ff-auto-update-flag "enabled" "disabled"))) + +(defun helm-ff-run-toggle-auto-update () + (interactive) + (with-helm-alive-p + (helm-attrset 'toggle-auto-update '(helm-ff-toggle-auto-update . never-split)) + (helm-execute-persistent-action 'toggle-auto-update))) + +(defun helm-ff-delete-char-backward () + "Disable helm find files auto update and delete char backward." + (interactive) + (setq helm-ff-auto-update-flag nil) + (setq helm-ff--deleting-char-backward t) + (call-interactively + (lookup-key (current-global-map) + (read-kbd-macro "DEL")))) + +(defun helm-ff-delete-char-backward--exit-fn () + (setq helm-ff-auto-update-flag helm-ff--auto-update-state) + (setq helm-ff--deleting-char-backward nil)) + +(defun helm-ff-run-switch-to-history () + "Run Switch to history action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (when (helm-file-completion-source-p) + (helm-quit-and-execute-action 'helm-find-files-switch-to-hist)))) + +(defun helm-ff-run-grep () + "Run Grep action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-files-grep))) + +(defun helm-ff-run-pdfgrep () + "Run Pdfgrep action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-pdfgrep))) + +(defun helm-ff-run-zgrep () + "Run Grep action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-zgrep))) + +(defun helm-ff-run-copy-file () + "Run Copy file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-files-copy))) + +(defun helm-ff-run-rename-file () + "Run Rename file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-files-rename))) + +(defun helm-ff-run-byte-compile-file () + "Run Byte compile file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-files-byte-compile))) + +(defun helm-ff-run-load-file () + "Run Load file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-files-load-files))) + +(defun helm-ff-run-eshell-command-on-file () + "Run eshell command on file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action + 'helm-find-files-eshell-command-on-file))) + +(defun helm-ff-run-ediff-file () + "Run Ediff file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-files-ediff-files))) + +(defun helm-ff-run-ediff-merge-file () + "Run Ediff merge file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action + 'helm-find-files-ediff-merge-files))) + +(defun helm-ff-run-symlink-file () + "Run Symlink file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-files-symlink))) + +(defun helm-ff-run-hardlink-file () + "Run Hardlink file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-files-hardlink))) + +(defun helm-ff-run-delete-file () + "Run Delete file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-delete-marked-files))) + +(defun helm-ff-run-complete-fn-at-point () + "Run complete file name action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action + 'helm-insert-file-name-completion-at-point))) + +(defun helm-ff-run-switch-to-eshell () + "Run switch to eshell action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-switch-to-eshell))) + +(defun helm-ff-run-switch-other-window () + "Run switch to other window action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'find-file-other-window))) + +(defun helm-ff-run-switch-other-frame () + "Run switch to other frame action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'find-file-other-frame))) + +(defun helm-ff-run-open-file-externally () + "Run open file externally command action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-open-file-externally))) + +(defun helm-ff-run-open-file-with-default-tool () + "Run open file externally command action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-open-file-with-default-tool))) + +(defun helm-ff-locate (candidate) + "Locate action function for `helm-find-files'." + (helm-locate-set-command) + (let ((input (concat (helm-basename + (expand-file-name + candidate + helm-ff-default-directory)) + ;; The locate '-b' option doesn't exists + ;; in everything (es). + (unless (and (eq system-type 'windows-nt) + (string-match "^es" helm-locate-command)) + " -b")))) + (helm-locate-1 helm-current-prefix-arg nil 'from-ff input))) + +(defun helm-ff-run-locate () + "Run locate action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-locate))) + +(defun helm-files-insert-as-org-link (candidate) + (insert (format "[[%s][]]" candidate)) + (goto-char (- (point) 2))) + +(defun helm-ff-run-insert-org-link () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-files-insert-as-org-link))) + +(defun helm-ff-run-find-file-as-root () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-find-file-as-root))) + +(defun helm-ff-run-gnus-attach-files () + "Run gnus attach files command action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-gnus-attach-files))) + +(defun helm-ff-run-etags () + "Run Etags command action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-etags-select))) + +(defun helm-ff-print (_candidate) + "Print marked files. +You have to set in order +variables `lpr-command',`lpr-switches' and/or `printer-name'. + +e.g: +\(setq lpr-command \"gtklp\"\) +\(setq lpr-switches '(\"-P\")\) +\(setq printer-name \"Epson-Stylus-Photo-R265\"\) + +Same as `dired-do-print' but for helm." + (when (or helm-current-prefix-arg + (not helm-ff-printer-list)) + (setq helm-ff-printer-list + (helm-ff-find-printers))) + (let* ((file-list (helm-marked-candidates :with-wildcard t)) + (len (length file-list)) + (printer-name (if helm-ff-printer-list + (helm-comp-read + "Printer: " helm-ff-printer-list) + printer-name)) + (command (helm-read-string + (format "Print *%s File(s):\n%s with: " + len + (mapconcat + (lambda (f) (format "- %s\n" f)) + file-list "")) + (when (and lpr-command + (or lpr-switches + printer-name)) + (mapconcat 'identity + (cons lpr-command + (append (if (stringp lpr-switches) + (list lpr-switches) + lpr-switches) + (list printer-name))) + " ")))) + (file-args (mapconcat #'(lambda (x) + (format "'%s'" x)) + file-list " ")) + (cmd-line (concat command " " file-args))) + (if command + (start-process-shell-command "helm-print" nil cmd-line) + (error "Error: Please verify your printer settings in Emacs.")))) + +(defun helm-ff-run-print-file () + "Run Print file action from `helm-source-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-print))) + +(defun helm-ff-checksum (file) + "Calculate the checksum of FILE. +Provide completion on different algorithms to use on Emacs24. +On Emacs23 only 'sha1' is available. +The checksum is copied to kill-ring." + (let ((algo (and (fboundp 'secure-hash) + (intern + (helm-comp-read + "Algorithm: " + '(md5 sha1 sha224 + sha256 sha384 sha512)))))) + (kill-new + (if algo + (with-temp-buffer + (insert-file-contents-literally file) + (secure-hash algo (current-buffer))) + (with-temp-buffer + (insert-file-contents-literally file) + (sha1 (current-buffer))))) + (message "Checksum copied to kill-ring."))) + +(defun helm-ff-toggle-basename (candidate) + (setq helm-ff-transformer-show-only-basename + (not helm-ff-transformer-show-only-basename)) + (let ((target (if helm-ff-transformer-show-only-basename + (helm-basename candidate) candidate))) + (helm-force-update (regexp-quote target)))) + +(defun helm-ff-run-toggle-basename () + (interactive) + (with-helm-alive-p + (helm-attrset 'toggle-basename '(helm-ff-toggle-basename . never-split)) + (helm-execute-persistent-action 'toggle-basename))) + +(cl-defun helm-reduce-file-name (fname level &key unix-close expand) + "Reduce FNAME by LEVEL from end or beginning depending LEVEL value. +If LEVEL is positive reduce from end else from beginning. +If UNIX-CLOSE is non--nil close filename with /. +If EXPAND is non--nil expand-file-name." + (let* ((exp-fname (expand-file-name fname)) + (fname-list (split-string (if (or (string= fname "~/") expand) + exp-fname fname) "/" t)) + (len (length fname-list)) + (pop-list (if (< level 0) + (cl-subseq fname-list (* level -1)) + (cl-subseq fname-list 0 (- len level)))) + (result (mapconcat 'identity pop-list "/")) + (empty (string= result ""))) + (when unix-close (setq result (concat result "/"))) + (if (string-match "^~" result) + (if (string= result "~/") "~/" result) + (if (< level 0) + (if empty "../" (concat "../" result)) + (cond ((eq system-type 'windows-nt) + (if empty (expand-file-name "/") ; Expand to "/" or "c:/". + result)) + (empty "/") + (t + (concat "/" result))))))) + +;; Internal +(defvar helm-file-completion-sources + '("Find Files" "Read File Name" "Read File Name History") + "Sources that use the *find-files mechanism can be added here. +Sources generated by `helm-mode' don't need to be added here, it will +be done automatically. +You should not modify this yourself unless you know what you do.") + +(defun helm-file-completion-source-p () + "Return non--nil if current source is a file completion source." + (or (with-helm-buffer helm-in-file-completion-p) + (let ((cur-source (cdr (assoc 'name (helm-get-current-source))))) + (cl-loop for i in helm-file-completion-sources + thereis (string= cur-source i))))) + +(defun helm-find-files-up-one-level (arg) + "Go up one level like unix command `cd ..'. +If prefix numeric arg is given go ARG level up." + (interactive "p") + (with-helm-alive-p + (when (and (helm-file-completion-source-p) + (not (helm-ff-invalid-tramp-name-p))) + (with-helm-window + (when helm-follow-mode + (helm-follow-mode -1) (message nil))) + ;; When going up one level we want to be at the line + ;; corresponding to actual directory, so store this info + ;; in `helm-ff-last-expanded'. + (let ((cur-cand (helm-get-selection)) + (new-pattern (helm-reduce-file-name + helm-pattern arg :unix-close t :expand t))) + (cond ((file-directory-p helm-pattern) + (setq helm-ff-last-expanded helm-ff-default-directory)) + ((file-exists-p helm-pattern) + (setq helm-ff-last-expanded helm-pattern)) + ((and cur-cand (file-exists-p cur-cand)) + (setq helm-ff-last-expanded cur-cand))) + (helm-set-pattern new-pattern helm-suspend-update-flag) + (with-helm-after-update-hook (helm-ff-retrieve-last-expanded)))))) + +(defun helm-ff-retrieve-last-expanded () + "Move overlay to last visited directory `helm-ff-last-expanded'. +This happen after using `helm-find-files-up-one-level', +or hitting C-j on \"..\"." + (when helm-ff-last-expanded + (let ((presel (if helm-ff-transformer-show-only-basename + (helm-basename + (directory-file-name helm-ff-last-expanded)) + (directory-file-name helm-ff-last-expanded)))) + (with-helm-window + (when (re-search-forward (concat "^" (regexp-quote presel) "$") nil t) + (forward-line 0) + (helm-mark-current-line))) + (setq helm-ff-last-expanded nil)))) + +(defun helm-ff-move-to-first-real-candidate () + "When candidate is an incomplete file name move to first real candidate." + (helm-aif (and (helm-file-completion-source-p) + (helm-get-selection)) + (unless (or (and (string-match helm-tramp-file-name-regexp it) + (not (file-remote-p it nil t))) + (file-exists-p it)) + (helm-next-line)))) +(add-hook 'helm-after-update-hook 'helm-ff-move-to-first-real-candidate) + +;;; Auto-update - helm-find-files auto expansion of directories. +;; +;; +(defun helm-ff-update-when-only-one-matched () + "Expand to directory when sole completion. +When only one candidate is remaining and it is a directory, +expand to this directory. +This happen only when `helm-ff-auto-update-flag' is non--nil +or when `helm-pattern' is equal to \"~/\"." + (when (or (and helm-ff-auto-update-flag + (null helm-ff--deleting-char-backward) + (helm-file-completion-source-p) + ;; Issue #295 + ;; File predicates are returning t + ;; with paths like //home/foo. + ;; So check it is not the case by regexp + ;; to allow user to do C-a / to start e.g + ;; entering a tramp method e.g /sudo::. + (not (string-match "\\`//" helm-pattern)) + (not (helm-ff-invalid-tramp-name-p))) + ;; Fix issue #542. + (string= helm-pattern "~/")) + (let* ((history-p (string= (assoc-default + 'name (helm-get-current-source)) + "Read File Name History")) + (pat (if (string-match helm-tramp-file-name-regexp + helm-pattern) + (helm-create-tramp-name helm-pattern) + helm-pattern)) + (completed-p (string= (file-name-as-directory + (expand-file-name pat)) + helm-ff-default-directory)) + (candnum (helm-get-candidate-number))) + (when (and (or + ;; Only one candidate remaining + ;; and at least 2 char in basename. + (and (<= candnum 2) + (>= (string-width (helm-basename helm-pattern)) 2)) + ;; Already completed. + completed-p) + (not history-p)) ; Don't try to auto complete in history. + (with-helm-window + (let ((cur-cand (prog2 + (unless completed-p + ;; Only one non--existing candidate + ;; and one directory candidate, move to it. + (helm-next-line)) + (helm-get-selection)))) + (when (and (stringp cur-cand) + (file-accessible-directory-p cur-cand)) + (if (and (not (helm-dir-is-dot cur-cand)) ; [1] + ;; Maybe we are here because completed-p is true + ;; but check this again to be sure. (Windows fix) + (<= candnum 2)) ; [2] + ;; If after going to next line the candidate + ;; is not one of "." or ".." [1] + ;; and only one candidate is remaining [2], + ;; assume candidate is a new directory to expand, and do it. + (helm-set-pattern (file-name-as-directory cur-cand)) + ;; The candidate is one of "." or ".." + ;; that mean we have entered the last letter of the directory name + ;; in prompt, so expansion is already done, just add the "/" at end + ;; of name unless helm-pattern ends with "." + ;; (i.e we are writing something starting with ".") + (unless (string-match "\\`.*[.]\\{1\\}\\'" helm-pattern) + (helm-set-pattern + ;; Need to expand-file-name to avoid e.g /ssh:host:./ in prompt. + (expand-file-name (file-name-as-directory helm-pattern))))) + (helm-check-minibuffer-input)))))))) + +(defun helm-ff-auto-expand-to-home-or-root () + "Allow expanding to home/user directory or root or text yanked after pattern." + (when (and (helm-file-completion-source-p) + (string-match "/\\./\\|/\\.\\./\\|/~/\\|//\\|/[[:alpha:]]:/" + helm-pattern) + (with-current-buffer (window-buffer (minibuffer-window)) (eolp)) + (not (string-match helm-ff-url-regexp helm-pattern))) + (let* ((match (match-string 0 helm-pattern)) + (input (cond ((string= match "/./") default-directory) + ((string= helm-pattern "/../") "/") + (t (expand-file-name + (helm-substitute-in-filename helm-pattern) + ;; [Windows] On UNC paths "/" expand to current machine, + ;; so use the root of current Drive. (i.e "C:/") + (and (memq system-type '(windows-nt ms-dos)) + (getenv "SystemDrive")) ; nil on Unix. + ))))) + (if (file-directory-p input) + (setq helm-ff-default-directory + (setq input (file-name-as-directory input))) + (setq helm-ff-default-directory (file-name-as-directory + (file-name-directory input)))) + (with-helm-window + (helm-set-pattern input) + (helm-check-minibuffer-input))))) + +(defun helm-substitute-in-filename (fname) + "Substitute all parts of FNAME from start up to \"~/\" or \"/\". +On windows system substitute from start up to \"/[[:lower:]]:/\"." + (with-temp-buffer + (insert fname) + (goto-char (point-min)) + (skip-chars-forward "//") ;; Avoid infloop in UNC paths Issue #424 + (if (re-search-forward "~/\\|//\\|/[[:alpha:]]:/" nil t) + (let ((match (match-string 0))) + (goto-char (if (or (string= match "//") + (string-match-p "/[[:alpha:]]:/" match)) + (1+ (match-beginning 0)) + (match-beginning 0))) + (buffer-substring-no-properties (point) (point-at-eol))) + fname))) + +(add-hook 'helm-after-update-hook 'helm-ff-update-when-only-one-matched) +(add-hook 'helm-after-update-hook 'helm-ff-auto-expand-to-home-or-root) + +(defun helm-point-file-in-dired (file) + "Put point on filename FILE in dired buffer." + (dired (file-name-directory file)) + (dired-goto-file file)) + +(defun helm-create-tramp-name (fname) + "Build filename for `helm-pattern' like /su:: or /sudo::." + (apply #'tramp-make-tramp-file-name + (cl-loop with v = (tramp-dissect-file-name fname) + for i across v collect i))) + +(cl-defun helm-ff-tramp-hostnames (&optional (pattern helm-pattern)) + "Get a list of hosts for tramp method found in `helm-pattern'. +Argument PATTERN default to `helm-pattern', it is here only for debugging +purpose." + (when (string-match helm-tramp-file-name-regexp pattern) + (let ((method (match-string 1 pattern)) + (tn (match-string 0 pattern)) + (all-methods (mapcar 'car tramp-methods))) + (helm-fast-remove-dups + (cl-loop for (f . h) in (tramp-get-completion-function method) + append (cl-loop for e in (funcall f (car h)) + for host = (and (consp e) (cadr e)) + when (and host (not (member host all-methods))) + collect (concat tn host))) + :test 'equal)))) + +(defun helm-ff-before-action-hook-fn () + "Exit helm when user try to execute action on an invalid tramp fname." + (let ((cand (helm-get-selection))) + (when (and (helm-file-completion-source-p) + (helm-ff-invalid-tramp-name-p cand) ; Check candidate. + (helm-ff-invalid-tramp-name-p)) ; check helm-pattern. + (error "Error: Unknown file or directory `%s'" cand)))) +(add-hook 'helm-before-action-hook 'helm-ff-before-action-hook-fn) + +(cl-defun helm-ff-invalid-tramp-name-p (&optional (pattern helm-pattern)) + "Return non--nil when PATTERN is an invalid tramp filename." + (string= (helm-ff-set-pattern pattern) + "Invalid tramp file name")) + +(defun helm-ff-set-pattern (pattern) + "Handle tramp filenames in `helm-pattern'." + (let ((methods (mapcar 'car tramp-methods)) + (reg "\\`/\\([^[/:]+\\|[^/]+]\\):.*:") + cur-method tramp-name) + ;; In some rare cases tramp can return a nil input, + ;; so be sure pattern is a string for safety (Issue #476). + (unless pattern (setq pattern "")) + (cond ((string= pattern "") "") + ((string-match "\\`[.]\\{1,2\\}/\\'" pattern) + (expand-file-name pattern)) + ((string-match ".*\\(~?/?[.]\\{1\\}/\\)\\'" pattern) + (expand-file-name default-directory)) + ((and (string-match ".*\\(~//\\|//\\)\\'" pattern) + (not (string-match helm-ff-url-regexp helm-pattern))) + (expand-file-name "/")) ; Expand to "/" or "c:/" + ((string-match "\\`\\(~/\\|.*/~/\\)\\'" pattern) + (expand-file-name "~/")) + ;; Match "/method:maybe_hostname:" + ((and (string-match reg pattern) + (setq cur-method (match-string 1 pattern)) + (member cur-method methods)) + (setq tramp-name (helm-create-tramp-name + (match-string 0 pattern))) + (replace-match tramp-name nil t pattern)) + ;; Match "/hostname:" + ((and (string-match helm-tramp-file-name-regexp pattern) + (setq cur-method (match-string 1 pattern)) + (and cur-method (not (member cur-method methods)))) + (setq tramp-name (helm-create-tramp-name + (match-string 0 pattern))) + (replace-match tramp-name nil t pattern)) + ;; Match "/method:" in this case don't try to connect. + ((and (not (string-match reg pattern)) + (string-match helm-tramp-file-name-regexp pattern) + (member (match-string 1 pattern) methods)) + "Invalid tramp file name") ; Write in helm-buffer. + ;; PATTERN is a directory, end it with "/". + ;; This will make PATTERN not ending yet with "/" + ;; candidate for `helm-ff-default-directory', + ;; allowing `helm-ff-retrieve-last-expanded' to retrieve it + ;; when descending level. + ;; However, we don't add automatically the "/" when + ;; `helm-ff-auto-update-flag' is enabled to avoid quick expansion. + ((and (file-accessible-directory-p pattern) + helm-ff-auto-update-flag) + (file-name-as-directory (expand-file-name pattern))) + ;; Return PATTERN unchanged. + (t pattern)))) + +(defun helm-find-files-get-candidates (&optional require-match) + "Create candidate list for `helm-source-find-files'." + (let* ((path (helm-ff-set-pattern helm-pattern)) + (dir-p (file-accessible-directory-p path)) + basedir + invalid-basedir + non-essential + (tramp-verbose helm-tramp-verbose)) ; No tramp message when 0. + (set-text-properties 0 (length path) nil path) + ;; Issue #118 allow creation of newdir+newfile. + (unless (or + ;; A tramp file name not completed. + (string= path "Invalid tramp file name") + ;; An empty pattern + (string= path "") + ;; Check if base directory of PATH is valid. + (helm-aif (file-name-directory path) + ;; If PATH is a valid directory IT=PATH, + ;; else IT=basedir of PATH. + (file-directory-p it))) + ;; BASEDIR is invalid, that's mean user is starting + ;; to write a non--existing path in minibuffer + ;; probably to create a 'new_dir' or a 'new_dir+new_file'. + (setq invalid-basedir t)) + ;; Don't set now `helm-pattern' if `path' == "Invalid tramp file name" + ;; like that the actual value (e.g /ssh:) is passed to + ;; `helm-ff-tramp-hostnames'. + (unless (or (string= path "Invalid tramp file name") + invalid-basedir) ; Leave helm-pattern unchanged. + (setq helm-ff-auto-update-flag ; [1] + ;; Unless auto update is disabled at startup or + ;; interactively, start auto updating only at third char. + (unless (or (null helm-ff-auto-update-initial-value) + (null helm-ff--auto-update-state) + ;; But don't enable auto update when + ;; deleting backward. + helm-ff--deleting-char-backward) + (or (>= (length (helm-basename path)) 3) dir-p))) + (setq helm-pattern (helm-ff--transform-pattern-for-completion path)) + ;; This have to be set after [1] to allow deleting char backward. + (setq basedir (expand-file-name + (if (and dir-p helm-ff-auto-update-flag) + ;; Add the final "/" to path + ;; when `helm-ff-auto-update-flag' is enabled. + (file-name-as-directory path) + (file-name-directory path)))) + (setq helm-ff-default-directory + (if (string= helm-pattern "") + (expand-file-name "/") ; Expand to "/" or "c:/" + ;; If path is an url *default-directory have to be nil. + (unless (or (string-match helm-ff-url-regexp path) + (and ffap-url-regexp + (string-match ffap-url-regexp path))) + basedir)))) + (cond ((string= path "Invalid tramp file name") + (or (helm-ff-tramp-hostnames) ; Hostnames completion. + (prog2 + ;; `helm-pattern' have not been modified yet. + ;; Set it here to the value of `path' that should be now + ;; "Invalid tramp file name" and set the candidates list + ;; to ("Invalid tramp file name") to make `helm-pattern' + ;; match single candidate "Invalid tramp file name". + (setq helm-pattern path) + ;; "Invalid tramp file name" is now printed + ;; in `helm-buffer'. + (list path)))) + ((or (file-regular-p path) + ;; `ffap-url-regexp' don't match until url is complete. + (string-match helm-ff-url-regexp path) + invalid-basedir + (and (not (file-exists-p path)) (string-match "/$" path)) + (and ffap-url-regexp (string-match ffap-url-regexp path))) + (list path)) + ((string= path "") (helm-ff-directory-files "/" t)) + ((and (file-directory-p path) (not (file-readable-p path))) + (list (format "Opening directory: access denied, `%s'" path))) + ;; A fast expansion of PATH is made only if `helm-ff-auto-update-flag' + ;; is enabled. + ((and dir-p helm-ff-auto-update-flag) + (helm-ff-directory-files path t)) + (t (append (unless (or require-match + ;; When `helm-ff-auto-update-flag' has been + ;; disabled, whe don't want PATH to be added on top + ;; if it is a directory. + dir-p) + (list path)) + (helm-ff-directory-files basedir t)))))) + +(defsubst helm-ff-directory-files (directory &optional full) + "List contents of DIRECTORY. +Argument FULL mean absolute path. +It is same as `directory-files' but always returns the +dotted filename '.' and '..' even on root directories in Windows +systems." + (setq directory (file-name-as-directory + (expand-file-name directory))) + (let ((ls (directory-files + directory full directory-files-no-dot-files-regexp)) + (dot (concat directory ".")) + (dot2 (concat directory ".."))) + (append (list dot dot2) ls))) + +(defun helm-ff-handle-backslash (fname) + ;; Allow creation of filenames containing a backslash. + (cl-loop with bad = '((92 . "")) + for i across fname + for isbad = (assq i bad) + if isbad concat (cdr isbad) + else concat (string i))) + +(defun helm-ff-smart-completion-p () + (and helm-ff-smart-completion + (not (memq helm-mp-matching-method '(multi1 multi3p))))) + +(defun helm-ff--transform-pattern-for-completion (pattern) + "Maybe return PATTERN with it's basename modified as a regexp. +This happen only when `helm-ff-smart-completion' is enabled. +This provide a similar behavior as `ido-enable-flex-matching'. +See also `helm--mapconcat-candidate'. +If PATTERN is an url returns it unmodified. +When PATTERN contain a space fallback to match-plugin. +If basename contain one or more space fallback to match-plugin. +If PATTERN is a valid directory name,return PATTERN unchanged." + ;; handle bad filenames containing a backslash. + (setq pattern (helm-ff-handle-backslash pattern)) + (let ((bn (helm-basename pattern)) + (bd (or (helm-basedir pattern) "")) + (dir-p (file-directory-p pattern)) + (tramp-p (cl-loop for (m . f) in tramp-methods + thereis (string-match m pattern)))) + ;; Always regexp-quote base directory name to handle + ;; crap dirnames such e.g bookmark+ + (cond + ((or (and dir-p tramp-p (string-match ":\\'" pattern)) + (string= pattern "") + (and dir-p (<= (length bn) 2)) + ;; Fix Issue #541 when BD have a subdir similar + ;; to BN, don't switch to match plugin + ;; which will match both. + (and dir-p (string-match (regexp-quote bn) bd))) + ;; Use full PATTERN on e.g "/ssh:host:". + (regexp-quote pattern)) + ;; Prefixing BN with a space call match-plugin completion. + ;; This allow showing all files/dirs matching BN (Issue #518). + ;; FIXME: some match-plugin methods may not work here. + (dir-p (concat (regexp-quote bd) " " (regexp-quote bn))) + ((or (not (helm-ff-smart-completion-p)) + (string-match "\\s-" bn)) ; Fall back to match-plugin. + (concat (regexp-quote bd) bn)) + ((or (string-match "[*][.]?.*" bn) ; Allow entering wilcard. + (string-match "/$" pattern) ; Allow mkdir. + (string-match helm-ff-url-regexp pattern) + (and (string= helm-ff-default-directory "/") tramp-p)) + ;; Don't treat wildcards ("*") as regexp char. + ;; (e.g ./foo/*.el => ./foo/[*].el) + (concat (regexp-quote bd) + (replace-regexp-in-string "[*]" "[*]" bn))) + (t + (setq bn (if (>= (length bn) 2) ; wait 2nd char before concating. + (helm--mapconcat-candidate bn) + (concat ".*" (regexp-quote bn)))) + (concat (regexp-quote bd) bn))))) + +(defun helm-dir-is-dot (dir) + (string-match "\\(?:/\\|\\`\\)\\.\\{1,2\\}\\'" dir)) + +(defun helm-ff-save-history () + "Store the last value of `helm-ff-default-directory' in `helm-ff-history'. +Note that only existing directories are saved here." + (when (and helm-ff-default-directory + (helm-file-completion-source-p) + (file-directory-p helm-ff-default-directory)) + (set-text-properties 0 (length helm-ff-default-directory) + nil helm-ff-default-directory) + (push helm-ff-default-directory helm-ff-history))) +(add-hook 'helm-cleanup-hook 'helm-ff-save-history) + +(defun helm-files-save-file-name-history (&optional force) + "Save selected file to `file-name-history'." + (let ((helm-file-completion-sources + (append helm-files-save-history-extra-sources + helm-file-completion-sources))) + (when (or force (helm-file-completion-source-p)) + (let ((mkd (helm-marked-candidates)) + (history-delete-duplicates t)) + (cl-loop for sel in mkd + when (and sel + (file-exists-p sel) + (not (file-directory-p sel))) + do + ;; we use `abbreviate-file-name' here because + ;; other parts of Emacs seems to, + ;; and we don't want to introduce duplicates. + (add-to-history 'file-name-history + (abbreviate-file-name sel))))))) +(add-hook 'helm-exit-minibuffer-hook 'helm-files-save-file-name-history) + +(defun helm-ff-valid-symlink-p (file) + (file-exists-p (file-truename file))) + +(defun helm-get-default-mode-for-file (filename) + "Return the default mode to open FILENAME." + (let ((mode (cl-loop for (r . m) in auto-mode-alist + thereis (and (string-match r filename) m)))) + (or (and (symbolp mode) mode) "Fundamental"))) + +(defun helm-ff-properties (candidate) + "Show file properties of CANDIDATE in a tooltip or message." + (let* ((all (helm-file-attributes candidate)) + (dired-line (helm-file-attributes + candidate :dired t :human-size t)) + (type (cl-getf all :type)) + (mode-type (cl-getf all :mode-type)) + (owner (cl-getf all :uid)) + (owner-right (cl-getf all :user t)) + (group (cl-getf all :gid)) + (group-right (cl-getf all :group)) + (other-right (cl-getf all :other)) + (size (helm-file-human-size (cl-getf all :size))) + (modif (cl-getf all :modif-time)) + (access (cl-getf all :access-time)) + (ext (helm-get-default-program-for-file candidate)) + (tooltip-hide-delay (or helm-tooltip-hide-delay tooltip-hide-delay))) + (if (and (window-system) tooltip-mode) + (tooltip-show + (concat + (helm-basename candidate) "\n" + dired-line "\n" + (format "Mode: %s\n" (helm-get-default-mode-for-file candidate)) + (format "Ext prog: %s\n" (or (and ext (replace-regexp-in-string + " %s" "" ext)) + "Not defined")) + (format "Type: %s: %s\n" type mode-type) + (when (string= type "symlink") + (format "True name: '%s'\n" + (cond ((string-match "^\.#" (helm-basename candidate)) + "Autosave symlink") + ((helm-ff-valid-symlink-p candidate) + (file-truename candidate)) + (t "Invalid Symlink")))) + (format "Owner: %s: %s\n" owner owner-right) + (format "Group: %s: %s\n" group group-right) + (format "Others: %s\n" other-right) + (format "Size: %s\n" size) + (format "Modified: %s\n" modif) + (format "Accessed: %s\n" access))) + (message dired-line) (sit-for 5)))) + +(defun helm-ff-properties-persistent () + "Show properties without quitting helm." + (interactive) + (with-helm-alive-p + (helm-attrset 'properties-action '(helm-ff-properties . never-split)) + (helm-execute-persistent-action 'properties-action))) + +(defun helm-ff-persistent-delete () + "Delete current candidate without quitting." + (interactive) + (with-helm-alive-p + (helm-attrset 'quick-delete '(helm-ff-quick-delete . never-split)) + (helm-execute-persistent-action 'quick-delete))) + +(defun helm-ff-dot-file-p (file) + "Check if FILE is `.' or `..'." + (member (helm-basename file) '("." ".."))) + +(defun helm-ff-quick-delete (_candidate) + "Delete file CANDIDATE without quitting." + (let ((marked (helm-marked-candidates))) + (unwind-protect + (save-selected-window + (cl-loop for c in marked do + (progn (helm-preselect (if (and helm-ff-transformer-show-only-basename + (not (helm-ff-dot-file-p c))) + (helm-basename c) c)) + (when (y-or-n-p (format "Really Delete file `%s'? " c)) + (helm-delete-file c helm-ff-signal-error-on-dot-files + 'synchro) + (helm-delete-current-selection) + (message nil))))) + (with-helm-buffer + (setq helm-marked-candidates nil + helm-visible-mark-overlays nil)) + (helm-force-update)))) + +(defun helm-ff-kill-buffer-fname (candidate) + (let ((buf (get-file-buffer candidate))) + (if buf + (progn + (kill-buffer buf) (message "Buffer `%s' killed" buf)) + (message "No buffer to kill")))) + +(defun helm-ff-kill-or-find-buffer-fname (candidate) + "Find file CANDIDATE or kill it's buffer if it is visible. +Never kill `helm-current-buffer'. +Never kill buffer modified. +This is called normally on third hit of \ +\\\\[helm-execute-persistent-action] +in `helm-find-files-persistent-action'." + (let* ((buf (get-file-buffer candidate)) + (buf-name (buffer-name buf)) + (win (get-buffer-window buf)) + (helm--reading-passwd-or-string t)) + (if (and buf win + (not (eq buf (get-buffer helm-current-buffer))) + (not (buffer-modified-p buf))) + (progn + (kill-buffer buf) + (set-window-buffer win helm-current-buffer) + (message "Buffer `%s' killed" buf-name)) + (find-file candidate)))) + +(defun helm-ff-run-kill-buffer-persistent () + "Execute `helm-ff-kill-buffer-fname' whitout quitting." + (interactive) + (with-helm-alive-p + (helm-attrset 'kill-buffer-fname 'helm-ff-kill-buffer-fname) + (helm-execute-persistent-action 'kill-buffer-fname))) + +(defun helm-ff-prefix-filename (fname &optional file-or-symlinkp new-file) + "Return filename FNAME maybe prefixed with [?] or [@]. +If FILE-OR-SYMLINKP is non--nil this mean we assume FNAME is an +existing filename or valid symlink and there is no need to test it. +NEW-FILE when non--nil mean FNAME is a non existing file and +return FNAME prefixed with [?]." + (let* ((prefix-new (propertize + " " 'display + (propertize "[?]" 'face 'helm-ff-prefix))) + (prefix-url (propertize + " " 'display + (propertize "[@]" 'face 'helm-ff-prefix)))) + (cond ((or file-or-symlinkp (file-exists-p fname)) fname) + ((or (string-match helm-ff-url-regexp fname) + (and ffap-url-regexp (string-match ffap-url-regexp fname))) + (concat prefix-url " " fname)) + ((or new-file (not (file-exists-p fname))) + (concat prefix-new " " fname))))) + +(defun helm-ff-sort-candidates (candidates _source) + "Sort function for `helm-source-find-files'. +Return candidates prefixed with basename of `helm-input' first." + (if (or (file-directory-p helm-input) + (null candidates)) + candidates + (let* ((c1 (car candidates)) + (cand1real (if (consp c1) (cdr c1) c1)) + (cand1 (unless (file-exists-p cand1real) + c1)) + (rest-cand (if cand1 (cdr candidates) candidates)) + (all (sort rest-cand + #'(lambda (s1 s2) + (let* ((score (lambda (str) + (if (condition-case _err + (string-match + (concat + "\\_<" + (helm-basename + helm-input)) str) + (invalid-regexp nil)) + 1 0))) + (bn1 (helm-basename (if (consp s1) (cdr s1) s1))) + (bn2 (helm-basename (if (consp s2) (cdr s2) s2))) + (sc1 (funcall score bn1)) + (sc2 (funcall score bn2))) + (cond ((= sc1 sc2) + (< (string-width bn1) + (string-width bn2))) + ((> sc1 sc2)) + (t (string-lessp bn1 bn2)))))))) + (if cand1 (cons cand1 all) all)))) + +(defun helm-ff-filter-candidate-one-by-one (file) + "`filter-one-by-one' Transformer function for `helm-source-find-files'." + ;; Handle boring files + (unless (and helm-ff-skip-boring-files + (cl-loop for r in helm-boring-file-regexp-list + thereis (string-match r file))) + ;; Handle tramp files. + (if (and (string-match helm-tramp-file-name-regexp helm-pattern) + helm-ff-tramp-not-fancy) + (if helm-ff-transformer-show-only-basename + (if (helm-dir-is-dot file) + file + (cons (or (helm-ff-get-host-from-tramp-invalid-fname file) + (helm-basename file)) + file)) + file) + ;; Now highlight. + (let* ((disp (if (and helm-ff-transformer-show-only-basename + (not (helm-dir-is-dot file)) + (not (and ffap-url-regexp + (string-match ffap-url-regexp file))) + (not (string-match helm-ff-url-regexp file))) + (or (helm-ff-get-host-from-tramp-invalid-fname file) + (helm-basename file)) file)) + (attr (file-attributes file)) + (type (car attr))) + + (cond ((string-match "access denied" file) file) + ( ;; A not already saved file. + (and (stringp type) + (not (helm-ff-valid-symlink-p file)) + (not (string-match "^\.#" (helm-basename file)))) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-invalid-symlink) t) + file)) + ;; A symlink. + ((stringp type) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-symlink) t) + file)) + ;; A directory. + ((eq t type) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-directory) t) + file)) + ;; An executable file. + ((and attr (string-match "x" (nth 8 attr))) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-executable) t) + file)) + ;; A file. + ((and attr (null type)) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-file) t) + file)) + ;; A non--existing file. + (t + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-file) nil 'new-file) + file))))))) + +(defun helm-find-files-action-transformer (actions candidate) + "Action transformer for `helm-source-find-files'." + (cond ((with-helm-current-buffer + (eq major-mode 'message-mode)) + (append actions + '(("Gnus attach file(s)" . helm-ff-gnus-attach-files)))) + ((string-match (image-file-name-regexp) candidate) + (append actions + '(("Rotate image right `M-r'" . helm-ff-rotate-image-right) + ("Rotate image left `M-l'" . helm-ff-rotate-image-left)))) + ((string-match "\.el$" (helm-aif (helm-marked-candidates) + (car it) candidate)) + (append actions + '(("Byte compile lisp file(s) `M-B, C-u to load'" + . helm-find-files-byte-compile) + ("Load File(s) `M-L'" . helm-find-files-load-files)))) + ((and (string-match "\.html?$" candidate) + (file-exists-p candidate)) + (append actions + '(("Browse url file" . browse-url-of-file)))) + ((or (string= (file-name-extension candidate) "pdf") + (string= (file-name-extension candidate) "PDF")) + (append actions + '(("Pdfgrep File(s)" . helm-ff-pdfgrep)))) + (t actions))) + +(defun helm-ff-gnus-attach-files (_candidate) + "Run `gnus-dired-attach' on `helm-marked-candidates' or CANDIDATE." + (let ((flist (helm-marked-candidates :with-wildcard t))) + (gnus-dired-attach flist))) + +(defvar image-dired-display-image-buffer) +(defun helm-ff-rotate-current-image-1 (file &optional num-arg) + "Rotate current image at NUM-ARG degrees. +This is a destructive operation on FILE made by external tool mogrify." + (setq file (file-truename file)) ; For symlinked images. + ;; When FILE is not an image-file, do nothing. + (when (string-match (image-file-name-regexp) file) + (if (executable-find "mogrify") + (progn + (shell-command (format "mogrify -rotate %s %s" + (or num-arg 90) + (shell-quote-argument file))) + (when (buffer-live-p image-dired-display-image-buffer) + (kill-buffer image-dired-display-image-buffer)) + (image-dired-display-image file) + (message nil) + (display-buffer (get-buffer image-dired-display-image-buffer))) + (error "mogrify not found")))) + +(defun helm-ff-rotate-image-left (candidate) + "Rotate image file CANDIDATE left. +This affect directly file CANDIDATE." + (helm-ff-rotate-current-image-1 candidate -90)) + +(defun helm-ff-rotate-image-right (candidate) + "Rotate image file CANDIDATE right. +This affect directly file CANDIDATE." + (helm-ff-rotate-current-image-1 candidate)) + +(defun helm-ff-rotate-left-persistent () + "Rotate image left without quitting helm." + (interactive) + (with-helm-alive-p + (helm-attrset 'image-action1 'helm-ff-rotate-image-left) + (helm-execute-persistent-action 'image-action1))) + +(defun helm-ff-rotate-right-persistent () + "Rotate image right without quitting helm." + (interactive) + (with-helm-alive-p + (helm-attrset 'image-action2 'helm-ff-rotate-image-right) + (helm-execute-persistent-action 'image-action2))) + +(defun helm-ff-exif-data (candidate) + "Extract exif data from file CANDIDATE using `helm-ff-exif-data-program'." + (if (and helm-ff-exif-data-program + (executable-find helm-ff-exif-data-program)) + (shell-command-to-string (format "%s %s %s" + helm-ff-exif-data-program + helm-ff-exif-data-program-args + candidate)) + (format "No program %s found to extract exif" + helm-ff-exif-data-program))) + +(defun helm-find-files-persistent-action (candidate) + "Open subtree CANDIDATE without quitting helm. +If CANDIDATE is not a directory expand CANDIDATE filename. +If CANDIDATE is alone, open file CANDIDATE filename. +That's mean: +First hit on C-j expand CANDIDATE second hit open file. +If a prefix arg is given or `helm-follow-mode' is on open file." + (let* ((follow (or (buffer-local-value + 'helm-follow-mode + (get-buffer-create helm-buffer)) + helm--temp-follow-flag)) + (new-pattern (helm-get-selection)) + (num-lines-buf (with-current-buffer helm-buffer + (count-lines (point-min) (point-max)))) + (insert-in-minibuffer #'(lambda (fname) + (with-selected-window (minibuffer-window) + (unless follow + (delete-minibuffer-contents) + (set-text-properties 0 (length fname) + nil fname) + (insert fname)))))) + (cond ((and (helm-ff-invalid-tramp-name-p) + (string-match helm-tramp-file-name-regexp candidate)) + ;; First hit insert hostname and + ;; second hit insert ":" and expand. + (if (string= candidate helm-pattern) + (funcall insert-in-minibuffer (concat candidate ":")) + (funcall insert-in-minibuffer candidate))) + ( ;; A symlink directory, expand it's truename. + (and (file-directory-p candidate) (file-symlink-p candidate)) + (funcall insert-in-minibuffer (file-name-as-directory + (file-truename + (expand-file-name candidate))))) + ;; A directory, open it. + ((file-directory-p candidate) + (when (string= (helm-basename candidate) "..") + (setq helm-ff-last-expanded helm-ff-default-directory)) + (funcall insert-in-minibuffer (file-name-as-directory + (expand-file-name candidate)))) + ;; A symlink file, expand to it's true name. (cl-first hit) + ((and (file-symlink-p candidate) (not current-prefix-arg) (not follow)) + (funcall insert-in-minibuffer (file-truename candidate))) + ;; A regular file, expand it, (cl-first hit) + ((and (>= num-lines-buf 3) (not current-prefix-arg) (not follow)) + (funcall insert-in-minibuffer new-pattern)) + ;; An image file and it is the second hit on C-j, + ;; show the file in `image-dired'. + ((string-match (image-file-name-regexp) candidate) + (when (buffer-live-p (get-buffer image-dired-display-image-buffer)) + (kill-buffer image-dired-display-image-buffer)) + (image-dired-display-image candidate) + (message nil) + (helm-switch-to-buffer image-dired-display-image-buffer) + (with-current-buffer image-dired-display-image-buffer + (let ((exif-data (helm-ff-exif-data candidate))) + (setq default-directory helm-ff-default-directory) + (image-dired-update-property 'help-echo exif-data)))) + ;; Allow browsing archive on avfs fs. + ;; Assume volume is already mounted with mountavfs. + ((and helm-ff-avfs-directory + (string-match + (regexp-quote (expand-file-name helm-ff-avfs-directory)) + (file-name-directory candidate)) + (helm-ff-file-compressed-p candidate)) + (funcall insert-in-minibuffer (concat candidate "#"))) + ;; On second hit we open file. + ;; On Third hit we kill it's buffer maybe. + (t + (helm-ff-kill-or-find-buffer-fname candidate))))) + +(defun helm-ff-file-compressed-p (candidate) + "Whether CANDIDATE is a compressed file or not." + (member (file-name-extension candidate) + helm-ff-file-compressed-list)) + +(defun helm-insert-file-name-completion-at-point (candidate) + "Insert file name completion at point." + (with-helm-current-buffer + (if buffer-read-only + (error "Error: Buffer `%s' is read-only" (buffer-name)) + (let* ((end (point)) + (tap (thing-at-point 'filename)) + (guess (and (stringp tap) (substring-no-properties tap))) + (beg (- (point) (length guess))) + (full-path-p (and (stringp guess) + (or (string-match-p (concat "^" (getenv "HOME")) guess) + (string-match-p "^[^\~]" guess))))) + (set-text-properties 0 (length candidate) nil candidate) + (if (and guess (not (string= guess "")) + (string-match-p "^\\(~/\\|/\\|[[:lower:][:upper:]]:/\\)" guess)) + (progn + (delete-region beg end) + (insert (if full-path-p + (expand-file-name candidate) + (abbreviate-file-name candidate)))) + (insert candidate)))))) + +(cl-defun helm-find-files-history (&key (comp-read t)) + "The `helm-find-files' history. +Show the first `helm-ff-history-max-length' elements of +`helm-ff-history' in an `helm-comp-read'." + (let ((history (when helm-ff-history + (helm-fast-remove-dups helm-ff-history + :test 'equal)))) + (when history + (setq helm-ff-history + (if (>= (length history) helm-ff-history-max-length) + (cl-subseq history 0 helm-ff-history-max-length) + history)) + (if comp-read + (helm-comp-read + "Switch to Directory: " + helm-ff-history + :name "Helm Find Files History" + :must-match t) + helm-ff-history)))) + +(defun helm-find-files-1 (fname &optional preselect) + "Find FNAME with `helm' completion. +Like `find-file' but with `helm' support. +Use it for non--interactive calls of `helm-find-files'." + (when (get-buffer helm-action-buffer) + (kill-buffer helm-action-buffer)) + (let* ( ;; Be sure we don't erase the precedent minibuffer if some. + (helm-ff-auto-update-initial-value + (and helm-ff-auto-update-initial-value + (not (minibuffer-window-active-p (minibuffer-window))))) + (tap (thing-at-point 'filename)) + (def (and tap (expand-file-name tap)))) + (helm :sources 'helm-source-find-files + :input fname + :case-fold-search helm-file-name-case-fold-search + :keymap helm-find-files-map + :preselect preselect + :default def + :prompt "Find Files or Url: " + :buffer "*Helm Find Files*"))) + + +(defun helm-find-files-initial-input (&optional input) + "Return INPUT if present, otherwise try to guess it." + (unless (eq major-mode 'image-mode) + (or (and input (or (and (file-remote-p input) input) + (expand-file-name input))) + (helm-find-files-input + (ffap-guesser) + (thing-at-point 'filename))))) + +(defun helm-find-files-input (file-at-pt thing-at-pt) + "Try to guess a default input for `helm-find-files'." + (let* ((def-dir (helm-current-directory)) + (urlp (and file-at-pt ffap-url-regexp + (string-match ffap-url-regexp file-at-pt))) + (abs (and file-at-pt + (not urlp) + (expand-file-name file-at-pt def-dir))) + (lib (when helm-ff-search-library-in-sexp + (helm-find-library-at-point))) + (hlink (helm-ff-find-url-at-point)) + (remp (and abs (file-remote-p abs))) + (file-p (and (not remp) + file-at-pt + (not (string= file-at-pt "")) + (file-exists-p file-at-pt) + thing-at-pt (not (string= thing-at-pt "")) + (file-exists-p + (file-name-directory + (expand-file-name thing-at-pt def-dir)))))) + (cond (lib) ; e.g we are inside a require sexp. + (hlink) ; String at point is an hyperlink. + (remp abs) ; A remote file + (file-p ; a regular file + (helm-aif (ffap-file-at-point) (expand-file-name it))) + (urlp file-at-pt) ; possibly an url or email. + ((and file-at-pt (file-exists-p file-at-pt)) + file-at-pt)))) + +(defun helm-ff-find-url-at-point () + "Try to find link to an url in text-property at point." + (let* ((he (get-text-property (point) 'help-echo)) + (ov (overlays-at (point))) + (ov-he (and ov (overlay-get + (car (overlays-at (point))) 'help-echo))) + (w3m-l (get-text-property (point) 'w3m-href-anchor)) + (nt-prop (get-text-property (point) 'nt-link))) + ;; Org link. + (when (and (stringp he) (string-match "^LINK: " he)) + (setq he (replace-match "" t t he))) + (cl-loop for i in (list he ov-he w3m-l nt-prop) + thereis (and (stringp i) ffap-url-regexp (string-match ffap-url-regexp i) i)))) + +(defun helm-find-library-at-point () + "Try to find library path at point. +Find inside `require' and `declare-function' sexp." + (require 'find-func) + (let* ((beg-sexp (save-excursion (search-backward "(" (point-at-bol) t))) + (end-sexp (save-excursion (search-forward ")" (point-at-eol) t))) + (sexp (and beg-sexp end-sexp + (buffer-substring-no-properties + (1+ beg-sexp) (1- end-sexp))))) + (ignore-errors + (cond ((and sexp (string-match "require \'.+[^)]" sexp)) + (find-library-name + (replace-regexp-in-string + "'\\|\)\\|\(" "" + ;; If require use third arg, ignore it, + ;; always use library path found in `load-path'. + (cl-second (split-string (match-string 0 sexp)))))) + ((and sexp (string-match-p "^declare-function" sexp)) + (find-library-name + (replace-regexp-in-string + "\"\\|ext:" "" + (cl-third (split-string sexp))))) + (t nil))))) + + +;;; Handle copy, rename, symlink, relsymlink and hardlink from helm. +;; +;; +(defvar dired-async-be-async) +(cl-defun helm-dired-action (candidate + &key action follow (files (dired-get-marked-files))) + "Execute ACTION on FILES to CANDIDATE. +Where ACTION is a symbol that can be one of: +'copy, 'rename, 'symlink,'relsymlink, 'hardlink. +Argument FOLLOW when non--nil specify to follow FILES to destination." + (when (get-buffer dired-log-buffer) (kill-buffer dired-log-buffer)) + (let ((fn (cl-case action + (copy 'dired-copy-file) + (rename 'dired-rename-file) + (symlink 'make-symbolic-link) + (relsymlink 'dired-make-relative-symlink) + (hardlink 'dired-hardlink))) + (marker (cl-case action + ((copy rename) dired-keep-marker-copy) + (symlink dired-keep-marker-symlink) + (relsymlink dired-keep-marker-relsymlink) + (hardlink dired-keep-marker-hardlink))) + (dirflag (and (= (length files) 1) + (file-directory-p (car files)) + (not (file-directory-p candidate)))) + ;; When FOLLOW is enabled, disable helm-async. + ;; If it is globally disabled use this nil value. + (dired-async-be-async (and (boundp 'dired-async-be-async) + dired-async-be-async + (not follow)))) + (dired-create-files + fn (symbol-name action) files + ;; CANDIDATE is the destination. + (if (file-directory-p candidate) + ;; When CANDIDATE is a directory, build file-name in this directory. + ;; Else we use CANDIDATE. + #'(lambda (from) + (expand-file-name (file-name-nondirectory from) candidate)) + #'(lambda (_from) candidate)) + marker) + (push (file-name-as-directory + (if (file-directory-p candidate) + (expand-file-name candidate) + (file-name-directory candidate))) + helm-ff-history) + ;; If follow is non--nil we should not be in async mode. + (when (and follow (not (get-buffer dired-log-buffer))) + (let ((target (directory-file-name candidate))) + (unwind-protect + (progn + (setq helm-ff-cand-to-mark + (helm-get-dest-fnames-from-list files candidate dirflag)) + (with-helm-after-update-hook (helm-ff-maybe-mark-candidates)) + (if (and dirflag (eq action 'rename)) + (helm-find-files-1 (file-name-directory target) + (if helm-ff-transformer-show-only-basename + (helm-basename target) target)) + (helm-find-files-1 (file-name-as-directory + (expand-file-name candidate))))) + (setq helm-ff-cand-to-mark nil)))))) + +(defun helm-get-dest-fnames-from-list (flist dest-cand rename-dir-flag) + "Transform filenames of FLIST to abs of DEST-CAND. +If RENAME-DIR-FLAG is non--nil collect the `directory-file-name' of transformed +members of FLIST." + ;; At this point files have been renamed/copied at destination. + ;; That's mean DEST-CAND exists. + (cl-loop + with dest = (expand-file-name dest-cand) + for src in flist + for basename-src = (helm-basename src) + for fname = (cond (rename-dir-flag (directory-file-name dest)) + ((file-directory-p dest) + (concat (file-name-as-directory dest) basename-src)) + (t dest)) + when (file-exists-p fname) + collect fname into tmp-list + finally return (sort tmp-list 'string<))) + +(defun helm-ff-maybe-mark-candidates () + "Mark all candidates of list `helm-ff-cand-to-mark'. +This is used when copying/renaming/symlinking etc... and +following files to destination." + (when (and (string= (assoc-default 'name (helm-get-current-source)) + (assoc-default 'name helm-source-find-files)) + helm-ff-cand-to-mark) + (with-helm-window + (while helm-ff-cand-to-mark + (if (string= (car helm-ff-cand-to-mark) (helm-get-selection)) + (progn + (helm-make-visible-mark) + (helm-next-line) + (setq helm-ff-cand-to-mark (cdr helm-ff-cand-to-mark))) + (helm-next-line))) + (unless (helm-this-visible-mark) + (helm-prev-visible-mark))))) + + +;;; Routines for files +;; +;; +(defun helm-file-buffers (filename) + "Returns a list of buffer names corresponding to FILENAME." + (cl-loop with name = (expand-file-name filename) + for buf in (buffer-list) + for bfn = (buffer-file-name buf) + when (and bfn (string= name bfn)) + collect (buffer-name buf))) + +(defun helm-delete-file (file &optional error-if-dot-file-p synchro) + "Delete the given file after querying the user. +Ask to kill buffers associated with that file, too." + (when (and error-if-dot-file-p + (helm-ff-dot-file-p file)) + (error "Error: Cannot operate on `.' or `..'")) + (let ((buffers (helm-file-buffers file))) + (if (or (< emacs-major-version 24) synchro) + ;; `dired-delete-file' in Emacs versions < 24 + ;; doesn't support delete-by-moving-to-trash + ;; so use `delete-directory' and `delete-file' + ;; that handle it. + (cond ((and (not (file-symlink-p file)) + (file-directory-p file) + (directory-files file t dired-re-no-dot)) + (when (y-or-n-p (format "Recursive delete of `%s'? " file)) + (delete-directory file 'recursive))) + ((and (not (file-symlink-p file)) + (file-directory-p file)) + (delete-directory file)) + (t (delete-file file))) + (dired-delete-file + file dired-recursive-deletes delete-by-moving-to-trash)) + (when buffers + (cl-dolist (buf buffers) + (when (y-or-n-p (format "Kill buffer %s, too? " buf)) + (kill-buffer buf)))))) + +(defun helm-delete-marked-files (_ignore) + (let* ((files (helm-marked-candidates :with-wildcard t)) + (len (length files))) + (with-helm-display-marked-candidates + helm-marked-buffer-name + (mapcar #'(lambda (f) + (if (file-directory-p f) + (concat (helm-basename f) "/") + (helm-basename f))) + files) + (if (not (y-or-n-p (format "Delete *%s File(s)" len))) + (message "(No deletions performed)") + (cl-dolist (i files) + (set-text-properties 0 (length i) nil i) + (helm-delete-file i helm-ff-signal-error-on-dot-files)) + (message "%s File(s) deleted" len))))) + +(defun helm-find-file-or-marked (candidate) + "Open file CANDIDATE or open helm marked files in background." + (let ((marked (helm-marked-candidates :with-wildcard t)) + (url-p (and ffap-url-regexp ; we should have only one candidate. + (string-match ffap-url-regexp candidate))) + (ffap-newfile-prompt helm-ff-newfile-prompt-p) + (find-file-wildcards nil) + (make-dir-fn + #'(lambda (dir &optional helm-ff) + (when (y-or-n-p (format "Create directory `%s'? " dir)) + (let ((dirfname (directory-file-name dir))) + (if (file-exists-p dirfname) + (error + "Mkdir: Unable to create directory `%s': file exists." + (helm-basename dirfname)) + (make-directory dir 'parent))) + (when helm-ff + ;; Allow having this new dir in history + ;; to be able to retrieve it immediately + ;; if we want to e.g copy a file from somewhere in it. + (setq helm-ff-default-directory + (file-name-as-directory dir)) + (push helm-ff-default-directory helm-ff-history)) + (or (and helm-ff (helm-find-files-1 dir)) t)))) + (helm--reading-passwd-or-string t)) + (if (> (length marked) 1) + ;; Open all marked files in background and display + ;; the first one. + (progn + (mapc 'find-file-noselect (cdr marked)) + (find-file (car marked))) + (if (and (not (file-exists-p candidate)) + (not url-p) + (string-match "/$" candidate)) + ;; A a non--existing filename ending with / + ;; Create a directory and jump to it. + (funcall make-dir-fn candidate 'helm-ff) + ;; A non--existing filename NOT ending with / or + ;; an existing filename, create or jump to it. + ;; If the basedir of candidate doesn't exists, + ;; ask for creating it. + (let ((dir (file-name-directory candidate))) + (if (or (and dir (file-directory-p dir)) url-p) + (find-file-at-point (car marked)) + (and (funcall make-dir-fn dir) + (find-file-at-point candidate)))))))) + +(defun helm-shadow-boring-files (files) + "Files matching `helm-boring-file-regexp' will be +displayed with the `file-name-shadow' face if available." + (helm-shadow-entries files helm-boring-file-regexp-list)) + +(defun helm-skip-boring-files (files) + "Files matching `helm-boring-file-regexp' will be skipped." + (helm-skip-entries files helm-boring-file-regexp-list)) + +(defun helm-skip-current-file (files) + "Current file will be skipped." + (remove (buffer-file-name helm-current-buffer) files)) + +(defun helm-w32-pathname-transformer (args) + "Change undesirable features of windows pathnames to ones more acceptable to +other candidate transformers." + (if (eq system-type 'windows-nt) + (helm-transform-mapcar + (lambda (x) + (replace-regexp-in-string + "/cygdrive/\\(.\\)" "\\1:" + (replace-regexp-in-string "\\\\" "/" x))) + args) + args)) + +(defun helm-transform-file-load-el (actions candidate) + "Add action to load the file CANDIDATE if it is an emacs lisp +file. Else return ACTIONS unmodified." + (if (member (file-name-extension candidate) '("el" "elc")) + (append actions '(("Load Emacs Lisp File" . load-file))) + actions)) + +(defun helm-transform-file-browse-url (actions candidate) + "Add an action to browse the file CANDIDATE if it is a html file or URL. +Else return ACTIONS unmodified." + (let ((browse-action '("Browse with Browser" . browse-url))) + (cond ((string-match "^http\\|^ftp" candidate) + (cons browse-action actions)) + ((string-match "\\.html?$" candidate) + (append actions (list browse-action))) + (t actions)))) + + +;;; List of files gleaned from every dired buffer +;; +;; +(defun helm-files-in-all-dired-candidates () + (save-excursion + (cl-loop for (f . b) in dired-buffers + when (buffer-live-p b) + append (let ((dir (with-current-buffer b dired-directory))) + (if (listp dir) (cdr dir) + (directory-files f t dired-re-no-dot)))))) + +;; (dired '("~/" "~/.emacs.d/.emacs-custom.el" "~/.emacs.d/.emacs.bmk")) + +(defvar helm-source-files-in-all-dired + '((name . "Files in all dired buffer.") + (candidates . helm-files-in-all-dired-candidates) + (type . file))) + + +;;; File Cache +;; +;; +(defvar helm-file-cache-initialized-p nil) +(defvar helm-file-cache-files nil) + +(defvar helm-source-file-cache + `((name . "File Cache") + (init + . (lambda () + (require 'filecache nil t) + (unless helm-file-cache-initialized-p + (setq helm-file-cache-files + (cl-loop for item in file-cache-alist append + (cl-destructuring-bind (base &rest dirs) item + (cl-loop for dir in dirs collect + (concat dir base))))) + (defadvice file-cache-add-file (after file-cache-list activate) + (add-to-list 'helm-file-cache-files (expand-file-name file))) + (setq helm-file-cache-initialized-p t)))) + (keymap . ,helm-generic-files-map) + (help-message . helm-generic-file-help-message) + (mode-line . helm-generic-file-mode-line-string) + (candidates . helm-file-cache-files) + (type . file))) + + +;;; File name history +;; +;; +(defvar helm-source-file-name-history + `((name . "File Name History") + (candidates . file-name-history) + (persistent-action . ignore) + (filtered-candidate-transformer . helm-file-name-history-transformer) + (action . ,(cdr (helm-get-actions-from-type + helm-source-locate))))) + +(defvar helm-source--ff-file-name-history + '((name . "File name history") + (init . (lambda () + (with-helm-alive-p + (when helm-ff-file-name-history-use-recentf + (require 'recentf) + (or recentf-mode (recentf-mode 1)))))) + (candidates . (lambda () + (if helm-ff-file-name-history-use-recentf + recentf-list + file-name-history))) + (persistent-action . ignore) + (filtered-candidate-transformer . helm-file-name-history-transformer) + (action . (("Find file" + . (lambda (candidate) + (helm-set-pattern + (expand-file-name candidate)) + (with-helm-after-update-hook (helm-exit-minibuffer)))) + ("Find file in helm" + . (lambda (candidate) + (helm-set-pattern + (expand-file-name candidate))))))) + "[Internal] This source is build to be used with `helm-find-files'. +Don't use it in your own code unless you know what you are doing.") + +(defun helm-file-name-history-transformer (candidates _source) + (cl-loop for c in candidates collect + (cond ((file-remote-p c) + (cons (propertize c 'face 'helm-history-remote) c)) + ((file-exists-p c) + (cons (propertize c 'face 'helm-ff-file) c)) + (t (cons (propertize c 'face 'helm-history-deleted) c))))) + +(defun helm-ff-file-name-history () + "Switch to `file-name-history' without quitting `helm-find-files'." + (interactive) + (with-helm-alive-p + (helm :sources 'helm-source--ff-file-name-history + :buffer "*helm-file-name-history*" + :allow-nest t + :resume 'noresume))) + +;;; Recentf files +;; +;; +(defvar helm-source-recentf + `((name . "Recentf") + (init . (lambda () + (require 'recentf) + (recentf-mode 1))) + (candidates . recentf-list) + (match . helm-files-match-only-basename) + (filtered-candidate-transformer . (lambda (candidates _source) + (cl-loop for i in candidates + if helm-ff-transformer-show-only-basename + collect (cons (helm-basename i) i) + else collect i))) + (keymap . ,helm-generic-files-map) + (help-message . helm-generic-file-help-message) + (mode-line . helm-generic-file-mode-line-string) + (action . ,(cdr (helm-get-actions-from-type + helm-source-locate)))) + "See (info \"(emacs)File Conveniences\"). +Set `recentf-max-saved-items' to a bigger value if default is too small.") + +;;; Browse project +;; Need dependencies: +;; +;; +;; Only hg and git are supported for now. + +;;;###autoload +(defun helm-browse-project () + "Browse files and see status of project with its vcs. +Only hg and git are supported for now. +Fall back to `helm-find-files' if directory is not under +control of one of those vcs. +Need dependencies: + +and +." + (interactive) + (cond ((and (fboundp 'helm-ls-git-root-dir) + (helm-ls-git-root-dir)) + (helm-ls-git-ls)) + ((and (fboundp 'helm-hg-root) + (helm-hg-root)) + (helm-hg-find-files-in-project)) + (t (helm-find-files nil)))) + +(defun helm-ff-browse-project (_candidate) + (with-helm-default-directory helm-ff-default-directory + ;; `helm-browse-project' will call `helm-ls-git-ls' + ;; which will set locally `helm-default-directory' + (helm-browse-project))) + +(defun helm-ff-run-browse-project () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-browse-project))) + +;;; session.el files +;; +;; session (http://emacs-session.sourceforge.net/) is an alternative to +;; recentf that saves recent file history and much more. +(defvar helm-source-session + `((name . "Session") + (candidates . (lambda () + (cl-delete-if-not #'(lambda (f) + (or (string-match helm-tramp-file-name-regexp f) + (file-exists-p f))) + (mapcar 'car session-file-alist)))) + (keymap . ,helm-generic-files-map) + (help-message . helm-generic-file-help-message) + (mode-line . helm-generic-file-mode-line-string) + (action . ,(cdr (helm-get-actions-from-type + helm-source-locate)))) + "File list from emacs-session.") + + +;;; Files in current dir +;; +;; +(defun helm-highlight-files (files) + "A basic transformer for helm files sources. +Colorize only symlinks, directories and files." + (cl-loop for i in files + for disp = (if (and helm-ff-transformer-show-only-basename + (not (helm-dir-is-dot i)) + (not (and ffap-url-regexp + (string-match ffap-url-regexp i))) + (not (string-match helm-ff-url-regexp i))) + (helm-basename i) i) + for type = (car (file-attributes i)) + collect + (cond ((and helm-ff-tramp-not-fancy + (string-match helm-tramp-file-name-regexp i)) + (cons disp i)) + ((stringp type) + (cons (propertize disp + 'face 'helm-ff-symlink + 'help-echo (expand-file-name i)) + i)) + ((eq type t) + (cons (propertize disp + 'face 'helm-ff-directory + 'help-echo (expand-file-name i)) + i)) + (t (cons (propertize disp + 'face 'helm-ff-file + 'help-echo (expand-file-name i)) + i))))) + +(defvar helm-source-files-in-current-dir + `((name . "Files from Current Directory") + (candidates . (lambda () + (with-helm-current-buffer + (let ((dir (helm-current-directory))) + (when (file-accessible-directory-p dir) + (directory-files dir t)))))) + (match . helm-files-match-only-basename) + (keymap . ,helm-generic-files-map) + (help-message . helm-generic-file-help-message) + (mode-line . helm-generic-file-mode-line-string) + (type . file))) + + +;;; External searching file tools. +;; +;; Tracker desktop search +(defvar helm-source-tracker-cand-incomplete nil "Contains incomplete candidate") +(defun helm-source-tracker-transformer (candidates _source) + (helm-log "received: %S" candidates) + (cl-loop for cand in candidates + for path = (when (stringp helm-source-tracker-cand-incomplete) + (caar (helm-highlight-files + (list helm-source-tracker-cand-incomplete)))) + for built = (if (not (stringp cand)) cand + (let ((snippet cand)) + (unless (or (null path) + (string= "" path) + (not (string-match-p + "\\`[[:space:]]*\\.\\.\\." + snippet))) + (let ((complete-candidate + (cons (concat path "\n" snippet) path))) + (setq helm-source-tracker-cand-incomplete nil) + (helm-log "built: %S" complete-candidate) + complete-candidate)))) + when (and (stringp cand) + (string-match "\\`[[:space:]]*file://" cand)) + do (setq helm-source-tracker-cand-incomplete ; save path + (replace-match "" t t cand)) end + collect built)) + +(defvar helm-source-tracker-search + `((name . "Tracker Search") + (candidates-process + . (lambda () + (start-process "tracker-search-process" nil + "tracker-search" + "--disable-color" + "--limit=512" + helm-pattern))) + (filtered-candidate-transformer . helm-source-tracker-transformer) + ;;(multiline) ; https://github.com/emacs-helm/helm/issues/529 + (keymap . ,helm-generic-files-map) + (action . ,(cdr (helm-get-attribute-from-type 'action 'file))) + (action-transformer + helm-transform-file-load-el + helm-transform-file-browse-url) + (requires-pattern . 3)) + "Source for retrieving files matching the current input pattern +with the tracker desktop search.") + +;; Spotlight (MacOS X desktop search) +(defvar helm-source-mac-spotlight + '((name . "mdfind") + (candidates-process + . (lambda () (start-process "mdfind-process" nil "mdfind" helm-pattern))) + (type . file) + (requires-pattern . 3)) + "Source for retrieving files via Spotlight's command line +utility mdfind.") + + +;;; Findutils +;; +;; +(defvar helm-source-findutils + `((name . "Find") + (header-name . (lambda (name) + (concat name " in [" helm-default-directory "]"))) + (candidates-process . helm-find-shell-command-fn) + (filtered-candidate-transformer . helm-findutils-transformer) + (action-transformer helm-transform-file-load-el) + (action . ,(cdr (helm-inherit-attribute-from-source + 'action helm-source-locate))) + (mode-line . helm-generic-file-mode-line-string) + (keymap . ,helm-generic-files-map) + (candidate-number-limit . 9999) + (requires-pattern . 3))) + +(defun helm-findutils-transformer (candidates _source) + (cl-loop for i in candidates + for type = (car (file-attributes i)) + for abs = (expand-file-name i helm-default-directory) + for disp = (if (and helm-ff-transformer-show-only-basename + (not (string-match "[.]\\{1,2\\}$" i))) + (helm-basename i) abs) + collect (cond ((eq t type) + (cons (propertize disp 'face 'helm-ff-directory) abs)) + ((stringp type) + (cons (propertize disp 'face 'helm-ff-symlink) abs)) + (t (cons (propertize disp 'face 'helm-ff-file) abs))))) + +(defun helm-find-shell-command-fn () + "Asynchronously fetch candidates for `helm-find'." + (require 'find-cmd) + (let ((case-fold-search (helm-set-case-fold-search helm-pattern))) + (with-helm-default-directory (helm-default-directory) + (let* (process-connection-type + (pattern (mapconcat 'identity (split-string helm-pattern) "*")) + (ignored-dirs ()) + (ignored-files (when helm-findutils-skip-boring-files + (cl-loop for f in completion-ignored-extensions + if (string-match "/$" f) + do (push (replace-match "" nil t f) + ignored-dirs) + else collect (concat "*" f)))) + (path-or-name (if helm-findutils-search-full-path + '(ipath path) '(iname name))) + (name-or-iname (if case-fold-search + (car path-or-name) (cadr path-or-name))) + (cmd (find-cmd (and ignored-dirs + `(prune (name ,@ignored-dirs))) + (and ignored-files + `(not (name ,@ignored-files))) + `(and (,name-or-iname ,(concat "*" pattern "*")) + (type "d" "f")))) + (proc (start-file-process-shell-command "hfind" helm-buffer cmd))) + (helm-log "Find command:\n%s" cmd) + (prog1 proc + (set-process-sentinel + proc + #'(lambda (process event) + (helm-process-deferred-sentinel-hook + process event (helm-default-directory))))))))) + +(defun helm-find-1 (dir) + (helm :sources 'helm-source-findutils + :buffer "*helm find*" + ;; Make these vars local for further resuming. + :default-directory dir ; reset it when called from elsewhere. + :ff-transformer-show-only-basename nil + :case-fold-search helm-file-name-case-fold-search)) + +;; helm-find-files integration. +(defun helm-ff-find-sh-command (_candidate) + "Run `helm-find' from `helm-find-files'." + (helm-find-1 helm-ff-default-directory)) + +(defun helm-ff-run-find-sh-command () + "Run find shell command action with key from `helm-find-files'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-find-sh-command))) + + +;;; Preconfigured commands +;; +;; +;;;###autoload +(defun helm-find (arg) + "Preconfigured `helm' for the find shell command." + (interactive "P") + (let ((directory + (if arg + (file-name-as-directory + (read-directory-name "DefaultDirectory: ")) + default-directory))) + (helm-find-1 directory))) + +(defvar org-directory) +;;;###autoload +(defun helm-find-files (arg) + "Preconfigured `helm' for helm implementation of `find-file'. +Called with a prefix arg show history if some. +Don't call it from programs, use `helm-find-files-1' instead. +This is the starting point for nearly all actions you can do on files." + (interactive "P") + (let* ((hist (and arg helm-ff-history (helm-find-files-history))) + (default-input (or hist (helm-find-files-initial-input))) + (input (cond ((and (eq major-mode 'org-agenda-mode) + org-directory + (not default-input)) + (expand-file-name org-directory)) + ((and (eq major-mode 'dired-mode) default-input) + (file-name-directory default-input)) + (default-input) + (t (expand-file-name (helm-current-directory))))) + (presel (helm-aif (or hist + (buffer-file-name (current-buffer)) + (and (eq major-mode 'dired-mode) + default-input)) + (if helm-ff-transformer-show-only-basename + (helm-basename it) it)))) + (set-text-properties 0 (length input) nil input) + (helm-find-files-1 input (and presel (concat "^" (regexp-quote presel)))))) + +;;;###autoload +(defun helm-for-files () + "Preconfigured `helm' for opening files. +Run all sources defined in `helm-for-files-preferred-list'." + (interactive) + (let ((helm-ff-transformer-show-only-basename nil)) + (helm-other-buffer helm-for-files-preferred-list "*helm for files*"))) + +;;;###autoload +(defun helm-recentf () + "Preconfigured `helm' for `recentf'." + (interactive) + (let ((helm-ff-transformer-show-only-basename nil)) + (helm-other-buffer 'helm-source-recentf "*helm recentf*"))) + +(provide 'helm-files) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-files.el ends here diff --git a/elpa/helm-20140808.2300/helm-files.elc b/elpa/helm-20140808.2300/helm-files.elc new file mode 100644 index 000000000..35371b5f1 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-files.elc differ diff --git a/elpa/helm-20140808.2300/helm-firefox.el b/elpa/helm-20140808.2300/helm-firefox.el new file mode 100644 index 000000000..e6f40a760 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-firefox.el @@ -0,0 +1,124 @@ +;;; helm-firefox.el --- Firefox bookmarks -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) +(require 'helm-adaptive) +;; +;; You will have to set firefox to import bookmarks in his html file bookmarks.html. +;; (only for firefox versions >=3) +;; To achieve that, open about:config in firefox and double click on this line to enable value +;; to true: +;; user_pref("browser.bookmarks.autoExportHTML", false); +;; You should have now: +;; user_pref("browser.bookmarks.autoExportHTML", true); +;; NOTE: This is also working in the same way for mozilla aka seamonkey. + + +(defgroup helm-firefox nil + "Helm libraries and applications for Firefox navigator." + :group 'helm) + +(defcustom helm-firefox-default-directory "/.mozilla/firefox/" + "The root directory containing firefox config." + :group 'helm-firefox + :type 'string) + +(defvar helm-firefox-bookmark-url-regexp "\\(https\\|http\\|ftp\\|about\\|file\\)://[^ \"]*") +(defvar helm-firefox-bookmarks-regexp ">\\([^><]+.[^]\\)") + +(defun helm-get-firefox-user-init-dir () + "Guess the default Firefox user directory name." + (let* ((moz-dir (concat (getenv "HOME") helm-firefox-default-directory)) + (moz-user-dir + (with-current-buffer (find-file-noselect (concat moz-dir "profiles.ini")) + (goto-char (point-min)) + (prog1 + (when (search-forward "Path=" nil t) + (buffer-substring-no-properties (point) (point-at-eol))) + (kill-buffer))))) + (file-name-as-directory (concat moz-dir moz-user-dir)))) + +(defun helm-guess-firefox-bookmark-file () + "Return the path of the Firefox bookmarks file." + (concat (helm-get-firefox-user-init-dir) "bookmarks.html")) + +(defvar helm-firefox-bookmarks-alist nil) +(defvar helm-source-firefox-bookmarks + '((name . "Firefox Bookmarks") + (init . (lambda () + (setq helm-firefox-bookmarks-alist + (helm-html-bookmarks-to-alist + (helm-guess-firefox-bookmark-file) + helm-firefox-bookmark-url-regexp + helm-firefox-bookmarks-regexp)))) + (candidates . (lambda () + (mapcar #'car helm-firefox-bookmarks-alist))) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-firefox-bookmarks) + (action . (("Browse Url" + . (lambda (candidate) + (helm-browse-url + (helm-firefox-bookmarks-get-value candidate)))) + ("Copy Url" + . (lambda (candidate) + (let ((url (helm-firefox-bookmarks-get-value + candidate))) + (kill-new url) + (message "`%s' copied to kill-ring" url)))))))) + +(defun helm-firefox-bookmarks-get-value (elm) + (assoc-default elm helm-firefox-bookmarks-alist)) + +(defun helm-highlight-firefox-bookmarks (bookmarks _source) + (cl-loop for i in bookmarks + collect (propertize + i 'face '((:foreground "YellowGreen")) + 'help-echo (helm-firefox-bookmarks-get-value i)))) + +;;;###autoload +(defun helm-firefox-bookmarks () + "Preconfigured `helm' for firefox bookmark. +You will have to enable html bookmarks in firefox: +open about:config in firefox and double click on this line to enable value \ +to true: + +user_pref(\"browser.bookmarks.autoExportHTML\", false); + +You should have now: + +user_pref(\"browser.bookmarks.autoExportHTML\", true); + +After closing firefox, you will be able to browse you bookmarks. +" + (interactive) + (helm-other-buffer 'helm-source-firefox-bookmarks + "*Helm Firefox*")) + + +(provide 'helm-firefox) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-firefox.el ends here diff --git a/elpa/helm-20140808.2300/helm-firefox.elc b/elpa/helm-20140808.2300/helm-firefox.elc new file mode 100644 index 000000000..54fe20058 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-firefox.elc differ diff --git a/elpa/helm-20140808.2300/helm-font.el b/elpa/helm-20140808.2300/helm-font.el new file mode 100644 index 000000000..446880e01 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-font.el @@ -0,0 +1,177 @@ +;;; helm-font --- Font and ucs selection for Helm -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) + +(defvar helm-ucs-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "") 'helm-ucs-persistent-delete) + (define-key map (kbd "") 'helm-ucs-persistent-backward) + (define-key map (kbd "") 'helm-ucs-persistent-forward) + (define-key map (kbd "") 'helm-ucs-persistent-insert) + (define-key map (kbd "C-c ?") 'helm-ucs-help) + map) + "Keymap for `helm-ucs'.") + + +;;; Xfont selection +;; +;; +(defun helm-persistent-xfont-action (elm) + "Show current font temporarily" + (let ((current-font (cdr (assoc 'font (frame-parameters)))) + (default-font elm)) + (unwind-protect + (progn (set-frame-font default-font 'keep-size) (sit-for 2)) + (set-frame-font current-font)))) + +(defvar helm-xfonts-cache nil) +(defvar helm-source-xfonts + '((name . "X Fonts") + (init . (lambda () + (unless helm-xfonts-cache + (setq helm-xfonts-cache + (x-list-fonts "*"))))) + (candidates . helm-xfonts-cache) + (action . (("Copy to kill ring" . (lambda (elm) + (kill-new elm))) + ("Set Font" . (lambda (elm) + (kill-new elm) + (set-frame-font elm 'keep-size) + (message "New font have been copied to kill ring"))))) + (persistent-action . helm-persistent-xfont-action) + (persistent-help . "Switch to this font temporarily"))) + +;;; 𝕌𝕔𝕤 𝕊𝕪𝕞𝕓𝕠𝕝 𝕔𝕠𝕞𝕡𝕝𝕖𝕥𝕚𝕠𝕟 +;; +;; +(defvar helm-ucs-max-len 0) +(defun helm-calculate-ucs-max-len () + "Calculate the length of longest `ucs-names' candidate." + (cl-loop with count = 0 + for (n . v) in (ucs-names) + for len = (length n) + if (> len count) + do (setq count len) + finally return count)) + +(defun helm-ucs-init () + "Initialize an helm buffer with ucs symbols. +Only math* symbols are collected." + (unless (> helm-ucs-max-len 0) + (setq helm-ucs-max-len + (helm-calculate-ucs-max-len))) + (with-current-buffer (helm-candidate-buffer + (get-buffer-create "*helm ucs*")) + ;; `ucs-names' fn will not run again, data is cached in + ;; var `ucs-names'. + (cl-loop for (n . v) in (ucs-names) + for len = (length n) + for diff = (+ (- helm-ucs-max-len len) 2) + unless (string= "" n) + do (progn (insert (concat + n ":" + (make-string + diff ? ))) + (if (fboundp 'ucs-insert) + (ucs-insert v) + ;; call `insert-char' with nil nil + ;; to shutup byte compiler in 24.1. + (insert-char v nil nil)) + (insert "\n"))))) + +(defun helm-ucs-forward-char (_candidate) + (with-helm-current-buffer + (forward-char 1))) + +(defun helm-ucs-backward-char (_candidate) + (with-helm-current-buffer + (forward-char -1))) + +(defun helm-ucs-delete-backward (_candidate) + (with-helm-current-buffer + (delete-char -1))) + +(defun helm-ucs-insert-char (candidate) + (with-helm-current-buffer + (insert + (replace-regexp-in-string + " " "" + (cadr (split-string candidate ":")))))) + +(defun helm-ucs-persistent-insert () + (interactive) + (with-helm-alive-p + (helm-attrset 'action-insert 'helm-ucs-insert-char) + (helm-execute-persistent-action 'action-insert))) + +(defun helm-ucs-persistent-forward () + (interactive) + (with-helm-alive-p + (helm-attrset 'action-forward 'helm-ucs-forward-char) + (helm-execute-persistent-action 'action-forward))) + +(defun helm-ucs-persistent-backward () + (interactive) + (with-helm-alive-p + (helm-attrset 'action-back 'helm-ucs-backward-char) + (helm-execute-persistent-action 'action-back))) + +(defun helm-ucs-persistent-delete () + (interactive) + (with-helm-alive-p + (helm-attrset 'action-delete 'helm-ucs-delete-backward) + (helm-execute-persistent-action 'action-delete))) + +(defvar helm-source-ucs + '((name . "Ucs names") + (init . helm-ucs-init) + (candidate-number-limit . 9999) + (candidates-in-buffer) + (mode-line . helm-ucs-mode-line-string) + (action . (("Insert" . helm-ucs-insert-char) + ("Forward char" . helm-ucs-forward-char) + ("Backward char" . helm-ucs-backward-char) + ("Delete char backward" . helm-ucs-delete-backward)))) + "Source for collecting `ucs-names' math symbols.") + +;;;###autoload +(defun helm-select-xfont () + "Preconfigured `helm' to select Xfont." + (interactive) + (helm-other-buffer 'helm-source-xfonts "*helm select* xfont")) + +;;;###autoload +(defun helm-ucs () + "Preconfigured helm for `ucs-names' math symbols." + (interactive) + (helm :sources 'helm-source-ucs + :keymap helm-ucs-map)) + +(provide 'helm-font) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-font.el ends here diff --git a/elpa/helm-20140808.2300/helm-font.elc b/elpa/helm-20140808.2300/helm-font.elc new file mode 100644 index 000000000..a92e11427 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-font.elc differ diff --git a/elpa/helm-20140808.2300/helm-gentoo.el b/elpa/helm-20140808.2300/helm-gentoo.el new file mode 100644 index 000000000..075ea8c17 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-gentoo.el @@ -0,0 +1,258 @@ +;;; helm-gentoo.el --- Helm UI for gentoo portage. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) + +(declare-function term-line-mode "term") +(declare-function term-char-mode "term") +(declare-function term-send-input "term") +(declare-function term-send-eof "term") + + +(defgroup helm-gentoo nil + "Predefined configurations for `helm.el'." + :group 'helm) + +(defface helm-gentoo-match '((t (:foreground "red"))) + "Face for helm-gentoo installed packages." + :group 'traverse-faces) + + +;;; Internals +(defvar helm-gentoo-use-flags nil) +(defvar helm-gentoo-buffer "*helm-gentoo-output*") +(defvar helm-cache-gentoo nil) +(defvar helm-cache-world nil) +(defvar helm-source-gentoo + '((name . "Portage sources") + (init . (lambda () + (get-buffer-create helm-gentoo-buffer) + (unless helm-cache-gentoo + (helm-gentoo-setup-cache)) + (unless helm-cache-world + (setq helm-cache-world (helm-gentoo-get-world))) + (helm-gentoo-init-list))) + (candidates-in-buffer) + (match . identity) + (candidate-transformer helm-highlight-world) + (action . (("Show package" . (lambda (elm) + (helm-gentoo-eshell-action elm "eix"))) + ("Show history" . (lambda (elm) + (if (member elm helm-cache-world) + (helm-gentoo-eshell-action elm "genlop -qe") + (message "No infos on packages not yet installed")))) + ("Copy in kill-ring" . kill-new) + ("insert at point" . insert) + ("Browse HomePage" . (lambda (elm) + (let ((urls (helm-gentoo-get-url elm))) + (browse-url (helm-comp-read "Url: " urls :must-match t))))) + ("Show extra infos" . (lambda (elm) + (if (member elm helm-cache-world) + (helm-gentoo-eshell-action elm "genlop -qi") + (message "No infos on packages not yet installed")))) + ("Show use flags" . (lambda (elm) + (helm-gentoo-default-action elm "equery" "-C" "u") + (font-lock-add-keywords nil '(("^\+.*" . font-lock-variable-name-face))) + (font-lock-mode 1))) + ("Run emerge pretend" . (lambda (elm) + (helm-gentoo-eshell-action elm "emerge -p"))) + ("Emerge" . (lambda (elm) + (helm-gentoo-install elm :action 'install))) + ("Unmerge" . (lambda (elm) + (helm-gentoo-install elm :action 'uninstall))) + ("Show dependencies" . (lambda (elm) + (helm-gentoo-default-action elm "equery" "-C" "d"))) + ("Show related files" . (lambda (elm) + (helm-gentoo-default-action elm "equery" "files"))) + ("Refresh" . (lambda (elm) + (helm-gentoo-setup-cache) + (setq helm-cache-world (helm-gentoo-get-world)))))))) + + +(cl-defun helm-gentoo-install (_candidate &key action) + (setq helm-external-commands-list nil) + (ansi-term (getenv "SHELL") "Gentoo emerge") + (term-line-mode) + (let ((command (cl-case action + (install "sudo emerge -av ") + (uninstall "sudo emerge -avC ") + (t (error "Unknown action")))) + (elms (mapconcat 'identity (helm-marked-candidates) " "))) + (goto-char (point-max)) + (insert (concat command elms)) + (term-char-mode) (term-send-input))) + +(defun helm-gentoo-default-action (elm command &rest args) + "Gentoo default action that use `helm-gentoo-buffer'." + (if (member elm helm-cache-world) + (progn + (helm-switch-to-buffer helm-gentoo-buffer) + (erase-buffer) + (let ((com-list (append args (list elm)))) + (apply #'call-process command nil t nil + com-list))) + (message "No infos on packages not yet installed"))) + +(defvar helm-source-use-flags + '((name . "Use Flags") + (init . (lambda () + (unless helm-gentoo-use-flags + (helm-gentoo-setup-use-flags-cache)) + (helm-gentoo-get-use))) + (candidates-in-buffer) + (match . identity) + (candidate-transformer helm-highlight-local-use) + (action . (("Description" + . (lambda (elm) + (helm-switch-to-buffer helm-gentoo-buffer) + (erase-buffer) + (apply #'call-process "euse" nil t nil + `("-i" + ,elm)) + (font-lock-add-keywords nil `((,elm . font-lock-variable-name-face))) + (font-lock-mode 1))) + ("Enable" + . (lambda (elm) + (helm-gentoo-eshell-action elm "*sudo -p Password: euse -E"))) + ("Disable" + . (lambda (elm) + (helm-gentoo-eshell-action elm "*sudo -p Password: euse -D"))) + ("Remove" + . (lambda (elm) + (helm-gentoo-eshell-action elm "*sudo -p Password: euse -P"))) + ("Show which dep use this flag" + . (lambda (elm) + (helm-switch-to-buffer helm-gentoo-buffer) + (erase-buffer) + (apply #'call-process "equery" nil t nil + `("-C" + "h" + ,elm)))))))) + + + +(defun helm-gentoo-init-list () + "Initialize buffer with all packages in Portage." + (let* ((portage-buf (get-buffer-create "*helm-gentoo*")) + (buf (helm-candidate-buffer portage-buf))) + (with-current-buffer buf + (cl-dolist (i helm-cache-gentoo) + (insert (concat i "\n")))))) + +(defun helm-gentoo-setup-cache () + "Set up `helm-cache-gentoo'" + (setq helm-cache-gentoo + (split-string (with-temp-buffer + (call-process "eix" nil t nil + "--only-names") + (buffer-string))))) + +(defun helm-gentoo-eshell-action (elm command) + (when (get-buffer "*EShell Command Output*") + (kill-buffer "*EShell Command Output*")) + (message "Wait searching...") + (let ((buf-fname (buffer-file-name helm-current-buffer))) + (if (and buf-fname (string-match tramp-file-name-regexp buf-fname)) + (progn + (save-window-excursion + (pop-to-buffer "*scratch*") + (eshell-command (format "%s %s" command elm))) + (pop-to-buffer "*EShell Command Output*")) + (eshell-command (format "%s %s" command elm))))) + +(defun helm-gentoo-get-use () + "Initialize buffer with all use flags." + (let* ((use-buf (get-buffer-create "*helm-gentoo-use*")) + (buf (helm-candidate-buffer use-buf))) + (with-current-buffer buf + (cl-dolist (i helm-gentoo-use-flags) + (insert (concat i "\n")))))) + + +(defun helm-gentoo-setup-use-flags-cache () + "Setup `helm-gentoo-use-flags'" + (setq helm-gentoo-use-flags + (split-string (with-temp-buffer + (call-process "eix" nil t nil + "--print-all-useflags") + (buffer-string))))) + +(defun helm-gentoo-get-url (elm) + "Return a list of urls from eix output." + (cl-loop with url-list = (split-string + (with-temp-buffer + (call-process "eix" nil t nil + elm "--format" "\n") + (buffer-string))) + for i in url-list + when (and (string-match "^http://.*" i) + all + (not (member i all))) + collect i into all + finally return all)) + +(defun helm-gentoo-get-world () + "Return list of all installed package on your system." + (split-string (with-temp-buffer + (call-process "qlist" nil t nil + "-I") + (buffer-string)))) + +(defun helm-gentoo-get-local-use () + (split-string (with-temp-buffer + (call-process "portageq" nil t nil + "envvar" + "USE") + (buffer-string)))) + + +(defun helm-highlight-world (eix) + "Highlight all installed package." + (cl-loop for i in eix + if (member i helm-cache-world) + collect (propertize i 'face 'helm-gentoo-match) + else + collect i)) + +(defun helm-highlight-local-use (use-flags) + (let ((local-uses (helm-gentoo-get-local-use))) + (cl-loop for i in use-flags + if (member i local-uses) + collect (propertize i 'face 'helm-gentoo-match) + else + collect i))) + +;;;###autoload +(defun helm-gentoo () + "Preconfigured `helm' for gentoo linux." + (interactive) + (helm-other-buffer '(helm-source-gentoo + helm-source-use-flags) + "*helm gentoo*")) + + +(provide 'helm-gentoo) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-gentoo.el ends here diff --git a/elpa/helm-20140808.2300/helm-gentoo.elc b/elpa/helm-20140808.2300/helm-gentoo.elc new file mode 100644 index 000000000..f02eeae6f Binary files /dev/null and b/elpa/helm-20140808.2300/helm-gentoo.elc differ diff --git a/elpa/helm-20140808.2300/helm-grep.el b/elpa/helm-20140808.2300/helm-grep.el new file mode 100644 index 000000000..628b88fef --- /dev/null +++ b/elpa/helm-20140808.2300/helm-grep.el @@ -0,0 +1,1196 @@ +;;; helm-grep.el --- Helm Incremental Grep. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'grep) +(require 'helm-regexp) + +;;; load wgrep proxy if it's available +(require 'wgrep-helm nil t) + +(declare-function helm-buffer-list "helm-buffers") +(declare-function helm-elscreen-find-file "helm-elscreen" (file)) +(declare-function View-quit "view") +(declare-function doc-view-goto-page "doc-view" (page)) + + +(defgroup helm-grep nil + "Grep related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-grep-default-command + "grep -a -d skip %e -n%cH -e %p %f" + "Default grep format command for `helm-do-grep-1'. +Where: +'%e' format spec is for --exclude or --include grep options or + ack-grep --type option. (Not mandatory) + +'%c' format spec is for case-fold-search, + whether to use the -i option of grep. (Not mandatory) + When you specify this spec, helm grep will use smartcase + that is when a upcase character is found in pattern case will + be respected and no '-i' option will be used, otherwise, when + no upcase character is found in pattern always use '-i'. + If you don't want this behavior, don't use this spec and + specify or not the '-i' option. + Note that with ack-grep this is not needed, just specify + the '--smart-case' option. + +'%p' format spec is for pattern. (Mandatory) + +'%f' format spec is for filenames. (Mandatory) + +If your grep version doesn't support the --exclude/include args +don't specify the '%e' format spec. + +Helm also support ack-grep and git-grep , +here a default command example for ack-grep: + +\(setq helm-grep-default-command \"ack-grep -Hn --no-group --no-color %e %p %f\" + helm-grep-default-recurse-command \"ack-grep -H --no-group --no-color %e %p %f\") + +You can ommit the %e spec if you don't want to be prompted for types. +`helm-grep-default-command' and `helm-grep-default-recurse-command'are +independents, so you can enable `helm-grep-default-command' with ack-grep +and `helm-grep-default-recurse-command' with grep if you want to be faster +on recursive grep. +NOTE: remote grepping is not available with ack-grep." + :group 'helm-grep + :type 'string) + +(defcustom helm-grep-default-recurse-command + "grep -a -d recurse %e -n%cH -e %p %f" + "Default recursive grep format command for `helm-do-grep-1'. +See `helm-grep-default-command' for format specs and infos about ack-grep." + :group 'helm-grep + :type 'string) + +(defcustom helm-default-zgrep-command + "zgrep -a -n%cH -e %p %f" + "Default command for Zgrep. +See `helm-grep-default-command' for infos on format specs." + :group 'helm-grep + :type 'string) + +(defcustom helm-ack-grep-executable "ack-grep" + "Default ack-grep command." + :group 'helm-grep + :type 'string) + +(defcustom helm-pdfgrep-default-command + "pdfgrep --color never -niH %s %s" + "Default command for pdfgrep." + :group 'helm-grep + :type 'string) + +(defcustom helm-grep-use-ioccur-style-keys t + "Use Arrow keys to jump to occurences." + :group 'helm-grep + :type 'boolean) + +(defcustom helm-pdfgrep-default-read-command nil + "Default command to read pdf files from pdfgrep. +Where '%f' format spec is filename and '%p' is page number. +e.g In Ubuntu you can set it to: + + \"evince --page-label=%p '%f'\" + +If set to nil `doc-view-mode' will be used instead of an external command." + :group 'helm-grep + :type 'string) + +(defcustom helm-grep-max-length-history 100 + "Max number of elements to save in `helm-grep-history'." + :group 'helm-grep + :type 'integer) + +(defcustom helm-zgrep-file-extension-regexp + ".*\\(\\.gz\\|\\.bz\\|\\.xz\\|\\.lzma\\)$" + "Default file extensions zgrep will search in." + :group 'helm-grep + :type 'string) + +(defcustom helm-do-grep-preselect-candidate nil + "When non--nil the file name of current buffer will be selected." + :group 'helm-grep + :type 'boolean) + +(defcustom helm-grep-preferred-ext nil + "This file extension will be preselected for grep." + :group 'helm-grep + :type 'string) + + +;;; Faces +;; +;; +(defface helm-grep-match + '((t (:inherit match))) + "Face used to highlight grep matches." + :group 'helm-grep) + +(defface helm-grep-file + '((t (:foreground "BlueViolet" + :underline t))) + "Face used to highlight grep results filenames." + :group 'helm-grep) + +(defface helm-grep-lineno + '((t (:foreground "Darkorange1"))) + "Face used to highlight grep number lines." + :group 'helm-grep) + +(defface helm-grep-running + '((t (:foreground "Red"))) + "Face used in mode line when grep is running." + :group 'helm-grep) + +(defface helm-grep-finish + '((t (:foreground "Green"))) + "Face used in mode line when grep is finish." + :group 'helm-grep) + +(defface helm-grep-cmd-line + '((t (:inherit diff-added))) + "Face used to highlight grep command line when no results." + :group 'helm-grep) + + +;;; Keymaps +;; +;; +(defvar helm-grep-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-") 'helm-goto-next-file) + (define-key map (kbd "M-") 'helm-goto-precedent-file) + (define-key map (kbd "C-c o") 'helm-grep-run-other-window-action) + (define-key map (kbd "C-c C-o") 'helm-grep-run-other-frame-action) + (define-key map (kbd "C-w") 'helm-yank-text-at-point) + (define-key map (kbd "C-x C-s") 'helm-grep-run-save-buffer) + (when helm-grep-use-ioccur-style-keys + (define-key map (kbd "") 'helm-execute-persistent-action) + (define-key map (kbd "") 'helm-grep-run-default-action)) + (define-key map (kbd "C-c ?") 'helm-grep-help) + (delq nil map)) + "Keymap used in Grep sources.") + +(defvar helm-pdfgrep-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-") 'helm-goto-next-file) + (define-key map (kbd "M-") 'helm-goto-precedent-file) + (define-key map (kbd "C-w") 'helm-yank-text-at-point) + (define-key map (kbd "C-c ?") 'helm-pdfgrep-help) + map) + "Keymap used in pdfgrep.") + +(defvar helm-grep-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") 'helm-grep-mode-jump) + (define-key map (kbd "C-o") 'helm-grep-mode-jump-other-window) + (define-key map (kbd "") 'helm-grep-mode-jump-other-window-forward) + (define-key map (kbd "") 'helm-grep-mode-jump-other-window-backward) + (define-key map (kbd "") 'helm-gm-next-file) + (define-key map (kbd "") 'helm-gm-precedent-file) + map)) + + +;;; Internals vars +;; +;; +(defvar helm-rzgrep-cache (make-hash-table :test 'equal)) +(defvar helm-grep-default-function 'helm-grep-init) +(defvar helm-zgrep-recurse-flag nil) +(defvar helm-grep-history nil) +(defvar helm-grep-last-targets nil) +(defvar helm-grep-include-files nil) +(defvar helm-grep-in-recurse nil) +(defvar helm-grep-use-zgrep nil) +(defvar helm-grep-last-default-directory nil) +(defvar helm-grep-default-directory-fn nil + "A function that should return a directory to expand candidate to. +It is intended to use as a let-bound variable, DON'T set this globaly.") +(defvar helm-pdfgrep-targets nil) +(defvar helm-grep-last-cmd-line nil) +(defvar helm-grep-split-line-regexp "^\\([[:lower:][:upper:]]?:?.*?\\):\\([0-9]+\\):\\(.*\\)") + + +;;; Init +;; +;; +(defun helm-grep-prepare-candidates (candidates) + "Prepare filenames and directories CANDIDATES for grep command line." + ;; If one or more candidate is a directory, search in all files + ;; of this candidate (e.g /home/user/directory/*). + ;; If r option is enabled search also in subdidrectories. + ;; We need here to expand wildcards to support crap windows filenames + ;; as grep doesn't accept quoted wildcards (e.g "dir/*.el"). + (setq candidates (if (file-remote-p default-directory) + ;; Grep don't understand tramp filenames + ;; use the local name. + (mapcar #'(lambda (x) + (file-remote-p x 'localname)) + candidates) + candidates)) + (if helm-zgrep-recurse-flag + (mapconcat 'shell-quote-argument candidates " ") + ;; When candidate is a directory, search in all its files. + ;; NOTE that `file-expand-wildcards' will return also + ;; directories, they will be ignored by grep but not + ;; by ack-grep that will grep all files of this directory + ;; without recursing in their subdirs though, see that as a one + ;; level recursion with ack-grep. + ;; So I leave it as it is, considering it is a feature. [1] + (cl-loop for i in candidates append + (cond ((string-match "^git" helm-grep-default-command) + (list i)) + ;; Candidate is a directory and we use recursion or ack. + ((and (file-directory-p i) + (or helm-grep-in-recurse + ;; ack-grep accept directory [1]. + (helm-grep-use-ack-p))) + (list (expand-file-name i))) + ;; Grep doesn't support directory only when not in recurse. + ((file-directory-p i) + (file-expand-wildcards + (concat (file-name-as-directory (expand-file-name i)) "*") t)) + ;; Candidate is a file or wildcard and we use recursion, use the + ;; current directory instead of candidate. + ((and (or (file-exists-p i) (string-match "[*]" i)) + helm-grep-in-recurse) + (list (expand-file-name + (directory-file-name ; Needed for windoze. + (file-name-directory (directory-file-name i)))))) + ;; Else should be one or more file/directory + ;; possibly marked. + ;; When real is a normal filename without wildcard + ;; file-expand-wildcards returns a list of one file. + ;; wildcards should have been already handled by + ;; helm-read-file-name or helm-find-files but do it from + ;; here too in case we are called from elsewhere. + (t (file-expand-wildcards i t))) into all-files ; [1] + finally return + (if (string-match "^git" helm-grep-default-command) + (mapconcat 'identity all-files " ") + (mapconcat 'shell-quote-argument all-files " "))))) + +(defun helm-grep-command (&optional recursive) + (let* ((com (if recursive + helm-grep-default-recurse-command + helm-grep-default-command)) + (exe (and com (car (split-string com " "))))) + (if (and exe (string= exe "git")) "git-grep" exe))) + +(cl-defun helm-grep-use-ack-p (&key where) + (let ((rec-com (helm-grep-command t)) + (norm-com (helm-grep-command))) + (cl-case where + (default (and norm-com + (string= norm-com helm-ack-grep-executable))) + (recursive (and rec-com + (string= rec-com helm-ack-grep-executable))) + (strict (and norm-com rec-com + (string= rec-com helm-ack-grep-executable) + (string= norm-com helm-ack-grep-executable))) + (t (and (not (and norm-com (string= norm-com "git-grep"))) + (or (and norm-com + (string= norm-com helm-ack-grep-executable)) + (and rec-com + (string= rec-com helm-ack-grep-executable)))))))) + +(defun helm-grep--prepare-cmd-line (only-files &optional include zgrep) + (let* ((default-directory (or helm-default-directory + (expand-file-name helm-ff-default-directory))) + (fnargs (helm-grep-prepare-candidates only-files)) + (ignored-files (unless (helm-grep-use-ack-p) + (mapconcat + #'(lambda (x) + (concat "--exclude=" + (shell-quote-argument x))) + grep-find-ignored-files " "))) + (ignored-dirs (unless (helm-grep-use-ack-p) + (mapconcat + ;; Need grep version >=2.5.4 + ;; of Gnuwin32 on windoze. + #'(lambda (x) + (concat "--exclude-dir=" + (shell-quote-argument x))) + grep-find-ignored-directories " "))) + (exclude (unless (helm-grep-use-ack-p) + (if helm-grep-in-recurse + (concat (or include ignored-files) + " " ignored-dirs) + ignored-files))) + (types (and (helm-grep-use-ack-p) + ;; When %e format spec is not specified + ;; in `helm-grep-default-command' + ;; we need to pass an empty string + ;; to types to avoid error. + (or include ""))) + (smartcase (if (helm-grep-use-ack-p) "" + (unless (let ((case-fold-search nil)) + (string-match-p + "[[:upper:]]" helm-pattern)) "i")))) + (format-spec + helm-grep-default-command + (delq nil + (list (unless zgrep + (if types + (cons ?e types) + (cons ?e exclude))) + (cons ?c (or smartcase "")) + (cons ?p (shell-quote-argument helm-pattern)) + (cons ?f fnargs)))))) + +(defun helm-grep-init (cmd-line) + "Start an asynchronous grep process with CMD-LINE using ZGREP if non--nil." + (let* ((zgrep (string-match "\\`zgrep" cmd-line)) + ;; Use pipe only with grep, zgrep or git-grep. + (process-connection-type (and (not zgrep) (helm-grep-use-ack-p))) + (tramp-verbose helm-tramp-verbose)) + ;; Start grep process. + (helm-log "Starting Grep process in directory `%s'" default-directory) + (helm-log "Command line used was:\n\n%s" + (concat ">>> " (propertize cmd-line 'face 'helm-grep-cmd-line) "\n\n")) + (prog1 ; This function should return the process first. + (start-file-process-shell-command + "grep" helm-buffer cmd-line) + ;; Init sentinel. + (set-process-sentinel + (get-buffer-process helm-buffer) + #'(lambda (process event) + (let ((noresult (= (process-exit-status process) 1))) + (unless noresult + (helm-process-deferred-sentinel-hook + process event helm-ff-default-directory)) + (cond ((and noresult + ;; [FIXME] This is a workaround for zgrep + ;; that exit with code 1 + ;; after a certain amount of results. + (not (with-helm-buffer helm-grep-use-zgrep))) + (with-current-buffer helm-buffer + (insert (concat "* Exit with code 1, no result found," + " Command line was:\n\n " + (propertize helm-grep-last-cmd-line + 'face 'helm-grep-cmd-line))) + (setq mode-line-format + '(" " mode-line-buffer-identification " " + (:eval (format "L%s" (helm-candidate-number-at-point))) " " + (:eval (propertize + (format + "[%s process finished - (no results)] " + (if helm-grep-use-zgrep + "Zgrep" + (capitalize + (if helm-grep-in-recurse + (helm-grep-command t) + (helm-grep-command))))) + 'face 'helm-grep-finish)))))) + ((string= event "finished\n") + (with-helm-window + (setq mode-line-format + '(" " mode-line-buffer-identification " " + (:eval (format "L%s" (helm-candidate-number-at-point))) " " + (:eval (propertize + (format + "[%s process finished - (%s results)] " + (if helm-grep-use-zgrep + "Zgrep" + (capitalize + (if helm-grep-in-recurse + (helm-grep-command t) + (helm-grep-command)))) + (max (1- (count-lines + (point-min) + (point-max))) + 0)) + 'face 'helm-grep-finish)))) + (force-mode-line-update))) + ;; Catch error output in log. + (t (helm-log + "Error: %s %s" + (if helm-grep-use-zgrep "Zgrep" "Grep") + (replace-regexp-in-string "\n" "" event)))))))))) + +(defun helm-grep-collect-candidates () + (let ((cmd-line (helm-grep--prepare-cmd-line + helm-grep-last-targets + helm-grep-include-files + helm-grep-use-zgrep))) + (set (make-local-variable 'helm-grep-last-cmd-line) cmd-line) + (funcall helm-grep-default-function cmd-line))) + + +;;; Actions +;; +;; +(defun helm-grep-action (candidate &optional where mark) + "Define a default action for `helm-do-grep' on CANDIDATE. +WHERE can be one of other-window, elscreen, other-frame." + (let* ((split (helm-grep-split-line candidate)) + (lineno (string-to-number (nth 1 split))) + (loc-fname (or (with-current-buffer + (if (eq major-mode 'helm-grep-mode) + (current-buffer) + helm-buffer) + (get-text-property (point-at-bol) 'help-echo)) + (car split))) + (tramp-method (file-remote-p (or helm-ff-default-directory + default-directory) 'method)) + (tramp-host (file-remote-p (or helm-ff-default-directory + default-directory) 'host)) + (tramp-prefix (concat "/" tramp-method ":" tramp-host ":")) + (fname (if tramp-host + (concat tramp-prefix loc-fname) loc-fname))) + (cl-case where + (other-window (find-file-other-window fname)) + (elscreen (helm-elscreen-find-file fname)) + (other-frame (find-file-other-frame fname)) + (grep (helm-grep-save-results-1)) + (pdf (if helm-pdfgrep-default-read-command + (helm-pdfgrep-action-1 split lineno (car split)) + (find-file (car split)) (doc-view-goto-page lineno))) + (t (find-file fname))) + (unless (or (eq where 'grep) (eq where 'pdf)) + (helm-goto-line lineno)) + (when mark + (set-marker (mark-marker) (point)) + (push-mark (point) 'nomsg)) + ;; Save history + (unless (or helm-in-persistent-action + (eq major-mode 'helm-grep-mode) + (string= helm-pattern "")) + (setq helm-grep-history + (cons helm-pattern + (delete helm-pattern helm-grep-history))) + (when (> (length helm-grep-history) + helm-grep-max-length-history) + (setq helm-grep-history + (delete (car (last helm-grep-history)) + helm-grep-history)))))) + +(defun helm-grep-persistent-action (candidate) + "Persistent action for `helm-do-grep'. +With a prefix arg record CANDIDATE in `mark-ring'." + (if current-prefix-arg + (helm-grep-action candidate nil 'mark) + (helm-grep-action candidate)) + (helm-highlight-current-line)) + +(defun helm-grep-other-window (candidate) + "Jump to result in other window from helm grep." + (helm-grep-action candidate 'other-window)) + +(defun helm-grep-other-frame (candidate) + "Jump to result in other frame from helm grep." + (helm-grep-action candidate 'other-frame)) + +(defun helm-grep-jump-elscreen (candidate) + "Jump to result in elscreen from helm grep." + (helm-grep-action candidate 'elscreen)) + +(defun helm-goto-next-or-prec-file (n &optional type) + "Go to next or precedent candidate file in helm grep/etags buffers. +If N is positive go forward otherwise go backward." + (let* ((allow-mode (or (eq major-mode 'helm-grep-mode) + (eq major-mode 'helm-moccur-mode))) + (sel (if allow-mode + (buffer-substring (point-at-bol) (point-at-eol)) + (helm-get-selection nil t))) + (current-line-list (if (eq type 'etags) + (split-string sel ": +" t) + (helm-grep-split-line sel))) + (current-fname (nth 0 current-line-list)) + (bob-or-eof (if (eq n 1) 'eobp 'bobp)) + (mark-maybe #'(lambda () + (if allow-mode + (ignore) + (helm-mark-current-line))))) + (catch 'break + (while (not (funcall bob-or-eof)) + (forward-line n) ; Go forward or backward depending of n value. + ;; Exit when current-fname is not matched or in `helm-grep-mode' + ;; the line is not a grep line i.e 'fname:num:tag'. + (setq sel (buffer-substring (point-at-bol) (point-at-eol))) + (unless (or (string= current-fname + (car (if (eq type 'etags) + (split-string sel ": +" t) + (helm-grep-split-line sel)))) + (and (eq major-mode 'helm-grep-mode) + (not (get-text-property (point-at-bol) 'help-echo)))) + (funcall mark-maybe) + (throw 'break nil)))) + (cond ((and (> n 0) (eobp)) + (re-search-backward ".") + (forward-line 0) + (funcall mark-maybe)) + ((and (< n 0) (bobp)) + (helm-aif (next-single-property-change (point-at-bol) 'help-echo) + (goto-char it) + (forward-line 1)) + (funcall mark-maybe))))) + +;;;###autoload +(defun helm-goto-precedent-file () + "Go to precedent file in helm grep/etags buffers." + (interactive) + (let ((etagp (when (string= (assoc-default + 'name (helm-get-current-source)) "Etags") + 'etags))) + (with-helm-window + (helm-goto-next-or-prec-file -1 etagp)))) + +;;;###autoload +(defun helm-goto-next-file () + "Go to precedent file in helm grep/etags buffers." + (interactive) + (let ((etagp (when (string= (assoc-default + 'name (helm-get-current-source)) "Etags") + 'etags))) + (with-helm-window + (helm-goto-next-or-prec-file 1 etagp)))) + +(defun helm-grep-run-default-action () + "Run grep default action from `helm-do-grep-1'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-grep-action))) + +(defun helm-grep-run-other-window-action () + "Run grep goto other window action from `helm-do-grep-1'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-grep-other-window))) + +(defun helm-grep-run-other-frame-action () + "Run grep goto other frame action from `helm-do-grep-1'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-grep-other-frame))) + +;;;###autoload +(defun helm-grep-run-save-buffer () + "Run grep save results action from `helm-do-grep-1'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-grep-save-results))) + + +;;; helm-grep-mode +;; +;; +(defun helm-grep-save-results (candidate) + (helm-grep-action candidate 'grep)) + +(defun helm-grep-save-results-1 () + "Save helm grep result in a `helm-grep-mode' buffer." + (let ((buf "*hgrep*") + new-buf) + (when (get-buffer buf) + (setq new-buf (helm-read-string "GrepBufferName: " buf)) + (cl-loop for b in (helm-buffer-list) + when (and (string= new-buf b) + (not (y-or-n-p + (format "Buffer `%s' already exists overwrite? " + new-buf)))) + do (setq new-buf (helm-read-string "GrepBufferName: " "*hgrep "))) + (setq buf new-buf)) + (with-current-buffer (get-buffer-create buf) + (setq buffer-read-only t) + (let ((inhibit-read-only t)) + (erase-buffer) + (insert "-*- mode: helm-grep -*-\n\n" + (format "Grep Results for `%s':\n\n" helm-pattern)) + (save-excursion + (insert (with-current-buffer helm-buffer + (goto-char (point-min)) (forward-line 1) + (buffer-substring (point) (point-max)))))) + (helm-grep-mode) (pop-to-buffer buf)) + (message "Helm Grep Results saved in `%s' buffer" buf))) + +;;;###autoload +(define-derived-mode helm-grep-mode + special-mode "helm-grep" + "Major mode to provide actions in helm grep saved buffer. + +Special commands: +\\{helm-grep-mode-map}" + (set (make-local-variable 'helm-grep-last-cmd-line) + (with-helm-buffer helm-grep-last-cmd-line)) + (set (make-local-variable 'revert-buffer-function) + #'helm-grep-mode--revert-buffer-function)) + +(defun helm-grep-mode--revert-buffer-function (&optional _ignore-auto _noconfirm) + (goto-char (point-min)) + (re-search-forward "^Grep Results for" nil t) + (forward-line 0) + (when (re-search-forward "^$" nil t) + (forward-line 1)) + (let ((inhibit-read-only t)) + (delete-region (point) (point-max))) + (message "Reverting buffer...") + (set-process-sentinel + (start-file-process-shell-command + "hgrep" (generate-new-buffer "*hgrep revert*") helm-grep-last-cmd-line) + (lambda (process event) + (when (string= event "finished\n") + (with-current-buffer (current-buffer) + (let ((inhibit-read-only t)) + (save-excursion + (cl-loop for line in (with-current-buffer (process-buffer process) + (prog1 (split-string (buffer-string) "\n") + (kill-buffer))) + when (string-match helm-grep-split-line-regexp line) + do (insert (propertize + (car (helm-grep-filter-one-by-one line)) + ;; needed for wgrep. + 'helm-realvalue line) + "\n")))) + (message "Reverting buffer done")))))) + +;;;###autoload +(defun helm-gm-next-file () + (interactive) + (helm-goto-next-or-prec-file 1)) + +;;;###autoload +(defun helm-gm-precedent-file () + (interactive) + (helm-goto-next-or-prec-file -1)) + +;;;###autoload +(defun helm-grep-mode-jump () + (interactive) + (let ((candidate (buffer-substring (point-at-bol) (point-at-eol)))) + (condition-case nil + (progn (helm-grep-action candidate) (delete-other-windows)) + (error nil)))) + +(defun helm-grep-mode-jump-other-window-1 (arg) + (let ((candidate (buffer-substring (point-at-bol) (point-at-eol)))) + (condition-case nil + (progn + (save-selected-window + (helm-grep-action candidate 'other-window) + (recenter)) + (forward-line arg)) + (error nil)))) + +;;;###autoload +(defun helm-grep-mode-jump-other-window-forward () + (interactive) + (helm-grep-mode-jump-other-window-1 1)) + +;;;###autoload +(defun helm-grep-mode-jump-other-window-backward () + (interactive) + (helm-grep-mode-jump-other-window-1 -1)) + +;;;###autoload +(defun helm-grep-mode-jump-other-window () + (interactive) + (let ((candidate (buffer-substring (point-at-bol) (point-at-eol)))) + (condition-case nil + (helm-grep-action candidate 'other-window) + (error nil)))) + + +;;; ack-grep types +;; +;; +(defun helm-grep-hack-types () + "Return a list of known ack-grep types." + (with-temp-buffer + ;; "--help-types" works with both 1.96 and 2.1+, while + ;; "--help types" works only with 1.96 Issue #422 + (call-process helm-ack-grep-executable nil t nil "--help-types") + (goto-char (point-min)) + (cl-loop while (re-search-forward + "^ *--\\(\\[no\\]\\)\\([^. ]+\\) *\\(.*\\)" nil t) + collect (cons (concat (match-string 2) + " [" (match-string 3) "]") + (match-string 2)) + collect (cons (concat "no" (match-string 2) + " [" (match-string 3) "]") + (concat "no" (match-string 2)))))) + +(defun helm-grep-ack-types-transformer (candidates _source) + (cl-loop for i in candidates + if (stringp i) + collect (rassoc i helm-grep-ack-types-cache) + else + collect i)) + +(defvar helm-grep-ack-types-cache nil) +(defun helm-grep-read-ack-type () + "Select types for the '--type' argument of ack-grep." + (require 'helm-mode) + (require 'helm-adaptive) + (setq helm-grep-ack-types-cache (helm-grep-hack-types)) + (let ((types (helm-comp-read + "Types: " helm-grep-ack-types-cache + :name "*Ack-grep types*" + :marked-candidates t + :must-match t + :fc-transformer '(helm-adaptive-sort + helm-grep-ack-types-transformer) + :buffer "*helm ack-types*"))) + (mapconcat #'(lambda (type) (concat "--type=" type)) types " "))) + + +;;; grep extensions +;; +;; +(defun helm-grep-guess-extensions (files) + "Try to guess file extensions in FILES list when using grep recurse. +These extensions will be added to command line with --include arg of grep." + (cl-loop with ext-list = (list helm-grep-preferred-ext "*") + with lst = (if (file-directory-p (car files)) + (directory-files + (car files) nil + directory-files-no-dot-files-regexp) + files) + for i in lst + for ext = (file-name-extension i 'dot) + for glob = (and ext (not (string= ext "")) + (concat "*" ext)) + unless (or (not glob) + (and glob-list (member glob glob-list)) + (and glob-list (member glob ext-list)) + (and glob-list (member glob grep-find-ignored-files))) + collect glob into glob-list + finally return (delq nil (append ext-list glob-list)))) + +(defun helm-grep-get-file-extensions (files) + "Try to return a list of file extensions to pass to '--include' arg of grep." + (let* ((all-exts (helm-grep-guess-extensions + (mapcar 'expand-file-name files))) + (extensions (helm-comp-read "Search Only in: " all-exts + :marked-candidates t + :fc-transformer 'helm-adaptive-sort + :buffer "*helm grep exts*" + :name "*helm grep extensions*"))) + (when (listp extensions) ; Otherwise it is empty string returned by C-RET. + ;; If extensions is a list of one string containing spaces, + ;; assume user entered more than one glob separated by space(s) and + ;; split this string to pass it later to mapconcat. + ;; e.g '("*.el *.py") + (cl-loop for i in extensions + append (split-string-and-unquote i " "))))) + + +;;; Set up source +;; +;; +(defvar helm-source-grep nil) +(defun helm-do-grep-1 (targets &optional recurse zgrep exts) + "Launch grep on a list of TARGETS files. +When RECURSE is given use -r option of grep and prompt user +to set the --include args of grep. +You can give more than one arg separated by space. +e.g *.el *.py *.tex. +If you are using ack-grep, you will be prompted for --type +instead. +If prompt is empty '--exclude `grep-find-ignored-files' is used instead. +ZGREP when non--nil use zgrep instead, without prompting for a choice +in recurse, search being made on `helm-zgrep-file-extension-regexp'." + (when (and (helm-grep-use-ack-p) + helm-ff-default-directory + (file-remote-p helm-ff-default-directory)) + (error "Error: Remote operation not supported with ack-grep.")) + (let* ((exts (and recurse + ;; [FIXME] I could handle this from helm-walk-directory. + (not zgrep) ; zgrep doesn't handle -r opt. + (not (helm-grep-use-ack-p :where 'recursive)) + (or exts (helm-grep-get-file-extensions targets)))) + (include-files (and exts + (mapconcat #'(lambda (x) + (concat "--include=" + (shell-quote-argument x))) + (if (> (length exts) 1) + (remove "*" exts) + exts) " "))) + (types (and (not include-files) + (not zgrep) + recurse + (helm-grep-use-ack-p :where 'recursive) + ;; When %e format spec is not specified + ;; ignore types and do not prompt for choice. + (string-match "%e" helm-grep-default-command) + (helm-grep-read-ack-type))) + (follow (and helm-follow-mode-persistent + (assoc-default 'follow helm-source-grep)))) + ;; When called as action from an other source e.g *-find-files + ;; we have to kill action buffer. + (when (get-buffer helm-action-buffer) + (kill-buffer helm-action-buffer)) + ;; If `helm-find-files' haven't already started, + ;; give a default value to `helm-ff-default-directory'. + (unless helm-ff-default-directory + (setq helm-ff-default-directory default-directory)) + ;; We need to store these vars locally + ;; to pass infos later to `helm-resume'. + (helm-set-local-variable 'helm-zgrep-recurse-flag (and recurse zgrep) + 'helm-grep-last-targets targets + 'helm-grep-include-files (or include-files types) + 'helm-grep-in-recurse recurse + 'helm-grep-use-zgrep zgrep + 'helm-grep-last-default-directory helm-ff-default-directory + 'helm-grep-default-command + (cond (zgrep helm-default-zgrep-command) + (recurse helm-grep-default-recurse-command) + ;; When resuming the local value of + ;; `helm-grep-default-command' is used, only git-grep + ;; should need this. + (t helm-grep-default-command))) + ;; Setup the source. + (setq helm-source-grep + `((name . ,(if zgrep "Zgrep" (capitalize (if recurse + (helm-grep-command t) + (helm-grep-command))))) + (header-name . (lambda (name) + (concat name "(C-c ? Help)"))) + (candidates-process . helm-grep-collect-candidates) + (filter-one-by-one . helm-grep-filter-one-by-one) + (candidate-number-limit . 9999) + (no-matchplugin) + (nohighlight) + (mode-line . helm-grep-mode-line-string) + ;; We need to specify keymap here and as :keymap arg [1] + ;; to make it available in further resuming. + (keymap . ,helm-grep-map) + (history . ,'helm-grep-history) + (action . ,(delq + nil + `(("Find File" . helm-grep-action) + ("Find file other frame" . helm-grep-other-frame) + ,(and (locate-library "elscreen") + '("Find file in Elscreen" + . helm-grep-jump-elscreen)) + ("Save results in grep buffer" . helm-grep-save-results) + ("Find file other window" . helm-grep-other-window)))) + (persistent-action . helm-grep-persistent-action) + (persistent-help . "Jump to line (`C-u' Record in mark ring)") + (requires-pattern . 2))) + (and follow (helm-attrset 'follow follow helm-source-grep)) + (helm + :sources '(helm-source-grep) + :buffer (format "*helm %s*" (if zgrep "zgrep" (helm-grep-command recurse))) + :default-directory helm-ff-default-directory + :keymap helm-grep-map ; [1] + :history 'helm-grep-history + :truncate-lines t))) + + +;;; zgrep +;; +;; +(defun helm-ff-zgrep-1 (flist recursive) + (unwind-protect + (let* ((def-dir (or helm-ff-default-directory + default-directory)) + (only (if recursive + (or (gethash def-dir helm-rzgrep-cache) + (puthash + def-dir + (helm-walk-directory + def-dir + :directories nil + :path 'full + :match helm-zgrep-file-extension-regexp) + helm-rzgrep-cache)) + flist))) + (helm-do-grep-1 only recursive 'zgrep)) + (setq helm-zgrep-recurse-flag nil))) + + +;;; transformers +;; +;; +(defun helm-grep-split-line (line) + "Split a grep output line." + ;; The output of grep may send a truncated line in this chunk, + ;; so don't split until grep line is valid, that is + ;; once the second part of the line comes with next chunk + ;; send by process. + (when (string-match helm-grep-split-line-regexp line) + ;; Don't use split-string because buffer/file name or string + ;; may contain a ":". + (cl-loop for n from 1 to 3 collect (match-string n line)))) + +(defun helm-grep--filter-candidate-1 (candidate &optional dir) + (let* ((root (or dir (and helm-grep-default-directory-fn + (funcall helm-grep-default-directory-fn)))) + (split (helm-grep-split-line candidate)) + (fname (if (and root split) + (expand-file-name (car split) root) + (car-safe split))) + (lineno (nth 1 split)) + (str (nth 2 split))) + (when (and fname lineno str) + (cons (concat (propertize (file-name-nondirectory fname) + 'face 'helm-grep-file + 'help-echo fname) ":" + (propertize lineno 'face 'helm-grep-lineno) ":" + (helm-grep-highlight-match str)) + candidate)))) + +(defun helm-grep-filter-one-by-one (candidate) + "`filter-one-by-one' transformer function for `helm-do-grep'." + (let ((helm-grep-default-directory-fn + (or helm-grep-default-directory-fn + (lambda () (or helm-ff-default-directory + helm-default-directory + default-directory))))) + (helm-grep--filter-candidate-1 candidate))) + +(defun helm-grep-highlight-match (str &optional multi-match) + "Highlight in string STR all occurences matching `helm-pattern'." + (require 'helm-match-plugin) + (let (beg end) + (condition-case nil + (with-temp-buffer + (insert str) + (goto-char (point-min)) + (cl-loop for reg in (if multi-match + (cl-loop for r in (helm-mp-split-pattern + helm-pattern) + unless (string-match "\\`!" r) + collect r) + (list helm-pattern)) + do + (while (and (re-search-forward reg nil t) + (> (- (setq end (match-end 0)) + (setq beg (match-beginning 0))) 0)) + (add-text-properties beg end '(face helm-grep-match))) + do (goto-char (point-min))) + (buffer-string)) + (error nil)))) + + +;;; Grep from buffer list +;; +;; +(defun helm-grep-buffers-1 (candidate &optional zgrep) + "Run grep on all file--buffers or CANDIDATE if it is a file--buffer. +If one of selected buffers is not a file--buffer, +it is ignored and grep will run on all others file--buffers. +If only one candidate is selected and it is not a file--buffer, +switch to this buffer and run `helm-occur'. +If a prefix arg is given run grep on all buffers ignoring non--file-buffers." + (let* ((prefarg (or current-prefix-arg helm-current-prefix-arg)) + (helm-ff-default-directory + (if (and helm-ff-default-directory + (file-remote-p helm-ff-default-directory)) + default-directory + helm-ff-default-directory)) + (cands (if prefarg + (buffer-list) + (helm-marked-candidates))) + (win-conf (current-window-configuration)) + ;; Non--fname and remote buffers are ignored. + (bufs (cl-loop for buf in cands + for fname = (buffer-file-name (get-buffer buf)) + when (and fname (not (file-remote-p fname))) + collect (expand-file-name fname)))) + (if bufs + (if zgrep + (helm-do-grep-1 bufs nil 'zgrep) + (helm-do-grep-1 bufs)) + ;; bufs is empty, thats mean we have only CANDIDATE + ;; and it is not a buffer-filename, fallback to occur. + (helm-switch-to-buffer candidate) + (when (get-buffer helm-action-buffer) + (kill-buffer helm-action-buffer)) + (helm-occur) + (when (eq helm-exit-status 1) + (set-window-configuration win-conf))))) + +(defun helm-grep-buffers (candidate) + "Action to grep buffers." + (helm-grep-buffers-1 candidate)) + +(defun helm-zgrep-buffers (candidate) + "Action to zgrep buffers." + (helm-grep-buffers-1 candidate 'zgrep)) + + +;;; Helm interface for pdfgrep +;; pdfgrep program +;; and a pdf-reader (e.g xpdf) are needed. +;; +(defvar helm-pdfgrep-default-function 'helm-pdfgrep-init) +(defun helm-pdfgrep-init (only-files) + "Start an asynchronous pdfgrep process in ONLY-FILES list." + (let* ((default-directory (or helm-ff-default-directory + default-directory)) + (fnargs (helm-grep-prepare-candidates + (if (file-remote-p default-directory) + (mapcar #'(lambda (x) + (file-remote-p x 'localname)) + only-files) + only-files))) + (cmd-line (format helm-pdfgrep-default-command + helm-pattern + fnargs)) + process-connection-type) + ;; Start pdf grep process. + (helm-log "Starting Pdf Grep process in directory `%s'" default-directory) + (helm-log "Command line used was:\n\n%s" + (concat ">>> " (propertize cmd-line 'face 'helm-grep-cmd-line) "\n\n")) + (prog1 + (start-file-process-shell-command + "pdfgrep" helm-buffer cmd-line) + (message nil) + (set-process-sentinel + (get-buffer-process helm-buffer) + #'(lambda (_process event) + (if (string= event "finished\n") + (with-helm-window + (setq mode-line-format + '(" " mode-line-buffer-identification " " + (:eval (format "L%s" (helm-candidate-number-at-point))) " " + (:eval (propertize + (format "[Pdfgrep Process Finish - %s result(s)] " + (max (1- (count-lines + (point-min) (point-max))) 0)) + 'face 'helm-grep-finish)))) + (force-mode-line-update)) + (helm-log "Error: Pdf grep %s" + (replace-regexp-in-string "\n" "" event)))))))) + +(defun helm-do-pdfgrep-1 (only) + "Launch pdfgrep with a list of ONLY files." + (unless (executable-find "pdfgrep") + (error "Error: No such program `pdfgrep'.")) + (let* (helm-grep-in-recurse) ; recursion is never used in pdfgrep. + ;; When called as action from an other source e.g *-find-files + ;; we have to kill action buffer. + (when (get-buffer helm-action-buffer) + (kill-buffer helm-action-buffer)) + (setq helm-pdfgrep-targets only) + (helm + :sources + `(((name . "PdfGrep") + (init . (lambda () + ;; If `helm-find-files' haven't already started, + ;; give a default value to `helm-ff-default-directory'. + (setq helm-ff-default-directory (or helm-ff-default-directory + default-directory)))) + (candidates-process + . (lambda () + (funcall helm-pdfgrep-default-function helm-pdfgrep-targets))) + (filter-one-by-one . helm-grep-filter-one-by-one) + (candidate-number-limit . 9999) + (no-matchplugin) + (nohighlight) + (history . ,'helm-grep-history) + (keymap . ,helm-pdfgrep-map) + (mode-line . helm-pdfgrep-mode-line-string) + (action . helm-pdfgrep-action) + (persistent-help . "Jump to PDF Page") + (requires-pattern . 2))) + :buffer "*helm pdfgrep*" + :history 'helm-grep-history))) + +(defun helm-pdfgrep-action (candidate) + (helm-grep-action candidate 'pdf)) + +(defun helm-pdfgrep-action-1 (_split pageno fname) + (save-selected-window + (start-file-process-shell-command + "pdf-reader" nil + (format-spec helm-pdfgrep-default-read-command + (list (cons ?f fname) (cons ?p pageno)))))) + +;;;###autoload +(defun helm-do-grep () + "Preconfigured helm for grep. +Contrarily to Emacs `grep', no default directory is given, but +the full path of candidates in ONLY. +That allow to grep different files not only in `default-directory' but anywhere +by marking them (C-). If one or more directory is selected +grep will search in all files of these directories. +You can also use wildcard in the base name of candidate. +If a prefix arg is given use the -r option of grep (recurse). +The prefix arg can be passed before or after start file selection. +See also `helm-do-grep-1'." + (interactive) + (require 'helm-mode) + (let* ((preselection (or (dired-get-filename nil t) + (buffer-file-name (current-buffer)))) + (only (helm-read-file-name + "Search in file(s): " + :marked-candidates t + :preselect (and helm-do-grep-preselect-candidate + (if helm-ff-transformer-show-only-basename + (helm-basename preselection) + preselection)))) + (prefarg (or current-prefix-arg helm-current-prefix-arg))) + (helm-do-grep-1 only prefarg))) + +;;;###autoload +(defun helm-do-zgrep () + "Preconfigured helm for zgrep." + (interactive) + (require 'helm-mode) + (let* ((prefarg (or current-prefix-arg helm-current-prefix-arg)) + (preselection (or (dired-get-filename nil t) + (buffer-file-name (current-buffer)))) + (ls (helm-read-file-name + "Search in file(s): " + :marked-candidates t + :preselect (and helm-do-grep-preselect-candidate + (if helm-ff-transformer-show-only-basename + (helm-basename preselection) + preselection))))) + (helm-ff-zgrep-1 ls prefarg))) + +;;;###autoload +(defun helm-do-pdfgrep () + "Preconfigured helm for pdfgrep." + (interactive) + (require 'helm-mode) + (let* ((preselection (or (dired-get-filename nil t) + (buffer-file-name (current-buffer)))) + (only (helm-read-file-name + "Search in file(s): " + :marked-candidates t + :test #'(lambda (file) + (or (string= (file-name-extension file) "pdf") + (string= (file-name-extension file) "PDF") + (file-directory-p file))) + :preselect (and helm-do-grep-preselect-candidate + (if helm-ff-transformer-show-only-basename + (helm-basename preselection) + preselection)))) + (helm-grep-default-function 'helm-pdfgrep-init)) + (helm-do-pdfgrep-1 only))) + + +(provide 'helm-grep) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-grep.el ends here diff --git a/elpa/helm-20140808.2300/helm-grep.elc b/elpa/helm-20140808.2300/helm-grep.elc new file mode 100644 index 000000000..5ff4fa9b0 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-grep.elc differ diff --git a/elpa/helm-20140808.2300/helm-help.el b/elpa/helm-20140808.2300/helm-help.el new file mode 100644 index 000000000..8c0d0ec2e --- /dev/null +++ b/elpa/helm-20140808.2300/helm-help.el @@ -0,0 +1,1487 @@ +;;; helm-help.el --- Help messages for Helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'helm) + +(defgroup helm-help nil + "Embedded help for `helm'." + :group 'helm) + +(defface helm-helper + '((t :inherit helm-header)) + "Face for helm help string in minibuffer." + :group 'helm-help) + + +;;; Global help message - Used by `helm-help' +;; +;; +(defvar helm-help-message + (lambda () + (concat + "\\" + "`helm' is an Emacs incremental completion and selection narrowing framework. + +Narrow the list by typing some pattern, +Multiple patterns are allowed by splitting by space. +Select with natural Emacs operations, choose with RET. + +== Help == +C-h m : Run this generic help for helm. +C-c ? : Run specific helm help for current source. + +== Basic Operations == +C-p, Up: Previous Line +C-n, Down : Next Line +M-v, PageUp : Previous Page +C-v, PageDown : Next Page +Enter : Execute first (default) action / Select +M-< : First Line +M-> : Last Line +M-PageUp, C-M-S-v, C-M-y : Previous Page (other-window) +M-PageDown, C-M-v : Next Page (other-window) + +Tab, C-i : Show action list +Left : Previous Source +Right, C-o : Next Source +C-k : Delete pattern (with prefix arg delete from point to end) +C-j or C-z: Persistent Action (Execute action with helm session kept) + +== Shortcuts For nth Action == + +f1-12: Execute nth 1 to 12 Action(s). + +== Visible Marks == +Visible marks store candidate. Some actions uses marked candidates. + +\\[helm-toggle-visible-mark] : Toggle Visible Mark +\\[helm-prev-visible-mark] : Previous Mark +\\[helm-next-visible-mark] : Next Mark + +== Miscellaneous Commands == +\\[helm-toggle-resplit-window] : Toggle vertical/horizontal split helm window. +\\[helm-quit-and-find-file] : Drop into `find-file'. +\\[helm-delete-current-selection] : Delete selected item (visually). +\\[helm-kill-selection-and-quit] : Kill display value of candidate and quit (with prefix arg kill the real value). +\\[helm-yank-selection] : Yank selection into pattern. +\\[helm-follow-mode] : Toggle automatical execution of persistent action. +\\[helm-follow-action-forward] : Run persistent action and goto next line. +\\[helm-follow-action-backward] : Run persistent action and goto previous line. +\\[helm-force-update] : Recalculate and redisplay candidates. + +== Global Commands == +\\\\[helm-resume] revives last `helm' session. +It is very useful, so you should bind any key.")) + "Detailed help message string for `helm'. +It also accepts function or variable symbol.") + +(defun helm-help-internal (bufname insert-content-fn) + "Show long message during `helm' session in BUFNAME. +INSERT-CONTENT-FN is the function that insert +text to be displayed in BUFNAME." + (let ((winconf (current-frame-configuration))) + (unwind-protect + (progn + (setq helm-suspend-update-flag t) + (switch-to-buffer (get-buffer-create bufname)) + (delete-other-windows) + (erase-buffer) + (funcall insert-content-fn) + (setq cursor-type nil) + (goto-char 1) + (helm-help-event-loop)) + (setq helm-suspend-update-flag nil) + (set-frame-configuration winconf)))) + +(defun helm-help-event-loop () + (let ((prompt (propertize + "[SPC,C-v,down:NextPage b,M-v,up:PrevPage C-s/r:Isearch Other:Exit]" + 'face 'helm-helper)) + (scroll-error-top-bottom t)) + (condition-case _err + (cl-loop for event = (read-key prompt) do + (cl-case event + ((?\C-v ? down) (scroll-up-command helm-scroll-amount)) + ((?\M-v ?b up) (scroll-down-command helm-scroll-amount)) + ((?\C-s) (isearch-forward)) + ((?\C-r) (isearch-backward)) + (t (cl-return)))) + (beginning-of-buffer (message "Beginning of buffer")) + (end-of-buffer (message "End of Buffer"))))) + +;;;###autoload +(defun helm-help () + "Help of `helm'." + (interactive) + (save-selected-window + (helm-help-internal + " *Helm Help*" + (lambda () + (insert (substitute-command-keys + (helm-interpret-value (or (assoc-default + 'help-message + (helm-get-current-source)) + helm-help-message)))))))) + +;;; `helm-buffer-list' help +;; +;; +(defvar helm-buffer-help-message + "== Helm Buffer == +\nTips: + +Completion: + +- Major-mode: + +You can enter a partial name of major-mode (e.g lisp, sh) to narrow down buffers. +To specify the major-mode, prefix it with \"*\" e.g \"*lisp\". +If you want to match all buffers but the ones with a specific major-mode (negation), +prefix the major-mode with \"!\" e.g \"*!lisp\". +If you want to specify more than one major-mode, separate them with \",\", +e.g \"*!lisp,!sh,!fun\" will list all buffers but the ones in lisp-mode, sh-mode and +fundamental-mode. + +Enter then a space and a pattern to narrow down to buffers matching this pattern. + +- Search inside buffers: + +If you enter a space and a pattern prefixed by \"@\" helm will search for text matching +this pattern INSIDE the buffer (i.e not in the name of buffer). +NOTE that if you enter your pattern prefixed with \"@\" but escaped, helm will search a buffer +matching \"@pattern\" but will not search inside. + +- Search by directory name: + +If you prefix the beginning of pattern with \"/\" the match will occur on directory name +of buffer, it is interesting to narrow down to one directory for example, subsequent string +entered after a space will match on buffer-name only. +Note that negation is not supported for matching on buffer-file-name. +You can't cumulate both major-mode matching AND directory matching, choose one or the other. + +- Fuzzy matching: + +Note that if `helm-buffers-fuzzy-matching' is non--nil you will have +fuzzy matching on buffer names (not on directory name matching and major-mode though). +A pattern starting with \"^\" will disable fuzzy matching and will match by exact regexp. + +- Examples: + +if I enter in pattern prompt: +\"*lisp ^helm @moc\" +helm will narrow down the list by selecting only buffers that are in lisp mode, start by helm +and match \"moc\" in their contents. + +if I enter in pattern prompt: +\"*lisp ^helm moc\" +Notice there is no \"@\" this time +helm will look for lisp mode buffers starting by \"helm\" and have \"moc\" in their name. + +if I enter in pattern prompt: +\"*!lisp !helm\" +helm will narrow down to buffers that are not in \"lisp\" mode and that do not match \"helm\" + +if I enter in pattern prompt: +/helm/ w3 +helm will narrow down to buffers that are in any \"helm\" subdirectory and matching w3. + + +- Creating buffers + +When creating a new buffer use \\[universal-argument] to choose a mode for your buffer in a list. +This list is customizable, see `helm-buffers-favorite-modes'. + +- Killing buffers + +You have a command to kill buffer(s) and quit emacs and a command to kill buffers one by one +\(no marked\) without quitting helm. +You can run this persistent kill buffer command either with the regular +`helm-execute-persistent-action' called with a prefix arg (C-u C-j) or with its specific command +`helm-buffer-run-kill-persistent' see binding below. + +- Meaning of colors and prefixes for buffers: + +Remote buffers are prefixed with '@'. +Red => Buffer have its file modified on disk by an external process. +Indianred2 => Buffer exists but its file have been deleted. +Orange => Buffer is modified and its file not saved to disk. +Italic => A non--file buffer. + +\nSpecific commands for `helm-buffers-list': +\\ +\\[helm-buffer-run-zgrep]\t\t->Grep Buffer(s) works as zgrep too (C-u grep all buffers but non--file buffers). +\\[helm-buffers-run-multi-occur]\t\t->Multi Occur buffer or marked buffers. (C-u toggle force searching current-buffer). +\\[helm-buffer-switch-other-window]\t\t->Switch other window. +\\[helm-buffer-switch-other-frame]\t\t->Switch other frame. +\\[helm-buffer-run-query-replace-regexp]\t\t->Query replace regexp in marked buffers. +\\[helm-buffer-run-query-replace]\t\t->Query replace in marked buffers. +\\[helm-buffer-run-ediff]\t\t->Ediff current buffer with candidate. If two marked buffers ediff those buffers. +\\[helm-buffer-run-ediff-merge]\t\t->Ediff merge current buffer with candidate. If two marked buffers ediff merge those buffers. +\\[helm-buffer-diff-persistent]\t\t->Toggle Diff buffer with saved file without quitting. +\\[helm-buffer-revert-persistent]\t\t->Revert buffer without quitting. +\\[helm-buffer-save-persistent]\t\t->Save buffer without quitting. +\\[helm-buffer-run-kill-buffers]\t\t->Delete marked buffers and quit. +\\[helm-buffer-run-kill-persistent]\t\t->Delete buffer without quitting helm. +\\[helm-toggle-all-marks]\t\t->Toggle all marks. +\\[helm-mark-all]\t\t->Mark all. +\\[helm-toggle-buffers-details]\t\t->Toggle details. +\\[helm-buffers-toggle-show-hidden-buffers]\t\t->Show hidden buffers. +\\[helm-buffers-mark-similar-buffers]\t\t->Mark all buffers with same type (color) than current. +\\[helm-buffer-help]\t\t->Display this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-buffer-help () + "Help command for helm buffers." + (interactive) + (let ((helm-help-message helm-buffer-help-message)) + (helm-help))) + +;;; Find files help (`helm-find-files') +;; +;; +(defvar helm-ff-help-message + "== Helm Find Files == +\nTips: +\n- Enter `~/' at end of pattern to quickly reach home directory. + +- Enter `/' at end of pattern to quickly reach root of your file system. + +- Enter `./' at end of pattern to quickly reach `default-directory' (initial start of session). + If you are in `default-directory' move cursor on top. + +- Enter `../' at end of pattern will reach upper directory, moving cursor on top. + NOTE: This different to using `C-l' in that `C-l' don't move cursor on top but stay on previous + subdir name. + +- You can complete with partial basename (start on third char entered) + + e.g \"fob\" or \"fbr\" will complete \"foobar\" + but \"fb\" will wait for a third char for completing. + +- Use `C-u C-j' to watch an image. + +- `C-j' on a filename will expand in helm-buffer to this filename. + Second hit on `C-j' will display buffer filename. + Third hit on `C-j' will kill buffer filename. + NOTE: `C-u C-j' will display buffer directly. + +- To browse images directories turn on `helm-follow-mode' and navigate with arrow keys. + You can also use `helm-follow-action-forward' and `helm-follow-action-backward' + (`C-'). + +- You can turn off/on (toggle) autoupdate completion at any moment with `C-DEL'. + NOTE: On a terminal C- may not work, use in this case C-c . + +- You can create a new directory and a new file at the same time, just write the path in prompt + and press `'. + e.g You can create \"~/new/newnew/newnewnew/my_newfile.txt\". + +- To create a new directory, add a \"/\" at end of new name and press . + +- To create a new file just write the filename not ending with \"/\". + +- You can start a recursive search with Locate of Find (See commands below). + With Locate you can use a local db with a prefix arg; If the localdb doesn't already + exists, you will be prompted for its creation, if it exists and you want to refresh it, + give two prefix args. + +\nSpecific commands for `helm-find-files': +\\ +\\[helm-ff-run-locate]\t\t->Run Locate (C-u to specify locate db, M-n insert basename of candidate) +\\[helm-ff-run-find-sh-command]\t\t->Run Find shell command from this directory. +\\[helm-ff-run-grep]\t\t->Run Grep (C-u Recursive). +\\[helm-ff-run-pdfgrep]\t\t->Run Pdfgrep on marked files. +\\[helm-ff-run-zgrep]\t\t->Run zgrep (C-u Recursive). +\\[helm-ff-run-etags]\t\t->Run Etags (C-u use thing-at-point `C-u C-u' reload cache) +\\[helm-ff-run-rename-file]\t\t->Rename File (C-u Follow). +\\[helm-ff-run-query-replace-on-marked]\t\t->Query replace on marked files. +\\[helm-ff-run-copy-file]\t\t->Copy File (C-u Follow). +\\[helm-ff-run-byte-compile-file]\t\t->Byte Compile File (C-u Load). +\\[helm-ff-run-load-file]\t\t->Load File. +\\[helm-ff-run-symlink-file]\t\t->Symlink File. +\\[helm-ff-run-hardlink-file]\t\t->Hardlink file. +\\[helm-ff-run-delete-file]\t\t->Delete File. +\\[helm-ff-run-kill-buffer-persistent]\t\t->Kill buffer candidate without quitting. +\\[helm-ff-persistent-delete]\t\t->Delete file without quitting. +\\[helm-ff-run-switch-to-eshell]\t\t->Switch to Eshell. +\\[helm-ff-run-eshell-command-on-file]\t\t->Eshell command on file (C-u Apply on marked files, otherwise treat them sequentially). +\\[helm-ff-run-ediff-file]\t\t->Ediff file. +\\[helm-ff-run-ediff-merge-file]\t\t->Ediff merge file. +\\[helm-ff-run-complete-fn-at-point]\t\t->Complete file name at point. +\\[helm-ff-run-switch-other-window]\t\t->Switch other window. +\\[helm-ff-run-switch-other-frame]\t\t->Switch other frame. +\\[helm-ff-run-open-file-externally]\t\t->Open file with external program (C-u to choose). +\\[helm-ff-run-open-file-with-default-tool]\t\t->Open file externally with default tool. +\\[helm-ff-rotate-left-persistent]\t\t->Rotate Image Left. +\\[helm-ff-rotate-right-persistent]\t\t->Rotate Image Right. +\\[helm-find-files-up-one-level]\t\t->Go down precedent directory. +\\[helm-ff-run-switch-to-history]\t\t->Switch to last visited directories history. +\\[helm-ff-file-name-history]\t\t->Switch to file name history. +\\[helm-ff-properties-persistent]\t\t->Show file properties in a tooltip. +\\[helm-mark-all]\t\t->Mark all visibles candidates. +\\[helm-ff-run-toggle-auto-update]\t\t->Toggle auto expansion of directories. +\\[helm-unmark-all]\t\t->Unmark all candidates, visibles and invisibles. +\\[helm-ff-run-gnus-attach-files]\t\t->Gnus attach files to message buffer. +\\[helm-ff-run-print-file]\t\t->Print file, (C-u to refresh printers list). +\\[helm-enlarge-window]\t\t->Enlarge helm window. +\\[helm-narrow-window]\t\t->Narrow helm window. +\\[helm-ff-run-toggle-basename]\t\t->Toggle basename/fullpath. +\\[helm-ff-run-find-file-as-root]\t\t->Find file as root. +\\[helm-ff-run-insert-org-link]\t\t->Insert org link. +\\[helm-ff-help]\t\t->Display this help info. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-ff-help () + "Help command for `helm-find-files'." + (interactive) + (let ((helm-help-message helm-ff-help-message)) + (helm-help))) + +;;; Help for `helm-read-file-name' +;; +;; +(defvar helm-read-file-name-help-message + "== Helm read file name ==\ +\nTips: +\n- Enter `~/' at end of pattern to quickly reach home directory. + +- Enter `/' at end of pattern to quickly reach root of your file system. + +- Enter `./' at end of pattern to quickly reach `default-directory' (initial start of session). + If you are in `default-directory' move cursor on top. + +- Enter `../' at end of pattern will reach upper directory, moving cursor on top. + NOTE: This different to using `C-l' in that `C-l' don't move cursor on top but stay on previous + subdir name. + +- You can complete with partial basename (start on third char entered) + + e.g \"fob\" or \"fbr\" will complete \"foobar\" + but \"fb\" will wait for a third char for completing. + +Persistent actions: + +By default `helm-read-file-name' use the persistent actions of `helm-find-files'. + +- Use `C-u C-j' to watch an image. + +- `C-j' on a filename will expand in helm-buffer to this filename. + Second hit on `C-j' will display buffer filename. + Third hit on `C-j' will kill buffer filename. + NOTE: `C-u C-j' will display buffer directly. + +- To browse images directories turn on `helm-follow-mode' and navigate with arrow keys. + +- When you want to delete backward characters to e.g creating a new file or directory, + autoupdate may keep updating to an existent directory + preventing you to do so, in this case just hit C- and then . + This should not needed when copying/renaming files because autoupdate is disabled + by default in this case. + NOTE: On a terminal C- may not work, use in this case C-c . + +- You can create a new directory and a new file at the same time, just write the path in prompt + and press . + e.g You can create \"~/new/newnew/newnewnew/my_newfile.txt\". + +- To create a new directory, add a \"/\" at end of new name and press . + +- To create a new file just write the filename not ending with \"/\". + +\nSpecific commands for helm-read-file-name: +\\ +\\[helm-find-files-up-one-level]\t\t->Go down precedent directory. +\\[helm-ff-run-toggle-auto-update]\t->Toggle auto expansion of directories. +\\[helm-ff-run-toggle-basename]\t\t->Toggle basename. +\\[helm-ff-file-name-history]\t\t->File name history. +\\[helm-cr-empty-string]\t->Maybe return empty string (unless `must-match'). +\\[helm-next-source]\t->Goto next source. +\\[helm-previous-source]\t->Goto previous source. +\\[helm-read-file-name-help]\t\t->Display this help info. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-read-file-name-help () + (interactive) + (let ((helm-help-message helm-read-file-name-help-message)) + (helm-help))) + +;;; Generic file help - Used by locate. +;; +;; +(defvar helm-generic-file-help-message + "== Helm Generic files Map ==\ + +\nLocate tips: +You can add after writing search pattern any of the locate command line options. +e.g -b, -e, -n ...etc. +See Man locate for more infos. + +Note: +Some other sources (at the moment recentf and file in current directory sources) +support the -b flag for compatibility with locate when they are used with it. + +\nSpecific commands for helm locate and others files sources: +\\ +\\[helm-ff-run-toggle-basename]\t\t->Toggle basename. +\\[helm-ff-run-grep]\t\t->Run grep (C-u recurse). +\\[helm-ff-run-pdfgrep]\t\t->Run Pdfgrep on marked files. +\\[helm-ff-run-delete-file]\t\t->Delete file. +\\[helm-ff-run-ediff-file]\t\t->Ediff file. +\\[helm-ff-run-ediff-merge-file]\t\t->Ediff merge file. +\\[helm-ff-run-switch-other-window]\t\t->Switch other window. +\\[helm-ff-properties-persistent]\t\t->Show file properties. +\\[helm-ff-run-etags]\t\t->Run etags (C-u use tap, C-u C-u reload DB). +\\[helm-yank-text-at-point]\t\t->Yank text at point. +\\[helm-ff-run-open-file-externally]\t\t->Open file with external program (C-u to choose). +\\[helm-ff-run-open-file-with-default-tool]\t\t->Open file externally with default tool. +\\[helm-ff-run-insert-org-link]\t\t->Insert org link. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-generic-file-help () + (interactive) + (let ((helm-help-message helm-generic-file-help-message)) + (helm-help))) + +;;; Grep help +;; +;; +(defvar helm-grep-help-message + "== Helm Grep Map ==\ +\nHelm Grep tips: +You can start grep with a prefix arg to recurse in subdirectories. +You can use wild card when selecting files (e.g *.el) +You can grep in many differents directories by marking files or wild cards. +You can save your results in a grep-mode buffer, see below. + +Grepping on remote file will work only with grep, not ack-grep, but it is +anyway bad supported as tramp doesn't support multiple process running in a +short delay (less than 5s actually), so I strongly advice hitting `C-!' (i.e +suspend process) before entering anything in pattern, and hit again `C-!' when +your regexp is ready to send to remote process. + +\nSpecific commands for Helm Grep: +\\ +\\[helm-goto-next-file]\t->Next File. +\\[helm-goto-precedent-file]\t\t->Precedent File. +\\[helm-yank-text-at-point]\t\t->Yank Text at point in minibuffer. +\\[helm-grep-run-other-window-action]\t\t->Jump other window. +\\[helm-grep-run-other-frame-action]\t\t->Jump other frame. +\\[helm-grep-run-persistent-action]\t\t->Run persistent action (Same as `C-j'). +\\[helm-grep-run-default-action]\t\t->Run default action (Same as RET). +\\[helm-grep-run-save-buffer]\t\t->Save to a `grep-mode' enabled buffer. +\\[helm-grep-help]\t\t->Show this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-grep-help () + (interactive) + (let ((helm-help-message helm-grep-help-message)) + (helm-help))) + +;;; Pdf grep help +;; +;; +(defvar helm-pdfgrep-help-message + "== Helm PdfGrep Map ==\ +\nSpecific commands for Pdf Grep: +\\ +\\[helm-goto-next-file]\t->Next File. +\\[helm-goto-precedent-file]\t\t->Precedent File. +\\[helm-yank-text-at-point]\t\t->Yank Text at point in minibuffer. +\\[helm-pdfgrep-help]\t\t->Show this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-pdfgrep-help () + (interactive) + (let ((helm-help-message helm-pdfgrep-help-message)) + (helm-help))) + +;;; Etags help +;; +;; +(defvar helm-etags-help-message + "== Helm Etags Map ==\ +\nSpecific commands for Etags: +\\ +\\[helm-goto-next-file]\t->Next File. +\\[helm-goto-precedent-file]\t\t->Precedent File. +\\[helm-yank-text-at-point]\t\t->Yank Text at point in minibuffer. +\\[helm-etags-help]\t\t->Show this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-etags-help () + "The help function for etags." + (interactive) + (let ((helm-help-message helm-etags-help-message)) + (helm-help))) + +;;; Ucs help +;; +;; +(defvar helm-ucs-help-message + "== Helm Ucs == +\nSpecific commands for `helm-ucs': +\\ +\\[helm-ucs-persistent-insert]\t->Insert char. +\\[helm-ucs-persistent-forward]\t->Forward char. +\\[helm-ucs-persistent-backward]\t->Backward char. +\\[helm-ucs-persistent-delete]\t->Delete char backward. +\\[helm-ucs-help]\t\t->Show this help. + +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-ucs-help () + "Help command for `helm-ucs'." + (interactive) + (let ((helm-help-message helm-ucs-help-message)) + (helm-help))) + +;;; Bookmark help +;; +;; +(defvar helm-bookmark-help-message + "== Helm bookmark name Map ==\ +\nSpecific commands for bookmarks: +\\ +\\[helm-bookmark-run-jump-other-window]\t\t->Jump other window. +\\[helm-bookmark-run-delete]\t\t->Delete bookmark. +\\[helm-bookmark-run-edit]\t\t->Edit bookmark. +\\[helm-bmkext-run-sort-by-frequency]\t\t->Sort by frequency (only for bmkext). +\\[helm-bmkext-run-sort-by-last-visit]\t\t->Sort by last visited (only for bmkext). +\\[helm-bmkext-run-sort-alphabetically]\t\t->Sort alphabetically (only for bmkext). +\\[helm-bookmark-toggle-filename]\t\t->Toggle bookmark location visibility. +\\[helm-bookmark-help]\t\t->Run this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-bookmark-help () + "Help command for bookmarks." + (interactive) + (let ((helm-help-message helm-bookmark-help-message)) + (helm-help))) + +;;; Eshell command on file help +;; +;; +(defvar helm-esh-help-message + "== Helm eshell on file == +\nTips: + +- Passing extra args after filename: + +Normally your command or alias will be called with file as argument. + +e.g 'candidate_file' + +But you can also pass an argument or more after 'candidate_file' like this: + + %s [extra_args]\n + +'candidate_file' will be added at '%s' and your command will look at this: + + 'candidate_file' [extra_args] + +- Specify many files as args (marked files): + +e.g file1 file2 ... + +Call `helm-find-files-eshell-command-on-file' with one prefix-arg +Otherwise you can pass one prefix-arg from the command selection buffer. +NOTE: This is not working on remote files. + +With two prefix-arg before starting or from the command selection buffer +the output is printed to your `current-buffer'. + +Note that with no prefix-arg or a prefix-arg value of '(16) (C-u C-u) +the command is called once for each file like this: + + file1 file2 etc... + +\nSpecific commands for `helm-find-files-eshell-command-on-file': +\\ +\\[helm-esh-help]\t\t->Display this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-esh-help () + "Help command for `helm-find-files-eshell-command-on-file'." + (interactive) + (let ((helm-help-message helm-esh-help-message)) + (helm-help))) + +;;; Ido virtual buffer help +;; +;; +(defvar helm-buffers-ido-virtual-help-message + "== Helm ido virtual buffers Map ==\ +\nSpecific commands for ido virtuals buffers: +\\ +\\[helm-ff-run-switch-other-window]\t\t->Switch other window. +\\[helm-ff-run-switch-other-frame]\t\t->Switch other frame. +\\[helm-ff-run-grep]\t\t->Grep file. +\\[helm-ff-run-zgrep]\t\t->Zgrep file. +\\[helm-ff-run-delete-file]\t\t->Delete file. +\\[helm-ff-run-open-file-externally]\t\t->Open file externally. +\\[helm-buffers-ido-virtual-help]\t\t->Display this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-buffers-ido-virtual-help () + "Help command for ido virtual buffers." + (interactive) + (let ((helm-help-message helm-buffers-ido-virtual-help-message)) + (helm-help))) + +;;; Moccur help +;; +;; +(defvar helm-moccur-help-message + "== Helm Moccur Map ==\ +\nHelm Moccur tips: + +\nSpecific commands for Helm Moccur: +\\ +\\[helm-goto-next-file]\t->Next Buffer. +\\[helm-goto-precedent-file]\t\t->Precedent Buffer. +\\[helm-yank-text-at-point]\t\t->Yank Text at point in minibuffer. +\\[helm-moccur-run-goto-line-ow]\t\t->Goto line in other window. +\\[helm-moccur-run-goto-line-of]\t\t->Goto line in new frame. +\\[helm-moccur-help]\t\t->Show this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-moccur-help () + (interactive) + (let ((helm-help-message helm-moccur-help-message)) + (helm-help))) + +;;; Helm Top +;; +;; +(defvar helm-top-help-message + "== Helm Top Map ==\ +\nHelm Top tips: + +\nSpecific commands for Helm Top: +\\ +\\[helm-top-run-sort-by-com]\t->Sort by commands. +\\[helm-top-run-sort-by-cpu]\t->Sort by cpu usage. +\\[helm-top-run-sort-by-user]\t->Sort alphabetically by user. +\\[helm-top-run-sort-by-mem]\t->Sort by memory. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-top-help () + (interactive) + (let ((helm-help-message helm-top-help-message)) + (helm-help))) + +;;; Helm Apt +;; +;; +(defvar helm-apt-help-message + "== Helm Apt Map ==\ +\nHelm Apt tips: + +\nSpecific commands for Helm Apt: +\\ +\\[helm-apt-show-all]\t->Show all packages. +\\[helm-apt-show-only-installed]\t->Show installed packages only. +\\[helm-apt-show-only-not-installed]\t->Show not installed packages only. +\\[helm-apt-show-only-deinstalled]\t-Show deinstalled (not purged yet) packages only.> +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-apt-help () + (interactive) + (let ((helm-help-message helm-apt-help-message)) + (helm-help))) + +;;; Helm elisp package +;; +;; +(defvar helm-el-package-help-message + "== Helm elisp package Map ==\ +\nHelm elisp package tips: + +\nSpecific commands for Helm elisp package: +\\ +\\[helm-el-package-show-all]\t->Show all packages. +\\[helm-el-package-show-installed]\t->Show installed packages only. +\\[helm-el-package-show-uninstalled]\t->Show not installed packages only. +\\[helm-el-package-help]\t->Show this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-el-package-help () + (interactive) + (let ((helm-help-message helm-el-package-help-message)) + (helm-help))) + +;;; Helm M-x +;; +;; +(defvar helm-M-x-help-message + "== Helm M-x ==\ +\nHelm M-x tips: + +You can get help on any command with persistent action (C-j). + +All the prefix args passed BEFORE running `helm-M-x' are ignored. +When you want to pass prefix args, pass them AFTER starting `helm-M-x', +you will have a prefix arg counter appearing in mode-line notifying you +the amount of prefix args entered. + +\nSpecific commands for Helm M-x: +\\ +\\[helm-M-x-help]\t\t->Show this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-M-x-help () + (interactive) + (let ((helm-help-message helm-M-x-help-message)) + (helm-help))) + +;;; helm-imenu +;; +;; +(defvar helm-imenu-help-message + "== Helm imenu ==\ +\nHelm imenu tips: + +\nSpecific commands for Helm imenu: +\\ +\\[helm-imenu-help]\t->Show this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-imenu-help () + (interactive) + (let ((helm-help-message helm-imenu-help-message)) + (helm-help))) + +;;; helm-colors +;; +;; +(defvar helm-colors-help-message + "== Helm colors ==\ +\nSpecific commands for Helm colors: +\\ +\\[helm-color-run-insert-name]\t\tInsert the entry'name. +\\[helm-color-run-kill-name]\t\tKill the entry's name. +\\[helm-color-run-insert-rgb]\t\tInsert entry in RGB format. +\\[helm-color-run-kill-rgb]\t\tKill entry in RGB format. +\\[helm-color-help]\t\tShow this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-color-help () + (interactive) + (let ((helm-help-message helm-colors-help-message)) + (helm-help))) + +;;; helm semantic +;; +;; +(defvar helm-semantic-help-message + "== Helm semantic ==\ +\nHelm semantic tips: + +\nSpecific commands for Helm semantic: +\\ +\\[helm-semantic-help]\t->Show this help. +\n== Helm Map == +\\{helm-map}") + +;;;###autoload +(defun helm-semantic-help () + (interactive) + (let ((helm-help-message helm-semantic-help-message)) + (helm-help))) + + +;;; Mode line strings +;; +;; +;;;###autoload +(defvar helm-buffer-mode-line-string + '("Buffer(s)" "\ +\\\ +\\[helm-buffer-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct" + "String displayed in mode-line in `helm-source-buffers-list'")) + +;;;###autoload +(defvar helm-color-mode-line-string + '("Colors" "\ +\\\ +\\[helm-color-help]:Help/\ +\\[helm-color-run-insert-name]:Insert name/\ +\\[helm-color-run-insert-rgb]:Insert RGB/\ +with shift: Kill")) + +;;;###autoload +(defvar helm-buffers-ido-virtual-mode-line-string + '("Killed Buffer(s)" "\ +\\\ +\\[helm-buffers-ido-virtual-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct" + "String displayed in mode-line in `helm-source-buffers-list'")) + +;;;###autoload +(defvar helm-ff-mode-line-string "\ +\\\ +\\[helm-ff-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct" + "String displayed in mode-line in `helm-source-find-files'") + +;;;###autoload +(defvar helm-read-file-name-mode-line-string "\ +\\\ +\\[helm-read-file-name-help]:Help \ +\\[helm-cr-empty-string]:Empty \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct" + "String displayed in mode-line in `helm-source-find-files'.") + +;;;###autoload +(defvar helm-generic-file-mode-line-string "\ +\\\ +\\[helm-generic-file-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend" + "String displayed in mode-line in Locate.") + +;;;###autoload +(defvar helm-grep-mode-line-string"\ +\\\ +\\[helm-grep-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend" + "String displayed in mode-line in `helm-do-grep'.") + +;;;###autoload +(defvar helm-pdfgrep-mode-line-string "\ +\\\ +\\[helm-pdfgrep-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend" + "String displayed in mode-line in `helm-do-pdfgrep'.") + +;;;###autoload +(defvar helm-etags-mode-line-string "\ +\\\ +\\[helm-etags-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct" + "String displayed in mode-line in `helm-etags-select'.") + +;;;###autoload +(defvar helm-ucs-mode-line-string "\ +\\\ +\\[helm-ucs-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct" + "String displayed in mode-line in `helm-ucs'.") + +;;;###autoload +(defvar helm-bookmark-mode-line-string + '("Bookmark(s)" "\ +\\\ +\\[helm-bookmark-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct") + "String displayed in mode-line in `helm-source-buffers-list'") + +;;;###autoload +(defvar helm-occur-mode-line "\ +\\\ +\\[helm-help]:Help \ +\\\ +\\[helm-occur-run-query-replace-regexp]:Query replace regexp \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend") + +;;;###autoload +(defvar helm-moccur-mode-line "\ +\\\ +\\[helm-moccur-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend") + +;;;###autoload +(defvar helm-comp-read-mode-line "\ +\\\ +\\[helm-cr-empty-string]:Empty \ +\\\ +\\[helm-help]:Help \ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct") + +;;;###autoload +(defvar helm-top-mode-line "\ +\\\ +\\[helm-top-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend") + +;;;###autoload +(defvar helm-apt-mode-line "\ +\\\ +\\[helm-apt-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend") + +;;;###autoload +(defvar helm-el-package-mode-line "\ +\\\ +\\[helm-el-package-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend") + +;;;###autoload +(defvar helm-M-x-mode-line "\ +\\\ +\\[helm-M-x-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend") + +;;;###autoload +(defvar helm-imenu-mode-line "\ +\\\ +\\[helm-imenu-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend") + +;;;###autoload +(defvar helm-semantic-mode-line "\ +\\\ +\\[helm-semantic-help]:Help \ +\\\ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct \ +\\[helm-toggle-suspend-update]:Tog.suspend") + + +;;; Attribute Documentation +;; +;; +;;;###autoload +(defun helm-describe-helm-attribute (helm-attribute) + "Display the full documentation of HELM-ATTRIBUTE. +HELM-ATTRIBUTE should be a symbol." + (interactive (list (intern + (completing-read + "Describe helm attribute: " + (mapcar 'symbol-name helm-attributes) + nil t)))) + (with-output-to-temp-buffer "*Help*" + (princ (get helm-attribute 'helm-attrdoc)))) + +(helm-document-attribute 'name "mandatory" + " The name of the source. It is also the heading which appears + above the list of matches from the source. Must be unique.") + +(helm-document-attribute 'header-name "optional" + " A function returning the display string of the header. Its + argument is the name of the source. This attribute is useful to + add an additional information with the source name.") + +(helm-document-attribute 'candidates "mandatory if candidates-in-buffer attribute is not provided" + " Specifies how to retrieve candidates from the source. It can + either be a variable name, a function called with no parameters + or the actual list of candidates. + + The list must be a list whose members are strings, symbols + or (DISPLAY . REAL) pairs. + + In case of (DISPLAY . REAL) pairs, the DISPLAY string is shown + in the Helm buffer, but the REAL one is used as action + argument when the candidate is selected. This allows a more + readable presentation for candidates which would otherwise be, + for example, too long or have a common part shared with other + candidates which can be safely replaced with an abbreviated + string for display purposes. + + Note that if the (DISPLAY . REAL) form is used then pattern + matching is done on the displayed string, not on the real + value. + + If the candidates have to be retrieved asynchronously (for + example, by an external command which takes a while to run) + then the function should start the external command + asynchronously and return the associated process object. + Helm will take care of managing the process (receiving the + output from it, killing it if necessary, etc.). The process + should return candidates matching the current pattern (see + variable `helm-pattern'.) + You should use instead `candidates-process' attribute for + async processes, a warning will popup when using async process + in a `candidates' attribute. + + Note that currently results from asynchronous sources appear + last in the helm buffer regardless of their position in + `helm-sources'.") + +(helm-document-attribute 'candidates-process + "Same as `candidates' attributes but for process function." + " You should use this attribute when using a function involving + an async process instead of `candidates'.") + +(helm-document-attribute 'action "mandatory if type attribute is not provided" + " It is a list of (DISPLAY . FUNCTION) pairs or FUNCTION. + FUNCTION is called with one parameter: the selected candidate. + + An action other than the default can be chosen from this list + of actions for the currently selected candidate (by default + with TAB). The DISPLAY string is shown in the completions + buffer and the FUNCTION is invoked when an action is + selected. The first action of the list is the default.") + +(helm-document-attribute 'coerce "optional" + " It's a function called with one argument: the selected + candidate. + + This function is intended for type convertion. In normal case, + the selected candidate (string) is passed to action + function. If coerce function is specified, it is called just + before action function. + + Example: converting string to symbol + (coerce . intern)") + +(helm-document-attribute 'type "optional if action attribute is provided" + " Indicates the type of the items the source returns. + + Merge attributes not specified in the source itself from + `helm-type-attributes'. + + This attribute is implemented by plug-in.") + +(helm-document-attribute 'init "optional" + " Function called with no parameters when helm is started. It + is useful for collecting current state information which can be + used to create the list of candidates later. + + For example, if a source needs to work with the current + directory then it can store its value here, because later + helm does its job in the minibuffer and in the + `helm-buffer' and the current directory can be different + there.") + +(helm-document-attribute 'delayed-init "optional" + " Function called with no parameters before candidate function + is called. It is similar with `init' attribute, but its + evaluation is deferred. It is useful to combine with ") + +(helm-document-attribute 'match "optional" + " List of functions called with one parameter: a candidate. The + function should return non-nil if the candidate matches the + current pattern (see variable `helm-pattern'). + + This attribute allows the source to override the default + pattern matching based on `string-match'. It can be used, for + example, to implement a source for file names and do the + pattern matching on the basename of files, since it's more + likely one is typing part of the basename when searching for a + file, instead of some string anywhere else in its path. + + If the list contains more than one function then the list of + matching candidates from the source is constructed by appending + the results after invoking the first function on all the + potential candidates, then the next function, and so on. The + matching candidates supplied by the first function appear first + in the list of results and then results from the other + functions, respectively. + + This attribute has no effect for asynchronous sources (see + attribute `candidates'), since they perform pattern matching + themselves.") + +(helm-document-attribute 'candidate-transformer "optional" + " It's a function or a list of functions called with one argument + when the completion list from the source is built. The argument + is the list of candidates retrieved from the source. The + function should return a transformed list of candidates which + will be used for the actual completion. If it is a list of + functions, it calls each function sequentially. + + This can be used to transform or remove items from the list of + candidates. + + Note that `candidates' is run already, so the given transformer + function should also be able to handle candidates with (DISPLAY + . REAL) format.") + +(helm-document-attribute 'filtered-candidate-transformer "optional" + " It has the same format as `candidate-transformer', except the + function is called with two parameters: the candidate list and + the source. + + This transformer is run on the candidate list which is already + filtered by the current pattern. While `candidate-transformer' + is run only once, it is run every time the input pattern is + changed. + + It can be used to transform the candidate list dynamically, for + example, based on the current pattern. + + In some cases it may also be more efficent to perform candidate + transformation here, instead of with `candidate-transformer' + even if this transformation is done every time the pattern is + changed. For example, if a candidate set is very large then + `candidate-transformer' transforms every candidate while only + some of them will actually be dislpayed due to the limit + imposed by `helm-candidate-number-limit'. + + Note that `candidates' and `candidate-transformer' is run + already, so the given transformer function should also be able + to handle candidates with (DISPLAY . REAL) format. + + This option has no effect for asynchronous sources. (Not yet, + at least.") + +(helm-document-attribute 'action-transformer "optional" + " It's a function or a list of functions called with two + arguments when the action list from the source is + assembled. The first argument is the list of actions, the + second is the current selection. If it is a list of functions, + it calls each function sequentially. + + The function should return a transformed action list. + + This can be used to customize the list of actions based on the + currently selected candidate.") + +(helm-document-attribute 'pattern-transformer "optional" + " It's a function or a list of functions called with one argument + before computing matches. Its argument is `helm-pattern'. + Functions should return transformed `helm-pattern'. + + It is useful to change interpretation of `helm-pattern'.") + +(helm-document-attribute 'delayed "optional" + " Candidates from the source are shown only if the user stops + typing and is idle for `helm-idle-delay' seconds. + If a value is given to delayed attr, this value is used instead only + if it is > to `helm-idle-delay'.") + +(helm-document-attribute 'volatile "optional" + " Indicates the source assembles the candidate list dynamically, + so it shouldn't be cached within a single Helm + invocation. It is only applicable to synchronous sources, + because asynchronous sources are not cached.") + +(helm-document-attribute 'requires-pattern "optional" + " If present matches from the source are shown only if the + pattern is not empty. Optionally, it can have an integer + parameter specifying the required length of input which is + useful in case of sources with lots of candidates.") + +(helm-document-attribute 'persistent-action "optional" + " Can be a either a Function called with one parameter (the + selected candidate) or a cons cell where first element is this + same function and second element a symbol (e.g never-split) + that inform `helm-execute-persistent-action'to not split his + window to execute this persistent action.") + +(helm-document-attribute 'candidates-in-buffer "optional" + " Shortcut attribute for making and narrowing candidates using + buffers. This newly-introduced attribute prevents us from + forgetting to add volatile and match attributes. + + See docstring of `helm-candidates-in-buffer'. + + (candidates-in-buffer) is equivalent of three attributes: + (candidates . helm-candidates-in-buffer) + (volatile) + (match identity) + + (candidates-in-buffer . candidates-function) is equivalent of: + (candidates . candidates-function) + (volatile) + (match identity) + + This attribute is implemented by plug-in.") + +(helm-document-attribute 'search "optional" + " List of functions like `re-search-forward' or `search-forward'. + Buffer search function used by `helm-candidates-in-buffer'. + By default, `helm-candidates-in-buffer' uses + `re-search-forward'. This attribute is meant to be used with + (candidates . helm-candidates-in-buffer) or + (candidates-in-buffer) in short.") + +(helm-document-attribute 'search-from-end "optional" + " Make `helm-candidates-in-buffer' search from the end of buffer. + If this attribute is specified, `helm-candidates-in-buffer' + uses `re-search-backward' instead.") + +(helm-document-attribute 'get-line "optional" + " A function like `buffer-substring-no-properties' or `buffer-substring'. + This function converts point of line-beginning and point of line-end, + which represents a candidate computed by `helm-candidates-in-buffer'. + By default, `helm-candidates-in-buffer' uses + `buffer-substring-no-properties'.") + +(helm-document-attribute 'display-to-real "optional" + " Function called with one parameter; the selected candidate. + + The function transforms the selected candidate, and the result + is passed to the action function. The display-to-real + attribute provides another way to pass other string than one + shown in Helm buffer. + + Traditionally, it is possible to make candidates, + candidate-transformer or filtered-candidate-transformer + function return a list with (DISPLAY . REAL) pairs. But if REAL + can be generated from DISPLAY, display-to-real is more + convenient and faster.") + +(helm-document-attribute 'real-to-display "optional" + " Function called with one parameter; the selected candidate. + + The inverse of display-to-real attribute. + + The function transforms the selected candidate, which is passed + to the action function, for display. The real-to-display + attribute provides the other way to pass other string than one + shown in Helm buffer. + + Traditionally, it is possible to make candidates, + candidate-transformer or filtered-candidate-transformer + function return a list with (DISPLAY . REAL) pairs. But if + DISPLAY can be generated from REAL, real-to-display is more + convenient. + + Note that DISPLAY parts returned from candidates / + candidate-transformer are IGNORED as the name `display-to-real' + says.") + +(helm-document-attribute 'cleanup "optional" + " Function called with no parameters when *helm* buffer is + closed. It is useful for killing unneeded candidates buffer. + + Note that the function is executed BEFORE performing action.") + +(helm-document-attribute 'candidate-number-limit "optional" + " Override `helm-candidate-number-limit' only for this source.") + +(helm-document-attribute 'accept-empty "optional" + " Pass empty string \"\" to action function.") + +(helm-document-attribute 'dummy "optional" + " Set `helm-pattern' to candidate. If this attribute is + specified, The candidates attribute is ignored. + + This attribute is implemented by plug-in.") + +(helm-document-attribute 'multiline "optional" + " Enable to selection multiline candidates.") + +(helm-document-attribute 'update "optional" + (substitute-command-keys + " Function called with no parameters at end of reinitialization when \ +\\\\[helm-force-update] is pressed.")) + +(helm-document-attribute 'mode-line "optional" + " Source local `helm-mode-line-string' (included in + `mode-line-format'). It accepts also variable/function name.") + +(helm-document-attribute 'header-line "optional" + " Source local `header-line-format'. + It accepts also variable/function name. ") + +(helm-document-attribute + 'resume "optional" + " Function called with no parameters at end of initialization + when `helm-resume' is started. + If this function try to do something against `helm-buffer', \(e.g updating, + searching etc...\) probably you should run it in a timer to ensure + `helm-buffer' is ready.") + +(helm-document-attribute 'keymap "optional" + " Specific keymap for this source. + It is useful to have a keymap per source when using more than + one source. Otherwise, a keymap can be set per command with + `helm' argument KEYMAP. NOTE: when a source have `helm-map' as + keymap attr, the global value of `helm-map' will override the + actual local one.") + +(helm-document-attribute 'help-message "optional" + " Help message for this source. + If not present, `helm-help-message' value will be used.") + +(helm-document-attribute 'match-part "optional" + " Allow matching candidate in the line with `candidates-in-buffer'. + In candidates-in-buffer sources, match is done with + `re-search-forward' which allow matching only a regexp on the + `helm-buffer'; when this search is done, match-part allow + matching only a specific part of the current line e.g with a + line like this: + + filename:candidate-containing-the-word-filename + + What you want is to ignore \"filename\" part and match only + \"candidate-containing-the-word-filename\" + + So give a function matching only the part of candidate after \":\" + + If source contain match-part attribute, match is computed only + on part of candidate returned by the call of function provided + by this attribute. The function should have one arg, candidate, + and return only a specific part of candidate. + + NOTE: This have effect only on sources using + `candidates-in-buffer'.") + +(helm-document-attribute 'match-strict "optional" + " When specifying a match function within a source and + helm-match-plugin is enabled, the result of all matching + functions will be concatened, which in some cases is not what + is wanted. When using `match-strict' only this or these + functions will be used. You can specify those functions as a + list of functions or a single symbol function. For anonymous + function don't add the dot, e.g: + + \(match-strict (lambda () (foo))).") + +(helm-document-attribute 'nohighlight "optional" + " Disable highlight match in this source.") + +(helm-document-attribute 'no-matchplugin "optional" + " Disable matchplugin for this source.") + +(helm-document-attribute 'history "optional" + " Allow passing history variable to helm from source. + It should be a quoted symbol evaluated from source, i.e: + (history . ,'history-var)") + +(helm-document-attribute 'follow "optional" + " Enable `helm-follow-mode' for this source only. + You must give it a value of 1 or -1, though giving a -1 value + is surely not what you want, e.g: (follow . 1) + + See `helm-follow-mode' for more infos") + +(helm-document-attribute 'follow-delay "optional" + " `helm-follow-mode' will execute persistent-action after this delay. +Otherwise value of `helm-follow-input-idle-delay' is used if non--nil, +If none of these are found fallback to `helm-input-idle-delay'.") + +(helm-document-attribute 'allow-dups "optional" + " Allow helm collecting duplicates candidates.") + +(helm-document-attribute 'filter-one-by-one "optional" + " A transformer function that treat candidates one by one. + It is called with one arg the candidate. + It is faster than `filtered-candidate-transformer' or `candidates-transformer', + but should be used only in sources that recompute constantly their candidates, + e.g `helm-source-find-files'. + Filtering happen early and candidates are treated + one by one instead of re-looping on the whole list. + If used with `filtered-candidate-transformer' or `candidates-transformer' + these functions should treat the candidates transformed by the `filter-one-by-one' + function in consequence.") + +(helm-document-attribute 'nomark "optional" + " Don't allow marking candidates when this attribute is present.") + +(provide 'helm-help) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-help.el ends here diff --git a/elpa/helm-20140808.2300/helm-help.elc b/elpa/helm-20140808.2300/helm-help.elc new file mode 100644 index 000000000..962c785f9 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-help.elc differ diff --git a/elpa/helm-20140808.2300/helm-imenu.el b/elpa/helm-20140808.2300/helm-imenu.el new file mode 100644 index 000000000..1f4eb5777 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-imenu.el @@ -0,0 +1,170 @@ +;;; helm-imenu.el --- Helm interface for Imenu -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'imenu) +(require 'helm-utils) + + +(defgroup helm-imenu nil + "Imenu related libraries and applications for helm." + :group 'helm) + +(defcustom helm-imenu-delimiter " / " + "Delimit types of candidates and his value in `helm-buffer'." + :group 'helm-imenu + :type 'string) + +(defcustom helm-imenu-execute-action-at-once-if-one t + "Goto the candidate when only one is remaining." + :group 'helm-imenu + :type 'boolean) + +(defcustom helm-imenu-lynx-style-map t + "Use Arrow keys to jump to occurences." + :group 'helm-imenu + :type 'boolean) + + +;;; keymap +(defvar helm-imenu-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-imenu-help) + (when helm-imenu-lynx-style-map + (define-key map (kbd "") 'helm-maybe-exit-minibuffer) + (define-key map (kbd "") 'helm-execute-persistent-action)) + (delq nil map))) + + +;;; Internals +(defvar helm-cached-imenu-alist nil) +(make-variable-buffer-local 'helm-cached-imenu-alist) + +(defvar helm-cached-imenu-candidates nil) +(make-variable-buffer-local 'helm-cached-imenu-candidates) + +(defvar helm-cached-imenu-tick nil) +(make-variable-buffer-local 'helm-cached-imenu-tick) + + +(defvar helm-source-imenu + `((name . "Imenu") + (candidates . helm-imenu-candidates) + (allow-dups) + (candidate-transformer . helm-imenu-transformer) + (persistent-action . helm-imenu-persistent-action) + (persistent-help . "Show this entry") + (keymap . ,helm-imenu-map) + (mode-line . helm-imenu-mode-line) + (action . helm-imenu-action) + "See (info \"(emacs)Imenu\")")) + + +(defun helm-imenu-action (candidate) + "Default action for `helm-source-imenu'." + (imenu candidate) + ;; If semantic is supported in this buffer + ;; imenu used `semantic-imenu-goto-function' + ;; and position have been highlighted, + ;; no need to highlight again. + (unless (eq imenu-default-goto-function + 'semantic-imenu-goto-function) + (helm-highlight-current-line nil nil nil nil 'pulse))) + +(defun helm-imenu-persistent-action (candidate) + "Default persistent action for `helm-source-imenu'." + (imenu candidate) + (helm-highlight-current-line)) + +(defun helm-imenu-candidates () + (with-helm-current-buffer + (let ((tick (buffer-modified-tick))) + (if (eq helm-cached-imenu-tick tick) + helm-cached-imenu-candidates + (setq imenu--index-alist nil) + (setq helm-cached-imenu-tick tick + helm-cached-imenu-candidates + (let ((index (imenu--make-index-alist))) + (helm-imenu--candidates-1 + (delete (assoc "*Rescan*" index) index)))))))) + +(defun helm-imenu--candidates-1 (alist) + (cl-loop for elm in alist + append (if (imenu--subalist-p elm) + (helm-imenu--candidates-1 + (cl-loop for (e . v) in (cdr elm) collect + (cons (propertize + e 'helm-imenu-type (car elm)) + v))) + (and (cdr elm) ; bug in imenu, should not be needed. + (list elm))))) + +(defun helm-imenu--get-prop (item) + ;; property value of ITEM can have itself + ;; a property value which have itself a property value + ;; ...and so on; Return a list of all these + ;; properties values starting at ITEM. + (let* ((prop (get-text-property 0 'helm-imenu-type item)) + (lst (list prop item))) + (when prop + (while prop + (setq prop (get-text-property 0 'helm-imenu-type prop)) + (and prop (push prop lst))) + lst))) + +(defun helm-imenu-transformer (candidates) + (cl-loop for (k . v) in candidates + for types = (or (helm-imenu--get-prop k) + (list "Function" k)) + collect + (cons (mapconcat (lambda (x) + (propertize + x 'face (cond ((string= x "Variables") + 'font-lock-variable-name-face) + ((string= x "Function") + 'font-lock-function-name-face) + ((string= x "Types") + 'font-lock-type-face)))) + types helm-imenu-delimiter) + (cons k v)))) + +;;;###autoload +(defun helm-imenu () + "Preconfigured `helm' for `imenu'." + (interactive) + (let ((imenu-auto-rescan t) + (str (thing-at-point 'symbol)) + (helm-execute-action-at-once-if-one + helm-imenu-execute-action-at-once-if-one)) + (helm :sources 'helm-source-imenu + :default (list (concat "\\_<" str "\\_>") str) + :candidate-number-limit 9999 + :buffer "*helm imenu*"))) + +(provide 'helm-imenu) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-imenu.el ends here diff --git a/elpa/helm-20140808.2300/helm-imenu.elc b/elpa/helm-20140808.2300/helm-imenu.elc new file mode 100644 index 000000000..273c2653c Binary files /dev/null and b/elpa/helm-20140808.2300/helm-imenu.elc differ diff --git a/elpa/helm-20140808.2300/helm-info.el b/elpa/helm-20140808.2300/helm-info.el new file mode 100644 index 000000000..9dbf5c4d2 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-info.el @@ -0,0 +1,144 @@ +;;; helm-info.el --- Browse info index with helm -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-plugin) +(require 'helm-net) + +(declare-function Info-index-nodes "info" (&optional file)) +(declare-function Info-goto-node "info" (&optional fork)) +(declare-function Info-find-node "info.el" (filename nodename &optional no-going-back)) + + +(defgroup helm-info nil + "Info related Applications and libraries for Helm." + :group 'helm) + +;;; Build info-index sources with info-index plug-in. +;; +;; +(defun helm-build-info-index-command (name doc source buffer) + "Define an helm command NAME with documentation DOC. +Arg SOURCE will be an existing helm source named +`helm-source-info-' and BUFFER a string buffer name." + (eval (list 'defun name nil doc + (list 'interactive) + (list 'helm + :sources source + :buffer buffer + :candidate-number-limit 1000)))) + +(defun helm-define-info-index-sources (var-value &optional commands) + "Define helm sources named helm-source-info-. +Sources are generated for all entries of `helm-default-info-index-list'. +If COMMANDS arg is non--nil build also commands named `helm-info'. +Where NAME is one of `helm-default-info-index-list'." + (cl-loop with symbols = (cl-loop for str in var-value + collect + (intern (concat "helm-source-info-" str))) + for sym in symbols + for str in var-value + do (set sym (list (cons 'name (format "Info index: %s" str)) + (cons 'info-index str))) + when commands + do (let ((com (intern (concat "helm-info-" str)))) + (helm-build-info-index-command + com (format "Predefined helm for %s info." str) + sym (format "*helm info %s*" str))))) + +(defun helm-info-index-set (var value) + (set var value) + (helm-define-info-index-sources value t)) + +(defcustom helm-default-info-index-list + '("elisp" "cl" "org" "gnus" "tramp" "ratpoison" + "zsh" "bash" "coreutils" "fileutils" + "find" "sh-utils" "textutils" "libc" + "make" "automake" "autoconf" "eintr" + "emacs" "elib" "eieio" "gauche-refe" "guile" + "guile-tut" "goops" "screen" "latex" "gawk" + "sed" "m4" "wget" "binutils" "as" "bfd" "gprof" + "ld" "diff" "flex" "grep" "gzip" "libtool" + "texinfo" "info" "gdb" "stabs" "cvsbook" "cvs" + "bison" "id-utils" "global") + "Info Manual entries to use for building helm info index commands." + :group 'helm-info + :type '(repeat (choice string)) + :set 'helm-info-index-set) + +(defcustom helm-info-default-sources + '(helm-source-info-elisp + helm-source-info-cl + helm-source-info-eieio + helm-source-info-pages) + "The default sources to use in `helm-info-at-point'." + :group 'helm-info + :type '(repeat (choice symbol))) + + +;;; Info pages +(defvar helm-info-pages nil + "All info pages on system. +Will be calculated the first time you invoke helm with this +source.") + +(defun helm-info-pages-init () + "Collect candidates for initial Info node Top." + (if helm-info-pages + helm-info-pages + (let ((info-topic-regexp "\\* +\\([^:]+: ([^)]+)[^.]*\\)\\.") + topics) + (require 'info) + (with-temp-buffer + (Info-find-node "dir" "top") + (goto-char (point-min)) + (while (re-search-forward info-topic-regexp nil t) + (push (match-string-no-properties 1) topics)) + (kill-buffer)) + (setq helm-info-pages topics)))) + +(defvar helm-source-info-pages + `((name . "Info Pages") + (init . helm-info-pages-init) + (candidates . helm-info-pages) + (action . (("Show with Info" .(lambda (node-str) + (info (replace-regexp-in-string + "^[^:]+: " "" node-str)))))) + (requires-pattern . 2))) + +;;;###autoload +(defun helm-info-at-point () + "Preconfigured `helm' for searching info at point. +With a prefix-arg insert symbol at point." + (interactive) + (let ((helm-google-suggest-default-function + 'helm-google-suggest-emacs-lisp)) + (helm :sources helm-info-default-sources + :buffer "*helm info*"))) + +(provide 'helm-info) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-info.el ends here diff --git a/elpa/helm-20140808.2300/helm-info.elc b/elpa/helm-20140808.2300/helm-info.elc new file mode 100644 index 000000000..11d437cd5 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-info.elc differ diff --git a/elpa/helm-20140808.2300/helm-locate.el b/elpa/helm-20140808.2300/helm-locate.el new file mode 100644 index 000000000..ec7c661b6 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-locate.el @@ -0,0 +1,325 @@ +;;; helm-locate.el --- helm interface for locate. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;; NOTE for WINDOZE users: +;; You have to install Everything with his command line interface here: +;; http://www.voidtools.com/download.php + +;;; Code: + +(require 'cl-lib) +(require 'helm) + + +(defgroup helm-locate nil + "Locate related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-locate-db-file-regexp "m?locate\.db$" + "Default regexp to match locate database. +If nil Search in all files." + :type 'string + :group 'helm-locate) + +(defcustom helm-ff-locate-db-filename "locate.db" + "The basename of the locatedb file you use locally in your directories. +When this is set and `helm' find such a file in the directory from +where you launch locate, it will use this file and will not prompt you +for a db file. +Note that this happen only when locate is launched with a prefix arg." + :group 'helm-locate + :type 'string) + +(defcustom helm-locate-command nil + "A list of arguments for locate program. +Normally you should not have to modify this yourself. + +If nil it will be calculated when `helm-locate' startup +with these default values for different systems: + +Gnu/linux: \"locate %s -e -A %s\" +berkeley-unix: \"locate %s %s\" +windows-nt: \"es %s %s\" +Others: \"locate %s %s\" + +This string will be passed to format so it should end with `%s'. +The first format spec is used for the \"-i\" value of locate/es, +So don't set it directly but use `helm-locate-case-fold-search' +for this. +The \"-r\" option must be the last option, however if not specified you will +be able to specify it during helm invocation by prefixing the pattern +you enter with \"-r\"." + :type 'string + :group 'helm-locate) + +(defcustom helm-locate-create-db-command + "updatedb -l 0 -o %s -U %s" + "Command used to create a locale locate db file." + :type 'string + :group 'helm-locate) + +(defcustom helm-locate-case-fold-search helm-case-fold-search + "It have the same meaning as `helm-case-fold-search'. +The -i option of locate will be used depending of value of +`helm-pattern' when this is set to 'smart. +When nil \"-i\" will not be used at all. +and when non--nil it will always be used. +NOTE: the -i option of the \"es\" command used on windows does +the opposite of \"locate\" command." + :group 'helm-locate + :type 'symbol) + + +(defvar helm-generic-files-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) + (define-key map (kbd "C-s") 'helm-ff-run-grep) + (define-key map (kbd "M-g s") 'helm-ff-run-grep) + (define-key map (kbd "M-g z") 'helm-ff-run-zgrep) + (define-key map (kbd "M-g p") 'helm-ff-run-pdfgrep) + (define-key map (kbd "M-D") 'helm-ff-run-delete-file) + (define-key map (kbd "C-=") 'helm-ff-run-ediff-file) + (define-key map (kbd "C-c =") 'helm-ff-run-ediff-merge-file) + (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window) + (define-key map (kbd "M-i") 'helm-ff-properties-persistent) + (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally) + (define-key map (kbd "C-c X") 'helm-ff-run-open-file-with-default-tool) + (define-key map (kbd "M-.") 'helm-ff-run-etags) + (define-key map (kbd "C-w") 'helm-yank-text-at-point) + (define-key map (kbd "C-c @") 'helm-ff-run-insert-org-link) + (define-key map (kbd "C-c ?") 'helm-generic-file-help) + map) + "Generic Keymap for files.") + + +(defface helm-locate-finish + '((t (:foreground "Green"))) + "Face used in mode line when locate process is finish." + :group 'helm-locate) + + +(defun helm-ff-find-locatedb (&optional from-ff) + "Try to find if a local locatedb file is available. +The search is done in `helm-ff-default-directory' or +fall back to `default-directory' if FROM-FF is nil." + (when helm-ff-locate-db-filename + (cond ((and helm-ff-default-directory + from-ff + (file-exists-p (expand-file-name + helm-ff-locate-db-filename + helm-ff-default-directory)) + (expand-file-name + helm-ff-locate-db-filename + helm-ff-default-directory))) + ((and (not from-ff) + (file-exists-p (expand-file-name + helm-ff-locate-db-filename + default-directory)) + (expand-file-name + helm-ff-locate-db-filename + default-directory)))))) + +(defun helm-locate-1 (&optional localdb init from-ff default) + "Generic function to run Locate. +Prefix arg LOCALDB when (4) search and use a local locate db file when it +exists or create it, when (16) force update of existing db file +even if exists. +It have no effect when locate command is 'es'. +INIT is a string to use as initial input in prompt. +See `helm-locate-with-db' and `helm-locate'." + (require 'helm-mode) + (let ((pfn #'(lambda (candidate) + (if (file-directory-p candidate) + (message "Error: The locate Db should be a file") + (if (= (shell-command + (format helm-locate-create-db-command + candidate + helm-ff-default-directory)) + 0) + (message "New locatedb file `%s' created" candidate) + (error "Failed to create locatedb file `%s'" candidate))))) + (locdb (and localdb + (not (string-match "^es" helm-locate-command)) + (or (and (equal '(4) localdb) + (helm-ff-find-locatedb from-ff)) + (helm-read-file-name + "Create Locate Db file: " + :initial-input (expand-file-name "locate.db" + (or helm-ff-default-directory + default-directory)) + :preselect helm-locate-db-file-regexp + :test #'(lambda (x) + (if helm-locate-db-file-regexp + ;; Select only locate db files and directories + ;; to allow navigation. + (or (string-match + helm-locate-db-file-regexp x) + (file-directory-p x)) + x))))))) + (when (and locdb (or (equal localdb '(16)) + (not (file-exists-p locdb)))) + (funcall pfn locdb)) + (helm-locate-with-db (and localdb locdb) init default))) + +(defun helm-locate-set-command () + "Setup `helm-locate-command' if not already defined." + (unless helm-locate-command + (setq helm-locate-command + (cl-case system-type + (gnu/linux "locate %s -e -r %s") + (berkeley-unix "locate %s %s") + (windows-nt "es %s %s") + (t "locate %s %s"))))) + +(defvar helm-file-name-history nil) +(defun helm-locate-with-db (&optional db initial-input default) + "Run locate -d DB. +If DB is not given or nil use locate without -d option. +Argument DB can be given as a string or list of db files. +Argument INITIAL-INPUT is a string to use as initial-input. +See also `helm-locate'." + (when (and db (stringp db)) (setq db (list db))) + (helm-locate-set-command) + (let ((helm-ff-transformer-show-only-basename nil) + (helm-locate-command + (if db + (replace-regexp-in-string + "locate" + (format "locate -d %s" + (mapconcat 'identity + ;; Remove eventually + ;; marked directories by error. + (cl-loop for i in db + unless (file-directory-p i) + collect i) ":")) + helm-locate-command) + helm-locate-command))) + (setq helm-file-name-history (mapcar 'helm-basename file-name-history)) + (helm :sources 'helm-source-locate + :buffer "*helm locate*" + :input initial-input + :default default + :history 'helm-file-name-history))) + +(defun helm-locate-init () + "Initialize async locate process for `helm-source-locate'." + (let* ((locate-is-es (string-match "\\`es" helm-locate-command)) + (real-locate (string-match "\\`locate" helm-locate-command)) + (case-sensitive-flag (if locate-is-es "-i" "")) + (ignore-case-flag (if (or locate-is-es + (not real-locate)) "" "-i")) + process-connection-type + (args (split-string helm-pattern " "))) + (prog1 + (start-process-shell-command + "locate-process" helm-buffer + (format helm-locate-command + (cl-case helm-locate-case-fold-search + (smart (let ((case-fold-search nil)) + (if (string-match "[[:upper:]]" helm-pattern) + case-sensitive-flag + ignore-case-flag))) + (t (if helm-locate-case-fold-search + ignore-case-flag + case-sensitive-flag))) + (concat + ;; The pattern itself. + (shell-quote-argument (car args)) " " + ;; Possible locate args added + ;; after pattern, don't quote them. + (mapconcat 'identity (cdr args) " ")))) + (set-process-sentinel + (get-buffer-process helm-buffer) + #'(lambda (_process event) + (if (string= event "finished\n") + (with-helm-window + (setq mode-line-format + '(" " mode-line-buffer-identification " " + (:eval (format "L%s" (helm-candidate-number-at-point))) " " + (:eval (propertize + (format "[Locate Process Finish- (%s results)]" + (max (1- (count-lines + (point-min) (point-max))) + 0)) + 'face 'helm-locate-finish)))) + (force-mode-line-update)) + (helm-log "Error: Locate %s" + (replace-regexp-in-string "\n" "" event)))))))) + +(defvar helm-source-locate + `((name . "Locate") + (init . helm-locate-set-command) + (candidates-process . helm-locate-init) + (type . file) + (requires-pattern . 3) + (history . ,'helm-file-name-history) + (keymap . ,helm-generic-files-map) + (help-message . helm-generic-file-help-message) + (candidate-number-limit . 9999) + (no-matchplugin) + (mode-line . helm-generic-file-mode-line-string)) + "Find files matching the current input pattern with locate.") + +;;;###autoload +(defun helm-locate-read-file-name (prompt) + (let* (helm-ff-transformer-show-only-basename + (src `((name . "Locate read fname") + (init . helm-locate-set-command) + (candidates-process . helm-locate-init) + (action . identity) + (requires-pattern . 3) + (history . ,'helm-file-name-history) + (candidate-transformer . (helm-skip-boring-files + helm-highlight-files)) + (candidate-number-limit . 9999) + (no-matchplugin)))) + (or (helm :sources src + :prompt prompt + :buffer "*helm locate read fname*" + :resume 'noresume) + (keyboard-quit)))) + +;;;###autoload +(defun helm-locate (arg) + "Preconfigured `helm' for Locate. +Note: you can add locate options after entering pattern. +See 'man locate' for valid options and also `helm-locate-command'. + +You can specify a local database with prefix argument ARG. +With two prefix arg, refresh the current local db or create it +if it doesn't exists. +Many databases can be used: navigate and mark them. +See also `helm-locate-with-db'. + +To create a user specific db, use +\"updatedb -l 0 -o db_path -U directory\". +Where db_path is a filename matched by +`helm-locate-db-file-regexp'." + (interactive "P") + (setq helm-ff-default-directory default-directory) + (helm-locate-1 arg)) + +(provide 'helm-locate) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-locate.el ends here diff --git a/elpa/helm-20140808.2300/helm-locate.elc b/elpa/helm-20140808.2300/helm-locate.elc new file mode 100644 index 000000000..2b4d1fdfe Binary files /dev/null and b/elpa/helm-20140808.2300/helm-locate.elc differ diff --git a/elpa/helm-20140808.2300/helm-man.el b/elpa/helm-20140808.2300/helm-man.el new file mode 100644 index 000000000..e0692e322 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-man.el @@ -0,0 +1,102 @@ +;;; helm-man.el --- Man and woman UI -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) + +(declare-function woman-file-name-all-completions "woman.el" (topic)) +(declare-function Man-getpage-in-background "man.el" (topic)) +(declare-function helm-generic-sort-fn "helm-utils.el" (S1 S2)) + +(defgroup helm-man nil + "Man and Woman applications for helm." + :group 'helm) + +(defcustom helm-man-or-woman-function 'Man-getpage-in-background + "Default command to display a man page." + :group 'helm-man + :type '(radio :tag "Preferred command to display a man page" + (const :tag "Man" Man-getpage-in-background) + (const :tag "Woman" woman))) + +;; Internal +(defvar helm-man-pages nil + "All man pages on system. +Will be calculated the first time you invoke helm with this +source.") + +(defun helm-man-default-action (candidate) + "Default action for jumping to a woman or man page from helm." + (let ((wfiles (mapcar + 'car (woman-file-name-all-completions candidate)))) + (condition-case nil + (if (> (length wfiles) 1) + (let ((file (helm-comp-read + "ManFile: " wfiles :must-match t))) + (if (eq helm-man-or-woman-function 'Man-getpage-in-background) + (manual-entry (format "-l %s" file)) + (woman-find-file file))) + (funcall helm-man-or-woman-function candidate)) + ;; If woman is unable to format correctly + ;; use man instead. + (error (kill-buffer) ; Kill woman buffer. + (Man-getpage-in-background candidate))))) + +(defvar helm-source-man-pages + '((name . "Manual Pages") + (init . (lambda () + (require 'woman) + (require 'helm-utils) + (unless helm-man-pages + (setq helm-man-pages + (ignore-errors + (woman-file-name "" t) + (sort (mapcar 'car woman-topic-all-completions) + 'string-lessp)))) + (helm-init-candidates-in-buffer 'global helm-man-pages))) + (candidates-in-buffer) + (persistent-action . ignore) + (filtered-candidate-transformer + . (lambda (candidates _source) + (sort candidates #'helm-generic-sort-fn))) + (action . (("Display Man page" . helm-man-default-action))) + ;; Woman does not work OS X + ;; http://xahlee.org/emacs/modernization_man_page.html + (action-transformer . (lambda (actions candidate) + (if (eq system-type 'darwin) + '(("Display Man page" . man)) + actions))))) + +;;;###autoload +(defun helm-man-woman (arg) + "Preconfigured `helm' for Man and Woman pages. +With a prefix arg reinitialize the cache." + (interactive "P") + (when arg (setq helm-man-pages nil)) + (helm-other-buffer 'helm-source-man-pages "*Helm man woman*")) + +(provide 'helm-man) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-man.el ends here diff --git a/elpa/helm-20140808.2300/helm-man.elc b/elpa/helm-20140808.2300/helm-man.elc new file mode 100644 index 000000000..d2a65eb2e Binary files /dev/null and b/elpa/helm-20140808.2300/helm-man.elc differ diff --git a/elpa/helm-20140808.2300/helm-match-plugin.el b/elpa/helm-20140808.2300/helm-match-plugin.el new file mode 100644 index 000000000..60d2ce290 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-match-plugin.el @@ -0,0 +1,437 @@ +;;; helm-match-plugin.el --- Multiple regexp matching methods for helm -*- lexical-binding: t -*- + +;; Original Author: rubikitch + +;; Copyright (C) 2008 ~ 2011 rubikitch +;; Copyright (C) 2011 ~ 2014 Thierry Volpiatto + +;; Author: Thierry Volpiatto +;; URL: http://github.com/emacs-helm/helm + +;; 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 . + +;;; Code: + +(require 'helm) +(require 'cl-lib) + +;;;; Match-plugin + +;; Internal +(defvar helm-mp-default-match-functions nil) +(defvar helm-mp-default-search-functions nil) +(defvar helm-mp-default-search-backward-functions nil) + +(defun helm-mp-set-matching-method (var key) + "Default function to set matching methods in helm match plugin." + (set-default var key) + (cl-case (symbol-value var) + (multi1 (setq helm-mp-default-match-functions + '(helm-mp-exact-match helm-mp-1-match) + helm-mp-default-search-functions + '(helm-mp-exact-search helm-mp-1-search) + helm-mp-default-search-backward-functions + '(helm-mp-exact-search-backward + helm-mp-1-search-backward))) + (multi2 (setq helm-mp-default-match-functions + '(helm-mp-exact-match helm-mp-2-match) + helm-mp-default-search-functions + '(helm-mp-exact-search helm-mp-2-search) + helm-mp-default-search-backward-functions + '(helm-mp-exact-search-backward + helm-mp-2-search-backward))) + (multi3 (setq helm-mp-default-match-functions + '(helm-mp-exact-match helm-mp-3-match) + helm-mp-default-search-functions + '(helm-mp-exact-search helm-mp-3-search) + helm-mp-default-search-backward-functions + '(helm-mp-exact-search-backward + helm-mp-3-search-backward))) + (multi3p (setq helm-mp-default-match-functions + '(helm-mp-exact-match helm-mp-3p-match) + helm-mp-default-search-functions + '(helm-mp-exact-search helm-mp-3p-search) + helm-mp-default-search-backward-functions + '(helm-mp-exact-search-backward + helm-mp-3p-search-backward))) + (t (error "Unknown value: %s" helm-mp-matching-method)))) + +(defgroup helm-match-plugin nil + "Helm match plugin." + :group 'helm) + +(defcustom helm-mp-matching-method 'multi3 + "Matching method for helm match plugin. +You can set here different methods to match candidates in helm. +Here are the possible value of this symbol and their meaning: +- multi1: Respect order, prefix of pattern must match. +- multi2: Same but with partial match. +- multi3: The best, multiple regexp match, allow negation. +- multi3p: Same but prefix must match. +Default is multi3." + :type '(radio :tag "Matching methods for helm" + (const :tag "Multiple regexp 1 ordered with prefix match" multi1) + (const :tag "Multiple regexp 2 ordered with partial match" multi2) + (const :tag "Multiple regexp 3 matching no order, partial, best." multi3) + (const :tag "Multiple regexp 3p matching with prefix match" multi3p)) + :set 'helm-mp-set-matching-method + :group 'helm-match-plugin) + +(defface helm-match + '((t (:inherit match))) + "Face used to highlight matches." + :group 'helm-match-plugin) + +(defcustom helm-mp-highlight-delay 0.7 + "Highlight matches with `helm-match' face after this many seconds. + If nil, no highlight. " + :type 'integer + :group 'helm-match-plugin) + +(defcustom helm-mp-highlight-threshold 2 + "Minimum length of pattern to highlight. +The smaller this value is, the slower highlight is." + :type 'integer + :group 'helm-match-plugin) + +;;;###autoload +(define-minor-mode helm-match-plugin-mode + "Add more flexible regexp matching for helm. +See `helm-mp-matching-method' for the behavior of each method." + :group 'helm-match-plugin + :require 'helm-match-plugin + :global t + (if helm-match-plugin-mode + (progn + (add-to-list 'helm-compile-source-functions 'helm-compile-source--match-plugin) + (add-hook 'helm-update-hook 'helm-mp-highlight-match)) + (setq helm-compile-source-functions + (delq 'helm-compile-source--match-plugin + helm-compile-source-functions)) + (remove-hook 'helm-update-hook 'helm-mp-highlight-match))) + + +;;; Build regexps +;; +;; +(defvar helm-mp-space-regexp "[\\ ] " + "Regexp to represent space itself in multiple regexp match.") + +(defun helm-mp-split-pattern (pattern) + "Split PATTERN if it contain spaces and return resulting list. +If spaces in PATTERN are escaped, don't split at this place. +i.e \"foo bar\"=> (\"foo\" \"bar\") +but \"foo\ bar\"=> (\"foobar\")." + (if (string= pattern "") + '("") + (cl-loop for s in (split-string + (replace-regexp-in-string helm-mp-space-regexp + "\000\000" pattern) + " " t) + collect (replace-regexp-in-string "\000\000" " " s)))) + +(defun helm-mp-1-make-regexp (pattern) + "Replace spaces in PATTERN with \"\.*\"." + (mapconcat 'identity (helm-mp-split-pattern pattern) ".*")) + + +;;; Exact match. +;; +;; +;; Internal. +(defvar helm-mp-exact-pattern-str nil) +(defvar helm-mp-exact-pattern-real nil) + +(defun helm-mp-exact-get-pattern (pattern) + (unless (equal pattern helm-mp-exact-pattern-str) + (setq helm-mp-exact-pattern-str pattern + helm-mp-exact-pattern-real (concat "\n" pattern "\n"))) + helm-mp-exact-pattern-real) + + +(defun helm-mp-exact-match (str &optional pattern) + (string= str (or pattern helm-pattern))) + +(defun helm-mp-exact-search (pattern &rest _ignore) + (and (search-forward (helm-mp-exact-get-pattern pattern) nil t) + (forward-line -1))) + +(defun helm-mp-exact-search-backward (pattern &rest _ignore) + (and (search-backward (helm-mp-exact-get-pattern pattern) nil t) + (forward-line 1))) + + +;;; Prefix match +;; +;; +;; Internal +(defvar helm-mp-prefix-pattern-str nil) +(defvar helm-mp-prefix-pattern-real nil) + +(defun helm-mp-prefix-get-pattern (pattern) + (unless (equal pattern helm-mp-prefix-pattern-str) + (setq helm-mp-prefix-pattern-str pattern + helm-mp-prefix-pattern-real (concat "\n" pattern))) + helm-mp-prefix-pattern-real) + +(defun helm-mp-prefix-match (str &optional pattern) + (setq pattern (or pattern helm-pattern)) + (let ((len (length pattern))) + (and (<= len (length str)) + (string= (substring str 0 len) pattern )))) + +(defun helm-mp-prefix-search (pattern &rest _ignore) + (search-forward (helm-mp-prefix-get-pattern pattern) nil t)) + +(defun helm-mp-prefix-search-backward (pattern &rest _ignore) + (and (search-backward (helm-mp-prefix-get-pattern pattern) nil t) + (forward-line 1))) + + +;;; Multiple regexp patterns 1 (order is preserved / prefix). +;; +;; +;; Internal +(defvar helm-mp-1-pattern-str nil) +(defvar helm-mp-1-pattern-real nil) + +(defun helm-mp-1-get-pattern (pattern) + (unless (equal pattern helm-mp-1-pattern-str) + (setq helm-mp-1-pattern-str pattern + helm-mp-1-pattern-real + (concat "^" (helm-mp-1-make-regexp pattern)))) + helm-mp-1-pattern-real) + +(cl-defun helm-mp-1-match (str &optional (pattern helm-pattern)) + (string-match (helm-mp-1-get-pattern pattern) str)) + +(defun helm-mp-1-search (pattern &rest _ignore) + (re-search-forward (helm-mp-1-get-pattern pattern) nil t)) + +(defun helm-mp-1-search-backward (pattern &rest _ignore) + (re-search-backward (helm-mp-1-get-pattern pattern) nil t)) + + +;;; Multiple regexp patterns 2 (order is preserved / partial). +;; +;; +;; Internal +(defvar helm-mp-2-pattern-str nil) +(defvar helm-mp-2-pattern-real nil) + +(defun helm-mp-2-get-pattern (pattern) + (unless (equal pattern helm-mp-2-pattern-str) + (setq helm-mp-2-pattern-str pattern + helm-mp-2-pattern-real + (concat "^.*" (helm-mp-1-make-regexp pattern)))) + helm-mp-2-pattern-real) + +(cl-defun helm-mp-2-match (str &optional (pattern helm-pattern)) + (string-match (helm-mp-2-get-pattern pattern) str)) + +(defun helm-mp-2-search (pattern &rest _ignore) + (re-search-forward (helm-mp-2-get-pattern pattern) nil t)) + +(defun helm-mp-2-search-backward (pattern &rest _ignore) + (re-search-backward (helm-mp-2-get-pattern pattern) nil t)) + + +;;; Multiple regexp patterns 3 (permutation). +;; +;; +;; Internal +(defvar helm-mp-3-pattern-str nil) +(defvar helm-mp-3-pattern-list nil) + +(defun helm-mp-3-get-patterns (pattern) + "Return `helm-mp-3-pattern-list', a list of predicate/regexp cons cells. +e.g ((identity . \"foo\") (identity . \"bar\")). +This is done only if `helm-mp-3-pattern-str' is same as PATTERN." + (unless (equal pattern helm-mp-3-pattern-str) + (setq helm-mp-3-pattern-str pattern + helm-mp-3-pattern-list + (helm-mp-3-get-patterns-internal pattern))) + helm-mp-3-pattern-list) + +(defun helm-mp-3-get-patterns-internal (pattern) + "Return a list of predicate/regexp cons cells. +e.g ((identity . \"foo\") (identity . \"bar\"))." + (unless (string= pattern "") + (cl-loop for pat in (helm-mp-split-pattern pattern) + collect (if (string= "!" (substring pat 0 1)) + (cons 'not (substring pat 1)) + (cons 'identity pat))))) + +(defun helm-mp-3-match (str &optional pattern) + "Check if PATTERN match STR. +When PATTERN contain a space, it is splitted and matching is done +with the several resulting regexps against STR. +e.g \"bar foo\" will match \"foobar\" and \"barfoo\". +Argument PATTERN, a string, is transformed in a list of +cons cell with `helm-mp-3-get-patterns' if it contain a space. +e.g \"foo bar\"=>((identity . \"foo\") (identity . \"bar\")). +Then each predicate of cons cell(s) is called with regexp of same +cons cell against STR (a candidate). +i.e (identity (string-match \"foo\" \"foo bar\")) => t." + (let ((pat (helm-mp-3-get-patterns (or pattern helm-pattern)))) + (cl-loop for (predicate . regexp) in pat + always (funcall predicate (string-match regexp str))))) + +(defun helm-mp-3-search-base (pattern searchfn1 searchfn2) + "Try to find PATTERN in `helm-buffer' with SEARCHFN1 and SEARCHFN2. +This is the search function for `candidates-in-buffer' enabled sources. +Use the same method as `helm-mp-3-match' except it search in buffer +instead of matching on a string. +i.e (identity (re-search-forward \"foo\" (point-at-eol) t)) => t." + (cl-loop with pat = (if (stringp pattern) + (helm-mp-3-get-patterns pattern) + pattern) + while (funcall searchfn1 (or (cdar pat) "") nil t) + for bol = (point-at-bol) + for eol = (point-at-eol) + if (cl-loop for (pred . str) in (cdr pat) always + (progn (goto-char bol) + (funcall pred (funcall searchfn2 str eol t)))) + do (goto-char eol) and return t + else do (goto-char eol) + finally return nil)) + +(defun helm-mp-3-search (pattern &rest _ignore) + (when (stringp pattern) + (setq pattern (helm-mp-3-get-patterns pattern))) + (helm-mp-3-search-base + pattern 're-search-forward 're-search-forward)) + +(defun helm-mp-3-search-backward (pattern &rest _ignore) + (when (stringp pattern) + (setq pattern (helm-mp-3-get-patterns pattern))) + (helm-mp-3-search-base + pattern 're-search-backward 're-search-backward)) + + +;;; mp-3p- (multiple regexp pattern 3 with prefix search) +;; +;; +(defun helm-mp-3p-match (str &optional pattern) + "Check if PATTERN match STR. +Same as `helm-mp-3-match' but more strict, matching against prefix also. +e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to +`helm-mp-3-match'." + (let* ((pat (helm-mp-3-get-patterns (or pattern helm-pattern))) + (first (car pat))) + (and (funcall (car first) (helm-mp-prefix-match str (cdr first))) + (cl-loop for (predicate . regexp) in (cdr pat) + always (funcall predicate (string-match regexp str)))))) + +(defun helm-mp-3p-search (pattern &rest _ignore) + (when (stringp pattern) + (setq pattern (helm-mp-3-get-patterns pattern))) + (helm-mp-3-search-base + pattern 'helm-mp-prefix-search 're-search-forward)) + +(defun helm-mp-3p-search-backward (pattern &rest _ignore) + (when (stringp pattern) + (setq pattern (helm-mp-3-get-patterns pattern))) + (helm-mp-3-search-base + pattern 'helm-mp-prefix-search-backward 're-search-backward)) + + +;;; source compiler +;; +;; +(defun helm-compile-source--match-plugin (source) + (if (assoc 'no-matchplugin source) + source + (let* ((searchers (if (assoc 'search-from-end source) + helm-mp-default-search-backward-functions + helm-mp-default-search-functions)) + (defmatch (helm-aif (assoc-default 'match source) + (helm-mklist it))) + (defmatch-strict (helm-aif (assoc-default 'match-strict source) + (helm-mklist it))) + (defsearch (helm-aif (assoc-default 'search source) + (helm-mklist it))) + (defsearch-strict (helm-aif (assoc-default 'search-strict source) + (helm-mklist it))) + (matchfns (cond (defmatch-strict) + (defmatch + (append helm-mp-default-match-functions defmatch)) + (t helm-mp-default-match-functions))) + (searchfns (cond (defsearch-strict) + (defsearch + (append searchers defsearch)) + (t searchers)))) + `(,(if (or (assoc 'candidates-in-buffer source) + (equal '(identity) matchfns)) + '(match identity) `(match ,@matchfns)) + (search ,@searchfns) + ,@source)))) + + +;;; Highlight matches. +;; +;; +(defun helm-mp-highlight-match () + "Highlight matches after `helm-mp-highlight-delay' seconds." + (unless (or (assoc 'nohighlight (helm-get-current-source)) + (not helm-mp-highlight-delay) + (helm-empty-buffer-p) + (string= helm-pattern "")) + (helm-mp-highlight-match-internal (window-end (helm-window))) + (run-with-idle-timer helm-mp-highlight-delay nil + 'helm-mp-highlight-match-internal + (with-current-buffer helm-buffer (point-max))))) + +(defun helm-mp-highlight-region (start end regexp face) + (save-excursion + (goto-char start) + (let ((case-fold-search (helm-set-case-fold-search regexp)) me) + (condition-case _err + (while (and (setq me (re-search-forward regexp nil t)) + (< (point) end) + (< 0 (- (match-end 0) (match-beginning 0)))) + (unless (helm-pos-header-line-p) + (put-text-property (match-beginning 0) me 'face face))) + (invalid-regexp nil))))) + +(defun helm-mp-highlight-match-internal (end) + (when helm-alive-p + (set-buffer helm-buffer) + (let ((requote (cl-loop for (pred . re) in + (helm-mp-3-get-patterns helm-pattern) + when (and (eq pred 'identity) + (>= (length re) + helm-mp-highlight-threshold)) + collect re into re-list + finally return + (if (and re-list (>= (length re-list) 1)) + (mapconcat 'identity re-list "\\|") + (regexp-quote helm-pattern))))) + (when (>= (length requote) helm-mp-highlight-threshold) + (helm-mp-highlight-region + (point-min) end requote 'helm-match))))) + +;; Enable match-plugin by default. +(helm-match-plugin-mode 1) + +(provide 'helm-match-plugin) + + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-match-plugin.el ends here diff --git a/elpa/helm-20140808.2300/helm-match-plugin.elc b/elpa/helm-20140808.2300/helm-match-plugin.elc new file mode 100644 index 000000000..b698df0c4 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-match-plugin.elc differ diff --git a/elpa/helm-20140808.2300/helm-misc.el b/elpa/helm-20140808.2300/helm-misc.el new file mode 100644 index 000000000..043a0462a --- /dev/null +++ b/elpa/helm-20140808.2300/helm-misc.el @@ -0,0 +1,402 @@ +;;; helm-misc.el --- Various functions for helm -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) + + +(defgroup helm-misc nil + "Various Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-time-zone-home-location "Paris" + "The time zone of your home" + :group 'helm-misc + :type 'string) + +(defcustom helm-mini-default-sources '(helm-source-buffers-list + helm-source-recentf + helm-source-buffer-not-found) + "Default sources list used in `helm-mini'." + :group 'helm-misc + :type '(repeat (choice symbol))) + +(defface helm-time-zone-current + '((t (:foreground "green"))) + "Face used to colorize current time in `helm-world-time'." + :group 'helm-misc) + +(defface helm-time-zone-home + '((t (:foreground "red"))) + "Face used to colorize home time in `helm-world-time'." + :group 'helm-misc) + + +;;; Latex completion +(defvar LaTeX-math-menu) +(defun helm-latex-math-candidates () + "Collect candidates for latex math completion." + (cl-loop for i in (cddr LaTeX-math-menu) + for elm = (cl-loop for s in i when (vectorp s) + collect (cons (aref s 0) (aref s 1))) + append elm)) + +(defvar helm-source-latex-math + '((name . "Latex Math Menu") + (init . (lambda () + (with-helm-current-buffer + (LaTeX-math-mode 1)))) + (candidate-number-limit . 9999) + (candidates . helm-latex-math-candidates) + (action . (lambda (candidate) + (call-interactively candidate))))) + + +;;;; +(defvar helm-source-fixme + '((name . "TODO/FIXME/DRY comments") + (headline . "^.*\\<\\(TODO\\|FIXME\\|DRY\\)\\>.*$") + (adjust) + (recenter)) + "Show TODO/FIXME/DRY comments in current file.") + +(defvar helm-source-rd-headline + '((name . "RD HeadLine") + (headline "^= \\(.+\\)$" "^== \\(.+\\)$" "^=== \\(.+\\)$" "^==== \\(.+\\)$") + (condition . (memq major-mode '(rdgrep-mode rd-mode))) + (migemo) + (subexp . 1)) + "Show RD headlines. + +RD is Ruby's POD. +http://en.wikipedia.org/wiki/Ruby_Document_format") + +(defvar helm-source-oddmuse-headline + '((name . "Oddmuse HeadLine") + (headline "^= \\(.+\\) =$" "^== \\(.+\\) ==$" + "^=== \\(.+\\) ===$" "^==== \\(.+\\) ====$") + (condition . (memq major-mode '(oddmuse-mode yaoddmuse-mode))) + (migemo) + (subexp . 1)) + "Show Oddmuse headlines, such as EmacsWiki.") + +(defvar helm-source-emacs-source-defun + '((name . "Emacs Source DEFUN") + (headline . "DEFUN\\|DEFVAR") + (condition . (string-match "/emacs2[0-9].+/src/.+c$" + (or buffer-file-name "")))) + "Show DEFUN/DEFVAR in Emacs C source file.") + +(defvar helm-source-emacs-lisp-expectations + '((name . "Emacs Lisp Expectations") + (headline . "(desc[ ]\\|(expectations") + (condition . (eq major-mode 'emacs-lisp-mode))) + "Show descriptions (desc) in Emacs Lisp Expectations. + +http://www.emacswiki.org/cgi-bin/wiki/download/el-expectations.el") + +(defvar helm-source-emacs-lisp-toplevels + '((name . "Emacs Lisp Toplevel / Level 4 Comment / Linkd Star") + (headline . "^(\\|(@\\*\\|^;;;;") + (get-line . buffer-substring) + (condition . (eq major-mode 'emacs-lisp-mode)) + (adjust)) + "Show top-level forms, level 4 comments and linkd stars (optional) in Emacs Lisp. +linkd.el is optional because linkd stars are extracted by regexp. +http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el") + + +;;; Eev anchors +(defvar helm-source-eev-anchor + '((name . "Anchors") + (candidates + . (lambda () + (ignore-errors + (with-helm-current-buffer + (cl-loop initially (goto-char (point-min)) + while (re-search-forward + (format ee-anchor-format "\\([^\.].+\\)") nil t) + for anchor = (match-string-no-properties 1) + collect (cons (format "%5d:%s" + (line-number-at-pos (match-beginning 0)) + (format ee-anchor-format anchor)) + anchor)))))) + (persistent-action . (lambda (item) + (ee-to item) + (helm-highlight-current-line))) + (persistent-help . "Show this entry") + (action . (("Goto link" . ee-to))))) + +;;; Jabber Contacts (jabber.el) +(defun helm-jabber-online-contacts () + "List online Jabber contacts." + (with-no-warnings + (cl-loop for item in (jabber-concat-rosters) + when (get item 'connected) + collect + (if (get item 'name) + (cons (get item 'name) item) + (cons (symbol-name item) item))))) + +(defvar helm-source-jabber-contacts + '((name . "Jabber Contacts") + (init . (lambda () (require 'jabber))) + (candidates . (lambda () (mapcar 'car (helm-jabber-online-contacts)))) + (action . (lambda (x) + (jabber-chat-with + (jabber-read-account) + (symbol-name + (cdr (assoc x (helm-jabber-online-contacts))))))))) + +;;; World time +;; +(defun helm-time-zone-transformer (candidates _source) + (cl-loop for i in candidates + collect + (cond ((string-match (format-time-string "%H:%M" (current-time)) i) + (propertize i 'face 'helm-time-zone-current)) + ((string-match helm-time-zone-home-location i) + (propertize i 'face 'helm-time-zone-home)) + (t i)))) + +(defvar helm-source-time-world + '((name . "Time World List") + (init . (lambda () + (require 'time) + (let ((helm-buffer (helm-candidate-buffer 'global))) + (with-current-buffer helm-buffer + (display-time-world-display display-time-world-list))))) + (candidates-in-buffer) + (filtered-candidate-transformer . helm-time-zone-transformer))) + +;;; LaCarte +;; +;; +(defun helm-create-lacarte-source (name &optional maps) + "Create lacarte source named NAME for MAPS. +MAPS is like in `lacarte-get-overall-menu-item-alist'. +See + http://www.emacswiki.org/cgi-bin/wiki/download/lacarte.el" + `((name . ,name) + (init . (lambda () (require 'lacarte))) + (candidates . (lambda () + (with-helm-current-buffer + (delete '(nil) (lacarte-get-overall-menu-item-alist ,@maps))))) + (candidate-transformer . helm-lacarte-candidate-transformer) + (candidate-number-limit . 9999) + (type . command))) + +(defun helm-lacarte-candidate-transformer (cands) + (mapcar (lambda (cand) + (let* ((item (car cand)) + (match (string-match "[^>] \\((.*)\\)$" item))) + (when match + (put-text-property (match-beginning 1) (match-end 1) + 'face 'helm-M-x-key item)) + cand)) + cands)) + +(defvar helm-source-lacarte (helm-create-lacarte-source "Lacarte") + "Helm interface for lacarte.el. +See + http://www.emacswiki.org/cgi-bin/wiki/download/lacarte.el") + +;;;###autoload +(defun helm-browse-menubar () + "Helm interface to the menubar using lacarte.el." + (interactive) + (require 'lacarte) + (helm :sources 'helm-source-lacarte :buffer "*helm lacarte*")) + +(defun helm-call-interactively (cmd-or-name) + "Execute CMD-OR-NAME as Emacs command. +It is added to `extended-command-history'. +`helm-current-prefix-arg' is used as the command's prefix argument." + (setq extended-command-history + (cons (helm-stringify cmd-or-name) + (delete (helm-stringify cmd-or-name) extended-command-history))) + (let ((current-prefix-arg helm-current-prefix-arg) + (cmd (helm-symbolify cmd-or-name))) + (if (stringp (symbol-function cmd)) + (execute-kbd-macro (symbol-function cmd)) + (setq this-command cmd) + (call-interactively cmd)))) + +;;; Minibuffer History +;; +;; +(defvar helm-source-minibuffer-history + '((name . "Minibuffer History") + (header-name . (lambda (name) + (format "%s (%s)" name minibuffer-history-variable))) + (candidates + . (lambda () + (let ((history (cl-loop for i in + (symbol-value minibuffer-history-variable) + unless (string= "" i) collect i))) + (if (consp (car history)) + (mapcar 'prin1-to-string history) + history)))) + (migemo) + (multiline) + (action . (lambda (candidate) + (delete-minibuffer-contents) + (insert candidate))))) + +;;; Shell history +;; +;; +(defun helm-comint-input-ring-action (candidate) + "Default action for comint history." + (with-helm-current-buffer + (delete-region (comint-line-beginning-position) (point-max)) + (insert candidate))) + +(defvar helm-source-comint-input-ring + '((name . "Comint history") + (candidates . (lambda () + (with-helm-current-buffer + (ring-elements comint-input-ring)))) + (action . helm-comint-input-ring-action)) + "Source that provide helm completion against `comint-input-ring'.") + + +;;; Helm ratpoison UI +;; +;; +(defvar helm-source-ratpoison-commands + '((name . "Ratpoison Commands") + (init . helm-ratpoison-commands-init) + (candidates-in-buffer) + (action ("Execute the command" . helm-ratpoison-commands-execute)) + (display-to-real . helm-ratpoison-commands-display-to-real) + (candidate-number-limit))) + +(defun helm-ratpoison-commands-init () + (unless (helm-candidate-buffer) + (with-current-buffer (helm-candidate-buffer 'global) + ;; with ratpoison prefix key + (save-excursion + (call-process "ratpoison" nil (current-buffer) nil "-c" "help")) + (while (re-search-forward "^\\([^ ]+\\) \\(.+\\)$" nil t) + (replace-match " \\1: \\2")) + (goto-char (point-max)) + ;; direct binding + (save-excursion + (call-process "ratpoison" nil (current-buffer) nil "-c" "help top")) + (while (re-search-forward "^\\([^ ]+\\) \\(.+\\)$" nil t) + (replace-match "\\1: \\2"))))) + +(defun helm-ratpoison-commands-display-to-real (display) + (and (string-match ": " display) + (substring display (match-end 0)))) + +(defun helm-ratpoison-commands-execute (candidate) + (call-process "ratpoison" nil nil nil "-ic" candidate)) + +;;; Helm stumpwm UI +;; +;; +(defvar helm-source-stumpwm-commands + '((name . "Stumpwm Commands") + (init . helm-stumpwm-commands-init) + (candidates-in-buffer) + (action ("Execute the command" . helm-stumpwm-commands-execute)) + (candidate-number-limit))) + +(defun helm-stumpwm-commands-init () + (with-current-buffer (helm-candidate-buffer 'global) + (save-excursion + (call-process "stumpish" nil (current-buffer) nil "commands")) + (while (re-search-forward "[ ]*\\([^ ]+\\)[ ]*\n?" nil t) + (replace-match "\n\\1\n")) + (delete-blank-lines) + (sort-lines nil (point-min) (point-max)) + (goto-char (point-max)))) + +(defun helm-stumpwm-commands-execute (candidate) + (call-process "stumpish" nil nil nil candidate)) + +;;;###autoload +(defun helm-world-time () + "Preconfigured `helm' to show world time." + (interactive) + (helm-other-buffer 'helm-source-time-world "*helm world time*")) + +;;;###autoload +(defun helm-insert-latex-math () + "Preconfigured helm for latex math symbols completion." + (interactive) + (helm-other-buffer 'helm-source-latex-math "*helm latex*")) + +;;;###autoload +(defun helm-eev-anchors () + "Preconfigured `helm' for eev anchors." + (interactive) + (helm-other-buffer 'helm-source-eev-anchor "*Helm eev anchors*")) + +;;;###autoload +(defun helm-ratpoison-commands () + "Preconfigured `helm' to execute ratpoison commands." + (interactive) + (helm-other-buffer 'helm-source-ratpoison-commands + "*helm ratpoison commands*")) + +;;;###autoload +(defun helm-stumpwm-commands() + (interactive) + (helm-other-buffer 'helm-source-stumpwm-commands + "*helm stumpwm commands*")) + + +;;;###autoload +(defun helm-mini () + "Preconfigured `helm' lightweight version \(buffer -> recentf\)." + (interactive) + (require 'helm-files) + (let ((helm-ff-transformer-show-only-basename nil)) + (helm-other-buffer helm-mini-default-sources "*helm mini*"))) + +;;;###autoload +(defun helm-minibuffer-history () + "Preconfigured `helm' for `minibuffer-history'." + (interactive) + (let ((enable-recursive-minibuffers t)) + (helm-other-buffer 'helm-source-minibuffer-history + "*helm minibuffer-history*"))) + +;;;###autoload +(defun helm-comint-input-ring () + "Predefined `helm' that provide completion of `comint' history." + (interactive) + (when (derived-mode-p 'comint-mode) + (helm :sources 'helm-source-comint-input-ring + :input (buffer-substring-no-properties (comint-line-beginning-position) + (point-at-eol)) + :buffer "*helm comint history*"))) + + +(provide 'helm-misc) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-misc.el ends here diff --git a/elpa/helm-20140808.2300/helm-misc.elc b/elpa/helm-20140808.2300/helm-misc.elc new file mode 100644 index 000000000..6ed42c108 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-misc.elc differ diff --git a/elpa/helm-20140808.2300/helm-mode.el b/elpa/helm-20140808.2300/helm-mode.el new file mode 100644 index 000000000..2dc238a26 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-mode.el @@ -0,0 +1,1042 @@ +;;; helm-mode.el --- Enable helm completion everywhere. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-files) + + +(defgroup helm-mode nil + "Enable helm completion." + :group 'helm) + +(defcustom helm-completing-read-handlers-alist + '((describe-function . helm-completing-read-symbols) + (describe-variable . helm-completing-read-symbols) + (debug-on-entry . helm-completing-read-symbols) + (find-function . helm-completing-read-symbols) + (find-tag . helm-completing-read-with-cands-in-buffer) + (ffap-alternate-file . nil) + (tmm-menubar . nil)) + "Alist of handlers to replace `completing-read', `read-file-name' in `helm-mode'. +Each entry is a cons cell like \(emacs_command . completing-read_handler\) +where key and value are symbols. + +Each key is an Emacs command that use originaly `completing-read'. + +Each value maybe an helm function that take same arguments as +`completing-read' plus NAME and BUFFER, where NAME is the name of the new +helm source and BUFFER the name of the buffer we will use. +This function prefix name must start by \"helm\". + +See `helm-completing-read-symbols' for example. + +Note that this function will be reused for ALL the `completing-read' +of this command, so it should handle all cases, e.g +If first `completing-read' complete against symbols and +second `completing-read' should handle only buffer, +your specialized function should handle the both. + +If the value of an entry is nil completion will fall back to +emacs vanilla behavior. +e.g If you want to disable helm completion for `describe-function': +\(describe-function . nil\). + +Ido is also supported, you can use `ido-completing-read' and +`ido-read-file-name' as value of an entry or just 'ido. +e.g ido completion for `find-file': +\(find-file . ido\) +same as +\(find-file . ido-read-file-name\) +Note that you don't need to enable `ido-mode' for this to work." + :group 'helm-mode + :type '(alist :key-type symbol :value-type symbol)) + +(defcustom helm-comp-read-case-fold-search helm-case-fold-search + "Default Local setting of `helm-case-fold-search' for `helm-comp-read'. +See `helm-case-fold-search' for more info." + :group 'helm-mode + :type 'symbol) + +(defcustom helm-mode-handle-completion-in-region t + "Whether to replace or not `completion-in-region-function'. +This enable support for `completing-read-multiple' and `completion-at-point' +when non--nil." + :group 'helm-mode + :type 'boolean) + +(defcustom helm-mode-reverse-history t + "Display history source after current source in `helm-mode' handled commands." + :group 'helm-mode + :type 'boolean) + + +(defvar helm-comp-read-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "") 'helm-cr-empty-string) + map) + "Keymap for `helm-comp-read'.") + + +;;; Internal +;; +;; +;; Flag to know if `helm-pattern' have been added +;; to candidate list in `helm-comp-read'. +(defvar helm-cr-unknown-pattern-flag nil) + + +;;; Helm `completing-read' replacement +;; +;; +(defun helm-cr-empty-string () + "Return empty string." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action + #'(lambda (_candidate) + (identity ""))))) + +(defun helm-comp-read-get-candidates (collection &optional test sort-fn alistp) + "Convert COLLECTION to list removing elements that don't match TEST. +See `helm-comp-read' about supported COLLECTION arguments. + +SORT-FN is a predicate to sort COLLECTION. + +ALISTP when non--nil will not use `all-completions' to collect +candidates because it doesn't handle alists correctly for helm. +i.e In `all-completions' the car of each pair is used as value. +In helm we want to use the cdr instead like \(display . real\), +so we return the alist as it is with no transformation by all-completions. + +e.g + +\(setq A '((a . 1) (b . 2) (c . 3))) +==>((a . 1) (b . 2) (c . 3)) +\(helm-comp-read \"test: \" A :alistp nil + :exec-when-only-one t + :initial-input \"a\") +==>\"a\" Which is not what we expect. + +\(helm-comp-read \"test: \" A :alistp t + :exec-when-only-one t + :initial-input \"1\") +==>\"1\" + +See docstring of `all-completions' for more info. + +If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." + + (let ((cands + (cond ((vectorp collection) + (all-completions "" collection test)) + ((and (symbolp collection) (boundp collection) + ;; Issue #324 history is let-bounded and given + ;; quoted as hist argument of completing-read. + ;; See example in `rcirc-browse-url'. + (symbolp (symbol-value collection))) + nil) + ;; When collection is a symbol, most of the time + ;; it should be a symbol used as a minibuffer-history. + ;; The value of this symbol in this case return a list + ;; of string which maybe are converted later as symbol + ;; in special cases. + ;; we treat here commandp as a special case as it return t + ;; also with a string unless its last arg is provided. + ;; Also, the history collections generally collect their + ;; elements as string, so intern them to call predicate. + ((and (symbolp collection) (boundp collection) test) + (let ((predicate `(lambda (elm) + (condition-case err + (if (eq (quote ,test) 'commandp) + (funcall (quote ,test) (intern elm)) + (funcall (quote ,test) elm)) + (wrong-type-argument + (funcall (quote ,test) (intern elm))))))) + (all-completions "" (symbol-value collection) predicate))) + ((and (symbolp collection) (boundp collection)) + (all-completions "" (symbol-value collection))) + ((and alistp test) + (cl-loop for i in collection when (funcall test i) collect i)) + (alistp collection) + (t (all-completions "" collection test))))) + (if sort-fn (sort cands sort-fn) cands))) + +(defun helm-cr-default-transformer (candidates _source) + "Default filter candidate function for `helm-comp-read'." + (cl-loop for c in candidates + for cand = (if (stringp c) (replace-regexp-in-string "\\s\\" "" c) c) + for pat = (replace-regexp-in-string "\\s\\" "" helm-pattern) + if (and (equal cand pat) helm-cr-unknown-pattern-flag) + collect + (cons (concat (propertize + " " 'display + (propertize "[?]" 'face 'helm-ff-prefix)) + c) + c) + into lst + else collect c into lst + finally return (helm-fast-remove-dups lst :test 'equal))) + +;;;###autoload +(cl-defun helm-comp-read (prompt collection + &key + test + initial-input + default + preselect + (buffer "*Helm Completions*") + must-match + reverse-history + (requires-pattern 0) + history + input-history + (case-fold helm-comp-read-case-fold-search) + (del-input t) + (persistent-action nil) + (persistent-help "DoNothing") + (mode-line helm-comp-read-mode-line) + (keymap helm-comp-read-map) + (name "Helm Completions") + candidates-in-buffer + exec-when-only-one + quit-when-no-cand + (volatile t) + sort + (fc-transformer 'helm-cr-default-transformer) + marked-candidates + nomark + (alistp t)) + "Read a string in the minibuffer, with helm completion. + +It is helm `completing-read' equivalent. + +- PROMPT is the prompt name to use. + +- COLLECTION can be a list, vector, obarray or hash-table. + It can be also a function that receives three arguments: + the values string, predicate and t. See `all-completions' for more details. + +Keys description: + +- TEST: A predicate called with one arg i.e candidate. + +- INITIAL-INPUT: Same as input arg in `helm'. + +- PRESELECT: See preselect arg of `helm'. + +- DEFAULT: This option is used only for compatibility with regular + Emacs `completing-read' (Same as DEFAULT arg of `completing-read'). + +- BUFFER: Name of helm-buffer. + +- MUST-MATCH: Candidate selected must be one of COLLECTION. + +- REVERSE-HISTORY: When non--nil display history source after current + source completion. + +- REQUIRES-PATTERN: Same as helm attribute, default is 0. + +- HISTORY: A list containing specific history, default is nil. + When it is non--nil, all elements of HISTORY are displayed in + a special source before COLLECTION. + +- INPUT-HISTORY: A symbol. the minibuffer input history will be + stored there, if nil or not provided, `minibuffer-history' + will be used instead. + +- CASE-FOLD: Same as `helm-case-fold-search'. + +- DEL-INPUT: Boolean, when non--nil (default) remove the partial + minibuffer input from HISTORY is present. + +- PERSISTENT-ACTION: A function called with one arg i.e candidate. + +- PERSISTENT-HELP: A string to document PERSISTENT-ACTION. + +- MODE-LINE: A string or list to display in mode line. + Default is `helm-comp-read-mode-line'. + +- KEYMAP: A keymap to use in this `helm-comp-read'. + (the keymap will be shared with history source) + +- NAME: The name related to this local source. + +- EXEC-WHEN-ONLY-ONE: Bound `helm-execute-action-at-once-if-one' + to non--nil. (possibles values are t or nil). + +- VOLATILE: Use volatile attribute \(enabled by default\). + +- SORT: A predicate to give to `sort' e.g `string-lessp'. + +- FC-TRANSFORMER: A `filtered-candidate-transformer' function. + +- MARKED-CANDIDATES: If non--nil return candidate or marked candidates as a list. + +- NOMARK: When non--nil don't allow marking candidates. + +- ALISTP: \(default is non--nil\) See `helm-comp-read-get-candidates'. + +- CANDIDATES-IN-BUFFER: when non--nil use a source build with + `helm-candidates-in-buffer' which is much faster. + Argument VOLATILE have no effect when CANDIDATES-IN-BUFFER is non--nil. + +Any prefix args passed during `helm-comp-read' invocation will be recorded +in `helm-current-prefix-arg', otherwise if prefix args were given before +`helm-comp-read' invocation, the value of `current-prefix-arg' will be used. +That's mean you can pass prefix args before or after calling a command +that use `helm-comp-read' See `helm-M-x' for example." + + (when (get-buffer helm-action-buffer) + (kill-buffer helm-action-buffer)) + (let ((action-fn `(("Sole action (Identity)" + . (lambda (candidate) + (if ,marked-candidates + (helm-marked-candidates) + (identity candidate))))))) + ;; Assume completion have been already required, + ;; so always use 'confirm. + (when (eq must-match 'confirm-after-completion) + (setq must-match 'confirm)) + (let* ((minibuffer-completion-confirm must-match) + (must-match-map (when must-match + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") + 'helm-confirm-and-exit-minibuffer) + map))) + (loc-map (if must-match-map + (make-composed-keymap + must-match-map (or keymap helm-map)) + (or keymap helm-map))) + (helm-read-file-name-mode-line-string + (replace-regexp-in-string "helm-maybe-exit-minibuffer" + "helm-confirm-and-exit-minibuffer" + helm-read-file-name-mode-line-string)) + (get-candidates (lambda () + (let ((cands (helm-comp-read-get-candidates + collection test sort alistp))) + (setq helm-cr-unknown-pattern-flag nil) + (unless (or (eq must-match t) (string= helm-pattern "") + (assoc helm-pattern cands) + (assoc (intern helm-pattern) cands) + (member helm-pattern cands)) + (setq cands (append (list helm-pattern) cands)) + (setq helm-cr-unknown-pattern-flag t)) + (if (and default (not (string= default ""))) + (delq nil (cons default (delete default cands))) + cands)))) + (history-get-candidates (lambda () + (let ((all (helm-comp-read-get-candidates + history test nil alistp))) + (when all + (delete + "" + (helm-fast-remove-dups + (if (and default (not (string= default ""))) + (delq nil (cons default + (delete default all))) + all) + :test 'equal)))))) + (src-hist `((name . ,(format "%s History" name)) + (candidates . ,history-get-candidates) + (filtered-candidate-transformer + . (lambda (candidates sources) + (cl-loop for i in candidates + ;; Input is added to history in completing-read's + ;; and may be regexp-quoted, so unquote it. + for cand = (replace-regexp-in-string "\\s\\" "" i) + do (set-text-properties 0 (length cand) nil cand) + collect cand))) + (persistent-action . ,persistent-action) + (persistent-help . ,persistent-help) + (keymap . ,loc-map) + (mode-line . ,mode-line) + (action . ,action-fn))) + (src `((name . ,name) + (candidates . ,get-candidates) + (filtered-candidate-transformer . ,fc-transformer) + (requires-pattern . ,requires-pattern) + (persistent-action . ,persistent-action) + (persistent-help . ,persistent-help) + (keymap . ,loc-map) + (mode-line . ,mode-line) + (action . ,action-fn))) + (src-1 `((name . ,name) + (init . (lambda () + (helm-init-candidates-in-buffer + 'global (funcall ',get-candidates)))) + (candidates-in-buffer) + (filtered-candidate-transformer . ,fc-transformer) + (requires-pattern . ,requires-pattern) + (persistent-action . ,persistent-action) + (persistent-help . ,persistent-help) + (keymap . ,loc-map) + (mode-line . ,mode-line) + (action . ,action-fn))) + (src-list (list src-hist + (if candidates-in-buffer + src-1 + (if volatile + (append src '((volatile))) + src)))) + (helm-execute-action-at-once-if-one exec-when-only-one) + (helm-quit-if-no-candidate quit-when-no-cand) + result) + (when nomark + (setq src-list (cl-loop for src in src-list + collect (cons '(nomark) src)))) + (when reverse-history (setq src-list (nreverse src-list))) + (setq result (helm + :sources src-list + :input initial-input + :default default + :preselect preselect + :prompt prompt + :resume 'noresume + :case-fold-search case-fold + :keymap loc-map + :history (and (symbolp input-history) input-history) + :buffer buffer)) + ;; Avoid adding an incomplete input to history. + (when (and result history del-input) + (cond ((and (symbolp history) ; History is a symbol. + (not (symbolp (symbol-value history)))) ; Fix Issue #324. + ;; Be sure history is not a symbol with a nil value. + (helm-aif (symbol-value history) (setcar it result))) + ((consp history) ; A list with a non--nil value. + (setcar history result)) + (t ; Possibly a symbol with a nil value. + (set history (list result))))) + (or + result + (when (and (eq helm-exit-status 0) + (eq must-match 'confirm)) + ;; Return empty string only if it is the DEFAULT + ;; value and helm-pattern is empty. + ;; otherwise return helm-pattern + (if (and (string= helm-pattern "") default) + default (identity helm-pattern))) + (unless (or (eq helm-exit-status 1) + must-match) ; FIXME this should not be needed now. + default) + (keyboard-quit))))) + +;; Generic completing-read +;; +;; Support also function as collection. +;; e.g M-x man is supported. +;; Support hash-table and vectors as collection. +;; NOTE: +;; Some crap emacs functions may not be supported +;; like ffap-alternate-file (bad use of completing-read) +;; and maybe others. +;; Provide a mode `helm-mode' which turn on +;; helm in all `completing-read' and `read-file-name' in Emacs. +;; +(defvar helm-completion-mode-string " Helm") + +(defvar helm-completion-mode-quit-message + "Helm completion disabled") + +(defvar helm-completion-mode-start-message + "Helm completion enabled") + +;;; Specialized handlers +;; +;; +(defun helm-completing-read-symbols + (prompt _collection test _require-match init + hist default _inherit-input-method name buffer) + "Specialized function for fast symbols completion in `helm-mode'." + (or + (helm + :sources `((name . ,name) + (init . (lambda () + (with-current-buffer (helm-candidate-buffer 'global) + (goto-char (point-min)) + (when (and ,default (stringp ,default) + ;; Some defaults args result as + ;; (symbol-name nil) == "nil". + ;; e.g debug-on-entry. + (not (string= ,default "nil")) + (not (string= ,default ""))) + (insert (concat ,default "\n"))) + (cl-loop for sym in (all-completions "" obarray ',test) + for s = (intern sym) + unless (or (and ,default (string= sym ,default)) + (keywordp s)) + do (insert (concat sym "\n")))))) + (persistent-action . helm-lisp-completion-persistent-action) + (persistent-help . "Show brief doc in mode-line") + (candidates-in-buffer) + (action . identity)) + :prompt prompt + :buffer buffer + :input init + :history hist + :resume 'noresume + :default (or default "")) + (keyboard-quit))) + + +;;; Generic completing read +;; +;; +(defun helm-completing-read-default-1 + (prompt collection test require-match + init hist default _inherit-input-method + name buffer &optional cands-in-buffer exec-when-only-one) + "Call `helm-comp-read' with same args as `completing-read'. +Extra optional arg CANDS-IN-BUFFER mean use `candidates-in-buffer' +method which is faster. +It should be used when candidate list don't need to rebuild dynamically." + (let ((history (or (car-safe hist) hist))) + (when (and default (listp default)) + ;; When DEFAULT is a list move the list on head of COLLECTION + ;; and set it to its car. #bugfix `grep-read-files'. + (setq collection (if (listp collection) + (append default collection) + ;; Else COLLECTION is maybe a function or a table. + (append default (all-completions "" collection)))) + (setq default (car default))) + (helm-comp-read + prompt collection + :test test + :history history + :reverse-history helm-mode-reverse-history + :input-history history + :must-match require-match + :alistp nil ; Be sure `all-completions' is used. + :name name + :requires-pattern (if (and (string= default "") + (or (eq require-match 'confirm) + (eq require-match + 'confirm-after-completion))) + 1 0) + :candidates-in-buffer cands-in-buffer + :exec-when-only-one exec-when-only-one + :buffer buffer + ;; If DEF is not provided, fallback to empty string + ;; to avoid `thing-at-point' to be appended on top of list + :default (or default "") + ;; Fail with special characters (e.g in gnus "nnimap+gmail:") + ;; if regexp-quote is not used. + ;; when init is added to history, it will be unquoted by + ; helm-comp-read. + :initial-input (and (stringp init) (regexp-quote init))))) + +(defun helm-completing-read-with-cands-in-buffer + (prompt collection test require-match + init hist default inherit-input-method + name buffer) + "Same as `helm-completing-read-default-1' but use candidates-in-buffer." + ;; Some commands like find-tag may use `read-file-name' from inside + ;; the calculation of collection. in this case it clash with + ;; candidates-in-buffer that reuse precedent data (files) which is wrong. + ;; So (re)calculate collection outside of main helm-session. + (let ((cands (all-completions "" collection))) + (helm-completing-read-default-1 prompt cands test require-match + init hist default inherit-input-method + name buffer t))) + +(cl-defun helm--completing-read-default + (prompt collection &optional + predicate require-match + initial-input hist def + inherit-input-method) + "An helm replacement of `completing-read'. +This function should be used only as a `completing-read-function'. + +Don't use it directly, use instead `helm-comp-read' in your programs. + +See documentation of `completing-read' and `all-completions' for details." + (let* ((current-command (or (helm-this-command) this-command)) + (str-command (if (consp current-command) ; Maybe a lambda. + "Anonymous" + (symbol-name current-command))) + (buf-name (format "*helm-mode-%s*" str-command)) + (entry (assq current-command + helm-completing-read-handlers-alist)) + (def-com (cdr-safe entry)) + (str-defcom (and def-com (symbol-name def-com))) + (def-args (list prompt collection predicate require-match + initial-input hist def inherit-input-method)) + ;; Append the two extra args needed to set the buffer and source name + ;; in helm specialized functions. + (any-args (append def-args (list str-command buf-name))) + helm-completion-mode-start-message ; Be quiet + helm-completion-mode-quit-message + ;; Be sure this pesty *completion* buffer doesn't popup. + ;; Note: `minibuffer-with-setup-hook' may setup a lambda + ;; calling `minibuffer-completion-help' or other minibuffer + ;; functions we DONT WANT here, in these cases removing the hook + ;; (a symbol) have no effect. Issue #448. + ;; But because `minibuffer-completion-table' and + ;; `minibuffer-completion-predicate' are not bound + ;; anymore here, these functions should have no effect now. + (minibuffer-setup-hook (remove 'minibuffer-completion-help + minibuffer-setup-hook)) + ;; Disable hack that could be used before `completing-read'. + ;; i.e (push ?\t unread-command-events). + unread-command-events) + (when (eq def-com 'ido) (setq def-com 'ido-completing-read)) + (unless (or (not entry) def-com) + ;; An entry in *read-handlers-alist exists but have + ;; a nil value, so we exit from here, disable `helm-mode' + ;; and run the command again with it original behavior. + ;; `helm-mode' will be restored on exit. + (cl-return-from helm--completing-read-default + (unwind-protect + (progn + (helm-mode -1) + (apply completing-read-function def-args)) + (helm-mode 1)))) + ;; If we use now `completing-read' we MUST turn off `helm-mode' + ;; to avoid infinite recursion and CRASH. It will be reenabled on exit. + (when (or (eq def-com 'completing-read) + ;; All specialized functions are prefixed by "helm" + (and (stringp str-defcom) + (not (string-match "^helm" str-defcom)))) + (helm-mode -1)) + (unwind-protect + (cond (;; An helm specialized function exists, run it. + (and def-com helm-mode) + (apply def-com any-args)) + (;; Try to handle `ido-completing-read' everywhere. + (and def-com (eq def-com 'ido-completing-read)) + (setcar (memq collection def-args) + (all-completions "" collection predicate)) + (apply def-com def-args)) + (;; User set explicitely `completing-read' or something similar + ;; in *read-handlers-alist, use this with exactly the same + ;; args as in `completing-read'. + ;; If we are here `helm-mode' is now disabled. + def-com + (apply def-com def-args)) + (t ; Fall back to classic `helm-comp-read'. + (helm-completing-read-default-1 + prompt collection predicate require-match + initial-input hist def inherit-input-method + str-command buf-name))) + (helm-mode 1) + ;; When exiting minibuffer, `this-command' is set to + ;; `helm-exit-minibuffer', which is unwanted when starting + ;; on another `completing-read', so restore `this-command' to + ;; initial value when exiting. + (setq this-command current-command)))) + +;;; Generic read-file-name +;; +;; +(cl-defun helm-read-file-name + (prompt + &key + (name "Read File Name") + (initial-input (expand-file-name default-directory)) + (buffer "*Helm file completions*") + test + (case-fold helm-file-name-case-fold-search) + preselect + history + must-match + default + marked-candidates + nomark + (alistp t) + (persistent-action 'helm-find-files-persistent-action) + (persistent-help "Hit1 Expand Candidate, Hit2 or (C-u) Find file") + (mode-line helm-read-file-name-mode-line-string)) + "Read a file name with helm completion. +It is helm `read-file-name' emulation. + +Argument PROMPT is the default prompt to use. + +Keys description: + +- NAME: Source name, default to \"Read File Name\". + +- INITIAL-INPUT: Where to start read file name, default to `default-directory'. + +- BUFFER: `helm-buffer' name default to \"*Helm Completions*\". + +- TEST: A predicate called with one arg 'candidate'. + +- CASE-FOLD: Same as `helm-case-fold-search'. + +- PRESELECT: helm preselection. + +- HISTORY: Display HISTORY in a special source. + +- MUST-MATCH: Can be 'confirm, nil, or t. + +- MARKED-CANDIDATES: When non--nil return a list of marked candidates. + +- NOMARK: When non--nil don't allow marking candidates. + +- ALISTP: Don't use `all-completions' in history (take effect only on history). + +- PERSISTENT-ACTION: a persistent action function. + +- PERSISTENT-HELP: persistent help message. + +- MODE-LINE: A mode line message, default is `helm-read-file-name-mode-line-string'." + + (when (get-buffer helm-action-buffer) + (kill-buffer helm-action-buffer)) + ;; Assume completion have been already required, + ;; so always use 'confirm. + (when (eq must-match 'confirm-after-completion) + (setq must-match 'confirm)) + (let* ((action-fn `(("Sole action (Identity)" + . (lambda (candidate) + (if ,marked-candidates + (helm-marked-candidates :with-wildcard t) + (identity candidate)))))) + (helm-mp-highlight-delay nil) + ;; Be sure we don't erase the underlying minibuffer if some. + (helm-ff-auto-update-initial-value + (and helm-ff-auto-update-initial-value + (not (minibuffer-window-active-p (minibuffer-window))))) + helm-full-frame + (hist (and history (helm-comp-read-get-candidates + history nil nil alistp))) + (minibuffer-completion-confirm must-match) + (must-match-map (when must-match + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") + 'helm-confirm-and-exit-minibuffer) + map))) + (cmap (if must-match-map + (make-composed-keymap + must-match-map helm-read-file-map) + helm-read-file-map)) + (helm-read-file-name-mode-line-string + (replace-regexp-in-string "helm-maybe-exit-minibuffer" + "helm-confirm-and-exit-minibuffer" + helm-read-file-name-mode-line-string)) + (src-list `(((name . ,(format "%s History" name)) + (header-name . (lambda (hname) + (concat hname + helm-find-files-doc-header))) + (mode-line . ,mode-line) + (candidates . ,hist) + (keymap . ,cmap) + (persistent-action . ,persistent-action) + (persistent-help . ,persistent-help) + (action . ,action-fn)) + ((name . ,name) + (header-name . (lambda (hname) + (concat hname + helm-find-files-doc-header))) + (init . (lambda () + (setq helm-ff-auto-update-flag + helm-ff-auto-update-initial-value) + (setq helm-ff-auto-update--state + helm-ff-auto-update-flag) + (helm-set-local-variable 'helm-in-file-completion-p t))) + (mode-line . ,mode-line) + (candidates + . (lambda () + (append (and (not (file-exists-p helm-pattern)) + (list helm-pattern)) + (if ',test + (cl-loop with hn = (helm-ff-tramp-hostnames) + for i in (helm-find-files-get-candidates + ',must-match) + when (or (member i hn) ; A tramp host + (funcall ',test i)) ; Test ok + collect i) + (helm-find-files-get-candidates ',must-match))))) + (filtered-candidate-transformer . helm-ff-sort-candidates) + (filter-one-by-one . helm-ff-filter-candidate-one-by-one) + (keymap . ,cmap) + (persistent-action . ,persistent-action) + (candidate-number-limit . 9999) + (persistent-help . ,persistent-help) + (volatile) + (action . ,action-fn)))) + (result (helm + :sources (if nomark + (cl-loop for src in src-list + collect (cons '(nomark) src)) + src-list) + :input initial-input + :prompt prompt + :resume 'noresume + :case-fold-search case-fold + :default default + :buffer buffer + :preselect preselect))) + (or + (cond ((and result (stringp result) + (string= result "") "")) + ((and result + (stringp result) + (file-equal-p result initial-input) + default) + default) + ((and result (stringp result)) + (expand-file-name result)) + ((and result (listp result)) + (mapcar #'expand-file-name result)) + (t result)) + (when (and (not (string= helm-pattern "")) + (eq helm-exit-status 0) + (eq must-match 'confirm)) + (identity helm-pattern)) + (keyboard-quit)))) + +(cl-defun helm--generic-read-file-name + (prompt &optional dir default-filename mustmatch initial predicate) + "Generic helm replacement of `read-file-name'. +Don't use it directly, use instead `helm-read-file-name' in your programs." + (let* ((init (or initial dir default-directory)) + (current-command (or (helm-this-command) this-command)) + (str-command (symbol-name current-command)) + (helm-file-completion-sources + (cons str-command + (remove str-command helm-file-completion-sources))) + (buf-name (format "*helm-mode-%s*" str-command)) + (entry (assq current-command + helm-completing-read-handlers-alist)) + (def-com (cdr-safe entry)) + (str-defcom (and def-com (symbol-name def-com))) + (def-args (list prompt dir default-filename mustmatch initial predicate)) + ;; Append the two extra args needed to set the buffer and source name + ;; in helm specialized functions. + (any-args (append def-args (list str-command buf-name))) + (ido-state ido-mode) + helm-completion-mode-start-message ; Be quiet + helm-completion-mode-quit-message ; Same here + fname) + ;; Some functions that normally call `completing-read' can switch + ;; brutally to `read-file-name' (e.g find-tag), in this case + ;; the helm specialized function will fail because it is build + ;; for `completing-read', so set it to 'incompatible to be sure + ;; we switch to `helm-read-file-name' and don't try to call it + ;; with wrong number of args. + (when (eq def-com 'ido) + (setq def-com 'ido-read-file-name) (ido-mode 1)) + (when (and def-com (> (length (help-function-arglist def-com)) 8)) + (setq def-com 'incompatible)) + (unless (or (not entry) def-com) + (cl-return-from helm--generic-read-file-name + (unwind-protect + (progn + (helm-mode -1) + (apply read-file-name-function def-args)) + (helm-mode 1)))) + ;; If we use now `read-file-name' we MUST turn off `helm-mode' + ;; to avoid infinite recursion and CRASH. It will be reenabled on exit. + (when (or (eq def-com 'read-file-name) + (eq def-com 'ido-read-file-name) + (and (stringp str-defcom) + (not (string-match "^helm" str-defcom)))) + (helm-mode -1)) + (unwind-protect + (setq fname + (cond (;; A specialized function exists, run it + ;; with the two extra args specific to helm.. + (and def-com helm-mode + (not (eq def-com 'ido-read-file-name)) + (not (eq def-com 'incompatible))) + (apply def-com any-args)) + (;; Def-com value is `ido-read-file-name' + ;; run it with default args. + (and def-com (eq def-com 'ido-read-file-name)) + (ido-mode 1) + (apply def-com def-args)) + (;; Def-com value is `read-file-name' + ;; run it with default args. + (eq def-com 'read-file-name) + (apply def-com def-args)) + (t ; Fall back to classic `helm-read-file-name'. + (helm-read-file-name + prompt + :name str-command + :buffer buf-name + :default default-filename + :initial-input (expand-file-name init dir) + :alistp nil + :must-match mustmatch + :test predicate)))) + (helm-mode 1) + (ido-mode (if ido-state 1 -1)) + ;; Same comment as in `helm--completing-read-default'. + (setq this-command current-command)) + fname)) + +(defun helm-mode--advice-lisp--local-variables (old--fn &rest args) + (ignore-errors + (apply old--fn args))) + +(defun helm--completion-in-region (start end collection &optional predicate) + "[EXPERIMENTAL] Helm replacement of `completion--in-region'. +Can be used as value for `completion-in-region-function'." + (cl-declare (special require-match prompt)) + (advice-add + 'lisp--local-variables + :around #'helm-mode--advice-lisp--local-variables) + (unwind-protect + (let* ((enable-recursive-minibuffers t) + (input (buffer-substring-no-properties start end)) + (current-command (or (helm-this-command) this-command)) + (str-command (symbol-name current-command)) + (buf-name (format "*helm-mode-%s*" str-command)) + (require-match (or (and (boundp 'require-match) require-match) + minibuffer-completion-confirm + ;; If prompt have not been propagated here, that's + ;; probably mean we have no prompt and we are in + ;; completion-at-point or friend, so use a non--nil + ;; value for require-match. + (not (boundp 'prompt)))) + ;; `completion-extra-properties' is let-bounded in `completion-at-point'. + ;; `afun' is a closure to call against each string in `data'. + ;; it provide the annotation info for each string. + ;; e.g "foo" => "foo " where foo is a function. + ;; See Issue #407. + (afun (plist-get completion-extra-properties :annotation-function)) + (data (all-completions input collection predicate)) + (file-comp-p (helm-mode--in-file-completion-p input (car data))) + ;; Completion-at-point and friends have no prompt. + (result (helm-comp-read + (or (and (boundp 'prompt) prompt) "Pattern: ") + (if file-comp-p + (cl-loop for f in data unless + (string-match "\\`\\.\\{1,2\\}/\\'" f) + collect f) + (if afun + (mapcar (lambda (s) + (let ((ann (funcall afun s))) + (if ann + (cons + (concat + s + (propertize + " " 'display + (propertize + ann + 'face 'completions-annotations))) + s) + s))) + data) + data)) + :name str-command + :nomark t + :initial-input + (cond ((and file-comp-p + (not (string-match "/\\'" input))) + (concat (helm-basename input) + (unless (string= input "") " "))) + ((string-match "/\\'" input) nil) + ((or (null require-match) + (stringp require-match)) + input) + (t (concat input " "))) + :buffer buf-name + :fc-transformer (append (list 'helm-cr-default-transformer) + (list (lambda (candidates _source) + (sort candidates 'helm-generic-sort-fn)))) + :exec-when-only-one t + :quit-when-no-cand + #'(lambda () + ;; Delay message to overwrite "Quit". + (run-with-timer + 0.01 nil + #'(lambda () + (message "[No matches]"))) + t) ; exit minibuffer immediately. + :must-match require-match))) + (when result + (delete-region (if (and file-comp-p + (save-excursion + (re-search-backward "~?/" start t))) + (match-end 0) start) + end) + (insert (if file-comp-p + (shell-quote-argument result) + result)))) + (advice-remove 'lisp--local-variables + #'helm-mode--advice-lisp--local-variables))) + +(defun helm-mode--in-file-completion-p (target candidate) + (when (and candidate target) + (or (string-match "/\\'" candidate) + (string-match "/\\'" target) + (if (string-match "~?/" target) + (file-exists-p (expand-file-name candidate (helm-basedir target))) + (file-exists-p (expand-file-name + candidate (with-helm-current-buffer + default-directory))))))) + +(when (boundp 'completion-in-region-function) + (defconst helm--old-completion-in-region-function completion-in-region-function)) + +;;;###autoload +(define-minor-mode helm-mode + "Toggle generic helm completion. + +All functions in Emacs that use `completing-read' +or `read-file-name' and friends will use helm interface +when this mode is turned on. +However you can modify this behavior for functions of your choice +with `helm-completing-read-handlers-alist'. + +Called with a positive arg, turn on unconditionally, with a +negative arg turn off. +You can turn it on with `helm-mode'. + +Some crap emacs functions may not be supported, +e.g `ffap-alternate-file' and maybe others +You can add such functions to `helm-completing-read-handlers-alist' +with a nil value. + +Note: This mode is incompatible with Emacs23." + :group 'helm-mode + :global t + :lighter helm-completion-mode-string + (cl-assert (boundp 'completing-read-function) nil + "`helm-mode' not available, upgrade to Emacs-24") + (if helm-mode + (progn + (setq completing-read-function 'helm--completing-read-default + read-file-name-function 'helm--generic-read-file-name) + (when (and (boundp 'completion-in-region-function) + helm-mode-handle-completion-in-region) + (setq completion-in-region-function #'helm--completion-in-region)) + (message helm-completion-mode-start-message)) + (setq completing-read-function (and (fboundp 'completing-read-default) + 'completing-read-default) + read-file-name-function (and (fboundp 'read-file-name-default) + 'read-file-name-default)) + (when (and (boundp 'completion-in-region-function) + (boundp 'helm--old-completion-in-region-function)) + (setq completion-in-region-function helm--old-completion-in-region-function)) + (message helm-completion-mode-quit-message))) + +(provide 'helm-mode) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-mode.el ends here diff --git a/elpa/helm-20140808.2300/helm-mode.elc b/elpa/helm-20140808.2300/helm-mode.elc new file mode 100644 index 000000000..913a4dcd0 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-mode.elc differ diff --git a/elpa/helm-20140808.2300/helm-net.el b/elpa/helm-20140808.2300/helm-net.el new file mode 100644 index 000000000..4e9d3dcdd --- /dev/null +++ b/elpa/helm-20140808.2300/helm-net.el @@ -0,0 +1,607 @@ +;;; helm-net.el --- helm browse url and search web. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'url) +(require 'xml) +(require 'browse-url) + + +(defgroup helm-net nil + "Net related applications and libraries for Helm." + :group 'helm) + +(defcustom helm-google-suggest-default-browser-function nil + "The browse url function you prefer to use with google suggest. +When nil, use the first browser function available +See `helm-browse-url-default-browser-alist'." + :group 'helm-net + :type 'symbol) + +(defcustom helm-home-url "http://www.google.fr" + "Default url to use as home url." + :group 'helm-net + :type 'string) + +(defcustom helm-surfraw-default-browser-function nil + "The browse url function you prefer to use with surfraw. +When nil, fallback to `browse-url-browser-function'." + :group 'helm-net + :type 'symbol) + +(defcustom helm-google-suggest-url + "http://google.com/complete/search?output=toolbar&q=" + "URL used for looking up Google suggestions." + :type 'string + :group 'helm-net) + +(defcustom helm-google-suggest-search-url + "http://www.google.com/search?ie=utf-8&oe=utf-8&q=" + "URL used for Google searching." + :type 'string + :group 'helm-net) + +(defcustom helm-google-suggest-use-curl-p nil + "When non--nil use CURL to get info from `helm-google-suggest-url'. +Otherwise `url-retrieve-synchronously' is used." + :type 'boolean + :group 'helm-net) + +(defcustom helm-yahoo-suggest-url + "http://search.yahooapis.com/WebSearchService/V1/relatedSuggestion?appid=Generic&query=" + "Url used for looking up Yahoo suggestions." + :type 'string + :group 'helm-net) + +(defcustom helm-yahoo-suggest-search-url + "http://search.yahoo.com/search?&ei=UTF-8&fr&h=c&p=" + "Url used for Yahoo searching." + :type 'string + :group 'helm-net) + +(defcustom helm-surfraw-duckduckgo-url + "https://duckduckgo.com/lite/?q=%s&kp=1" + "The duckduckgo url. +This is a format string, don't forget the `%s'. +If you have personal settings saved on duckduckgo you should have +a personal url, see your settings on duckduckgo." + :type 'string + :group 'helm-net) + +(defcustom helm-wikipedia-suggest-url + "http://en.wikipedia.org/w/api.php?action=opensearch&search=" + "Url used for looking up Wikipedia suggestions." + :type 'string + :group 'helm-net) + +(defcustom helm-search-suggest-action-wikipedia-url + "https://en.wikipedia.org/wiki/Special:Search?search=%s" + "The Wikipedia search url. +This is a format string, don't forget the `%s'." + :type 'string + :group 'helm-net) + +(defcustom helm-wikipedia-summary-url + "http://en.wikipedia.org/w/api.php?action=parse&format=json&prop=text§ion=0&page=" + "URL for getting the summary of a Wikipedia topic." + :type 'string + :group 'helm-net) + +(defcustom helm-wikipedia-follow-delay 2 + "Delay before wikipedia summary popup." + :type 'number + :group 'helm-net) + +(defcustom helm-search-suggest-action-youtube-url + "http://www.youtube.com/results?aq=f&search_query=%s" + "The Youtube search url. +This is a format string, don't forget the `%s'." + :type 'string + :group 'helm-net) + +(defcustom helm-search-suggest-action-imdb-url + "http://www.imdb.com/find?s=all&q=%s" + "The IMDb search url. +This is a format string, don't forget the `%s'." + :type 'string + :group 'helm-net) + +(defcustom helm-search-suggest-action-google-maps-url + "http://maps.google.com/maps?f=q&source=s_q&q=%s" + "The Google Maps search url. +This is a format string, don't forget the `%s'." + :type 'string + :group 'helm-net) + +(defcustom helm-search-suggest-action-google-news-url + "http://www.google.com/search?safe=off&prmd=nvlifd&source=lnms&tbs=nws:1&q=%s" + "The Google News search url. +This is a format string, don't forget the `%s'." + :type 'string + :group 'helm-net) + + +;;; Additional actions for search suggestions +;; +;; +;; Internal + +(defun helm-search-suggest-perform-additional-action (url query) + "Perform the search via URL using QUERY as input." + (browse-url (format url (url-hexify-string query)))) + +(defvar helm-search-suggest-additional-actions + '(("Wikipedia" . (lambda (candidate) + (helm-search-suggest-perform-additional-action + helm-search-suggest-action-wikipedia-url + candidate))) + ("Youtube" . (lambda (candidate) + (helm-search-suggest-perform-additional-action + helm-search-suggest-action-youtube-url + candidate))) + ("IMDb" . (lambda (candidate) + (helm-search-suggest-perform-additional-action + helm-search-suggest-action-imdb-url + candidate))) + ("Google Maps" . (lambda (candidate) + (helm-search-suggest-perform-additional-action + helm-search-suggest-action-google-maps-url + candidate))) + ("Google News" . (lambda (candidate) + (helm-search-suggest-perform-additional-action + helm-search-suggest-action-google-news-url + candidate)))) + "List of additional actions for suggest sources.") + + +;;; Google Suggestions +;; +;; +;; Internal +(defvar helm-ggs-max-length-real-flag 0) +(defvar helm-ggs-max-length-num-flag 0) + +(defun helm-google-suggest-fetch (input) + "Fetch suggestions for INPUT from XML buffer. +Return an alist with elements like (data . number_results)." + (setq helm-ggs-max-length-real-flag 0 + helm-ggs-max-length-num-flag 0) + (let ((request (concat helm-google-suggest-url + (url-hexify-string input))) + (fetch #'(lambda () + (cl-loop + with result-alist = (xml-get-children + (car (xml-parse-region + (point-min) (point-max))) + 'CompleteSuggestion) + for i in result-alist + for data = (cdr (cl-caadr (assoc 'suggestion i))) + for nqueries = (cdr (cl-caadr (assoc 'num_queries i))) + for lqueries = (length (helm-ggs-set-number-result + nqueries)) + for ldata = (length data) + do + (progn + (when (> ldata helm-ggs-max-length-real-flag) + (setq helm-ggs-max-length-real-flag ldata)) + (when (> lqueries helm-ggs-max-length-num-flag) + (setq helm-ggs-max-length-num-flag lqueries))) + collect (cons data nqueries) into cont + finally return cont)))) + (if helm-google-suggest-use-curl-p + (with-temp-buffer + (call-process "curl" nil t nil request) + (funcall fetch)) + (with-current-buffer + (url-retrieve-synchronously request) + (funcall fetch))))) + +(defun helm-google-suggest-set-candidates (&optional request-prefix) + "Set candidates with result and number of google results found." + (let ((suggestions + (cl-loop with suggested-results = (helm-google-suggest-fetch + (or (and request-prefix + (concat request-prefix + " " helm-pattern)) + helm-pattern)) + for (real . numresult) in suggested-results + ;; Prepare number of results with "," + for fnumresult = (helm-ggs-set-number-result numresult) + ;; Calculate number of spaces to add before fnumresult + ;; if it is smaller than longest result + ;; `helm-ggs-max-length-num-flag'. + ;; e.g 1,234,567 + ;; 345,678 + ;; To be sure it is aligned properly. + for nspaces = (if (< (length fnumresult) + helm-ggs-max-length-num-flag) + (- helm-ggs-max-length-num-flag + (length fnumresult)) + 0) + ;; Add now the spaces before fnumresult. + for align-fnumresult = (concat (make-string nspaces ? ) + fnumresult) + for interval = (- helm-ggs-max-length-real-flag + (length real)) + for spaces = (make-string (+ 2 interval) ? ) + for display = (format "%s%s(%s results)" + real spaces align-fnumresult) + collect (cons display real)))) + (if (cl-loop for (_disp . dat) in suggestions + thereis (equal dat helm-pattern)) + suggestions + ;; if there is no suggestion exactly matching the input then + ;; prepend a Search on Google item to the list + (append + suggestions + (list (cons (concat "Search for " "'" helm-input "'" " on Google") + helm-input)))))) + +(defun helm-ggs-set-number-result (num) + (if num + (progn + (and (numberp num) (setq num (number-to-string num))) + (cl-loop for i in (reverse (split-string num "" t)) + for count from 1 + append (list i) into C + when (= count 3) + append (list ",") into C + and do (setq count 0) + finally return + (replace-regexp-in-string + "^," "" (mapconcat 'identity (reverse C) "")))) + "?")) + +(defun helm-google-suggest-action (candidate) + "Default action to jump to a google suggested candidate." + (let ((arg (concat helm-google-suggest-search-url + (url-hexify-string candidate)))) + (helm-aif helm-google-suggest-default-browser-function + (funcall it arg) + (helm-browse-url arg)))) + +(defvar helm-google-suggest-default-function + 'helm-google-suggest-set-candidates + "Default function to use in helm google suggest.") + +(defvar helm-source-google-suggest + `((name . "Google Suggest") + (candidates . (lambda () + (funcall helm-google-suggest-default-function))) + (action . ,(cons '("Google Search" . helm-google-suggest-action) + helm-search-suggest-additional-actions)) + (volatile) + (keymap . ,helm-map) + (requires-pattern . 3))) + +(defun helm-google-suggest-emacs-lisp () + "Try to emacs lisp complete with google suggestions." + (helm-google-suggest-set-candidates "emacs lisp")) + + +;;; Yahoo suggestions +;; +;; +(defun helm-yahoo-suggest-fetch (input) + "Fetch Yahoo suggestions for INPUT from XML buffer. +Return an alist with elements like (data . number_results)." + (let ((request (concat helm-yahoo-suggest-url + (url-hexify-string input)))) + (with-current-buffer + (url-retrieve-synchronously request) + (cl-loop with result-alist = + (xml-get-children + (car (xml-parse-region + (point-min) (point-max))) + 'Result) + for i in result-alist + collect (cl-caddr i))))) + +(defun helm-yahoo-suggest-set-candidates () + "Set candidates with Yahoo results found." + (let ((suggestions (helm-yahoo-suggest-fetch helm-input))) + (or suggestions + (append + suggestions + (list (cons (concat "Search for " "'" helm-input "'" " on Yahoo") + helm-input)))))) + +(defun helm-yahoo-suggest-action (candidate) + "Default action to jump to a Yahoo suggested candidate." + (helm-browse-url (concat helm-yahoo-suggest-search-url + (url-hexify-string candidate)))) + +(defvar helm-source-yahoo-suggest + `((name . "Yahoo Suggest") + (candidates . helm-yahoo-suggest-set-candidates) + (action . (("Yahoo Search" . helm-yahoo-suggest-action))) + (volatile) + (keymap . ,helm-map) + (requires-pattern . 3))) + +;;; Wikipedia suggestions +;; +;; +(declare-function json-read-from-string "json" (string)) +(defun helm-wikipedia-suggest-fetch () + "Fetch Wikipedia suggestions and return them as a list." + (require 'json) + (let ((request (concat helm-wikipedia-suggest-url + (url-hexify-string helm-pattern)))) + (if helm-google-suggest-use-curl-p + (with-temp-buffer + (call-process "curl" nil t nil request) + (helm-wikipedia--parse-buffer)) + (with-current-buffer + (url-retrieve-synchronously request) + (helm-wikipedia--parse-buffer))))) + +(defun helm-wikipedia--parse-buffer () + (goto-char (point-min)) + (when (re-search-forward "^\\[.+\\[\\(.*\\)\\]\\]" nil t) + (cl-loop for i across (aref (json-read-from-string (match-string 0)) 1) + collect i into result + finally return (or result + (append + result + (list (cons (format "Search for '%s' on wikipedia" + helm-pattern) + helm-pattern))))))) + +(defvar helm-wikipedia--summary-cache (make-hash-table :test 'equal)) +(defun helm-wikipedia-persistent-action (candidate) + (unless (string= (format "Search for '%s' on wikipedia" + helm-pattern) + (helm-get-selection nil t)) + (message "Fetching summary from Wikipedia...") + (let ((buf (get-buffer-create "*helm wikipedia summary*")) + result mess) + (while (progn + (setq result (or (gethash candidate helm-wikipedia--summary-cache) + (puthash candidate + (prog1 + (helm-wikipedia-fetch-summary candidate) + (setq mess "Done")) + helm-wikipedia--summary-cache))) + (when (and result + (listp result)) + (setq candidate (cdr result)) + (message "Redirected to %s" candidate) + t))) + (if (not result) + (message "Error when getting summary.") + (with-current-buffer buf + (erase-buffer) + (setq cursor-type nil) + (insert result) + (fill-region (point-min) (point-max)) + (goto-char (point-min))) + (display-buffer buf) + (message mess))))) + + +(defun helm-wikipedia-fetch-summary (input) + (let* ((request (concat helm-wikipedia-summary-url (url-hexify-string input)))) + (if helm-google-suggest-use-curl-p + (with-temp-buffer + (call-process "curl" nil t nil request) + (helm-wikipedia--parse-summary)) + (with-current-buffer + (url-retrieve-synchronously request) + (helm-wikipedia--parse-summary))))) + + +(defun helm-wikipedia--parse-summary () + (goto-char (point-min)) + (when (search-forward "{" nil t) + (let ((result (cdr (assoc '* + (assoc 'text + (assoc 'parse + (json-read-from-string + (buffer-substring-no-properties + (1- (point)) (point-max))))))))) + (when result + (if (string-match "]+>\\([^<]+\\)" result) + (cons 'redirect (match-string 1 result)) + + ;; find the beginning of the summary text in the result + + ;; check if there is a table before the summary and skip that + (when (or (string-match "\\(\n\\)?\n

" result) + ;; otherwise just find the first paragraph + (string-match "

" result)) + ;; remove cruft and do a simple formatting + (replace-regexp-in-string + "Cite error: .*" "" + (replace-regexp-in-string + " " "" + (replace-regexp-in-string + "\\[[^\]]+\\]" "" + (replace-regexp-in-string + "<[^>]*>" "" + (replace-regexp-in-string + "

\n

" "\n\n" + (substring result (match-end 0))))))))))))) + + +(defvar helm-source-wikipedia-suggest + `((name . "Wikipedia Suggest") + (candidates . helm-wikipedia-suggest-fetch) + (action . (("Wikipedia" . (lambda (candidate) + (helm-search-suggest-perform-additional-action + helm-search-suggest-action-wikipedia-url + candidate))))) + (persistent-action . helm-wikipedia-persistent-action) + (volatile) + (keymap . ,helm-map) + (follow . 1) + (follow-delay . ,helm-wikipedia-follow-delay) + (requires-pattern . 3))) + + +;;; Web browser functions. +;; +;; +;; If default setting of `w3m-command' is not +;; what you want and you modify it, you will have to reeval +;; also `helm-browse-url-default-browser-alist'. + +(defvar helm-browse-url-chromium-program "chromium-browser") +(defvar helm-browse-url-uzbl-program "uzbl-browser") +(defvar helm-browse-url-conkeror-program "conkeror") +(defvar helm-browse-url-default-browser-alist + `((,(or (and (boundp 'w3m-command) w3m-command) + "/usr/bin/w3m") . w3m-browse-url) + (,browse-url-firefox-program . browse-url-firefox) + (,helm-browse-url-chromium-program . helm-browse-url-chromium) + (,helm-browse-url-conkeror-program . helm-browse-url-conkeror) + (,helm-browse-url-uzbl-program . helm-browse-url-uzbl) + (,browse-url-kde-program . browse-url-kde) + (,browse-url-gnome-moz-program . browse-url-gnome-moz) + (,browse-url-mozilla-program . browse-url-mozilla) + (,browse-url-galeon-program . browse-url-galeon) + (,browse-url-netscape-program . browse-url-netscape) + (,browse-url-mosaic-program . browse-url-mosaic) + (,browse-url-xterm-program . browse-url-text-xterm) + ("emacs" . eww-browse-url)) + "*Alist of \(executable . function\) to try to find a suitable url browser.") + +(cl-defun helm-generic-browser (url cmd-name &rest args) + "Browse URL with NAME browser." + (let ((proc (concat cmd-name " " url))) + (message "Starting %s..." cmd-name) + (apply 'start-process proc nil cmd-name + (append args (list url))) + (set-process-sentinel + (get-process proc) + #'(lambda (process event) + (when (string= event "finished\n") + (message "%s process %s" process event)))))) + +(defun helm-browse-url-chromium (url &optional _ignore) + "Browse URL with google chrome browser." + (interactive "sURL: ") + (helm-generic-browser + url helm-browse-url-chromium-program)) + +(defun helm-browse-url-uzbl (url &optional _ignore) + "Browse URL with uzbl browser." + (interactive "sURL: ") + (helm-generic-browser url helm-browse-url-uzbl-program "-u")) + +(defun helm-browse-url-conkeror (url &optional _ignore) + "Browse URL with conkeror browser." + (interactive "sURL: ") + (helm-generic-browser url helm-browse-url-conkeror-program)) + +(defun helm-browse-url-default-browser (url &rest args) + "Find the first available browser and ask it to load URL." + (let ((default-browser-fn + (cl-loop for (exe . fn) in helm-browse-url-default-browser-alist + thereis (and exe (executable-find exe) (fboundp fn) fn)))) + (if default-browser-fn + (apply default-browser-fn url args) + (error "No usable browser found")))) + +(defun helm-browse-url (url &rest args) + "Default command to browse URL." + (if browse-url-browser-function + (browse-url url args) + (helm-browse-url-default-browser url args))) + + +;;; Surfraw +;; +;; Need external program surfraw. +;; + +;; Internal +(defvar helm-surfraw-engines-history nil) +(defvar helm-surfraw-input-history nil) +(defvar helm-surfraw--elvi-cache nil) + +(defun helm-build-elvi-list () + "Return list of all engines and descriptions handled by surfraw." + (or helm-surfraw--elvi-cache + (setq helm-surfraw--elvi-cache + (cdr (with-temp-buffer + (call-process "surfraw" nil t nil "-elvi") + (split-string (buffer-string) "\n")))))) + +;;;###autoload +(defun helm-surfraw (pattern engine) + "Preconfigured `helm' to search PATTERN with search ENGINE." + (interactive (list (read-string "SearchFor: " + nil 'helm-surfraw-input-history + (thing-at-point 'symbol)) + (helm-comp-read + "Engine: " + (helm-build-elvi-list) + :must-match t + :name "Surfraw Search Engines" + :del-input nil + :history helm-surfraw-engines-history))) + (let* ((engine-nodesc (car (split-string engine))) + (url (if (string= engine-nodesc "duckduckgo") + ;; "sr duckduckgo -p foo" is broken, workaround. + (format helm-surfraw-duckduckgo-url + (url-hexify-string pattern)) + (with-temp-buffer + (apply 'call-process "surfraw" nil t nil + (append (list engine-nodesc "-p") (split-string pattern))) + (replace-regexp-in-string + "\n" "" (buffer-string))))) + (browse-url-browser-function (or helm-surfraw-default-browser-function + browse-url-browser-function))) + (if (string= engine-nodesc "W") + (helm-browse-url helm-home-url) + (helm-browse-url url) + (setq helm-surfraw-engines-history + (cons engine (delete engine helm-surfraw-engines-history)))))) + +;;;###autoload +(defun helm-google-suggest () + "Preconfigured `helm' for google search with google suggest." + (interactive) + (helm-other-buffer 'helm-source-google-suggest "*helm google*")) + +;;;###autoload +(defun helm-yahoo-suggest () + "Preconfigured `helm' for Yahoo searching with Yahoo suggest." + (interactive) + (helm-other-buffer 'helm-source-yahoo-suggest "*helm yahoo*")) + +;;;###autoload +(defun helm-wikipedia-suggest () + "Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest." + (interactive) + (helm :sources 'helm-source-wikipedia-suggest + :buffer "*helm wikipedia*")) + + +(provide 'helm-net) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-net.el ends here diff --git a/elpa/helm-20140808.2300/helm-net.elc b/elpa/helm-20140808.2300/helm-net.elc new file mode 100644 index 000000000..f16df3043 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-net.elc differ diff --git a/elpa/helm-20140808.2300/helm-org.el b/elpa/helm-20140808.2300/helm-org.el new file mode 100644 index 000000000..a0f772408 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-org.el @@ -0,0 +1,185 @@ +;;; helm-org.el --- Helm for org headlines and keywords completion -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'helm-plugin) +(require 'org) + +(declare-function org-get-current-options "ext:org-exp.el") + +;;; Org headlines +;; +;; +(defvar helm-source-org-headline + `((name . "Org Headline") + (headline + ,@(mapcar + (lambda (num) + (format "^\\*\\{%d\\} \\(.+?\\)\\([ \t]*:[[:lower:][:upper:]0-9_@:]+:\\)?[ \t]*$" + num)) + (number-sequence 1 8))) + (condition . (eq major-mode 'org-mode)) + (migemo) + (subexp . 1) + (persistent-action . (lambda (elm) + (helm-action-line-goto elm) + (org-cycle))) + (action-transformer + . (lambda (actions candidate) + '(("Go to line" . helm-action-line-goto) + ("Refile to this headline" . helm-org-headline-refile) + ("Insert link to this headline" + . helm-org-headline-insert-link-to-headline))))) + "Show Org headlines. +org-mode is very very much extended text-mode/outline-mode. + +See (find-library \"org.el\") +See http://orgmode.org for the latest version.") + +(defun helm-org-headline-insert-link-to-headline (lineno-and-content) + (insert + (save-excursion + (helm-goto-line (car lineno-and-content)) + (and (looking-at org-complex-heading-regexp) + (org-make-link-string (concat "*" (match-string 4))))))) + +(defun helm-org-headline-refile (lineno-and-content) + "Refile current org entry to LINENO-AND-CONTENT." + (with-helm-current-buffer + (org-cut-subtree) + (helm-goto-line (car lineno-and-content)) + (org-end-of-subtree t t) + (let ((org-yank-adjusted-subtrees t)) + (org-yank)))) + + +;;; Org keywords +;; +;; Stop supporting this in emacs-24.3.50.1. +(when (boundp 'org-additional-option-like-keywords) + (defvar helm-source-org-keywords + '((name . "Org Keywords") + (init . helm-org-keywords-init) + (candidates . helm-org-keywords-candidates) + (action . helm-org-keywords-insert) + (persistent-action . helm-org-keywords-show-help) + (persistent-help . "Show an example and info page to describe this keyword.") + (keywords-examples) + (keywords))) + + (defvar helm-org-keywords-info-location + '(("#+TITLE:" . "(org)Export options") + ("#+AUTHOR:" . "(org)Export options") + ("#+DATE:" . "(org)Export options") + ("#+EMAIL:" . "(org)Export options") + ("#+DESCRIPTION:" . "(org)Export options") + ("#+KEYWORDS:" . "(org)Export options") + ("#+LANGUAGE:" . "(org)Export options") + ("#+TEXT:" . "(org)Export options") + ("#+TEXT:" . "(org)Export options") + ("#+OPTIONS:" . "(org)Export options") + ("#+BIND:" . "(org)Export options") + ("#+LINK_UP:" . "(org)Export options") + ("#+LINK_HOME:" . "(org)Export options") + ("#+LATEX_HEADER:" . "(org)Export options") + ("#+EXPORT_SELECT_TAGS:" . "(org)Export options") + ("#+EXPORT_EXCLUDE_TAGS:" . "(org)Export options") + ("#+INFOJS_OPT" . "(org)Javascript support") + ("#+BEGIN_HTML" . "(org)Quoting HTML tags") + ("#+BEGIN_LaTeX" . "(org)Quoting LaTeX code") + ("#+ORGTBL" . "(org)Radio tables") + ("#+HTML:" . "(org)Quoting HTML tags") + ("#+LaTeX:" . "(org)Quoting LaTeX code") + ("#+BEGIN:" . "(org)Dynamic blocks") ;clocktable columnview + ("#+BEGIN_EXAMPLE" . "(org)Literal examples") + ("#+BEGIN_QUOTE" . "(org)Paragraphs") + ("#+BEGIN_VERSE" . "(org)Paragraphs") + ("#+BEGIN_SRC" . "(org)Literal examples") + ("#+CAPTION" . "(org)Tables in HTML export") + ("#+LABEL" . "(org)Tables in LaTeX export") + ("#+ATTR_HTML" . "(org)Links") + ("#+ATTR_LaTeX" . "(org)Images in LaTeX export"))) + + (defun helm-org-keywords-init () + (unless (helm-attr 'keywords-examples) + (require 'org) + (helm-attrset 'keywords-examples + (append + (mapcar + (lambda (x) + (string-match "^#\\+\\(\\([[:upper:]_]+:?\\).*\\)" x) + (cons (match-string 2 x) (match-string 1 x))) + (org-split-string (org-get-current-options) "\n")) + (mapcar 'list org-additional-option-like-keywords))) + (helm-attrset 'keywords (mapcar 'car (helm-attr 'keywords-examples))))) + + (defun helm-org-keywords-candidates () + (and (or (eq (buffer-local-value 'major-mode helm-current-buffer) 'org-mode) + (eq (buffer-local-value 'major-mode helm-current-buffer) 'message-mode)) + (helm-attr 'keywords))) + + (defun helm-org-keywords-insert (keyword) + (cond ((and (string-match "BEGIN" keyword) + (helm-region-active-p)) + (let ((beg (region-beginning)) + (end (region-end))) + (goto-char end) + (insert "\n#+" (replace-regexp-in-string + "BEGIN" "END" keyword) "\n") + (goto-char beg) + (insert "#+" keyword " ") + (save-excursion (insert "\n")))) + ((string-match "BEGIN" keyword) + (insert "#+" keyword " ") + (save-excursion + (insert "\n#+" (replace-regexp-in-string + "BEGIN" "END" keyword) "\n"))) + (t (insert "#+" keyword " ")))) + + (defun helm-org-keywords-show-help (keyword) + (info (or (assoc-default (concat "#+" keyword) helm-org-keywords-info-location) + "(org)In-buffer settings")) + (search-forward (concat "#+" keyword) nil t) + (helm-highlight-current-line) + (message "%s" (or (cdr (assoc keyword (helm-attr 'keywords-examples))) "")))) + +;;;###autoload +(defun helm-org-keywords () + "Preconfigured `helm' for org keywords." + (interactive) + (cl-assert (boundp 'org-additional-option-like-keywords) nil + "Helm-org-keyword not supported in %s" emacs-version) + (helm-other-buffer 'helm-source-org-keywords "*org keywords*")) + +;;;###autoload +(defun helm-org-headlines () + "Preconfigured helm to show org headlines." + (interactive) + (helm-other-buffer 'helm-source-org-headline "*org headlines*")) + + +(provide 'helm-org) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-org.el ends here diff --git a/elpa/helm-20140808.2300/helm-org.elc b/elpa/helm-20140808.2300/helm-org.elc new file mode 100644 index 000000000..df1b192d7 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-org.elc differ diff --git a/elpa/helm-20140808.2300/helm-pkg.el b/elpa/helm-20140808.2300/helm-pkg.el new file mode 100644 index 000000000..ed0462b9a --- /dev/null +++ b/elpa/helm-20140808.2300/helm-pkg.el @@ -0,0 +1 @@ +(define-package "helm" "20140808.2300" "Helm is an Emacs incremental and narrowing framework" 'nil) diff --git a/elpa/helm-20140808.2300/helm-pkg.elc b/elpa/helm-20140808.2300/helm-pkg.elc new file mode 100644 index 000000000..47d66848a Binary files /dev/null and b/elpa/helm-20140808.2300/helm-pkg.elc differ diff --git a/elpa/helm-20140808.2300/helm-plugin.el b/elpa/helm-20140808.2300/helm-plugin.el new file mode 100644 index 000000000..28e8ae2a8 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-plugin.el @@ -0,0 +1,342 @@ +;;; helm-plugin.el --- Helm plugins -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) + +(declare-function Info-index-nodes "info" (&optional file)) +(declare-function Info-goto-node "info" (&optional fork)) +(declare-function Info-find-node "info.el" (filename nodename &optional no-going-back)) + + +;;; Plug-in: `info-index' +;; +;; +(defvar Info-history) +(cl-defun helm-info-init (&optional (file (helm-attr 'info-file))) + ;; Allow reinit candidate buffer when using edebug. + (helm-aif (and debug-on-error + (helm-candidate-buffer)) + (kill-buffer it)) + (unless (helm-candidate-buffer) + (save-window-excursion + (info file) + (let (Info-history + (tobuf (helm-candidate-buffer 'global)) + (infobuf (current-buffer)) + s e + (nodes (or (helm-attr 'index-nodes) (Info-index-nodes)))) + (cl-dolist (node nodes) + (Info-goto-node node) + (goto-char (point-min)) + (while (search-forward "\n* " nil t) + (unless (search-forward "Menu:\n" (1+ (point-at-eol)) t) + (save-current-buffer (buffer-substring-no-properties + (point-at-bol) (point-at-eol))) + (setq s (point-at-bol) + e (point-at-eol)) + (with-current-buffer tobuf + (insert-buffer-substring infobuf s e) + (insert "\n"))))))))) + +(defun helm-info-goto (node-line) + (Info-goto-node (car node-line)) + (helm-goto-line (cdr node-line))) + +(defun helm-info-display-to-real (line) + (and (string-match + ;; This regexp is stolen from Info-apropos-matches + "\\* +\\([^\n]*.+[^\n]*\\):[ \t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" line) + (cons (format "(%s)%s" (helm-attr 'info-file) (match-string 2 line)) + (string-to-number (or (match-string 3 line) "1"))))) + +(defun helm-make-info-source (source file) + `(,@source + (name . ,(concat "Info Index: " file)) + (info-file . ,file) + (init . helm-info-init) + (display-to-real . helm-info-display-to-real) + (get-line . buffer-substring) + (candidates-in-buffer) + (action ("Goto node" . helm-info-goto)))) + +(defun helm-compile-source--info-index (source) + (helm-aif (helm-interpret-value (assoc-default 'info-index source)) + (helm-make-info-source source it) + source)) + +(add-to-list 'helm-compile-source-functions 'helm-compile-source--info-index) + +(helm-document-attribute 'info-index "info-index plugin" + " Create a source of info index very easily. + + Example: + + (defvar helm-source-info-wget '((info-index . \"wget\"))") + +(helm-document-attribute 'index-nodes "info-index plugin (optional)" + " Index nodes of info file. + + If it is omitted, `Info-index-nodes' is used to collect index + nodes. Some info files are missing index specification. + + See `helm-source-info-screen'.") + + +;;; Plug-in: `candidates-file' +;; +;; List all lines in a file. +(defun helm-compile-source--candidates-file (source) + (if (assoc-default 'candidates-file source) + `((init helm-p-candidates-file-init + ,@(let ((orig-init (assoc-default 'init source))) + (cond ((null orig-init) nil) + ((functionp orig-init) (list orig-init)) + (t orig-init)))) + (candidates-in-buffer) + ,@source) + source)) +(add-to-list 'helm-compile-source-functions 'helm-compile-source--candidates-file) + +(defun helm-p-candidates-file-init () + (cl-destructuring-bind (file &optional updating) + (helm-mklist (helm-attr 'candidates-file)) + (setq file (helm-interpret-value file)) + (with-current-buffer (helm-candidate-buffer 'global) + (insert-file-contents file) + (when updating + (buffer-disable-undo) + (font-lock-mode -1) + (auto-revert-mode 1))))) + +(helm-document-attribute 'candidates-file "candidates-file plugin" + " Use a file as the candidates buffer. + + 1st argument is a filename, string or function name or variable + name. If optional 2nd argument is non-nil, the file is opened with + `auto-revert-mode' enabled. + + Example: + + \(defvar helm-source-test-file + '((name . \"test1\") + (candidates-file \"~/.emacs.el\" t))) + + Will list all lines in .emacs.el.") + + +;;; Plug-in: `headline' +;; +;; +(defun helm-compile-source--helm-headline (source) + (if (assoc-default 'headline source) + (append '((init . helm-headline-init) + (get-line . buffer-substring) + (type . line)) + source + '((candidates-in-buffer) + (persistent-help . "Show this line"))) + source)) +(add-to-list 'helm-compile-source-functions 'helm-compile-source--helm-headline) + +(defun helm-headline-init () + (when (and (helm-current-buffer-is-modified) + (with-helm-current-buffer + (eval (or (helm-attr 'condition) t)))) + (helm-headline-make-candidate-buffer + (helm-interpret-value (helm-attr 'headline)) + (helm-interpret-value (helm-attr 'subexp))))) + +(helm-document-attribute 'headline "Headline plug-in" + " Regexp string for helm-headline to scan.") +(helm-document-attribute 'condition "Headline plug-in" + " A sexp representing the condition to use helm-headline.") +(helm-document-attribute 'subexp "Headline plug-in" + " Display (match-string-no-properties subexp).") + +(defun helm-headline-get-candidates (regexp subexp) + (with-helm-current-buffer + (save-excursion + (goto-char (point-min)) + (if (functionp regexp) (setq regexp (funcall regexp))) + (let ((matched + #'(lambda () + (if (numberp subexp) + (cons (match-string-no-properties subexp) + (match-beginning subexp)) + (cons (buffer-substring (point-at-bol) (point-at-eol)) + (point-at-bol))))) + (arrange + #'(lambda (headlines) + (unless (null headlines) ; FIX headlines empty bug! + (cl-loop with curhead = (make-vector + (1+ (cl-loop for (_ . hierarchy) in headlines + maximize hierarchy)) + "") + for ((str . pt) . hierarchy) in headlines + do (aset curhead hierarchy str) + collecting + (cons + (format "H%d:%s" (1+ hierarchy) + (mapconcat 'identity + (cl-loop for i from 0 to hierarchy + collecting (aref curhead i)) + " / ")) + pt)))))) + (if (listp regexp) + (funcall arrange + (sort + (cl-loop for re in regexp + for hierarchy from 0 + do (goto-char (point-min)) + appending + (cl-loop + while (re-search-forward re nil t) + collect (cons (funcall matched) hierarchy))) + (lambda (a b) (> (cdar b) (cdar a))))) + (cl-loop while (re-search-forward regexp nil t) + collect (funcall matched))))))) + +(defun helm-headline-make-candidate-buffer (regexp subexp) + (with-current-buffer (helm-candidate-buffer 'local) + (cl-loop for (content . pos) in (helm-headline-get-candidates regexp subexp) + do (insert + (format "%5d:%s\n" + (with-helm-current-buffer + (line-number-at-pos pos)) + content))))) + +(defun helm-headline-goto-position (pos recenter) + (goto-char pos) + (unless recenter + (set-window-start (get-buffer-window helm-current-buffer) (point)))) + + +;;; Plug-in: `persistent-help' +;; +;; Add help about persistent action in `helm-buffer' header. +(defun helm-compile-source--persistent-help (source) + (append source '((header-line . helm-persistent-help-string)))) +(add-to-list 'helm-compile-source-functions 'helm-compile-source--persistent-help) + +(defun helm-persistent-help-string () + (substitute-command-keys + (concat "\\\\[helm-execute-persistent-action]: " + (or (helm-interpret-value (helm-attr 'persistent-help)) + (helm-aif (or (assoc-default + 'persistent-action + (helm-get-current-source)) + (assoc-default + 'action (helm-get-current-source))) + (cond ((symbolp it) + (symbol-name it)) + ((listp it) + (or (ignore-errors (caar it)) "")))) + "") + " (keeping session)"))) + +(defun helm-display-to-real-numbered-line (candidate) + "This is used to display a line in occur style in helm sources. +e.g \" 12:some_text\". +It is used with type attribute 'line'." + (if (string-match "^ *\\([0-9]+\\):\\(.*\\)$" candidate) + (list (string-to-number (match-string 1 candidate)) + (match-string 2 candidate)) + (error "Line number not found"))) + + +;;; Type attributes +;; +;; +(define-helm-type-attribute 'line + '((display-to-real . helm-display-to-real-numbered-line) + (action ("Go to Line" . helm-action-line-goto))) + "LINENO:CONTENT string, eg. \" 16:foo\". + +Optional `target-file' attribute is a name of target file. + +Optional `before-jump-hook' attribute is a function with no +arguments which is called before jumping to position. + +Optional `after-jump-hook' attribute is a function with no +arguments which is called after jumping to position. + +If `adjust' attribute is specified, searches the line whose +content is CONTENT near the LINENO. + +If `recenter' attribute is specified, the line is displayed at +the center of window, otherwise at the top of window.") + +(define-helm-type-attribute 'file-line + `((filtered-candidate-transformer helm-filtered-candidate-transformer-file-line) + (multiline) + (action ("Go to" . helm-action-file-line-goto))) + "FILENAME:LINENO:CONTENT string, eg. \"~/.emacs:16:;; comment\". + +Optional `default-directory' attribute is a default-directory +FILENAME is interpreted. + +Optional `before-jump-hook' attribute is a function with no +arguments which is called before jumping to position. + +Optional `after-jump-hook' attribute is a function with no +arguments which is called after jumping to position. + +If `adjust' attribute is specified, searches the line whose +content is CONTENT near the LINENO. + +If `recenter' attribute is specified, the line is displayed at +the center of window, otherwise at the top of window.") + + +;;; Document new attributes +;; +;; +(helm-document-attribute 'persistent-help "persistent-help plug-in" + " A string to explain persistent-action of this source. It also + accepts a function or a variable name.") + +(helm-document-attribute 'default-directory "type . file-line" + " `default-directory' to interpret file.") + +(helm-document-attribute 'before-jump-hook "type . file-line / line" + " Function to call before jumping to the target location.") + +(helm-document-attribute 'after-jump-hook "type . file-line / line" + " Function to call after jumping to the target location.") + +(helm-document-attribute 'adjust "type . file-line" + " Search around line matching line contents.") + +(helm-document-attribute 'recenter "type . file-line / line" + " `recenter' after jumping.") + +(helm-document-attribute 'target-file "type . line" + " Goto line of target-file.") + +(provide 'helm-plugin) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-plugin ends here diff --git a/elpa/helm-20140808.2300/helm-plugin.elc b/elpa/helm-20140808.2300/helm-plugin.elc new file mode 100644 index 000000000..4a9333591 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-plugin.elc differ diff --git a/elpa/helm-20140808.2300/helm-regexp.el b/elpa/helm-20140808.2300/helm-regexp.el new file mode 100644 index 000000000..3634f1d52 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-regexp.el @@ -0,0 +1,621 @@ +;;; helm-regexp.el --- In buffer regexp searching and replacement for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) + + +(defgroup helm-regexp nil + "Regexp related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-moccur-always-search-in-current nil + "Helm multi occur always search in current buffer when non--nil." + :group 'helm-regexp + :type 'boolean) + +(defcustom helm-moccur-use-ioccur-style-keys t + "Similar to `helm-grep-use-ioccur-style-keys' but for multi occur." + :group 'helm-regexp + :type 'boolean) + +(defcustom helm-moccur-auto-update-on-resume nil + "Allow auto updating helm-(m)occur buffer when outdated. +noask => Always update without asking +nil => Don't update but signal buffer needs update +never => Never update and do not signal buffer needs update +Any other non--nil value update after confirmation." + :group 'helm-regexp + :type '(radio :tag "Allow auto updating helm-(m)occur buffer when outdated." + (const :tag "Always update without asking" noask) + (const :tag "Never update and do not signal buffer needs update" never) + (const :tag "Don't update but signal buffer needs update" nil) + (const :tag "Update after confirmation" t))) + + +(defface helm-moccur-buffer + '((t (:foreground "DarkTurquoise" :underline t))) + "Face used to highlight moccur buffer names." + :group 'helm-regexp) + +(defface helm-resume-need-update + '((t (:background "red"))) + "Face used to flash moccur buffer when it needs update." + :group 'helm-regexp) + + +(defvar helm-moccur-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-") 'helm-goto-next-file) + (define-key map (kbd "M-") 'helm-goto-precedent-file) + (define-key map (kbd "C-w") 'helm-yank-text-at-point) + (define-key map (kbd "C-c ?") 'helm-moccur-help) + (define-key map (kbd "C-c o") 'helm-moccur-run-goto-line-ow) + (define-key map (kbd "C-c C-o") 'helm-moccur-run-goto-line-of) + (define-key map (kbd "C-x C-s") 'helm-moccur-run-save-buffer) + (when helm-moccur-use-ioccur-style-keys + (define-key map (kbd "") 'helm-execute-persistent-action) + (define-key map (kbd "") 'helm-moccur-run-default-action)) + (delq nil map)) + "Keymap used in Moccur source.") + + +(defvar helm-build-regexp-history nil) +(defun helm-query-replace-regexp (_candidate) + "Query replace regexp from `helm-regexp'. +With a prefix arg replace only matches surrounded by word boundaries, +i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." + (let ((regexp (funcall (helm-attr 'regexp)))) + (apply 'query-replace-regexp + (helm-query-replace-args regexp)))) + +(defun helm-kill-regexp-as-sexp (_candidate) + "Kill regexp in a format usable in lisp code." + (helm-regexp-kill-new + (prin1-to-string (funcall (helm-attr 'regexp))))) + +(defun helm-kill-regexp (_candidate) + "Kill regexp as it is in `helm-pattern'." + (helm-regexp-kill-new (funcall (helm-attr 'regexp)))) + +(defun helm-query-replace-args (regexp) + "create arguments of `query-replace-regexp' action in `helm-regexp'." + (let ((region-only (helm-region-active-p))) + (list + regexp + (query-replace-read-to regexp + (format "Query replace %sregexp %s" + (if helm-current-prefix-arg "word " "") + (if region-only "in region " "")) + t) + helm-current-prefix-arg + (when region-only (region-beginning)) + (when region-only (region-end))))) + +(defvar helm-source-regexp + '((name . "Regexp Builder") + (init . (lambda () + (helm-init-candidates-in-buffer + 'global (with-temp-buffer + (insert-buffer-substring helm-current-buffer) + (buffer-string))))) + (candidates-in-buffer) + (get-line . helm-regexp-get-line) + (persistent-action . helm-regexp-persistent-action) + (persistent-help . "Show this line") + (multiline) + (no-matchplugin) + (requires-pattern . 2) + (mode-line . "Press TAB to select action.") + (regexp . (lambda () helm-input)) + (action . (("Kill Regexp as sexp" . helm-kill-regexp-as-sexp) + ("Query Replace Regexp (C-u Not inside word.)" + . helm-query-replace-regexp) + ("Kill Regexp" . helm-kill-regexp))))) + +(defun helm-regexp-get-line (s e) + (let ((matches (match-data)) + (line (buffer-substring s e))) + (propertize + (cl-loop with ln = (format "%5d: %s" (line-number-at-pos (1- s)) line) + for i from 0 to (1- (/ (length matches) 2)) + concat (format "\n %s'%s'" (format "Group %d: " i) + (match-string i)) + into ln1 + finally return (concat ln ln1)) + ;; match beginning + ;; KLUDGE: point of helm-candidate-buffer is +1 than that of helm-current-buffer. + ;; It is implementation problem of candidates-in-buffer. + 'helm-real-value (1- s)))) + +(defun helm-regexp-persistent-action (pt) + (helm-goto-char pt) + (helm-highlight-current-line)) + +(defun helm-regexp-kill-new (input) + (kill-new input) + (message "Killed: %s" input)) + +(defun helm-quote-whitespace (candidate) + "Quote whitespace, if some, in string CANDIDATE." + (replace-regexp-in-string " " "\\\\ " candidate)) + + +;;; Occur +;; +;; +(defvar helm-source-occur nil) +(defun helm-occur-init-source () + (unless helm-source-occur + (setq helm-source-occur (copy-alist helm-source-moccur)) + (helm-attrset 'name "Occur" helm-source-occur))) + + +;;; Multi occur +;; +;; + +;; Internal +(defvar helm-multi-occur-buffer-list nil) +(defvar helm-multi-occur-buffer-tick nil) +(defun helm-moccur-init () + "Create the initial helm multi occur buffer." + (helm-init-candidates-in-buffer + 'global + (cl-loop with buffers = (helm-attr 'moccur-buffers) + for buf in buffers + for bufstr = (with-current-buffer buf (buffer-string)) + do (add-text-properties + 0 (length bufstr) + `(buffer-name ,(buffer-name (get-buffer buf))) + bufstr) + concat bufstr))) + +(defun helm-moccur-get-line (beg end) + "Format line for `helm-source-moccur'." + (format "%s:%d:%s" + (get-text-property beg 'buffer-name) + (save-restriction + (narrow-to-region (previous-single-property-change + (point) 'buffer-name) + (next-single-property-change + (point) 'buffer-name)) + (line-number-at-pos beg)) + (buffer-substring beg end))) + +(cl-defun helm-moccur-action (candidate + &optional (method (quote buffer)) mark) + "Jump to CANDIDATE with METHOD. +arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." + (require 'helm-grep) + (let* ((split (helm-grep-split-line candidate)) + (buf (car split)) + (lineno (string-to-number (nth 1 split))) + (split-pat (if helm-occur-match-plugin-mode + (helm-mp-split-pattern helm-pattern) + (list helm-pattern)))) + (cl-case method + (buffer (switch-to-buffer buf)) + (buffer-other-window (switch-to-buffer-other-window buf)) + (buffer-other-frame (switch-to-buffer-other-frame buf))) + (helm-goto-line lineno) + ;; Move point to the nearest matching regexp from bol. + (cl-loop for reg in split-pat + when (save-excursion + (re-search-forward reg (point-at-eol) t)) + collect (match-beginning 0) into pos-ls + finally (when pos-ls (goto-char (apply #'min pos-ls)))) + (when mark + (set-marker (mark-marker) (point)) + (push-mark (point) 'nomsg)))) + +(defun helm-moccur-persistent-action (candidate) + (helm-moccur-goto-line candidate) + (helm-highlight-current-line)) + +(defun helm-moccur-goto-line (candidate) + "From multi occur, switch to buffer and go to nth 1 CANDIDATE line." + (helm-moccur-action + candidate 'buffer (or current-prefix-arg ; persistent. + helm-current-prefix-arg))) ; exit. + +(defun helm-moccur-goto-line-ow (candidate) + "Go to CANDIDATE line in other window. +Same as `helm-moccur-goto-line' but go in other window." + (helm-moccur-action + candidate 'buffer-other-window + (or current-prefix-arg ; persistent. + helm-current-prefix-arg))) ; exit. + +(defun helm-moccur-goto-line-of (candidate) + "Go to CANDIDATE line in new frame. +Same as `helm-moccur-goto-line' but go in new frame." + (helm-moccur-action + candidate 'buffer-other-frame + (or current-prefix-arg ; persistent. + helm-current-prefix-arg))) ; exit. + +(defun helm-moccur-run-goto-line-ow () + "Run goto line other window action from `helm-source-moccur'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-moccur-goto-line-ow))) + +(defun helm-moccur-run-goto-line-of () + "Run goto line new frame action from `helm-source-moccur'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-moccur-goto-line-of))) + +(defun helm-moccur-run-default-action () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-moccur-goto-line))) + +;;;###autoload +(define-minor-mode helm-occur-match-plugin-mode + "Turn On/Off `helm-match-plugin-mode' only for `helm-m/occur'." + :global t + :init-value t + (if helm-occur-match-plugin-mode + (setq helm-source-moccur + (remove (assoc 'no-matchplugin helm-source-moccur) + helm-source-moccur) + helm-source-occur helm-source-moccur) + (helm-attrset 'no-matchplugin nil helm-source-moccur) + (setq helm-source-occur helm-source-moccur))) + +(defvar helm-source-moccur + `((name . "Moccur") + (init . (lambda () + (require 'helm-grep) + (helm-moccur-init))) + (candidates-in-buffer) + (filter-one-by-one . helm-moccur-filter-one-by-one) + (get-line . helm-moccur-get-line) + (nohighlight) + (migemo) + (action . (("Go to Line" . helm-moccur-goto-line) + ("Goto line other window" . helm-moccur-goto-line-ow) + ("Goto line new frame" . helm-moccur-goto-line-of))) + (persistent-action . helm-moccur-persistent-action) + (persistent-help . "Go to line") + (recenter) + (resume . helm-moccur-resume-fn) + (candidate-number-limit . 9999) + (mode-line . helm-moccur-mode-line) + (keymap . ,helm-moccur-map) + (history . ,'helm-grep-history) + (requires-pattern . 2)) + "Helm source for multi occur.") + +(defun helm-moccur-resume-fn () + (with-helm-buffer + (let (new-tick-ls buffer-is-modified) + (set (make-local-variable 'helm-multi-occur-buffer-list) + (cl-loop for b in helm-multi-occur-buffer-list + when (buffer-live-p (get-buffer b)) + collect b)) + (setq buffer-is-modified (/= (length helm-multi-occur-buffer-list) + (length (helm-attr 'moccur-buffers)))) + (helm-attrset 'moccur-buffers helm-multi-occur-buffer-list) + (setq new-tick-ls (cl-loop for b in helm-multi-occur-buffer-list + collect (buffer-chars-modified-tick (get-buffer b)))) + (when buffer-is-modified + (setq helm-multi-occur-buffer-tick new-tick-ls)) + (cl-assert (> (length helm-multi-occur-buffer-list) 0) nil + "helm-resume error: helm-(m)occur buffer list is empty") + (unless (eq helm-moccur-auto-update-on-resume 'never) + (when (or buffer-is-modified + (cl-loop for b in helm-multi-occur-buffer-list + for new-tick = (buffer-chars-modified-tick (get-buffer b)) + for tick in helm-multi-occur-buffer-tick + thereis (/= tick new-tick))) + (helm-aif helm-moccur-auto-update-on-resume + (when (or (eq it 'noask) + (y-or-n-p "Helm (m)occur Buffer outdated, update? ")) + (run-with-idle-timer 0.1 nil (lambda () + (with-helm-buffer + (helm-force-update) + (message "Helm (m)occur Buffer have been udated") + (sit-for 1) (message nil)))) + (unless buffer-is-modified (setq helm-multi-occur-buffer-tick new-tick-ls))) + (run-with-idle-timer 0.1 nil (lambda () + (with-helm-buffer + (let ((ov (make-overlay (save-excursion + (goto-char (point-min)) + (forward-line 1) + (point)) + (point-max)))) + (overlay-put ov 'face 'helm-resume-need-update) + (sit-for 0.3) (delete-overlay ov) + (message "[Helm occur Buffer outdated (C-c C-u to update)]"))))) + (unless buffer-is-modified + (with-helm-after-update-hook + (setq helm-multi-occur-buffer-tick new-tick-ls) + (message "Helm (m)occur Buffer have been udated"))))))))) + +(defun helm-moccur-filter-one-by-one (candidate) + "`filter-one-by-one' function for `helm-source-moccur'." + (require 'helm-grep) + (let* ((split (helm-grep-split-line candidate)) + (buf (car split)) + (lineno (nth 1 split)) + (str (nth 2 split))) + (cons (concat (propertize + buf + 'face 'helm-moccur-buffer + 'help-echo (buffer-file-name + (get-buffer buf)) + 'buffer-name buf) + ":" + (propertize lineno 'face 'helm-grep-lineno) + ":" + (helm-grep-highlight-match + str helm-occur-match-plugin-mode)) + candidate))) + +(defun helm-multi-occur-1 (buffers &optional input) + "Main function to call `helm-source-moccur' with BUFFERS list." + (let ((bufs (if helm-moccur-always-search-in-current + (cons + ;; will become helm-current-buffer later. + (buffer-name (current-buffer)) + (remove helm-current-buffer helm-multi-occur-buffer-list)) + buffers))) + (helm-attrset 'moccur-buffers bufs helm-source-moccur) + (helm-set-local-variable 'helm-multi-occur-buffer-list bufs) + (helm-set-local-variable + 'helm-multi-occur-buffer-tick + (cl-loop for b in bufs + collect (buffer-chars-modified-tick (get-buffer b))))) + (helm :sources 'helm-source-moccur + :buffer "*helm multi occur*" + :history 'helm-grep-history + :input input + :truncate-lines t)) + +;;;###autoload +(defun helm-moccur-run-save-buffer () + "Run grep save results action from `helm-do-grep-1'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-moccur-save-results))) + + +;;; helm-moccur-mode +;; +;; +(defvar helm-moccur-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") 'helm-moccur-mode-goto-line) + (define-key map (kbd "C-o") 'helm-moccur-mode-goto-line-ow) + (define-key map (kbd "") 'undefined) + (define-key map (kbd "") 'undefined) + (define-key map (kbd "") 'helm-gm-next-file) + (define-key map (kbd "") 'helm-gm-precedent-file) + map)) + +(defun helm-moccur-mode-goto-line () + (interactive) + (helm-moccur-goto-line + (buffer-substring (point-at-bol) (point-at-eol)))) + +(defun helm-moccur-mode-goto-line-ow () + (interactive) + (helm-moccur-goto-line-ow + (buffer-substring (point-at-bol) (point-at-eol)))) + +(defun helm-moccur-save-results (_candidate) + "Save helm moccur results in a `helm-moccur-mode' buffer." + (let ((buf "*hmoccur*") + new-buf) + (when (get-buffer buf) + (setq new-buf (helm-read-string "OccurBufferName: " buf)) + (cl-loop for b in (helm-buffer-list) + when (and (string= new-buf b) + (not (y-or-n-p + (format "Buffer `%s' already exists overwrite? " + new-buf)))) + do (setq new-buf (helm-read-string "OccurBufferName: " "*hmoccur "))) + (setq buf new-buf)) + (with-current-buffer (get-buffer-create buf) + (setq buffer-read-only t) + (let ((inhibit-read-only t)) + (erase-buffer) + (insert "-*- mode: helm-moccur -*-\n\n" + (format "Moccur Results for `%s':\n\n" helm-pattern)) + (save-excursion + (insert (with-current-buffer helm-buffer + (goto-char (point-min)) (forward-line 1) + (buffer-substring (point) (point-max)))))) + (helm-moccur-mode) (pop-to-buffer buf)) + (message "Helm Moccur Results saved in `%s' buffer" buf))) + +;;;###autoload +(define-derived-mode helm-moccur-mode + special-mode "helm-moccur" + "Major mode to provide actions in helm moccur saved buffer. + +Special commands: +\\{helm-moccur-mode-map}" + (set (make-local-variable 'helm-multi-occur-buffer-list) + (with-helm-buffer helm-multi-occur-buffer-list)) + (set (make-local-variable 'revert-buffer-function) + #'helm-moccur-mode--revert-buffer-function)) + +(defun helm-moccur-mode--revert-buffer-function (&optional _ignore-auto _noconfirm) + (goto-char (point-min)) + (let (pattern) + (when (re-search-forward "^Moccur Results for `\\(.*\\)'" nil t) + (setq pattern (match-string 1)) + (forward-line 0) + (when (re-search-forward "^$" nil t) + (forward-line 1)) + (let ((inhibit-read-only t) + (buffer (current-buffer)) + (buflst helm-multi-occur-buffer-list)) + (delete-region (point) (point-max)) + (message "Reverting buffer...") + (save-excursion + (with-temp-buffer + (insert + "\n" + (cl-loop for buf in buflst + for bufstr = (or (and (buffer-live-p (get-buffer buf)) + (with-current-buffer buf + (buffer-string))) + "") + unless (string= bufstr "") + do (add-text-properties + 0 (length bufstr) + `(buffer-name ,(buffer-name (get-buffer buf))) + bufstr) + concat bufstr) + "\n") + (goto-char (point-min)) + (cl-loop while (re-search-forward pattern nil t) + for line = (helm-moccur-get-line (point-at-bol) (point-at-eol)) + when line + do (with-current-buffer buffer + (insert + (propertize + (car (helm-moccur-filter-one-by-one line)) + 'helm-real-value line) + "\n"))))) + (message "Reverting buffer done"))))) + + +;;; Predefined commands +;; +;; + +;;;###autoload +(defun helm-regexp () + "Preconfigured helm to build regexps. +`query-replace-regexp' can be run from there against found regexp." + (interactive) + (save-restriction + (when (and (helm-region-active-p) + ;; Don't narrow to region if buffer is already narrowed. + (not (helm-current-buffer-narrowed-p (current-buffer)))) + (narrow-to-region (region-beginning) (region-end))) + (helm :sources helm-source-regexp + :buffer "*helm regexp*" + :prompt "Regexp: " + :history 'helm-build-regexp-history))) + +;;;###autoload +(defun helm-occur () + "Preconfigured helm for Occur." + (interactive) + (helm-occur-init-source) + (let ((bufs (list (buffer-name (current-buffer))))) + (helm-attrset 'moccur-buffers bufs helm-source-occur) + (helm-set-local-variable 'helm-multi-occur-buffer-list bufs) + (helm-set-local-variable + 'helm-multi-occur-buffer-tick + (cl-loop for b in bufs + collect (buffer-chars-modified-tick (get-buffer b))))) + (helm :sources 'helm-source-occur + :buffer "*helm occur*" + :history 'helm-grep-history + :preselect (and (memq 'helm-source-occur helm-sources-using-default-as-input) + (format "%s:%d:" (buffer-name) (line-number-at-pos (point)))) + :truncate-lines t)) + +;;;###autoload +(defun helm-occur-from-isearch () + "Invoke `helm-occur' from isearch." + (interactive) + (let ((input (if isearch-regexp + isearch-string + (regexp-quote isearch-string))) + (bufs (list (buffer-name (current-buffer))))) + (isearch-exit) + (helm-occur-init-source) + (helm-attrset 'moccur-buffers bufs helm-source-occur) + (helm-set-local-variable 'helm-multi-occur-buffer-list bufs) + (helm-set-local-variable + 'helm-multi-occur-buffer-tick + (cl-loop for b in bufs + collect (buffer-chars-modified-tick (get-buffer b)))) + (helm :sources 'helm-source-occur + :buffer "*helm occur*" + :history 'helm-grep-history + :input input + :truncate-lines t))) + +;;;###autoload +(defun helm-multi-occur (buffers) + "Preconfigured helm for multi occur. + + BUFFERS is a list of buffers to search through. +With a prefix arg, reverse the behavior of +`helm-moccur-always-search-in-current'. +The prefix arg can be set before calling `helm-multi-occur' +or during the buffer selection." + (interactive (list (helm-comp-read + "Buffers: " (helm-buffer-list) + :marked-candidates t))) + (let ((helm-moccur-always-search-in-current + (if (or current-prefix-arg + helm-current-prefix-arg) + (not helm-moccur-always-search-in-current) + helm-moccur-always-search-in-current))) + (helm-multi-occur-1 buffers))) + +;;;###autoload +(defun helm-multi-occur-from-isearch (&optional _arg) + "Invoke `helm-multi-occur' from isearch. + +With a prefix arg, reverse the behavior of +`helm-moccur-always-search-in-current'. +The prefix arg can be set before calling +`helm-multi-occur-from-isearch' or during the buffer selection." + (interactive "p") + (let (buf-list + helm-moccur-always-search-in-current + (input (if isearch-regexp + isearch-string + (regexp-quote isearch-string)))) + (isearch-exit) + (setq buf-list (helm-comp-read "Buffers: " + (helm-buffer-list) + :name "Occur in buffer(s)" + :marked-candidates t)) + (setq helm-moccur-always-search-in-current + (if (or current-prefix-arg + helm-current-prefix-arg) + (not helm-moccur-always-search-in-current) + helm-moccur-always-search-in-current)) + (helm-multi-occur-1 buf-list input))) + + +(provide 'helm-regexp) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-regexp.el ends here diff --git a/elpa/helm-20140808.2300/helm-regexp.elc b/elpa/helm-20140808.2300/helm-regexp.elc new file mode 100644 index 000000000..ec467c650 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-regexp.elc differ diff --git a/elpa/helm-20140808.2300/helm-ring.el b/elpa/helm-20140808.2300/helm-ring.el new file mode 100644 index 000000000..1493ff476 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-ring.el @@ -0,0 +1,378 @@ +;;; helm-ring.el --- kill-ring, mark-ring, and register browsers for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) +(require 'helm-elisp) + +(declare-function undo-tree-restore-state-from-register "ext:undo-tree.el" (register)) + + +(defgroup helm-ring nil + "Ring related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-kill-ring-threshold 3 + "Minimum length of a candidate to be listed by `helm-source-kill-ring'." + :type 'integer + :group 'helm-ring) + +(defcustom helm-kill-ring-max-lines-number 5 + "Max number of lines displayed per candidate in kill-ring browser. +If nil or zero (disabled), don't truncate candidate, show all." + :type '(choice (const :tag "Disabled" nil) + (integer :tag "Max number of lines")) + :group 'helm-ring) + +(defcustom helm-kill-ring-show-completion t + "Show yank contents with an overlay in current buffer." + :group 'helm-ring + :type 'boolean) + +(defcustom helm-register-max-offset 160 + "Max size of string register entries before truncating." + :group 'helm-ring + :type 'integer) + + +;;; Kill ring +;; +;; +(defvar helm-kill-ring-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-y") 'helm-next-line) + (define-key map (kbd "M-u") 'helm-previous-line) + map) + "Keymap for `helm-show-kill-ring'.") + +(defvar helm-source-kill-ring + `((name . "Kill Ring") + (init . (lambda () (helm-attrset 'last-command last-command))) + (candidates . helm-kill-ring-candidates) + (filtered-candidate-transformer helm-kill-ring-transformer) + (action . (("Yank" . helm-kill-ring-action) + ("Delete" . (lambda (candidate) + (cl-loop for cand in (helm-marked-candidates) + do (setq kill-ring + (delete cand kill-ring))))))) + (persistent-action . (lambda (_candidate) (ignore))) + (persistent-help . "DoNothing") + (keymap . ,helm-kill-ring-map) + (last-command) + (migemo) + (multiline)) + "Source for browse and insert contents of kill-ring.") + +(defun helm-kill-ring-candidates () + (cl-loop for kill in (helm-fast-remove-dups kill-ring :test 'equal) + unless (or (< (length kill) helm-kill-ring-threshold) + (string-match "\\`[\n[:blank:]]+\\'" kill)) + collect kill)) + +(defun helm-kill-ring-transformer (candidates _source) + "Display only the `helm-kill-ring-max-lines-number' lines of candidate." + (cl-loop for i in candidates + for nlines = (with-temp-buffer (insert i) (count-lines (point-min) (point-max))) + if (and helm-kill-ring-max-lines-number + (> nlines helm-kill-ring-max-lines-number)) + collect (cons + (with-temp-buffer + (insert i) + (goto-char (point-min)) + (concat + (buffer-substring + (point-min) + (save-excursion + (forward-line helm-kill-ring-max-lines-number) + (point))) + "[...]")) i) + else collect i)) + +(defun helm-kill-ring-action (str) + "Insert STR in `kill-ring' and set STR to the head. +If this action is executed just after `yank', +replace with STR as yanked string." + (with-helm-current-buffer + (setq kill-ring (delete str kill-ring)) + (if (not (eq (helm-attr 'last-command helm-source-kill-ring) 'yank)) + (run-with-timer 0.01 nil `(lambda () (insert-for-yank ,str))) + ;; from `yank-pop' + (let ((inhibit-read-only t) + (before (< (point) (mark t)))) + (if before + (funcall (or yank-undo-function 'delete-region) (point) (mark t)) + (funcall (or yank-undo-function 'delete-region) (mark t) (point))) + (setq yank-undo-function nil) + (set-marker (mark-marker) (point) helm-current-buffer) + (run-with-timer 0.01 nil `(lambda () (insert-for-yank ,str))) + ;; Set the window start back where it was in the yank command, + ;; if possible. + (set-window-start (selected-window) yank-window-start t) + (when before + ;; This is like exchange-point-and-mark, but doesn't activate the mark. + ;; It is cleaner to avoid activation, even though the command + ;; loop would deactivate the mark because we inserted text. + (goto-char (prog1 (mark t) + (set-marker (mark-marker) (point) helm-current-buffer)))))) + (kill-new str))) + + + + +;;;; +;; DO NOT use these sources with other sources use +;; the commands `helm-mark-ring', `helm-global-mark-ring' or +;; `helm-all-mark-rings' instead. + +(defun helm-mark-ring-get-marks (pos) + (save-excursion + (goto-char pos) + (forward-line 0) + (let ((line (car (split-string (thing-at-point 'line) "[\n\r]")))) + (when (string= "" line) + (setq line "")) + (format "%7d: %s" (line-number-at-pos) line)))) + +(defun helm-mark-ring-get-candidates () + (with-helm-current-buffer + (cl-loop with marks = (if (mark t) (cons (mark-marker) mark-ring) mark-ring) + for i in marks + for m = (helm-mark-ring-get-marks i) + unless (and recip (member m recip)) + collect m into recip + finally return recip))) + +(defvar helm-source-mark-ring + '((name . "mark-ring") + (candidates . helm-mark-ring-get-candidates) + (action . (("Goto line" + . (lambda (candidate) + (helm-goto-line (string-to-number candidate)))))) + (persistent-action . (lambda (candidate) + (helm-goto-line (string-to-number candidate)) + (helm-highlight-current-line))) + (persistent-help . "Show this line"))) + + +;;; Global-mark-ring +(defvar helm-source-global-mark-ring + '((name . "global-mark-ring") + (candidates . helm-global-mark-ring-get-candidates) + (action . (("Goto line" + . (lambda (candidate) + (let ((items (split-string candidate ":"))) + (helm-switch-to-buffer (cl-second items)) + (helm-goto-line (string-to-number (car items)))))))) + (persistent-action . (lambda (candidate) + (let ((items (split-string candidate ":"))) + (helm-switch-to-buffer (cl-second items)) + (helm-goto-line (string-to-number (car items))) + (helm-highlight-current-line)))) + (persistent-help . "Show this line"))) + +(defun helm-global-mark-ring-format-buffer (marker) + (with-current-buffer (marker-buffer marker) + (goto-char marker) + (forward-line 0) + (let (line) + (if (string= "" line) + (setq line "") + (setq line (car (split-string (thing-at-point 'line) + "[\n\r]")))) + (format "%7d:%s: %s" + (line-number-at-pos) (marker-buffer marker) line)))) + +(defun helm-global-mark-ring-get-candidates () + (let ((marks global-mark-ring)) + (when marks + (cl-loop for i in marks + for gm = (unless (or (string-match + "^ " (format "%s" (marker-buffer i))) + (null (marker-buffer i))) + (helm-global-mark-ring-format-buffer i)) + when (and gm (not (member gm recip))) + collect gm into recip + finally return recip)))) + + +;;;; +;;; Insert from register +(defvar helm-source-register + '((name . "Registers") + (candidates . helm-register-candidates) + (action-transformer . helm-register-action-transformer) + (multiline) + (action)) + "See (info \"(emacs)Registers\")") + +(defun helm-register-candidates () + "Collecting register contents and appropriate commands." + (cl-loop for (char . val) in register-alist + for key = (single-key-description char) + for string-actions = + (cond + ((numberp val) + (list (int-to-string val) + 'insert-register + 'increment-register)) + ((markerp val) + (let ((buf (marker-buffer val))) + (if (null buf) + (list "a marker in no buffer") + (list (concat + "a buffer position:" + (buffer-name buf) + ", position " + (int-to-string (marker-position val))) + 'jump-to-register + 'insert-register)))) + ((and (consp val) (window-configuration-p (car val))) + (list "window configuration." + 'jump-to-register)) + ((and (vectorp val) + (fboundp 'undo-tree-register-data-p) + (undo-tree-register-data-p (elt val 1))) + (list + "Undo-tree entry." + 'undo-tree-restore-state-from-register)) + ((or (and (vectorp val) (eq 'registerv (aref val 0))) + (and (consp val) (frame-configuration-p (car val)))) + (list "frame configuration." + 'jump-to-register)) + ((and (consp val) (eq (car val) 'file)) + (list (concat "file:" + (prin1-to-string (cdr val)) + ".") + 'jump-to-register)) + ((and (consp val) (eq (car val) 'file-query)) + (list (concat "file:a file-query reference: file " + (car (cdr val)) + ", position " + (int-to-string (car (cdr (cdr val)))) + ".") + 'jump-to-register)) + ((consp val) + (let ((lines (format "%4d" (length val)))) + (list (format "%s: %s\n" lines + (truncate-string-to-width + (mapconcat 'identity (list (car val)) + "^J") (- (window-width) 15))) + 'insert-register))) + ((stringp val) + (list + ;; without properties + (concat (substring-no-properties + val 0 (min (length val) helm-register-max-offset)) + (if (> (length val) helm-register-max-offset) + "[...]" "")) + 'insert-register + 'append-to-register + 'prepend-to-register)) + (t + "GARBAGE!")) + collect (cons (format "Register %3s:\n %s" key (car string-actions)) + (cons char (cdr string-actions))))) + +(defun helm-register-action-transformer (_actions register-and-functions) + "Decide actions by the contents of register." + (cl-loop with func-actions = + '((insert-register + "Insert Register" . + (lambda (c) (insert-register (car c)))) + (jump-to-register + "Jump to Register" . + (lambda (c) (jump-to-register (car c)))) + (append-to-register + "Append Region to Register" . + (lambda (c) (append-to-register + (car c) (region-beginning) (region-end)))) + (prepend-to-register + "Prepend Region to Register" . + (lambda (c) (prepend-to-register + (car c) (region-beginning) (region-end)))) + (increment-register + "Increment Prefix Arg to Register" . + (lambda (c) (increment-register + helm-current-prefix-arg (car c)))) + (undo-tree-restore-state-from-register + "Restore Undo-tree register" + (lambda (c) (and (fboundp 'undo-tree-restore-state-from-register) + (undo-tree-restore-state-from-register (car c)))))) + for func in (cdr register-and-functions) + for cell = (assq func func-actions) + when cell + collect (cdr cell))) + +;;;###autoload +(defun helm-mark-ring () + "Preconfigured `helm' for `helm-source-mark-ring'." + (interactive) + (helm :sources 'helm-source-mark-ring + :resume 'noresume + :buffer "*helm mark*")) + +;;;###autoload +(defun helm-global-mark-ring () + "Preconfigured `helm' for `helm-source-global-mark-ring'." + (interactive) + (helm :sources 'helm-source-global-mark-ring + :resume 'noresume + :buffer "*helm global mark*")) + +;;;###autoload +(defun helm-all-mark-rings () + "Preconfigured `helm' for `helm-source-global-mark-ring' and \ +`helm-source-mark-ring'." + (interactive) + (helm :sources '(helm-source-mark-ring + helm-source-global-mark-ring) + :resume 'noresume + :buffer "*helm mark ring*")) + +;;;###autoload +(defun helm-register () + "Preconfigured `helm' for Emacs registers." + (interactive) + (helm :sources 'helm-source-register + :resume 'noresume + :buffer "*helm register*")) + +;;;###autoload +(defun helm-show-kill-ring () + "Preconfigured `helm' for `kill-ring'. +It is drop-in replacement of `yank-pop'. + +First call open the kill-ring browser, next calls move to next line." + (interactive) + (helm :sources helm-source-kill-ring + :buffer "*helm kill ring*" + :resume 'noresume + :allow-nest t)) + +(provide 'helm-ring) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-ring.el ends here diff --git a/elpa/helm-20140808.2300/helm-ring.elc b/elpa/helm-20140808.2300/helm-ring.elc new file mode 100644 index 000000000..c8f0718a4 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-ring.elc differ diff --git a/elpa/helm-20140808.2300/helm-semantic.el b/elpa/helm-20140808.2300/helm-semantic.el new file mode 100644 index 000000000..c1a0d2728 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-semantic.el @@ -0,0 +1,156 @@ +;;; helm-semantic.el --- Helm interface for Semantic -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Daniel Hackney +;; Author: Daniel Hackney + +;; 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 . + +;;; Commentary: + +;; Uses `candidates-in-buffer' for speed. + +;;; Code: + +(require 'cl-lib) +(require 'semantic) +(require 'helm-imenu) + +(declare-function pulse-momentary-highlight-one-line "pulse.el" (point &optional face)) + +(defcustom helm-semantic-lynx-style-map t + "Use Arrow keys to jump to occurences." + :group 'helm-imenu + :type 'boolean) + +;;; keymap +(defvar helm-semantic-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-semantic-help) + (when helm-imenu-lynx-style-map + (define-key map (kbd "") 'helm-maybe-exit-minibuffer) + (define-key map (kbd "") 'helm-execute-persistent-action)) + (delq nil map))) + +(defun helm-semantic-init-candidates (tags depth &optional class) + "Write the contents of TAGS to the current buffer." + (let ((class class) cur-type) + (cl-dolist (tag tags) + (when (listp tag) + (cl-case (setq cur-type (semantic-tag-class tag)) + ((function variable type) + (let ((spaces (make-string (* depth 2) ?\s)) + (type-p (eq cur-type 'type))) + (unless (and (> depth 0) (not type-p)) + (setq class nil)) + (insert + (if (and class (not type-p)) + (format "%s%sClass(%s) " + spaces (if (< depth 2) "" "├►") class) + spaces) + ;; Save the tag for later + (propertize (semantic-format-tag-summarize tag nil t) + 'semantic-tag tag) + "\n") + (and type-p (setq class (car tag))) + ;; Recurse to children + (helm-semantic-init-candidates + (semantic-tag-components tag) (1+ depth) class))) + + ;; Don't do anything with packages or includes for now + ((package include)) + ;; Catch-all + (t)))))) + +(defun helm-semantic-default-action (_candidate &optional persistent) + ;; By default, helm doesn't pass on the text properties of the selection. + ;; Fix this. + (helm-log-run-hook 'helm-goto-line-before-hook) + (with-current-buffer helm-buffer + (when (looking-at " ") + (goto-char (next-single-property-change + (point-at-bol) 'semantic-tag nil (point-at-eol)))) + (let ((tag (get-text-property (point) 'semantic-tag))) + (semantic-go-to-tag tag) + (unless persistent + (pulse-momentary-highlight-one-line (point)))))) + +(defun helm-semantic--maybe-set-needs-update () + (with-helm-current-buffer + (let ((tick (buffer-modified-tick))) + (unless (eq helm-cached-imenu-tick tick) + (setq helm-cached-imenu-tick tick) + (semantic-parse-tree-set-needs-update))))) + +(defvar helm-source-semantic + `((name . "Semantic Tags") + (init . (lambda () + (helm-semantic--maybe-set-needs-update) + (let ((tags (semantic-fetch-tags))) + (with-current-buffer (helm-candidate-buffer 'global) + (helm-semantic-init-candidates tags 0))))) + (candidates-in-buffer) + (allow-dups) + (get-line . buffer-substring) + (persistent-action . (lambda (elm) + (helm-semantic-default-action elm t) + (helm-highlight-current-line))) + (persistent-help . "Show this entry") + (keymap . ,helm-semantic-map) + (mode-line . helm-semantic-mode-line) + (action . helm-semantic-default-action) + "Source to search tags using Semantic from CEDET.")) + +;;;###autoload +(defun helm-semantic () + "Preconfigured `helm' for `semantic'." + (interactive) + (let ((str (thing-at-point 'symbol))) + (helm :sources 'helm-source-semantic + :default (list (concat "\\_<" str "\\_>") str) + :candidate-number-limit 9999 + :buffer "*helm semantic*"))) + +;;;###autoload +(defun helm-semantic-or-imenu () + "Run `helm' with `semantic' or `imenu'. + +If `semantic-mode' is active in the current buffer, then use +semantic for generating tags, otherwise fall back to `imenu'. +Fill in the symbol at point by default." + (interactive) + (let* ((source (if (semantic-active-p) + 'helm-source-semantic + 'helm-source-imenu)) + (imenu-p (eq source 'helm-source-imenu)) + (str (thing-at-point 'symbol)) + (imenu-auto-rescan imenu-p) + (helm-execute-action-at-once-if-one + (and imenu-p + helm-imenu-execute-action-at-once-if-one))) + (helm :sources source + :default (list (concat "\\_<" str "\\_>") str) + :buffer "*helm semantic/imenu*" + :candidate-number-limit 9999 + :preselect (unless imenu-p (thing-at-point 'symbol))))) + +(provide 'helm-semantic) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-semantic.el ends here diff --git a/elpa/helm-20140808.2300/helm-semantic.elc b/elpa/helm-20140808.2300/helm-semantic.elc new file mode 100644 index 000000000..3edea4d5a Binary files /dev/null and b/elpa/helm-20140808.2300/helm-semantic.elc differ diff --git a/elpa/helm-20140808.2300/helm-sys.el b/elpa/helm-20140808.2300/helm-sys.el new file mode 100644 index 000000000..a1ec822bf --- /dev/null +++ b/elpa/helm-20140808.2300/helm-sys.el @@ -0,0 +1,295 @@ +;;; helm-sys.el --- System related functions for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) + + +(defgroup helm-sys nil + "System related helm library." + :group 'helm) + +(defun helm-top-command-set-fn (var _value) + (set var + (cl-case system-type + (darwin "env COLUMNS=%s ps -axo pid,user,pri,nice,ucomm,tty,start,vsz,%%cpu,%%mem,etime,command") + (t "env COLUMNS=%s top -b -n 1")))) + +(defcustom helm-top-command "env COLUMNS=%s top -b -n 1" + "Top command used to display output of top. +To use top command, a version supporting batch mode (-b option) is needed. +On Mac OSX top command doesn't support this, so ps command +is used by default instead. +If you modify this the number and order of elements displayed +should be the same as top command to have the sort commands +working properly, that is 12 elements with the 2 first being +PID and USER and the last 4 being %CPU, %MEM, TIME and COMMAND. +A format string where %s will be replaced with `frame-width'." + :group 'helm-sys + :type 'string + :set 'helm-top-command-set-fn) + + +;;; Top (process) +;; +;; +(defvar helm-top-sort-fn nil) +(defvar helm-top-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-top-help) + (define-key map (kbd "M-P") 'helm-top-run-sort-by-cpu) + (define-key map (kbd "M-C") 'helm-top-run-sort-by-com) + (define-key map (kbd "M-M") 'helm-top-run-sort-by-mem) + (define-key map (kbd "M-U") 'helm-top-run-sort-by-user) + map)) + +(defvar helm-source-top + `((name . "Top") + (header-name . (lambda (name) (concat name " (Press C-c C-u to refresh)"))) + (init . helm-top-init) + (candidates-in-buffer) + (nomark) + (display-to-real . helm-top-display-to-real) + (persistent-action . helm-top-sh-persistent-action) + (persistent-help . "SIGTERM") + (mode-line . helm-top-mode-line) + (follow . never) + (keymap . ,helm-top-map) + (filtered-candidate-transformer . helm-top-sort-transformer) + (action-transformer . helm-top-action-transformer))) + +(defun helm-top-transformer (candidates _source) + "Transformer for `helm-top'. +Return empty string for non--valid candidates." + (cl-loop for disp in candidates collect + (if (string-match "^ *[0-9]+" disp) disp (cons disp "")))) + +(defun helm-top-action-transformer (actions _candidate) + "Action transformer for `top'. +Show actions only on line starting by a PID." + (let ((disp (helm-get-selection nil t))) + (cond ((string-match "^ *[0-9]+" disp) + (list '("kill (SIGTERM)" . (lambda (pid) (helm-top-sh "TERM" pid))) + '("kill (SIGKILL)" . (lambda (pid) (helm-top-sh "KILL" pid))) + '("kill (SIGINT)" . (lambda (pid) (helm-top-sh "INT" pid))) + '("kill (Choose signal)" + . (lambda (pid) + (helm-top-sh + (helm-comp-read (format "Kill [%s] with signal: " pid) + '("ALRM" "HUP" "INT" "KILL" "PIPE" "POLL" + "PROF" "TERM" "USR1" "USR2" "VTALRM" + "STKFLT" "PWR" "WINCH" "CHLD" "URG" + "TSTP" "TTIN" "TTOU" "STOP" "CONT" + "ABRT" "FPE" "ILL" "QUIT" "SEGV" + "TRAP" "SYS" "EMT" "BUS" "XCPU" "XFSZ") + :must-match t) + pid))))) + (t actions)))) + +(defun helm-top-sh (sig pid) + "Run kill shell command with signal SIG on PID for `helm-top'." + (let ((cmd (format "kill -%s %s" sig pid))) + (message "Executed %s\n%s" cmd (shell-command-to-string cmd)))) + +(defun helm-top-sh-persistent-action (pid) + (delete-other-windows) + (helm-top-sh "TERM" pid) + (helm-force-update)) + +(defun helm-top-init () + "Insert output of top command in candidate buffer." + (unless helm-top-sort-fn (helm-top-set-mode-line "CPU")) + (with-current-buffer (helm-candidate-buffer 'global) + (call-process-shell-command + (format helm-top-command (frame-width)) + nil (current-buffer)))) + +(defun helm-top-display-to-real (line) + "Return pid only from LINE." + (car (split-string line))) + +;; Sort top command + +(defun helm-top-set-mode-line (str) + (if (string-match "Sort:\\[\\(.*\\)\\] " helm-top-mode-line) + (setq helm-top-mode-line (replace-match str nil nil helm-top-mode-line 1)) + (setq helm-top-mode-line (concat (format "Sort:[%s] " str) helm-top-mode-line)))) + +(defun helm-top-sort-transformer (candidates source) + (helm-top-transformer + (if helm-top-sort-fn + (cl-loop for c in candidates + if (string-match "^ *[0-9]+" c) collect c into pid-cands + else collect c into header-cands + finally return (append (if (cdr header-cands) + (butlast header-cands) + header-cands) + (sort pid-cands helm-top-sort-fn))) + candidates) + source)) + +(defun helm-top-sort-by-com (s1 s2) + (let* ((split-1 (split-string s1)) + (split-2 (split-string s2)) + (com-1 (nth 11 split-1)) + (com-2 (nth 11 split-2))) + (string< com-1 com-2))) + +(defun helm-top-sort-by-mem (s1 s2) + (let* ((split-1 (split-string s1)) + (split-2 (split-string s2)) + (mem-1 (string-to-number (nth 9 split-1))) + (mem-2 (string-to-number (nth 9 split-2)))) + (> mem-1 mem-2))) + +(defun helm-top-sort-by-user (s1 s2) + (let* ((split-1 (split-string s1)) + (split-2 (split-string s2)) + (user-1 (nth 1 split-1)) + (user-2 (nth 1 split-2))) + (string< user-1 user-2))) + +;;;###autoload +(defun helm-top-run-sort-by-com () + (interactive) + (helm-top-set-mode-line "COM") + (setq helm-top-sort-fn 'helm-top-sort-by-com) + (helm-force-update)) + +;;;###autoload +(defun helm-top-run-sort-by-cpu () + (interactive) + (helm-top-set-mode-line "CPU") + (setq helm-top-sort-fn nil) + (helm-force-update)) + +;;;###autoload +(defun helm-top-run-sort-by-mem () + (interactive) + (helm-top-set-mode-line "MEM") + (setq helm-top-sort-fn 'helm-top-sort-by-mem) + (helm-force-update)) + +;;;###autoload +(defun helm-top-run-sort-by-user () + (interactive) + (helm-top-set-mode-line "USER") + (setq helm-top-sort-fn 'helm-top-sort-by-user) + (helm-force-update)) + + +;;; X RandR resolution change +;; +;; +;;; FIXME I do not care multi-display. + +(defun helm-xrandr-info () + "Return a pair with current X screen number and current X display name." + (with-temp-buffer + (call-process "xrandr" nil (current-buffer) nil + "--current") + (let (screen output) + (goto-char (point-min)) + (save-excursion + (when (re-search-forward "\\(^Screen \\)\\([0-9]\\):" nil t) + (setq screen (match-string 2)))) + (when (re-search-forward "^\\(.*\\) connected" nil t) + (setq output (match-string 1))) + (list screen output)))) + +(defun helm-xrandr-screen () + "Return current X screen number." + (car (helm-xrandr-info))) + +(defun helm-xrandr-output () + "Return current X display name." + (cadr (helm-xrandr-info))) + +(defvar helm-source-xrandr-change-resolution + '((name . "Change Resolution") + (candidates + . (lambda () + (with-temp-buffer + (call-process "xrandr" nil (current-buffer) nil + "--screen" (helm-xrandr-screen) "-q") + (goto-char 1) + (cl-loop with modes = nil + while (re-search-forward " \\([0-9]+x[0-9]+\\)" nil t) + for mode = (match-string 1) + unless (member mode modes) + collect mode into modes + finally return modes)))) + (action + ("Change Resolution" + . (lambda (mode) + (call-process "xrandr" nil nil nil + "--screen" (helm-xrandr-screen) + "--output" (helm-xrandr-output) + "--mode" mode)))))) + + +;;; Emacs process +;; +;; +(defvar helm-source-emacs-process + '((name . "Emacs Process") + (init . (lambda () (list-processes--refresh))) + (candidates . (lambda () (mapcar #'process-name (process-list)))) + (persistent-action . (lambda (elm) + (delete-process (get-process elm)) + (helm-delete-current-selection))) + (update . list-processes--refresh) + (persistent-help . "Kill Process") + (action ("Kill Process" . (lambda (elm) + (delete-process (get-process elm))))))) + + +;;;###autoload +(defun helm-top () + "Preconfigured `helm' for top command." + (interactive) + (save-window-excursion + (unless helm-alive-p (delete-other-windows)) + (helm :sources 'helm-source-top + :buffer "*helm top*" :full-frame t + :candidate-number-limit 9999))) + +;;;###autoload +(defun helm-list-emacs-process () + "Preconfigured `helm' for emacs process." + (interactive) + (helm-other-buffer 'helm-source-emacs-process "*helm process*")) + +;;;###autoload +(defun helm-xrandr-set () + (interactive) + (helm :sources 'helm-source-xrandr-change-resolution + :buffer "*helm xrandr*")) + +(provide 'helm-sys) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-sys.el ends here diff --git a/elpa/helm-20140808.2300/helm-sys.elc b/elpa/helm-20140808.2300/helm-sys.elc new file mode 100644 index 000000000..6ce3f8276 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-sys.elc differ diff --git a/elpa/helm-20140808.2300/helm-tags.el b/elpa/helm-20140808.2300/helm-tags.el new file mode 100644 index 000000000..06d51dac1 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-tags.el @@ -0,0 +1,339 @@ +;;; helm-tags.el --- Helm for Etags and Ctags. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-utils) + + +(defgroup helm-tags nil + "Tags related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-etags-tag-file-name "TAGS" + "Etags tag file name." + :type 'string + :group 'helm-tags) + +(defcustom helm-etags-tag-file-search-limit 10 + "The limit level of directory to search tag file. +Don't search tag file deeply if outside this value." + :type 'number + :group 'helm-tags) + +(defcustom helm-etags-match-part-only t + "Whether to match only the tag part of CANDIDATE in +helm-source-ctags-select." + :type 'boolean + :group 'helm-tags) + +(defcustom helm-etags-execute-action-at-once-if-one t + "Whether to jump straight to the selected tag if there's only +one match." + :type 'boolean + :group 'helm-tags) + +(defun helm-etags-run-switch-other-window () + "Run switch to other window action from `helm-source-etags-select'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action + (lambda (c) + (helm-etags-action-goto 'find-file-other-window c))))) + +(defun helm-etags-run-switch-other-frame () + "Run switch to other frame action from `helm-source-etags-select'." + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action + (lambda (c) + (helm-etags-action-goto 'find-file-other-frame c))))) + +(defvar helm-etags-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-") 'helm-goto-next-file) + (define-key map (kbd "M-") 'helm-goto-precedent-file) + (define-key map (kbd "C-w") 'helm-yank-text-at-point) + (define-key map (kbd "C-c ?") 'helm-etags-help) + (define-key map (kbd "C-c o") 'helm-etags-run-switch-other-window) + (define-key map (kbd "C-c C-o") 'helm-etags-run-switch-other-frame) + map) + "Keymap used in Etags.") + + +;;; Ctags +;; +;; +(defvar helm-ctags-modes + '( c-mode c++-mode awk-mode csharp-mode java-mode javascript-mode lua-mode + makefile-mode pascal-mode perl-mode cperl-mode php-mode python-mode + scheme-mode sh-mode slang-mode sql-mode tcl-mode )) + +(defun helm-ctags-init () + (when (and buffer-file-name + (memq major-mode helm-ctags-modes) + (helm-current-buffer-is-modified)) + (with-current-buffer (helm-candidate-buffer 'local) + (call-process-shell-command + (if (string-match "\\.el\\.gz$" helm-buffer-file-name) + (format "ctags -e -u -f- --language-force=lisp --fields=n =(zcat %s) " + helm-buffer-file-name) + (format "ctags -e -u -f- --fields=n %s " helm-buffer-file-name)) + nil (current-buffer)) + (goto-char (point-min)) + (forward-line 2) + (delete-region (point-min) (point)) + (cl-loop while (and (not (eobp)) (search-forward "\001" (point-at-eol) t)) + for lineno-start = (point) + for lineno = (buffer-substring + lineno-start + (1- (search-forward "," (point-at-eol) t))) + do + (forward-line 0) + (insert (format "%5s:" lineno)) + (search-forward "\177" (point-at-eol) t) + (delete-region (1- (point)) (point-at-eol)) + (forward-line 1))))) + +(defvar helm-source-ctags + '((name . "Exuberant ctags") + (init . helm-ctags-init) + (candidates-in-buffer) + (adjust) + (type . line)) + "Needs Exuberant Ctags. + +http://ctags.sourceforge.net/") + + +;;; Etags +;; +;; +(defvar helm-etags-mtime-alist nil + "Store the last modification time of etags files here.") +(defvar helm-etags-cache (make-hash-table :test 'equal) + "Cache content of etags files used here for faster access.") + +(defun helm-etags-get-tag-file (&optional directory) + "Return the path of etags file if found. +Lookes recursively in parents directorys for a +`helm-etags-tag-file-name' file." + ;; Get tag file from `default-directory' or upper directory. + (let ((current-dir (helm-etags-find-tag-file-directory + (or directory default-directory)))) + ;; Return nil if not find tag file. + (when current-dir + (expand-file-name helm-etags-tag-file-name current-dir)))) + +(defun helm-etags-all-tag-files () + "Return files from the following sources; + 1) An automatically located file in the parent directories, by `helm-etags-get-tag-file'. + 2) `tags-file-name', which is commonly set by `find-tag' command. + 3) `tags-table-list' which is commonly set by `visit-tags-table' command." + (helm-fast-remove-dups + (delq nil + (append (list (helm-etags-get-tag-file) + tags-file-name) + tags-table-list)) + :test 'equal)) + +(defun helm-etags-find-tag-file-directory (current-dir) + "Try to find the directory containing tag file. +If not found in CURRENT-DIR search in upper directory." + (let ((file-exists? #'(lambda (dir) + (let ((tag-path (expand-file-name + helm-etags-tag-file-name dir))) + (and (stringp tag-path) + (file-regular-p tag-path) + (file-readable-p tag-path)))))) + (cl-loop with count = 0 + until (funcall file-exists? current-dir) + ;; Return nil if outside the value of + ;; `helm-etags-tag-file-search-limit'. + if (= count helm-etags-tag-file-search-limit) + do (cl-return nil) + ;; Or search upper directories. + else + do (cl-incf count) + (setq current-dir (expand-file-name (concat current-dir "../"))) + finally return current-dir))) + +(defun helm-etags-get-header-name (_x) + "Create header name for this helm etags session." + (concat "Etags in " + (with-helm-current-buffer + (helm-etags-get-tag-file)))) + +(defun helm-etags-create-buffer (file) + "Create the `helm-buffer' based on contents of etags tag FILE." + (let* ((tag-fname file) + max + (split (with-current-buffer (find-file-noselect tag-fname) + (prog1 + (split-string (buffer-string) "\n" 'omit-nulls) + (setq max (line-number-at-pos (point-max))) + (kill-buffer)))) + (progress-reporter (make-progress-reporter "Loading tag file..." 0 max))) + (cl-loop + with fname + with cand + for i in split for count from 0 + for elm = (unless (string-match "^\x0c" i) + (helm-aif (string-match "\177" i) + (substring i 0 it) + i)) + do (cond ((and elm (string-match "^\\([^,]+\\),[0-9]+$" elm)) + (setq fname (match-string 1 elm))) + (elm (setq cand (concat fname ": " elm))) + (t (setq cand nil))) + when cand do (progn + (insert (concat cand "\n")) + (progress-reporter-update progress-reporter count))))) + +(defun helm-etags-init () + "Feed `helm-buffer' using `helm-etags-cache' or tag file. +If no entry in cache, create one." + (let ((tagfiles (helm-etags-all-tag-files))) + (when tagfiles + (with-current-buffer (helm-candidate-buffer 'global) + (dolist (f tagfiles) + (helm-aif (gethash f helm-etags-cache) + ;; An entry is present in cache, insert it. + (insert it) + ;; No entry, create a new buffer using content of tag file (slower). + (helm-etags-create-buffer f) + ;; Store content of buffer in cache. + (puthash f (buffer-string) helm-etags-cache) + ;; Store or set the last modification of tag file. + (helm-aif (assoc f helm-etags-mtime-alist) + ;; If an entry exists modify it. + (setcdr it (helm-etags-mtime f)) + ;; No entry create a new one. + (add-to-list 'helm-etags-mtime-alist + (cons f (helm-etags-mtime f)))))))))) + +(defun helm-etags-split-line (line) + (let ((regexp "\\`\\([[:lower:][:upper:]]?:?.*?\\): \\(.*\\)")) + (when (string-match regexp line) + (cl-loop for n from 1 to 2 collect (match-string n line))))) + +(defvar helm-source-etags-select + `((name . "Etags") + (header-name . helm-etags-get-header-name) + (init . helm-etags-init) + (candidates-in-buffer) + (match-part . (lambda (candidate) + ;; Match only the tag part of CANDIDATE + ;; and not the filename. + (if helm-etags-match-part-only + (cadr (helm-etags-split-line candidate)) + candidate))) + (mode-line . helm-etags-mode-line-string) + (keymap . ,helm-etags-map) + (action . (("Go to tag" . (lambda (c) + (helm-etags-action-goto 'find-file c))) + ("Go to tag in other window" . (lambda (c) + (helm-etags-action-goto + 'find-file-other-window + c))) + ("Go to tag in other frame" . (lambda (c) + (helm-etags-action-goto + 'find-file-other-frame + c))))) + (persistent-help . "Go to line") + (persistent-action . (lambda (candidate) + (helm-etags-action-goto 'find-file candidate) + (helm-highlight-current-line)))) + "Helm source for Etags.") + +(defvar find-tag-marker-ring) + +(defun helm-etags-action-goto (switcher candidate) + "Helm default action to jump to an etags entry in other window." + (require 'etags) + (helm-log-run-hook 'helm-goto-line-before-hook) + (let* ((split (helm-etags-split-line candidate)) + (fname (cl-loop for tagf being the hash-keys of helm-etags-cache + for f = (expand-file-name + (car split) (file-name-directory tagf)) + when (file-exists-p f) + return f)) + (elm (cadr split))) + (if (null fname) + (error "file %s not found" fname) + (ring-insert find-tag-marker-ring (point-marker)) + (funcall switcher fname) + (goto-char (point-min)) + (search-forward elm nil t) + (goto-char (match-beginning 0))))) + +(defun helm-etags-mtime (file) + "Last modification time of etags tag FILE." + (cadr (nth 5 (file-attributes file)))) + +(defun helm-etags-file-modified-p (file) + "Check if tag FILE have been modified in this session. +If FILE is nil return nil." + (let ((last-modif (and file + (assoc-default file helm-etags-mtime-alist)))) + (and last-modif + (/= last-modif (helm-etags-mtime file))))) + + +;;;###autoload +(defun helm-etags-select (arg) + "Preconfigured helm for etags. +If called with a prefix argument or if any of the tag files have +been modified, reinitialize cache. + +This function aggregates three sources of tag files: + + 1) An automatically located file in the parent directories, by `helm-etags-get-tag-file'. + 2) `tags-file-name', which is commonly set by `find-tag' command. + 3) `tags-table-list' which is commonly set by `visit-tags-table' command." + (interactive "P") + (let ((tag-files (helm-etags-all-tag-files)) + (helm-execute-action-at-once-if-one helm-etags-execute-action-at-once-if-one) + (str (thing-at-point 'symbol))) + (if (cl-notany 'file-exists-p tag-files) + (message "Error: No tag file found. Create with etags shell command, or visit with `find-tag' or `visit-tags-table'.") + (cl-loop for k being the hash-keys of helm-etags-cache + unless (member k tag-files) + do (remhash k helm-etags-cache)) + (mapc (lambda (f) + (when (or (equal arg '(4)) + (and helm-etags-mtime-alist + (helm-etags-file-modified-p f))) + (remhash f helm-etags-cache))) + tag-files) + (helm :sources 'helm-source-etags-select + :keymap helm-etags-map + :default (list (concat "\\_<" str "\\_>") str) + :buffer "*helm etags*")))) + +(provide 'helm-tags) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-tags.el ends here diff --git a/elpa/helm-20140808.2300/helm-tags.elc b/elpa/helm-20140808.2300/helm-tags.elc new file mode 100644 index 000000000..db667f79b Binary files /dev/null and b/elpa/helm-20140808.2300/helm-tags.elc differ diff --git a/elpa/helm-20140808.2300/helm-utils.el b/elpa/helm-20140808.2300/helm-utils.el new file mode 100644 index 000000000..ccaf28cf1 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-utils.el @@ -0,0 +1,948 @@ +;;; helm-utils.el --- Utilities Functions for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'compile) ; Fixme: Is this needed? +(require 'dired) + +(declare-function helm-find-files-1 "helm-files.el" (fname &optional preselect)) + + +(defgroup helm-utils nil + "Utilities routines for Helm." + :group 'helm) + +(defcustom helm-su-or-sudo "sudo" + "What command to use for root access." + :type 'string + :group 'helm-utils) + +(defcustom helm-yank-symbol-first nil + "`helm-yank-text-at-point' yanks symbol at point on first +invocation if this is non-nil." + :type 'boolean + :group 'helm-utils) + +(defcustom helm-default-kbsize 1024.0 + "Default Kbsize to use for showing files size. +It is a float, usually 1024.0 but could be 1000.0 on some systems." + :group 'helm-utils + :type 'float) + +(defvar helm-goto-line-before-hook '(helm-save-current-pos-to-mark-ring) + "Run before jumping to line. +This hook run when jumping from `helm-goto-line', `helm-etags-default-action', +and `helm-imenu-default-action'.") + +(defvar helm-save-pos-before-jump-register ?_ + "The register where `helm-save-pos-to-register-before-jump' save position.") + +(defface helm-selection-line + '((t (:background "IndianRed4" :underline t))) + "Face used in the `helm-current-buffer' when jumping to candidate." + :group 'helm-utils) + + +;;; compatibility +;; +;; +(unless (fboundp 'window-system) + (defun window-system (&optional _arg) + window-system)) + +(unless (fboundp 'make-composed-keymap) + (defun make-composed-keymap (maps &optional parent) + "Construct a new keymap composed of MAPS and inheriting from PARENT. +When looking up a key in the returned map, the key is looked in each +keymap of MAPS in turn until a binding is found. +If no binding is found in MAPS, the lookup continues in PARENT, if non-nil. +As always with keymap inheritance, a nil binding in MAPS overrides +any corresponding binding in PARENT, but it does not override corresponding +bindings in other keymaps of MAPS. +MAPS can be a list of keymaps or a single keymap. +PARENT if non-nil should be a keymap." + `(keymap + ,@(if (keymapp maps) (list maps) maps) + ,@parent))) + +(unless (fboundp 'assoc-default) + (defun assoc-default (key alist &optional test default) + "Find object KEY in a pseudo-alist ALIST. +ALIST is a list of conses or objects. Each element (or the element's car, +if it is a cons) is compared with KEY by evaluating (TEST (car elt) KEY). +If that is non-nil, the element matches; +then `assoc-default' returns the element's cdr, if it is a cons, +or DEFAULT if the element is not a cons. + +If no element matches, the value is nil. +If TEST is omitted or nil, `equal' is used." + (let (found (tail alist) value) + (while (and tail (not found)) + (let ((elt (car tail))) + (when (funcall (or test 'equal) (if (consp elt) (car elt) elt) key) + (setq found t value (if (consp elt) (cdr elt) default)))) + (setq tail (cdr tail))) + value))) + +;; Function not available in XEmacs, +(unless (fboundp 'minibuffer-contents) + (defun minibuffer-contents () + "Return the user input in a minbuffer as a string. +The current buffer must be a minibuffer." + (field-string (point-max))) + + (defun delete-minibuffer-contents () + "Delete all user input in a minibuffer. +The current buffer must be a minibuffer." + (delete-field (point-max)))) + +;; Function not available in older Emacs (<= 22.1). +(unless (fboundp 'buffer-chars-modified-tick) + (defun buffer-chars-modified-tick (&optional buffer) + "Return BUFFER's character-change tick counter. +Each buffer has a character-change tick counter, which is set to the +value of the buffer's tick counter (see `buffer-modified-tick'), each +time text in that buffer is inserted or deleted. By comparing the +values returned by two individual calls of `buffer-chars-modified-tick', +you can tell whether a character change occurred in that buffer in +between these calls. No argument or nil as argument means use current +buffer as BUFFER." + (with-current-buffer (or buffer (current-buffer)) + (if (listp buffer-undo-list) + (length buffer-undo-list) + (buffer-modified-tick))))) + +;; Functions not available in versions < emacs-24. +;; Allow using helm-async.el in Emacs-23 among other things. +(unless (and (fboundp 'file-equal-p) + (fboundp 'file-in-directory-p)) + (defun file-equal-p (file1 file2) + "Return non-nil if files FILE1 and FILE2 name the same file. +If FILE1 or FILE2 does not exist, the return value is unspecified." + (let ((handler (or (find-file-name-handler file1 'file-equal-p) + (find-file-name-handler file2 'file-equal-p)))) + (if handler + (funcall handler 'file-equal-p file1 file2) + (let (f1-attr f2-attr) + (and (setq f1-attr (file-attributes (file-truename file1))) + (setq f2-attr (file-attributes (file-truename file2))) + (equal f1-attr f2-attr)))))) + + ;; This is the original loop version, more readable, not the one of 24.1+. + (defun file-in-directory-p (file dir) + "Return non-nil if FILE is in DIR or a subdirectory of DIR. +A directory is considered to be \"in\" itself. +Return nil if DIR is not an existing directory." + (let ((handler (or (find-file-name-handler file 'file-in-directory-p) + (find-file-name-handler dir 'file-in-directory-p)))) + (if handler + (funcall handler 'file-in-directory-p file dir) + (when (file-directory-p dir) + (cl-loop with f1 = (file-truename file) + with f2 = (file-truename dir) + with ls1 = (or (split-string f1 "/" t) (list "/")) + with ls2 = (or (split-string f2 "/" t) (list "/")) + for p = (string-match "^/" f1) + for i in ls1 for j in ls2 + when (string= i j) + concat (if p (concat "/" i) (concat i "/")) into root + finally return (file-equal-p (file-truename root) f2))))))) + + +;; CUA workaround +(defadvice cua-delete-region (around helm-avoid-cua activate) + (ignore-errors ad-do-it)) + +(defadvice copy-region-as-kill (around helm-avoid-cua activate) + (if cua-mode + (ignore-errors ad-do-it) + ad-do-it)) + + +;;; Utils functions +;; +;; +(defun helm-ff-find-printers () + "Return a list of available printers on Unix systems." + (when (executable-find "lpstat") + (let ((printer-list (with-temp-buffer + (call-process "lpstat" nil t nil "-a") + (split-string (buffer-string) "\n")))) + (cl-loop for p in printer-list + for printer = (car (split-string p)) + when printer + collect printer)))) + +;; Shut up byte compiler in emacs24*. +(defun helm-switch-to-buffer (buffer-or-name) + "Same as `switch-to-buffer' whithout warnings at compile time." + (with-no-warnings + (switch-to-buffer buffer-or-name))) + +(cl-defmacro helm-position (item seq &key (test 'eq) all) + "A simple and faster replacement of CL `position'. +Return position of first occurence of ITEM found in SEQ. +Argument SEQ can be a string, in this case ITEM have to be a char. +Argument ALL, if non--nil specify to return a list of positions of +all ITEM found in SEQ." + (let ((key (if (stringp seq) 'across 'in))) + `(cl-loop for c ,key ,seq + for index from 0 + when (funcall ,test c ,item) + if ,all collect index into ls + else return index + finally return ls))) + +(defun helm-substring (str width) + "Return the substring of string STR from 0 to WIDTH. +Handle multibyte characters by moving by columns." + (with-temp-buffer + (save-excursion + (insert str)) + (move-to-column width) + (buffer-substring (point-at-bol) (point)))) + +(cl-defun helm-substring-by-width (str width &optional (endstr "...")) + "Truncate string STR to end at column WIDTH. +Similar to `truncate-string-to-width'. +Add ENDSTR (default \"...\") at end of truncated STR. +Add spaces at end if needed to reach WIDTH when STR is shorter than WIDTH." + (cl-loop for ini-str = str + then (substring ini-str 0 (1- (length ini-str))) + for sw = (string-width ini-str) + when (<= sw width) return + (concat ini-str endstr (make-string (- width sw) ? )))) + +(defun helm-string-multibyte-p (str) + "Check if string STR contains multibyte characters." + (cl-loop for c across str + thereis (> (char-width c) 1))) + +(defun helm-get-pid-from-process-name (process-name) + "Get pid from running process PROCESS-NAME." + (cl-loop with process-list = (list-system-processes) + for pid in process-list + for process = (assoc-default 'comm (process-attributes pid)) + when (and process (string-match process-name process)) + return pid)) + +(cl-defun helm-current-buffer-narrowed-p (&optional + (buffer helm-current-buffer)) + "Check if BUFFER is narrowed. +Default is `helm-current-buffer'." + (with-current-buffer buffer + (let ((beg (point-min)) + (end (point-max)) + (total (buffer-size))) + (or (/= beg 1) (/= end (1+ total)))))) + +(defun helm-region-active-p () + (and transient-mark-mode mark-active (/= (mark) (point)))) + +(defun helm-goto-char (loc) + "Go to char, revealing if necessary." + (goto-char loc) + (when (or (eq major-mode 'org-mode) + (and (boundp 'outline-minor-mode) + outline-minor-mode)) + (require 'org) ; On some old Emacs versions org may not be loaded. + (org-reveal))) + +(defun helm-goto-line (lineno &optional noanim) + "Goto LINENO opening only outline headline if needed. +Animation is used unless NOANIM is non--nil." + (helm-log-run-hook 'helm-goto-line-before-hook) + (goto-char (point-min)) + (helm-goto-char (point-at-bol lineno)) + (unless noanim + (helm-highlight-current-line nil nil nil nil 'pulse))) + +(defun helm-save-pos-to-register-before-jump () + "Save current buffer position to `helm-save-pos-before-jump-register'. +To use this add it to `helm-goto-line-before-hook'." + (with-helm-current-buffer + (unless helm-in-persistent-action + (point-to-register helm-save-pos-before-jump-register)))) + +(defun helm-save-current-pos-to-mark-ring () + "Save current buffer position to mark ring. +To use this add it to `helm-goto-line-before-hook'." + (with-helm-current-buffer + (unless helm-in-persistent-action + (set-marker (mark-marker) (point)) + (push-mark (point) 'nomsg)))) + +;;;###autoload +(defun helm-show-all-in-this-source-only (arg) + "Show only current source of this helm session with all its candidates. +With a numeric prefix arg show only the ARG number of candidates." + (interactive "p") + (with-helm-window + (with-helm-default-directory helm-default-directory + (let ((helm-candidate-number-limit (and (> arg 1) arg))) + (helm-set-source-filter + (list (assoc-default 'name (helm-get-current-source)))))))) + +;;;###autoload +(defun helm-display-all-sources () + "Display all sources previously hidden by `helm-set-source-filter'." + (interactive) + (helm-set-source-filter nil)) + +(defun helm-displaying-source-names () + "Return the list of sources name for this helm session." + (with-current-buffer helm-buffer + (goto-char (point-min)) + (cl-loop with pos + while (setq pos (next-single-property-change (point) 'helm-header)) + do (goto-char pos) + collect (buffer-substring-no-properties (point-at-bol)(point-at-eol)) + do (forward-line 1)))) + +(defun helm-files-match-only-basename (candidate) + "Allow matching only basename of file when \" -b\" is added at end of pattern. +If pattern contain one or more spaces, fallback to match-plugin +even is \" -b\" is specified." + (let ((source (helm-get-current-source))) + (if (string-match "\\([^ ]*\\) -b\\'" helm-pattern) + (progn + (helm-attrset 'no-matchplugin nil source) + (string-match (match-string 1 helm-pattern) + (helm-basename candidate))) + ;; Disable no-matchplugin by side effect. + (helm-aif (assq 'no-matchplugin source) + (setq source (delete it source))) + (string-match + (replace-regexp-in-string " -b\\'" "" helm-pattern) + candidate)))) + +(defun helm--mapconcat-candidate (candidate) + "Transform string CANDIDATE in regexp. +e.g helm.el$ + => \"[^h]*h[^e]*e[^l]*l[^m]*m[^.]*[.][^e]*e[^l]*l$\" + ^helm.el$ + => \"helm[.]el$\"." + (let ((ls (split-string candidate "" t))) + (if (string= "^" (car ls)) + (mapconcat (lambda (c) + (if (string= c ".") + (concat "[" c "]") c)) + (cdr ls) "") + (mapconcat (lambda (c) + (cond ((string= c ".") + (concat "[^" c "]*" (concat "[" c "]"))) + ((string= c "$") c) + (t (concat "[^" c "]*" (regexp-quote c))))) + ls "")))) + +(defun helm-skip-entries (seq regexp-list) + "Remove entries which matches one of REGEXP-LIST from SEQ." + (cl-loop for i in seq + unless (cl-loop for regexp in regexp-list + thereis (and (stringp i) + (string-match regexp i))) + collect i)) + +(defun helm-shadow-entries (seq regexp-list) + "Put shadow property on entries in SEQ matching a regexp in REGEXP-LIST." + (let ((face 'italic)) + (cl-loop for i in seq + if (cl-loop for regexp in regexp-list + thereis (and (stringp i) + (string-match regexp i))) + collect (propertize i 'face face) + else collect i))) + +(defun helm-stringify (str-or-sym) + "Get string of STR-OR-SYM." + (if (stringp str-or-sym) + str-or-sym + (symbol-name str-or-sym))) + +(defun helm-symbolify (str-or-sym) + "Get symbol of STR-OR-SYM." + (if (symbolp str-or-sym) + str-or-sym + (intern str-or-sym))) + +(defun helm-describe-function (func) + "FUNC is symbol or string." + (describe-function (helm-symbolify func)) + (message nil)) + +(defun helm-describe-variable (var) + "VAR is symbol or string." + (describe-variable (helm-symbolify var)) + (message nil)) + +(defun helm-find-function (func) + "FUNC is symbol or string." + (find-function (helm-symbolify func))) + +(defun helm-find-variable (var) + "VAR is symbol or string." + (find-variable (helm-symbolify var))) + +(defun helm-kill-new (candidate &optional replace) + "CANDIDATE is symbol or string. +See `kill-new' for argument REPLACE." + (kill-new (helm-stringify candidate) replace)) + +(cl-defun helm-fast-remove-dups (seq &key (test 'eq)) + "Remove duplicates elements in list SEQ. +This is same as `remove-duplicates' but with memoisation. +It is much faster, especially in large lists. +A test function can be provided with TEST argument key. +Default is `eq'." + (cl-loop with cont = (make-hash-table :test test) + for elm in seq + unless (gethash elm cont) + do (puthash elm elm cont) + finally return + (cl-loop for i being the hash-values in cont collect i))) + +;;;###autoload +(defun helm-quit-and-find-file () + "Drop into `helm-find-files' from `helm'. +If current selection is a buffer or a file, `helm-find-files' +from its directory." + (interactive) + (require 'helm-grep) + (helm-run-after-quit + (lambda (f) + (if (file-exists-p f) + (helm-find-files-1 (file-name-directory f) + (regexp-quote + (if helm-ff-transformer-show-only-basename + (helm-basename f) f))) + (helm-find-files-1 f))) + (let* ((sel (helm-get-selection)) + (grep-line (and (stringp sel) + (helm-grep-split-line sel)))) + (if (stringp sel) + (helm-aif (get-buffer (or (get-text-property + (1- (length sel)) 'buffer-name sel) + sel)) + (or (buffer-file-name it) + (car (rassoc it dired-buffers)) + (and (with-current-buffer it + (eq major-mode 'org-agenda-mode)) + org-directory + (expand-file-name org-directory)) + (with-current-buffer it default-directory)) + (cond ((or (file-remote-p sel) + (file-exists-p sel)) + (expand-file-name sel)) + ((and grep-line (file-exists-p (car grep-line))) + (expand-file-name (car grep-line))) + ((and ffap-url-regexp (string-match ffap-url-regexp sel)) sel) + (t default-directory))) + default-directory)))) + +;; Same as `vc-directory-exclusion-list'. +(defvar helm-walk-ignore-directories + '("SCCS" "RCS" "CVS" "MCVS" ".svn" ".git" ".hg" ".bzr" + "_MTN" "_darcs" "{arch}")) + +(cl-defun helm-walk-directory (directory &key path (directories t) match skip-subdirs) + "Walk through DIRECTORY tree. +Argument PATH can be one of basename, relative, or full, default to basename. +Argument DIRECTORIES when non--nil (default) return also directories names, +otherwise skip directories names. +Argument MATCH can be a predicate or a regexp. +Argument SKIP-SUBDIRS when non--nil will skip `helm-walk-ignore-directories' +unless it is given as a list of directories, in this case this list will be used +instead of `helm-walk-ignore-directories'." + (let* (result + (fn (cl-case path + (basename 'file-name-nondirectory) + (relative 'file-relative-name) + (full 'identity) + (t 'file-name-nondirectory))) + ls-R) + (setq ls-R (lambda (dir) + (unless (and skip-subdirs + (member (helm-basename dir) + (if (listp skip-subdirs) + skip-subdirs + helm-walk-ignore-directories))) + (cl-loop with ls = (directory-files + dir t directory-files-no-dot-files-regexp) + for f in ls + if (file-directory-p f) + do (progn (when directories + (push (funcall fn f) result)) + ;; Don't recurse in directory symlink. + (unless (file-symlink-p f) + (funcall ls-R f))) + else do + (if match + (and (if (functionp match) + (funcall match f) + (and (stringp match) + (string-match + match (file-name-nondirectory f)))) + (push (funcall fn f) result)) + (push (funcall fn f) result)))))) + (funcall ls-R directory) + (nreverse result))) + +(defun helm-generic-sort-fn (s1 s2) + "Sort predicate function for helm candidates. +Args S1 and S2 can be single or \(display . real\) candidates, +that is sorting is done against real value of candidate." + (let* ((reg1 (concat "\\_<" helm-pattern "\\_>")) + (reg2 (concat "\\_<" helm-pattern)) + (split (split-string helm-pattern)) + (str1 (if (consp s1) (cdr s1) s1)) + (str2 (if (consp s2) (cdr s2) s2)) + (score #'(lambda (str r1 r2 lst) + (cond ((string-match r1 str) 4) + ((and (string-match " " helm-pattern) + (string-match (concat "\\_<" (car lst)) str) + (cl-loop for r in (cdr lst) + always (string-match r str))) 3) + ((and (string-match " " helm-pattern) + (cl-loop for r in lst always (string-match r str))) 2) + ((string-match r2 str) 1) + (t 0)))) + (sc1 (funcall score str1 reg1 reg2 split)) + (sc2 (funcall score str2 reg1 reg2 split))) + (cond ((or (zerop (string-width helm-pattern)) + (and (zerop sc1) (zerop sc2))) + (string-lessp str1 str2)) + ((= sc1 sc2) + (< (length str1) (length str2))) + (t (> sc1 sc2))))) + +(defun helm-basename (fname &optional ext) + "Print FNAME with any leading directory components removed. +If specified, also remove filename extension EXT." + (let ((non-essential t)) + (if (and ext (or (string= (file-name-extension fname) ext) + (string= (file-name-extension fname t) ext)) + (not (file-directory-p fname))) + (file-name-sans-extension (file-name-nondirectory fname)) + (file-name-nondirectory (directory-file-name fname))))) + +(defun helm-basedir (fname) + "Return the base directory of filename." + (helm-aif (and fname (file-name-directory fname)) + (file-name-as-directory it))) + +(defun helm-ff-get-host-from-tramp-invalid-fname (fname) + "Extract hostname from an incomplete tramp file name. +Return nil on valid file name remote or not." + (let* ((str (helm-basename fname)) + (split (split-string str ":")) + (meth (car (member (car split) (mapcar 'car tramp-methods))))) + (when (and meth (<= (length split) 2)) + (cadr split)))) + +(cl-defun helm-file-human-size (size &optional (kbsize helm-default-kbsize)) + "Return a string showing SIZE of a file in human readable form. +SIZE can be an integer or a float depending it's value. +`file-attributes' will take care of that to avoid overflow error. +KBSIZE if a floating point number, defaulting to `helm-default-kbsize'." + (let ((M (cons "M" (/ size (expt kbsize 2)))) + (G (cons "G" (/ size (expt kbsize 3)))) + (K (cons "K" (/ size kbsize))) + (B (cons "B" size))) + (cl-loop with result = B + for (a . b) in + (cl-loop for (x . y) in (list M G K B) + unless (< y 1) collect (cons x y)) + when (< b (cdr result)) do (setq result (cons a b)) + finally return (if (string= (car result) "B") + (format "%s" size) + (format "%.1f%s" (cdr result) (car result)))))) + +(cl-defun helm-file-attributes + (file &key type links uid gid access-time modif-time + status size mode gid-change inode device-num dired human-size + mode-type mode-owner mode-group mode-other (string t)) + "Return `file-attributes' elements of FILE separately according to key value. +Availables keys are: +- TYPE: Same as nth 0 `files-attributes' if STRING is nil + otherwise return either symlink, directory or file (default). +- LINKS: See nth 1 `files-attributes'. +- UID: See nth 2 `files-attributes'. +- GID: See nth 3 `files-attributes'. +- ACCESS-TIME: See nth 4 `files-attributes', however format time + when STRING is non--nil (the default). +- MODIF-TIME: See nth 5 `files-attributes', same as above. +- STATUS: See nth 6 `files-attributes', same as above. +- SIZE: See nth 7 `files-attributes'. +- MODE: See nth 8 `files-attributes'. +- GID-CHANGE: See nth 9 `files-attributes'. +- INODE: See nth 10 `files-attributes'. +- DEVICE-NUM: See nth 11 `files-attributes'. +- DIRED: A line similar to what 'ls -l' return. +- HUMAN-SIZE: The size in human form, see `helm-file-human-size'. +- MODE-TYPE, mode-owner,mode-group, mode-other: Split what + nth 7 `files-attributes' return in four categories. +- STRING: When non--nil (default) `helm-file-attributes' return + more friendly values. +If you want the same behavior as `files-attributes' , +\(but with return values in proplist\) use a nil value for STRING. +However when STRING is non--nil, time and type value are different from what +you have in `file-attributes'." + (let* ((all (cl-destructuring-bind + (type links uid gid access-time modif-time + status size mode gid-change inode device-num) + (file-attributes file string) + (list :type (if string + (cond ((stringp type) "symlink") ; fname + (type "directory") ; t + (t "file")) ; nil + type) + :links links + :uid uid + :gid gid + :access-time (if string + (format-time-string + "%Y-%m-%d %R" access-time) + access-time) + :modif-time (if string + (format-time-string + "%Y-%m-%d %R" modif-time) + modif-time) + :status (if string + (format-time-string + "%Y-%m-%d %R" status) + status) + :size size + :mode mode + :gid-change gid-change + :inode inode + :device-num device-num))) + (modes (helm-split-mode-file-attributes (cl-getf all :mode)))) + (cond (type (cl-getf all :type)) + (links (cl-getf all :links)) + (uid (cl-getf all :uid)) + (gid (cl-getf all :gid)) + (access-time (cl-getf all :access-time)) + (modif-time (cl-getf all :modif-time)) + (status (cl-getf all :status)) + (size (cl-getf all :size)) + (mode (cl-getf all :mode)) + (gid-change (cl-getf all :gid-change)) + (inode (cl-getf all :inode)) + (device-num (cl-getf all :device-num)) + (dired + (concat + (helm-split-mode-file-attributes (cl-getf all :mode) t) " " + (number-to-string (cl-getf all :links)) " " + (cl-getf all :uid) ":" + (cl-getf all :gid) " " + (if human-size + (helm-file-human-size (cl-getf all :size)) + (int-to-string (cl-getf all :size))) " " + (cl-getf all :modif-time))) + (human-size (helm-file-human-size (cl-getf all :size))) + (mode-type (cl-getf modes :mode-type)) + (mode-owner (cl-getf modes :user)) + (mode-group (cl-getf modes :group)) + (mode-other (cl-getf modes :other)) + (t (append all modes))))) + +(defun helm-split-mode-file-attributes (str &optional string) + "Split mode file attributes STR into a proplist. +If STRING is non--nil return instead a space separated string." + (cl-loop with type = (substring str 0 1) + with cdr = (substring str 1) + for i across cdr + for count from 1 + if (<= count 3) + concat (string i) into user + if (and (> count 3) (<= count 6)) + concat (string i) into group + if (and (> count 6) (<= count 9)) + concat (string i) into other + finally return + (if string + (mapconcat 'identity (list type user group other) " ") + (list :mode-type type :user user :group group :other other)))) + +(defun helm-current-directory () + "Return current-directory name at point. +Useful in dired buffers when there is inserted subdirs." + (if (eq major-mode 'dired-mode) + (dired-current-directory) + default-directory)) + +(defmacro with-helm-display-marked-candidates (buffer-or-name candidates &rest body) + (declare (indent 0) (debug t)) + (let ((buffer (make-symbol "buffer")) + (window (make-symbol "window"))) + `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name)) + ,window) + (unwind-protect + (with-current-buffer ,buffer + (dired-format-columns-of-files ,candidates) + (select-window + (setq ,window (temp-buffer-window-show + ,buffer + '(display-buffer-below-selected + (window-height . fit-window-to-buffer))))) + (progn ,@body)) + (quit-window 'kill ,window))))) + +;;; Persistent Action Helpers +;; +;; +;; Internal +(defvar helm-match-line-overlay nil) + +(defun helm-highlight-current-line (&optional start end buf face pulse) + "Highlight and underline current position" + (let* ((start (or start (line-beginning-position))) + (end (or end (1+ (line-end-position)))) + (args (list start end buf))) + (if (not helm-match-line-overlay) + (setq helm-match-line-overlay (apply 'make-overlay args)) + (apply 'move-overlay helm-match-line-overlay args)) + (overlay-put helm-match-line-overlay + 'face (or face 'helm-selection-line)) + (recenter) + (when pulse + (sit-for 0.3) + (helm-match-line-cleanup)))) + +(defun helm-match-line-cleanup () + (when helm-match-line-overlay + (delete-overlay helm-match-line-overlay) + (setq helm-match-line-overlay nil))) + +(defun helm-match-line-update () + (when helm-match-line-overlay + (delete-overlay helm-match-line-overlay) + (helm-highlight-current-line))) + +(add-hook 'helm-cleanup-hook 'helm-match-line-cleanup) +(add-hook 'helm-after-persistent-action-hook 'helm-match-line-update) + +(defun helm-w32-prepare-filename (file) + "Convert filename FILE to something usable by external w32 executables." + (replace-regexp-in-string ; For UNC paths + "/" "\\" + (replace-regexp-in-string ; Strip cygdrive paths + "/cygdrive/\\(.\\)" "\\1:" + file nil nil) nil t)) + +;;;###autoload +(defun helm-w32-shell-execute-open-file (file) + (interactive "fOpen file:") + (with-no-warnings + (w32-shell-execute "open" (helm-w32-prepare-filename file)))) + +(defun helm-open-file-with-default-tool (file) + "Open FILE with the default tool on this platform." + (let (process-connection-type) + (if (eq system-type 'windows-nt) + (helm-w32-shell-execute-open-file file) + (start-process "helm-open-file-with-default-tool" + nil + (cond ((eq system-type 'gnu/linux) + "xdg-open") + ((or (eq system-type 'darwin) ;; Mac OS X + (eq system-type 'macos)) ;; Mac OS 9 + "open")) + file)))) + +(defun helm-open-dired (file) + "Opens a dired buffer in FILE's directory. If FILE is a +directory, open this directory." + (if (file-directory-p file) + (dired file) + (dired (file-name-directory file)) + (dired-goto-file file))) + +(defun helm-action-line-goto (lineno-and-content) + (apply #'helm-goto-file-line + (append lineno-and-content + (list (helm-interpret-value (helm-attr 'target-file)) + (if (and (helm-attr-defined 'target-file) + (not helm-in-persistent-action)) + 'find-file-other-window + 'find-file))))) + +(cl-defun helm-action-file-line-goto (file-line-content) + (apply #'helm-goto-file-line + (if (stringp file-line-content) + ;; Case: filtered-candidate-transformer is skipped + (cdr (helm-filtered-candidate-transformer-file-line-1 + file-line-content)) + file-line-content))) + +(defun helm-require-or-error (feature function) + (or (require feature nil t) + (error "Need %s to use `%s'." feature function))) + +(defun helm-filtered-candidate-transformer-file-line (candidates _source) + (delq nil (mapcar 'helm-filtered-candidate-transformer-file-line-1 + candidates))) + +(defun helm-filtered-candidate-transformer-file-line-1 (candidate) + (when (string-match "^\\(.+?\\):\\([0-9]+\\):\\(.*\\)$" candidate) + (let ((filename (match-string 1 candidate)) + (lineno (match-string 2 candidate)) + (content (match-string 3 candidate))) + (cons (format "%s:%s\n %s" + (propertize filename 'face compilation-info-face) + (propertize lineno 'face compilation-line-face) + content) + (list (string-to-number lineno) content + (expand-file-name + filename + (or (helm-interpret-value (helm-attr 'default-directory)) + (and (helm-candidate-buffer) + (buffer-local-value + 'default-directory (helm-candidate-buffer)))))))))) + +(cl-defun helm-goto-file-line (lineno &optional content file (find-file-function #'find-file)) + (helm-aif (helm-attr 'before-jump-hook) + (funcall it)) + (when file (funcall find-file-function file)) + (if (helm-attr-defined 'adjust) + (helm-goto-line-with-adjustment lineno content) + (helm-goto-line lineno)) + (unless (helm-attr-defined 'recenter) + (set-window-start (get-buffer-window helm-current-buffer) (point))) + (helm-aif (helm-attr 'after-jump-hook) + (funcall it)) + (when helm-in-persistent-action + (helm-highlight-current-line))) + +(defun helm-find-file-as-root (candidate) + (let ((buf (helm-basename candidate)) + non-essential) + (if (buffer-live-p (get-buffer buf)) + (progn + (set-buffer buf) + (find-alternate-file (concat "/" helm-su-or-sudo + "::" (expand-file-name candidate)))) + (find-file (concat "/" helm-su-or-sudo "::" (expand-file-name candidate)))))) + +(defun helm-find-many-files (_ignore) + (let ((helm--reading-passwd-or-string t)) + (mapc 'find-file (helm-marked-candidates)))) + +(defun helm-goto-line-with-adjustment (line line-content) + (let ((startpos) + offset found pat) + ;; This constant is 1/2 the initial search window. + ;; There is no sense in making it too small, + ;; since just going around the loop once probably + ;; costs about as much as searching 2000 chars. + (setq offset 1000 + found nil + pat (concat (if (eq selective-display t) + "\\(^\\|\^m\\) *" "^ *") ;allow indent + (regexp-quote line-content))) + ;; If no char pos was given, try the given line number. + (setq startpos (progn (helm-goto-line line) (point))) + (or startpos (setq startpos (point-min))) + ;; First see if the tag is right at the specified location. + (goto-char startpos) + (setq found (looking-at pat)) + (while (and (not found) + (progn + (goto-char (- startpos offset)) + (not (bobp)))) + (setq found + (re-search-forward pat (+ startpos offset) t) + offset (* 3 offset))) ; expand search window + (or found + (re-search-forward pat nil t) + (error "not found"))) + ;; Position point at the right place + ;; if the search string matched an extra Ctrl-m at the beginning. + (and (eq selective-display t) + (looking-at "\^m") + (forward-char 1)) + (forward-line 0)) + +(defun helm-quit-and-execute-action (action) + "Quit current helm session and execute ACTION." + (setq helm-saved-action action) + (helm-exit-minibuffer)) + +;; Yank text at point. +;; +;; +;; Internal +(defvar helm-yank-point nil) + +;;;###autoload +(defun helm-yank-text-at-point () + "Yank text at point in `helm-current-buffer' into minibuffer. +If `helm-yank-symbol-first' is non--nil the first yank +grabs the entire symbol." + (interactive) + (with-helm-current-buffer + (let ((fwd-fn (if helm-yank-symbol-first + 'forward-symbol 'forward-word))) + ;; Start to initial point if C-w have never been hit. + (unless helm-yank-point (setq helm-yank-point (point))) + (save-excursion + (goto-char helm-yank-point) + (funcall fwd-fn 1) + (helm-set-pattern + (concat + helm-pattern (replace-regexp-in-string + "\\`\n" "" + (buffer-substring-no-properties + helm-yank-point (point))))) + (setq helm-yank-point (point)))))) + +(defun helm-reset-yank-point () + (setq helm-yank-point nil)) + +(add-hook 'helm-after-persistent-action-hook 'helm-reset-yank-point) +(add-hook 'helm-cleanup-hook 'helm-reset-yank-point) +(add-hook 'helm-after-initialize-hook 'helm-reset-yank-point) + +(defun helm-html-bookmarks-to-alist (file url-regexp bmk-regexp) + "Parse html bookmark FILE and return an alist with (title . url) as elements." + (let (bookmarks-alist url title) + (with-temp-buffer + (insert-file-contents file) + (goto-char (point-min)) + (while (re-search-forward "href=\\|^ *

\\([^><]+.[^]\\)") +(defvar helm-w3m-bookmark-url-regexp "\\(https\\|http\\|ftp\\|file\\)://[^>]*") +(defvar helm-w3m-bookmarks-alist nil) +(defvar helm-source-w3m-bookmarks + '((name . "W3m Bookmarks") + (init . (lambda () + (setq helm-w3m-bookmarks-alist + (helm-html-bookmarks-to-alist + w3m-bookmark-file + helm-w3m-bookmark-url-regexp + helm-w3m-bookmarks-regexp)))) + (candidates . (lambda () + (mapcar #'car helm-w3m-bookmarks-alist))) + (filtered-candidate-transformer + helm-adaptive-sort + helm-highlight-w3m-bookmarks) + (action . (("Browse Url" + . (lambda (candidate) + (helm-w3m-browse-bookmark candidate))) + ("Copy Url" + . (lambda (elm) + (kill-new (helm-w3m-bookmarks-get-value elm)))) + ("Browse Url Externally" + . (lambda (candidate) + (helm-w3m-browse-bookmark candidate t))) + ("Delete Bookmark" + . (lambda (candidate) + (helm-w3m-delete-bookmark candidate))) + ("Rename Bookmark" + . (lambda (candidate) + (helm-w3m-rename-bookmark candidate))))) + (persistent-action . (lambda (candidate) + (if current-prefix-arg + (helm-w3m-browse-bookmark candidate t) + (helm-w3m-browse-bookmark candidate nil t)))) + (persistent-help . "Open URL with emacs-w3m in new tab / \ +C-u \\[helm-execute-persistent-action]: Open URL with Firefox")) + "Needs w3m and emacs-w3m. + +http://w3m.sourceforge.net/ +http://emacs-w3m.namazu.org/") + + +(defun helm-w3m-bookmarks-get-value (elm) + (replace-regexp-in-string + "\"" "" (cdr (assoc elm helm-w3m-bookmarks-alist)))) + +(defun helm-w3m-browse-bookmark (elm &optional use-external new-tab) + (let* ((fn (if use-external 'helm-browse-url 'w3m-browse-url)) + (arg (and (eq fn 'w3m-browse-url) new-tab))) + (funcall fn (helm-w3m-bookmarks-get-value elm) arg))) + +(defun helm-highlight-w3m-bookmarks (bookmarks _source) + (cl-loop for i in bookmarks + collect (propertize + i 'face 'helm-w3m-bookmarks + 'help-echo (helm-w3m-bookmarks-get-value i)))) + + +(defun helm-w3m-delete-bookmark (elm) + "Delete w3m bookmark from `w3m-bookmark-file'." + (with-current-buffer + (find-file-literally w3m-bookmark-file) + (goto-char (point-min)) + (when (re-search-forward elm nil t) + (forward-line 0) + (delete-region (point) + (line-end-position)) + (delete-blank-lines)) + (save-buffer) + (kill-buffer))) + +(defun helm-w3m-rename-bookmark (elm) + "Rename w3m bookmark in `w3m-bookmark-file'." + (let* ((old-title (replace-regexp-in-string ">" "" elm)) + (new-title (helm-read-string "NewTitle: " old-title))) + (with-current-buffer + (find-file-literally w3m-bookmark-file) + (goto-char (point-min)) + (when (re-search-forward (concat elm "<") nil t) + (goto-char (1- (point))) + (delete-char (- (length old-title))) + (insert new-title)) + (save-buffer) + (kill-buffer)))) + +;;;###autoload +(defun helm-w3m-bookmarks () + "Preconfigured `helm' for w3m bookmark. + +Needs w3m and emacs-w3m. + +http://w3m.sourceforge.net/ +http://emacs-w3m.namazu.org/" + (interactive) + (helm-other-buffer 'helm-source-w3m-bookmarks + "*helm w3m bookmarks*")) + + +(provide 'helm-w3m) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-w3m.el ends here diff --git a/elpa/helm-20140808.2300/helm-w3m.elc b/elpa/helm-20140808.2300/helm-w3m.elc new file mode 100644 index 000000000..812b27d4c Binary files /dev/null and b/elpa/helm-20140808.2300/helm-w3m.elc differ diff --git a/elpa/helm-20140808.2300/helm-yaoddmuse.el b/elpa/helm-20140808.2300/helm-yaoddmuse.el new file mode 100644 index 000000000..7df533248 --- /dev/null +++ b/elpa/helm-20140808.2300/helm-yaoddmuse.el @@ -0,0 +1,171 @@ +;;; helm-yaoddmuse.el --- Helm extension for yaoddmuse -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2014 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) + +(declare-function yaoddmuse-update-pagename "ext:yaoddmuse.el" (&optional unforced)) +(declare-function yaoddmuse-get-library-list "ext:yaoddmuse.el" (&optional dirs string)) + +;; Be sure to have yaoddmuse.el installed +;; install-elisp may be required if you want to install elisp file from here. +(defvar helm-yaoddmuse-use-cache-file nil) +(defvar helm-yaoddmuse-cache-file "~/.emacs.d/yaoddmuse-cache.el") +(defvar helm-yaoddmuse-ew-cache nil) +(defvar yaoddmuse-pages-hash) + +(defun helm-yaoddmuse-get-candidates () + (if helm-yaoddmuse-use-cache-file + (ignore-errors + (unless helm-yaoddmuse-ew-cache + (load helm-yaoddmuse-cache-file) + (setq helm-yaoddmuse-ew-cache + (gethash "EmacsWiki" yaoddmuse-pages-hash))) + helm-yaoddmuse-ew-cache) + (yaoddmuse-update-pagename t) + (gethash "EmacsWiki" yaoddmuse-pages-hash))) + +(defvar helm-source-yaoddmuse-emacswiki-edit-or-view + '((name . "Yaoddmuse Edit or View (EmacsWiki)") + (candidates . helm-yaoddmuse-get-candidates) + (action . (("Edit page" . (lambda (candidate) + (yaoddmuse-edit "EmacsWiki" candidate))) + ("Browse page" + . (lambda (candidate) + (yaoddmuse-browse-page "EmacsWiki" candidate))) + ("Browse page other window" + . (lambda (candidate) + (if (one-window-p) + (split-window-vertically)) + (yaoddmuse-browse-page "EmacsWiki" candidate))) + ("Browse diff" + . (lambda (candidate) + (yaoddmuse-browse-page-diff "EmacsWiki" candidate))) + ("Copy URL" + . (lambda (candidate) + (kill-new (yaoddmuse-url "EmacsWiki" candidate)) + (message "Have copy page %s's URL to yank." candidate))) + ("Create page" + . (lambda (candidate) + (yaoddmuse-edit "EmacsWiki" helm-input))) + ("Update cache" + . (lambda (candidate) + (if helm-yaoddmuse-use-cache-file + (progn + (helm-yaoddmuse-cache-pages t) + (setq helm-yaoddmuse-ew-cache + (gethash "EmacsWiki" yaoddmuse-pages-hash))) + (yaoddmuse-update-pagename)))))) + (action-transformer helm-yaoddmuse-action-transformer)) + "Needs yaoddmuse.el. + +http://www.emacswiki.org/emacs/download/yaoddmuse.el") + + +(defvar helm-source-yaoddmuse-emacswiki-post-library + '((name . "Yaoddmuse Post library (EmacsWiki)") + (init . (helm-yaoddmuse-init)) + (candidates-in-buffer) + (action . (("Post library and Browse" + . (lambda (candidate) + (yaoddmuse-post-file + (find-library-name candidate) + "EmacsWiki" + (file-name-nondirectory (find-library-name candidate)) + nil t))) + ("Post library" + . (lambda (candidate) + (yaoddmuse-post-file + (find-library-name candidate) + "EmacsWiki" + (file-name-nondirectory + (find-library-name candidate)))))))) + "Needs yaoddmuse.el. + +http://www.emacswiki.org/emacs/download/yaoddmuse.el") + + +(defun helm-yaoddmuse-action-transformer (actions candidate) + "Allow the use of `install-elisp' only on elisp files." + (if (string-match "\.el$" candidate) + (append actions '(("Install Elisp" + . (lambda (elm) + (install-elisp-from-emacswiki elm))))) + actions)) + +;;;###autoload +(defun helm-yaoddmuse-cache-pages (&optional load) + "Fetch the list of files on emacswiki and create cache file. +If load is non--nil load the file and feed `yaoddmuse-pages-hash'." + (interactive) + (yaoddmuse-update-pagename) + (save-excursion + (find-file helm-yaoddmuse-cache-file) + (erase-buffer) + (insert "(puthash \"EmacsWiki\" '(") + (cl-loop for i in (gethash "EmacsWiki" yaoddmuse-pages-hash) + do + (insert (concat "(\"" (car i) "\") "))) + (insert ") yaoddmuse-pages-hash)\n") + (save-buffer) + (kill-buffer (current-buffer)) + (when (or current-prefix-arg + load) + (load helm-yaoddmuse-cache-file)))) + +(defun helm-yaoddmuse-init () + "Init helm buffer status." + (let ((helm-buffer (helm-candidate-buffer 'global)) + (library-list (yaoddmuse-get-library-list))) + (with-current-buffer helm-buffer + ;; Insert library name. + (cl-dolist (library library-list) + (insert (format "%s\n" library))) + ;; Sort lines. + (sort-lines nil (point-min) (point-max))))) + +;;;###autoload +(defun helm-yaoddmuse-emacswiki-edit-or-view () + "Preconfigured `helm' to edit or view EmacsWiki page. + +Needs yaoddmuse.el. + +http://www.emacswiki.org/emacs/download/yaoddmuse.el" + (interactive) + (helm :sources 'helm-source-yaoddmuse-emacswiki-edit-or-view)) + +;;;###autoload +(defun helm-yaoddmuse-emacswiki-post-library () + "Preconfigured `helm' to post library to EmacsWiki. + +Needs yaoddmuse.el. + +http://www.emacswiki.org/emacs/download/yaoddmuse.el" + (interactive) + (helm :sources 'helm-source-yaoddmuse-emacswiki-post-library)) + +(provide 'helm-yaoddmuse) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-yaoddmuse.el ends here diff --git a/elpa/helm-20140808.2300/helm-yaoddmuse.elc b/elpa/helm-20140808.2300/helm-yaoddmuse.elc new file mode 100644 index 000000000..9466d9bd9 Binary files /dev/null and b/elpa/helm-20140808.2300/helm-yaoddmuse.elc differ diff --git a/elpa/helm-20140808.2300/helm.el b/elpa/helm-20140808.2300/helm.el new file mode 100644 index 000000000..1bd0430bd --- /dev/null +++ b/elpa/helm-20140808.2300/helm.el @@ -0,0 +1,4695 @@ +;;; helm.el --- Emacs incremental and narrowing framework -*- lexical-binding: t -*- + +;; Copyright (C) 2007 Tamas Patrovics +;; 2008 ~ 2011 rubikitch +;; 2011 ~ 2014 Thierry Volpiatto + +;; This is a fork of anything.el wrote by Tamas Patrovics. + +;; Authors of anything.el: Tamas Patrovics +;; rubikitch +;; Thierry Volpiatto + +;; Author: Thierry Volpiatto +;; URL: http://github.com/emacs-helm/helm + +;; 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 . + +;;; Code: + +(require 'cl-lib) + + +;;; Multi keys +;; +;; +;;;###autoload +(defun helm-define-multi-key (keymap key functions &optional delay) + "In KEYMAP, define key sequence KEY for function list FUNCTIONS. +Each function run sequentialy each time the key KEY is pressed. +If DELAY is specified switch back to initial function of FUNCTIONS list +after DELAY seconds. +The functions in FUNCTIONS list are functions with no args. +e.g + \(defun foo () + (message \"Run foo\")) + \(defun bar () + (message \"Run bar\")) + \(defun baz () + (message \"Run baz\")) + +\(helm-define-multi-key global-map \" q\" '(foo bar baz) 2) + +Each time \" q\" is pressed the next function is executed, if you wait +More than 2 seconds, next hit will run again the first function and so on." + (define-key keymap key (helm-make-multi-command functions delay))) + +;;;###autoload +(defmacro helm-multi-key-defun (name docstring funs &optional delay) + "Define NAME as a multi-key command running FUNS. +After DELAY seconds the FUNS list is reinitialised. +See `helm-define-multi-key'." + (declare (indent 2)) + (setq docstring (if docstring (concat docstring "\n\n") + "This is a helmish multi-key command.")) + `(defalias (quote ,name) (helm-make-multi-command ,funs ,delay) ,docstring)) + +(defun helm-make-multi-command (functions &optional delay) + "Return an anonymous multi-key command running FUNCTIONS. +Run each function of FUNCTIONS list in turn when called within DELAY seconds." + (declare (indent 1)) + (let ((funs functions) + (iter (cl-gensym "helm-iter-key")) + (timeout delay)) + (eval (list 'defvar iter nil)) + #'(lambda () (interactive) (helm-run-multi-key-command funs iter timeout)))) + +(defun helm-run-multi-key-command (functions iterator delay) + (let ((fn #'(lambda () + (cl-loop for count from 1 to (length functions) + collect count))) + next) + (unless (and (symbol-value iterator) + ;; Reset iterator when another key is pressed. + (eq this-command real-last-command)) + (set iterator (helm-iter-list (funcall fn)))) + (setq next (helm-iter-next (symbol-value iterator))) + (unless next + (set iterator (helm-iter-list (funcall fn))) + (setq next (helm-iter-next (symbol-value iterator)))) + (and next (symbol-value iterator) (call-interactively (nth (1- next) functions))) + (when delay (run-with-idle-timer delay nil `(lambda () + (setq ,iterator nil)))))) + +(defun helm-iter-list (seq) + "Return an iterator object from SEQ." + (let ((lis seq)) + (lambda () + (let ((elm (car lis))) + (setq lis (cdr lis)) + elm)))) + +(defun helm-iter-next (iterator) + "Return next elm of ITERATOR." + (funcall iterator)) + +(helm-multi-key-defun helm-toggle-resplit-and-swap-windows + "Multi key command to resplit and swap helm window. +First call run `helm-toggle-resplit-window', +second call within 0.5s run `helm-swap-windows'." + '(helm-toggle-resplit-window helm-swap-windows) 1) + +;;;###autoload +(defmacro helm-define-key-with-subkeys (map key subkey command + &optional other-subkeys menu exit-fn) + "Allow defining a KEY without having to type its prefix again on next calls. +Arg MAP is the keymap to use, SUBKEY is the initial long keybinding to +call COMMAND. +Arg OTHER-SUBKEYS is an unquoted alist specifying other short keybindings +to use once started. +e.g: + +\(helm-define-key-with-subkeys global-map + \(kbd \"C-x v n\") ?n 'git-gutter:next-hunk ((?p . 'git-gutter:previous-hunk))\) + + +In this example, `C-x v n' will run `git-gutter:next-hunk' subsequent hit on \"n\" +will run this command again and subsequent hit on \"p\" will run `git-gutter:previous-hunk'. + +Arg MENU is a string to display in minibuffer to describe SUBKEY and OTHER-SUBKEYS. +Arg EXIT-FN specify a function to run on exit. + +Any other keys pressed run their assigned command defined in MAP and exit the loop." + + (let ((other-keys (and other-subkeys + (cl-loop for (x . y) in other-subkeys + collect (list x (list 'call-interactively y) t))))) + `(define-key ,map ,key + #'(lambda () + (interactive) + (unwind-protect + (progn + (call-interactively ,command) + (while (let ((input (read-key ,menu)) kb com) + (cl-case input + (,subkey (call-interactively ,command) t) + ,@other-keys + (t (setq kb (this-command-keys-vector)) + (setq com (lookup-key ,map kb)) + (if (commandp com) + (call-interactively com) + (setq unread-command-events + (nconc (mapcar 'identity + (this-single-command-raw-keys)) + unread-command-events))) + nil))))) + (and ,exit-fn (funcall ,exit-fn))))))) + + +;;; Keymap +;; +;; +(defvar helm-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-map) + (define-key map (kbd "") 'helm-next-line) + (define-key map (kbd "") 'helm-previous-line) + (define-key map (kbd "C-n") 'helm-next-line) + (define-key map (kbd "C-p") 'helm-previous-line) + (define-key map (kbd "") 'helm-follow-action-forward) + (define-key map (kbd "") 'helm-follow-action-backward) + (define-key map (kbd "") 'helm-previous-page) + (define-key map (kbd "") 'helm-next-page) + (define-key map (kbd "M-v") 'helm-previous-page) + (define-key map (kbd "C-v") 'helm-next-page) + (define-key map (kbd "M-<") 'helm-beginning-of-buffer) + (define-key map (kbd "M->") 'helm-end-of-buffer) + (define-key map (kbd "C-g") 'helm-keyboard-quit) + (define-key map (kbd "") 'helm-next-source) + (define-key map (kbd "") 'helm-previous-source) + (define-key map (kbd "") 'helm-maybe-exit-minibuffer) + (define-key map (kbd "C-i") 'helm-select-action) + (define-key map (kbd "C-z") 'helm-execute-persistent-action) + (define-key map (kbd "C-j") 'helm-execute-persistent-action) + (define-key map (kbd "C-o") 'helm-next-source) + (define-key map (kbd "C-l") 'helm-recenter-top-bottom-other-window) + (define-key map (kbd "M-C-l") 'helm-reposition-window-other-window) + (define-key map (kbd "C-M-v") 'helm-scroll-other-window) + (define-key map (kbd "M-") 'helm-scroll-other-window) + (define-key map (kbd "C-M-y") 'helm-scroll-other-window-down) + (define-key map (kbd "C-M-S-v") 'helm-scroll-other-window-down) + (define-key map (kbd "M-") 'helm-scroll-other-window-down) + (define-key map (kbd "") 'helm-scroll-other-window) + (define-key map (kbd "") 'helm-scroll-other-window-down) + (define-key map (kbd "C-@") 'helm-toggle-visible-mark) + (define-key map (kbd "C-SPC") 'helm-toggle-visible-mark) + (define-key map (kbd "M-SPC") 'helm-toggle-visible-mark) + (define-key map (kbd "M-[") nil) + (define-key map (kbd "M-(") 'helm-prev-visible-mark) + (define-key map (kbd "M-)") 'helm-next-visible-mark) + (define-key map (kbd "C-k") 'helm-delete-minibuffer-contents) + (define-key map (kbd "C-x C-f") 'helm-quit-and-find-file) + (define-key map (kbd "M-m") 'helm-toggle-all-marks) + (define-key map (kbd "M-a") 'helm-mark-all) + (define-key map (kbd "M-u") 'helm-unmark-all) + (define-key map (kbd "C-w") 'helm-yank-text-at-point) + (define-key map (kbd "C-M-a") 'helm-show-all-in-this-source-only) + (define-key map (kbd "C-M-e") 'helm-display-all-sources) + (define-key map (kbd "C-r") 'undefined) + (define-key map (kbd "C-s") 'undefined) + (define-key map (kbd "M-s") 'undefined) + (define-key map (kbd "C-}") 'helm-narrow-window) + (define-key map (kbd "C-{") 'helm-enlarge-window) + (define-key map (kbd "C-c -") 'helm-swap-windows) + (define-key map (kbd "C-c C-d") 'helm-delete-current-selection) + (define-key map (kbd "C-c C-y") 'helm-yank-selection) + (define-key map (kbd "C-c C-k") 'helm-kill-selection-and-quit) + (define-key map (kbd "C-c C-i") 'helm-copy-to-buffer) + (define-key map (kbd "C-c C-f") 'helm-follow-mode) + (define-key map (kbd "C-c C-u") 'helm-force-update) + (define-key map (kbd "M-p") 'previous-history-element) + (define-key map (kbd "M-n") 'next-history-element) + (define-key map (kbd "C-!") 'helm-toggle-suspend-update) + (define-key map (kbd "C-x b") 'helm-resume-previous-session-after-quit) + (define-key map (kbd "C-x C-b") 'helm-resume-list-buffers-after-quit) + ;; Disable usage of the mouse while in helm. + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + (define-key map (kbd "") 'ignore) + ;; Disable `file-cache-minibuffer-complete'. + (define-key map (kbd "") 'undefined) + ;; Multi keys + (define-key map (kbd "C-t") 'helm-toggle-resplit-and-swap-windows) + ;; Debugging command + (define-key map (kbd "C-h C-d") 'undefined) + (define-key map (kbd "C-h C-d") 'helm-debug-output) + ;; Use `describe-mode' key in `global-map'. + (define-key map [f1] nil) ; Allow to eval keymap without errors. + (define-key map (kbd "C-h C-h") 'undefined) + (define-key map (kbd "C-h h") 'undefined) + (cl-dolist (k (where-is-internal 'describe-mode global-map)) + (define-key map k 'helm-help)) + ;; Bind all actions from 1 to 12 to their corresponding nth index+1. + (cl-loop for n from 0 to 12 do + (define-key map (kbd (format "" (1+ n))) + `(lambda () + (interactive) + (helm-select-nth-action ,n)))) + map) + "Keymap for helm.") + + +(defgroup helm nil + "Open helm." + :prefix "helm-" :group 'convenience) + +(defcustom helm-completion-window-scroll-margin 5 + " `scroll-margin' to use for helm completion window. +Which see. Set to 0 to disable. +NOTE: This have no effect when `helm-display-source-at-screen-top' +id non--nil." + :group 'helm + :type 'integer) + +(defcustom helm-display-source-at-screen-top t + "Display candidates at the top of screen. +This happen when using `helm-next-source' and `helm-previous-source'. +NOTE: When non--nil (default) disable `helm-completion-window-scroll-margin'." + :group 'helm + :type 'boolean) + +(defcustom helm-candidate-number-limit 100 + "Limit candidate number globally. +Do not show more candidates than this limit from individual sources. +It is usually pointless to show hundreds of matches +when the pattern is empty, because it is much simpler to type a +few characters to narrow down the list of potential candidates. + +Set it to nil if you don't want this limit." + :group 'helm + :type '(choice (const :tag "Disabled" nil) integer)) + +(defcustom helm-idle-delay 0.01 + "Be idle for this many seconds, before updating in delayed sources. +This is useful for sources involving heavy operations +\(like launching external programs\), so that candidates +from the source are not retrieved unnecessarily if the user keeps typing. + +It also can be used to declutter the results helm displays, +so that results from certain sources are not shown with every +character typed, only if the user hesitates a bit. +Be sure to know what you are doing when modifying this." + :group 'helm + :type 'float) + +(defcustom helm-input-idle-delay 0.01 + "Be idle for this many seconds, before updating. + +Unlike `helm-idle-delay', it is also effective for non-delayed sources. +If nil, candidates are collected immediately. + +Note: If this value is too low compared to `helm-idle-delay', +you may have duplicated sources when using multiples sources. +Safe value is always >= `helm-idle-delay'. +Default settings are equal value for both. +Be sure to know what you are doing when modifying this." + :group 'helm + :type 'float) + +(defcustom helm-exit-idle-delay 0 + "Be idle for this many seconds before exiting minibuffer while helm is updating. +Note that this does nothing when helm-buffer is up to date +\(i.e exit without delay in this condition\)." + :group 'helm + :type 'float) + +(defcustom helm-full-frame nil + "Use current window to show the candidates. +If t then Helm doesn't pop up a new window." + :group 'helm + :type 'boolean) + +(defvaralias 'helm-samewindow 'helm-full-frame) +(make-obsolete-variable 'helm-samewindow 'helm-full-frame "1.4.8.1") + +(defcustom helm-quick-update nil + "If non-nil, suppress displaying sources which are out of screen at first. +They are treated as delayed sources at this input. +This flag makes `helm' a bit faster with many sources." + :group 'helm + :type 'boolean) + +(defcustom helm-candidate-separator + "--------------------" + "Candidates separator of `multiline' source." + :group 'helm + :type 'string) + +(defcustom helm-save-configuration-functions + '(set-window-configuration . current-window-configuration) + "The functions used to restore/save window or frame configurations. +It is a pair where the car is the function to restore window or frame config, +and the cdr is the function to save the window or frame config. + +If you want to save and restore frame configuration, set this variable to + '\(set-frame-configuration . current-frame-configuration\) +NOTE: This may not work properly with own-frame minibuffer settings. +Older version saves/restores frame configuration, but the default is changed now +because flickering can occur in some environment." + :group 'helm + :type 'sexp) + +(defcustom helm-persistent-action-use-special-display nil + "If non-nil, use `special-display-function' in persistent action." + :group 'helm + :type 'boolean) + +(defcustom helm-scroll-amount nil + "Scroll amount when scrolling other window in a helm session. +It is used by `helm-scroll-other-window' +and `helm-scroll-other-window-down'. + +If you prefer scrolling line by line, set this value to 1." + :group 'helm + :type 'integer) + +(defcustom helm-display-function 'helm-default-display-buffer + "Function to display *helm* buffer. +It is `helm-default-display-buffer' by default, +which affects `helm-full-frame'." + :group 'helm + :type 'symbol) + +(defcustom helm-case-fold-search 'smart + "Add 'smart' option to `case-fold-search'. +When smart is enabled, ignore case in the search strings +if pattern contains no uppercase characters. +Otherwise, with a nil or t value, the behavior is same as +`case-fold-search'. +Default value is smart, other possible values are nil and t. +NOTE: This have no effect in asynchronous sources, you will +have to implement a similar feature directly in the process. +See in helm-grep.el how it is implemented." + :group 'helm + :type '(choice (const :tag "Ignore case" t) + (const :tag "Respect case" nil) + (other :tag "Smart" 'smart))) + +(defcustom helm-file-name-case-fold-search + (if (memq system-type + '(cygwin windows-nt ms-dos darwin)) + t + helm-case-fold-search) + "Local setting of `helm-case-fold-search' for reading filenames. + +See `helm-case-fold-search' for more info." + :group 'helm + :type 'symbol) + +(defcustom helm-reuse-last-window-split-state nil + "Reuse the last state of window split, vertical or horizontal. +That is when you use `helm-toggle-resplit-window' the next helm session +will reuse the same window scheme than the one of last session unless +`helm-split-window-default-side' is 'same or 'other." + :group 'helm + :type 'boolean) + +(defcustom helm-split-window-preferred-function 'helm-split-window-default-fn + "Default function used for splitting window." + :group 'helm + :type 'function) + +(defcustom helm-split-window-default-side 'below + "The default side to display `helm-buffer'. +Must be one acceptable arg for `split-window' SIDE, +that is 'below, 'above, 'left or 'right. + +Other acceptable values are 'same which always display `helm-buffer' +in current window and 'other that display `helm-buffer' below if only one +window or in `other-window-for-scrolling' if available. + +A nil value as same effect as 'below. +If `helm-full-frame' is non--nil, it take precedence on this. + +See also `helm-split-window-in-side-p' and `helm-always-two-windows' that +take precedence on this. + +NOTE: this have no effect if `helm-split-window-preferred-function' is not +`helm-split-window-default-fn' unless this new function handle this." + :group 'helm + :type 'symbol) + +(defcustom helm-split-window-in-side-p nil + "Force splitting inside selected window when non--nil. +See also `helm-split-window-default-side'. + +NOTE: this have no effect if `helm-split-window-preferred-function' is not +`helm-split-window-default-fn' unless this new function handle this." + :group 'helm + :type 'boolean) + +(defcustom helm-always-two-windows nil + "When non--nil helm will use two windows in this frame. +That is one window to display `helm-buffer' and one to display +`helm-current-buffer'. +Note: this have no effect when `helm-split-window-in-side-p' is non--nil, +or when `helm-split-window-default-side' is set to 'same." + :group 'helm + :type 'boolean) + +(defcustom helm-sources-using-default-as-input '(helm-source-imenu + helm-source-semantic + helm-source-info-elisp + helm-source-etags-select) + "List of helm sources that need to use `helm-maybe-use-default-as-input'. +When a source is member of this list, default `thing-at-point' +will be used as input." + :group 'helm + :type '(repeat (choice symbol))) + +(defcustom helm-delete-minibuffer-contents-from-point nil + "When non--nil, `helm-delete-minibuffer-contents' delete region from `point'. +Otherwise (default) delete `minibuffer-contents'." + :group 'helm + :type 'boolean) + +(defcustom helm-follow-mode-persistent nil + "Retrieve last state of `helm-follow-mode' in next helm session when non--nil. +This will not make it persistent through emacs sessions though, +you will have to set explicitely the `follow' attribute in the source where +you want this mode enabled definitely." + :group 'helm + :type 'boolean) + +(defcustom helm-prevent-escaping-from-minibuffer t + "Prevent escaping from minibuffer during helm session." + :group 'helm + :type 'boolean) + +(defcustom helm-truncate-lines nil + "Truncate long lines when non--nil. +See `truncate-lines'." + :group 'helm + :type 'boolean) + +(defcustom helm-move-to-line-cycle-in-source nil + "Move to end or beginning of source when reaching top or bottom of source. +This happen when using `helm-next/previous-line'." + :group 'helm + :type 'boolean) + + +;;; Faces +;; +;; +(defface helm-source-header + '((((background dark)) + :background "#22083397778B" + :foreground "white" + :weight bold :height 1.3 :family "Sans Serif") + (((background light)) + :background "#abd7f0" + :foreground "black" + :weight bold :height 1.3 :family "Sans Serif")) + "Face for source header in the helm buffer." + :group 'helm) + +(defface helm-visible-mark + '((((min-colors 88) (background dark)) + (:background "green1" :foreground "black")) + (((background dark)) + (:background "green" :foreground "black")) + (((background light)) :background "#d1f5ea") + (((min-colors 88)) + (:background "green1")) + (t (:background "green"))) + "Face for visible mark." + :group 'helm) + +(defface helm-header + '((t (:inherit header-line))) + "Face for header lines in the helm buffer." + :group 'helm) + +(defface helm-candidate-number + '((((background dark)) :background "Yellow" :foreground "black") + (((background light)) :background "#faffb5" :foreground "black")) + "Face for candidate number in mode-line." :group 'helm) + +(defface helm-selection + '((((background dark)) :background "ForestGreen" :underline t) + (((background light)) :background "#b5ffd1" :underline t)) + "Face for currently selected item in the helm buffer." + :group 'helm) + +(defface helm-separator + '((((background dark)) :foreground "red") + (((background light)) :foreground "#ffbfb5")) + "Face for multiline source separator." + :group 'helm) + +(defface helm-action + '((t (:underline t))) + "Face for action lines in the helm action buffer." + :group 'helm) + +(defface helm-prefarg + '((((background dark)) :foreground "green") + (((background light)) :foreground "red")) + "Face for showing prefix arg in mode-line." + :group 'helm) + + +;;; Variables. +;; +;; +(defvar helm-type-attributes nil + "It's a list of \(TYPE ATTRIBUTES ...\). +ATTRIBUTES are the same as attributes for `helm-sources'. +TYPE connects the value to the appropriate sources. +Don't set this directly, use instead `define-helm-type-attribute'. + +This allows specifying common attributes for several sources. +For example, sources which provide files can specify +common attributes with a `file' type.") + +(defvar helm-source-filter nil + "A list of source names to be displayed. +Other sources won't appear in the search results. +If nil then there is no filtering. +See also `helm-set-source-filter'.") + +(defvar helm-action-buffer "*helm action*" + "Buffer showing actions.") + +(defvar helm-selection-overlay nil + "Overlay used to highlight the currently selected item.") + +(defvar helm-async-processes nil + "List of information about asynchronous processes managed by helm.") + +(defvar helm-before-initialize-hook nil + "Run before helm initialization. +This hook is run before init functions in `helm-sources'.") + +(defvar helm-after-initialize-hook nil + "Run after helm initialization. +Global variables are initialized and the helm buffer is created. +But the helm buffer has no contents.") + +(defvar helm-update-hook nil + "Run after the helm buffer was updated according the new input pattern. +This hook is run at the beginning of buffer. +The first candidate is selected after running this hook. +See also `helm-after-update-hook'.") + +(defvar helm-after-update-hook nil + "Run after the helm buffer was updated according the new input pattern. +This is very similar to `helm-update-hook' but selection is not moved. +It is useful to select a particular object instead of the first one.") + +(defvar helm-cleanup-hook nil + "Run after helm minibuffer is closed. +IOW this hook is executed BEFORE performing action.") + +(defvar helm-select-action-hook nil + "Run when opening the action buffer.") + +(defvar helm-before-action-hook nil + "Run before executing action. +Contrarily to `helm-cleanup-hook', +this hook run before helm minibuffer is closed +and before performing action.") + +(defvar helm-after-action-hook nil + "Run after executing action.") + +(defvar helm-exit-minibuffer-hook nil + "Run just before exiting minibuffer.") + +(defvar helm-after-persistent-action-hook nil + "Run after executing persistent action.") + +(defvar helm-move-selection-before-hook nil + "Run before moving selection in `helm-buffer'.") + +(defvar helm-move-selection-after-hook nil + "Run after moving selection in `helm-buffer'.") + +(defvar helm-restored-variables + '(helm-candidate-number-limit + helm-source-filter + helm-source-in-each-line-flag + helm-map + helm-sources) + "Variables which are restored after `helm' invocation.") + +(defvar helm-execute-action-at-once-if-one nil + "Execute default action and exit when only one candidate is remaining.") + +(defvar helm-quit-if-no-candidate nil + "Quit when there is no candidates when non--nil. +This variable accepts a function, which is executed if no candidate.") + +(defvar helm-maybe-use-default-as-input nil + "Use :default arg of `helm' as input to update display. +Note that if also :input is specified as `helm' arg, it will take +precedence on :default.") + +(defvar helm-source-in-each-line-flag nil + "Non-nil means add helm-source text-property in each candidate. +experimental feature.") + +(defvar helm-debug-variables nil + "A list of helm variables to show in `helm-debug-output'. +Otherwise all variables started with `helm-' are shown.") + +(defvar helm-debug-buffer "*Debug Helm Log*") + +(defvar helm-debug nil + "If non-nil, write log message into `helm-debug-buffer' buffer. +It is disabled by default because `helm-debug-buffer' grows quickly.") + +(defvar helm-compile-source-functions + '(helm-compile-source--type + helm-compile-source--dummy + helm-compile-source--candidates-in-buffer) + "Functions to compile elements of `helm-sources' (plug-in).") + +(defvar helm-mode-line-string "\ +\\\ +\\[helm-help]:Help \ +\\[helm-select-action]:Act \ +\\[helm-maybe-exit-minibuffer]/\ +f1/f2/f-n:NthAct" + "Help string displayed in mode-line in `helm'. +It can be a string or a list of two args, in this case, +first arg is a string that will be used as name for candidates number, +second arg any string to display in mode line. +If nil, use default `mode-line-format'.") + + +;;; Internal Variables +;; +;; +(defvar helm-current-prefix-arg nil + "Record `current-prefix-arg' when exiting minibuffer.") +(defvar helm-saved-action nil + "Saved value of the currently selected action by key.") +(defvar helm-saved-current-source nil + "Value of the current source when the action list is shown.") +(defvar helm-compiled-sources nil + "Compiled version of `helm-sources'.") +(defvar helm-in-persistent-action nil + "Flag whether in persistent-action or not.") +(defvar helm-last-buffer nil + "`helm-buffer' of previously `helm' session.") +(defvar helm-saved-selection nil + "Value of the currently selected object when the action list is shown.") +(defvar helm-sources nil + "[INTERNAL] Value of current sources in used, a list.") +(defvar helm-delayed-init-executed nil) +(defvar helm-buffer "*helm*" + "Buffer showing completions.") +(defvar helm-current-buffer nil + "Current buffer when `helm' is invoked.") +(defvar helm-buffer-file-name nil + "Variable `buffer-file-name' when `helm' is invoked.") +(defvar helm-default-directory nil + "The value of `default-directory' when `helm' is initialized.") +(defvar helm-candidate-cache (make-hash-table :test 'equal) + "Holds the available candidate within a single helm invocation.") +(defvar helm-pattern "" + "The input pattern used to update the helm buffer.") +(defvar helm-input "" + "The input typed in the candidates panel.") +(defvar helm-input-local nil + "Internal, store locally `helm-pattern' value for later use in `helm-resume'.") +(defvar helm-source-name nil) +(defvar helm-current-source nil) +(defvar helm-candidate-buffer-alist nil) +(defvar helm-match-hash (make-hash-table :test 'equal)) +(defvar helm-cib-hash (make-hash-table :test 'equal)) +(defvar helm-tick-hash (make-hash-table :test 'equal)) +(defvar helm-issued-errors nil) +(defvar helm-debug-root-directory nil + "When non--nil, save helm log to `helm-last-log-file'. +Be aware that if you set that, you will end up with a huge directory +of log files, so use that only for debugging purpose. +See `helm-log-save-maybe' for more info.") +(defvar helm-last-log-file nil + "The name of the last helm session log file.") +(defvar helm-follow-mode nil) +(defvar helm--local-variables nil) +(defvar helm-split-window-state nil) +(defvar helm--window-side-state nil) +(defvar helm-selection-point nil) +(defvar helm-alive-p nil) +(defvar helm-visible-mark-overlays nil) +(defvar helm-update-blacklist-regexps '("^" "^ *" "$" "!" " " "\\b" + "\\<" "\\>" "\\_<" "\\_>" ".*")) +(defvar helm-suspend-update-flag nil) +(defvar helm-force-updating-p nil) +(defvar helm-exit-status 0 + "Flag to inform whether helm have exited or quitted. +Exit with 0 mean helm have exited executing an action. +Exit with 1 mean helm have quitted with \\[keyboard-quit] +It is useful for example to restore a window config if helm abort +in special cases. +See `helm-exit-minibuffer' and `helm-keyboard-quit'.") +(defvar helm-minibuffer-confirm-state nil) +(defvar helm-quit nil) +(defvar helm-attributes nil "List of all `helm' attributes.") +(defvar helm-buffers nil + "All of `helm-buffer' in most recently used order.") +(defvar helm-current-position nil + "Cons of \(point . window-start\) when `helm' is invoked. +It is needed to restore position in `helm-current-buffer' +when `helm' is keyboard-quitted.") +(defvar helm-last-frame-or-window-configuration nil + "Used to store window or frame configuration when helm start.") +(defvar helm-onewindow-p nil) +(defvar helm-types nil) +(defvar helm--mode-line-string-real nil) ; The string to display in mode-line. +(defvar helm-persistent-action-display-window nil) +(defvar helm-marked-candidates nil + "Marked candadates. List of \(source . real\) pair.") +(defvar helm-in-file-completion-p nil) +(defvar helm--mode-line-display-prefarg nil) +(defvar helm--temp-follow-flag nil + "[INTERNAL] A simple flag to notify persistent action we are following.") +(defvar helm--reading-passwd-or-string nil) +(defvar helm--in-update nil) + + +;; Utility: logging +(defun helm-log (format-string &rest args) + "Log message `helm-debug' is non-nil. +Messages are written to the `helm-debug-buffer' buffer. + +Argument FORMAT-STRING is a string to use with `format'. +Use optional arguments ARGS like in `format'." + (when helm-debug + (with-current-buffer (get-buffer-create helm-debug-buffer) + (outline-mode) + (buffer-disable-undo) + (set (make-local-variable 'inhibit-read-only) t) + (goto-char (point-max)) + (insert (let ((tm (current-time))) + (format (concat (if (string-match "Start session" format-string) + "* " "** ") + "%s.%06d (%s)\n %s\n") + (format-time-string "%H:%M:%S" tm) + (nth 2 tm) + (helm-log-get-current-function) + (apply #'format (cons format-string args)))))))) + +(defun helm-log-run-hook (hook) + "Run HOOK like `run-hooks' but write these actions to helm log buffer." + (helm-log "Executing %s with value = %S" hook (symbol-value hook)) + (helm-log "Executing %s with global value = %S" hook (default-value hook)) + (run-hooks hook) + (helm-log "executed %s" hook)) + +(defun helm-log-get-current-function () + "Get function name calling `helm-log'. +The original idea is from `tramp-debug-message'." + (cl-loop with exclude-func-re = "^helm-\\(?:interpret\\|log\\|.*funcall\\)" + for btn from 1 to 40 + for btf = (cl-second (backtrace-frame btn)) + for fn = (if (symbolp btf) (symbol-name btf) "") + if (and (string-match "^helm" fn) + (not (string-match exclude-func-re fn))) + return fn)) + +(defun helm-log-error (&rest args) + "Accumulate error messages into `helm-issued-errors'. +ARGS are args given to `format'. +e.g (helm-log-error \"Error %s: %s\" (car err) (cdr err))." + (apply 'helm-log (concat "ERROR: " (car args)) (cdr args)) + (let ((msg (apply 'format args))) + (unless (member msg helm-issued-errors) + (add-to-list 'helm-issued-errors msg)))) + +(defun helm-log-save-maybe () + "May be save log buffer to `helm-last-log-file'. +If `helm-debug-root-directory' is non--nil and a valid directory, +a directory named 'helm-debug-' +will be created there and the log recorded in a file named +at the date and time of today in this directory." + (when (and (stringp helm-debug-root-directory) + (file-directory-p helm-debug-root-directory) + helm-debug) + (let ((logdir (expand-file-name (concat "helm-debug-" + (format-time-string "%Y%m%d")) + helm-debug-root-directory))) + (make-directory logdir t) + (with-current-buffer (get-buffer-create helm-debug-buffer) + (write-region (point-min) (point-max) + (setq helm-last-log-file + (expand-file-name + (format-time-string "%Y%m%d-%H%M%S") + logdir)) + nil 'silent) + (kill-buffer))))) + +;;;###autoload +(defun helm-debug-open-last-log () + "Open helm log file of last helm session. +If `helm-last-log-file' is nil, switch to `helm-debug-buffer' ." + (interactive) + (if helm-last-log-file + (view-file helm-last-log-file) + (switch-to-buffer helm-debug-buffer) + (view-mode 1) (visual-line-mode 1))) + +(defun helm-print-error-messages () + "Print error messages in `helm-issued-errors'." + (and helm-issued-errors + (message "Helm issued errors: %s" + (mapconcat 'identity (reverse helm-issued-errors) "\n")))) + +;; [FIXME] It seem it is no more needed to have cursor at end of +;; insertion, so I keep the advices fo now but don't activate +;; them, need to clarify why I needed that IIRC it was +;; a problem with keybinding not activated. + +;; These advices are needed to fix cursor position in minibuffer +;; after insertion, otherwise cursor stay at beginning of insertion. +;; Using a timer ensure `minibuffer-temporary-goal-position' is set +;; to nil in `goto-history-element' because `last-command' +;; will be one of `next-history-element' or `previous-history-element'. +;; Activate deactivate them by hook because they may not work outside +;; of helm (Issue #338). +(defadvice next-history-element (around helm-delay-next-history-element) + (interactive "p") + (or (zerop n) + (run-with-timer + 0.01 nil + `(lambda () + (condition-case _err + (goto-history-element (- minibuffer-history-position ,n)) + (user-error (message "End of history; no default available") + (sit-for 0.5) (message nil))))))) + +(defadvice previous-history-element (around helm-delay-previous-history-element) + (interactive "p") + (or (zerop n) + (run-with-timer + 0.01 nil + `(lambda () + (condition-case _err + (goto-history-element (+ minibuffer-history-position ,n)) + (user-error (message "Beginning of history; no preceding item") + (sit-for 0.5) (message nil))))))) + +;; (add-hook 'helm-before-initialize-hook +;; (lambda () +;; (ad-enable-advice 'next-history-element 'around +;; 'helm-delay-next-history-element) +;; (ad-enable-advice 'previous-history-element 'around +;; 'helm-delay-previous-history-element))) +;; (add-hook 'helm-cleanup-hook +;; (lambda () +;; (ad-disable-advice 'next-history-element 'around +;; 'helm-delay-next-history-element) +;; (ad-disable-advice 'previous-history-element 'around +;; 'helm-delay-previous-history-element))) + + +;; Programming Tools +(defmacro helm-aif (test-form then-form &rest else-forms) + "Like `if' but set the result of TEST-FORM in a temprary variable called `it'. +THEN-FORM and ELSE-FORMS are then excuted just like in `if'." + (declare (indent 2) (debug t)) + `(let ((it ,test-form)) + (if it ,then-form ,@else-forms))) + +(defun helm-mklist (obj) + "If OBJ is a list \(but not lambda\), return itself. +Otherwise make a list with one element." + (if (and (listp obj) (not (functionp obj))) + obj + (list obj))) + +(defun helm-this-command () + "Return the actual command in action. +Like `this-command' but return the real command, +not `exit-minibuffer' or unwanted functions." + (cl-loop with bl = '(helm-maybe-exit-minibuffer + helm-confirm-and-exit-minibuffer + helm-exit-minibuffer + exit-minibuffer) + for count from 1 to 50 + for btf = (backtrace-frame count) + for fn = (cl-second btf) + if (and (commandp fn) (not (memq fn bl))) return fn + else + if (and (eq fn 'call-interactively) + (> (length btf) 2)) + return (cadr (cdr btf)))) + + +;; Helm API + +(defun helm-buffer-get () + "Return `helm-action-buffer' if shown otherwise `helm-buffer'." + (if (helm-action-window) + helm-action-buffer + helm-buffer)) + +(defun helm-window () + "Window of `helm-buffer'." + (get-buffer-window (helm-buffer-get) 'visible)) + +(defun helm-action-window () + "Window of `helm-action-buffer'." + (get-buffer-window helm-action-buffer 'visible)) + +(defmacro with-helm-window (&rest body) + "Be sure BODY is excuted in the helm window." + (declare (indent 0) (debug t)) + `(with-selected-window (helm-window) + ,@body)) + +(defmacro with-helm-current-buffer (&rest body) + "Eval BODY inside `helm-current-buffer'." + (declare (indent 0) (debug t)) + `(with-current-buffer (or (and (buffer-live-p helm-current-buffer) + helm-current-buffer) + (setq helm-current-buffer + (current-buffer))) + ,@body)) + +(defmacro with-helm-buffer (&rest body) + "Eval BODY inside `helm-buffer'." + (declare (indent 0) (debug t)) + `(with-current-buffer (helm-buffer-get) + ,@body)) + +(defmacro with-helm-restore-variables(&rest body) + "Restore `helm-restored-variables' after executing BODY." + (declare (indent 0) (debug t)) + `(let ((orig-vars (mapcar (lambda (v) + (cons v (symbol-value v))) + helm-restored-variables))) + (unwind-protect (progn ,@body) + (cl-loop for (var . value) in orig-vars + do (set var value)) + (helm-log "restore variables")))) + +(defmacro with-helm-default-directory (directory &rest body) + (declare (indent 2) (debug t)) + `(let ((default-directory (or (and ,directory + (file-name-as-directory ,directory)) + default-directory))) + ,@body)) + +(defun helm-default-directory () + "Return the value of `helm-default-directory'." + (buffer-local-value 'helm-default-directory (get-buffer helm-buffer))) + +(defmacro with-helm-temp-hook (hook &rest body) + "Execute temporarily BODY as a function for HOOK." + (declare (indent 1) (debug t)) + (let ((fun (cl-gensym "helm-hook"))) + `(progn + (defun ,fun () + (unwind-protect + (progn ,@body) + (remove-hook ,hook (quote ,fun)))) + (add-hook ,hook (quote ,fun))))) + +(defmacro with-helm-after-update-hook (&rest body) + "Execute BODY at end of `helm-update'." + (declare (indent 0) (debug t)) + `(with-helm-temp-hook 'helm-after-update-hook ,@body)) + +(defmacro with-helm-alive-p (&rest body) + "Return error when BODY run outside helm context." + (declare (indent 0) (debug t)) + `(progn + (if helm-alive-p + (progn ,@body) + (error "Running helm command outside of context")))) + +(cl-defun helm-attr (attribute-name + &optional (src (helm-get-current-source)) compute) + "Get the value of ATTRIBUTE-NAME of SRC. +If SRC is omitted, use current source. +If COMPUTE is non--nil compute value of ATTRIBUTE-NAME +with `helm-interpret-value'." + (helm-aif (or (assq attribute-name src) + (helm-get-attribute-from-source-type attribute-name src)) + (if compute (helm-interpret-value (cdr it)) (cdr it)))) + +(cl-defun helm-attr-defined (attribute-name + &optional (src (helm-get-current-source))) + "Return non-nil if ATTRIBUTE-NAME of SRC is defined. +if SRC is omitted, use current source." + (and (helm-attr attribute-name src) t)) + +(cl-defun helm-attrset (attribute-name value + &optional + (src (helm-get-current-source)) + alter-type) + "Set the value of ATTRIBUTE-NAME of source SRC to VALUE. +If ATTRIBUTE-NAME doesn't exists in source it is created with value VALUE. +If ALTER-TYPE is non--nil alter the value of ATTRIBUTE-NAME in `helm-attributes' +if it exists. +If SRC is omitted, use current source. +If operation succeed, return value, otherwise nil." + (let ((from-type (helm-get-attribute-from-source-type attribute-name src)) + done) + (helm-aif (or (assq attribute-name src) + (and alter-type from-type)) + (prog1 (setcdr it value) (setq done t)) + (unless from-type + (setcdr src (cons (cons attribute-name value) (cdr src))) + (setq done t))) + (and done value))) + +(defun helm-get-attribute-from-source-type (attribute source) + "Get ATTRIBUTE from type attribute of SOURCE." + (when (assq 'type source) + (assq attribute + (assq (cdr (assq 'type source)) + helm-type-attributes)))) + +(defun helm-get-attribute-from-type (attribute type) + "Get ATTRIBUTE from TYPE. +arg TYPE is an existing type defined in `helm-type-attributes'." + (assq attribute (assq type helm-type-attributes))) + +(defun helm-get-actions-from-type (source) + "Get actions list from type attribute of SOURCE." + (when (assq 'type source) + (helm-get-attribute-from-source-type 'action source))) + +(defun helm-inherit-attribute-from-source (attribute source) + "Get the ATTRIBUTE of SOURCE." + (helm-aif (assq attribute source) + it + (helm-get-attribute-from-source-type attribute source))) + +(defun helm-append-at-nth (seq elm index) + "Append ELM at INDEX in SEQ." + (let ((len (length seq))) + (when (> index len) (setq index len)) + (cl-loop for i in seq + for count from 1 collect i + when (= count index) + if (listp elm) append elm + else collect elm))) + +(defun helm-add-action-to-source (name fn source &optional index) + "Add new action NAME linked to function FN to SOURCE. +Function FN should be a valid function that take one arg i.e candidate, +argument NAME is a string that will appear in action menu +and SOURCE should be an existing helm source already loaded. +If INDEX is specified, action is added in action list at INDEX, +otherwise it is added at end. +This allow user to add a specific action to an existing source +without modifying source code." + (let ((actions (helm-attr 'action source)) + (new-action (list (cons name fn)))) + (when (symbolp actions) + (setq actions (list (cons "Default action" actions)))) + (helm-attrset 'action + (if index + (helm-append-at-nth actions new-action index) + (append actions new-action)) + source))) + +(defun helm-delete-action-from-source (action-or-name source) + "Delete ACTION-OR-NAME from SOURCE. +ACTION-OR-NAME can either be the name of action or the symbol function +associated to name." + (let* ((actions (helm-attr 'action source)) + (del-action (if (symbolp action-or-name) + (rassoc action-or-name actions) + (assoc action-or-name actions)))) + (helm-attrset 'action (delete del-action actions) source))) + +(cl-defun helm-add-action-to-source-if (name fn source predicate + &optional (index 4) test-only) + "Add new action NAME linked to function FN to SOURCE. +Action is added only if current candidate match PREDICATE. +This function add an entry in the `action-transformer' attribute +of SOURCE (or create one if not found). +Function PREDICATE should take one arg candidate. +Function FN should be a valid function that take one arg i.e candidate, +argument NAME is a string that will appear in action menu +and SOURCE should be an existing helm source already loaded. +If INDEX is specified, action is added in action list at INDEX. +Value of INDEX should be always >=1, default to 4. +This allow user to add a specific `action-tranformer' +to an existing source without modifying source code. +E.g +Add the action \"Byte compile file async\" linked to +function 'async-byte-compile-file to source `helm-source-find-files' +only when predicate helm-ff-candidates-lisp-p return non--nil: + +\(helm-add-action-to-source-if \"Byte compile file async\" + 'async-byte-compile-file + helm-source-find-files + 'helm-ff-candidates-lisp-p\)." + (let* ((actions (helm-attr 'action source)) + (action-transformers (helm-attr 'action-transformer source)) + (new-action (list (cons name fn))) + (transformer `(lambda (actions candidate) + (cond ((funcall (quote ,predicate) candidate) + (helm-append-at-nth + actions (quote ,new-action) ,index)) + (t actions))))) + (when (symbolp actions) + (helm-attrset 'action (list (cons "Default action" actions)) source)) + (when (symbolp action-transformers) + (setq action-transformers (list action-transformers))) + (if test-only ; debug + (delq nil (append (list transformer) action-transformers)) + (helm-attrset 'action-transformer + (delq nil (append (list transformer) action-transformers)) + source)))) + +(defun helm-set-source-filter (sources) + "Set the value of `helm-source-filter' to SOURCES and update. + +This function sets a filter for helm sources and it may be +called while helm is running. It can be used to toggle +displaying of sources dynamically. For example, additional keys +can be bound into `helm-map' to display only the file-related +results if there are too many matches from other sources and +you're after files only: + +Shift+F shows only file results from some sources: + +\(define-key helm-map \"F\" 'helm-my-show-files-only) + +\(defun helm-my-show-files-only () + (interactive) + (helm-set-source-filter '(\"File Name History\" + \"Files from Current Directory\"))) + +Shift+A shows all results: + +\(define-key helm-map \"A\" 'helm-my-show-all) + +\(defun helm-my-show-all () + (interactive) + (helm-set-source-filter nil)) + +The -my- part is added to avoid collisions with +existing Helm function names." + (unless (and (listp sources) + (cl-loop for name in sources always (stringp name))) + (error "Invalid data in `helm-set-source-filter': %S" sources)) + (let ((cur-disp-sel (with-current-buffer helm-buffer + (helm-get-selection nil t)))) + (setq helm-source-filter sources) + (helm-log "helm-source-filter = %S" helm-source-filter) + ;; Use force-update to run init/update functions. + (helm-force-update (regexp-quote cur-disp-sel)))) + +(defun helm-set-sources (sources &optional no-init no-update) + "Set SOURCES during `helm' invocation. +If NO-INIT is non-nil, skip executing init functions of SOURCES. +If NO-UPDATE is non-nil, skip executing `helm-update'." + (with-current-buffer helm-buffer + (setq helm-compiled-sources nil + helm-sources sources) + (helm-log "helm-compiled-sources = %S" helm-compiled-sources) + (helm-log "helm-sources = %S" helm-sources)) + (unless no-init (helm-funcall-foreach 'init)) + (unless no-update (helm-update))) + +(defun helm-get-sources () + "Return compiled `helm-sources', which is memoized. + +Attributes: + +- type + `helm-type-attributes' are merged in. +- candidates-buffer + candidates, volatile and match attribute are created." + (cond + ;; action + ((helm-action-window) + helm-sources) + ;; memoized + (helm-compiled-sources) + ;; first time + (t + (prog1 + (setq helm-compiled-sources + (helm-compile-sources + helm-sources helm-compile-source-functions)) + (helm-log "helm-compiled-sources = %S" helm-compiled-sources))))) + +(cl-defun helm-get-selection (&optional (buffer nil buffer-s) + force-display-part) + "Return the currently selected item or nil. +if BUFFER is nil or unspecified, use helm-buffer as default value. +If FORCE-DISPLAY-PART is non-nil, return the display string. +If FORCE-DISPLAY-PART value is 'withprop the display string is returned +with its properties." + (setq buffer (if (and buffer buffer-s) buffer helm-buffer)) + (unless (helm-empty-buffer-p buffer) + (with-current-buffer buffer + (let* ((disp-fn (if (eq force-display-part 'withprop) + 'buffer-substring + 'buffer-substring-no-properties)) + (selection + (or (and (not force-display-part) + (get-text-property (overlay-start + helm-selection-overlay) + 'helm-realvalue)) + ;; It is needed to return properties of DISP in some case, + ;; e.g for `helm-confirm-and-exit-minibuffer', + ;; so use `buffer-substring' here when 'withprop is specified. + (let ((disp (funcall + disp-fn + (overlay-start helm-selection-overlay) + (1- (overlay-end helm-selection-overlay)))) + (source (helm-get-current-source))) + (helm-aif (and (not force-display-part) + (assoc-default 'display-to-real source)) + (helm-funcall-with-source source it disp) + disp))))) + (unless (equal selection "") + (helm-log "selection = %S" selection) + selection))))) + +(defun helm-get-actions-from-current-source () + "Return the associated action for the selected candidate. +It is a function symbol \(sole action\) or list +of \(action-display . function\)." + (unless (helm-empty-buffer-p (helm-buffer-get)) + (helm-aif (helm-attr 'action-transformer) + (helm-composed-funcall-with-source + (helm-get-current-source) it + (helm-attr 'action) (helm-get-selection)) + (helm-attr 'action)))) + +(defun helm-get-current-source () + "Return the source for the current selection. +Allow also checking if helm-buffer contain candidates." + (or helm-current-source + (with-current-buffer (helm-buffer-get) + (or + ;; This happen only when `helm-source-in-each-line-flag' + ;; is non--nil and there is candidates in buffer. + (get-text-property (point) 'helm-source) + ;; Return nil when no--candidates. + (cl-block exit + ;; This goto-char shouldn't be necessary, but point is moved to + ;; point-min somewhere else which shouldn't happen. + (goto-char (overlay-start helm-selection-overlay)) + (let* ((header-pos (or (helm-get-previous-header-pos) + (helm-get-next-header-pos))) + (source-name + (save-excursion + (unless header-pos + (cl-return-from exit nil)) + (goto-char header-pos) + (helm-current-line-contents)))) + (cl-loop for source in (helm-get-sources) thereis + (and (equal (assoc-default 'name source) source-name) + source)))))))) + +(defun helm-buffer-is-modified (buffer) + "Return non-nil when BUFFER is modified since `helm' was invoked." + (let* ((b (get-buffer buffer)) + (key (concat (buffer-name b) "/" (helm-attr 'name))) + (source-tick (or (gethash key helm-tick-hash) 0)) + (buffer-tick (buffer-chars-modified-tick b)) + (modifiedp (/= source-tick buffer-tick))) + (puthash key buffer-tick helm-tick-hash) + (helm-log "buffer = %S" buffer) + (helm-log "modifiedp = %S" modifiedp) + modifiedp)) + +(defun helm-current-buffer-is-modified () + "Check if `helm-current-buffer' is modified since `helm' was invoked." + (helm-buffer-is-modified helm-current-buffer)) + +(defun helm-run-after-quit (function &rest args) + "Perform an action after quitting `helm'. +The action is to call FUNCTION with arguments ARGS." + (setq helm-quit t) + (helm-kill-async-processes) + (helm-log "function = %S" function) + (helm-log "args = %S" args) + (apply 'run-with-timer 0.1 nil function args) + (helm-exit-minibuffer)) + + +(defun define-helm-type-attribute (type definition &optional doc) + "Register type attribute of TYPE as DEFINITION with DOC. +DOC is displayed in `helm-type-attributes' docstring. + +Use this function is better than setting `helm-type-attributes' directly." + (cl-loop for i in definition do + ;; without `ignore-errors', error at emacs22 + (ignore-errors (setf i (delete nil i)))) + (helm-add-type-attribute type definition) + (and doc (helm-document-type-attribute type doc)) + nil) + +(defun helm-document-attribute (attribute short-doc &optional long-doc) + "Register ATTRIBUTE documentation introduced by plug-in. +SHORT-DOC is displayed beside attribute name. +LONG-DOC is displayed below attribute name and short documentation." + (if long-doc + (setq short-doc (concat "(" short-doc ")")) + (setq long-doc short-doc + short-doc "")) + (add-to-list 'helm-attributes attribute t) + (put attribute 'helm-attrdoc + (concat "- " (symbol-name attribute) + " " short-doc "\n\n" long-doc "\n"))) + +(put 'helm-document-attribute 'lisp-indent-function 2) + +(defun helm-interpret-value (value &optional source) + "Interpret VALUE as variable, function or literal and return it. +If VALUE is a function, call it with no arguments and return the value. +If SOURCE compute VALUE for this source. +If VALUE is a variable, return the value. +If VALUE is a symbol, but it is not a function or a variable, cause an error. +Otherwise, return VALUE itself." + (cond ((and source (functionp value)) + (helm-funcall-with-source source value)) + ((functionp value) + (funcall value)) + ((and (symbolp value) (boundp value)) + (symbol-value value)) + ((symbolp value) + (error + "helm-interpret-value: Symbol must be a function or a variable")) + (t + value))) + +(defun helm-set-local-variable (&rest args) + "Bind each pair in ARGS locally to `helm-buffer'. +Use this to set local vars before calling helm. +Usage: helm-set-local-variable ([VAR VALUE]...) +Just like `setq' except that the vars are not set sequentially. +IOW Don't use VALUE of previous VAR to eval the VALUE of next VAR. +When helm is alive use `make-local-variable' as usual on `helm-buffer'. + +\(fn VAR VALUE ...)" + (setq helm--local-variables + (append (cl-loop for i on args by #'cddr + collect (cons (car i) (cadr i))) + helm--local-variables))) + + +;; Core: API helper +(cl-defun helm-empty-buffer-p (&optional (buffer helm-buffer)) + "Check if BUFFER have candidates. +Default value for BUFFER is `helm-buffer'." + (zerop (buffer-size (and buffer (get-buffer buffer))))) + +(defun helm-empty-source-p () + "Check if current source contains candidates. +This happen only in certains cases when e.g the last element +of a source is deleted without updating the source." + (with-helm-window + (or (helm-empty-buffer-p) + (and (helm-end-of-source-p) + (eq (point-at-bol) (point-at-eol)) + (or + (save-excursion + (forward-line -1) + (helm-pos-header-line-p)) + (bobp)))))) + + +;; Core: tools +(defun helm-current-line-contents () + "Current line string without properties." + (buffer-substring-no-properties (point-at-bol) (point-at-eol))) + +(defun helm-funcall-with-source (source functions &rest args) + "Call from SOURCE FUNCTIONS list or single function FUNCTIONS with ARGS. +FUNCTIONS can be a symbol or a list of functions. +Return the result of last function call." + (let ((helm-source-name (assoc-default 'name source)) + (helm-current-source source) + (funs (if (functionp functions) (list functions) functions))) + (helm-log "helm-source-name = %S" helm-source-name) + (helm-log "functions = %S" functions) + (helm-log "args = %S" args) + (cl-loop with result for fn in funs + do (setq result (apply fn args)) finally return result))) + +(defun helm-funcall-foreach (sym &optional sources) + "Call the associated function to SYM for each source if any." + (let ((sources (or sources (helm-get-sources)))) + (cl-dolist (source sources) + (helm-aif (assoc-default sym source) + (helm-funcall-with-source source it))))) + +(defun helm-normalize-sources (sources) + "If SOURCES is only one source, make a list of one element." + (cond ((or (and sources + (symbolp sources)) + (and (listp sources) (assq 'name sources))) + (list sources)) + (sources) + (t helm-sources))) + +(defun helm-get-candidate-number (&optional in-current-source) + "Return candidates number in `helm-buffer'. +If IN-CURRENT-SOURCE is provided return number of candidates +in the source where point is." + (with-current-buffer (helm-buffer-get) + (if (or (helm-empty-buffer-p) + (helm-empty-source-p)) + 0 + (save-excursion + (if in-current-source + (goto-char (helm-get-previous-header-pos)) + (goto-char (point-min))) + (forward-line 1) + (if (helm-pos-multiline-p) + (save-excursion + (cl-loop with count-multi = 1 + while (and (not (if in-current-source + (save-excursion + (forward-line 2) + (or (helm-pos-header-line-p) (eobp))) + (eobp))) + (search-forward helm-candidate-separator nil t)) + do (cl-incf count-multi) + finally return count-multi)) + (save-excursion + (cl-loop with ln = 0 + while (not (if in-current-source + (or (helm-pos-header-line-p) (eobp)) + (eobp))) + unless (helm-pos-header-line-p) + do (cl-incf ln) + do (forward-line 1) finally return ln))))))) + +(defmacro with-helm-quittable (&rest body) + "If an error occur in execution of BODY, quit helm safely." + (declare (indent 0) (debug t)) + `(let (inhibit-quit) + (condition-case _v + (progn ,@body) + (quit (setq helm-quit t) + (exit-minibuffer) + (keyboard-quit))))) + +(defun helm-compose (arg-lst func-lst) + "Apply arguments specified in ARG-LST with each function of FUNC-LST. +The result of each function will be the new `car' of ARG-LST. +Each function in FUNC-LST must accept (length ARG-LST) arguments +\(See examples below) . +This function allows easy sequencing of transformer functions. +Where generally, ARG-LST is '(candidates-list source) and FUNC-LST a +list of transformer functions that take one or two arguments depending +we are using 'filtered-candidate-transformer' or 'candidate-transformer'. +e.g +filtered-candidate-transformer: +\(helm-compose '((1 2 3 4 5 6 7) + '((name . \"A helm source\") (candidates . (a b c)))) + '((lambda (candidates _source) + (cl-loop for i in candidates + when (cl-oddp i) collect i)) + (lambda (candidates _source) + (cl-loop for i in candidates collect (1+ i))))) +=>(2 4 6 8) + +candidate-transformer: +\(helm-compose '((1 2 3 4 5 6 7)) + '((lambda (candidates) + (cl-loop for i in candidates + when (cl-oddp i) collect i)) + (lambda (candidates) + (cl-loop for i in candidates collect (1+ i))))) +=> (2 4 6 8)." + (cl-dolist (func func-lst) + (setcar arg-lst (apply func arg-lst))) + (car arg-lst)) + +(defun helm-composed-funcall-with-source (source funcs &rest args) + "With SOURCE apply `helm-funcall-with-source' with each FUNCS and ARGS. +This is used in transformers to modify candidates list." + (if (functionp funcs) + (apply 'helm-funcall-with-source source funcs args) + (apply 'helm-funcall-with-source source + (lambda (&rest oargs) (helm-compose oargs funcs)) + args))) + + +;; Core: entry point +;; `:allow-nest' is not in this list because it is treated before. +(defconst helm-argument-keys + '(:sources :input :prompt :resume + :preselect :buffer :keymap :default :history)) + +;;;###autoload +(defun helm (&rest plist) + "Main function to execute helm sources. + +Keywords supported: +:sources :input :prompt :resume :preselect +:buffer :keymap :default :history :allow-nest + +Extra LOCAL-VARS keywords are supported, see below. + +PLIST is a list like \(:key1 val1 :key2 val2 ...\) or +\(&optional sources input prompt resume + preselect buffer keymap default history\). + +Basic keywords are the following: + +\:sources + +A list of sources used for this session. It also accepts a +symbol, interpreted as a variable of a helm source +i.e (a symbol can be passed instead of a list of sources). +It also accepts an alist representing a helm source, which is +detected by \(assq 'name ANY-SOURCES\). +NOTE: In this case the source is embedded in the helm command and +have no symbol name, so it is not reachable from outside. +It will be referenced in `helm-sources' as a whole alist. + +\:input + +Temporary value of `helm-pattern', ie. initial input of minibuffer. + +\:prompt + +Prompt other than \"pattern: \". + +\:resume + +If t, Resurrect previously instance of `helm'. Skip the initialization. +If 'noresume, this instance of `helm' cannot be resumed. + +\:preselect + +Initially selected candidate. Specified by exact candidate or a regexp. + +\:buffer + +`helm-buffer' instead of *helm*. + +\:keymap + +`helm-map' for current `helm' session. + +\:default + +A default argument that will be inserted in minibuffer \ +with \\\\[next-history-element]. +When nil or not present `thing-at-point' will be used instead. +If `helm-maybe-use-default-as-input' is non--nil display will be +updated using :default arg as input unless :input is specified, +which in this case will take precedence on :default +This is a string or a list, in this case the car of the list will +be used as initial default input, but you will be able to cycle in this +list with \\\\[next-history-element]. + +\:history + +By default all minibuffer input is pushed to `minibuffer-history', +if an argument HISTORY is provided, input will be pushed to HISTORY. +History element should be a symbol. + +\:allow-nest + +Allow running this helm command within a running helm session. + +Of course, conventional arguments are supported, the two are same. + +\(helm :sources sources :input input :prompt prompt :resume resume + :preselect preselect :buffer buffer :keymap keymap :default default + :history history\) + +and + +\(helm sources input prompt resume preselect buffer keymap default history\) + +are the same. + +However the use of non keyword args is deprecated and should not be used. + +Other keywords are interpreted as local variables of this helm session. +The `helm-' prefix can be omitted. For example, + +\(helm :sources 'helm-source-buffers-list + :buffer \"*buffers*\" :candidate-number-limit 10\) + +means starting helm session with `helm-source-buffers' +source in *buffers* buffer and set variable `helm-candidate-number-limit' +to 10 as session local variable. + +\(fn &key SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT HISTORY ALLOW-NEST OTHER-LOCAL-VARS)" + (let ((fn (cond ((or (and helm-alive-p (plist-get plist :allow-nest)) + (and helm-alive-p (memq 'allow-nest plist))) + #'helm-nest) + ((keywordp (car plist)) + #'helm) + (t #'helm-internal)))) + (if (and helm-alive-p (eq fn #'helm)) + (if (helm-alive-p) + ;; A helm session is normally running. + (error "Error: Trying to run helm within a running helm session") + ;; A helm session is already running and user jump somewhere else + ;; without desactivating it. + (with-helm-buffer + (prog1 + (message "Aborting an helm session running in background") + ;; `helm-alive-p' will be reset in unwind-protect forms. + (helm-keyboard-quit)))) + (if (keywordp (car plist)) + ;; Parse `plist' and move not regular `helm-argument-keys' + ;; to `helm--local-variables', then calling helm on itself + ;; with normal arguments (the non--arguments-keys removed) + ;; will end up in [1]. + (progn + (setq helm--local-variables + (append helm--local-variables + ;; Vars passed by keyword on helm call + ;; take precedence on same vars + ;; that may have been passed before helm call. + (helm-parse-keys plist))) + (apply fn (mapcar #'(lambda (key) (plist-get plist key)) + helm-argument-keys))) + (apply fn plist))))) ; [1] fn == helm-internal. + +(defun helm-alive-p () + "Check if `helm' is alive. +An `helm' session is considered alive if `helm-alive-p' is non--nil, +the `helm-buffer' is visible, and cursor is in minibuffer." + (and helm-alive-p + (get-buffer-window helm-buffer 'visible) + (minibuffer-window-active-p (minibuffer-window)) + (minibufferp (current-buffer)))) + +(defun helm-parse-keys (keys) + "Parse the KEYS arguments of `helm'. +Return only the keys that are not in `helm-argument-keys', +prefix them with \"helm\" and convert them to alist. +This allow to add arguments that are not part of `helm-argument-keys', +but are valid helm variables. +e.g :candidate-number-limit will be bound to `helm-candidate-number-limit' +in source. + + (helm-parse-keys '(:sources ((name . \"test\") + (candidates . (a b c))) + :buffer \"toto\" + :candidate-number-limit 4)) + ==> ((helm-candidate-number-limit . 4))." + + (cl-loop for (key value) on keys by #'cddr + for symname = (substring (symbol-name key) 1) + for sym = (intern (if (string-match "^helm-" symname) + symname + (concat "helm-" symname))) + unless (memq key helm-argument-keys) + collect (cons sym value))) + +;;; Core: entry point helper +(defun helm-internal (&optional + any-sources any-input + any-prompt any-resume + any-preselect any-buffer + any-keymap any-default any-history) + "The internal helm function called by `helm'. +For ANY-SOURCES ANY-INPUT ANY-PROMPT ANY-RESUME ANY-PRESELECT ANY-BUFFER and +ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'." + ;; Activate the advice for `tramp-read-passwd'. + (if (fboundp 'advice-add) + (advice-add 'tramp-read-passwd :around #'helm--advice-tramp-read-passwd) + (ad-activate 'tramp-read-passwd)) + (catch 'exit ; `exit-minibuffer' use this tag on exit. + (helm-log (concat "[Start session] " (make-string 41 ?+))) + (helm-log "any-prompt = %S" any-prompt) + (helm-log "any-preselect = %S" any-preselect) + (helm-log "any-buffer = %S" any-buffer) + (helm-log "any-keymap = %S" any-keymap) + (helm-log "any-default = %S" any-default) + (helm-log "any-history = %S" any-history) + (let ((old-overriding-local-map overriding-terminal-local-map) + ;; #163 no cursor in minibuffer in <=Emacs-24.2. + ;; Apart this bug in <=24.2, this is needed for + ;; messages in minibuffer on top of helm prompt. + (cursor-in-echo-area t) + (non-essential t) + (old--cua cua-mode) + (helm-maybe-use-default-as-input + (or helm-maybe-use-default-as-input ; it is let-bounded so use it. + (cl-loop for s in (helm-normalize-sources any-sources) + thereis (memq s helm-sources-using-default-as-input))))) + ;; cua-mode overhide local helm bindings. + ;; disable this stupid thing if enabled. + (and cua-mode (cua-mode -1)) + (unwind-protect + (condition-case _v + (let (;; `helm-source-name' is non-nil + ;; when `helm' is invoked by action, reset it. + helm-source-name + helm-current-source + helm-in-persistent-action + helm-quit + (helm-buffer (or any-buffer helm-buffer))) + (with-helm-restore-variables + (helm-initialize + any-resume any-input any-default any-sources) + (helm-display-buffer helm-buffer) + (add-hook 'post-command-hook 'helm--maybe-update-keymap) + (helm-log "show prompt") + (unwind-protect + (helm-read-pattern-maybe + any-prompt any-input any-preselect + any-resume any-keymap any-default any-history) + (helm-cleanup))) + (prog1 + (unless helm-quit (helm-execute-selection-action)) + (helm-log (concat "[End session] " (make-string 41 ?-))))) + (quit + (helm-restore-position-on-quit) + (helm-log (concat "[End session (quit)] " (make-string 34 ?-))) + nil)) + (remove-hook 'post-command-hook 'helm--maybe-update-keymap) + (if (fboundp 'advice-add) + (advice-remove 'tramp-read-passwd #'helm--advice-tramp-read-passwd) + (ad-deactivate 'tramp-read-passwd)) + (helm-log "helm-alive-p = %S" (setq helm-alive-p nil)) + (setq overriding-terminal-local-map old-overriding-local-map) + (setq helm-alive-p nil) + (setq helm-in-file-completion-p nil) + (and old--cua (cua-mode 1)) + (helm-log-save-maybe))))) + + +;;; Helm resume +;; +;; +(defun helm-resume (arg) + "Resurrect previously invoked `helm'. +Called with a prefix arg, allow choosing among all existing +helm buffers. i.e choose among various helm sessions. +Called from lisp, you can specify a buffer-name as a string with ARG." + (interactive "P") + (let (any-buffer helm-full-frame cur-dir) + (if arg + (if (and (stringp arg) (bufferp (get-buffer arg))) + (setq any-buffer arg) + (setq any-buffer (helm-resume-select-buffer))) + (setq any-buffer helm-last-buffer)) + (cl-assert any-buffer nil + "helm-resume: No helm buffers found to resume") + ;; Reset `cursor-type' to nil as it have been set to t + ;; when quitting previous session. + (with-current-buffer any-buffer (setq cursor-type nil)) + (setq helm-full-frame (buffer-local-value + 'helm-full-frame (get-buffer any-buffer))) + (setq helm-compiled-sources nil) + (setq cur-dir (buffer-local-value + 'helm-default-directory (get-buffer any-buffer))) + (unless (buffer-live-p helm-current-buffer) + ;; `helm-current-buffer' may have been killed. + (setq helm-current-buffer (current-buffer))) + ;; Restart with same `default-directory' value this session + ;; was initially started with. + (with-helm-default-directory cur-dir + (helm + :sources (buffer-local-value + 'helm-sources (get-buffer any-buffer)) + :input (buffer-local-value 'helm-input-local (get-buffer any-buffer)) + :resume t + :buffer any-buffer)))) + +(defun helm-resume-previous-session-after-quit (arg) + "Resume previous helm session within running helm." + (interactive "p") + (if (and helm-alive-p (> (length helm-buffers) arg)) + (helm-run-after-quit `(lambda () (helm-resume (nth ,arg helm-buffers)))) + (message "No previous helm sessions to resume yet!"))) + +(defun helm-resume-list-buffers-after-quit () + "List resumable helm buffers within running helm." + (interactive) + (if (and helm-alive-p (> (length helm-buffers) 0)) + (helm-run-after-quit #'(lambda () (helm-resume t))) + (message "No previous helm sessions to resume yet!"))) + +(defun helm-resume-p (any-resume) + "Whether current helm session is resumed or not." + (eq any-resume t)) + +(defun helm-resume-select-buffer () + "Select an `helm-buffer' in `helm-buffers' list to resume a helm session. +Return nil if no `helm-buffer' found." + (when helm-buffers + (or (helm :sources '(((name . "Resume helm buffer") + (candidates . helm-buffers) + (action . identity))) + :resume 'noresume + :buffer "*helm resume*") + (keyboard-quit)))) + + +;;;###autoload +(defun helm-other-buffer (any-sources any-buffer) + "Simplified interface of `helm' with other `helm-buffer'. +Call `helm' with only ANY-SOURCES and ANY-BUFFER as args." + (helm :sources any-sources :buffer any-buffer)) + +(defun helm-nest (&rest same-as-helm) + "Allow calling `helm' whithin a running helm session. +Arguments SAME-AS-HELM are the same as `helm', which see." + (with-helm-window + (let ((orig-helm-current-buffer helm-current-buffer) + (orig-helm-buffer helm-buffer) + (orig-helm-last-frame-or-window-configuration + helm-last-frame-or-window-configuration) + (orig-one-window-p helm-onewindow-p)) + (unwind-protect + (let (helm-current-position + helm-current-buffer + helm-pattern + (helm-buffer (or (cl-getf same-as-helm :buffer) + (nth 5 same-as-helm) + "*Helm*")) + helm-sources + helm-compiled-sources + (helm-full-frame t) + (enable-recursive-minibuffers t)) + (apply #'helm same-as-helm)) + (with-current-buffer orig-helm-buffer + (setq helm-alive-p t) ; Nested session set this to nil on exit. + (setq helm-buffer orig-helm-buffer) + (helm-initialize-overlays helm-buffer) + (unless (helm-empty-buffer-p) (helm-mark-current-line t)) + (setq helm-last-frame-or-window-configuration + orig-helm-last-frame-or-window-configuration) + (setq cursor-type nil) + (setq helm-current-buffer orig-helm-current-buffer) + (setq helm-onewindow-p orig-one-window-p)))))) + + +;;; Core: Accessors +;; +(defun helm-current-position (save-or-restore) + "Restore or save current position in `helm-current-buffer'. +Argument SAVE-OR-RESTORE is one of save or restore." + (cl-case save-or-restore + (save + (helm-log "Save position at %S" (cons (point) (window-start))) + (setq helm-current-position (cons (point) (window-start)))) + (restore + (helm-log "Restore position at %S in buffer %s" + helm-current-position + (buffer-name (current-buffer))) + (goto-char (car helm-current-position)) + ;; Fix this position with the NOFORCE arg of `set-window-start' + ;; otherwise, if there is some other buffer than `helm-current-buffer' + ;; one, position will be lost. + (set-window-start (selected-window) (cdr helm-current-position) t)))) + + +(defun helm-frame-or-window-configuration (save-or-restore) + "Save or restore last frame or window configuration. +Possible value of SAVE-OR-RESTORE are 'save and 'restore. +window or frame configuration is saved/restored according to values of +`helm-save-configuration-functions'." + (helm-log "helm-save-configuration-functions = %S" + helm-save-configuration-functions) + (let ((window-persistent-parameters (append '((no-other-window . t)) + window-persistent-parameters))) + (cl-case save-or-restore + (save (setq helm-last-frame-or-window-configuration + (funcall (cdr helm-save-configuration-functions)))) + (restore (funcall (car helm-save-configuration-functions) + helm-last-frame-or-window-configuration) + ;; Restore frame focus. + ;; This is needed for minibuffer own-frame config + ;; when recursive minibuffers are in use. + ;; e.g M-: + helm-minibuffer-history. + (let ((frame (if (minibufferp helm-current-buffer) + (selected-frame) + (last-nonminibuffer-frame)))) + (select-frame-set-input-focus frame)))))) + +(defun helm-split-window-default-fn (window) + (let (split-width-threshold) + (if (and (fboundp 'window-in-direction) + ;; Don't try to split when starting in a minibuffer + ;; e.g M-: and try to use helm-show-kill-ring. + (not (minibufferp helm-current-buffer))) + (if (or (one-window-p t) + helm-split-window-in-side-p) + (split-window + (selected-window) nil (if (eq helm-split-window-default-side 'other) + 'below helm-split-window-default-side)) + ;; If more than one window reuse one of them. + (cl-case helm-split-window-default-side + (left (or (helm-window-in-direction 'left) + (helm-window-in-direction 'above) + (selected-window))) + (above (or (helm-window-in-direction 'above) + (helm-window-in-direction 'left) + (selected-window))) + (right (or (helm-window-in-direction 'right) + (helm-window-in-direction 'below) + (selected-window))) + (below (or (helm-window-in-direction 'below) + (helm-window-in-direction 'right) + (selected-window))) + (same (selected-window)) + (other (other-window-for-scrolling)) + (t (or (window-next-sibling) (selected-window))))) + (split-window-sensibly window)))) + +(defun helm-window-in-direction (direction) + "Same as `window-in-direction' but check if window is dedicated." + (helm-aif (window-in-direction direction) + (and (not (window-dedicated-p it)) it))) + + +;;; Display helm buffer +;; +;; +(defun helm-display-buffer (buffer) + "Display BUFFER. +The function used to display `helm-buffer'." + (let (pop-up-frames + (split-window-preferred-function + helm-split-window-preferred-function) + (helm-split-window-default-side + (if (and (not helm-full-frame) + helm-reuse-last-window-split-state) + (cond ((eq helm-split-window-default-side 'same) 'same) + ((eq helm-split-window-default-side 'other) 'other) + (helm--window-side-state) + (t helm-split-window-default-side)) + helm-split-window-default-side))) + (prog1 + (funcall (with-current-buffer buffer helm-display-function) buffer) + (setq helm-onewindow-p (one-window-p t)) + ;; Don't allow other-window and friends switching out of minibuffer. + (when helm-prevent-escaping-from-minibuffer + (helm-prevent-switching-other-window))))) + +(cl-defun helm-prevent-switching-other-window (&key (enabled t)) + "Allow setting `no-other-window' window parameter in all windows. +Arg ENABLE will be the value of the `no-other-window' window property." + (walk-windows + #'(lambda (w) + (unless (window-dedicated-p w) + (set-window-parameter w 'no-other-window enabled))) 0)) + +(defun helm-default-display-buffer (buffer) + "Default function to display `helm-buffer' BUFFER. +It uses `switch-to-buffer' or `pop-to-buffer' depending of value of +`helm-full-frame' and/or `helm-split-window-default-side'." + (if (or (buffer-local-value 'helm-full-frame (get-buffer buffer)) + (and (eq helm-split-window-default-side 'same) + (one-window-p t))) + (progn (delete-other-windows) (switch-to-buffer buffer)) + (when (and helm-always-two-windows + (not (eq helm-split-window-default-side 'same)) + (not (minibufferp helm-current-buffer)) + (not helm-split-window-in-side-p)) + (delete-other-windows)) + (pop-to-buffer buffer))) + + +;;; Core: initialize +;; +(defun helm-initialize (any-resume any-input any-default any-sources) + "Start initialization of `helm' session. +For ANY-RESUME ANY-INPUT ANY-DEFAULT and ANY-SOURCES See `helm'." + (helm-log "start initialization: any-resume=%S any-input=%S" + any-resume any-input) + (helm-frame-or-window-configuration 'save) + (setq helm-sources (helm-normalize-sources any-sources)) + (helm-log "sources = %S" helm-sources) + (helm-current-position 'save) + (if (helm-resume-p any-resume) + (helm-initialize-overlays (helm-buffer-get)) + (helm-initial-setup any-default)) + (setq helm-alive-p t) + (unless (eq any-resume 'noresume) + (helm-recent-push helm-buffer 'helm-buffers) + (setq helm-last-buffer helm-buffer)) + (when any-input (setq helm-input any-input + helm-pattern any-input)) + ;; If a `resume' attribute is present `helm-funcall-foreach' + ;; will run its function. + (when (helm-resume-p any-resume) + (helm-funcall-foreach 'resume)) + (helm-log "end initialization")) + +(defun helm-initialize-overlays (buffer) + "Initialize helm overlays in BUFFER." + (helm-log "overlay setup") + (if helm-selection-overlay + ;; make sure the overlay belongs to the helm buffer if + ;; it's newly created + (move-overlay helm-selection-overlay (point-min) (point-min) + (get-buffer buffer)) + + (setq helm-selection-overlay + (make-overlay (point-min) (point-min) (get-buffer buffer))) + (overlay-put helm-selection-overlay 'face 'helm-selection))) + +(defun helm-restore-position-on-quit () + "Restore position in `helm-current-buffer' when quitting." + (helm-current-position 'restore)) + +(defun helm-recent-push (elt list-var) + "Add ELT to the value of LIST-VAR as most recently used value." + (let ((m (member elt (symbol-value list-var)))) + (and m (set list-var (delq (car m) (symbol-value list-var)))) + (push elt (symbol-value list-var)))) + +(defun helm--current-buffer () + "[internal] Return `current-buffer' BEFORE `helm-buffer' is initialized. +Note that this will return the minibuffer in use after helm have started, +so to get the buffer where helm started while in a helm session, +use `helm-current-buffer'. +It is intended to use this only in `helm-initial-setup'." + (if (minibuffer-window-active-p (minibuffer-window)) + ;; If minibuffer is active be sure to use it's buffer + ;; as `helm-current-buffer', this allow to use helm + ;; from an already active minibuffer (M-: etc...) + (window-buffer (active-minibuffer-window)) + ;; Fix Issue #456 + ;; Use this instead of `current-buffer' to ensure + ;; helm session started in helm-mode from a completing-read + ;; Use really the buffer where we started and not the one + ;; where the completing-read is wrapped. i.e + ;; (with-current-buffer SOME-OTHER-BUFFER (completing-read [...]) + (window-buffer (with-selected-window (minibuffer-window) + (minibuffer-selected-window))))) + +(defun helm-initial-setup (any-default) + "Initialize helm settings and set up the helm buffer." + (helm-log-run-hook 'helm-before-initialize-hook) + (setq helm-current-prefix-arg nil) + (setq helm-suspend-update-flag nil) + (setq helm-delayed-init-executed nil) + (setq helm-current-buffer (helm--current-buffer)) + (setq helm-buffer-file-name buffer-file-name) + (setq helm-issued-errors nil) + (setq helm-compiled-sources nil) + (setq helm-saved-current-source nil) + (unless (and (or helm-split-window-state + helm--window-side-state) + helm-reuse-last-window-split-state) + (setq helm-split-window-state + (if (or (null split-width-threshold) + (and (integerp split-width-threshold) + (>= split-width-threshold (+ (frame-width) 4)))) + 'vertical 'horizontal)) + (setq helm--window-side-state + (or helm-split-window-default-side 'below))) + ;; Call the init function for sources where appropriate + (helm-funcall-foreach + 'init (and helm-source-filter + (cl-remove-if-not #'(lambda (s) + (member (assoc-default 'name s) + helm-source-filter)) + (helm-get-sources)))) + (setq helm-pattern (or (and helm-maybe-use-default-as-input + (or (if (listp any-default) + (car any-default) any-default) + (with-helm-current-buffer + (thing-at-point 'symbol)))) + "")) + (setq helm-input "") + (clrhash helm-candidate-cache) + (helm-create-helm-buffer) + (helm-clear-visible-mark) + (helm-log-run-hook 'helm-after-initialize-hook)) + +(defun helm-create-helm-buffer () + "Create and setup `helm-buffer'." + (let ((root-dir default-directory)) + (with-current-buffer (get-buffer-create helm-buffer) + (helm-log "kill local variables: %S" (buffer-local-variables)) + (kill-all-local-variables) + (set (make-local-variable 'inhibit-read-only) t) + (buffer-disable-undo) + (erase-buffer) + (set (make-local-variable 'helm-map) helm-map) + (make-local-variable 'helm-sources) + (set (make-local-variable 'helm-follow-mode) nil) + (set (make-local-variable 'helm-display-function) helm-display-function) + (set (make-local-variable 'helm-selection-point) nil) + (set (make-local-variable 'scroll-margin) + (if helm-display-source-at-screen-top + 0 helm-completion-window-scroll-margin)) + (set (make-local-variable 'helm-default-directory) root-dir) + (set (make-local-variable 'default-directory) root-dir) + (set (make-local-variable 'helm-marked-candidates) nil) + (helm-initialize-persistent-action) + (helm-log "helm-display-function = %S" helm-display-function) + (helm-log "helm--local-variables = %S" helm--local-variables) + (cl-loop for (var . val) in helm--local-variables + do (set (make-local-variable var) val) + finally (setq helm--local-variables nil)) + (setq truncate-lines helm-truncate-lines) ; already local. + (setq cursor-type nil) + (setq mode-name "Helm")) + (helm-initialize-overlays helm-buffer) + (get-buffer helm-buffer))) + +(defun helm-read-pattern-maybe (any-prompt any-input + any-preselect any-resume any-keymap + any-default any-history) + "Read pattern with prompt ANY-PROMPT and initial input ANY-INPUT. +For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." + (if (and (helm-resume-p any-resume) + ;; When no source, helm-buffer is empty + ;; or contain non--candidate lines (e.g grep exit status) + (helm-get-current-source)) + (helm-mark-current-line t) + (helm-update any-preselect)) + (with-current-buffer (helm-buffer-get) + (let* ((src (helm-get-current-source)) + (src-keymap (assoc-default 'keymap src)) + (hist (or (and any-history (symbolp any-history) any-history) + ;; Needed for resuming. + (assoc-default 'history src))) + (timer nil) + blink-matching-paren + (first-src (car helm-sources)) + (source-delayed-p (or (assq 'delayed src) + (assq 'delayed (if (symbolp first-src) + (symbol-value first-src) + first-src))))) + ;; Startup with the first keymap found either in current source + ;; or helm arg, otherwise use global value of `helm-map'. + ;; This map will be used as a `minibuffer-local-map'. + ;; Maybe it will be overriden when changing source + ;; by `helm--maybe-update-keymap'. + ;; Note that helm-map have been made buffer-local + ;; in `helm-create-helm-buffer'. + (setq helm-map (or src-keymap any-keymap helm-map)) + (helm-log "helm-get-candidate-number => %S" + (helm-get-candidate-number)) + (helm-log "helm-execute-action-at-once-if-one = %S" + helm-execute-action-at-once-if-one) + (helm-log "helm-quit-if-no-candidate = %S" helm-quit-if-no-candidate) + ;; If source is delayed `helm-execute-action-at-once-if-one' + ;; and `helm-quit-if-no-candidate' are handled after update finish. + (when source-delayed-p + ;; Note that we quickly add the hook now when `helm-update' + ;; is already started, but because source is delayed the hook + ;; should have the time to be passed !!! + ;; the hook will remove itself once done. + (with-helm-after-update-hook (helm-exit-or-quit-maybe))) + ;; Reset `helm-pattern' for non--delayed sources and update + ;; display if no result found with precedent value of `helm-pattern' + ;; unless `helm-quit-if-no-candidate' is non--nil, in this case + ;; Don't force update with an empty pattern. + ;; Reset also `helm-maybe-use-default-as-input' as this checking + ;; happen only on startup. + (when (and helm-maybe-use-default-as-input (not source-delayed-p)) + (setq helm-pattern "") + (setq helm-maybe-use-default-as-input nil) + (and (helm-empty-buffer-p) + (null helm-quit-if-no-candidate) + (helm-force-update))) + ;; Handle `helm-execute-action-at-once-if-one' and + ;; `helm-quit-if-no-candidate' now only for not--delayed sources. + (cond ((and helm-execute-action-at-once-if-one + (not source-delayed-p) + (= (helm-get-candidate-number) 1)) + (ignore)) ; Don't enter the minibuffer loop. + ((and helm-quit-if-no-candidate + (not source-delayed-p) + (= (helm-get-candidate-number) 0)) + (setq helm-quit t) + (and (functionp helm-quit-if-no-candidate) + (funcall helm-quit-if-no-candidate))) + (t ; Enter now minibuffer and wait for input. + (let ((tap (or any-default + (with-helm-current-buffer + (thing-at-point 'symbol))))) + (unwind-protect + (minibuffer-with-setup-hook + #'(lambda () + (setq timer (run-with-idle-timer + (max helm-input-idle-delay 0.001) 'repeat + #'(lambda () + ;; Stop updating when in persistent action + ;; or when `helm-suspend-update-flag' is + ;; non--nil. + (unless (or helm-in-persistent-action + helm-suspend-update-flag) + (save-selected-window + (helm-check-minibuffer-input) + (helm-print-error-messages))))))) + (read-from-minibuffer (or any-prompt "pattern: ") + any-input helm-map + nil hist tap t)) + (when timer (cancel-timer timer) (setq timer nil))))))))) + +(defun helm-exit-or-quit-maybe () + "Exit and run default action if only one candidate, quit if no candidates. +This function is handling `helm-execute-action-at-once-if-one' and +`helm-quit-if-no-candidate' in delayed sources." + (with-helm-window + (cond ((and helm-execute-action-at-once-if-one + (= (helm-get-candidate-number) 1)) + (helm-exit-minibuffer)) + ((and helm-quit-if-no-candidate + (= (helm-get-candidate-number) 0)) + (setq helm-quit t) + (and (functionp helm-quit-if-no-candidate) + (funcall helm-quit-if-no-candidate)) + (keyboard-quit))))) + +(defun helm-toggle-suspend-update () + "Enable or disable update of display in helm. +This can be useful for e.g writing quietly a complex regexp." + (interactive) + (when (setq helm-suspend-update-flag (not helm-suspend-update-flag)) + (helm-kill-async-processes) + (setq helm-pattern "")) + (message (if helm-suspend-update-flag + "Helm update suspended!" + "Helm update reenabled!"))) + +(defadvice tramp-read-passwd (around disable-helm-update) + ;; Suspend update when prompting for a tramp password. + (setq helm-suspend-update-flag t) + (setq overriding-terminal-local-map nil) + (setq helm--reading-passwd-or-string t) + (let (stimers) + (unwind-protect + (progn + (setq stimers (with-timeout-suspend)) + ad-do-it) + (with-timeout-unsuspend stimers) + (setq helm--reading-passwd-or-string nil) + (setq helm-suspend-update-flag nil)))) + +(defun helm--advice-tramp-read-passwd (old--fn &rest args) + ;; Suspend update when prompting for a tramp password. + (setq helm-suspend-update-flag t) + (setq overriding-terminal-local-map nil) + (setq helm--reading-passwd-or-string t) + (unwind-protect + ;; No need to suspend timer in emacs-24.4 + (apply old--fn args) + (setq helm--reading-passwd-or-string nil) + (setq helm-suspend-update-flag nil))) + +(defun helm--maybe-update-keymap () + "Handle differents keymaps in multiples sources. + +It will override `helm-map' with the local map of current source. +If no map is found in current source do nothing (keep previous map)." + (with-helm-buffer + (helm-aif (assoc-default 'keymap (helm-get-current-source)) + ;; Fix #466; we use here set-transient-map + ;; to not overhide other minor-mode-map's. + (if (fboundp 'set-transient-map) + (set-transient-map it) + (set-temporary-overlay-map it))))) + + +;; Core: clean up + +(defun helm-cleanup () + "Clean up the mess when helm exit or quit." + (helm-log "start cleanup") + (with-current-buffer helm-buffer + ;; bury-buffer from this window. + (bury-buffer) ;[1] + ;; Be sure we call this from helm-buffer. + (helm-funcall-foreach 'cleanup)) + (helm-kill-async-processes) + (helm-log-run-hook 'helm-cleanup-hook) + (helm-frame-or-window-configuration 'restore) + ;; [1] now bury-buffer from underlying windows otherwise, + ;; if this window is killed the underlying buffer will + ;; be a helm buffer. + (replace-buffer-in-windows helm-buffer) + (setq helm-alive-p nil) + (setq helm-in-file-completion-p nil) + ;; This is needed in some cases where last input + ;; is yielded infinitely in minibuffer after helm session. + (helm-clean-up-minibuffer)) + +(defun helm-clean-up-minibuffer () + "Remove contents of minibuffer." + (let ((miniwin (minibuffer-window))) + ;; Clean only current minibuffer used by helm. + ;; i.e The precedent one is active. + (unless (minibuffer-window-active-p miniwin) + (with-current-buffer (window-buffer miniwin) + (delete-minibuffer-contents))))) + + +;;; Core: input handling +;; +;; +(defun helm-check-minibuffer-input () + "Check minibuffer content." + (with-helm-quittable + (with-selected-window (or (active-minibuffer-window) + (minibuffer-window)) + (helm-check-new-input (minibuffer-contents))))) + +(defun helm-check-new-input (input) + "Check INPUT string and update the helm buffer if necessary." + ;; First time minibuffer is entered + ;; we check value of `helm-pattern' that have been set + ;; in `helm-initial-setup' when `helm-maybe-use-default-as-input' + ;; is non--nil. After this initial check, reset + ;; `helm-maybe-use-default-as-input' and ignore this. + ;; This happen only when source is `delayed'. + (when helm-maybe-use-default-as-input ; nil when non--delayed. + (setq input helm-pattern) + (with-helm-after-update-hook (setq helm-pattern "")) + (setq helm-maybe-use-default-as-input nil)) + ;; In delayed sources `helm-pattern' have not been resat yet. + (unless (equal input helm-pattern) + (setq helm-pattern input) + (unless (helm-action-window) + (setq helm-input helm-pattern)) + (helm-log "helm-pattern = %S" helm-pattern) + (helm-log "helm-input = %S" helm-input) + (setq helm--in-update t) + (helm-update))) + +(defun helm--reset-update-flag () + (run-with-idle-timer + helm-exit-idle-delay nil + (lambda () (setq helm--in-update nil)))) + +(add-hook 'helm-after-update-hook #'helm--reset-update-flag) + + +;;; Core: source compiler +;; +;; +(defun helm-compile-sources (sources funcs) + "Compile SOURCES with FUNCS. +See `helm-compile-source-functions'. +Helm plug-ins are realized by this function." + (mapcar + (lambda (source) + (cl-loop with src = (if (listp source) source (symbol-value source)) + for f in funcs + do (setq src (funcall f src)) + finally (cl-return src))) + sources)) + + +;; Core: all candidates +(defun helm-process-delayed-init (source) + "Initialize delayed SOURCE." + (let ((name (assoc-default 'name source))) + (unless (member name helm-delayed-init-executed) + (helm-aif (assoc-default 'delayed-init source) + (with-current-buffer helm-current-buffer + (helm-funcall-with-source source it) + (cl-dolist (_f (if (functionp it) (list it) it)) + (add-to-list 'helm-delayed-init-executed name))))))) + +(defun helm-get-candidates (source) + "Retrieve and return the list of candidates from SOURCE." + (helm-process-delayed-init source) + (let* (inhibit-quit + (candidate-fn (assoc-default 'candidates source)) + (candidate-proc (assoc-default 'candidates-process source)) + (type-error (lambda () + (error + "`%s' must either be a function, a variable or a list" + (or candidate-fn candidate-proc)))) + (candidates (condition-case err + ;; Process candidates-(process) function + ;; It may return a process or a list of candidates. + (if candidate-proc + (helm-interpret-value candidate-proc source) + (helm-interpret-value candidate-fn source)) + (error (helm-log "Error: %S" err) nil)))) + (when (and (processp candidates) (not candidate-proc)) + (warn "Candidates function `%s' should be called in a `candidates-process' attribute" + candidate-fn)) + (cond ((processp candidates) + ;; Candidates will be filtered later in process filter. + candidates) + ((null candidates) candidates) + ((listp candidates) + ;; Transform candidates with `candidate-transformer' functions if + ;; some, otherwise return candidates. + (helm-transform-candidates candidates source)) + (t (funcall type-error))))) + +(defmacro helm-while-no-input (&rest body) + "Same as `while-no-input' but without testing with `input-pending-p'." + (declare (debug t) (indent 0)) + (let ((catch-sym (make-symbol "input")) + inhibit-quit) + `(with-local-quit + (catch ',catch-sym + (let ((throw-on-input ',catch-sym)) + ,@body))))) + +(defun helm-get-cached-candidates (source) + "Return the cached value of candidates for SOURCE. +Cache the candidates if there is not yet a cached value." + (let* ((name (assoc-default 'name source)) + (candidate-cache (gethash name helm-candidate-cache))) + (helm-aif candidate-cache + (prog1 it (helm-log "Use cached candidates")) + (helm-log "No cached candidates, calculate candidates") + (let ((candidates (helm-get-candidates source))) + (cond ((processp candidates) + (push (cons candidates + (append source + (list (cons 'item-count 0) + (cons 'incomplete-line "")))) + helm-async-processes) + (set-process-filter candidates 'helm-output-filter) + (setq candidates nil)) + ((not (assoc 'volatile source)) + (puthash name candidates helm-candidate-cache))) + candidates)))) + + +;;; Core: candidate transformers +(defun helm-transform-mapcar (function args) + "`mapcar' for candidate-transformer. + +ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...) + +\(helm-transform-mapcar 'upcase '(\"foo\" \"bar\")) +=> (\"FOO\" \"BAR\") +\(helm-transform-mapcar 'upcase '((\"1st\" . \"foo\") (\"2nd\" . \"bar\"))) +=> ((\"1st\" . \"FOO\") (\"2nd\" . \"BAR\")) +" + (cl-loop for arg in args + if (consp arg) + collect (cons (car arg) (funcall function (cdr arg))) + else + collect (funcall function arg))) + +(defun helm-process-candidate-transformer (candidates source) + "Execute `candidate-transformer' function(s) on CANDIDATES in SOURCE." + (helm-aif (assoc-default 'candidate-transformer source) + (helm-composed-funcall-with-source source it candidates) + candidates)) + +(defun helm-process-filtered-candidate-transformer (candidates source) + "Execute `filtered-candidate-transformer' function(s) on CANDIDATES in SOURCE." + (helm-aif (assoc-default 'filtered-candidate-transformer source) + (helm-composed-funcall-with-source source it candidates source) + candidates)) + +(defmacro helm--maybe-process-filter-one-by-one-candidate (candidate source) + "Execute `filter-one-by-one' function(s) on CANDIDATE in SOURCE." + `(helm-aif (assoc-default 'filter-one-by-one ,source) + (if (listp it) + (cl-loop for f in it + do (setq ,candidate (funcall f ,candidate))) + (setq ,candidate (funcall it ,candidate))))) + +(defun helm--initialize-one-by-one-candidates (candidates source) + "Process the CANDIDATES with the `filter-one-by-one' function in SOURCE. +Return CANDIDATES when pattern is empty." + (helm-aif (and (string= helm-pattern "") + (assoc-default 'filter-one-by-one source)) + (cl-loop for cand in candidates + do (helm--maybe-process-filter-one-by-one-candidate cand source) + collect cand) + candidates)) + +(defun helm-process-filtered-candidate-transformer-maybe + (candidates source process-p) + "Execute `filtered-candidate-transformer' function(s) on CANDIDATES in SOURCE. +When PROCESS-P is non-nil execute `filtered-candidate-transformer' +functions if some, otherwise return CANDIDATES." + (if process-p + ;; When no filter return CANDIDATES unmodified. + (helm-process-filtered-candidate-transformer candidates source) + candidates)) + +(defun helm-process-real-to-display (candidates source) + "Execute real-to-display function on all CANDIDATES of SOURCE." + (helm-aif (assoc-default 'real-to-display source) + (setq candidates (helm-funcall-with-source + source 'mapcar + (lambda (cand_) + (if (consp cand_) + ;; override DISPLAY from candidate-transformer + (cons (funcall it (cdr cand_)) (cdr cand_)) + (cons (funcall it cand_) cand_))) + candidates)) + candidates)) + +(defun helm-transform-candidates (candidates source &optional process-p) + "Transform CANDIDATES of SOURCE according to candidate transformers. +When PROCESS-P is non-nil execute the `filtered-candidate-transformer' functions +otherwise only the `candidate-transformer' functions are processed. +When attribute `real-to-display' is present, execute its function on all maybe +filtered CANDIDATES." + (helm-process-real-to-display + (helm-process-filtered-candidate-transformer-maybe + (helm-process-candidate-transformer + (helm--initialize-one-by-one-candidates candidates source) source) + source process-p) + source)) + + +;; Core: narrowing candidates +(defun helm-candidate-number-limit (source) + "Apply candidate-number-limit attribute value. +This overhide variable `helm-candidate-number-limit'. + +e.g: +If \(candidate-number-limit\) is in SOURCE, show all candidates in SOURCE. +If \(candidate-number-limit . 123\) is in SOURCE limit candidate to 123." + (helm-aif (assq 'candidate-number-limit source) + (or (cdr it) 99999999) + (or helm-candidate-number-limit 99999999))) + +(defun helm-candidate-get-display (candidate) + "Get searched display part from CANDIDATE. +CANDIDATE is a string, a symbol, or \(DISPLAY . REAL\) cons cell." + (format "%s" (or (car-safe candidate) candidate))) + +(defun helm-process-pattern-transformer (pattern source) + "Execute pattern-transformer attribute PATTERN function in SOURCE." + (helm-aif (assoc-default 'pattern-transformer source) + (helm-composed-funcall-with-source source it pattern) + pattern)) + +(defun helm-default-match-function (candidate) + "Check if `helm-pattern' match CANDIDATE. +Default function to match candidates according to `helm-pattern'." + (string-match helm-pattern candidate)) + +(defun helm-match-functions (source) + (let ((matchfns (or (assoc-default 'match source) + (assoc-default 'match-strict source) + #'helm-default-match-function))) + (if (listp matchfns) matchfns (list matchfns)))) + +(defmacro helm--accumulate-candidates (candidate newmatches + hash item-count limit source) + "Add CAND into NEWMATCHES and use HASH to uniq NEWMATCHES. +Argument ITEM-COUNT count the matches. +if ITEM-COUNT reaches LIMIT, exit from inner loop." + `(unless (gethash ,candidate ,hash) + (unless (assq 'allow-dups ,source) + (puthash ,candidate t ,hash)) + (helm--maybe-process-filter-one-by-one-candidate ,candidate source) + (push ,candidate ,newmatches) + (cl-incf ,item-count) + (when (= ,item-count ,limit) (cl-return)))) + +(defun helm-take-first-elements (seq n) + "Return the N first element of SEQ if SEQ is longer than N. +It is used to narrow down list of candidates to `helm-candidate-number-limit'." + (if (> (length seq) n) (cl-subseq seq 0 n) seq)) + +(cl-defun helm-set-case-fold-search (&optional (pattern helm-pattern)) + "Used to set the value of `case-fold-search' in helm. +Return t or nil depending of value of `helm-case-fold-search' +and `helm-pattern'." + (let ((helm-case-fold-search + (helm-aif (assq 'case-fold-search (helm-get-current-source)) + (cdr it) + helm-case-fold-search)) + ;; Only parse basename for filenames + ;; to avoid setting case sensitivity + ;; when expanded directories contains upcase + ;; characters. + (bn-or-pattern (if (string-match "[~/]*" pattern) + ;; `helm-basename' is not available yet. + (file-name-nondirectory + (directory-file-name pattern)) + pattern))) + (helm-set-case-fold-search-1 bn-or-pattern))) + +(defun helm-set-case-fold-search-1 (pattern) + (cl-case helm-case-fold-search + (smart (let ((case-fold-search nil)) + (if (string-match "[[:upper:]]" pattern) nil t))) + (t helm-case-fold-search))) + +(defun helm-match-from-candidates (cands matchfns limit source) + (let (matches) + (condition-case err + (let ((item-count 0) + (case-fold-search (helm-set-case-fold-search))) + (clrhash helm-match-hash) + (cl-dolist (match matchfns) + (let (newmatches) + (cl-dolist (candidate cands) + (unless (gethash candidate helm-match-hash) + (when (funcall match + (helm-candidate-get-display candidate)) + (helm--accumulate-candidates + candidate newmatches + helm-match-hash item-count limit source)))) + ;; filter-one-by-one may return nil candidates, so delq them if some. + (setq matches (nconc matches (nreverse (delq nil newmatches))))))) + (error (unless (eq (car err) 'invalid-regexp) ; Always ignore regexps errors. + (helm-log-error "helm-match-from-candidates in source `%s': %s %s" + (assoc-default 'name source) (car err) (cdr err))) + (setq matches nil))) + matches)) + +(defun helm-compute-matches (source) + "Start computing candidates in SOURCE." + (save-current-buffer + (let ((matchfns (helm-match-functions source)) + (helm-source-name (assoc-default 'name source)) + (helm-current-source source) + (limit (helm-candidate-number-limit source)) + (helm-pattern (helm-process-pattern-transformer + helm-pattern source))) + ;; If source have a `filtered-candidate-transformer' attr + ;; Filter candidates with this func, otherwise just compute + ;; candidates. + (helm-process-filtered-candidate-transformer + (if (or (equal helm-pattern "") + (equal matchfns '(identity))) + ;; Compute all candidates up to LIMIT. + (helm-take-first-elements + (helm-get-cached-candidates source) limit) + ;; Compute candidates according to pattern with their match fns. + (helm-match-from-candidates + (helm-get-cached-candidates source) matchfns limit source)) + source)))) + +(defun helm-render-source (source matches) + "Display MATCHES from SOURCE according to its settings." + (helm-log "Source name = %S" (assoc-default 'name source)) + (when matches + (helm-insert-header-from-source source) + (if (not (assq 'multiline source)) + (cl-loop for m in matches + for count from 1 + do (helm-insert-match m 'insert source count)) + (let ((start (point)) + (count 0) + separate) + (cl-dolist (match matches) + (cl-incf count) + (if separate + (helm-insert-candidate-separator) + (setq separate t)) + (helm-insert-match match 'insert source count)) + (put-text-property start (point) 'helm-multiline t))))) + +(defmacro helm--maybe-use-while-no-input (&rest body) + "Wrap BODY in `helm-while-no-input' unless initializing a remote connection." + `(progn + (if (and (file-remote-p helm-pattern) + (not (file-remote-p helm-pattern nil t))) + ;; Tramp will ask for passwd, don't use `helm-while-no-input'. + ,@body + (helm-log "Using here `helm-while-no-input'") + (helm-while-no-input ,@body)))) + +(defun helm--compute-sources (src-list) + (cl-loop with matches = (helm--maybe-use-while-no-input + (cl-loop for src in src-list + collect (helm-compute-matches src))) + when (eq matches t) do (setq matches nil) + for src in src-list + for mtc in matches + do (helm-render-source src mtc))) + +(cl-defun helm-process-delayed-sources (delayed-sources &optional preselect source) + "Process helm DELAYED-SOURCES. +Move selection to string or regexp PRESELECT if non--nil. +This function is called in `helm-process-delayed-sources-timer' +when emacs is idle for `helm-idle-delay'." + (with-helm-quittable + (helm-log "Delayed sources = %S" + (mapcar (lambda (s) + (assoc-default 'name s)) + delayed-sources)) + (with-current-buffer (helm-buffer-get) + (save-excursion + (goto-char (point-max)) + (helm--compute-sources delayed-sources) + (when (and (not (helm-empty-buffer-p)) + ;; No selection yet. + (= (overlay-start helm-selection-overlay) + (overlay-end helm-selection-overlay))) + (helm-update-move-first-line 'without-hook))) + (save-excursion + (goto-char (point-min)) + (helm-log-run-hook 'helm-update-hook)) + (setq helm-force-updating-p nil) + (unless (assoc 'candidates-process source) + (helm-display-mode-line (helm-get-current-source)) + (helm-log-run-hook 'helm-after-update-hook)) + (when preselect (helm-preselect preselect source))))) + + +;;; Core: helm-update +;; +(defun helm-update (&optional preselect source) + "Update candidates list in `helm-buffer' according to `helm-pattern'. +Argument PRESELECT is a string or regexp used to move selection to a particular +place once updating is done. It should be used on single source because search +is done on whole `helm-buffer' and not on current source." + (helm-log "Start updating") + (helm-kill-async-processes) + ;; When persistent action have been called + ;; we have two windows even with `helm-full-frame'. + ;; So go back to one window when updating if `helm-full-frame' + ;; is non--nil. + (with-helm-window + (when helm-onewindow-p (delete-other-windows))) + (with-current-buffer (helm-buffer-get) + (set (make-local-variable 'helm-input-local) helm-pattern) + (let (normal-sources + delayed-sources) + (unwind-protect + (progn + ;; Iterate over all the sources + (cl-loop for source in (cl-remove-if-not + 'helm-update-source-p (helm-get-sources)) + if (helm-delayed-source-p source) + ;; Delayed sources just get collected for later + ;; processing + collect source into ds + else + ;; Collect the normal sources + collect source into ns + ;; Export the variables from cl-loop + finally (setq delayed-sources ds + normal-sources ns)) + (erase-buffer) + ;; Render all the sources into the helm buffer after + ;; calculating all candidates. + ;; Candidates must be computed AFTER erasing buffer + ;; even if it cause flickering; Doing so avoid + ;; unexpected results when executing actions. + (helm--compute-sources normal-sources)) + (helm-log "Delayed sources = %S" + (mapcar (lambda (s) (assoc-default 'name s)) + delayed-sources)) + (cond ((and preselect delayed-sources normal-sources) + ;; Preselection run here when there is + ;; normal AND delayed sources. + (helm-log "Update preselect candidate %s" preselect) + (helm-preselect preselect source)) + (delayed-sources ; Preselection and hooks will run later. + (helm-update-move-first-line 'without-hook)) + (t ; No delayed sources, run the hooks now. + (helm-update-move-first-line) + (unless (assoc 'candidates-process source) + (helm-display-mode-line (helm-get-current-source)) + (helm-log-run-hook 'helm-after-update-hook)) + (when preselect + (helm-log "Update preselect candidate %s" preselect) + (helm-preselect preselect source)) + (setq helm-force-updating-p nil))) + (when delayed-sources + ;; Allow giving a value to `delayed' attr from inside source. + ;; Retain the biggest value (the slower) found in DELAYED-SOURCES. + (let ((helm-idle-delay (cl-loop with delay = helm-idle-delay + for s in delayed-sources + for d = (assoc-default 'delayed s) + when d do (setq delay (max delay d)) + finally return delay))) + (run-with-idle-timer + ;; Be sure helm-idle-delay is > + ;; to helm-input-idle-delay + ;; otherwise use value of helm-input-idle-delay + ;; or 0.01 if == to 0. + (max helm-idle-delay helm-input-idle-delay 0.001) nil + 'helm-process-delayed-sources delayed-sources preselect source))) + (helm-log "end update"))))) + +;; Update keymap after updating. +;; Putting this in a hook allow users to disable it. +(add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) + +(defun helm-update-source-p (source) + "Whether SOURCE need updating or not." + (let ((len (string-width + (if (or (not (assoc 'no-matchplugin source)) + helm-match-plugin-mode) + ;; Don't count spaces entered when using + ;; match-plugin. + (replace-regexp-in-string " " "" helm-pattern) + helm-pattern)))) + (and (or (not helm-source-filter) + (member (assoc-default 'name source) helm-source-filter)) + (>= len + (helm-aif (assoc 'requires-pattern source) (or (cdr it) 1) 0)) + ;; These incomplete regexps hang helm forever + ;; so defer update. Maybe replace spaces quoted when using + ;; match-plugin-mode. + (not (member (replace-regexp-in-string "\\s\\ " " " helm-pattern) + helm-update-blacklist-regexps))))) + +(defun helm-delayed-source-p (source) + "Wheter SOURCE is a delayed source or not." + (or (assoc 'delayed source) + (and helm-quick-update + (< (window-height (get-buffer-window (current-buffer))) + (line-number-at-pos (point-max)))))) + +(defun helm-update-move-first-line (&optional without-hook) + "Goto first line of `helm-buffer'." + (goto-char (point-min)) + (unless without-hook + (save-excursion (helm-log-run-hook 'helm-update-hook))) + (helm-next-line)) + +(defun helm-force-update (&optional preselect) + "Force recalculation and update of candidates. +The difference with `helm-update' is this function is reevaling +the `init' and `update' attributes functions when present +before updating candidates according to pattern i.e calling `helm-update'. +Selection is preserved to current candidate or moved to PRESELECT +if specified." + (interactive) + (let ((source (helm-get-current-source)) + (selection (helm-get-selection nil t)) + ;; `helm-goto-source' need to have all sources displayed + ;; So disable `helm-quick-update'. + helm-quick-update) + (setq helm-force-updating-p t) + (when source + (mapc 'helm-force-update--reinit + (helm-get-sources))) + (helm-update (or preselect selection) source) + (with-helm-window (recenter)))) + +(defun helm-force-update--reinit (source) + "Reinit SOURCE by calling his update and/or init functions." + (helm-aif (helm-funcall-with-source + source 'helm-candidate-buffer) + (kill-buffer it)) + (cl-dolist (attr '(update init)) + (helm-aif (assoc-default attr source) + (helm-funcall-with-source source it))) + (helm-remove-candidate-cache source)) + +(defun helm-remove-candidate-cache (source) + "Remove SOURCE from `helm-candidate-cache'." + (remhash (assoc-default 'name source) helm-candidate-cache)) + +(defun helm-insert-match (match insert-function source &optional num) + "Insert MATCH into `helm-buffer' with INSERT-FUNCTION for SOURCE. +If MATCH is a list then insert the string intended to appear on the display +and store the real value in a text property." + (let ((start (point-at-bol (point))) + (dispvalue (or (car-safe match) match)) + (realvalue (cdr-safe match))) + (setq dispvalue + (cond ((symbolp dispvalue) (symbol-name dispvalue)) + ((numberp dispvalue) (number-to-string dispvalue)) + ((string= "" dispvalue)) + (t dispvalue))) + (when (stringp dispvalue) + (funcall insert-function dispvalue) + ;; Some sources with candidates-in-buffer have already added + ;; 'helm-realvalue property when creating candidate buffer. + (unless (get-text-property start 'helm-realvalue) + (and realvalue + (put-text-property start (point-at-eol) + 'helm-realvalue realvalue))) + (when num + (put-text-property start (point-at-eol) 'helm-cand-num num)) + (when helm-source-in-each-line-flag + (put-text-property start (point-at-eol) 'helm-source source)) + (funcall insert-function "\n")))) + +(defun helm-insert-header-from-source (source) + "Insert SOURCE name in `helm-buffer' header. +Maybe insert by overlay additional info after source name if SOURCE have +header-name attribute." + (let ((name (assoc-default 'name source))) + (helm-insert-header + name + (helm-aif (assoc-default 'header-name source) + (helm-funcall-with-source source it name))))) + +(defun helm-insert-header (name &optional display-string) + "Insert header of source NAME into the helm buffer. +If DISPLAY-STRING is non--nil and a string, display this additional info +after the source name by overlay." + (unless (bobp) + (let ((start (point))) + (insert "\n") + (put-text-property start (point) 'helm-header-separator t))) + (let ((start (point))) + (insert name) + (put-text-property (point-at-bol) + (point-at-eol) 'helm-header t) + (when display-string + (overlay-put (make-overlay (point-at-bol) (point-at-eol)) + 'display display-string)) + (insert "\n") + (put-text-property start (point) 'face 'helm-source-header))) + +(defun helm-insert-candidate-separator () + "Insert separator of candidates into the helm buffer." + (insert (propertize helm-candidate-separator 'face 'helm-separator)) + (put-text-property (point-at-bol) + (point-at-eol) 'helm-candidate-separator t) + (insert "\n")) + + +;;; Core: async process +;; +(defun helm-output-filter (process output-string) + "The `process-filter' function for helm async sources." + (helm-output-filter-1 (assoc process helm-async-processes) output-string)) + +(defun helm-output-filter-1 (process-assoc output-string) + (helm-log "output-string = %S" output-string) + (with-current-buffer helm-buffer + (let ((source (cdr process-assoc))) + (save-excursion + (helm-aif (assoc-default 'insertion-marker source) + (goto-char it) + (goto-char (point-max)) + (helm-insert-header-from-source source) + (setcdr process-assoc + (append source `((insertion-marker . ,(point-marker)))))) + (helm-output-filter--process-source + (car process-assoc) output-string source + (helm-candidate-number-limit source)))) + (helm-output-filter--post-process))) + +(defun helm-output-filter--process-source (process output-string source limit) + (cl-dolist (candidate (helm-transform-candidates + (helm-output-filter--collect-candidates + (split-string output-string "\n") + (assoc 'incomplete-line source) + source) + source t)) + (when candidate ; filter-one-by-one may return nil candidates. + (if (assq 'multiline source) + (let ((start (point))) + (helm-insert-candidate-separator) + (helm-insert-match candidate 'insert-before-markers source + (1+ (cdr (assoc 'item-count source)))) + (put-text-property start (point) 'helm-multiline t)) + (helm-insert-match candidate 'insert-before-markers source + (1+ (cdr (assoc 'item-count source))))) + (cl-incf (cdr (assoc 'item-count source))) + (when (>= (assoc-default 'item-count source) limit) + (helm-kill-async-process process) + (cl-return))))) + +(defun helm-output-filter--collect-candidates (lines incomplete-line-info source) + "Collect LINES maybe completing the truncated first and last lines." + ;; The output of process may come in chunks of any size, + ;; so the last line of LINES come truncated, this truncated line is + ;; stored in INCOMPLETE-LINE-INFO and will be concated with the first + ;; incomplete line of next chunk arriving. + ;; INCOMPLETE-LINE-INFO is an attribute of source which is created + ;; with an empty string when the source is computed => (incomplete-line . "") + (helm-log "incomplete-line-info = %S" (cdr incomplete-line-info)) + (butlast + (cl-loop for line in lines + ;; On start `incomplete-line-info' value is empty string. + for newline = (helm-aif (cdr incomplete-line-info) + (prog1 + (concat it line) + (setcdr incomplete-line-info nil)) + line) + do (helm--maybe-process-filter-one-by-one-candidate newline source) + collect newline + ;; Store last incomplete line (last chunk truncated) + ;; until new output arrives. + finally do (setcdr incomplete-line-info line)))) + +(defun helm-output-filter--post-process () + (let ((src (helm-get-current-source))) + (helm-log-run-hook 'helm-update-hook) + (helm-aif (get-buffer-window helm-buffer 'visible) + (with-selected-window it + (helm-skip-noncandidate-line 'next) + (helm-mark-current-line) + (helm-display-mode-line src) + (helm-log-run-hook 'helm-after-update-hook))))) + +(defun helm-process-deferred-sentinel-hook (process event file) + "Defer remote processes in sentinels. +Meant to be called at beginning of a sentinel process function." + (when (and (string= event "finished\n") + (or (file-remote-p file) + ;; `helm-suspend-update-flag' + ;; is non--nil here only during a + ;; running process, this will never be called + ;; when user set it explicitely with `C-!'. + helm-suspend-update-flag)) + (setq helm-suspend-update-flag t) + ;; Kill the process but don't delete entry in + ;; `helm-async-processes'. + (helm-kill-async-process process) + ;; When tramp tries to open the same connection twice in a + ;; short time frame (less than 5s) it throw 'suppress which + ;; call the real-handler on the main "Emacs", so we wait + ;; 5s before updating to avoid this [1], but allowing user to + ;; enter input during this delay. + ;; [1] On last Emacs versions, this is fixed and tramp return + ;; nil in this situation. + ;; Note: It is difficult to have a value < to 5 for + ;; `tramp-connection-min-time-diff', because the process die + ;; when calling too quickly same process. + (run-at-time (or (and (boundp 'tramp-connection-min-time-diff) + tramp-connection-min-time-diff) + 5) + nil #'(lambda () + (when helm-alive-p ; Don't run timer fn after quit. + (setq helm-suspend-update-flag nil) + (helm-check-minibuffer-input)))))) + +(defun helm-kill-async-processes () + "Kill all asynchronous processes registered in `helm-async-processes'." + (while helm-async-processes + (helm-kill-async-process (caar helm-async-processes)) + (setq helm-async-processes (cdr helm-async-processes)))) + +(defun helm-kill-async-process (process) + "Stop output from `helm-output-filter' and kill associated PROCESS." + (set-process-filter process nil) + (delete-process process)) + + +;;; Core: action +;; +(defun helm-execute-selection-action () + "Execute current action and kill the action buffer if present." + (helm-log-run-hook 'helm-before-action-hook) + ;; Position can be different when `helm-current-buffer' + ;; is splitted, so jump to this position before executing action. + (helm-current-position 'restore) + (unwind-protect + (helm-execute-selection-action-1) + (helm-aif (get-buffer helm-action-buffer) + (kill-buffer it)) + (helm-log-run-hook 'helm-after-action-hook))) + +(defun helm-execute-selection-action-1 (&optional + selection action + preserve-saved-action) + "Execute ACTION on current SELECTION. +If PRESERVE-SAVED-ACTION is non--nil save action." + (helm-log "executing action") + (setq action (helm-get-default-action + (or action + helm-saved-action + (if (get-buffer helm-action-buffer) + (helm-get-selection helm-action-buffer) + (helm-get-actions-from-current-source))))) + (let ((source (or helm-saved-current-source + (helm-get-current-source))) + non-essential) + (setq selection (or selection + (helm-get-selection) + (and (assoc 'accept-empty source) ""))) + (unless preserve-saved-action (setq helm-saved-action nil)) + (when (and selection action) + (helm-funcall-with-source + source action + (helm-coerce-selection selection source))))) + +(defun helm-coerce-selection (selection source) + "Apply coerce attribute function to SELECTION in SOURCE. +Coerce source with coerce function." + (helm-aif (assoc-default 'coerce source) + (helm-funcall-with-source source it selection) + selection)) + +(defun helm-get-default-action (action) + "Get the first ACTION value of action list in source." + (if (and (listp action) (not (functionp action))) + (cdar action) + action)) + +(defun helm-select-action () + "Select an action for the currently selected candidate. +If action buffer is selected, back to the helm buffer." + (interactive) + (helm-log-run-hook 'helm-select-action-hook) + (setq helm-saved-selection (helm-get-selection)) + (with-selected-frame (with-helm-window (selected-frame)) + (cond ((get-buffer-window helm-action-buffer 'visible) + (set-window-buffer (get-buffer-window helm-action-buffer) + helm-buffer) + (kill-buffer helm-action-buffer) + (helm-display-mode-line (helm-get-current-source)) + (helm-set-pattern helm-input 'noupdate)) + (helm-saved-selection + (setq helm-saved-current-source (helm-get-current-source)) + (let ((actions (helm-get-actions-from-current-source))) + (if (functionp actions) + (message "Sole action: %s" actions) + (helm-show-action-buffer actions) + (helm-delete-minibuffer-contents) + ;; Make `helm-pattern' differs from the previous value. + (setq helm-pattern 'dummy) + (helm-check-minibuffer-input)))) + (t (message "No Actions available"))))) + +(defun helm-show-action-buffer (actions) + (with-current-buffer (get-buffer-create helm-action-buffer) + (erase-buffer) + (buffer-disable-undo) + (set-window-buffer (get-buffer-window helm-buffer) helm-action-buffer) + (set (make-local-variable 'helm-sources) + `(((name . "Actions") + (volatile) + (nomark) + (candidates . ,actions) + (mode-line . ("Action(s)" "TAB:BackToCands RET/f1/f2/fn:NthAct")) + (candidate-transformer + . (lambda (candidates) + (cl-loop for (i . j) in candidates + for count from 1 + collect + (cons (concat (cond ((> count 12) + " ") + ((< count 10) + (format "[f%s] " count)) + (t (format "[f%s] " count))) + (propertize i 'face 'helm-action)) j)))) + (candidate-number-limit)))) + (set (make-local-variable 'helm-source-filter) nil) + (set (make-local-variable 'helm-selection-overlay) nil) + (helm-initialize-overlays helm-action-buffer))) + + +;; Core: selection + +(defun helm-display-source-at-screen-top-maybe (unit) + "Display source at top of screen when UNIT value is 'source. +With any other value of UNIT return nil." + (when (and helm-display-source-at-screen-top (eq unit 'source)) + (set-window-start (selected-window) + (save-excursion (forward-line -1) (point))))) + +(defun helm-skip-noncandidate-line (direction) + "Skip source header or candidates separator when going in DIRECTION. +Possible value of DIRECTION are 'next or 'previous. +Same as `helm-skip-header-and-separator-line' but ensure +point is moved to the right place when at bop or eob." + (helm-skip-header-and-separator-line direction) + (and (bobp) (forward-line 1)) ; Skip first header. + (and (eobp) (forward-line -1))) ; Avoid last empty line. + +(defun helm-skip-header-and-separator-line (direction) + "Skip source header or candidate separator when going to next/previous line. +Possible value of DIRECTION are 'next or 'previous." + (let ((fn (cl-ecase direction + (next 'eobp) + (previous 'bobp)))) + (while (and (not (funcall fn)) + (or (helm-pos-header-line-p) + (helm-pos-candidate-separator-p))) + (forward-line (if (and (eq direction 'previous) + (not (eq (point-at-bol) (point-min)))) + -1 1))))) + +(defun helm-display-mode-line (source &optional force) + "Setup mode-line and header-line for `helm-buffer'." + (set (make-local-variable 'helm-mode-line-string) + (helm-interpret-value (or (and (listp source) ; Check if source is empty. + (assoc-default 'mode-line source)) + (default-value 'helm-mode-line-string)) + source)) + (let ((follow (and (eq (cdr (assq 'follow source)) 1) "(HF) "))) + ;; Setup mode-line. + (if helm-mode-line-string + (setq mode-line-format + `(" " mode-line-buffer-identification " " + (:eval (format "L%d" (helm-candidate-number-at-point))) + " " ,follow + (:eval (when ,helm--mode-line-display-prefarg + (let ((arg (prefix-numeric-value + (or prefix-arg current-prefix-arg)))) + (unless (= arg 1) + (propertize (format "[prefarg:%s] " arg) + 'face 'helm-prefarg))))) + (:eval (helm-show-candidate-number + (car-safe helm-mode-line-string))) + " " helm--mode-line-string-real " -%-") + helm--mode-line-string-real + (substitute-command-keys (if (listp helm-mode-line-string) + (cadr helm-mode-line-string) + helm-mode-line-string))) + (setq mode-line-format (default-value 'mode-line-format))) + ;; Setup header-line. + (let* ((hlstr (helm-interpret-value + (and (listp source) + (assoc-default 'header-line source)) + source)) + (hlend (make-string (max 0 (- (window-width) (length hlstr))) ? ))) + (setq header-line-format + (propertize (concat " " hlstr hlend) 'face 'helm-header)))) + (when force (force-mode-line-update))) + +(defun helm-show-candidate-number (&optional name) + "Used to display candidate number in mode-line. +You can specify NAME of candidates e.g \"Buffers\" otherwise +it is \"Candidate\(s\)\" by default." + (when helm-alive-p + (unless (helm-empty-source-p) + (propertize + (format "[%s %s]" + (helm-get-candidate-number 'in-current-source) + (or name "Candidate(s)")) + 'face 'helm-candidate-number)))) + +(cl-defun helm-move-selection-common (&key where direction) + "Move the selection marker to a new position. +Position is determined by WHERE and DIRECTION. +Key arg WHERE can be one of: + - line + - page + - edge + - source +Key arg DIRECTION can be one of: + - previous + - next + - A source or a source name when used with :WHERE 'source." + (let ((move-func (cl-case where + (line (cl-ecase direction + (previous 'helm-move--previous-line-fn) + (next 'helm-move--next-line-fn))) + (page (cl-ecase direction + (previous 'helm-move--previous-page-fn) + (next 'helm-move--next-page-fn))) + (edge (cl-ecase direction + (previous 'helm-move--beginning-of-buffer-fn) + (next 'helm-move--end-of-buffer-fn))) + (source (cl-case direction + (previous 'helm-move--previous-source-fn) + (next 'helm-move--next-source-fn) + (t (lambda () ; A source is passed as DIRECTION arg. + (helm-move--goto-source-fn direction)))))))) + (unless (or (helm-empty-buffer-p (helm-buffer-get)) + (not (helm-window))) + (with-helm-window + (helm-log-run-hook 'helm-move-selection-before-hook) + (funcall move-func) + (and (memq direction '(next previous)) + (helm-skip-noncandidate-line direction)) + (when (helm-pos-multiline-p) + (helm-move--beginning-of-multiline-candidate)) + (helm-display-source-at-screen-top-maybe where) + (when (helm-get-previous-header-pos) + (helm-mark-current-line)) + (helm-display-mode-line (helm-get-current-source)) + (helm-log-run-hook 'helm-move-selection-after-hook))))) + +(defun helm-move--beginning-of-multiline-candidate () + (let ((header-pos (helm-get-previous-header-pos)) + (separator-pos (helm-get-previous-candidate-separator-pos))) + (when header-pos + (goto-char (if (or (null separator-pos) + (< separator-pos header-pos)) + header-pos + separator-pos)) + (forward-line 1)))) + +(defun helm-move--previous-multi-line-fn () + (forward-line -1) + (unless (helm-pos-header-line-p) + (helm-skip-header-and-separator-line 'previous) + (helm-move--beginning-of-multiline-candidate))) + +(defun helm-move--previous-line-fn () + (if (not (helm-pos-multiline-p)) + (forward-line -1) + (helm-move--previous-multi-line-fn)) + (when (and helm-move-to-line-cycle-in-source + (helm-pos-header-line-p)) + (forward-line 1) + (helm-move--end-of-source) + ;; We are at end of helm-buffer + ;; check if last candidate is a multiline candidate + ;; and jump to it + (when (and (eobp) + (save-excursion (forward-line -1) (helm-pos-multiline-p))) + (helm-move--previous-multi-line-fn)))) + +(defun helm-move--next-multi-line-fn () + (let ((header-pos (helm-get-next-header-pos)) + (separator-pos (helm-get-next-candidate-separator-pos))) + (cond ((and separator-pos + (or (null header-pos) (< separator-pos header-pos))) + (goto-char separator-pos)) + (header-pos + (goto-char header-pos))))) + +(defun helm-move--next-line-fn () + (if (not (helm-pos-multiline-p)) + (forward-line 1) + (helm-move--next-multi-line-fn)) + (when (and helm-move-to-line-cycle-in-source + (or (save-excursion (and (helm-pos-multiline-p) + (goto-char (overlay-end + helm-selection-overlay)) + (helm-end-of-source-p t))) + (helm-end-of-source-p t))) + (helm-move--beginning-of-source))) + +(defun helm-move--previous-page-fn () + (condition-case nil + (scroll-down) + (beginning-of-buffer (goto-char (point-min))))) + +(defun helm-move--next-page-fn () + (condition-case nil + (scroll-up) + (end-of-buffer (goto-char (point-max))))) + +(defun helm-move--beginning-of-buffer-fn () + (goto-char (point-min))) + +(defun helm-move--end-of-buffer-fn () + (goto-char (point-max))) + +(defun helm-move--end-of-source () + (goto-char (or (helm-get-next-header-pos) (point-max))) + (when (helm-pos-header-line-p) (forward-line -2))) + +(defun helm-move--beginning-of-source () + (goto-char (helm-get-previous-header-pos)) + (forward-line 1)) + +(defun helm-move--previous-source-fn () + (forward-line -1) + (if (bobp) + (goto-char (point-max)) + (helm-skip-header-and-separator-line 'previous)) + (goto-char (helm-get-previous-header-pos)) + (forward-line 1)) + +(defun helm-move--next-source-fn () + (goto-char (or (helm-get-next-header-pos) (point-min)))) + +(defun helm-move--goto-source-fn (source-or-name) + (goto-char (point-min)) + (let ((name (if (stringp source-or-name) source-or-name + (assoc-default 'name source-or-name)))) + (condition-case err + (while (not (string= name (helm-current-line-contents))) + (goto-char (helm-get-next-header-pos))) + (error (helm-log "%S" err))))) + +(defun helm-candidate-number-at-point () + (with-helm-buffer + (or (get-text-property (point) 'helm-cand-num) 1))) + +(defun helm--next-or-previous-line (direction &optional arg) + ;; Be sure to not use this in non--interactives calls. + (let ((helm-move-to-line-cycle-in-source + (and helm-move-to-line-cycle-in-source arg))) + (if (and arg (> arg 1)) + (cl-loop with pos = (helm-candidate-number-at-point) + with cand-num = (helm-get-candidate-number t) + with iter = (min arg (- cand-num pos)) + for count from 1 + while (<= count iter) + do + (helm-move-selection-common :where 'line :direction direction)) + (helm-move-selection-common :where 'line :direction direction)))) + +(defun helm-previous-line (&optional arg) + "Move selection to the ARG previous line(s). +Same behavior than `helm-next-line' when called with a numeric prefix arg." + (interactive "p") + (helm--next-or-previous-line 'previous arg)) + +(defun helm-next-line (&optional arg) + "Move selection to the next ARG line(s). +When a numeric prefix arg is given and this numeric arg +is > to the number of candidates, move to last candidate of +current source (i.e don't move to next source if some)." + (interactive "p") + (helm--next-or-previous-line 'next arg)) + +(defun helm-previous-page () + "Move selection back with a pageful." + (interactive) + (helm-move-selection-common :where 'page :direction 'previous)) + +(defun helm-next-page () + "Move selection forward with a pageful." + (interactive) + (helm-move-selection-common :where 'page :direction 'next)) + +(defun helm-beginning-of-buffer () + "Move selection at the top." + (interactive) + (helm-move-selection-common :where 'edge :direction 'previous)) + +(defun helm-end-of-buffer () + "Move selection at the bottom." + (interactive) + (helm-move-selection-common :where 'edge :direction 'next)) + +(defun helm-previous-source () + "Move selection to the previous source." + (interactive) + (helm-move-selection-common :where 'source :direction 'previous)) + +(defun helm-next-source () + "Move selection to the next source." + (interactive) + (helm-move-selection-common :where 'source :direction 'next)) + +(defun helm-goto-source (source-or-name) + "Move the selection to the source SOURCE-OR-NAME." + (helm-move-selection-common :where 'source :direction source-or-name)) + +(defun helm--follow-action (arg) + (let ((helm--temp-follow-flag t)) + (when (or (eq last-command 'helm-follow-action-forward) + (eq last-command 'helm-follow-action-backward) + (eq last-command 'helm-execute-persistent-action)) + (if (> arg 0) + (helm-next-line) + (helm-previous-line))) + (helm-execute-persistent-action))) + +(defun helm-follow-action-forward () + "Go to next line and execute persistent action." + (interactive) + (helm--follow-action 1)) + +(defun helm-follow-action-backward () + "Go to previous line and execute persistent action." + (interactive) + (helm--follow-action -1)) + +(defun helm-mark-current-line (&optional resumep) + "Move `helm-selection-overlay' to current line. +Note that this is not related with visibles marks, which are used +to mark candidates." + (with-helm-window + (when resumep + (goto-char helm-selection-point)) + (move-overlay + helm-selection-overlay (point-at-bol) + (if (helm-pos-multiline-p) + (let ((header-pos (helm-get-next-header-pos)) + (separator-pos (helm-get-next-candidate-separator-pos))) + (or (and (null header-pos) separator-pos) + (and header-pos separator-pos + (< separator-pos header-pos) + separator-pos) + header-pos + (point-max))) + (1+ (point-at-eol)))) + (setq helm-selection-point (overlay-start helm-selection-overlay))) + (helm-follow-execute-persistent-action-maybe)) + +(defun helm-confirm-and-exit-minibuffer () + "Maybe ask for confirmation when exiting helm. +It is similar to `minibuffer-complete-and-exit' adapted to helm. +If `minibuffer-completion-confirm' value is 'confirm, +send in minibuffer confirm message and exit on next hit. +If `minibuffer-completion-confirm' value is t, +don't exit and send message 'no match'." + (interactive) + (if (and (helm--updating-p) + (null helm--reading-passwd-or-string)) + (progn (message "[Display not ready]") + (sit-for 0.5) (message nil)) + (let* ((empty-buffer-p (with-current-buffer helm-buffer + (eq (point-min) (point-max)))) + (unknown (and (not empty-buffer-p) + (string= (get-text-property + 0 'display (helm-get-selection nil 'withprop)) + "[?]")))) + (cond ((and (or empty-buffer-p unknown) + (eq minibuffer-completion-confirm 'confirm)) + (setq helm-minibuffer-confirm-state + 'confirm) + (setq minibuffer-completion-confirm nil) + (minibuffer-message " [confirm]")) + ((and (or empty-buffer-p unknown) + (eq minibuffer-completion-confirm t)) + (minibuffer-message " [No match]")) + (t + (setq helm-minibuffer-confirm-state nil) + (helm-exit-minibuffer)))))) +(add-hook 'helm-after-update-hook 'helm-confirm-and-exit-hook) + +(defun helm-confirm-and-exit-hook () + "Restore `minibuffer-completion-confirm' when helm update." + (unless (or (eq minibuffer-completion-confirm t) + (not helm-minibuffer-confirm-state)) + (setq minibuffer-completion-confirm + helm-minibuffer-confirm-state))) + +(defun helm-read-string (prompt &optional initial-input history + default-value inherit-input-method) + "Same as `read-string' but for reading string from a helm session." + (let ((helm--reading-passwd-or-string t)) + (read-string + prompt initial-input history default-value inherit-input-method))) + +(defun helm--updating-p () + ;; helm timer is between two cycles. + ;; IOW `helm-check-minibuffer-input' haven't yet compared input + ;; and `helm-pattern'. + (or (not (equal (minibuffer-contents) helm-pattern)) + ;; `helm-check-minibuffer-input' have launched `helm-update'. + helm--in-update)) + +(defun helm-maybe-exit-minibuffer () + (interactive) + (if (and (helm--updating-p) + (null helm--reading-passwd-or-string)) + (progn (message "[Display not ready]") + (sit-for 0.5) (message nil)) + (helm-exit-minibuffer))) + +(defun helm-exit-minibuffer () + "Select the current candidate by exiting the minibuffer." + (unless helm-current-prefix-arg + (setq helm-current-prefix-arg current-prefix-arg)) + (setq helm-exit-status 0) + (helm-log-run-hook 'helm-exit-minibuffer-hook) + (exit-minibuffer)) + +(defun helm-keyboard-quit () + "Quit minibuffer in helm. +If action buffer is displayed, kill it." + (interactive) + (when (get-buffer-window helm-action-buffer 'visible) + (kill-buffer helm-action-buffer)) + (setq helm-exit-status 1) + (abort-recursive-edit)) + +(defun helm-get-next-header-pos () + "Return the position of the next header from point." + (next-single-property-change (point) 'helm-header)) + +(defun helm-get-previous-header-pos () + "Return the position of the previous header from point." + (previous-single-property-change (point) 'helm-header)) + +(defun helm-pos-multiline-p () + "Return non-nil if the current position is in the multiline source region." + (get-text-property (point) 'helm-multiline)) + +(defun helm-get-next-candidate-separator-pos () + "Return the position of the next candidate separator from point." + (let ((hp (helm-get-next-header-pos))) + (helm-aif (next-single-property-change (point) 'helm-candidate-separator) + (or + ;; Be sure we don't catch + ;; the separator of next source. + (and hp (< it hp) it) + ;; The separator found is in next source + ;; we are at last cand, so use the header pos. + (and hp (< hp it) hp) + ;; A single source, just try next separator. + it)))) + +(defun helm-get-previous-candidate-separator-pos () + "Return the position of the previous candidate separator from point." + (previous-single-property-change (point) 'helm-candidate-separator)) + +(defun helm-pos-header-line-p () + "Return t if the current line is a header line." + (or (get-text-property (point-at-bol) 'helm-header) + (get-text-property (point-at-bol) 'helm-header-separator))) + +(defun helm-pos-candidate-separator-p () + "Return t if the current line is a candidate separator." + (get-text-property (point-at-bol) 'helm-candidate-separator)) + + +;;; Debugging +;; +;; +(defun helm-debug-output () + "Show all helm-related variables at this time." + (interactive) + (helm-help-internal " *Helm Debug*" 'helm-debug-output-function)) + +(defun helm-debug-output-function (&optional vars) + (message "Calculating all helm-related values...") + (insert "If you debug some variables or forms, set `helm-debug-variables' +to a list of forms.\n\n") + (cl-dolist (v (or vars + helm-debug-variables + (apropos-internal "^helm-" 'boundp))) + (insert "** " + (pp-to-string v) "\n" + (pp-to-string (with-current-buffer helm-buffer (eval v))) "\n")) + (message "Calculating all helm-related values...Done")) + + +;; Core: misc +(defun helm-kill-buffer-hook () + "Remove tick entry from `helm-tick-hash' when killing a buffer." + (cl-loop for key being the hash-keys in helm-tick-hash + if (string-match (format "^%s/" (regexp-quote (buffer-name))) key) + do (remhash key helm-tick-hash))) +(add-hook 'kill-buffer-hook 'helm-kill-buffer-hook) + +(defun helm-preselect (candidate-or-regexp &optional source) + "Move `helm-selection-overlay' to CANDIDATE-OR-REGEXP on startup." + (with-helm-window + (when candidate-or-regexp + (if helm-force-updating-p + (and source (helm-goto-source source)) + (goto-char (point-min)) + (forward-line 1)) + (let ((start (point))) + (or (re-search-forward candidate-or-regexp nil t) + (goto-char start)))) + (forward-line 0) ; Avoid scrolling right on long lines. + (when (helm-pos-multiline-p) + (helm-move--beginning-of-multiline-candidate)) + (helm-mark-current-line))) + +(defun helm-delete-current-selection () + "Delete the currently selected item." + (interactive) + (with-helm-window + (cond ((helm-pos-multiline-p) + (helm-aif (helm-get-next-candidate-separator-pos) + (delete-region (point-at-bol) + (1+ (progn (goto-char it) (point-at-eol)))) + ;; last candidate + (goto-char (helm-get-previous-candidate-separator-pos)) + (delete-region (point-at-bol) (point-max))) + (when (helm-end-of-source-p) + (goto-char (or (helm-get-previous-candidate-separator-pos) + (point-min))) + (forward-line 1))) + (t + (delete-region (point-at-bol) (1+ (point-at-eol))) + (when (helm-end-of-source-p t) + (let ((headp (save-excursion + (forward-line -1) + (not (helm-pos-header-line-p))))) + (and headp (forward-line -1)))))) + (unless (helm-end-of-source-p t) + (helm-mark-current-line)))) + +(defun helm-end-of-source-p (&optional at-point) + "Return non--nil if we are at eob or end of source." + (save-excursion + (if (and (helm-pos-multiline-p) (null at-point)) + (null (helm-get-next-candidate-separator-pos)) + (forward-line (if at-point 0 1)) + (or (eq (point-at-bol) (point-at-eol)) + (helm-pos-header-line-p) + (eobp))))) + +(defun helm-edit-current-selection-internal (func) + (with-helm-window + (forward-line 0) + (let ((realvalue (get-text-property (point) 'helm-realvalue)) + (multiline (get-text-property (point) 'helm-multiline))) + (funcall func) + (forward-line 0) + (and realvalue + (put-text-property (point) (point-at-eol) + 'helm-realvalue realvalue)) + (and multiline + (put-text-property (point) (point-at-eol) + 'helm-multiline multiline)) + (helm-mark-current-line)))) + +(defmacro helm-edit-current-selection (&rest forms) + "Evaluate FORMS at current selection in the helm buffer. +Used generally to modify current selection." + (declare (indent 0) (debug t)) + `(helm-edit-current-selection-internal + (lambda () ,@forms))) + +(defun helm-set-pattern (pattern &optional noupdate) + "Set minibuffer contents to PATTERN. +if optional NOUPDATE is non-nil, helm buffer is not changed." + (with-selected-window (or (active-minibuffer-window) (minibuffer-window)) + (delete-minibuffer-contents) + (insert pattern)) + (when noupdate + (setq helm-pattern pattern))) + +(defun helm-minibuffer-completion-contents () + "Return the user input in a minibuffer before point as a string. +That is what completion commands operate on." + (buffer-substring (field-beginning) (point))) + +(defun helm-delete-minibuffer-contents (&optional arg) + "Delete minibuffer contents. +When called with a prefix arg or when +`helm-delete-minibuffer-contents-from-point' is non--nil, +delete minibuffer contents from point instead of deleting all." + (interactive "P") + (require 'helm-utils) + (let* ((input (minibuffer-contents)) + (str (if (or arg helm-delete-minibuffer-contents-from-point) + (helm-minibuffer-completion-contents) ""))) + (helm-reset-yank-point) + (if (> (length input) 0) + ;; minibuffer is not empty, delete contents and update. + (helm-set-pattern str) + ;; minibuffer is already empty, force update. + (helm-force-update)))) + + +;;; Plugins +;; +;; Built-in plug-in: type +(defun helm-compile-source--type (source) + (helm-aif (assoc-default 'type source) + (append source (assoc-default it helm-type-attributes) nil) + source)) + +;; `define-helm-type-attribute' is public API. + +(defun helm-add-type-attribute (type definition) + (helm-aif (assq type helm-type-attributes) + (setq helm-type-attributes (delete it helm-type-attributes))) + (push (cons type definition) helm-type-attributes)) + +(defun helm-document-type-attribute (type doc) + (add-to-list 'helm-types type t) + (put type 'helm-typeattrdoc + (concat "- " (symbol-name type) "\n\n" doc "\n"))) + +;; Built-in plug-in: dummy +(defun helm-dummy-candidate (_candidate _source) + "Use `helm-pattern' as CANDIDATE in SOURCE." + ;; `source' is defined in filtered-candidate-transformer + (list helm-pattern)) + +(defun helm-compile-source--dummy (source) + (if (assoc 'dummy source) + (progn + (unless (helm-attr-defined + 'filtered-candidate-transformer source) + (helm-attrset 'filtered-candidate-transformer + 'helm-dummy-candidate source)) + (append source + '((candidates "dummy") + (accept-empty) + (match identity) + (volatile)))) + source)) + +;; Built-in plug-in: candidates-in-buffer +(defun helm-candidates-in-buffer (source) + "Get candidates from the candidates buffer according to `helm-pattern'. + +BUFFER is `helm-candidate-buffer' by default. Each +candidate must be placed in one line. This function is meant to +be used in candidates-in-buffer or candidates attribute of an +helm source. Especially fast for many (1000+) candidates. + +eg. + '((name . \"many files\") + (init . (lambda () (with-current-buffer (helm-candidate-buffer 'local) + (insert-many-filenames)))) + (search re-search-forward) ; optional + (candidates-in-buffer) + (type . file)) + ++===============================================================+ +| The new way of making and narrowing candidates: Using buffers | ++===============================================================+ + +By default, `helm' makes candidates by evaluating the +candidates function, then narrows them by `string-match' for each +candidate. + +But this way is very slow for many candidates. The new way is +storing all candidates in a buffer and narrowing them by +`re-search-forward'. Search function is customizable by search +attribute. The important point is that buffer processing is MUCH +FASTER than string list processing and is the Emacs way. + +The init function writes all candidates to a newly-created +candidate buffer. The candidates buffer is created or specified +by `helm-candidate-buffer'. Candidates are stored in a line. + +The candidates function narrows all candidates, IOW creates a +subset of candidates dynamically. It is the task of +`helm-candidates-in-buffer'. As long as +`helm-candidate-buffer' is used,`(candidates-in-buffer)' is +sufficient in most cases. + +Note that `(candidates-in-buffer)' is shortcut of three attributes: + (candidates . helm-candidates-in-buffer) + (volatile) + (match identity) +And `(candidates-in-buffer . func)' is shortcut of three attributes: + (candidates . func) + (volatile) + (match identity) +The expansion is performed in `helm-get-sources'. + +The candidates-in-buffer attribute implies the volatile attribute. +The volatile attribute is needed because `helm-candidates-in-buffer' +creates candidates dynamically and need to be called everytime +`helm-pattern' changes. + +Because `helm-candidates-in-buffer' plays the role of `match' attribute +function, specifying `(match identity)' makes the source slightly faster. + +However if source contain match-part attribute, match is computed only +on part of candidate returned by the call of function provided by this attribute. +The function should have one arg, candidate, and return only +a specific part of candidate. + +To customize `helm-candidates-in-buffer' behavior, use `search', +`get-line', `match-part' and `search-from-end' attributes." + + (helm-candidates-in-buffer-1 + (helm-candidate-buffer) + helm-pattern + (or (assoc-default 'get-line source) + #'buffer-substring-no-properties) + ;; use external variable `source'. + (or (assoc-default 'search source) + (if (assoc 'search-from-end source) + '(helm-candidates-in-buffer-search-from-end) + '(helm-candidates-in-buffer-search-from-start))) + (helm-candidate-number-limit source) + (assoc 'search-from-end source) + (helm-attr 'match-part) + source)) + +(defun helm-candidates-in-buffer-search-from-start (pattern) + "Search PATTERN with `re-search-forward' with bound and noerror args." + (re-search-forward pattern nil t)) + +(defun helm-candidates-in-buffer-search-from-end (pattern) + "Search PATTERN with `re-search-backward' with bound and noerror args." + (re-search-backward pattern nil t)) + +(defun helm-candidates-in-buffer-1 (buffer pattern get-line-fn + search-fns limit search-from-end + match-part-fn source) + "Return the list of candidates inserted in BUFFER matching PATTERN." + ;; buffer == nil when candidates buffer does not exist. + (when buffer + (with-current-buffer buffer + (let ((start-point (if search-from-end + (1+ (point-max)) (1- (point-min)))) + (endp (if search-from-end #'bobp #'eobp)) + (inhibit-point-motion-hooks t)) + (goto-char start-point) + (if (string= pattern "") + (helm-initial-candidates-from-candidate-buffer + endp get-line-fn limit search-from-end) + (helm-search-from-candidate-buffer + pattern get-line-fn search-fns limit search-from-end + start-point match-part-fn source)))))) + +(defun helm-point-is-moved (proc) + "If point is moved after executing PROC, return t, otherwise nil." + (/= (point) (save-excursion (funcall proc) (point)))) + +(defun helm-search-from-candidate-buffer (pattern get-line-fn search-fns + limit search-from-end + start-point match-part-fn source) + (let (buffer-read-only + matches + newmatches + (case-fold-search (helm-set-case-fold-search))) + (helm-search-from-candidate-buffer-internal + (lambda () + (clrhash helm-cib-hash) + (cl-dolist (searcher search-fns) + (goto-char start-point) + (setq newmatches nil) + (cl-loop with item-count = 0 + while (funcall searcher pattern) + for cand = (funcall get-line-fn (point-at-bol) (point-at-eol)) + when (and (not (gethash cand helm-cib-hash)) + (or + ;; Always collect when cand is matched by searcher funcs + ;; and match-part attr is not present. + (not match-part-fn) + ;; If match-part attr is present, collect only if PATTERN + ;; match the part of CAND specified by the match-part func. + (helm-search-match-part cand pattern match-part-fn))) + do (helm--accumulate-candidates + cand newmatches helm-cib-hash item-count limit source) + unless (helm-point-is-moved + (lambda () + (if search-from-end + (goto-char (1- (point-at-bol))) + (forward-line 1)))) + return nil) + (setq matches (append matches (nreverse newmatches)))) + (delq nil matches))))) + +(defun helm-search-match-part (candidate pattern match-part-fn) + "Match PATTERN only on part of CANDIDATE returned by MATCH-PART-FN." + (let ((part (funcall match-part-fn candidate))) + (if (string-match " " pattern) + (cl-loop for i in (split-string pattern " " t) + always (string-match i part)) + (string-match pattern part)))) + +(defun helm-initial-candidates-from-candidate-buffer (endp + get-line-fn + limit search-from-end) + (delq nil (cl-loop with next-line-fn = + (if search-from-end + (lambda (_x) (goto-char (max (1- (point-at-bol)) 1))) + #'forward-line) + until (funcall endp) + for i from 1 to limit + collect (funcall get-line-fn (point-at-bol) (point-at-eol)) + do (funcall next-line-fn 1)))) + +(defun helm-search-from-candidate-buffer-internal (search-fn) + (goto-char (point-min)) + (insert "\n") + (goto-char (point-max)) + (insert "\n") + (unwind-protect + (funcall search-fn) + (goto-char (point-min)) + (delete-char 1) + (goto-char (1- (point-max))) + (delete-char 1) + (set-buffer-modified-p nil))) + +(defun helm-candidate-buffer (&optional create-or-buffer) + "Register and return a buffer containing candidates of current source. +`helm-candidate-buffer' searches buffer-local candidates buffer first, +then global candidates buffer. + +Acceptable values of CREATE-OR-BUFFER: + +- nil (omit) + Only return the candidates buffer. +- a buffer + Register a buffer as a candidates buffer. +- 'global + Create a new global candidates buffer, + named \" *helm candidates:SOURCE*\". +- other non-nil value + Create a new local candidates buffer, + named \" *helm candidates:SOURCE*HELM-CURRENT-BUFFER\"." + (let* ((global-bname (format " *helm candidates:%s*" + helm-source-name)) + (local-bname (format " *helm candidates:%s*%s" + helm-source-name + (buffer-name helm-current-buffer))) + (register-func #'(lambda () + (setq helm-candidate-buffer-alist + (cons (cons helm-source-name create-or-buffer) + (delete (assoc helm-source-name + helm-candidate-buffer-alist) + helm-candidate-buffer-alist))))) + (kill-buffers-func #'(lambda () + (cl-loop for b in (buffer-list) + if (string-match (format "^%s" (regexp-quote global-bname)) + (buffer-name b)) + do (kill-buffer b)))) + (create-func #'(lambda () + (with-current-buffer + (get-buffer-create (if (eq create-or-buffer 'global) + global-bname + local-bname)) + (buffer-disable-undo) + (erase-buffer) + (font-lock-mode -1)))) + (return-func #'(lambda () + (or (get-buffer local-bname) + (get-buffer global-bname) + (helm-aif (assoc-default helm-source-name + helm-candidate-buffer-alist) + (and (buffer-live-p it) it)))))) + (when create-or-buffer + (funcall register-func) + (unless (bufferp create-or-buffer) + (and (eq create-or-buffer 'global) (funcall kill-buffers-func)) + (funcall create-func))) + (funcall return-func))) + +(defun helm-init-candidates-in-buffer (buffer data) + "Register BUFFER with DATA for a helm candidates-in-buffer session. +Arg BUFFER can be a string, a buffer object (bufferp), or a symbol, +either 'local or 'global which is passed to `helm-candidate-buffer'. +Arg DATA can be either a list or a plain string." + (declare (indent 1)) + (let ((buf (helm-candidate-buffer + (if (or (stringp buffer) + (bufferp buffer)) + (get-buffer-create buffer) + buffer)))) ; a symbol. + (with-current-buffer buf + (erase-buffer) + (if (listp data) + (cl-loop for i in data do (insert (concat i "\n"))) + (and (stringp data) (insert data))))) + buffer) + +(defun helm-compile-source--candidates-in-buffer (source) + (helm-aif (assoc 'candidates-in-buffer source) + (append source + `((candidates . ,(or (cdr it) + (lambda () + (helm-candidates-in-buffer source)))) + (volatile) (match identity))) + source)) + + +;;; Resplit helm window +;; +;; +(defun helm-toggle-resplit-window () + "Toggle resplit helm window, vertically or horizontally." + (interactive) + (when helm-prevent-escaping-from-minibuffer + (helm-prevent-switching-other-window :enabled nil)) + (unwind-protect + (with-helm-window + (if (or helm-full-frame (one-window-p t)) + (message "Error: Attempt to resplit a single window") + (let ((before-height (window-height))) + (delete-window) + (set-window-buffer + (select-window + (if (= (window-height) before-height) ; initial split was horizontal. + ;; Split window vertically with `helm-buffer' placed + ;; on the good side according to actual value of + ;; `helm-split-window-default-side'. + (prog1 + (cond ((or (eq helm-split-window-default-side 'above) + (eq helm-split-window-default-side 'left)) + (split-window + (selected-window) nil 'above)) + (t (split-window-vertically))) + (setq helm-split-window-state 'vertical)) + ;; Split window vertically, same comment as above. + (setq helm-split-window-state 'horizontal) + (cond ((or (eq helm-split-window-default-side 'left) + (eq helm-split-window-default-side 'above)) + (split-window (selected-window) nil 'left)) + (t (split-window-horizontally))))) + helm-buffer))) + (setq helm--window-side-state (helm--get-window-side-state))) + (when helm-prevent-escaping-from-minibuffer + (helm-prevent-switching-other-window :enabled nil)))) + +;; Utility: Resize helm window. +(defun helm-enlarge-window-1 (n) + "Enlarge or narrow helm window. +If N is positive enlarge, if negative narrow." + (unless helm-full-frame + (let ((horizontal-p (eq helm-split-window-state 'horizontal))) + (with-helm-window + (enlarge-window n horizontal-p))))) + +(defun helm-narrow-window () + "Narrow helm window." + (interactive) + (helm-enlarge-window-1 -1)) + +(defun helm-enlarge-window () + "Enlarge helm window." + (interactive) + (helm-enlarge-window-1 1)) + +(defun helm-swap-windows () + "Swap window holding `helm-buffer' with other window." + (interactive) + (if (and helm-full-frame (one-window-p t)) + (error "Error: Can't swap windows in a single window") + (let* ((w1 (helm-window)) + (split-state (eq helm-split-window-state 'horizontal)) + (w1size (window-total-size w1 split-state)) + (b1 (window-buffer w1)) ; helm-buffer + (s1 (window-start w1)) + (cur-frame (window-frame w1)) + (w2 (with-selected-window (helm-window) + ;; Don't try to display helm-buffer + ;; in a dedicated window. + (get-window-with-predicate + (lambda (w) (not (window-dedicated-p w))) + 1 cur-frame))) + (w2size (window-total-size w2 split-state)) + (b2 (window-buffer w2)) ; probably helm-current-buffer + (s2 (window-start w2)) + resize) + (with-selected-frame (window-frame w1) + (helm-replace-buffer-in-window w1 b1 b2) + (helm-replace-buffer-in-window w2 b2 b1) + (setq resize + (cond ( ;; helm-window is smaller than other window. + (< w1size w2size) + (- (- (max w2size w1size) + (min w2size w1size)))) + ( ;; helm-window is larger than other window. + (> w1size w2size) + (- (max w2size w1size) + (min w2size w1size))) + ( ;; windows have probably same size. + t nil))) + ;; Maybe resize the window holding helm-buffer. + (and resize (window-resize w2 resize split-state)) + (set-window-start w1 s2 t) + (set-window-start w2 s1 t)) + (setq helm--window-side-state (helm--get-window-side-state))))) + +(defun helm--get-window-side-state () + "Return the position of `helm-window' from `helm-current-buffer'. +Possible values are 'left 'right 'below or 'above." + (let ((side-list '(left right below above))) + (cl-loop for side in side-list + thereis (and (equal (helm-window) + (window-in-direction + side (get-buffer-window helm-current-buffer t) + t)) + side)))) + +(defun helm-replace-buffer-in-window (window buffer1 buffer2) + "Replace BUFFER1 by BUFFER2 in WINDOW registering BUFFER1." + (when (get-buffer-window buffer1) + (unrecord-window-buffer window buffer1) + (set-window-buffer window buffer2))) + +;; Utility: select another action by key +(defun helm-select-nth-action (n) + "Select the N nth action for the currently selected candidate." + (setq helm-saved-selection (helm-get-selection)) + (unless helm-saved-selection + (error "Nothing is selected")) + (setq helm-saved-action + (helm-get-nth-action + n + (if (get-buffer-window helm-action-buffer 'visible) + (assoc-default 'candidates (helm-get-current-source)) + (helm-get-actions-from-current-source)))) + (helm-maybe-exit-minibuffer)) + +(defun helm-get-nth-action (n action) + (cond ((and (zerop n) (functionp action)) + action) + ((listp action) + (or (cdr (elt action n)) + (error "No such action"))) + ((and (functionp action) (< 0 n)) + (error "Sole action")) + (t + (error "Error in `helm-select-nth-action'")))) + +;; Utility: Persistent Action +(defmacro with-helm-display-same-window (&rest body) + "Execute BODY in the window used for persistent action. +Make `pop-to-buffer' and `display-buffer' display in the same window." + (declare (indent 0) (debug t)) + `(let ((display-buffer-function 'helm-persistent-action-display-buffer)) + ,@body)) + +(defun helm-initialize-persistent-action () + (set (make-local-variable 'helm-persistent-action-display-window) nil)) + +(cl-defun helm-execute-persistent-action + (&optional (attr 'persistent-action) split-onewindow) + "Perform the associated action ATTR without quitting helm. +ATTR default is 'persistent-action', but it can be anything else. +In this case you have to add this new attribute to your source. + +When `helm-full-frame' or SPLIT-ONEWINDOW are non--nil, +and `helm-buffer' is displayed in only one window, +the helm window is splitted to display +`helm-select-persistent-action-window' in other window +and keep its visibility." + (interactive) + (helm-log "executing persistent-action") + (let* ((attr-val (assoc-default attr (helm-get-current-source))) + ;; If attr value is a cons, use its car as persistent function + ;; and its car to decide if helm window should be splitted. + (fn (if (and (consp attr-val) + ;; maybe a lambda. + (not (functionp attr-val))) + (car attr-val) attr-val)) + (no-split (and (consp attr-val) + (not (functionp attr-val)) + (cdr attr-val)))) + (with-helm-window + (save-selected-window + (if no-split + (helm-select-persistent-action-window) + (helm-select-persistent-action-window + (or split-onewindow helm-onewindow-p))) + (helm-log "current-buffer = %S" (current-buffer)) + (let ((helm-in-persistent-action t)) + (with-helm-display-same-window + (helm-execute-selection-action-1 + nil (or fn (helm-get-actions-from-current-source)) t) + (helm-log-run-hook 'helm-after-persistent-action-hook)) + ;; A typical case is when a persistent action delete + ;; the buffer already displayed in + ;; `helm-persistent-action-display-window' and `helm-full-frame' + ;; is enabled, we end up with the `helm-buffer' + ;; displayed in two windows. + (when (and helm-onewindow-p + (> (length (window-list)) 1) + (equal (buffer-name + (window-buffer + helm-persistent-action-display-window)) + (helm-buffer-get))) + (delete-other-windows))))))) + +(defun helm-persistent-action-display-window (&optional split-onewindow) + "Return the window that will be used for persistent action. +If SPLIT-ONEWINDOW is non--nil window will be splitted in persistent action." + (with-helm-window + (setq helm-persistent-action-display-window + (cond ((and (window-live-p helm-persistent-action-display-window) + (not (member helm-persistent-action-display-window + (get-buffer-window-list helm-buffer)))) + helm-persistent-action-display-window) + (split-onewindow (split-window)) + ((get-buffer-window helm-current-buffer)) + (t (next-window (selected-window) 1)))))) + +(defun helm-select-persistent-action-window (&optional split-onewindow) + "Select the window that will be used for persistent action. +See `helm-persistent-action-display-window' for how to use SPLIT-ONEWINDOW." + (select-window (get-buffer-window (helm-buffer-get))) + (select-window + (setq minibuffer-scroll-window + (helm-persistent-action-display-window split-onewindow)))) + +(defun helm-persistent-action-display-buffer (buf &optional action) + "Make `pop-to-buffer' and `display-buffer' display in the same window. +If `helm-persistent-action-use-special-display' is non-nil and +BUF is to be displayed by `special-display-function', use it. +Otherwise ignores `special-display-buffer-names' and `special-display-regexps'. +Argument ACTION if present will be used as second argument of `display-buffer'." + (let* ((name (buffer-name buf)) + display-buffer-function pop-up-windows pop-up-frames + ;; Disable `special-display-regexps' and `special-display-buffer-names' + ;; unless `helm-persistent-action-use-special-display' is non--nil. + (special-display-buffer-names + (and helm-persistent-action-use-special-display + special-display-buffer-names)) + (special-display-regexps + (and helm-persistent-action-use-special-display + special-display-regexps)) + (same-window-regexps + (unless (and helm-persistent-action-use-special-display + (or (member name + (mapcar (lambda (x) (or (car-safe x) x)) + special-display-buffer-names)) + (cl-loop for x in special-display-regexps + thereis (string-match (or (car-safe x) x) + name)))) + '(".")))) + ;; Don't loose minibuffer when displaying persistent window in + ;; another frame. + ;; This happen when the displayed persistent buffer-name is one of + ;; `special-display-buffer-names' or match `special-display-regexps' + ;; and `helm-persistent-action-use-special-display' is enabled. + (with-selected-window (if (or special-display-regexps + special-display-buffer-names) + (minibuffer-window) + (selected-window)) + ;; Be sure window of BUF is not dedicated. + (set-window-dedicated-p (get-buffer-window buf) nil) + (display-buffer buf action)))) + +;; scroll-other-window(-down)? for persistent-action +(defun helm-other-window-base (command &optional scroll-amount) + (setq scroll-amount (unless (eq scroll-amount 'noscroll) + helm-scroll-amount)) + (with-selected-window (helm-persistent-action-display-window) + (funcall command scroll-amount))) + +(defun helm-scroll-other-window () + "Scroll other window (not *Helm* window) upward." + (interactive) + (helm-other-window-base 'scroll-up)) + +(defun helm-scroll-other-window-down () + "Scroll other window (not *Helm* window) downward." + (interactive) + (helm-other-window-base 'scroll-down)) + +(defun helm-recenter-top-bottom-other-window () + "`recenter-top-bottom' in other window (not *Helm* window)." + (interactive) + (helm-other-window-base 'recenter-top-bottom 'noscroll)) + +(defun helm-reposition-window-other-window () + "`helm-reposition-window' in other window (not *Helm* window)." + (interactive) + (helm-other-window-base 'reposition-window 'noscroll)) + + + +;; Utility: Visible Mark + +(defun helm-clear-visible-mark () + (with-current-buffer (helm-buffer-get) + (mapc 'delete-overlay helm-visible-mark-overlays) + (set (make-local-variable 'helm-visible-mark-overlays) nil))) + +(defun helm-this-visible-mark () + (cl-loop for o in helm-visible-mark-overlays + when (equal (point-at-bol) (overlay-start o)) + return o)) + +(defun helm-delete-visible-mark (overlay) + (setq helm-marked-candidates + (remove + (cons (helm-get-current-source) (helm-get-selection)) + helm-marked-candidates)) + (delete-overlay overlay) + (setq helm-visible-mark-overlays + (delq overlay helm-visible-mark-overlays))) + +(defun helm-make-visible-mark () + (let ((o (make-overlay (point-at-bol) + (if (helm-pos-multiline-p) + (or (helm-get-next-candidate-separator-pos) + (point-max)) + (1+ (point-at-eol)))))) + (overlay-put o 'face 'helm-visible-mark) + (overlay-put o 'source (assoc-default 'name (helm-get-current-source))) + (overlay-put o 'string (buffer-substring (overlay-start o) (overlay-end o))) + (overlay-put o 'real (helm-get-selection)) + (add-to-list 'helm-visible-mark-overlays o)) + (push (cons (helm-get-current-source) (helm-get-selection)) + helm-marked-candidates)) + +(defun helm-toggle-visible-mark () + "Toggle helm visible mark at point." + (interactive) + (with-helm-window + (let ((nomark (assq 'nomark (helm-get-current-source)))) + (if nomark + (message "Marking not allowed in this source") + (helm-aif (helm-this-visible-mark) + (helm-delete-visible-mark it) + (helm-make-visible-mark)) + (unless (helm-end-of-source-p) + (helm-next-line)))))) + +(defun helm-mark-all () + "Mark all visible unmarked candidates in current source." + (interactive) + (require 'helm-files) + (with-helm-window + (let ((nomark (assq 'nomark (helm-get-current-source))) + (follow (if helm-follow-mode 1 -1))) + (helm-follow-mode -1) + (unwind-protect + (if nomark + (message "Marking not allowed in this source") + (save-excursion + (goto-char (helm-get-previous-header-pos)) + (helm-next-line) + (let* ((next-head (helm-get-next-header-pos)) + (end (and next-head + (save-excursion + (goto-char next-head) + (forward-line -1) + (point)))) + (maxpoint (or end (point-max)))) + (while (< (point) maxpoint) + (helm-mark-current-line) + (let* ((prefix (get-text-property (point-at-bol) 'display)) + (cand (helm-get-selection)) + (bn (and (helm-file-completion-source-p) + (helm-basename cand))) + (src-name (assoc-default 'name + (helm-get-current-source)))) + (when (and (not (helm-this-visible-mark)) + (not (or (string= prefix "[?]") + (string= prefix "[@]")))) + ;; Don't mark possibles directories ending with . or .. + ;; autosave files/links and non--existent file. + (unless + (and (or (helm-file-completion-source-p) + (string= + src-name "Files from Current Directory")) + (or (string-match + "^[.]?#.*#?$\\|[^#]*[.]\\{1,2\\}$" bn) + ;; We need to test here when not using + ;; a transformer that tag prefix + ;; (i.e on tramp). + (not (file-exists-p cand)))) + (helm-make-visible-mark)))) + (if (helm-pos-multiline-p) + (progn + (goto-char + (or (helm-get-next-candidate-separator-pos) + (point-max))) + (forward-line 1)) + (forward-line 1)) + (end-of-line)))) + (helm-mark-current-line) + (message "%s candidates marked" (length helm-marked-candidates))) + (helm-follow-mode follow) (message nil))))) + +(defun helm-unmark-all () + "Unmark all candidates in all sources of current helm session." + (interactive) + (with-helm-window + (let ((len (length helm-marked-candidates))) + (save-excursion + (helm-clear-visible-mark)) + (setq helm-marked-candidates nil) + (helm-mark-current-line) + (message "%s candidates unmarked" len)))) + +(defun helm-toggle-all-marks () + "Toggle all marks. +Mark all visible candidates of current source or unmark all candidates +visible or invisible in all sources of current helm session" + (interactive) + (let ((marked (helm-marked-candidates))) + (if (and (>= (length marked) 1) + (with-helm-window helm-visible-mark-overlays)) + (helm-unmark-all) + (helm-mark-all)))) + +(defun helm-display-all-visible-marks () + "Show all `helm' visible marks strings. +Only useful for debugging." + (interactive) + (with-helm-window + (let ((overlays (reverse helm-visible-mark-overlays))) + (helm-run-after-quit + (lambda () + (with-output-to-temp-buffer "*helm visible marks*" + (cl-dolist (o overlays) (princ (overlay-get o 'string))))))))) + +(cl-defun helm-marked-candidates (&key with-wildcard) + "Return marked candidates of current source if any. +Otherwise one element list of current selection. +When key WITH-WILDCARD is specified try to expand a wilcard if some." + (with-current-buffer helm-buffer + (cl-loop with current-src = (helm-get-current-source) + for (source . real) in + (or (reverse helm-marked-candidates) + (list (cons current-src (helm-get-selection)))) + when (equal current-src source) + ;; When real is a normal filename without wildcard + ;; file-expand-wildcards returns a list of one file. + ;; When real is a non--existent file it return nil. + append (let* ((elm (helm-coerce-selection real source)) + (c (and with-wildcard + (condition-case nil + (file-expand-wildcards elm t) + (error nil))))) + (or c (list elm))) + into cands + finally do (prog1 (cl-return cands) + (helm-log "Marked candidates = %S" cands))))) + +(defun helm-current-source-name= (name) + (save-excursion + (goto-char (helm-get-previous-header-pos)) + (equal name (helm-current-line-contents)))) + +(defun helm-revive-visible-mark () + "Restore marked candidates when helm update display." + (with-current-buffer helm-buffer + (cl-dolist (o helm-visible-mark-overlays) + (goto-char (point-min)) + (while (and (search-forward (overlay-get o 'string) nil t) + (helm-current-source-name= (overlay-get o 'source))) + ;; Calculate real value of candidate. + ;; It can be nil if candidate have only a display value. + (let ((real (get-text-property (point-at-bol 0) 'helm-realvalue))) + (if real + ;; Check if real value of current candidate is the same + ;; that the one stored in overlay. + (and (string= (overlay-get o 'real) real) + (move-overlay o (point-at-bol 0) (1+ (point-at-eol 0)))) + (move-overlay o (point-at-bol 0) (1+ (point-at-eol 0))))))))) +(add-hook 'helm-update-hook 'helm-revive-visible-mark) + +(defun helm-next-point-in-list (curpos points &optional prev) + (cond + ;; rule out special cases. + ((null points) curpos) + ((and prev (<= curpos (car points))) + (nth (1- (length points)) points)) + ((< (car (last points)) curpos) + (if prev (car (last points)) (nth 0 points))) + ((and (not prev) (>= curpos (car (last points)))) + (nth 0 points)) + (t + (nth (if prev + (cl-loop for pt in points + for i from 0 + if (<= curpos pt) return (1- i)) + (cl-loop for pt in points + for i from 0 + if (< curpos pt) return i)) + points)))) + +(defun helm-next-visible-mark (&optional prev) + "Move next helm visible mark. +If PREV is non-nil move to precedent." + (interactive) + (with-helm-window + (ignore-errors + (goto-char (helm-next-point-in-list + (point) + (sort (mapcar 'overlay-start helm-visible-mark-overlays) '<) + prev))) + (helm-mark-current-line))) + +(defun helm-prev-visible-mark () + "Move previous helm visible mark." + (interactive) + (helm-next-visible-mark t)) + +;;; Utility: Selection Paste +;; +(defun helm-yank-selection (arg) + "Set minibuffer contents to current display selection. +With a prefix arg set to real value of current selection." + (interactive "P") + (let ((str (helm-get-selection nil (not arg)))) + (kill-new str) + (helm-set-pattern str))) + +(defun helm-kill-selection-and-quit (arg) + "Store display value of current selection to kill ring. +With a prefix arg set to real value of current selection. +Display value is what you see in `helm-buffer' and real value +is what is used to perform actions." + (interactive "P") + (helm-run-after-quit + (lambda (sel) + (kill-new sel) + (message "Killed: %s" sel)) + (helm-get-selection nil (not arg)))) + +(defun helm-copy-to-buffer () + "Copy selection or marked candidates to `helm-current-buffer'." + (interactive) + (with-helm-buffer + (cl-loop for cand in (helm-marked-candidates) + do (with-helm-current-buffer + (insert cand "\n"))))) + + +;;; Follow-mode: Automatical execution of persistent-action +;; +;; +(defun helm-follow-mode (&optional arg) + "Execute persistent action everytime the cursor is moved when enabled. +The mode is enabled for the current source only, you will have to turn it +on again when you go to next source if you want it there also. +This mode can be enabled or disabled interactively at anytime during +helm session or enabled specifically by source by adding the `follow' +attribute to this source. +Even when the attribute `follow' exists in source, it is still possible +to disable/enable this mode interactively. +Note that when you disable it interactively and `follow' attribute exists, +`helm-follow-mode' will be disabled on next helm session even if `follow' +attribute is specified in source. To avoid this set your `follow' attribute +in source in `helm-before-initialize-hook'. + +e.g: + +\(add-hook 'helm-before-initialize-hook + #'(lambda () (helm-attrset 'follow 1 helm-source-buffers-list))) + +This will enable `helm-follow-mode' automatically in `helm-source-buffers-list'." + (interactive "p") + (with-current-buffer helm-buffer + (let* ((src (helm-get-current-source)) + (name (assoc-default 'name src)) + (sym (cl-loop for s in helm-sources + for sname = (and (symbolp s) + (assoc-default + 'name (symbol-value s))) + thereis (and sname (string= sname name) s))) + (fol-attr (assq 'follow src)) + (enabled (or (< arg 0) ; Assume follow is enabled. + (eq (cdr fol-attr) 1)))) + (if (eq (cdr fol-attr) 'never) + (message "helm-follow-mode not allowed in this source") + (helm-attrset 'follow (if enabled -1 1) src) + (setq helm-follow-mode (eq (cdr (assq 'follow src)) 1)) + (message "helm-follow-mode is %s" + (if helm-follow-mode + "enabled" "disabled")) + (helm-display-mode-line src)) + ;; Make follow attr persistent for this session. + (when (and helm-follow-mode-persistent sym) + (set (car `(,sym)) src))))) + +(defvar helm-follow-input-idle-delay nil + "`helm-follow-mode' will execute its persistent action after this delay. +Note that if the `follow-delay' attr is present in source, +it will take precedence on this.") +(defun helm-follow-execute-persistent-action-maybe () + "Execute persistent action in mode `helm-follow-mode'. +This happen after `helm-input-idle-delay' secs." + (let ((src (helm-get-current-source))) + (and (not (get-buffer-window helm-action-buffer 'visible)) + (eq (assoc-default 'follow src) 1) + (sit-for (or (assoc-default 'follow-delay src) + helm-follow-input-idle-delay + (and helm-input-idle-delay + (max helm-input-idle-delay 0.01)))) + (helm-window) + (helm-get-selection) + (save-excursion + (helm-execute-persistent-action))))) + + +(provide 'helm) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm.el ends here diff --git a/elpa/helm-20140808.2300/helm.elc b/elpa/helm-20140808.2300/helm.elc new file mode 100644 index 000000000..12f102ab2 Binary files /dev/null and b/elpa/helm-20140808.2300/helm.elc differ diff --git a/elpa/highlight-indentation-20131207.835/highlight-indentation-autoloads.el b/elpa/highlight-indentation-20131207.835/highlight-indentation-autoloads.el new file mode 100644 index 000000000..576374887 --- /dev/null +++ b/elpa/highlight-indentation-20131207.835/highlight-indentation-autoloads.el @@ -0,0 +1,44 @@ +;;; highlight-indentation-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (highlight-indentation-current-column-mode highlight-indentation-set-offset +;;;;;; highlight-indentation-mode) "highlight-indentation" "highlight-indentation.el" +;;;;;; (21478 16684 0 0)) +;;; Generated autoloads from highlight-indentation.el + +(autoload 'highlight-indentation-mode "highlight-indentation" "\ +Highlight indentation minor mode highlights indentation based +on spaces + +\(fn &optional ARG)" t nil) + +(autoload 'highlight-indentation-set-offset "highlight-indentation" "\ +Set indentation offset localy in buffer, will prevent +highlight-indentation from trying to guess indentation offset +from major mode + +\(fn OFFSET)" t nil) + +(autoload 'highlight-indentation-current-column-mode "highlight-indentation" "\ +Hilight Indentation minor mode displays +a vertical bar corresponding to the indentation of the current line + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("highlight-indentation-pkg.el") (21478 +;;;;;; 16684 351232 0)) + +;;;*** + +(provide 'highlight-indentation-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; highlight-indentation-autoloads.el ends here diff --git a/elpa/highlight-indentation-20131207.835/highlight-indentation-pkg.el b/elpa/highlight-indentation-20131207.835/highlight-indentation-pkg.el new file mode 100644 index 000000000..04793e97f --- /dev/null +++ b/elpa/highlight-indentation-20131207.835/highlight-indentation-pkg.el @@ -0,0 +1 @@ +(define-package "highlight-indentation" "20131207.835" "Minor modes for highlighting indentation" (quote nil)) diff --git a/elpa/highlight-indentation-20131207.835/highlight-indentation-pkg.elc b/elpa/highlight-indentation-20131207.835/highlight-indentation-pkg.elc new file mode 100644 index 000000000..0a4004811 Binary files /dev/null and b/elpa/highlight-indentation-20131207.835/highlight-indentation-pkg.elc differ diff --git a/elpa/highlight-indentation-20131207.835/highlight-indentation.el b/elpa/highlight-indentation-20131207.835/highlight-indentation.el new file mode 100644 index 000000000..3cd83286b --- /dev/null +++ b/elpa/highlight-indentation-20131207.835/highlight-indentation.el @@ -0,0 +1,156 @@ +;;; highlight-indentation.el --- Minor modes for highlighting indentation +;; Author: Anton Johansson - http://antonj.se +;; Created: Dec 15 23:42:04 2010 +;; Version: 20131207.835 +;; X-Original-Version: 0.6.0 +;; URL: https://github.com/antonj/Highlight-Indentation-for-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 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. +;; +;;; Commentary: +;; Customize `highlight-indentation-face', and +;; `highlight-indentation-current-column-face' to suit your theme. + +;;; Code: + +(defgroup highlight-indentation nil + "Highlight Indentation" + :prefix "highlight-indentation-" + :group 'basic-faces) + +(defface highlight-indentation-face + ;; Fringe has non intrusive color in most color-themes + '((t :inherit fringe)) + "Basic face for highlighting indentation guides." + :group 'highlight-indentation) + +(defcustom highlight-indentation-offset 4 + "Default indentation offset, used if no other can be found from + major mode. This value is always used by + `highlight-indentation-mode' if set buffer local. Set buffer + local with `highlight-indentation-set-offset'" + :group 'highlight-indentation) + +(defvar highlight-indentation-current-regex nil) + +;;;###autoload +(define-minor-mode highlight-indentation-mode + "Highlight indentation minor mode highlights indentation based +on spaces" + :lighter " ||" + (when highlight-indentation-current-regex ;; OFF + (font-lock-remove-keywords nil `((,highlight-indentation-current-regex + (1 'highlight-indentation-face))))) + + (set (make-local-variable 'highlight-indentation-current-regex) nil) + + (when highlight-indentation-mode ;; ON + (when (not (local-variable-p 'highlight-indentation-offset)) + (set (make-local-variable 'highlight-indentation-offset) + ;; Set indentation offset from highlight-indentation-offset if set, otherwise + ;; according to major mode + (cond ((and (eq major-mode 'python-mode) (boundp 'python-indent)) + python-indent) + ((and (eq major-mode 'python-mode) (boundp 'py-indent-offset)) + py-indent-offset) + ((and (eq major-mode 'python-mode) (boundp 'python-indent-offset)) + python-indent-offset) + ((eq major-mode 'ruby-mode) + ruby-indent-level) + ((and (eq major-mode 'scala-mode) (boundp 'scala-indent:step)) + scala-indent:step) + ((and (eq major-mode 'scala-mode) (boundp 'scala-mode-indent:step)) + scala-mode-indent:step) + ((or (eq major-mode 'scss-mode) (eq major-mode 'css-mode)) + css-indent-offset) + ((eq major-mode 'nxml-mode) + nxml-child-indent) + ((eq major-mode 'coffee-mode) + coffee-tab-width) + ((eq major-mode 'js-mode) + js-indent-level) + ((eq major-mode 'js2-mode) + js2-basic-offset) + ((local-variable-p 'c-basic-offset) + c-basic-offset) + (t + (default-value 'highlight-indentation-offset))))) + (set (make-local-variable 'highlight-indentation-current-regex) + (format "\\( \\) \\{%s\\}" (- highlight-indentation-offset 1))) + (font-lock-add-keywords nil `((,highlight-indentation-current-regex + (1 'highlight-indentation-face))))) + (font-lock-fontify-buffer)) + +;;;###autoload +(defun highlight-indentation-set-offset (offset) + "Set indentation offset localy in buffer, will prevent +highlight-indentation from trying to guess indentation offset +from major mode" + (interactive + (if (and current-prefix-arg (not (consp current-prefix-arg))) + (list (prefix-numeric-value current-prefix-arg)) + (list (read-number "Indentation offset: ")))) + (set (make-local-variable 'highlight-indentation-offset) offset) + (when highlight-indentation-mode + (highlight-indentation-mode))) + + +;;; +;;; Copyright (C) Kresten Krab Thorup +;;; Available under Apache License, Version 2. +;;; +;;; This minor mode will highlight the indentation of the current line +;;; as a vertical bar (grey background color) aligned with the column of the +;;; first character of the current line. +;;; +(defface highlight-indentation-current-column-face + ;; Fringe has non intrusive color in most color-themes + '((t :inherit fringe)) + "Basic face for highlighting indentation guides." + :group 'highlight-indentation) + +;; used to hold the last regex we installed +(defvar highlight-indentation-current-column-regex nil) + +;;;###autoload +(define-minor-mode + highlight-indentation-current-column-mode + "Hilight Indentation minor mode displays +a vertical bar corresponding to the indentation of the current line" + :lighter " |" + + (when highlight-indentation-current-column-regex + (font-lock-remove-keywords nil highlight-indentation-current-column-regex)) + + (set (make-local-variable 'highlight-indentation-current-column-regex) nil) + (cond (highlight-indentation-current-column-mode + (add-hook 'post-command-hook 'highlight-indentation-current-column-post-command-hook nil t)) + (t + (remove-hook 'post-command-hook 'highlight-indentation-current-column-post-command-hook t) + + (font-lock-fontify-buffer)))) + +(defun highlight-indentation-current-column-post-command-hook () + "This hook runs after every keystroke" + (when highlight-indentation-current-column-regex + (font-lock-remove-keywords nil highlight-indentation-current-column-regex)) + (let ((indent (save-excursion (back-to-indentation) (current-column)))) + (when (and highlight-indentation-current-column-mode + (> indent 1)) + (let* ((re (format "^ \\{%d\\}\\( \\)" indent)) + (arg `((,re (1 'highlight-indentation-current-column-face prepend))))) + (set (make-local-variable 'highlight-indentation-current-column-regex) arg) + (font-lock-add-keywords nil arg)))) + (font-lock-fontify-buffer)) + +(provide 'highlight-indentation) + +;;; highlight-indentation.el ends here diff --git a/elpa/highlight-indentation-20131207.835/highlight-indentation.elc b/elpa/highlight-indentation-20131207.835/highlight-indentation.elc new file mode 100644 index 000000000..a8641de56 Binary files /dev/null and b/elpa/highlight-indentation-20131207.835/highlight-indentation.elc differ diff --git a/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-autoloads.el b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-autoloads.el new file mode 100644 index 000000000..4889b4dbd --- /dev/null +++ b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-autoloads.el @@ -0,0 +1,29 @@ +;;; idle-highlight-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (idle-highlight-mode) "idle-highlight-mode" "idle-highlight-mode.el" +;;;;;; (21478 16683 0 0)) +;;; Generated autoloads from idle-highlight-mode.el + +(autoload 'idle-highlight-mode "idle-highlight-mode" "\ +Idle-Highlight Minor Mode + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("idle-highlight-mode-pkg.el") (21478 16683 +;;;;;; 704053 0)) + +;;;*** + +(provide 'idle-highlight-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; idle-highlight-mode-autoloads.el ends here diff --git a/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-pkg.el b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-pkg.el new file mode 100644 index 000000000..e30f738ed --- /dev/null +++ b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-pkg.el @@ -0,0 +1 @@ +(define-package "idle-highlight-mode" "20120920.948" "highlight the word the point is on" (quote nil)) diff --git a/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-pkg.elc b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-pkg.elc new file mode 100644 index 000000000..5a78bb4a8 Binary files /dev/null and b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode-pkg.elc differ diff --git a/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode.el b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode.el new file mode 100644 index 000000000..1ab240af5 --- /dev/null +++ b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode.el @@ -0,0 +1,115 @@ +;;; idle-highlight-mode.el --- highlight the word the point is on + +;; Copyright (C) 2008-2011 Phil Hagelberg, Cornelius Mika + +;; Author: Phil Hagelberg, Cornelius Mika +;; URL: http://www.emacswiki.org/cgi-bin/wiki/IdleHighlight +;; Version: 20120920.948 +;; X-Original-Version: 1.1.3 +;; Created: 2008-05-13 +;; Keywords: convenience +;; EmacsWiki: IdleHighlight + +;; This file is NOT part of GNU Emacs. + +;;; License: + +;; 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, 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; Based on some snippets by fledermaus from the #emacs channel. + +;; M-x idle-highlight-mode sets an idle timer that highlights all +;; occurences in the buffer of the word under the point. + +;; Enabling it in a hook is recommended. But you don't want it enabled +;; for all buffers, just programming ones. +;; +;; Example: +;; +;; (defun my-coding-hook () +;; (make-local-variable 'column-number-mode) +;; (column-number-mode t) +;; (if window-system (hl-line-mode t)) +;; (idle-highlight-mode t)) +;; +;; (add-hook 'emacs-lisp-mode-hook 'my-coding-hook) +;; (add-hook 'ruby-mode-hook 'my-coding-hook) +;; (add-hook 'js2-mode-hook 'my-coding-hook) + +;;; Code: + +(require 'thingatpt) + + +(defgroup idle-highlight nil + "Highlight other occurrences of the word at point." + :group 'faces) + +(defface idle-highlight + '((t (:inherit region))) + "Face used to highlight other occurrences of the word at point." + :group 'idle-highlight) + +(defcustom idle-highlight-exceptions '("end") + "List of words to be excepted from highlighting." + :group 'idle-highlight + :type '(repeat string)) + +(defcustom idle-highlight-idle-time 0.5 + "Time after which to highlight the word at point." + :group 'idle-highlight + :type 'float) + +(defvar idle-highlight-regexp nil + "Buffer-local regexp to be idle-highlighted.") + +(defvar idle-highlight-global-timer nil + "Timer to trigger highlighting.") + +(defun idle-highlight-word-at-point () + "Highlight the word under the point." + (if idle-highlight-mode + (let* ((target-symbol (symbol-at-point)) + (target (symbol-name target-symbol))) + (idle-highlight-unhighlight) + (when (and target-symbol + (not (in-string-p)) + (looking-at-p "\\s_\\|\\sw") ;; Symbol characters + (not (member target idle-highlight-exceptions))) + (setq idle-highlight-regexp (concat "\\<" (regexp-quote target) "\\>")) + (highlight-regexp idle-highlight-regexp 'idle-highlight))))) + +(defsubst idle-highlight-unhighlight () + (when idle-highlight-regexp + (unhighlight-regexp idle-highlight-regexp) + (setq idle-highlight-regexp nil))) + +;;;###autoload +(define-minor-mode idle-highlight-mode + "Idle-Highlight Minor Mode" + :group 'idle-highlight + (if idle-highlight-mode + (progn (unless idle-highlight-global-timer + (setq idle-highlight-global-timer + (run-with-idle-timer idle-highlight-idle-time + :repeat 'idle-highlight-word-at-point))) + (set (make-local-variable 'idle-highlight-regexp) nil)) + (idle-highlight-unhighlight))) + +(provide 'idle-highlight-mode) +;;; idle-highlight-mode.el ends here diff --git a/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode.elc b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode.elc new file mode 100644 index 000000000..1ae219411 Binary files /dev/null and b/elpa/idle-highlight-mode-20120920.948/idle-highlight-mode.elc differ diff --git a/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-autoloads.el b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-autoloads.el new file mode 100644 index 000000000..56510c0d5 --- /dev/null +++ b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-autoloads.el @@ -0,0 +1,49 @@ +;;; ido-ubiquitous-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (ido-ubiquitous-mode) "ido-ubiquitous" "ido-ubiquitous.el" +;;;;;; (21478 16682 0 0)) +;;; Generated autoloads from ido-ubiquitous.el + +(define-obsolete-variable-alias 'ido-ubiquitous 'ido-ubiquitous-mode "0.8") + +(define-obsolete-function-alias 'ido-ubiquitous 'ido-ubiquitous-mode "0.8") + +(defvar ido-ubiquitous-mode nil "\ +Non-nil if Ido-Ubiquitous mode is enabled. +See the command `ido-ubiquitous-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `ido-ubiquitous-mode'.") + +(custom-autoload 'ido-ubiquitous-mode "ido-ubiquitous" nil) + +(autoload 'ido-ubiquitous-mode "ido-ubiquitous" "\ +Use `ido-completing-read' instead of `completing-read' almost everywhere. + + This mode has no effect unles `ido-mode' is also enabled. + + If this mode causes problems for a function, you can customize + when ido completion is or is not used by customizing + `ido-ubiquitous-command-overrides' or + `ido-ubiquitous-function-overrides'. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("ido-ubiquitous-pkg.el") (21478 16682 +;;;;;; 691774 0)) + +;;;*** + +(provide 'ido-ubiquitous-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; ido-ubiquitous-autoloads.el ends here diff --git a/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-pkg.el b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-pkg.el new file mode 100644 index 000000000..3dd090429 --- /dev/null +++ b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-pkg.el @@ -0,0 +1 @@ +(define-package "ido-ubiquitous" "20140526.1306" "Use ido (nearly) everywhere." (quote ((emacs "24.1")))) diff --git a/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-pkg.elc b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-pkg.elc new file mode 100644 index 000000000..e68990d68 Binary files /dev/null and b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous-pkg.elc differ diff --git a/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous.el b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous.el new file mode 100644 index 000000000..0a9b74577 --- /dev/null +++ b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous.el @@ -0,0 +1,868 @@ +;; -*- lexical-binding: t -*- + +;;; ido-ubiquitous.el --- Use ido (nearly) everywhere. + +;; Author: Ryan C. Thompson +;; URL: https://github.com/DarwinAwardWinner/ido-ubiquitous +;; Version: 20140526.1306 +;; X-Original-Version: 2.13 +;; Created: 2011-09-01 +;; Keywords: convenience +;; EmacsWiki: InteractivelyDoThings +;; Package-Requires: ((emacs "24.1")) + +;; This file is NOT part of GNU Emacs. + +;;; Commentary: + +;; If you use the excellent `ido-mode' for efficient completion of +;; file names and buffers, you might wonder if you can get ido-style +;; completion everywhere else too. Well, that's what this package +;; does! ido-ubiquitous is here to enable ido-style completion for +;; (almost) every function that uses the standard completion function +;; `completing-read'. + +;;; License: + +;; 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, 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +(defconst ido-ubiquitous-version "2.13" + "Currently running version of ido-ubiquitous. + +Note that when you update ido-ubiquitous, this variable may not +be updated until you restart Emacs.") + +(eval-when-compile + (when (or (not (boundp 'completing-read-function)) + (< emacs-major-version 24)) + (error "Could not find required variable `completing-read-function'. Are you using Emacs version 24 or higher? If you have Emacs 23 or lower, please downgrade to ido-ubiquitous version 1.7."))) + +(require 'ido) +(require 'advice) +(require 'cl) +;; Only exists in emacs 24.4 and up; we use a workaround for earlier +;; versions. +(require 'nadvice nil 'noerror) + +;; Declare this ahead of time to quiet the compiler +(defvar ido-ubiquitous-fallback-completing-read-function) + +;;; Internal utility functions + +(defun ido-ubiquitous--as-string (sym-or-str) + "Return name of symbol, return string as is." + (if (symbolp sym-or-str) + (symbol-name sym-or-str) + sym-or-str)) + +(defun ido-ubiquitous--as-symbol (sym-or-str) + "Return name of symbol, return string as is." + (if (symbolp sym-or-str) + sym-or-str + (intern sym-or-str))) + +;;; Custom widget definitions + +;; We need to define some custom widget types for use in the override +;; variables. + +(define-widget 'lazy-notag 'lazy + "Like lazy widget, but does not display its tag, only its value." + :format "%v") + +;; Define matcher functions and widgets for match specifications +(defvar ido-ubiquitous-match-spec-widget-types nil + "List of widget names for match specs.") +(defvar ido-ubiquitous-spec-matchers nil + "Alist of functions for matching function specs against function names.") +(loop for (widget-name widget-tag key field-type matcher) in + '((exact-match "Exact match" exact string string=) + (prefix-match "Prefix match" prefix string string-prefix-p) + (regexp-match "Regexp match" regexp regexp string-match-p)) + do (define-widget (ido-ubiquitous--as-symbol widget-name) 'lazy-notag widget-tag + :menu-tag widget-tag + :type `(list :tag ,widget-tag :format "%v" + (const :format "" + :tag ,widget-tag + ,key) + (,field-type :tag ,widget-tag))) + do (add-to-list 'ido-ubiquitous-match-spec-widget-types + widget-name 'append) + do (add-to-list 'ido-ubiquitous-spec-matchers + (cons key matcher) 'append)) + +(define-widget 'ido-ubiquitous-match-spec 'lazy-notag + "Choice of exact, prefix, or regexp match." + :type `(choice :tag "Match type" + ,@ido-ubiquitous-match-spec-widget-types)) + +(define-widget 'ido-ubiquitous-command-override-spec 'lazy-notag + "Choice of override action plus match specification." + :type '(cons :tag "Override rule" + (choice :tag "For matching commands" + (const :menu-tag "Disable" + :tag "Disable ido-ubiquitous" + disable) + (const :menu-tag "Enable" + :tag "Enable ido-ubiquitous in normal default mode" + enable) + (const :menu-tag "Enable old-style default" + :tag "Enable ido-ubiquitous in old-style default mode" + enable-old)) + ido-ubiquitous-match-spec)) + +(define-widget 'ido-ubiquitous-function-override-spec 'lazy-notag + "Choice of override action and function name. (Exact match only.)" + :type '(list :tag "Override rule" + (choice :tag "Do the following" + (const :menu-tag "Disable" + :tag "Disable ido-ubiquitous" + disable) + (const :menu-tag "Enable" + :tag "Enable ido-ubiquitous in normal default mode" + enable) + (const :menu-tag "Enable old-style default" + :tag "Enable ido-ubiquitous in old-style default mode" + enable-old)) + (const :format "" exact) + (string :tag "For function"))) + +;;; Custom Declarations + +(defgroup ido-ubiquitous nil + "Use ido for (almost) all completion." + :group 'ido) + +;;;###autoload +(define-obsolete-variable-alias 'ido-ubiquitous + 'ido-ubiquitous-mode "0.8") +;;;###autoload +(define-obsolete-function-alias 'ido-ubiquitous + 'ido-ubiquitous-mode "0.8") + +;;;###autoload +(define-minor-mode ido-ubiquitous-mode + "Use `ido-completing-read' instead of `completing-read' almost everywhere. + + This mode has no effect unles `ido-mode' is also enabled. + + If this mode causes problems for a function, you can customize + when ido completion is or is not used by customizing + `ido-ubiquitous-command-overrides' or + `ido-ubiquitous-function-overrides'." + + nil + :global t + :group 'ido-ubiquitous + ;; Handle warning about ido disabled + (when ido-ubiquitous-mode + (ido-ubiquitous-warn-about-ido-disabled)) + ;; Ensure emacs 23 code disabled (in case user upgraded in this session) + (ignore-errors + (ad-disable-advice 'completing-read 'around 'ido-ubiquitous-legacy) + (ad-activate 'completing-read)) + ;; Actually enable/disable the mode + (setq completing-read-function + (if ido-ubiquitous-mode + 'completing-read-ido + (or ido-ubiquitous-fallback-completing-read-function + 'completing-read-default)))) + +(defcustom ido-ubiquitous-max-items 30000 + "Max collection size to use ido-ubiquitous on. + +If `ido-ubiquitous-mode' is active and `completing-read' is +called on a COLLECTION with greater than this number of items in +it, the fallback completion method will be used instead. To +disable fallback based on collection size, set this to nil." + :type '(choice (const :tag "No limit" nil) + (integer + :tag "Limit" :value 5000 + :validate + (lambda (widget) + (let ((v (widget-value widget))) + (if (and (integerp v) + (> v 0)) + nil + (widget-put widget :error "This field should contain a positive integer") + widget))))) + :group 'ido-ubiquitous) + +(defcustom ido-ubiquitous-fallback-completing-read-function + ;; Initialize to the current value of `completing-read-function', + ;; unless that is already set to the ido completer, in which case + ;; use `completing-read-default'. + (if (eq completing-read-function 'completing-read-ido) + 'completing-read-default + completing-read-function) + "Alternate completing-read function to use when ido is not wanted. + +This will be used for functions that are incompatibile with ido +or if ido cannot handle the completion arguments. + +If you turn off ido-ubiquitous mode, `completing-read-function' +will be set back to this." + :type '(choice (const :tag "Standard emacs completion" + completing-read-default) + (function :tag "Other function")) + :group 'ido-ubiquitous) + +(define-obsolete-variable-alias + 'ido-ubiquitous-enable-compatibility-globally + 'ido-ubiquitous-enable-old-style-default + "2.0") + +(defcustom ido-ubiquitous-enable-old-style-default t + "Allow ido to emulate a quirk of `completing-read'. + +From the `completing-read' docstring: + +> If the input is null, `completing-read' returns DEF, or the +> first element of the list of default values, or an empty string +> if DEF is nil, regardless of the value of REQUIRE-MATCH. + +If this variable is non-nil, then ido-ubiquitous will attempt to +emulate this behavior. Specifically, if RET is pressed +immediately upon entering completion, an empty string will be +returned instead of the first element in the list. This behavior +is only enabled when ido is being used as a substitute for +`completing-read', and not when it is used directly. + +This odd behavior is required for compatibility with an old-style +usage pattern whereby the default was requested by returning an +empty string. In this mode, the caller receives the empty string +and handles the default case manually, while `completing-read' +never has any knowledge of the default. This is a problem for +ido, which always returns the first element in the list when the +input is empty. Without knowledge of the default, it cannot +ensure that the default is first on the list, so returning the +first item is not the correct behavior. Instead, it must return +an empty string like `completing-read'. + +You can termporarily invert this behavior by prefixing \"RET\" +with \"C-u\". + +If you want to enable old-style default selection selectively for +specific commands or functions, set appropriate overrides in +`ido-ubiquitous-command-overrides' or +`ido-ubiquitous-function-overrides'." + :type 'boolean + :group 'ido-ubiquitous) + +(defconst ido-ubiquitous-default-command-overrides + '(;; If you want ido for M-x, install smex + (disable exact "execute-extended-command") + ;; https://github.com/technomancy/ido-ubiquitous/issues/13#issuecomment-8033522 + (enable prefix "wl-") + ;; https://github.com/technomancy/ido-ubiquitous/issues/7 + (enable-old prefix "Info-") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/4 + (enable exact "webjump") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/28 + (enable regexp "\\`\\(find\\|load\\|locate\\)-library\\'") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/37 + ;; Org and Magit already support ido natively + (disable prefix "org-") + (disable prefix "magit-") + ;; https://github.com/bbatsov/prelude/issues/488 + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/44 + ;; tmm implements its own non-standard completion mechanics + (disable prefix "tmm-") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/47 + ;; theme functions don't need old-style compatibility + (enable regexp "\\`\\(load\\|enable\\|disable\\|describe\\|custom-theme-visit-theme\\)-theme\\'") +) + "Default value of `ido-ubiquitous-command-overrides'. + +You can restore these using the command `ido-ubiquitous-restore-default-overrides'.") + +(defconst ido-ubiquitous-default-function-overrides + '((disable exact "read-file-name") + (disable exact "read-file-name-internal") + (disable exact "read-buffer") + (disable exact "gnus-emacs-completing-read") + (disable exact "gnus-iswitchb-completing-read") + (disable exact "grep-read-files") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/36 + (enable exact "bookmark-completing-read") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/4 + (enable-old exact "webjump-read-choice") + (enable-old exact "webjump-read-url-choice") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/9 + (disable exact "isearchp-read-unicode-char") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/37 + (disable exact "org-completing-read") + (disable exact "org-completing-read-no-i") + (disable exact "org-iswitchb-completing-read") + (disable exact "org-icompleting-read") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/38 + (enable exact "read-char-by-name") + ;; https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/39 + (disable exact "Info-read-node-name") + ;; https://github.com/purcell/emacs.d/issues/182#issuecomment-44212927 + (disable exact "tmm-menubar")) + "Default value of `ido-ubiquitous-function-overrides'. + +You can restore these using the command `ido-ubiquitous-restore-default-overrides'.") + +(defcustom ido-ubiquitous-command-overrides ido-ubiquitous-default-command-overrides + "List of command override specifications for ido-ubiquitous + +Each override specification describes how ido-ubiquitous should +behave one or many commands. A specification has the +form `(BEHAVIOR MATCH-TYPE MATCH-TEXT)'. BEHAVIOR is one of the +following: + + * `disable': ido-ubiquitous should not be used at all for the + specified commands; + * `enable': ido-ubiquitous may be used with the specified + commands, without emulating the old-style default selection + of `completing-read'; + * `enable-old': ido-ubiquitous may be used with the specified + commands, and should emulate the old-style default selection + of `completing-read'. + +MATCH-TYPE affects how MATCH-TEXT is interpreted, as follows: + + * `exact': the specification only affects the one command + whose name is MATCH-TEXT; + * `prefix': the specification affects any command whose name + starts with MATCH-TEXT (This is useful for specifying a + certain behavior for an entire package); + * `regexp': the specification affects any command whose name + matches MATCH-TEXT (with MATCH-TEXT being interpreted as a + regular expression) + +MATCH-TEXT should be a string. + +Since this variable's has a somewhat complex structure, it is +recommended that you set this variable through Customize. + +Note that this variable only affects *commands*, which are +functions marked as interactive. See +`ido-ubiquitous-function-overrides' for how to modify the +behavior of ido-ubiquitous for arbitrary functions. + +If you need to add a new specification to this list, please also +file a bug report at https://github.com/DarwinAwardWinner/ido-ubiquitous/issues" + :type '(repeat ido-ubiquitous-command-override-spec) + :group 'ido-ubiquitous) + +(defmacro ido-ubiquitous-with-override (override &rest body) + "Eval BODY with specicified OVERRIDE in place. + +The OVERRIDE argument is evaluated normally, so if it is a +literal symbol, it must be quoted. + +See `ido-ubiquitous-command-overrides' for valid override types." + ;; Eval override + `(let ((ido-ubiquitous-next-override ,override)) + ,@body)) +(put 'ido-ubiquitous-with-override 'lisp-indent-function + (get 'prog1 'lisp-indent-function)) + +(defun ido-ubiquitous-apply-function-override (func override) + "Set the override property on FUNC to OVERRIDE and set up advice to apply the override." + (setq func (ido-ubiquitous--as-symbol func) + override (ido-ubiquitous--as-symbol override)) + (put func 'ido-ubiquitous-override override) + (when override + (let ((docstring + (format "Override ido-ubiquitous behavior in %s if its `ido-ubiquitous-override' property is non-nil." func))) + (eval + `(defadvice ,func (around ido-ubiquitous-override activate) + ,docstring + (ido-ubiquitous-with-override + (get ',func 'ido-ubiquitous-override) + ad-do-it)))))) + +(defun ido-ubiquitous-set-function-overrides (sym newval) + "Custom setter function for `ido-ubiquitous-function-overrides'. + +In addition to setting the variable, this also sets up advice on +each function to apply the appropriate override." + ;; Unset all previous overrides + (when (boundp sym) + (let ((oldval (eval sym))) + (loop for (_action _match-type func) in oldval + do (ido-ubiquitous-apply-function-override func nil)))) + ;; Ensure that function names are strings, not symbols + (setq newval + (loop for (action match-type func) in newval + collect (list action match-type + (ido-ubiquitous--as-string func)))) + (set-default sym newval) + ;; set new overrides + (loop for (action _match-type func) in (eval sym) + do (ido-ubiquitous-apply-function-override func action))) + +(defcustom ido-ubiquitous-function-overrides ido-ubiquitous-default-function-overrides + "List of function override specifications for ido-ubiquitous + +Function override specifications have a similar structure to +command override specifications (see +`ido-ubiquitous-command-overrides'). A function override +specification has the form `(BEHAVIOR MATCH-TYPE MATCH-TEXT)'. +However, `MATCH-TYPE' may ONLY be `exact'; No other match type is +supported. + +If you need to add a new specification to this list, please also file a +bug report at https://github.com/DarwinAwardWinner/ido-ubiquitous/issues + +Setting this variable directly has no effect. You must set it +through Customize." + :type '(repeat ido-ubiquitous-function-override-spec) + :set 'ido-ubiquitous-set-function-overrides + :group 'ido-ubiquitous) + +(defcustom ido-ubiquitous-allow-on-functional-collection nil + "Allow ido completion when COLLECTION is a function. + +The `completing-read' function allows its COLLECTION argument to +be a function instead of a list of choices. Some such functions +simply return a list of completions and are suitable for use with +ido, but others implement more complex behavior and will result +in incorrect behavior if used with ido. Since there is no way to +tell the difference, this preference defaults to nil, which means +that ido-ubiquitous will not work when COLLECTION is a function +unless there is a specific override in effect. To disable this +safeguard and guarantee breakage on some functions, you may set +this to non-nil, but this is not recommended." + :type 'boolean + :group 'ido-ubiquitous) + +;;; ido-ubiquitous core + +(defvar ido-ubiquitous-next-call-replaces-completing-read nil + "If t, then the next call to `ido-completing-read' is by ido-ubiquitous.") +(defvar ido-ubiquitous-this-call-replaces-completing-read nil + "If t, then the current call to `ido-completing-read' is by ido-ubiquitous.") +(defvar ido-ubiquitous-next-override nil + "This holds the override to be applied on the next call to `completing-read'.") +(defvar ido-ubiquitous-active-override nil + "This holds the override being applied to the current call to `completing-read'.") + +(defun ido-ubiquitous-completing-read (&rest args) + "Wrapper for `ido-completing-read' that enables ido-ubiquitous features." + (let ((ido-ubiquitous-next-call-replaces-completing-read t)) + (apply 'ido-completing-read args))) + +(defadvice ido-completing-read (around detect-replacing-cr activate) + "Enable workarounds if this call was done through ido-ubiquitous. + +This advice implements the logic required for +`ido-completing-read' to handle a number of special cases that +`completing-read' can handle. It only has an effect if +`ido-completing-read' is called through +`ido-ubiquitous-completing-read', so other packages that use +`ido-completing-read', such as `smex', will not be affected." + (let* ((ido-ubiquitous-this-call-replaces-completing-read ido-ubiquitous-next-call-replaces-completing-read) + (ido-ubiquitous-next-call-replaces-completing-read nil) + (error-during-setup nil)) + (when ido-ubiquitous-this-call-replaces-completing-read + (condition-case nil + (progn + ;; ido doesn't natively handle DEF being a list. If DEF is + ;; a list, prepend it to CHOICES and set DEF to just the + ;; car of the default list. + (when (and def (listp def)) + (setq choices + (append def + (nreverse (cl-set-difference choices def))) + def (car def))) + ;; Work around a bug in ido when both INITIAL-INPUT and + ;; DEF are provided More info: + ;; https://github.com/technomancy/ido-ubiquitous/issues/18 + (let ((initial (cond ((null initial-input) "") + ((stringp initial-input) initial-input) + ((consp initial-input) (car initial-input)) + (t initial-input)))) + (when (and def initial + (stringp initial) + (not (string= initial ""))) + ;; Both default and initial input were provided. So + ;; keep the initial input and preprocess the choices + ;; list to put the default at the head, then proceed + ;; with default = nil. + (setq choices (cons def (remove def choices)) + def nil)))) + (error + (progn + (warn "ido-ubiquitous: failed during setup. Falling back to standard completion") + (setq error-during-setup t))))) + ;; For ido-ubiquitous, only attempt ido completion if setup + ;; completed without error + (if (not error-during-setup) + ad-do-it + (setq ad-return-value + (funcall + ido-ubiquitous-fallback-completing-read-function + prompt choices predicate require-match initial-input + hist def inherit-input-method))))) + +(defun completing-read-ido (prompt collection &optional predicate + require-match initial-input + hist def inherit-input-method) + "ido-based method for reading from the minibuffer with completion. + +See `completing-read' for the meaning of the arguments. + +This function is a wrapper for `ido-completing-read' designed to +be used as the value of `completing-read-function'. Importantly, +it detects edge cases that ido cannot handle and uses normal +completion for them." + (let* (;; Set the active override and clear the "next" one so it + ;; doesn't apply to nested calls. + (ido-ubiquitous-active-override ido-ubiquitous-next-override) + (ido-ubiquitous-next-override nil) + ;; Check for conditions that ido can't or shouldn't handle + (ido-allowed + (and ido-mode + ido-ubiquitous-mode + ;; Check for disable override + (not (eq ido-ubiquitous-active-override 'disable)) + ;; Can't handle this arg + (not inherit-input-method) + ;; Can't handle this being set + (not (bound-and-true-p completion-extra-properties)))) + ;; Check if ido can handle this collection. If collection is + ;; a function, require an override to be ok. Also, + ;; collection-ok should never be true when ido-allowed is + ;; false. + (collection-ok + (and ido-allowed + (or ido-ubiquitous-allow-on-functional-collection + (not (functionp collection)) + (memq ido-ubiquitous-active-override '(enable enable-old))))) + ;; Pre-expand list of possible completions, but only if we + ;; have a chance of using ido. This is executed after the + ;; ido-allowed check to avoid unnecessary work if ido isn't + ;; going to used. + (_ignore ;; (Return value doesn't matter). + (when (and ido-allowed collection-ok) + (setq collection (all-completions "" collection predicate) + ;; Don't need this any more + predicate nil))) + (collection-ok + ;; Don't use ido if the collection is empty or too large. + (and collection-ok + collection + (or (null ido-ubiquitous-max-items) + (<= (length collection) ido-ubiquitous-max-items)))) + ;; Final check for everything + (ido-allowed (and ido-allowed collection-ok)) + (comp-read-fun + (if ido-allowed + 'ido-ubiquitous-completing-read + ido-ubiquitous-fallback-completing-read-function))) + (funcall comp-read-fun + prompt collection predicate + require-match initial-input + hist def inherit-input-method))) + +;;; Old-style default support + +(defvar ido-ubiquitous-initial-item nil + "The first item selected when ido starts. + +This is initialized to the first item in the list of completions +when ido starts, and is cleared when any character is entered +into the prompt or the list is cycled. If it is non-nil and still +equal to the first item in the completion list when ido exits, +then if `ido-ubiquitous-enable-old-style-default' is +non-nil, ido returns an empty string instead of the first item on +the list.") + +(defadvice ido-read-internal (before clear-initial-item activate) + (setq ido-ubiquitous-initial-item nil)) + +(defadvice ido-make-choice-list (after set-initial-item activate) + (when (and ad-return-value (listp ad-return-value)) + (setq ido-ubiquitous-initial-item (car ad-return-value)))) + +(defadvice ido-next-match (after clear-initial-item activate) + (setq ido-ubiquitous-initial-item nil)) + +(defadvice ido-prev-match (after clear-initial-item activate) + (setq ido-ubiquitous-initial-item nil)) + +(defadvice ido-exit-minibuffer (around compatibility activate) + "Emulate a quirk of `completing-read'. + +> If the input is null, `completing-read' returns DEF, or the +> first element of the list of default values, or an empty string +> if DEF is nil, regardless of the value of REQUIRE-MATCH. + +See `ido-ubiquitous-enable-old-style-default', which +controls whether this advice has any effect." + (condition-case nil + (let* ((enable-oldstyle + (and + ;; Completing a list, not a buffer or file + (eq ido-cur-item 'list) + ;; Only enable if we are replacing `completing-read' + ido-ubiquitous-this-call-replaces-completing-read + ;; Default is nil + (null ido-default-item) + ;; Input is empty + (string= ido-text "") + ;; Old-style default enabled + (if ido-ubiquitous-active-override + (eq ido-ubiquitous-active-override 'enable-old) + ido-ubiquitous-enable-old-style-default) + ;; First item on the list hasn't changed + (string= (car ido-cur-list) + ido-ubiquitous-initial-item))) + ;; Prefix inverts oldstyle behavior + (should-invert current-prefix-arg) + (actually-enable-oldstyle + (if should-invert (not enable-oldstyle) enable-oldstyle))) + (if actually-enable-oldstyle + (ido-select-text) + ad-do-it)) + (error ad-do-it)) + (setq ido-ubiquitous-initial-item nil)) + +;;; Overrides + +(defun ido-ubiquitous-restore-default-overrides (&optional save) + "Re-add the default overrides for ido-ubiquitous. + +This will ensure that the default overrides are all present and +at the head of the list in `ido-ubiquitous-command-overrides' and +`ido-ubiquitous-function-overrides'. User-added overrides will +not be removed, but they may be masked if one of the default +overrides affects the same functions. + +With a prefix arg, also save the above variables' new values for +future sessions." + (interactive "P") + (let ((setter (if save + 'customize-save-variable + 'customize-set-variable))) + (loop for (var def) in '((ido-ubiquitous-command-overrides + ido-ubiquitous-default-command-overrides) + (ido-ubiquitous-function-overrides + ido-ubiquitous-default-function-overrides)) + do (let* ((curval (eval var)) + (defval (eval def)) + (newval (delete-dups (append defval curval)))) + (funcall setter var newval))) + (message (if save + "ido-ubiquitous: Restored default command and function overrides and saved for future sessions." + "ido-ubiquitous: Restored default command and function overrides for current session only.")))) + +(defun ido-ubiquitous-spec-match (spec symbol) + "Returns t if SPEC matches SYMBOL (which should be a function name). + +See `ido-ubiquitous-command-overrides'." + (when (and symbol (symbolp symbol)) + (destructuring-bind (type text) spec + (let ((matcher (cdr (assoc type ido-ubiquitous-spec-matchers))) + (text (ido-ubiquitous--as-string text)) + (symname (ido-ubiquitous--as-string symbol))) + (when (null matcher) + (error "ido-ubiquitous: Unknown match spec type \"%s\". See `ido-ubiquitous-spec-matchers' for valid types." type)) + (funcall matcher text symname))))) + +(defun ido-ubiquitous-get-command-override (cmd) + "Return the override associated with the command CMD. + +If there is no override set for CMD in +`ido-ubiquitous-command-overrides', return nil." + (when (and cmd (symbolp cmd)) + (loop for (action . spec) in ido-ubiquitous-command-overrides + when (memq action '(disable enable enable-old nil)) + when (ido-ubiquitous-spec-match spec cmd) + return action + finally return nil))) + +;;; Workaround for https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/24 + +;; When `call-interactively' is advised, `called-interactively-p' +;; always returns nil. So we redefine it (and `interactive-p') to test +;; the correct condition. + +(defsubst ido-ubiquitous--looks-like-advised-orig (func) + "Returns t if FUNC is a symbol starting with \"ad-Orig-\". + +Such symbols are used to store the original definitions of +functions that have been advised by `defadvice' or similar." + (and (symbolp func) + (string-prefix-p "ad-Orig-" (symbol-name func)))) + +(defsubst ido-ubiquitous--looks-like-call-interactively (func) + "Returns t if FUNC looks like the function `call-interactively'. + +FUNC \"looks like\" `call-interactively' if it is the literal +symbol `call-interactively', or the value of `(symbol-function +'call-interactively)', or a symbol whose `symbol-function' is the +same as that of `call-interactively'. + +This function is used to determine whether a given function was +\"called by\" `call-interactively' and therefore was called +interactively." + (when func + (eq (symbol-function 'call-interactively) + (if (symbolp func) + (symbol-function func) + func)))) + +(defun ido-ubiquitous--backtrace-from (fun) + "Return all backtrace frames, starting with the one for FUN. + +FUN may be a list of functions, in which case the first one found +on the stack will be used." + (let ((stack + (loop for i upfrom 0 + for frame = (backtrace-frame i) + while frame + collect frame)) + (funcs (if (functionp fun) + (list fun) + fun))) + (while (and stack + (not (memq (cadar stack) funcs))) + (setq stack (cdr stack))) + stack)) + +(defun ido-ubiquitous--clean-advice-from-backtrace (stack) + "Takes a stack trace and cleans all evidence of advice. + +Specifically, for each call to a function starting with +\"ad-Orig-\", that call and all prior calls up to but not +including the advised function's original name are deleted from +the stack." + (let ((skipping-until nil)) + (loop for frame in stack + for func = (cadr frame) + ;; Check if we found the frame we we're skipping to + if (and skipping-until + (eq func skipping-until)) + do (setq skipping-until nil) + ;; If we're looking at an the original form of an advised + ;; function, skip until the real name of that function. + if (and (not skipping-until) + (ido-ubiquitous--looks-like-advised-orig func)) + do (setq skipping-until + (intern + (substring (symbol-name func) + (eval-when-compile (length "ad-Orig-"))))) + unless skipping-until collect frame))) + +(defsubst ido-ubiquitous--interactive-internal () + "Eqivalent of the INTERACTIVE macro in the Emacs C source. + +This is an internal function that should never be called +directly. + +See the C source for the logic behind this function." + (and (not executing-kbd-macro) + (not noninteractive))) + +(defun ido-ubiquitous--interactive-p-internal () + "Equivalent of C function \"interactive_p\". + +This is an internal function that should never be called +directly. + +See the C source for the logic behind this function." + (let ((stack + ;; We clean advice from the backtrace. This ensures that we + ;; get the right answer even if `call-interactively' has been + ;; advised. + (ido-ubiquitous--clean-advice-from-backtrace + (cdr + (ido-ubiquitous--backtrace-from + '(called-interactively-p interactive-p)))))) + ;; See comments in the C function for the logic here. + (while (and stack + (or (eq (cadar stack) 'bytecode) + (null (caar stack)))) + (setq stack (cdr stack))) + ;; Top of stack is now the function that we want to know + ;; about. Pop it, then check if the next function is + ;; `call-interactively', using a more permissive test than the default. + (ido-ubiquitous--looks-like-call-interactively (cadadr stack)))) + +(defadvice call-interactively (around ido-ubiquitous activate) + "Implements the behavior specified in `ido-ubiquitous-command-overrides'." + (ido-ubiquitous-with-override + (ido-ubiquitous-get-command-override (ad-get-arg 0)) + ad-do-it)) + +;; Work around `called-interactively-p' in Emacs 24.3 and earlier, +;; which always returns nil when `call-interactively' is advised. +(when (not (and (featurep 'nadvice) + (boundp 'called-interactively-p-functions))) + + (defadvice interactive-p (around ido-ubiquitous activate) + "Return the correct result when `call-interactively' is advised. + +This advice completely overrides the original definition." + (condition-case nil + (setq ad-return-value + (and (ido-ubiquitous--interactive-internal) + (ido-ubiquitous--interactive-p-internal))) + ;; In case of error in the advice, fall back to the default + ;; implementation + (error ad-do-it))) + + (defadvice called-interactively-p (around ido-ubiquitous activate) + "Return the correct result when `call-interactively' is advised. + +This advice completely overrides the original definition." + (condition-case nil + (setq ad-return-value + (and (or (ido-ubiquitous--interactive-internal) + (not (eq kind 'interactive))) + (ido-ubiquitous--interactive-p-internal))) + ;; In case of error in the advice, fall back to the default + ;; implementation + (error ad-do-it)))) + +;;; Other + +(defun ido-ubiquitous-warn-about-ido-disabled () + "Warn if ido-ubiquitous is enabled without ido. + +Don't warn if emacs is still initializing, since ido-ubiquitous +could be enabled first during init." + (when (and ido-ubiquitous-mode + after-init-time + (not (bound-and-true-p ido-mode))) + (warn "ido-ubiquitous-mode enabled without ido mode. ido-ubiquitous requires ido mode to be enabled."))) + +(defun ido-ubiquitous-initialize () + "Do initial setup for ido-ubiquitous. + +This only needs to be called once when the file is first loaded." + ;; Clean up old versions of ido-ubiquitous that defined advice on + ;; `completing-read' instead of modifying + ;; `completing-read-function'. + (when (ad-find-advice 'completing-read 'around 'ido-ubiquitous) + (ad-remove-advice 'completing-read 'around 'ido-ubiquitous) + (ad-activate 'completing-read)) + ;; Make sure the mode is turned on/off as specified by the value of + ;; the mode variable + (ido-ubiquitous-mode (if ido-ubiquitous-mode 1 0))) +(ido-ubiquitous-initialize) + +(provide 'ido-ubiquitous) + +;;; ido-ubiquitous.el ends here diff --git a/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous.elc b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous.elc new file mode 100644 index 000000000..17ebfa85d Binary files /dev/null and b/elpa/ido-ubiquitous-20140526.1306/ido-ubiquitous.elc differ diff --git a/elpa/inf-ruby-20140809.416/inf-ruby-autoloads.el b/elpa/inf-ruby-20140809.416/inf-ruby-autoloads.el new file mode 100644 index 000000000..4ed47ec2b --- /dev/null +++ b/elpa/inf-ruby-20140809.416/inf-ruby-autoloads.el @@ -0,0 +1,103 @@ +;;; inf-ruby-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (inf-ruby-file-contents-match inf-ruby-console-default +;;;;;; inf-ruby-console-gem inf-ruby-console-rails inf-ruby-console-auto +;;;;;; inf-ruby-switch-setup run-ruby inf-ruby inf-ruby-minor-mode +;;;;;; inf-ruby-setup-keybindings) "inf-ruby" "inf-ruby.el" (21478 +;;;;;; 16680 0 0)) +;;; Generated autoloads from inf-ruby.el + +(defvar ruby-source-modes '(ruby-mode enh-ruby-mode) "\ +Used to determine if a buffer contains Ruby source code. +If it's loaded into a buffer that is in one of these major modes, it's +considered a ruby source file by `ruby-load-file'. +Used by these commands to determine defaults.") + +(autoload 'inf-ruby-setup-keybindings "inf-ruby" "\ +Hook up `inf-ruby-minor-mode' to each of `ruby-source-modes'. + +\(fn)" nil nil) + +(autoload 'inf-ruby-minor-mode "inf-ruby" "\ +Minor mode for interacting with the inferior process buffer. + +The following commands are available: + +\\{inf-ruby-minor-mode-map} + +\(fn &optional ARG)" t nil) + +(autoload 'inf-ruby "inf-ruby" "\ +Run an inferior Ruby process in a buffer. +With prefix argument, prompts for which Ruby implementation +\(from the list `inf-ruby-implementations') to use. Runs the +hooks `inf-ruby-mode-hook' (after the `comint-mode-hook' is +run). + +\(fn &optional IMPL)" t nil) + +(autoload 'run-ruby "inf-ruby" "\ +Run an inferior Ruby process, input and output via buffer `*NAME*'. +If there is a process already running in `*NAME*', switch to that buffer. + +NAME defaults to \"ruby\". COMMAND defaults to the default entry +in `inf-ruby-implementations'. + +\(Type \\[describe-mode] in the process buffer for the list of commands.) + +\(fn &optional COMMAND NAME)" t nil) + +(autoload 'inf-ruby-switch-setup "inf-ruby" "\ +Modify `rspec-compilation-mode' and `ruby-compilation-mode' +keymaps to bind `inf-ruby-switch-from-compilation' to `С-x C-q'. + +\(fn)" nil nil) + +(autoload 'inf-ruby-console-auto "inf-ruby" "\ +Run the appropriate Ruby console command. +The command and and the directory to run it from are detected +automatically. + +\(fn)" t nil) + +(autoload 'inf-ruby-console-rails "inf-ruby" "\ +Run Rails console in DIR. + +\(fn DIR)" t nil) + +(autoload 'inf-ruby-console-gem "inf-ruby" "\ +Run IRB console for the gem in DIR. +The main module should be loaded automatically. If DIR contains a +Gemfile, it should use the `gemspec' instruction. + +\(fn DIR)" t nil) + +(autoload 'inf-ruby-console-default "inf-ruby" "\ +Run racksh, custom console.rb, or just IRB, in DIR. + +\(fn DIR)" t nil) + +(autoload 'inf-ruby-file-contents-match "inf-ruby" "\ + + +\(fn FILE REGEXP &optional MATCH-GROUP)" nil nil) + (dolist (mode ruby-source-modes) (add-hook (intern (format "%s-hook" mode)) 'inf-ruby-minor-mode)) + +;;;*** + +;;;### (autoloads nil nil ("inf-ruby-pkg.el") (21478 16680 797816 +;;;;;; 0)) + +;;;*** + +(provide 'inf-ruby-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; inf-ruby-autoloads.el ends here diff --git a/elpa/inf-ruby-20140809.416/inf-ruby-pkg.el b/elpa/inf-ruby-20140809.416/inf-ruby-pkg.el new file mode 100644 index 000000000..6cbc66d0c --- /dev/null +++ b/elpa/inf-ruby-20140809.416/inf-ruby-pkg.el @@ -0,0 +1 @@ +(define-package "inf-ruby" "20140809.416" "Run a Ruby process in a buffer" (quote nil)) diff --git a/elpa/inf-ruby-20140809.416/inf-ruby-pkg.elc b/elpa/inf-ruby-20140809.416/inf-ruby-pkg.elc new file mode 100644 index 000000000..2bfef2974 Binary files /dev/null and b/elpa/inf-ruby-20140809.416/inf-ruby-pkg.elc differ diff --git a/elpa/inf-ruby-20140809.416/inf-ruby.el b/elpa/inf-ruby-20140809.416/inf-ruby.el new file mode 100644 index 000000000..6de18a7af --- /dev/null +++ b/elpa/inf-ruby-20140809.416/inf-ruby.el @@ -0,0 +1,721 @@ +;;; inf-ruby.el --- Run a Ruby process in a buffer + +;; Copyright (C) 1999-2008 Yukihiro Matsumoto, Nobuyoshi Nakada + +;; Author: Yukihiro Matsumoto +;; Nobuyoshi Nakada +;; Cornelius Mika +;; Dmitry Gutov +;; Kyle Hargraves +;; URL: http://github.com/nonsequitur/inf-ruby +;; Created: 8 April 1998 +;; Keywords: languages ruby +;; Version: 20140809.416 +;; X-Original-Version: 2.3.2 + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: +;; +;; inf-ruby provides a REPL buffer connected to a Ruby subprocess. +;; +;; If you're installing manually, you'll need to: +;; * drop the file somewhere on your load path (perhaps ~/.emacs.d) +;; * Add the following lines to your .emacs file: +;; +;; (autoload 'inf-ruby "inf-ruby" "Run an inferior Ruby process" t) +;; (add-hook 'ruby-mode-hook 'inf-ruby-minor-mode) +;; +;; Or, for enh-ruby-mode: +;; +;; (add-hook 'enh-ruby-mode-hook 'inf-ruby-minor-mode) +;; +;; Installation via ELPA interface does the above for you +;; automatically. +;; +;; Additionally, consider adding +;; +;; (add-hook 'after-init-hook 'inf-ruby-switch-setup) +;; +;; to your init file to easily switch from common Ruby compilation +;; modes to interact with a debugger. +;; +;; To call `inf-ruby-console-auto' more easily, you can, for example, +;; replace the original `inf-ruby' binding: +;; +;; (eval-after-load 'inf-ruby +;; '(define-key inf-ruby-minor-mode-map +;; (kbd "C-c C-s") 'inf-ruby-console-auto)) + +;;; Code: + +(require 'comint) +(require 'compile) +(require 'ruby-mode) +(require 'thingatpt) + +(eval-when-compile + (defvar rspec-compilation-mode-map) + (defvar ruby-compilation-mode-map)) + +(defgroup inf-ruby nil + "Run Ruby process in a buffer" + :group 'languages) + +(defcustom inf-ruby-prompt-read-only t + "If non-nil, the prompt will be read-only. + +Also see the description of `ielm-prompt-read-only'.") + +(defvar inf-ruby-default-implementation "ruby" + "Which Ruby implementation to use if none is specified.") + +(defconst inf-ruby-prompt-format + (concat + (mapconcat + #'identity + '("\\(^%s> *\\)" ; Simple + "\\(^(rdb:1) *\\)" ; Debugger + "\\(^(byebug) *\\)" ; byebug + "\\(^\\(irb([^)]+)" ; IRB default + "\\([[0-9]+] \\)?[Pp]ry ?([^)]+)" ; Pry + "\\(jruby-\\|JRUBY-\\)?[1-9]\\.[0-9]\\.[0-9]+\\(-?p?[0-9]+\\)?" ; RVM + "^rbx-head\\)") ; RVM continued + "\\|") + ;; Statement and nesting counters, common to the last four. + " ?[0-9:]* ?%s *\\)") + "Format string for the prompt regexp pattern. +Two placeholders: first char in the Simple prompt, and the last +graphical char in all other prompts.") + +(defvar inf-ruby-first-prompt-pattern (format inf-ruby-prompt-format ">" ">") + "First prompt regex pattern of Ruby interpreter.") + +(defvar inf-ruby-prompt-pattern (format inf-ruby-prompt-format "[?>]" "[\]>*\"'/`]") + "Prompt regex pattern of Ruby interpreter.") + +(defvar inf-ruby-mode-hook nil + "Hook for customizing `inf-ruby-mode'.") + +(defvar inf-ruby-mode-map + (let ((map (copy-keymap comint-mode-map))) + (define-key map (kbd "C-c C-l") 'ruby-load-file) + (define-key map (kbd "C-x C-e") 'ruby-send-last-sexp) + (define-key map (kbd "TAB") 'inf-ruby-complete) + (define-key map (kbd "C-x C-q") 'inf-ruby-maybe-switch-to-compilation) + (define-key map (kbd "C-c C-z") 'ruby-switch-to-last-ruby-buffer) + map) + "Mode map for `inf-ruby-mode'.") + +(defvar inf-ruby-implementations + '(("ruby" . "irb --prompt default --noreadline -r irb/completion") + ("jruby" . "jruby -S irb --prompt default --noreadline -r irb/completion") + ("rubinius" . "rbx -r irb/completion") + ("yarv" . "irb1.9 -r irb/completion") + ("macruby" . "macirb -r irb/completion") + ("pry" . "pry")) + "An alist of ruby implementations to irb executable names.") + +;;;###autoload +(defvar ruby-source-modes '(ruby-mode enh-ruby-mode) + "Used to determine if a buffer contains Ruby source code. +If it's loaded into a buffer that is in one of these major modes, it's +considered a ruby source file by `ruby-load-file'. +Used by these commands to determine defaults.") + +(defvar ruby-prev-l/c-dir/file nil + "Caches the last (directory . file) pair. +Caches the last pair used in the last `ruby-load-file' command. +Used for determining the default in the +next one.") + +(defvar inf-ruby-at-top-level-prompt-p t) +(make-variable-buffer-local 'inf-ruby-at-top-level-prompt-p) + +(defvar inf-ruby-last-prompt nil) +(make-variable-buffer-local 'inf-ruby-last-prompt) + +(defconst inf-ruby-error-regexp-alist + '(("SyntaxError: \\(?:compile error\n\\)?\\([^\(].*\\):\\([1-9][0-9]*\\):" 1 2) + ("^\tfrom \\([^\(].*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?$" 1 2))) + +;;;###autoload +(defun inf-ruby-setup-keybindings () + "Hook up `inf-ruby-minor-mode' to each of `ruby-source-modes'." + (warn "`inf-ruby-setup-keybindings' is deprecated, please don't use it anymore.") + (warn "If you're using `inf-ruby' from Git, please look up the new usage instructions.")) + +(make-obsolete 'inf-ruby-setup-keybindings 'add-hook "2.3.1") + +(defvar inf-ruby-minor-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-M-x") 'ruby-send-definition) + (define-key map (kbd "C-x C-e") 'ruby-send-last-sexp) + (define-key map (kbd "C-c C-b") 'ruby-send-block) + (define-key map (kbd "C-c M-b") 'ruby-send-block-and-go) + (define-key map (kbd "C-c C-x") 'ruby-send-definition) + (define-key map (kbd "C-c M-x") 'ruby-send-definition-and-go) + (define-key map (kbd "C-c C-r") 'ruby-send-region) + (define-key map (kbd "C-c M-r") 'ruby-send-region-and-go) + (define-key map (kbd "C-c C-z") 'ruby-switch-to-inf) + (define-key map (kbd "C-c C-l") 'ruby-load-file) + (define-key map (kbd "C-c C-s") 'inf-ruby) + map)) + +;;;###autoload +(define-minor-mode inf-ruby-minor-mode + "Minor mode for interacting with the inferior process buffer. + +The following commands are available: + +\\{inf-ruby-minor-mode-map}" + :lighter "" :keymap inf-ruby-minor-mode-map) + +(defvar inf-ruby-buffer nil "Current Ruby process buffer.") + +(defun inf-ruby-mode () + "Major mode for interacting with an inferior Ruby REPL process. + +A simple IRB process can be fired up with \\[inf-ruby]. + +To launch a REPL with project-specific console instead, type +\\[inf-ruby-console-auto]. It recognizes several +project types, including Rails, gems and anything with `racksh' +in their Gemfile. + +Customization: When entered, this mode runs `comint-mode-hook' and +`inf-ruby-mode-hook' (in that order). + +You can send text to the inferior Ruby process from other buffers containing +Ruby source. + + `ruby-switch-to-inf' switches the current buffer to the ruby process buffer. + `ruby-send-definition' sends the current definition to the ruby process. + `ruby-send-region' sends the current region to the ruby process. + `ruby-send-definition-and-go' and `ruby-send-region-and-go' + switch to the ruby process buffer after sending their text. + +Commands: +`RET' after the end of the process' output sends the text from the + end of process to point. +`RET' before the end of the process' output copies the sexp ending at point + to the end of the process' output, and sends it. +`DEL' converts tabs to spaces as it moves back. +`TAB' completes the input at point. IRB, Pry and Bond completion is supported. +`C-M-q' does `TAB' on each line starting within following expression. +Paragraphs are separated only by blank lines. # start comments. +If you accidentally suspend your process, use \\[comint-continue-subjob] +to continue it. + +The following commands are available: + +\\{inf-ruby-mode-map}" + (interactive) + (let ((orig-mode-line-process mode-line-process)) + (comint-mode) + (when orig-mode-line-process + (setq mode-line-process orig-mode-line-process))) + (setq comint-prompt-regexp inf-ruby-prompt-pattern) + (ruby-mode-variables) + (setq major-mode 'inf-ruby-mode) + (setq mode-name "Inf-Ruby") + (use-local-map inf-ruby-mode-map) + (add-hook 'comint-output-filter-functions 'inf-ruby-output-filter nil t) + (setq comint-get-old-input 'inf-ruby-get-old-input) + (set (make-local-variable 'compilation-error-regexp-alist) + inf-ruby-error-regexp-alist) + (set (make-local-variable 'comint-prompt-read-only) inf-ruby-prompt-read-only) + (when (eq system-type 'windows-nt) + (setq comint-process-echoes t)) + (compilation-shell-minor-mode t) + (run-hooks 'inf-ruby-mode-hook)) + +(defun inf-ruby-output-filter (output) + "Check if the current prompt is a top-level prompt." + (unless (zerop (length output)) + (setq inf-ruby-last-prompt (car (last (split-string output "\n"))) + inf-ruby-at-top-level-prompt-p + (string-match inf-ruby-first-prompt-pattern + inf-ruby-last-prompt)))) + +;; adapted from replace-in-string in XEmacs (subr.el) +(defun inf-ruby-remove-in-string (str regexp) + "Remove all matches in STR for REGEXP and returns the new string." + (let ((rtn-str "") (start 0) match prev-start) + (while (setq match (string-match regexp str start)) + (setq prev-start start + start (match-end 0) + rtn-str (concat rtn-str (substring str prev-start match)))) + (concat rtn-str (substring str start)))) + +(defun inf-ruby-get-old-input () + "Snarf the sexp ending at point." + (save-excursion + (let ((end (point))) + (re-search-backward inf-ruby-first-prompt-pattern) + (inf-ruby-remove-in-string (buffer-substring (point) end) + inf-ruby-prompt-pattern)))) + +;;;###autoload +(defun inf-ruby (&optional impl) + "Run an inferior Ruby process in a buffer. +With prefix argument, prompts for which Ruby implementation +\(from the list `inf-ruby-implementations') to use. Runs the +hooks `inf-ruby-mode-hook' \(after the `comint-mode-hook' is +run)." + + (interactive (list (if current-prefix-arg + (completing-read "Ruby Implementation: " + (mapc #'car inf-ruby-implementations)) + inf-ruby-default-implementation))) + (setq impl (or impl "ruby")) + + (let ((command (cdr (assoc impl inf-ruby-implementations)))) + (run-ruby command impl))) + +;;;###autoload +(defun run-ruby (&optional command name) + "Run an inferior Ruby process, input and output via buffer `*NAME*'. +If there is a process already running in `*NAME*', switch to that buffer. + +NAME defaults to \"ruby\". COMMAND defaults to the default entry +in `inf-ruby-implementations'. + +\(Type \\[describe-mode] in the process buffer for the list of commands.)" + + (interactive) + (setq command (or command (cdr (assoc inf-ruby-default-implementation + inf-ruby-implementations)))) + (setq name (or name "ruby")) + + (if (not (comint-check-proc inf-ruby-buffer)) + (let ((commandlist (split-string-and-unquote command)) + (buffer (current-buffer)) + (process-environment process-environment)) + ;; http://debbugs.gnu.org/15775 + (setenv "PAGER" (executable-find "cat")) + (set-buffer (apply 'make-comint name (car commandlist) + nil (cdr commandlist))) + (inf-ruby-mode) + (ruby-remember-ruby-buffer buffer))) + (pop-to-buffer (setq inf-ruby-buffer (format "*%s*" name)))) + +(defun inf-ruby-proc () + "Return the current inferior Ruby process. + +See variable `inf-ruby-buffer'." + (or (get-buffer-process (if (eq major-mode 'inf-ruby-mode) + (current-buffer) + inf-ruby-buffer)) + (error "No current process. See variable inf-ruby-buffer"))) + +;; These commands are added to the ruby-mode keymap: + +(defconst ruby-send-terminator "--inf-ruby-%x-%d-%d-%d--" + "Template for irb here document terminator. +Must not contain ruby meta characters.") + +(defconst inf-ruby-eval-binding + (concat "(IRB.conf[:MAIN_CONTEXT] && IRB.conf[:MAIN_CONTEXT].workspace.binding) || " + "(defined?(Pry) && Pry.toplevel_binding)")) + +(defconst ruby-eval-separator "") + +(defun ruby-send-region (start end) + "Send the current region to the inferior Ruby process." + (interactive "r") + (let (term (file (or buffer-file-name (buffer-name))) line) + (save-excursion + (save-restriction + (widen) + (goto-char start) + (setq line (+ start (forward-line (- start)) 1)) + (goto-char start) + (while (progn + (setq term (apply 'format ruby-send-terminator (random) (current-time))) + (re-search-forward (concat "^" (regexp-quote term) "$") end t))))) + ;; compilation-parse-errors parses from second line. + (save-excursion + (let ((m (process-mark (inf-ruby-proc)))) + (set-buffer (marker-buffer m)) + (goto-char m) + (insert ruby-eval-separator "\n") + (set-marker m (point)))) + (comint-send-string (inf-ruby-proc) (format "eval <<'%s', %s, %S, %d\n" + term inf-ruby-eval-binding + file line)) + (comint-send-region (inf-ruby-proc) start end) + (comint-send-string (inf-ruby-proc) (concat "\n" term "\n")))) + +(defun ruby-send-definition () + "Send the current definition to the inferior Ruby process." + (interactive) + (save-excursion + (ruby-end-of-defun) + (let ((end (point))) + (ruby-beginning-of-defun) + (ruby-send-region (point) end)))) + +(defun ruby-send-last-sexp () + "Send the previous sexp to the inferior Ruby process." + (interactive) + (ruby-send-region (save-excursion (ruby-backward-sexp) (point)) (point))) + +(defun ruby-send-block () + "Send the current block to the inferior Ruby process." + (interactive) + (save-excursion + (ruby-end-of-block) + (end-of-line) + (let ((end (point))) + (ruby-beginning-of-block) + (ruby-send-region (point) end)))) + +(defvar ruby-last-ruby-buffer nil + "The last buffer we switched to `inf-ruby' from.") + +(defun ruby-remember-ruby-buffer (buffer) + (setq ruby-last-ruby-buffer buffer)) + +(defun ruby-switch-to-inf (eob-p) + "Switch to the ruby process buffer. +With argument, positions cursor at end of buffer." + (interactive "P") + (let ((buffer (current-buffer))) + (if (and inf-ruby-buffer (get-buffer inf-ruby-buffer)) + (progn + (pop-to-buffer inf-ruby-buffer) + (ruby-remember-ruby-buffer buffer)) + (error "No current process buffer, see variable inf-ruby-buffer"))) + (cond (eob-p + (push-mark) + (goto-char (point-max))))) + +(defun ruby-switch-to-last-ruby-buffer () + "Switch back to the last Ruby buffer." + (interactive) + (if (and ruby-last-ruby-buffer + (buffer-live-p ruby-last-ruby-buffer)) + (pop-to-buffer ruby-last-ruby-buffer) + (message "Don't know the original Ruby buffer"))) + +(defun ruby-send-region-and-go (start end) + "Send the current region to the inferior Ruby process. +Then switch to the process buffer." + (interactive "r") + (ruby-send-region start end) + (ruby-switch-to-inf t)) + +(defun ruby-send-definition-and-go () + "Send the current definition to the inferior Ruby. +Then switch to the process buffer." + (interactive) + (ruby-send-definition) + (ruby-switch-to-inf t)) + +(defun ruby-send-block-and-go () + "Send the current block to the inferior Ruby. +Then switch to the process buffer." + (interactive) + (ruby-send-block) + (ruby-switch-to-inf t)) + +(defun ruby-load-file (file-name) + "Load a Ruby file into the inferior Ruby process." + (interactive (comint-get-source "Load Ruby file: " ruby-prev-l/c-dir/file + ruby-source-modes t)) ;; T because LOAD needs an exact name + (comint-check-source file-name) ; Check to see if buffer needs saved. + (setq ruby-prev-l/c-dir/file (cons (file-name-directory file-name) + (file-name-nondirectory file-name))) + (comint-send-string (inf-ruby-proc) (concat "(load \"" + file-name + "\"\)\n"))) + +(defun ruby-escape-single-quoted (str) + "Escape single quotes, double quotes and newlines in STR." + (replace-regexp-in-string "'" "\\\\'" + (replace-regexp-in-string "\n" "\\\\n" + (replace-regexp-in-string "\\\\" "\\\\\\\\" str)))) + +(defun inf-ruby-completions (expr) + "Return a list of completions for the Ruby expression starting with EXPR." + (let* ((proc (inf-ruby-proc)) + (line (buffer-substring (save-excursion (move-beginning-of-line 1) + (point)) + (point))) + (comint-filt (process-filter proc)) + (kept "") completions + ;; Guard against running completions in parallel: + inf-ruby-at-top-level-prompt-p) + (unless (equal "(rdb:1) " inf-ruby-last-prompt) + (set-process-filter proc (lambda (proc string) (setq kept (concat kept string)))) + (unwind-protect + (let ((completion-snippet + (format + (concat + "proc { |expr, line|" + " require 'ostruct';" + " old_wp = defined?(Bond) && Bond.started? && Bond.agent.weapon;" + " begin" + " Bond.agent.instance_variable_set('@weapon'," + " OpenStruct.new(line_buffer: line)) if old_wp;" + " if defined?(_pry_.complete) then" + " puts _pry_.complete(expr)" + " else" + " completer = if defined?(_pry_) then" + " Pry.config.completer.build_completion_proc(binding, _pry_)" + " elsif old_wp then" + " Bond.agent" + " elsif defined?(IRB::InputCompletor::CompletionProc) then" + " IRB::InputCompletor::CompletionProc" + " end and puts completer.call(expr).compact" + " end" + " ensure" + " Bond.agent.instance_variable_set('@weapon', old_wp) if old_wp " + " end " + "}.call('%s', '%s')\n") + (ruby-escape-single-quoted expr) + (ruby-escape-single-quoted line)))) + (process-send-string proc completion-snippet) + (while (and (not (string-match inf-ruby-prompt-pattern kept)) + (accept-process-output proc 2))) + (setq completions (butlast (split-string kept "\r?\n") 2)) + ;; Subprocess echoes output on Windows and OS X. + (when (and completions (string= (concat (car completions) "\n") completion-snippet)) + (setq completions (cdr completions)))) + (set-process-filter proc comint-filt))) + completions)) + +(defconst inf-ruby-ruby-expr-break-chars " \t\n\"\'`><,;|&{(") + +(defun inf-ruby-completion-bounds-of-expr-at-point () + "Return bounds of expression at point to complete." + (save-excursion + (let ((end (point))) + (skip-chars-backward (concat "^" inf-ruby-ruby-expr-break-chars)) + (cons (point) end)))) + +(defun inf-ruby-completion-expr-at-point () + "Return expression at point to complete." + (let ((bounds (inf-ruby-completion-bounds-of-expr-at-point))) + (buffer-substring (car bounds) (cdr bounds)))) + +(defun inf-ruby-completion-at-point () + "Retrieve the list of completions and prompt the user. +Returns the selected completion or nil." + (if inf-ruby-at-top-level-prompt-p + (let* ((expr (inf-ruby-completion-expr-at-point)) + (completions (inf-ruby-completions expr))) + (if completions + (if (= (length completions) 1) + (car completions) + (completing-read "possible completions: " + completions nil t expr)))) + (message "Completion aborted: Not at a top-level prompt") + nil)) + +(defun inf-ruby-complete () + "Complete the Ruby code at point. +Uses the first one available of Pry, Bond and the default IRB +completion." + (interactive) + (let ((replacement (inf-ruby-completion-at-point))) + (when replacement + (inf-ruby-complete-replace-expr replacement)))) + +(defun inf-ruby-complete-replace-expr (str) + "Replace expression at point with STR." + (let ((bounds (inf-ruby-completion-bounds-of-expr-at-point))) + (delete-region (car bounds) (cdr bounds))) + (insert str)) + +(defun inf-ruby-complete-or-tab () + "Complete the Ruby code at point or call `indent-for-tab-command'." + (interactive) + (let ((replacement (inf-ruby-completion-at-point))) + (if (not replacement) + (call-interactively 'indent-for-tab-command) + (inf-ruby-complete-replace-expr replacement)))) + +(defvar inf-ruby-orig-compilation-mode nil + "Original compilation mode before switching to `inf-ruby-mode'.") + +(defvar inf-ruby-orig-process-filter nil + "Original process filter before switching to `inf-ruby-mode'.") + +(defun inf-ruby-switch-from-compilation () + "Make the buffer writable and switch to `inf-ruby-mode'. +Recommended for use when the program being executed enters +interactive mode, i.e. hits a debugger breakpoint." + (interactive) + (setq buffer-read-only nil) + (buffer-enable-undo) + (let ((mode major-mode)) + (inf-ruby-mode) + (make-local-variable 'inf-ruby-orig-compilation-mode) + (setq inf-ruby-orig-compilation-mode mode)) + (let ((proc (get-buffer-process (current-buffer)))) + (when proc + (make-local-variable 'inf-ruby-orig-process-filter) + (setq inf-ruby-orig-process-filter (process-filter proc)) + (set-process-filter proc 'comint-output-filter)) + (when (looking-back inf-ruby-prompt-pattern (line-beginning-position)) + (let ((line (match-string 0))) + (delete-region (match-beginning 0) (point)) + (comint-output-filter proc line))))) + +(defun inf-ruby-maybe-switch-to-compilation () + "Switch to compilation mode this buffer was in before +`inf-ruby-switch-from-compilation' was called, if it was. +Otherwise, just toggle read-only status." + (interactive) + (if inf-ruby-orig-compilation-mode + (let ((orig-mode-line-process mode-line-process) + (proc (get-buffer-process (current-buffer))) + (filter inf-ruby-orig-process-filter)) + (funcall inf-ruby-orig-compilation-mode) + (setq mode-line-process orig-mode-line-process) + (when proc + (set-process-filter proc filter))) + (toggle-read-only))) + +;;;###autoload +(defun inf-ruby-switch-setup () + "Modify `rspec-compilation-mode' and `ruby-compilation-mode' +keymaps to bind `inf-ruby-switch-from-compilation' to `С-x C-q'." + (eval-after-load 'rspec-mode + '(define-key rspec-compilation-mode-map (kbd "C-x C-q") + 'inf-ruby-switch-from-compilation)) + (eval-after-load 'ruby-compilation + '(define-key ruby-compilation-mode-map (kbd "C-x C-q") + 'inf-ruby-switch-from-compilation))) + +(defvar inf-ruby-console-patterns-alist + '(("config/application.rb" . rails) + ("*.gemspec" . gem) + ("Gemfile" . default)) + "Mapping from file name patterns to name symbols. +`inf-ruby-console-auto' walks up from the current directory until +one of the patterns matches, then calls `inf-ruby-console-NAME', +passing it the found directory.") + +(defun inf-ruby-console-match (dir) + "Find matching console command for DIR, if any." + (catch 'type + (dolist (pair inf-ruby-console-patterns-alist) + (let ((default-directory dir)) + (when (file-expand-wildcards (car pair)) + (throw 'type (cdr pair))))))) + +;;;###autoload +(defun inf-ruby-console-auto () + "Run the appropriate Ruby console command. +The command and and the directory to run it from are detected +automatically." + (interactive) + (let* ((dir (locate-dominating-file default-directory + #'inf-ruby-console-match)) + (type (inf-ruby-console-match dir)) + (fun (intern (format "inf-ruby-console-%s" type)))) + (unless type (error "No matching directory found")) + (funcall fun dir))) + +;;;###autoload +(defun inf-ruby-console-rails (dir) + "Run Rails console in DIR." + (interactive "D") + (let* ((default-directory (file-name-as-directory dir)) + (envs (inf-ruby-console-rails-envs)) + (env (completing-read "Rails environment: " envs nil t + nil nil (car (member "development" envs)))) + (with-bundler (file-exists-p "Gemfile"))) + (run-ruby (concat (when with-bundler "bundle exec ") + "rails console " + env) + "rails"))) + +(defun inf-ruby-console-rails-envs () + (let ((files (file-expand-wildcards "config/environments/*.rb"))) + (if (null files) + (error "No files in %s" (expand-file-name "config/environments/")) + (mapcar #'file-name-base files)))) + +;;;###autoload +(defun inf-ruby-console-gem (dir) + "Run IRB console for the gem in DIR. +The main module should be loaded automatically. If DIR contains a +Gemfile, it should use the `gemspec' instruction." + (interactive "D") + (let* ((default-directory (file-name-as-directory dir)) + (gemspec (car (file-expand-wildcards "*.gemspec"))) + (base-command + (if (file-exists-p "Gemfile") + (if (inf-ruby-file-contents-match gemspec "\\$LOAD_PATH") + "bundle exec irb" + "bundle exec irb -I lib") + "irb -I lib")) + (name (inf-ruby-file-contents-match + gemspec "\\.name[ \t]*=[ \t]*\"\\([^\"]+\\)\"" 1)) + args files) + (unless (file-exists-p "lib") + (error "The directory must contain a 'lib' subdirectory")) + (let ((feature (and name (replace-regexp-in-string "-" "/" name)))) + (if (and feature (file-exists-p (concat "lib/" feature ".rb"))) + ;; There exists the main file corresponding to the gem name, + ;; let's require it. + (setq args (concat " -r " feature)) + ;; Let's require all non-directory files under lib, instead. + (dolist (item (directory-files "lib")) + (unless (file-directory-p (format "lib/%s" item)) + (push item files))) + (setq args + (mapconcat + (lambda (file) + (concat " -r " (file-name-sans-extension file))) + files + "")))) + (run-ruby (concat base-command args) "gem"))) + +;;;###autoload +(defun inf-ruby-console-default (dir) + "Run racksh, custom console.rb, or just IRB, in DIR." + (interactive "D") + (let ((default-directory (file-name-as-directory dir))) + (unless (file-exists-p "Gemfile") + (error "The directory must contain a Gemfile")) + (cond + ((inf-ruby-file-contents-match "Gemfile" "[\"']racksh[\"']") + (run-ruby "bundle exec racksh" "racksh")) + ((inf-ruby-file-contents-match "Gemfile" "[\"']pry[\"']") + (run-ruby "bundle exec pry" "pry")) + ((file-exists-p "console.rb") + (run-ruby "bundle exec ruby console.rb" "console.rb")) + (t + (run-ruby "bundle console"))))) + +;;;###autoload +(defun inf-ruby-file-contents-match (file regexp &optional match-group) + (with-temp-buffer + (insert-file-contents file) + (when (re-search-forward regexp nil t) + (if match-group + (match-string match-group) + t)))) + +;;;###autoload (dolist (mode ruby-source-modes) (add-hook (intern (format "%s-hook" mode)) 'inf-ruby-minor-mode)) + +(provide 'inf-ruby) +;;; inf-ruby.el ends here diff --git a/elpa/inf-ruby-20140809.416/inf-ruby.elc b/elpa/inf-ruby-20140809.416/inf-ruby.elc new file mode 100644 index 000000000..7057f9170 Binary files /dev/null and b/elpa/inf-ruby-20140809.416/inf-ruby.elc differ diff --git a/elpa/magit-20140807.909/AUTHORS.md b/elpa/magit-20140807.909/AUTHORS.md new file mode 100644 index 000000000..da76724a1 --- /dev/null +++ b/elpa/magit-20140807.909/AUTHORS.md @@ -0,0 +1,174 @@ +Authors +======= + +Also see https://github.com/magit/magit/graphs/contributors. +Names below are sorted alphabetically. + +Author +------ + +- Marius Vollmer + +Maintainer +---------- + +- Jonas Bernoulli + +Retired Maintainers +------------------- + +- Nicolas Dudebout +- Peter J. Weisberg +- Phil Jackson +- Rémi Vanicat +- Yann Hodique + +Contributors +------------ + +- aaa707 +- Aaron Culich +- Abdo Roig-Maranges +- acple +- Ævar Arnfjörð Bjarmason +- Alan Falloon +- Alexey Voinov +- Alex Ott +- Andreas Fuchs +- Andreas Liljeqvist +- Andreas Rottmann +- Andrei Chițu +- Andrew Kirkpatrick +- Andrey Smirnov +- Bastian Beischer +- Ben Walton +- Bradley Wright +- Brandon W Maister +- Brian Warner +- Bryan Shell +- Chris Bernard +- Chris Done +- Chris Moore +- Chris Ring +- Christian Dietrich +- Christian Kluge +- Christopher Monsanto +- Cornelius Mika +- Craig Andera +- Dale Hagglund +- Damien Cassou +- Daniel Brockman +- Daniel Farina +- Daniel Hackney +- Dan LaManna +- David Abrahams +- David Hull +- David Wallin +- Divye Kapoor +- Dominique Quatravaux +- Eli Barzilay +- Eric Davis +- Eric Schulte +- Evgkeni Sampelnikof +- Felix Geller +- Feng Li +- George Kadianakis +- Graham Clark +- Greg A. Woods +- Greg Sexton +- Hannu Koivisto +- Hans-Peter Deifel +- Ian Eure +- Jan Tatarik +- Jasper St. Pierre +- Jeff Bellegarde +- Jesse Alama +- John Wiegley +- Jonas Bernoulli +- Jonathan Roes +- Julien Danjou +- Justin Caratzas +- Kimberly Wolk +- Kyle Meyer +- Laurent Laffont +- Lele Gaifax +- Leo Liu +- Leonardo Etcheverry +- Lluís Vilanova +- Loic Dachary +- Luís Borges de Oliveira +- Luke Amdor +- Manuel Vázquez Acosta +- Marcel Wolf +- Marc Herbert +- Marcin Bachry +- Marco Craveiro +- Marian Schubert +- Marius Vollmer +- Mark Hepburn +- Matus Goljer +- Miles Bader +- Mitchel Humpherys +- Moritz Bunkus +- Nathan Weizenbaum +- Nguyễn Tuấn Anh +- Nic Ferier +- Nick Alcock +- Nick Alexander +- Nick Dimiduk +- Nicolas Dudebout +- Nicolas Richard +- Noam Postavsky +- Ole Arndt +- Óscar Fuentes +- Paul Stadig +- Pavel Holejsovsky +- Pekka Pessi +- Peter J. Weisberg +- Philippe Vaucher +- Philipp Haselwarter +- Philip Weaver +- Phil Jackson +- Pieter Praet +- Prathamesh Sonpatki +- rabio +- Raimon Grau +- Ramkumar Ramachandra +- Remco van 't Veer +- Rémi Vanicat +- René Stadler +- Robert Boone +- Robin Green +- Roger Crew +- Romain Francoise +- Ron Parker +- Roy Crihfield +- Rüdiger Sonderfeld +- Ryan C. Thompson +- Samuel Bronson +- Sanjoy Das +- Sean Bryant +- Sebastian Wiesner +- Sébastien Gross +- Seong-Kook Shin +- Sergey Pashinin +- Sergey Vinokurov +- Servilio Afre Puentes +- Štěpán Němec +- Steven Chow +- Steven Thomas +- Steve Purcell +- Suhail Shergill +- Takafumi Arakaki +- Teruki Shigitani +- Thierry Volpiatto +- Thomas Frössman +- Thomas Jost +- Thomas Riccardi +- Tibor Simko +- Timo Juhani Lindfors +- Ting-Yu Lin +- Tom Feist +- Wilfred Hughes +- Win Treese +- Yann Hodique diff --git a/elpa/magit-20140807.909/README.md b/elpa/magit-20140807.909/README.md new file mode 100644 index 000000000..330b5d824 --- /dev/null +++ b/elpa/magit-20140807.909/README.md @@ -0,0 +1,325 @@ +[![Build Status](https://travis-ci.org/magit/magit.svg?branch=master)](https://travis-ci.org/magit/magit) +[![Gittip](http://img.shields.io/gittip/magit.png)](https://www.gittip.com/magit) + +It's Magit! An Emacs mode for Git +================================== + +Magit is an interface to the version control system [Git][git], +implemented as an [Emacs][emacs] extension. + +Unlike Emacs' native [Version Control][vc] package which strives to +provide a unified interface to various version control systems, Magit +only supports Git and can therefore better take advantage of its native +features. + +Magit supports GNU Emacs 23.2 or later; 24.1 or later is recommended. +Magit supports Git 1.7.2.5 or later; 1.8.2 or later is recommended. +The minimal versions are those available in Debian oldstable. + +### Table of Contents + +* [Getting Started](#getting-started) +* [Getting Help](#getting-help) +* [Contributions](#contributions) +* [Installation](#installation) + * [Installing from Melpa](#installing-from-melpa) + * [Installing from Marmalade](#installing-from-marmalade) + * [Installing from Git](#installing-from-git) + * [Installing from Tarball](#installing-from-tarball) +* [Dependencies](#dependencies) + +Getting Started +=============== + +To get started with Magit, run M-x magit-status. If you +are inside a Git repository this opens a buffer that summarizes its +status. Otherwise you are first prompted for a repository. Read the +short help for `magit-status-mode` (C-h m in the status +buffer). + +Then edit and save some files, refresh the status buffer +(g), stage changes (s) and commit (c) +them. + +For more details consult the Magit user manual. You can read it with +C-u C-h i magit.info or [on the web][manual]. + +We can also strongly recommend [this][mastering-intro] introduction +from the Mastering Emacs blog. It even describes some new features +that are not yet documented in the manual. + +Magit also has a [website][website]. + +Getting Help +============ + +When something breaks *please* see the +[curated list of known issues][knownissues] and the [FAQ][faq]. +If that doesn't help check the list of [all open issues][issues]. + +If everything else fails please open a [new issue][issues] or ask for +help on the [mailing list][group]. + +Contributions +============= + +Magit is [hosted on Github][development]. Please contribute by +suggesting features on the [issue tracker][issues] or by making code +contributions using [pull requests][pulls]. Before opening a pull +request make sure to read the brief [guidelines][contributing]. + +Please also consider supporting development using [gittip][gittip]. +Thank you! + +Magit was started by [Marius Vollmer][marius] and is now maintained +by [Jonas Bernoulli][jonas]. Other Magitians (former maintainers) +are [Nicolas Dudebout][nicolas], [Peter J. Weisberg][peter], +[Phil Jackson][phil], [Rémi Vanicat][remi], and [Yann Hodique][yann]. + +Many more people have [contributed code][contributors] and suggested +features. + +Thanks to all of you, may (the history of) the source be with you! + +Installation +============ + +Beginning with version 24.1 Emacs includes a package management +facility known as Elpa or `package.el`. Using an Elpa package +repository is the easiest and recommended way to install and update +Magit and its dependencies. Among other things using `package.el` +is recommended because that automatically takes care of installing +dependencies. + +Magit is available from both of the two popular Elpa repositories, +[Marmalade][marmalade] (stable releases) and [Melpa][melpa] +(snapshots). + +### Installing from Melpa + +If you have already used Melpa to install some other package then +all you have to do is: + +M-x package-install RET magit RET + +This installs Magit as well as all of its dependencies and makes +them available in the current and future Emacs sessions. + +If this is the first time you are using Melpa, then you have to +configure `package.el` once. + +```lisp +(require 'package) +(add-to-list 'package-archives + '("melpa" . "http://melpa.milkbox.net/packages/") t) +``` + +Then evaluate these forms, update the package cache, and install +Magit as above. To update the cache use: + +M-x package-refresh-contents RET + +You might also want to have a look at the more detailed +[instructions][melpa-intro] provided by the Melpa project. Among +other things it explains how to install only some packages from Melpa +and others from Marmalade, and how to use `package.el` with older +versions of Emacs. + +### Installing from Marmalade + +For the time being we recommend that you install the development +version available from Melpa, because the latest Magit release (which +is what you get from Marmalade) is very outdated. If you are using +the development version of Emacs, then you have to do so, because it +contains an incompatible change that breaks the last Magit release. + +### Installing from Git + +If you want to contribute to Magit you should run it directly from the +Git repository. + +First get the repository: + +```sh +$ git clone git://github.com/magit/magit.git +``` + +Then you should byte compile the libraries and generate the +documentation, though that is not required: + +```sh +$ make lisp docs +``` + +Unless all dependencies are installed at `../DEPENDENCY` you have to +tell `make` where to find them, e.g.: + +```sh +$ EFLAGS="-L /path/to/git-modes" make lisp docs +``` + +Then add this to you init file: + +```lisp +(add-to-list 'load-path "/path/to/git-modes") +(add-to-list 'load-path "/path/to/magit") +(eval-after-load 'info + '(progn (info-initialize) + (add-to-list 'Info-directory-list "/path/to/magit/"))) +(require 'magit) +``` + +If you are using an Emacs version before 24.3, then you also have to +install `cl-lib` and tell `make` as well as Emacs where to find it. + +To view available make targets use: + +```sh +$ make help +``` + +To update use: + +```sh +$ git pull +$ make lisp docs +``` + +Before creating a pull request always run: + +```sh +$ make lisp test +``` + +You may also build Magit manually: + +```sh +$ emacs -Q --batch -L . -L /path/to/DEPENCENCY -f batch-byte-compile *.el +$ makeinfo -o magit.info magit.texi +$ install-info --dir=dir magit.info +``` + +### Installing from Tarball + +This is only intended for users who have been doing this sort of thing +for years. Installing from a tarball isn't particularly difficult but +because we are only providing this as an alternative method we are a +bit light on documentation, so it helps to have done this before. + +Also most steps have to be repeated every time you want to update. + +Because the latest Magit release is very outdated, please consider +installing the development version even if tarballs are your thing. + +Download and unpack [magit-1.2.0.tar.gz][download]. Then build and +install as usual: + +```sh +$ wget https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz +$ tar -xf magit-1.2.0.tar.gz +$ cd magit-1.2.0 +$ make +$ sudo make install +``` + +This installs the Emacs lisp libraries, as well as the prebuilt +documentation from the tarball. You may alternatively build the +documentation yourself: + +```sh +$ make docs +$ sudo make install-docs +``` + +By default the Emacs lisp libraries are installed in +`/usr/local/share/emacs/site-lisp/magit/`. Unless Emacs itself is +also installed in `/usr/local/` you have to add that directory to the +`load-path`. + +```lisp +(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/magit") +``` + +Then `magit` can be loaded: + +```lisp +(require 'magit) +``` + +Add the above lines to your init file and restart Emacs. + +Dependencies +============ + +If you install Magit using `package.el` then dependencies are +automatically being taken care of. Otherwise you have to track down +dependencies and install them manually. + +* `cl-lib` is a new library in Emacs 24.3. Like the old `cl` it + provides various Common Lisp forms, but differs in that symbols are + prefixed with `cl-`. A forward compatibility `cl-lib` for older + versions of Emacs is available from the GNU Elpa repository. You + can install it using `package.el` or get it [here][cl-lib]. + +* `git-commit-mode` which is part of the [git-modes][git-modes] + repository and available as a separate package from Melpa. + +* `git-rebase-mode` which is part of the [git-modes][git-modes] + repository and available as a separate package from Melpa. + +### Optional Dependencies + +The following libraries build on third-party tools or git subcommands +that are not installed by the Git base-package on some distributions: + +* `magit-stgit.el` requires [`stgit`][stgit]. +* `magit-svn.el` requires the official Git subcommand `svn`. +* `magit-topgit.el` requires [`topgit`][topgit]. +* `magit-wip.el` requires [`git-wip`][git-wip]. + +### Dependencies of Tests + +To run tests the following libraries are also required: + +* `ert` is a tool for automated testing. It is part of Emacs + starting with version 24.1. You can also obtain an old version from + the former development [repository][ert]. + + +[contributing]: https://github.com/magit/magit/blob/master/CONTRIBUTING.md +[contributors]: https://github.com/magit/magit/contributors +[development]: http://github.com/magit/magit +[download]: https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz +[faq]: https://github.com/magit/magit/wiki/FAQ +[group]: https://groups.google.com/forum/?fromgroups#!forum/magit +[issues]: https://github.com/magit/magit/issues +[knownissues]: https://github.com/magit/magit/wiki/Known-issues +[manual]: http://magit.github.io/documentation.html +[owners]: https://github.com/magit?tab=members +[pulls]: https://github.com/magit/magit/pulls +[screencast]: http://vimeo.com/2871241 +[website]: http://magit.github.io + +[jonas]: https://github.com/tarsius +[marius]: https://github.com/mvollmer +[nicolas]: https://github.com/dudebout +[peter]: https://github.com/pjweisberg +[phil]: https://github.com/philjackson +[remi]: https://github.com/vanicat +[yann]: https://github.com/sigma + +[cl-lib]: http://elpa.gnu.org/packages/cl-lib.html +[emacs]: http://www.gnu.org/software/emacs +[ert]: https://github.com/ohler/ert +[git-wip]: https://github.com/bartman/git-wip +[git]: http://git-scm.com +[gitflow]: https://github.com/nvie/gitflow +[gittip]: https://www.gittip.com/magit +[git-modes]: https://github.com/magit/git-modes +[marmalade]: http://marmalade-repo.org +[mastering-intro]: http://www.masteringemacs.org/articles/2013/12/06/introduction-magit-emacs-mode-git +[melpa]: http://melpa.milkbox.net +[melpa-intro]: http://melpa.milkbox.net/#/getting-started +[stgit]: http://www.procode.org/stgit +[topgit]: https://github.com/greenrd/topgit +[vc]: http://www.gnu.org/software/emacs/manual/html_node/emacs/Version-Control.html diff --git a/elpa/magit-20140807.909/dir b/elpa/magit-20140807.909/dir new file mode 100644 index 000000000..5fec54397 --- /dev/null +++ b/elpa/magit-20140807.909/dir @@ -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" visits the Emacs manual, etc. + + In Emacs, you can click mouse button 2 on a menu item or cross reference + to select it. + +* Menu: + +Emacs +* Magit: (magit). Using Git from Emacs with Magit. diff --git a/elpa/magit-20140807.909/magit-autoloads.el b/elpa/magit-20140807.909/magit-autoloads.el new file mode 100644 index 000000000..756877a44 --- /dev/null +++ b/elpa/magit-20140807.909/magit-autoloads.el @@ -0,0 +1,601 @@ +;;; magit-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (magit-run-gitk magit-run-git-gui-blame magit-run-git-gui +;;;;;; magit-add-change-log-entry-other-window magit-add-change-log-entry +;;;;;; magit-init magit-branch-manager magit-wazzup magit-diff-stash +;;;;;; magit-diff-unstaged magit-diff-staged magit-diff-working-tree +;;;;;; magit-diff magit-interactive-resolve magit-save-index magit-cherry +;;;;;; magit-reflog-head magit-reflog magit-file-log magit-log-long-ranged +;;;;;; magit-log-long magit-log-ranged magit-log magit-bisect-run +;;;;;; magit-bisect-skip magit-bisect-bad magit-bisect-good magit-bisect-reset +;;;;;; magit-bisect-start magit-submodule-sync magit-submodule-init +;;;;;; magit-submodule-update-init magit-submodule-update magit-stash-snapshot +;;;;;; magit-stash magit-delete-tag magit-tag magit-commit-squash +;;;;;; magit-commit-fixup magit-commit-reword magit-commit-extend +;;;;;; magit-commit-amend magit-commit magit-push magit-push-tags +;;;;;; magit-pull magit-remote-update magit-fetch-current magit-fetch +;;;;;; magit-reset-working-tree magit-reset-head-hard magit-reset-head +;;;;;; magit-interactive-rebase magit-rename-remote magit-remove-remote +;;;;;; magit-add-remote magit-rename-branch magit-delete-branch +;;;;;; magit-create-branch magit-checkout magit-merge-abort magit-merge +;;;;;; magit-show magit-dired-jump magit-unstage-all magit-stage-all +;;;;;; magit-status magit-show-commit magit-git-command) "magit" +;;;;;; "magit.el" (21478 16669 0 0)) +;;; Generated autoloads from magit.el + +(autoload 'magit-git-command "magit" "\ +Execute a Git subcommand asynchronously, displaying the output. +With a prefix argument run Git in the root of the current +repository. Non-interactively run Git in DIRECTORY with ARGS. + +\(fn ARGS DIRECTORY)" t nil) + +(autoload 'magit-show-commit "magit" "\ +Show information about COMMIT. + +\(fn COMMIT &optional NOSELECT)" t nil) + +(autoload 'magit-status "magit" "\ +Open a Magit status buffer for the Git repository containing DIR. +If DIR is not within a Git repository, offer to create a Git +repository in DIR. + +Interactively, a prefix argument means to ask the user which Git +repository to use even if `default-directory' is under Git +control. Two prefix arguments means to ignore `magit-repo-dirs' +when asking for user input. + +Depending on option `magit-status-buffer-switch-function' the +status buffer is shown in another window (the default) or the +current window. Non-interactively optional SWITCH-FUNCTION +can be used to override this. + +\(fn DIR &optional SWITCH-FUNCTION)" t nil) + +(autoload 'magit-stage-all "magit" "\ +Add all remaining changes in tracked files to staging area. +With a prefix argument, add remaining untracked files as well. +\('git add [-u] .'). + +\(fn &optional INCLUDING-UNTRACKED)" t nil) + +(autoload 'magit-unstage-all "magit" "\ +Remove all changes from staging area. +\('git reset --mixed HEAD'). + +\(fn)" t nil) + +(autoload 'magit-dired-jump "magit" "\ +Visit current item in dired. +With a prefix argument, visit in other window. + +\(fn &optional OTHER-WINDOW)" t nil) + +(autoload 'magit-show "magit" "\ +Display and select a buffer containing FILE as stored in REV. + +Insert the contents of FILE as stored in the revision REV into a +buffer. Then select the buffer using `pop-to-buffer' or with a +prefix argument using `switch-to-buffer'. Non-interactivity use +SWITCH-FUNCTION to switch to the buffer, if that is nil simply +return the buffer, without displaying it. + +\(fn REV FILE &optional SWITCH-FUNCTION)" t nil) + +(autoload 'magit-merge "magit" "\ +Merge REVISION into the current 'HEAD', leaving changes uncommitted. +With a prefix argument, skip editing the log message and commit. +\('git merge [--no-commit] REVISION'). + +\(fn REVISION &optional DO-COMMIT)" t nil) + +(autoload 'magit-merge-abort "magit" "\ +Abort the current merge operation. + +\(fn)" t nil) + +(autoload 'magit-checkout "magit" "\ +Switch 'HEAD' to REVISION and update working tree. +Fails if working tree or staging area contain uncommitted changes. +If REVISION is a remote branch, offer to create a local tracking branch. +\('git checkout [-b] REVISION'). + +\(fn REVISION)" t nil) + +(autoload 'magit-create-branch "magit" "\ +Switch 'HEAD' to new BRANCH at revision PARENT and update working tree. +Fails if working tree or staging area contain uncommitted changes. +\('git checkout -b BRANCH REVISION'). + +\(fn BRANCH PARENT)" t nil) + +(autoload 'magit-delete-branch "magit" "\ +Delete the BRANCH. +If the branch is the current one, offers to switch to `master' first. +With prefix, forces the removal even if it hasn't been merged. +Works with local or remote branches. +\('git branch [-d|-D] BRANCH' or 'git push :refs/heads/BRANCH'). + +\(fn BRANCH &optional FORCE)" t nil) + +(autoload 'magit-rename-branch "magit" "\ +Rename branch OLD to NEW. +With prefix, forces the rename even if NEW already exists. +\('git branch [-m|-M] OLD NEW'). + +\(fn OLD NEW &optional FORCE)" t nil) + +(autoload 'magit-add-remote "magit" "\ +Add the REMOTE and fetch it. +\('git remote add REMOTE URL'). + +\(fn REMOTE URL)" t nil) + +(autoload 'magit-remove-remote "magit" "\ +Delete the REMOTE. +\('git remote rm REMOTE'). + +\(fn REMOTE)" t nil) + +(autoload 'magit-rename-remote "magit" "\ +Rename remote OLD to NEW. +\('git remote rename OLD NEW'). + +\(fn OLD NEW)" t nil) + +(autoload 'magit-interactive-rebase "magit" "\ +Start a git rebase -i session, old school-style. + +\(fn COMMIT)" t nil) + +(autoload 'magit-reset-head "magit" "\ +Switch 'HEAD' to REVISION, keeping prior working tree and staging area. +Any differences from REVISION become new changes to be committed. +With prefix argument, all uncommitted changes in working tree +and staging area are lost. +\('git reset [--soft|--hard] REVISION'). + +\(fn REVISION &optional HARD)" t nil) + +(autoload 'magit-reset-head-hard "magit" "\ +Switch 'HEAD' to REVISION, losing all changes. +Uncomitted changes in both working tree and staging area are lost. +\('git reset --hard REVISION'). + +\(fn REVISION)" t nil) + +(autoload 'magit-reset-working-tree "magit" "\ +Revert working tree and clear changes from staging area. +\('git reset --hard HEAD'). + +With a prefix arg, also remove untracked files. +With two prefix args, remove ignored files as well. + +\(fn &optional ARG)" t nil) + +(autoload 'magit-fetch "magit" "\ +Fetch from REMOTE. + +\(fn REMOTE)" t nil) + +(autoload 'magit-fetch-current "magit" "\ +Run fetch for default remote. + +If there is no default remote, ask for one. + +\(fn)" t nil) + +(autoload 'magit-remote-update "magit" "\ +Update all remotes. + +\(fn)" t nil) + +(autoload 'magit-pull "magit" "\ +Run git pull. + +If there is no default remote, the user is prompted for one and +its values is saved with git config. If there is no default +merge branch, the user is prompted for one and its values is +saved with git config. With a prefix argument, the default +remote is not used and the user is prompted for a remote. With +two prefix arguments, the default merge branch is not used and +the user is prompted for a merge branch. Values entered by the +user because of prefix arguments are not saved with git config. + +\(fn)" t nil) + +(autoload 'magit-push-tags "magit" "\ +Push tags to a remote repository. + +Push tags to the current branch's remote. If that isn't set push +to \"origin\" or if that remote doesn't exit but only a single +remote is defined use that. Otherwise or with a prefix argument +ask the user what remote to use. + +\(fn)" t nil) + +(autoload 'magit-push "magit" "\ +Push the current branch to a remote repository. + +This command runs the `magit-push-remote' hook. By default that +means running `magit-push-dwim'. So unless you have customized +the hook this command behaves like this: + +With a single prefix argument ask the user what branch to push +to. With two or more prefix arguments also ask the user what +remote to push to. Otherwise use the remote and branch as +configured using the Git variables `branch..remote' and +`branch..merge'. If the former is undefined ask the user. +If the latter is undefined push without specifing the remote +branch explicitly. + +Also see option `magit-set-upstream-on-push'. + +\(fn)" t nil) + +(autoload 'magit-commit "magit" "\ +Create a new commit on HEAD. +With a prefix argument amend to the commit at HEAD instead. +\('git commit [--amend]'). + +\(fn &optional AMENDP)" t nil) + +(autoload 'magit-commit-amend "magit" "\ +Amend the last commit. +\('git commit --amend'). + +\(fn)" t nil) + +(autoload 'magit-commit-extend "magit" "\ +Amend the last commit, without editing the message. +With a prefix argument do change the committer date, otherwise +don't. The option `magit-commit-extend-override-date' can be +used to inverse the meaning of the prefix argument. +\('git commit --no-edit --amend [--keep-date]'). + +\(fn &optional OVERRIDE-DATE)" t nil) + +(autoload 'magit-commit-reword "magit" "\ +Reword the last commit, ignoring staged changes. + +With a prefix argument do change the committer date, otherwise +don't. The option `magit-commit-rewrite-override-date' can be +used to inverse the meaning of the prefix argument. + +Non-interactively respect the optional OVERRIDE-DATE argument +and ignore the option. + +\('git commit --only --amend'). + +\(fn &optional OVERRIDE-DATE)" t nil) + +(autoload 'magit-commit-fixup "magit" "\ +Create a fixup commit. +With a prefix argument the user is always queried for the commit +to be fixed. Otherwise the current or marked commit may be used +depending on the value of option `magit-commit-squash-commit'. +\('git commit [--no-edit] --fixup=COMMIT'). + +\(fn &optional COMMIT)" t nil) + +(autoload 'magit-commit-squash "magit" "\ +Create a squash commit. +With a prefix argument the user is always queried for the commit +to be fixed. Otherwise the current or marked commit may be used +depending on the value of option `magit-commit-squash-commit'. +\('git commit [--no-edit] --fixup=COMMIT'). + +\(fn &optional COMMIT FIXUP)" t nil) + +(autoload 'magit-tag "magit" "\ +Create a new tag with the given NAME at REV. +With a prefix argument annotate the tag. +\('git tag [--annotate] NAME REV'). + +\(fn NAME REV &optional ANNOTATE)" t nil) + +(autoload 'magit-delete-tag "magit" "\ +Delete the tag with the given NAME. +\('git tag -d NAME'). + +\(fn NAME)" t nil) + +(autoload 'magit-stash "magit" "\ +Create new stash of working tree and staging area named DESCRIPTION. +Working tree and staging area revert to the current 'HEAD'. +With prefix argument, changes in staging area are kept. +\('git stash save [--keep-index] DESCRIPTION') + +\(fn DESCRIPTION)" t nil) + +(autoload 'magit-stash-snapshot "magit" "\ +Create new stash of working tree and staging area; keep changes in place. +\('git stash save \"Snapshot...\"; git stash apply stash@{0}') + +\(fn)" t nil) + +(autoload 'magit-submodule-update "magit" "\ +Update the submodule of the current git repository. +With a prefix arg, do a submodule update --init. + +\(fn &optional INIT)" t nil) + +(autoload 'magit-submodule-update-init "magit" "\ +Update and init the submodule of the current git repository. + +\(fn)" t nil) + +(autoload 'magit-submodule-init "magit" "\ +Initialize the submodules. + +\(fn)" t nil) + +(autoload 'magit-submodule-sync "magit" "\ +Synchronizes submodule's remote URL configuration. + +\(fn)" t nil) + +(autoload 'magit-bisect-start "magit" "\ +Start a bisect session. + +Bisecting a bug means to find the commit that introduced it. +This command starts such a bisect session by asking for a know +good and a bad commit. To move the session forward use the +other actions from the bisect popup (\\\\[magit-key-mode-popup-bisecting]). + +\(fn BAD GOOD)" t nil) + +(autoload 'magit-bisect-reset "magit" "\ +After bisecting cleanup bisection state and return to original HEAD. + +\(fn)" t nil) + +(autoload 'magit-bisect-good "magit" "\ +While bisecting, mark the current commit as good. +Use this after you have asserted that the commit does not contain +the bug in question. + +\(fn)" t nil) + +(autoload 'magit-bisect-bad "magit" "\ +While bisecting, mark the current commit as bad. +Use this after you have asserted that the commit does contain the +bug in question. + +\(fn)" t nil) + +(autoload 'magit-bisect-skip "magit" "\ +While bisecting, skip the current commit. +Use this if for some reason the current commit is not a good one +to test. This command lets Git choose a different one. + +\(fn)" t nil) + +(autoload 'magit-bisect-run "magit" "\ +Bisect automatically by running commands after each step. + +\(fn CMDLINE)" t nil) + +(autoload 'magit-log "magit" "\ + + +\(fn &optional RANGE)" t nil) + +(autoload 'magit-log-ranged "magit" "\ + + +\(fn RANGE)" t nil) + +(autoload 'magit-log-long "magit" "\ + + +\(fn &optional RANGE)" t nil) + +(autoload 'magit-log-long-ranged "magit" "\ + + +\(fn RANGE)" t nil) + +(autoload 'magit-file-log "magit" "\ +Display the log for the currently visited file or another one. +With a prefix argument show the log graph. + +\(fn FILE &optional USE-GRAPH)" t nil) + +(autoload 'magit-reflog "magit" "\ +Display the reflog of the current branch. +With a prefix argument another branch can be chosen. + +\(fn REF)" t nil) + +(autoload 'magit-reflog-head "magit" "\ +Display the HEAD reflog. + +\(fn)" t nil) + +(autoload 'magit-cherry "magit" "\ +Show commits in a branch that are not merged in the upstream branch. + +\(fn HEAD UPSTREAM)" t nil) + +(autoload 'magit-save-index "magit" "\ +Add the content of current file as if it was the index. + +\(fn)" t nil) + +(autoload 'magit-interactive-resolve "magit" "\ +Resolve a merge conflict using Ediff. + +\(fn FILE)" t nil) + +(autoload 'magit-diff "magit" "\ +Show differences between two commits. +RANGE should be a range (A..B or A...B) but can also be a single +commit. If one side of the range is omitted, then it defaults +to HEAD. If just a commit is given, then changes in the working +tree relative to that commit are shown. + +\(fn RANGE &optional WORKING ARGS)" t nil) + +(autoload 'magit-diff-working-tree "magit" "\ +Show differences between a commit and the current working tree. + +\(fn REV)" t nil) + +(autoload 'magit-diff-staged "magit" "\ +Show differences between the index and the HEAD commit. + +\(fn)" t nil) + +(autoload 'magit-diff-unstaged "magit" "\ +Show differences between the current working tree and index. + +\(fn)" t nil) + +(autoload 'magit-diff-stash "magit" "\ +Show changes in a stash. +A Stash consist of more than just one commit. This command uses +a special diff range so that the stashed changes actually were a +single commit. + +\(fn STASH &optional NOSELECT)" t nil) + +(autoload 'magit-wazzup "magit" "\ +Show a list of branches in a dedicated buffer. +Unlike in the buffer created by `magit-branch-manager' each +branch can be expanded to show a list of commits not merged +into the selected branch. + +\(fn BRANCH)" t nil) + +(autoload 'magit-branch-manager "magit" "\ +Show a list of branches in a dedicated buffer. + +\(fn)" t nil) + +(autoload 'magit-init "magit" "\ +Create or reinitialize a Git repository. +Read directory name and initialize it as new Git repository. + +If the directory is below an existing repository, then the user +has to confirm that a new one should be created inside; or when +the directory is the root of the existing repository, whether +it should be reinitialized. + +Non-interactively DIRECTORY is always (re-)initialized. + +\(fn DIRECTORY)" t nil) + +(autoload 'magit-add-change-log-entry "magit" "\ +Find change log file and add date entry and item for current change. +This differs from `add-change-log-entry' (which see) in that +it acts on the current hunk in a Magit buffer instead of on +a position in a file-visiting buffer. + +\(fn &optional WHOAMI FILE-NAME OTHER-WINDOW)" t nil) + +(autoload 'magit-add-change-log-entry-other-window "magit" "\ +Find change log file in other window and add entry and item. +This differs from `add-change-log-entry-other-window' (which see) +in that it acts on the current hunk in a Magit buffer instead of +on a position in a file-visiting buffer. + +\(fn &optional WHOAMI FILE-NAME)" t nil) + +(autoload 'magit-run-git-gui "magit" "\ +Run `git gui' for the current git repository. + +\(fn)" t nil) + +(autoload 'magit-run-git-gui-blame "magit" "\ +Run `git gui blame' on the given FILENAME and COMMIT. +Interactively run it for the current file and the HEAD, with a +prefix or when the current file cannot be determined let the user +choose. When the current buffer is visiting FILENAME instruct +blame to center around the line point is on. + +\(fn COMMIT FILENAME &optional LINENUM)" t nil) + +(autoload 'magit-run-gitk "magit" "\ +Run Gitk for the current git repository. +Without a prefix argument run `gitk --all', with +a prefix argument run gitk without any arguments. + +\(fn ARG)" t nil) + +;;;*** + +;;;### (autoloads (magit-blame-mode) "magit-blame" "magit-blame.el" +;;;;;; (21478 16669 0 0)) +;;; Generated autoloads from magit-blame.el + +(autoload 'magit-blame-mode "magit-blame" "\ +Display blame information inline. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "magit-key-mode" "magit-key-mode.el" (21478 +;;;;;; 16669 0 0)) +;;; Generated autoloads from magit-key-mode.el + +(defvar magit-key-mode-groups '((dispatch (actions ("b" "Branching" magit-key-mode-popup-branching) ("B" "Bisecting" magit-key-mode-popup-bisecting) ("c" "Committing" magit-key-mode-popup-committing) ("d" "Diff worktree" magit-diff-working-tree) ("D" "Diff" magit-diff) ("f" "Fetching" magit-key-mode-popup-fetching) ("F" "Pulling" magit-key-mode-popup-pulling) ("g" "Refresh Buffers" magit-refresh-all) ("l" "Logging" magit-key-mode-popup-logging) ("m" "Merging" magit-key-mode-popup-merging) ("M" "Remoting" magit-key-mode-popup-remoting) ("P" "Pushing" magit-key-mode-popup-pushing) ("o" "Submoduling" magit-key-mode-popup-submodule) ("r" "Rewriting" magit-key-mode-popup-rewriting) ("R" "Rebasing" magit-rebase-step) ("s" "Show Status" magit-status) ("S" "Stage all" magit-stage-all) ("t" "Tagging" magit-key-mode-popup-tagging) ("U" "Unstage all" magit-unstage-all) ("v" "Show Commit" magit-show-commit) ("V" "Show File" magit-show) ("w" "Wazzup" magit-wazzup) ("X" "Reset worktree" magit-reset-working-tree) ("y" "Cherry" magit-cherry) ("z" "Stashing" magit-key-mode-popup-stashing) ("!" "Running" magit-key-mode-popup-running) ("$" "Show Process" magit-display-process))) (logging (man-page "git-log") (actions ("l" "Short" magit-log) ("L" "Long" magit-log-long) ("h" "Head Reflog" magit-reflog-head) ("f" "File log" magit-file-log) ("rl" "Ranged short" magit-log-ranged) ("rL" "Ranged long" magit-log-long-ranged) ("rh" "Reflog" magit-reflog)) (switches ("-m" "Only merge commits" "--merges") ("-s" "No merge commits" "--no-merges") ("-do" "Date Order" "--date-order") ("-f" "First parent" "--first-parent") ("-i" "Case insensitive patterns" "-i") ("-pr" "Pickaxe regex" "--pickaxe-regex") ("-g" "Show Graph" "--graph") ("-n" "Name only" "--name-only") ("-am" "All match" "--all-match") ("-al" "All" "--all")) (arguments ("=r" "Relative" "--relative=" read-directory-name) ("=c" "Committer" "--committer=" read-from-minibuffer) ("=>" "Since" "--since=" read-from-minibuffer) ("=<" "Before" "--before=" read-from-minibuffer) ("=a" "Author" "--author=" read-from-minibuffer) ("=g" "Grep messages" "--grep=" read-from-minibuffer) ("=G" "Grep patches" "-G" read-from-minibuffer) ("=L" "Trace evolution of line range [long log only]" "-L" magit-read-file-trace) ("=s" "Pickaxe search" "-S" read-from-minibuffer) ("=b" "Branches" "--branches=" read-from-minibuffer) ("=R" "Remotes" "--remotes=" read-from-minibuffer))) (running (actions ("!" "Git Subcommand (from root)" magit-git-command-topdir) (":" "Git Subcommand (from pwd)" magit-git-command) ("g" "Git Gui" magit-run-git-gui) ("k" "Gitk" magit-run-gitk))) (fetching (man-page "git-fetch") (actions ("f" "Current" magit-fetch-current) ("a" "All" magit-remote-update) ("o" "Other" magit-fetch)) (switches ("-p" "Prune" "--prune"))) (pushing (man-page "git-push") (actions ("P" "Push" magit-push) ("t" "Push tags" magit-push-tags)) (switches ("-f" "Force" "--force") ("-d" "Dry run" "-n") ("-u" "Set upstream" "-u"))) (pulling (man-page "git-pull") (actions ("F" "Pull" magit-pull)) (switches ("-f" "Force" "--force") ("-r" "Rebase" "--rebase"))) (branching (man-page "git-branch") (actions ("v" "Branch manager" magit-branch-manager) ("b" "Checkout" magit-checkout) ("c" "Create" magit-create-branch) ("r" "Rename" magit-rename-branch) ("k" "Delete" magit-delete-branch)) (switches ("-t" "Set upstream configuration" "--track") ("-m" "Merged to HEAD" "--merged") ("-M" "Merged to master" "--merged=master") ("-n" "Not merged to HEAD" "--no-merged") ("-N" "Not merged to master" "--no-merged=master")) (arguments ("=c" "Contains" "--contains=" magit-read-rev-with-default) ("=m" "Merged" "--merged=" magit-read-rev-with-default) ("=n" "Not merged" "--no-merged=" magit-read-rev-with-default))) (remoting (man-page "git-remote") (actions ("v" "Remote manager" magit-branch-manager) ("a" "Add" magit-add-remote) ("r" "Rename" magit-rename-remote) ("k" "Remove" magit-remove-remote))) (tagging (man-page "git-tag") (actions ("t" "Create" magit-tag) ("k" "Delete" magit-delete-tag)) (switches ("-a" "Annotate" "--annotate") ("-f" "Force" "--force") ("-s" "Sign" "--sign"))) (stashing (man-page "git-stash") (actions ("v" "View" magit-diff-stash) ("z" "Save" magit-stash) ("s" "Snapshot" magit-stash-snapshot) ("a" "Apply" magit-stash-apply) ("p" "Pop" magit-stash-pop) ("k" "Drop" magit-stash-drop)) (switches ("-k" "Keep index" "--keep-index") ("-u" "Include untracked files" "--include-untracked") ("-a" "Include all files" "--all"))) (committing (man-page "git-commit") (actions ("c" "Commit" magit-commit) ("a" "Amend" magit-commit-amend) ("e" "Extend" magit-commit-extend) ("r" "Reword" magit-commit-reword) ("f" "Fixup" magit-commit-fixup) ("s" "Squash" magit-commit-squash)) (switches ("-a" "Stage all modified and deleted files" "--all") ("-e" "Allow empty commit" "--allow-empty") ("-v" "Show diff of changes to be committed" "--verbose") ("-n" "Bypass git hooks" "--no-verify") ("-s" "Add Signed-off-by line" "--signoff") ("-R" "Claim authorship and reset author date" "--reset-author")) (arguments ("=A" "Override the author" "--author=" read-from-minibuffer) ("=S" "Sign using gpg" "--gpg-sign=" magit-read-gpg-secret-key))) (merging (man-page "git-merge") (actions ("m" "Merge" magit-merge) ("A" "Abort" magit-merge-abort)) (switches ("-ff" "Fast-forward only" "--ff-only") ("-nf" "No fast-forward" "--no-ff") ("-sq" "Squash" "--squash")) (arguments ("-st" "Strategy" "--strategy=" read-from-minibuffer))) (rewriting (actions ("b" "Begin" magit-rewrite-start) ("s" "Stop" magit-rewrite-stop) ("a" "Abort" magit-rewrite-abort) ("f" "Finish" magit-rewrite-finish) ("d" "Diff pending" magit-rewrite-diff-pending) ("*" "Set unused" magit-rewrite-set-unused) ("." "Set used" magit-rewrite-set-used))) (apply-mailbox (man-page "git-am") (actions ("J" "Apply Mailbox" magit-apply-mailbox)) (switches ("-s" "add a Signed-off-by line to the commit message" "--signoff") ("-3" "allow fall back on 3way merging if needed" "--3way") ("-k" "pass -k flag to git-mailinfo" "--keep") ("-c" "strip everything before a scissors line" "--scissors") ("-p" "pass it through git-apply" "-p") ("-r" "override error message when patch failure occurs" "--resolvemsg") ("-d" "lie about committer date" "--committer-date-is-author-date") ("-D" "use current timestamp for author date" "--ignore-date") ("-b" "pass -b flag to git-mailinfo" "--keep-non-patch")) (arguments ("=p" "format the patch(es) are in" "--patch-format=" read-from-minibuffer))) (submodule (man-page "git-submodule") (actions ("u" "Update" magit-submodule-update) ("b" "Both update and init" magit-submodule-update-init) ("i" "Init" magit-submodule-init) ("s" "Sync" magit-submodule-sync))) (bisecting (man-page "git-bisect") (actions ("b" "Bad" magit-bisect-bad) ("g" "Good" magit-bisect-good) ("k" "Skip" magit-bisect-skip) ("r" "Reset" magit-bisect-reset) ("s" "Start" magit-bisect-start) ("u" "Run" magit-bisect-run))) (diff-options (actions ("s" "Set" magit-set-diff-options) ("d" "Set default" magit-set-default-diff-options) ("c" "Save default" magit-save-default-diff-options) ("r" "Reset to default" magit-reset-diff-options) ("h" "Toggle Hunk Refinement" magit-diff-toggle-refine-hunk)) (switches ("-m" "Show smallest possible diff" "--minimal") ("-p" "Use patience diff algorithm" "--patience") ("-h" "Use histogram diff algorithm" "--histogram") ("-b" "Ignore whitespace changes" "--ignore-space-change") ("-w" "Ignore all whitespace" "--ignore-all-space") ("-W" "Show surrounding functions" "--function-context")))) "\ +Holds the key, help, function mapping for the log-mode. +If you modify this make sure you reset `magit-key-mode-keymaps' +to nil.") + (mapc (lambda (g) (eval `(autoload ',(intern (concat "magit-key-mode-popup-" (symbol-name (car g)))) "magit-key-mode" ,(concat "Key menu for " (symbol-name (car g))) t))) magit-key-mode-groups) + +;;;*** + +;;;### (autoloads (global-magit-wip-save-mode magit-wip-save-mode) +;;;;;; "magit-wip" "magit-wip.el" (21478 16669 0 0)) +;;; Generated autoloads from magit-wip.el + +(autoload 'magit-wip-save-mode "magit-wip" "\ +Magit support for committing to a work-in-progress ref. + +When this minor mode is turned on and a file is saved inside a +writable git repository then it is also committed to a special +work-in-progress ref. + +\(fn &optional ARG)" t nil) + +(defvar global-magit-wip-save-mode nil "\ +Non-nil if Global-Magit-Wip-Save mode is enabled. +See the command `global-magit-wip-save-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-magit-wip-save-mode'.") + +(custom-autoload 'global-magit-wip-save-mode "magit-wip" nil) + +(autoload 'global-magit-wip-save-mode "magit-wip" "\ +Toggle Magit-Wip-Save mode in all buffers. +With prefix ARG, enable Global-Magit-Wip-Save mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Magit-Wip-Save mode is enabled in all buffers where +`turn-on-magit-wip-save' would do it. +See `magit-wip-save-mode' for more information on Magit-Wip-Save mode. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("magit-pkg.el") (21478 16669 624918 0)) + +;;;*** + +(provide 'magit-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; magit-autoloads.el ends here diff --git a/elpa/magit-20140807.909/magit-blame.el b/elpa/magit-20140807.909/magit-blame.el new file mode 100644 index 000000000..839b9069a --- /dev/null +++ b/elpa/magit-20140807.909/magit-blame.el @@ -0,0 +1,307 @@ +;;; magit-blame.el --- blame support for Magit + +;; Copyright (C) 2012-2014 The Magit Project Developers +;; +;; For a full list of contributors, see the AUTHORS.md file +;; at the top-level directory of this distribution and at +;; https://raw.github.com/magit/magit/master/AUTHORS.md + +;; Author: Yann Hodique +;; Package: magit + +;; Contains code from Egg (Emacs Got Git) , +;; released under the GNU General Public License version 3 or later. + +;; Magit 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, or (at your option) +;; any later version. +;; +;; Magit 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 Magit. If not, see . + +;;; Commentary: + +;; Control git-blame from Magit. +;; This code has been backported from Egg (Magit fork) to Magit. + +;;; Code: + +(eval-when-compile (require 'cl-lib)) +(require 'magit) +(require 'easymenu) + +;;; Options + +(defgroup magit-blame nil + "Git-blame support for Magit." + :group 'magit-extensions) + +(defcustom magit-blame-ignore-whitespace t + "Ignore whitespace when determining blame information." + :group 'magit-blame + :type 'boolean) + +(defcustom magit-time-format-string "%Y-%m-%dT%T%z" + "How to format time in magit-blame header." + :group 'magit-blame + :type 'string) + +(defface magit-blame-header + '((t :inherit magit-section-title)) + "Face for blame header." + :group 'magit-faces) + +(defface magit-blame-sha1 + '((t :inherit (magit-log-sha1 magit-blame-header))) + "Face for blame sha1." + :group 'magit-faces) + +(defface magit-blame-culprit + '((t :inherit magit-blame-header)) + "Face for blame culprit." + :group 'magit-faces) + +(defface magit-blame-time + '((t :inherit magit-blame-header)) + "Face for blame time." + :group 'magit-faces) + +(defface magit-blame-subject + '((t :inherit (magit-log-message magit-blame-header))) + "Face for blame tag line." + :group 'magit-faces) + +;;; Keymaps + +(defvar magit-blame-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "l") 'magit-blame-locate-commit) + (define-key map (kbd "RET") 'magit-blame-locate-commit) + (define-key map (kbd "q") 'magit-blame-mode) + (define-key map (kbd "n") 'magit-blame-next-chunk) + (define-key map (kbd "p") 'magit-blame-previous-chunk) + map) + "Keymap for an annotated section.\\{magit-blame-map}") + +(easy-menu-define magit-blame-mode-menu magit-blame-map + "Magit blame menu" + '("Blame" + ["Locate Commit" magit-blame-locate-commit t] + ["Next" magit-blame-next-chunk t] + ["Previous" magit-blame-previous-chunk t] + "---" + ["Quit" magit-blame-mode t])) + +;;; Mode + +(defvar-local magit-blame-buffer-read-only nil) + +;;;###autoload +(define-minor-mode magit-blame-mode + "Display blame information inline." + :keymap magit-blame-map + :lighter " blame" + (unless (buffer-file-name) + (user-error "Current buffer has no associated file!")) + (when (and (buffer-modified-p) + (y-or-n-p (format "save %s first? " (buffer-file-name)))) + (save-buffer)) + + (cond (magit-blame-mode + (setq magit-blame-buffer-read-only buffer-read-only) + (magit-blame-file-on (current-buffer)) + (set-buffer-modified-p nil) + (setq buffer-read-only t)) + (t + (magit-blame-file-off (current-buffer)) + (set-buffer-modified-p nil) + (setq buffer-read-only magit-blame-buffer-read-only)))) + +(defun magit-blame-file-off (buffer) + (save-excursion + (save-restriction + (with-current-buffer buffer + (widen) + (mapc (lambda (ov) + (when (overlay-get ov :blame) + (delete-overlay ov))) + (overlays-in (point-min) (point-max))))))) + +(defun magit-blame-file-on (buffer) + (magit-blame-file-off buffer) + (save-excursion + (with-current-buffer buffer + (save-restriction + (with-temp-buffer + (apply 'magit-git-insert "blame" "--porcelain" + `(,@(and magit-blame-ignore-whitespace (list "-w")) "--" + ,(file-name-nondirectory (buffer-file-name buffer)))) + (magit-blame-parse buffer (current-buffer))))))) + +;;; Commands + +(defun magit-blame-locate-commit (pos) + "Jump to a commit in the branch history from an annotated blame section." + (interactive "d") + (let ((overlays (overlays-at pos)) + sha1) + (dolist (ov overlays) + (when (overlay-get ov :blame) + (setq sha1 (plist-get (nth 3 (overlay-get ov :blame)) :sha1)))) + (when sha1 + (magit-show-commit sha1)))) + +(defun magit-blame-next-chunk () + "Go to the next blame chunk." + (interactive) + (let ((next (next-single-property-change (point) :blame))) + (when next + (goto-char next)))) + +(defun magit-blame-previous-chunk () + "Go to the previous blame chunk." + (interactive) + (let ((prev (previous-single-property-change (point) :blame))) + (when prev + (goto-char prev)))) + +;;; Parse + +(defun magit-blame-decode-time (unixtime &optional tz) + "Decode UNIXTIME into (HIGH LOW) format. + +The second argument TZ can be used to add the timezone in (-)HHMM +format to UNIXTIME. UNIXTIME should be either a number +containing seconds since epoch or Emacs's (HIGH LOW . IGNORED) +format." + (when (numberp tz) + (unless (numberp unixtime) + (setq unixtime (float-time unixtime))) + (let* ((ptz (abs tz)) + (min (+ (* (/ ptz 100) 60) + (mod ptz 100)))) + (setq unixtime (+ (* (if (< tz 0) (- min) min) 60) unixtime)))) + + (when (numberp unixtime) + (setq unixtime (seconds-to-time unixtime))) + unixtime) + +(defun magit-blame-format-time-string (format &optional unixtime tz) + "Use FORMAT to format the time UNIXTIME, or now if omitted. + +UNIXTIME is specified as a number containing seconds since epoch +or Emacs's (HIGH LOW . IGNORED) format. The optional argument TZ +can be used to set the time zone. If TZ is a number it is +treated as a (-)HHMM offset to Universal Time. If TZ is not +a number and non-nil the time is printed in UTC. If TZ is nil +the local zime zone is used. The format of the function is +similar to `format-time-string' except for %Z which is not +officially supported at the moment." + (unless unixtime + (setq unixtime (current-time))) + (when (numberp tz) ;; TODO add support for %Z + (setq format (replace-regexp-in-string "%z" (format "%+05d" tz) format))) + (format-time-string format (magit-blame-decode-time unixtime tz) tz)) + +(defun magit-blame-parse (target-buf blame-buf) + "Parse blame-info in buffer BLAME-BUF and decorate TARGET-BUF buffer." + (save-match-data + (let ((blank (propertize " " 'face 'magit-blame-header)) + (nl (propertize "\n" 'face 'magit-blame-header)) + (commit-hash (make-hash-table :test 'equal :size 577)) + commit commit-info old-line new-line num old-file subject author + author-time author-timezone info ov beg end blame) + (with-current-buffer blame-buf + (goto-char (point-min)) + ;; search for a ful commit info + (while (re-search-forward + "^\\([0-9a-f]\\{40\\}\\) \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\)$" + nil t) + (setq commit (match-string-no-properties 1) + old-line (string-to-number + (match-string-no-properties 2)) + new-line (string-to-number + (match-string-no-properties 3)) + num (string-to-number + (match-string-no-properties 4))) + ;; was this commit already seen (and stored in the hash)? + (setq commit-info (gethash commit commit-hash)) + ;; Nope, this is the 1st time, the full commit-info follow. + (unless commit-info + (re-search-forward "^author \\(.+\\)$") + (setq author (match-string-no-properties 1)) + (re-search-forward "^author-time \\(.+\\)$") + (setq author-time (string-to-number + (match-string-no-properties 1))) + (re-search-forward "^author-tz \\(.+\\)$") + (setq author-timezone (string-to-number + (match-string-no-properties 1))) + (re-search-forward "^summary \\(.+\\)$") + (setq subject (match-string-no-properties 1)) + (re-search-forward "^filename \\(.+\\)$") + (setq old-file (match-string-no-properties 1)) + (setq commit-info (list :sha1 commit :author author + :author-time author-time + :author-timezone author-timezone + :subject subject :file old-file)) + ;; save it in the hash + (puthash commit commit-info commit-hash)) + ;; add the current blame-block into the list INFO. + (setq info (cons (list old-line new-line num commit-info) + info)))) + ;; now do from beginning + (setq info (nreverse info)) + (with-current-buffer target-buf + ;; for every blame chunk + (dolist (chunk info) + (setq commit-info (nth 3 chunk) + old-line (nth 0 chunk) + new-line (nth 1 chunk) + num (nth 2 chunk) + commit (plist-get commit-info :sha1) + author (plist-get commit-info :author) + author-time (plist-get commit-info :author-time) + author-timezone (plist-get commit-info :author-timezone) + subject (plist-get commit-info :subject)) + + (goto-char (point-min)) + (forward-line (1- new-line)) + + (setq beg (line-beginning-position) + end (save-excursion + (forward-line num) + (line-beginning-position))) + ;; mark the blame chunk + (put-text-property beg end :blame chunk) + + ;; make an overlay with blame info as 'before-string + ;; on the current chunk. + (setq ov (make-overlay beg end)) + (overlay-put ov :blame chunk) + (setq blame (concat + (propertize (substring-no-properties commit 0 8) + 'face 'magit-blame-sha1) + blank + (propertize (format "%-20s" author) + 'face 'magit-blame-culprit) + blank + (propertize (magit-blame-format-time-string + magit-time-format-string + author-time author-timezone) + 'face 'magit-blame-time) + blank + (propertize subject 'face 'magit-blame-subject) + blank nl)) + (overlay-put ov 'before-string blame)))))) + +(provide 'magit-blame) +;; Local Variables: +;; indent-tabs-mode: nil +;; End: +;;; magit-blame.el ends here diff --git a/elpa/magit-20140807.909/magit-blame.elc b/elpa/magit-20140807.909/magit-blame.elc new file mode 100644 index 000000000..56c4e84b2 Binary files /dev/null and b/elpa/magit-20140807.909/magit-blame.elc differ diff --git a/elpa/magit-20140807.909/magit-key-mode.el b/elpa/magit-20140807.909/magit-key-mode.el new file mode 100644 index 000000000..e486fc3b5 --- /dev/null +++ b/elpa/magit-20140807.909/magit-key-mode.el @@ -0,0 +1,735 @@ +;;; magit-key-mode.el --- interactively tune git invocation + +;; Copyright (C) 2010-2014 The Magit Project Developers +;; +;; For a full list of contributors, see the AUTHORS.md file +;; at the top-level directory of this distribution and at +;; https://raw.github.com/magit/magit/master/AUTHORS.md + +;; Author: Phil Jackson +;; Package: magit + +;; Magit 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, or (at your option) +;; any later version. +;; +;; Magit 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 Magit. If not, see . + +;;; Commentary: + +;; This library implements `magit-key-mode' which is used throughout +;; Magit to let the user interactively select the command, switches +;; and options to call Git with. It can be though of as a way to +;; provide "postfix" arguments. + +;;; Code: + +(require 'magit) + +(eval-when-compile (require 'cl-lib)) + +(defvar magit-key-mode-keymaps) +(defvar magit-key-mode-last-buffer) +(defvar magit-pre-key-mode-window-conf) + +;;; Options + +(defcustom magit-key-mode-show-usage t + "Whether to show usage information when entering a popup." + :group 'magit + :type 'boolean) + +;;; Faces + +(defface magit-key-mode-header-face + '((t :inherit font-lock-keyword-face)) + "Face for key mode header lines." + :group 'magit-faces) + +(defface magit-key-mode-button-face + '((t :inherit font-lock-builtin-face)) + "Face for key mode buttons." + :group 'magit-faces) + +(defface magit-key-mode-switch-face + '((t :inherit font-lock-warning-face)) + "Face for key mode switches." + :group 'magit-faces) + +(defface magit-key-mode-args-face + '((t :inherit widget-field)) + "Face for key mode switch arguments." + :group 'magit-faces) + +;;; Keygroups +;;;###autoload +(defvar magit-key-mode-groups + '((dispatch + (actions + ("b" "Branching" magit-key-mode-popup-branching) + ("B" "Bisecting" magit-key-mode-popup-bisecting) + ("c" "Committing" magit-key-mode-popup-committing) + ("d" "Diff worktree" magit-diff-working-tree) + ("D" "Diff" magit-diff) + ("f" "Fetching" magit-key-mode-popup-fetching) + ("F" "Pulling" magit-key-mode-popup-pulling) + ("g" "Refresh Buffers" magit-refresh-all) + ("l" "Logging" magit-key-mode-popup-logging) + ("m" "Merging" magit-key-mode-popup-merging) + ("M" "Remoting" magit-key-mode-popup-remoting) + ("P" "Pushing" magit-key-mode-popup-pushing) + ("o" "Submoduling" magit-key-mode-popup-submodule) + ("r" "Rewriting" magit-key-mode-popup-rewriting) + ("R" "Rebasing" magit-rebase-step) + ("s" "Show Status" magit-status) + ("S" "Stage all" magit-stage-all) + ("t" "Tagging" magit-key-mode-popup-tagging) + ("U" "Unstage all" magit-unstage-all) + ("v" "Show Commit" magit-show-commit) + ("V" "Show File" magit-show) + ("w" "Wazzup" magit-wazzup) + ("X" "Reset worktree" magit-reset-working-tree) + ("y" "Cherry" magit-cherry) + ("z" "Stashing" magit-key-mode-popup-stashing) + ("!" "Running" magit-key-mode-popup-running) + ("$" "Show Process" magit-display-process))) + + (logging + (man-page "git-log") + (actions + ("l" "Short" magit-log) + ("L" "Long" magit-log-long) + ("h" "Head Reflog" magit-reflog-head) + ("f" "File log" magit-file-log) + ("rl" "Ranged short" magit-log-ranged) + ("rL" "Ranged long" magit-log-long-ranged) + ("rh" "Reflog" magit-reflog)) + (switches + ("-m" "Only merge commits" "--merges") + ("-s" "No merge commits" "--no-merges") + ("-do" "Date Order" "--date-order") + ("-f" "First parent" "--first-parent") + ("-i" "Case insensitive patterns" "-i") + ("-pr" "Pickaxe regex" "--pickaxe-regex") + ("-g" "Show Graph" "--graph") + ("-n" "Name only" "--name-only") + ("-am" "All match" "--all-match") + ("-al" "All" "--all")) + (arguments + ("=r" "Relative" "--relative=" read-directory-name) + ("=c" "Committer" "--committer=" read-from-minibuffer) + ("=>" "Since" "--since=" read-from-minibuffer) + ("=<" "Before" "--before=" read-from-minibuffer) + ("=a" "Author" "--author=" read-from-minibuffer) + ("=g" "Grep messages" "--grep=" read-from-minibuffer) + ("=G" "Grep patches" "-G" read-from-minibuffer) + ("=L" "Trace evolution of line range [long log only]" + "-L" magit-read-file-trace) + ("=s" "Pickaxe search" "-S" read-from-minibuffer) + ("=b" "Branches" "--branches=" read-from-minibuffer) + ("=R" "Remotes" "--remotes=" read-from-minibuffer))) + + (running + (actions + ("!" "Git Subcommand (from root)" magit-git-command-topdir) + (":" "Git Subcommand (from pwd)" magit-git-command) + ("g" "Git Gui" magit-run-git-gui) + ("k" "Gitk" magit-run-gitk))) + + (fetching + (man-page "git-fetch") + (actions + ("f" "Current" magit-fetch-current) + ("a" "All" magit-remote-update) + ("o" "Other" magit-fetch)) + (switches + ("-p" "Prune" "--prune"))) + + (pushing + (man-page "git-push") + (actions + ("P" "Push" magit-push) + ("t" "Push tags" magit-push-tags)) + (switches + ("-f" "Force" "--force") + ("-d" "Dry run" "-n") + ("-u" "Set upstream" "-u"))) + + (pulling + (man-page "git-pull") + (actions + ("F" "Pull" magit-pull)) + (switches + ("-f" "Force" "--force") + ("-r" "Rebase" "--rebase"))) + + (branching + (man-page "git-branch") + (actions + ("v" "Branch manager" magit-branch-manager) + ("b" "Checkout" magit-checkout) + ("c" "Create" magit-create-branch) + ("r" "Rename" magit-rename-branch) + ("k" "Delete" magit-delete-branch)) + (switches + ("-t" "Set upstream configuration" "--track") + ("-m" "Merged to HEAD" "--merged") + ("-M" "Merged to master" "--merged=master") + ("-n" "Not merged to HEAD" "--no-merged") + ("-N" "Not merged to master" "--no-merged=master")) + (arguments + ("=c" "Contains" "--contains=" magit-read-rev-with-default) + ("=m" "Merged" "--merged=" magit-read-rev-with-default) + ("=n" "Not merged" "--no-merged=" magit-read-rev-with-default))) + + (remoting + (man-page "git-remote") + (actions + ("v" "Remote manager" magit-branch-manager) + ("a" "Add" magit-add-remote) + ("r" "Rename" magit-rename-remote) + ("k" "Remove" magit-remove-remote))) + + (tagging + (man-page "git-tag") + (actions + ("t" "Create" magit-tag) + ("k" "Delete" magit-delete-tag)) + (switches + ("-a" "Annotate" "--annotate") + ("-f" "Force" "--force") + ("-s" "Sign" "--sign"))) + + (stashing + (man-page "git-stash") + (actions + ("v" "View" magit-diff-stash) + ("z" "Save" magit-stash) + ("s" "Snapshot" magit-stash-snapshot) + ("a" "Apply" magit-stash-apply) + ("p" "Pop" magit-stash-pop) + ("k" "Drop" magit-stash-drop)) + (switches + ("-k" "Keep index" "--keep-index") + ("-u" "Include untracked files" "--include-untracked") + ("-a" "Include all files" "--all"))) + + (committing + (man-page "git-commit") + (actions + ("c" "Commit" magit-commit) + ("a" "Amend" magit-commit-amend) + ("e" "Extend" magit-commit-extend) + ("r" "Reword" magit-commit-reword) + ("f" "Fixup" magit-commit-fixup) + ("s" "Squash" magit-commit-squash)) + (switches + ("-a" "Stage all modified and deleted files" "--all") + ("-e" "Allow empty commit" "--allow-empty") + ("-v" "Show diff of changes to be committed" "--verbose") + ("-n" "Bypass git hooks" "--no-verify") + ("-s" "Add Signed-off-by line" "--signoff") + ("-R" "Claim authorship and reset author date" "--reset-author")) + (arguments + ("=A" "Override the author" "--author=" read-from-minibuffer) + ("=S" "Sign using gpg" "--gpg-sign=" magit-read-gpg-secret-key))) + + (merging + (man-page "git-merge") + (actions + ("m" "Merge" magit-merge) + ("A" "Abort" magit-merge-abort)) + (switches + ("-ff" "Fast-forward only" "--ff-only") + ("-nf" "No fast-forward" "--no-ff") + ("-sq" "Squash" "--squash")) + (arguments + ("-st" "Strategy" "--strategy=" read-from-minibuffer))) + + (rewriting + (actions + ("b" "Begin" magit-rewrite-start) + ("s" "Stop" magit-rewrite-stop) + ("a" "Abort" magit-rewrite-abort) + ("f" "Finish" magit-rewrite-finish) + ("d" "Diff pending" magit-rewrite-diff-pending) + ("*" "Set unused" magit-rewrite-set-unused) + ("." "Set used" magit-rewrite-set-used))) + + (apply-mailbox + (man-page "git-am") + (actions + ("J" "Apply Mailbox" magit-apply-mailbox)) + (switches + ("-s" "add a Signed-off-by line to the commit message" "--signoff") + ("-3" "allow fall back on 3way merging if needed" "--3way") + ("-k" "pass -k flag to git-mailinfo" "--keep") + ("-c" "strip everything before a scissors line" "--scissors") + ("-p" "pass it through git-apply" "-p") + ("-r" "override error message when patch failure occurs" "--resolvemsg") + ("-d" "lie about committer date" "--committer-date-is-author-date") + ("-D" "use current timestamp for author date" "--ignore-date") + ("-b" "pass -b flag to git-mailinfo" "--keep-non-patch")) + (arguments + ("=p" "format the patch(es) are in" "--patch-format=" read-from-minibuffer))) + + (submodule + (man-page "git-submodule") + (actions + ("u" "Update" magit-submodule-update) + ("b" "Both update and init" magit-submodule-update-init) + ("i" "Init" magit-submodule-init) + ("s" "Sync" magit-submodule-sync))) + + (bisecting + (man-page "git-bisect") + (actions + ("b" "Bad" magit-bisect-bad) + ("g" "Good" magit-bisect-good) + ("k" "Skip" magit-bisect-skip) + ("r" "Reset" magit-bisect-reset) + ("s" "Start" magit-bisect-start) + ("u" "Run" magit-bisect-run))) + + (diff-options + (actions + ("s" "Set" magit-set-diff-options) + ("d" "Set default" magit-set-default-diff-options) + ("c" "Save default" magit-save-default-diff-options) + ("r" "Reset to default" magit-reset-diff-options) + ("h" "Toggle Hunk Refinement" magit-diff-toggle-refine-hunk)) + (switches + ("-m" "Show smallest possible diff" "--minimal") + ("-p" "Use patience diff algorithm" "--patience") + ("-h" "Use histogram diff algorithm" "--histogram") + ("-b" "Ignore whitespace changes" "--ignore-space-change") + ("-w" "Ignore all whitespace" "--ignore-all-space") + ("-W" "Show surrounding functions" "--function-context")) + )) + "Holds the key, help, function mapping for the log-mode. +If you modify this make sure you reset `magit-key-mode-keymaps' +to nil.") + +(defun magit-key-mode-delete-group (group) + "Delete a group from `magit-key-mode-keymaps'." + (let ((items (assoc group magit-key-mode-groups))) + (when items + ;; reset the cache + (setq magit-key-mode-keymaps nil) + ;; delete the whole group + (setq magit-key-mode-groups + (delq items magit-key-mode-groups)) + ;; unbind the defun + (magit-key-mode-de-generate group)) + magit-key-mode-groups)) + +(defun magit-key-mode-add-group (group) + "Add a new group to `magit-key-mode-keymaps'. +If there already is a group of that name then this will +completely remove it and put in its place an empty one of the +same name." + (when (assoc group magit-key-mode-groups) + (magit-key-mode-delete-group group)) + (setq magit-key-mode-groups + (cons (list group (list 'actions) (list 'switches) (list 'arguments)) + magit-key-mode-groups))) + +(defun magit-key-mode-key-defined-p (for-group key) + "Return t if KEY is defined as any option within FOR-GROUP. +The option may be a switch, argument or action." + (catch 'result + (let ((options (magit-key-mode-options-for-group for-group))) + (dolist (type '(actions switches arguments)) + (when (assoc key (assoc type options)) + (throw 'result t)))))) + +(defun magit-key-mode-update-group (for-group thing &rest args) + "Abstraction for setting values in `magit-key-mode-keymaps'." + (let* ((options (magit-key-mode-options-for-group for-group)) + (things (assoc thing options)) + (key (car args))) + (if (cdr things) + (if (magit-key-mode-key-defined-p for-group key) + (error "%s is already defined in the %s group." key for-group) + (setcdr (cdr things) (cons args (cddr things)))) + (setcdr things (list args))) + (setq magit-key-mode-keymaps nil) + things)) + +(defun magit-key-mode-insert-argument (for-group key desc arg read-func) + "Add a new binding KEY in FOR-GROUP which will use READ-FUNC +to receive input to apply to argument ARG git is run. DESC should +be a brief description of the binding." + (magit-key-mode-update-group for-group 'arguments key desc arg read-func)) + +(defun magit-key-mode-insert-switch (for-group key desc switch) + "Add a new binding KEY in FOR-GROUP which will add SWITCH to git's +command line when it runs. DESC should be a brief description of +the binding." + (magit-key-mode-update-group for-group 'switches key desc switch)) + +(defun magit-key-mode-insert-action (for-group key desc func) + "Add a new binding KEY in FOR-GROUP which will run command FUNC. +DESC should be a brief description of the binding." + (magit-key-mode-update-group for-group 'actions key desc func)) + +(defun magit-key-mode-options-for-group (for-group) + "Retrieve the options for the group FOR-GROUP. +This includes switches, commands and arguments." + (or (cdr (assoc for-group magit-key-mode-groups)) + (error "Unknown group '%s'" for-group))) + +;;; Commands + +(defun magit-key-mode-help (for-group) + "Provide help for a key within FOR-GROUP. +The user is prompted for the key." + (let* ((opts (magit-key-mode-options-for-group for-group)) + (man-page (cadr (assoc 'man-page opts))) + (seq (read-key-sequence + (format "Enter command prefix%s: " + (if man-page + (format ", `?' for man `%s'" man-page) + "")))) + (actions (cdr (assoc 'actions opts)))) + (cond + ;; if it is an action popup the help for the to-be-run function + ((assoc seq actions) (describe-function (nth 2 (assoc seq actions)))) + ;; if there is "?" show a man page if there is one + ((equal seq "?") + (if man-page + (man man-page) + (error "No man page associated with `%s'" for-group))) + (t (error "No help associated with `%s'" seq))))) + +(defun magit-key-mode-exec-at-point () + "Run action/args/option at point." + (interactive) + (let ((key (or (get-text-property (point) 'key-group-executor) + (error "Nothing at point to do.")))) + (call-interactively (lookup-key (current-local-map) key)))) + +(defun magit-key-mode-jump-to-next-exec () + "Jump to the next action/args/option point." + (interactive) + (let* ((oldp (point)) + (old (get-text-property oldp 'key-group-executor)) + (p (if (= oldp (point-max)) (point-min) (1+ oldp)))) + (while (let ((new (get-text-property p 'key-group-executor))) + (and (not (= p oldp)) (or (not new) (eq new old)))) + (setq p (if (= p (point-max)) (point-min) (1+ p)))) + (goto-char p) + (skip-chars-forward " "))) + +;;; Keymaps + +(defvar magit-key-mode-keymaps nil + "This will be filled lazily with proper keymaps. +These keymaps are created using `define-key' as they're requested.") + +(defun magit-key-mode-build-keymap (for-group) + "Construct a normal looking keymap for the key mode to use. +Put it in `magit-key-mode-keymaps' for fast lookup." + (let* ((options (magit-key-mode-options-for-group for-group)) + (actions (cdr (assoc 'actions options))) + (switches (cdr (assoc 'switches options))) + (arguments (cdr (assoc 'arguments options))) + (map (make-sparse-keymap))) + (suppress-keymap map 'nodigits) + ;; ret dwim + (define-key map (kbd "RET") 'magit-key-mode-exec-at-point) + ;; tab jumps to the next "button" + (define-key map (kbd "TAB") 'magit-key-mode-jump-to-next-exec) + + ;; all maps should `quit' with `C-g' or `q' + (define-key map (kbd "C-g") `(lambda () + (interactive) + (magit-key-mode-command nil))) + (define-key map (kbd "q") `(lambda () + (interactive) + (magit-key-mode-command nil))) + ;; run help + (define-key map (kbd "?") `(lambda () + (interactive) + (magit-key-mode-help ',for-group))) + + (let ((defkey (lambda (k action) + (when (and (lookup-key map (car k)) + (not (numberp (lookup-key map (car k))))) + (message "Warning: overriding binding for `%s' in %S" + (car k) for-group) + (ding) + (sit-for 2)) + (define-key map (car k) + `(lambda () (interactive) ,action))))) + (dolist (k actions) + (funcall defkey k `(magit-key-mode-command ',(nth 2 k)))) + (dolist (k switches) + (funcall defkey k `(magit-key-mode-toggle-option ',for-group ,(nth 2 k)))) + (dolist (k arguments) + (funcall defkey k `(magit-key-mode-add-argument + ',for-group ,(nth 2 k) ',(nth 3 k))))) + + (push (cons for-group map) magit-key-mode-keymaps) + map)) + +;;; Toggling and Running + +(defvar magit-key-mode-prefix nil + "Prefix argument to the command that brought up the key-mode window. +For internal use. Used by the command that's eventually invoked.") + +(defvar magit-key-mode-current-args nil + "A hash-table of current argument set. +These will eventually make it to the git command-line.") + +(defvar magit-key-mode-current-options nil + "Current option set. +These will eventually make it to the git command-line.") + +(defvar magit-custom-options nil + "List of custom options to pass to Git. +Do not customize this (used in the `magit-key-mode' implementation).") + +(defun magit-key-mode-command (func) + (let ((current-prefix-arg (or current-prefix-arg magit-key-mode-prefix)) + (magit-custom-options magit-key-mode-current-options)) + (maphash (lambda (k v) + (push (concat k v) magit-custom-options)) + magit-key-mode-current-args) + (set-window-configuration magit-pre-key-mode-window-conf) + (kill-buffer magit-key-mode-last-buffer) + (when func + (setq this-command func) + (call-interactively this-command)))) + +(defun magit-key-mode-add-argument (for-group arg-name input-func) + (let ((input (funcall input-func (concat arg-name ": ")))) + (puthash arg-name input magit-key-mode-current-args) + (magit-key-mode-redraw for-group))) + +(defun magit-key-mode-toggle-option (for-group option-name) + "Toggles the appearance of OPTION-NAME in `magit-key-mode-current-options'." + (if (member option-name magit-key-mode-current-options) + (setq magit-key-mode-current-options + (delete option-name magit-key-mode-current-options)) + (add-to-list 'magit-key-mode-current-options option-name)) + (magit-key-mode-redraw for-group)) + +;;; Mode + +(defvar magit-key-mode-buf-name "*magit-key: %s*" + "Format string to create the name of the magit-key buffer.") + +(defvar magit-key-mode-last-buffer nil + "Store the last magit-key buffer used.") + +(defvar magit-pre-key-mode-window-conf nil + "Will hold the pre-menu configuration of magit.") + +(defun magit-key-mode (for-group &optional original-opts) + "Mode for magit key selection. +All commands, switches and options can be toggled/actioned with +the key combination highlighted before the description." + (interactive) + ;; save the window config to restore it as was (no need to make this + ;; buffer local) + (setq magit-pre-key-mode-window-conf + (current-window-configuration)) + ;; setup the mode, draw the buffer + (let ((buf (get-buffer-create (format magit-key-mode-buf-name + (symbol-name for-group))))) + (setq magit-key-mode-last-buffer buf) + (split-window-vertically) + (other-window 1) + (switch-to-buffer buf) + (kill-all-local-variables) + (set (make-local-variable 'scroll-margin) 0) + (set (make-local-variable + 'magit-key-mode-current-options) + original-opts) + (set (make-local-variable + 'magit-key-mode-current-args) + (make-hash-table)) + (set (make-local-variable 'magit-key-mode-prefix) current-prefix-arg) + (magit-key-mode-redraw for-group)) + (when magit-key-mode-show-usage + (message (concat "Type a prefix key to toggle it. " + "Run 'actions' with their prefixes. " + "'?' for more help.")))) + +(defun magit-key-mode-get-key-map (for-group) + "Get or build the keymap for FOR-GROUP." + (or (cdr (assoc for-group magit-key-mode-keymaps)) + (magit-key-mode-build-keymap for-group))) + +(defun magit-key-mode-redraw (for-group) + "(re)draw the magit key buffer." + (let ((buffer-read-only nil) + (current-exec (get-text-property (point) 'key-group-executor)) + (new-exec-pos) + (old-point (point)) + (is-first (zerop (buffer-size))) + (actions-p nil)) + (erase-buffer) + (make-local-variable 'font-lock-defaults) + (use-local-map (magit-key-mode-get-key-map for-group)) + (setq actions-p (magit-key-mode-draw for-group)) + (delete-trailing-whitespace) + (setq mode-name "magit-key-mode" major-mode 'magit-key-mode) + (when current-exec + (setq new-exec-pos + (cdr (assoc current-exec + (magit-key-mode-build-exec-point-alist))))) + (cond ((and is-first actions-p) + (goto-char actions-p) + (magit-key-mode-jump-to-next-exec)) + (new-exec-pos + (goto-char new-exec-pos) + (skip-chars-forward " ")) + (t + (goto-char old-point)))) + (setq buffer-read-only t) + (fit-window-to-buffer)) + +(defun magit-key-mode-build-exec-point-alist () + (save-excursion + (goto-char (point-min)) + (let* ((exec (get-text-property (point) 'key-group-executor)) + (exec-alist (and exec `((,exec . ,(point)))))) + (cl-do nil ((eobp) (nreverse exec-alist)) + (when (not (eq exec (get-text-property (point) 'key-group-executor))) + (setq exec (get-text-property (point) 'key-group-executor)) + (when exec (push (cons exec (point)) exec-alist))) + (forward-char))))) + +;;; Draw Buffer + +(defun magit-key-mode-draw-header (header) + "Draw a header with the correct face." + (insert (propertize header 'face 'magit-key-mode-header-face) "\n")) + +(defvar magit-key-mode-args-in-cols nil + "When true, draw arguments in columns as with switches and options.") + +(defun magit-key-mode-draw-args (args) + "Draw the args part of the menu." + (magit-key-mode-draw-buttons + "Args" + args + (lambda (x) + (format "(%s) %s" + (nth 2 x) + (propertize (gethash (nth 2 x) magit-key-mode-current-args "") + 'face 'magit-key-mode-args-face))) + (not magit-key-mode-args-in-cols))) + +(defun magit-key-mode-draw-switches (switches) + "Draw the switches part of the menu." + (magit-key-mode-draw-buttons + "Switches" + switches + (lambda (x) + (format "(%s)" (let ((s (nth 2 x))) + (if (member s magit-key-mode-current-options) + (propertize s 'face 'magit-key-mode-switch-face) + s)))))) + +(defun magit-key-mode-draw-actions (actions) + "Draw the actions part of the menu." + (magit-key-mode-draw-buttons "Actions" actions nil)) + +(defun magit-key-mode-draw-buttons (section xs maker + &optional one-col-each) + (when xs + (magit-key-mode-draw-header section) + (magit-key-mode-draw-in-cols + (mapcar (lambda (x) + (let* ((head (propertize (car x) 'face 'magit-key-mode-button-face)) + (desc (nth 1 x)) + (more (and maker (funcall maker x))) + (text (format " %s: %s%s%s" + head desc (if more " " "") (or more "")))) + (propertize text 'key-group-executor (car x)))) + xs) + one-col-each))) + +(defun magit-key-mode-draw-in-cols (strings one-col-each) + "Given a list of strings, print in columns (using `insert'). +If ONE-COL-EACH is true then don't columify, but rather, draw +each item on one line." + (let ((longest-act (apply 'max (mapcar 'length strings)))) + (while strings + (let ((str (car strings))) + (let ((padding (make-string (- (+ longest-act 3) (length str)) ? ))) + (insert str) + (if (or one-col-each + (and (> (+ (length padding) ; + (current-column) + longest-act) + (window-width)) + (cdr strings))) + (insert "\n") + (insert padding)))) + (setq strings (cdr strings)))) + (insert "\n")) + +(defun magit-key-mode-draw (for-group) + "Draw actions, switches and parameters. +Return the point before the actions part, if any, nil otherwise." + (let* ((options (magit-key-mode-options-for-group for-group)) + (switches (cdr (assoc 'switches options))) + (arguments (cdr (assoc 'arguments options))) + (actions (cdr (assoc 'actions options))) + (p nil)) + (magit-key-mode-draw-switches switches) + (magit-key-mode-draw-args arguments) + (when actions (setq p (point-marker))) + (magit-key-mode-draw-actions actions) + (insert "\n") + p)) + +;;; Generate Groups + +(defun magit-key-mode-de-generate (group) + "Unbind the function for GROUP." + (fmakunbound + (intern (concat "magit-key-mode-popup-" (symbol-name group))))) + +(defun magit-key-mode-generate (group) + "Generate the key-group menu for GROUP." + (let ((opts (magit-key-mode-options-for-group group))) + (eval + `(defun ,(intern (concat "magit-key-mode-popup-" (symbol-name group))) nil + ,(concat "Key menu for " (symbol-name group)) + (interactive) + (magit-key-mode + (quote ,group) + ;; As a tempory kludge it is okay to do this here. + ,(cl-case group + (logging + '(list "--graph")) + (diff-options + '(when (local-variable-p 'magit-diff-options) + magit-diff-options)))))))) + +;; create the interactive functions for the key mode popups (which are +;; applied in the top-level key maps) +(mapc (lambda (g) + (magit-key-mode-generate (car g))) + magit-key-mode-groups) + +;;;###autoload (mapc (lambda (g) (eval `(autoload ',(intern (concat "magit-key-mode-popup-" (symbol-name (car g)))) "magit-key-mode" ,(concat "Key menu for " (symbol-name (car g))) t))) magit-key-mode-groups) + +(provide 'magit-key-mode) +;; Local Variables: +;; indent-tabs-mode: nil +;; End: +;;; magit-key-mode.el ends here diff --git a/elpa/magit-20140807.909/magit-key-mode.elc b/elpa/magit-20140807.909/magit-key-mode.elc new file mode 100644 index 000000000..f1bb37e3c Binary files /dev/null and b/elpa/magit-20140807.909/magit-key-mode.elc differ diff --git a/elpa/magit-20140807.909/magit-pkg.el b/elpa/magit-20140807.909/magit-pkg.el new file mode 100644 index 000000000..b2c3e2c6a --- /dev/null +++ b/elpa/magit-20140807.909/magit-pkg.el @@ -0,0 +1,6 @@ +(define-package "magit" "20140807.909" "control Git from Emacs" + '((cl-lib "0.3") + (git-commit-mode "0.14.0") + (git-rebase-mode "0.14.0")) + :keywords + '("vc" "tools")) diff --git a/elpa/magit-20140807.909/magit-pkg.elc b/elpa/magit-20140807.909/magit-pkg.elc new file mode 100644 index 000000000..5a6cda1fa Binary files /dev/null and b/elpa/magit-20140807.909/magit-pkg.elc differ diff --git a/elpa/magit-20140807.909/magit-wip.el b/elpa/magit-20140807.909/magit-wip.el new file mode 100644 index 000000000..e2e355098 --- /dev/null +++ b/elpa/magit-20140807.909/magit-wip.el @@ -0,0 +1,142 @@ +;;; magit-wip.el --- git-wip plug-in for Magit + +;; Copyright (C) 2012-2014 The Magit Project Developers +;; +;; For a full list of contributors, see the AUTHORS.md file +;; at the top-level directory of this distribution and at +;; https://raw.github.com/magit/magit/master/AUTHORS.md + +;; Author: Jonas Bernoulli +;; Keywords: vc tools +;; Package: magit + +;; Magit 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, or (at your option) +;; any later version. +;; +;; Magit 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 Magit. If not, see . + +;;; Commentary: + +;; This plug-in provides support for special work-in-progress refs. + +;; This requires the third-party git command "git wip" which is available +;; from https://github.com/bartman/git-wip. + +;; To enable `magit-wip-save-mode' enable `global-magit-wip-save-mode' +;; and use the Magit extension mechanism to select the repositories in +;; which you want to use a work-in-progress ref. +;; +;; (global-magit-wip-save-mode 1) +;; +;; $ git config --add magit.extension wip-save # or +;; $ git config --global --add magit.extension wip-save + +;; Note that `global-magit-wip-save-mode' is the only mode that uses the +;; extension mechanism for file-visiting buffers all other global modes +;; making use of it to turn on local modes in Magit buffers. + +;;; Code: + +(require 'magit) +(require 'format-spec) + +(defun magit-wip-mode (&rest ignore) + (message "magit-wip-mode is obsolete and doesn't do anything")) +(make-obsolete 'magit-wip-mode "This mode is a noop now" "2.0.0") + +;;; Options + +(defgroup magit-wip nil + "Git-Wip support for Magit." + :group 'magit-extensions) + +(defcustom magit-wip-commit-message "WIP %r" + "Commit message for git-wip commits. + +The following `format'-like specs are supported: +%f the full name of the file being saved +%g the root of the git repository +%r the name of the file being saved, + relative to the repository root." + :group 'magit-wip + :type 'string) + +(defcustom magit-wip-echo-area-message "Wrote %f (wip)" + "Message shown in the echo area after creating a git-wip commit. + +The following `format'-like specs are supported: +%f the full name of the file being saved +%g the root of the git repository +%r the name of the file being saved, + relative to the repository root." + :group 'magit-wip + :type '(choice (const :tag "No message" nil) string)) + +(defvar magit-wip-save-mode-lighter " Wip") + +;;; Mode + +;;;###autoload +(define-minor-mode magit-wip-save-mode + "Magit support for committing to a work-in-progress ref. + +When this minor mode is turned on and a file is saved inside a +writable git repository then it is also committed to a special +work-in-progress ref." + :lighter magit-wip-save-mode-lighter + (if magit-wip-save-mode + (add-hook 'after-save-hook 'magit-wip-save t t) + (remove-hook 'after-save-hook 'magit-wip-save t))) + +;;;###autoload +(define-globalized-minor-mode global-magit-wip-save-mode + magit-wip-save-mode turn-on-magit-wip-save + :group 'magit-wip) + +(defun turn-on-magit-wip-save () + "Conditionally turn on magit-wip-save-mode. + +Turn on magit-wip-save-mode if the buffer is a file in a git +repository where wip-save is enabled in git config. + +You can activate it with git config magit.extension wip-save." + (when (and (buffer-file-name) + (magit-get-top-dir) + (member "wip-save" (magit-get-all "magit.extension"))) + (if (magit-git-success "wip" "-h") + (magit-wip-save-mode 1) + (message "Git command 'git wip' cannot be found")))) + +(defun magit-wip-save () + (let* ((filename (expand-file-name (file-truename (buffer-file-name)))) + (filedir (file-name-directory filename)) + (toplevel (magit-get-top-dir filedir)) + (blobname (file-relative-name filename toplevel)) + (spec `((?f . ,filename) + (?r . ,blobname) + (?g . ,toplevel)))) + (when (and toplevel (file-writable-p toplevel) + (not (member blobname + (let ((default-directory filedir)) + (magit-git-lines + "ls-files" "--other" "--ignored" + "--exclude-standard" "--full-name"))))) + (magit-run-git "wip" "save" + (format-spec magit-wip-commit-message spec) + "--editor" "--" filename) + (when magit-wip-echo-area-message + (message (format-spec magit-wip-echo-area-message spec)))))) + +(provide 'magit-wip) +;; Local Variables: +;; indent-tabs-mode: nil +;; End: +;;; magit-wip.el ends here diff --git a/elpa/magit-20140807.909/magit-wip.elc b/elpa/magit-20140807.909/magit-wip.elc new file mode 100644 index 000000000..43de48baa Binary files /dev/null and b/elpa/magit-20140807.909/magit-wip.elc differ diff --git a/elpa/magit-20140807.909/magit.el b/elpa/magit-20140807.909/magit.el new file mode 100644 index 000000000..60215007a --- /dev/null +++ b/elpa/magit-20140807.909/magit.el @@ -0,0 +1,7854 @@ +;;; magit.el --- control Git from Emacs + +;; Copyright (C) 2008-2014 The Magit Project Developers +;; +;; For a full list of contributors, see the AUTHORS.md file +;; at the top-level directory of this distribution and at +;; https://raw.github.com/magit/magit/master/AUTHORS.md + +;; Author: Marius Vollmer +;; Maintainer: Jonas Bernoulli +;; Former-Maintainers: +;; Nicolas Dudebout +;; Peter J. Weisberg +;; Phil Jackson +;; Rémi Vanicat +;; Yann Hodique + +;; Keywords: vc tools +;; Package: magit +;; Package-Requires: ((cl-lib "0.3") (git-commit-mode "0.14.0") (git-rebase-mode "0.14.0")) + +;; Magit requires at least GNU Emacs 23.2 and Git 1.7.2.5. +;; These are the versions shipped by Debian oldstable (6.0, Squeeze). + +;; Contains code from GNU Emacs , +;; released under the GNU General Public License version 3 or later. + +;; Magit 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, or (at your option) +;; any later version. +;; +;; Magit 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 Magit. If not, see . + +;;; Commentary: + +;; Invoking the magit-status function will show a buffer with the +;; status of the current git repository and its working tree. That +;; buffer offers key bindings for manipulating the status in simple +;; ways. +;; +;; The status buffer mainly shows the difference between the working +;; tree and the index, and the difference between the index and the +;; current HEAD. You can add individual hunks from the working tree +;; to the index, and you can commit the index. +;; +;; See the Magit User Manual for more information. + +;;; Code: + +(defvar magit-version 'undefined + "The version of Magit that you're using. +Use the function by the same name instead of this variable.") +;; The value is set at the end of this file, using the +;; function `magit-version' which is also defined there. + +;;;; Dependencies + +(when (version< emacs-version "23.2") + (error "Magit requires at least GNU Emacs 23.2")) + +;; Users may choose to use `magit-log-edit' instead of the preferred +;; `git-commit-mode', by simply putting it on the `load-path'. If +;; it can be found there then it is loaded at the end of this file. +(unless (locate-library "magit-log-edit") + (require 'git-commit-mode)) + +(require 'git-rebase-mode) + +(require 'ansi-color) +(require 'autorevert) +(require 'cl-lib) +(require 'diff-mode) +(require 'easymenu) +(require 'epa) +(require 'format-spec) +(require 'grep) +(require 'help-mode) +(require 'ring) +(require 'server) +(require 'tramp) +(require 'view) + +(eval-when-compile + (require 'dired) + (require 'dired-x) + (require 'ediff) + (require 'eshell) + (require 'ido) + (require 'iswitchb) + (require 'package nil t) + (require 'view)) + +;;;; Declarations + +(if (featurep 'vc-git) + (defalias 'magit-grep 'vc-git-grep) + (defalias 'magit-grep 'lgrep)) + +(declare-function dired-jump 'dired-x) +(declare-function dired-uncache 'dired) +(declare-function ediff-cleanup-mess 'ediff) +(declare-function eshell-parse-arguments 'eshell) +(declare-function ido-completing-read 'ido) +(declare-function iswitchb-read-buffer 'iswitchb) +(declare-function package-desc-vers 'package) +(declare-function package-desc-version 'package) +(declare-function package-version-join 'package) +(declare-function view-mode 'view) + +(defvar git-commit-previous-winconf) +(defvar magit-commit-buffer-name) +(defvar magit-custom-options) +(defvar magit-log-buffer-name) +(defvar magit-marked-commit) +(defvar magit-process-buffer-name) +(defvar magit-reflog-buffer-name) +(defvar magit-refresh-args) +(defvar magit-stash-buffer-name) +(defvar magit-status-buffer-name) +(defvar magit-this-process) +(defvar package-alist) + +;;;; Compatibility + +(eval-and-compile + + ;; Added in Emacs 24.3 + (unless (fboundp 'user-error) + (defalias 'user-error 'error)) + + ;; Added in Emacs 24.3 (mirrors/emacs@b335efc3). + (unless (fboundp 'setq-local) + (defmacro setq-local (var val) + "Set variable VAR to value VAL in current buffer." + (list 'set (list 'make-local-variable (list 'quote var)) val))) + + ;; Added in Emacs 24.3 (mirrors/emacs@b335efc3). + (unless (fboundp 'defvar-local) + (defmacro defvar-local (var val &optional docstring) + "Define VAR as a buffer-local variable with default value VAL. +Like `defvar' but additionally marks the variable as being automatically +buffer-local wherever it is set." + (declare (debug defvar) (doc-string 3)) + (list 'progn (list 'defvar var val docstring) + (list 'make-variable-buffer-local (list 'quote var))))) + + ;; Added in Emacs 24.1 + (unless (fboundp 'run-hook-wrapped) + (defun run-hook-wrapped-1 (hook fns wrap-function &rest args) + (cl-loop for fn in fns + if (and (eq fn t) + (local-variable-p hook) + (default-boundp hook) + (apply 'run-hook-wrapped-1 nil + (default-value hook) wrap-function args)) + return it + else if (and (functionp fn) (apply wrap-function fn args)) + return it)) + + (defun run-hook-wrapped (hook wrap-function &rest args) + "Run HOOK, passing each function through WRAP-FUNCTION. +I.e. instead of calling each function FUN directly with arguments ARGS, +it calls WRAP-FUNCTION with arguments FUN and ARGS. +As soon as a call to WRAP-FUNCTION returns non-nil, `run-hook-wrapped' +aborts and returns that value." + (when (boundp hook) + (let ((fns (symbol-value hook))) + (apply 'run-hook-wrapped-1 hook + (if (functionp fns) (list fns) fns) + wrap-function args))))) + ) + + +;;; Settings +;;;; Custom Groups + +(defgroup magit nil + "Controlling Git from Emacs." + :group 'tools) + +(defgroup magit-process nil + "Git and other external processes used by Magit." + :group 'magit) + +(defgroup magit-modes nil + "Modes provided by Magit." + :group 'magit) + +(defgroup magit-status nil + "Inspect and manipulate Git repositories." + :group 'magit-modes) + +(defgroup magit-diff nil + "Inspect and manipulate Git diffs." + :group 'magit-modes) + +(defgroup magit-commit nil + "Inspect and manipulate Git commits." + :group 'magit-modes) + +(defgroup magit-log nil + "Inspect and manipulate Git history." + :group 'magit-modes) + +(defgroup magit-extensions nil + "Extensions to Magit." + :group 'magit) + +(defgroup magit-faces nil + "Faces used by Magit." + :group 'magit + :group 'faces) + +(when (featurep 'gitattributes-mode) + (custom-add-to-group 'magit-modes 'gitattributes-mode 'custom-group)) + +(when (featurep 'git-commit-mode) + (custom-add-to-group 'magit-modes 'git-commit 'custom-group) + (custom-add-to-group 'magit-faces 'git-commit-faces 'custom-group)) + +(when (featurep 'git-rebase-mode) + (custom-add-to-group 'magit-modes 'git-rebase 'custom-group) + (custom-add-to-group 'magit-faces 'git-rebase-faces 'custom-group)) + +(custom-add-to-group 'magit 'vc-follow-symlinks 'custom-variable) + +;;;; Custom Options +;;;;; Processes + +(defcustom magit-git-executable + (or (and (eq system-type 'windows-nt) + ;; On Windows asking for "git" from $PATH might also return + ;; a "git.exe" or "git.cmd". Using "bin/git.exe" directly + ;; is faster than using one of the wrappers "cmd/git.exe" + ;; or "cmd/git.cmd". The wrappers are likely to come + ;; earlier on $PATH, and so we have to exlicitly use + ;; the former. + (let ((exe (executable-find "git.exe"))) + (when exe + (let ((alt (directory-file-name (file-name-directory exe)))) + (if (and (equal (file-name-nondirectory alt) "cmd") + (setq alt (expand-file-name + (convert-standard-filename "bin/git.exe") + (file-name-directory alt))) + (file-executable-p alt)) + alt + exe))))) + ;; When the only cost is finding the executable, then it it + ;; better not to cache the full path. It might not be installed + ;; in the same location on machines whose repositories are + ;; accessed using Tramp. + "git") + "The Git executable used by Magit." + :group 'magit-process + :type 'string) + +(defcustom magit-git-standard-options + '("--no-pager" "-c" "core.preloadindex=true") + "Standard options when running Git. +Be careful what you add here, especially if you are using +tramp to connect to servers with ancient Git versions." + :group 'magit-process + :type '(repeat string)) + +(defcustom magit-gitk-executable + (or (and (eq system-type 'windows-nt) + (let ((exe (expand-file-name + "gitk" (file-name-nondirectory magit-git-executable)))) + (and (file-executable-p exe) exe))) + (executable-find "gitk") "gitk") + "The Gitk executable." + :group 'magit-process + :set-after '(magit-git-executable) + :type 'string) + +(defun magit-locate-emacsclient () + "Search for a suitable Emacsclient executable." + (let ((path (cl-copy-list exec-path)) fixup client) + (when invocation-directory + (setq path (cons (directory-file-name invocation-directory) path)) + (when (eq system-type 'darwin) + (setq fixup (expand-file-name "bin" invocation-directory)) + (when (file-directory-p fixup) + (push fixup path)) + (when (string-match "^Emacs-\\(powerpc\\|i386\\|x86_64\\)-\\(.+\\)" + invocation-name) + (setq fixup (expand-file-name + (format "bin-%s-%s" + (match-string 1 invocation-name) + (match-string 2 invocation-name)) + invocation-directory)) + (when (file-directory-p fixup) + (push fixup path))) + (when (string-match-p "Cellar" invocation-directory) + (setq fixup (expand-file-name "../../../bin" invocation-directory)) + (when (file-directory-p fixup) + (push fixup path)))) + (setq path (delete-dups path))) + (setq client (magit-locate-emacsclient-1 path 3)) + (if client + (shell-quote-argument client) + (display-warning 'magit (format "\ +Cannot determine a suitable Emacsclient + +Determining an Emacsclient executable suitable for the +current Emacs instance failed. For more information +please see https://github.com/magit/magit/wiki/Emacsclient.")) + nil))) + +(defun magit-take (n l) ; until we get to use `-take' from dash + (let (r) (dotimes (_ n) (and l (push (pop l) r))) (nreverse r))) + +(defun magit-locate-emacsclient-1 (path depth) + (let* ((version-lst (magit-take depth (split-string emacs-version "\\."))) + (version-reg (concat "^" (mapconcat #'identity version-lst "\\.")))) + (or (locate-file-internal + "emacsclient" path + (cl-mapcan + (lambda (v) (cl-mapcar (lambda (e) (concat v e)) exec-suffixes)) + (nconc (cl-mapcon (lambda (v) + (setq v (mapconcat #'identity (reverse v) ".")) + (list v (concat "-" v))) + (reverse version-lst)) + (list ""))) + (lambda (exec) + (ignore-errors + (string-match-p version-reg (magit-emacsclient-version exec))))) + (and (> depth 1) + (magit-locate-emacsclient-1 path (1- depth)))))) + +(defun magit-emacsclient-version (exec) + (cadr (split-string (car (process-lines exec "--version"))))) + +(defcustom magit-emacsclient-executable (magit-locate-emacsclient) + "The Emacsclient executable. +If the default is nil, or commiting or rebasing is somehow broken, +please see https://github.com/magit/magit/wiki/Emacsclient." + :package-version '(magit . "2.0.0") + :group 'magit-process + :type '(choice (string :tag "Executable") + (const :tag "Don't use Emacsclient" nil))) + +(defcustom magit-process-connection-type (not (eq system-type 'cygwin)) + "Connection type used for the git process. + +If nil, use pipes: this is usually more efficient, and works on Cygwin. +If t, use ptys: this enables magit to prompt for passphrases when needed." + :group 'magit-process + :type '(choice (const :tag "pipe" nil) + (const :tag "pty" t))) + +(defcustom magit-process-popup-time -1 + "Popup the process buffer if a command takes longer than this many seconds." + :group 'magit-process + :type '(choice (const :tag "Never" -1) + (const :tag "Immediately" 0) + (integer :tag "After this many seconds"))) + +(defcustom magit-process-log-max 32 + "Maximum number of sections to keep in a process log buffer. +When adding a new section would go beyond the limit set here, +then the older half of the sections are remove. Sections that +belong to processes that are still running are never removed." + :package-version '(magit . "2.0.0") + :group 'magit-process + :type 'integer) + +(defcustom magit-process-quote-curly-braces + (and (eq system-type 'windows-nt) + (let ((case-fold-search t)) + (string-match-p "cygwin" magit-git-executable)) + t) + "Whether curly braces should be quoted when calling git. +This may be necessary when using Windows. On all other system +types this must always be nil. + +We are not certain when quoting is needed, but it appears it is +needed when using Cygwin Git but not when using stand-alone Git. +The default value is set based on that assumptions. If this +turns out to be wrong you can customize this option but please +also comment on issue #816." + :package-version '(magit . "2.0.0") + :group 'magit-process + :set-after '(magit-git-executable) + :type 'boolean) + +(defcustom magit-process-yes-or-no-prompt-regexp + " [\[(]\\([Yy]\\(?:es\\)?\\)[/|]\\([Nn]o?\\)[\])] ?[?:] ?$" + "Regexp matching Yes-or-No prompts of git and its subprocesses." + :package-version '(magit . "2.0.0") + :group 'magit-process + :type 'regexp) + +(defcustom magit-process-password-prompt-regexps + '("^\\(Enter \\)?[Pp]assphrase\\( for \\(RSA \\)?key '.*'\\)?: ?$" + "^\\(Enter \\)?[Pp]assword\\( for '.*'\\)?: ?$" + "^.*'s password: ?$" + "^Yubikey for .*: ?$") + "List of regexps matching password prompts of git and its subprocesses." + :package-version '(magit . "2.0.0") + :group 'magit-process + :type '(repeat (regexp))) + +(defcustom magit-process-username-prompt-regexps + '("^Username for '.*': ?$") + "List of regexps matching username prompts of git and its subprocesses." + :package-version '(magit . "2.0.0") + :group 'magit-process + :type '(repeat (regexp))) + +(defconst magit-server-window-type + '(choice + (const :tag "Use selected window" + :match (lambda (widget value) + (not (functionp value))) + nil) + (function-item :tag "Display in new frame" switch-to-buffer-other-frame) + (function-item :tag "Use pop-to-buffer" pop-to-buffer) + (function :tag "Other function"))) + +(defcustom magit-server-window-for-commit 'pop-to-buffer + "Function used to select a window for displaying commit message buffers. +It should take one argument (a buffer) and display and select it. +A common value is `pop-to-buffer'. It can also be nil in which +case the selected window is used." + :package-version '(magit . "2.0.0") + :group 'magit-process + :type magit-server-window-type) + +(defcustom magit-server-window-for-rebase server-window + "Function used to select a window for displaying interactive rebase buffers. +It should take one argument (a buffer) and display and select it. +A common value is `pop-to-buffer'. It can also be nil in which +case the selected window is used." + :package-version '(magit . "2.0.0") + :group 'magit-process + :set-after '(server-window) + :type magit-server-window-type) + +;;;;; Staging + +(defcustom magit-stage-all-confirm t + "Whether to require confirmation before staging all changes. +This reduces the risk of accidentally losing the index. If +nothing at all is staged yet, then always stage without requiring +confirmation, because it can be undone without the risk of losing +a carefully crafted index." + :package-version '(magit . "2.0.0") + :group 'magit + :type 'boolean) + +(defcustom magit-unstage-all-confirm t + "Whether to require confirmation before unstaging all changes. +This reduces the risk of accidentally losing of the index. If +there are no staged changes at all, then always unstage without +confirmation, because it can be undone without the risk of losing +a carefully crafted index." + :package-version '(magit . "2.0.0") + :group 'magit + :type 'boolean) + +(defcustom magit-revert-item-confirm t + "Whether to require confirmation before reverting hunks. +If you disable this, consider enabling `magit-revert-backup' +instead." + :group 'magit + :type 'boolean) + +(defcustom magit-revert-backup nil + "Whether to backup a hunk before reverting it. +The hunk is stored in \".git/magit/reverted.diff\" and can be +applied using `magit-revert-undo'. Older hunks are available +in the same directory as numbered backup files and have to be +applied manually. Only individual hunks are backed up; when +a complete file is reverted (which requires confirmation) no +backup is created." + :package-version '(magit . "2.1.0") + :group 'magit + :type 'boolean) + +(defcustom magit-save-some-buffers t + "Whether certain commands save modified buffers before running. + +nil don't save buffers. +t ask which buffers to save. +`dontask' save all buffers without asking." + :group 'magit + :type '(choice (const :tag "Never" nil) + (const :tag "Ask" t) + (const :tag "Save without asking" dontask))) + +(defcustom magit-save-some-buffers-predicate + 'magit-save-buffers-predicate-tree-only + "A predicate function to decide whether to save a buffer. + +Used by function `magit-save-some-buffers' when the variable of +the same name is non-nil." + :group 'magit + :type '(radio (function-item magit-save-buffers-predicate-tree-only) + (function-item magit-save-buffers-predicate-all) + (function :tag "Other"))) + +(defcustom magit-rewrite-inclusive t + "Whether magit includes the selected base commit in a rewrite operation. + +t means both the selected commit as well as any subsequent +commits will be rewritten. This is magit's default behaviour, +equivalent to 'git rebase -i ${REV}~1' + + A'---B'---C'---D' + ^ + +nil means the selected commit will be literally used as 'base', +so only subsequent commits will be rewritten. This is consistent +with git-rebase, equivalent to 'git rebase -i ${REV}', yet more +cumbersome to use from the status buffer. + + A---B'---C'---D' + ^" + :group 'magit + :type '(choice (const :tag "Always" t) + (const :tag "Never" nil) + (const :tag "Ask" ask))) + +;;;;; Highlighting + +(defun magit-set-variable-and-refresh (symbol value) + "Set SYMBOL to VALUE and call `magit-refresh-all'." + (set-default symbol value) + ;; If magit isn't fully loaded yet no buffer that might + ;; need refreshing can exist and we can take a shortcut. + ;; We also don't want everything to repeatedly refresh + ;; when evaluating this file. + (when (and (featurep 'magit) (not buffer-file-name)) + (magit-refresh-all))) + +(defcustom magit-highlight-whitespace t + "Specify where to highlight whitespace errors. +See `magit-highlight-trailing-whitespace', +`magit-highlight-indentation'. The symbol t means in all diffs, +`status' means only in the status buffer, and nil means nowhere." + :group 'magit + :set 'magit-set-variable-and-refresh + :type '(choice (const :tag "Always" t) + (const :tag "Never" nil) + (const :tag "In status buffer" status))) + +(defcustom magit-highlight-trailing-whitespace t + "Whether to highlight whitespace at the end of a line in diffs. +Used only when `magit-highlight-whitespace' is non-nil." + :group 'magit + :set 'magit-set-variable-and-refresh + :type 'boolean) + +(defcustom magit-highlight-indentation nil + "Highlight the \"wrong\" indentation style. +Used only when `magit-highlight-whitespace' is non-nil. + +The value is a list of cons cells. The car is a regular +expression, and the cdr is the value that applies to repositories +whose directory matches the regular expression. If more than one +item matches, then the *last* item in the list applies. So, the +default value should come first in the list. + +If the value is `tabs', highlight indentation with tabs. If the +value is an integer, highlight indentation with at least that +many spaces. Otherwise, highlight neither." + :group 'magit + :set 'magit-set-variable-and-refresh + :type `(repeat (cons (string :tag "Directory regexp") + (choice (const :tag "Tabs" tabs) + (integer :tag "Spaces" :value ,tab-width) + (const :tag "Neither" nil))))) ;^FIXME + +(defcustom magit-item-highlight-face 'magit-item-highlight + "The face used to highlight the current section. + +By default the highlighting of the current section is done using +the background color specified by face `magit-item-highlight'. + +If you don't want to use the background to do the highlighting, +this *might* by as easy as customizing that face. However if you +are using a theme, which in turn sets the background color of +that face then, due to limitations in face inheritance when using +themes, you might be forced to use another face. + +Unfortunately it is only possible to override a face attribute, +set by a theme, but not to drop it entirely. This means that one +has to explicitly use the `default' background color, to make it +appear *as if* the background wasn't used. + +One reason you might want to *not* use the background, is that +doing so forces the use of overlays for parts of diffs and for +refnames. Using overlays potentially degrades performance when +generating large diffs. Also see option `magit-use-overlays'." + :package-version '(magit . "2.0.0") + :group 'magit + :group 'magit-faces + :type '(choice (const magit-item-highlight) + (const bold) + (face :tag "Other face") + (const :tag "Don't highlight" nil))) + +(defcustom magit-use-overlays + (not (eq magit-item-highlight-face 'bold)) + "Whether to use overlays to highlight various diff components. + +This has to be non-nil if the current section is highlighted by +changing the background color. Otherwise background colors that +hold semantic meaning, like that of the added and removed lines +in diffs, as well as section headings, would be shadowed by the +highlighting. + +To select the face used for highlighting customize the option +`magit-item-highlight-face'. If you set that to `bold' or some +other face that does not use the background then you can set this +option to nil. Doing so could potentially improve performance +when generating large diffs." + :package-version '(magit . "2.1.0") + :group 'magit + :group 'magit-faces + :set-after '(magit-item-highlight-face) + :type 'boolean) + +(define-obsolete-variable-alias 'magit-diff-use-overlays + 'magit-use-overlays "2.1.0") + +;;;;; Completion + +(defcustom magit-completing-read-function 'magit-builtin-completing-read + "Function to be called when requesting input from the user." + :group 'magit + :type '(radio (function-item magit-iswitchb-completing-read) + (function-item magit-ido-completing-read) + (function-item magit-builtin-completing-read) + (function :tag "Other"))) + +(defcustom magit-remote-ref-format 'remote-slash-branch + "How to format refs when autocompleting, in particular for remotes. + +Autocompletion is used by functions like `magit-checkout', +`magit-interactive-rebase' and others which offer branch name +completion. + +`remote-slash-branch' Format refs as \"remote/branch\". +`branch-then-remote' Format refs as \"branch (remote)\"." + :package-version '(magit . "2.0.0") + :group 'magit + :type '(choice (const :tag "branch (remote)" branch-then-remote) + (const :tag "remote/branch" remote-slash-branch))) + +(defcustom magit-repo-dirs nil + "Directories containing Git repositories. +Magit will look into these directories for Git repositories and +offer them as choices for `magit-status'." + :group 'magit + :type '(repeat string)) + +(defcustom magit-repo-dirs-depth 3 + "The maximum depth to look for Git repos. +When looking for a Git repository below the directories in +`magit-repo-dirs', Magit will only descend this many levels +deep." + :group 'magit + :type 'integer) + +(defcustom magit-default-tracking-name-function + 'magit-default-tracking-name-remote-plus-branch + "Function used to generate default tracking branch names +when doing a \\[magit-checkout]. + +The default is `magit-default-tracking-name-remote-plus-branch', +which generates a tracking name of the form \"REMOTE-BRANCHNAME\"." + :group 'magit + :type '(radio (function-item magit-default-tracking-name-remote-plus-branch) + (function-item magit-default-tracking-name-branch-only) + (function :tag "Other"))) + +;;;;; Modes +;;;;;; Common + +(defcustom magit-mode-hook nil + "Hook run when entering a Magit mode derived mode." + :options '(magit-load-config-extensions) + :group 'magit-modes + :type 'hook) + +(defcustom magit-show-xref-buttons '(magit-diff-mode magit-commit-mode) + "List of modes whose buffers should contain history buttons. +Currently only `magit-diff-mode' and `magit-commit-mode' are +supported." + :package-version '(magit . "2.0.0") + :group 'magit-modes + :type '(repeat (choice (const magit-diff-mode) + (const magit-commit-mode)))) + +(defcustom magit-show-child-count nil + "Whether to append the number of childen to section headings." + :package-version '(magit . "2.0.0") + :group 'magit-modes + :type 'boolean) + +(defvar magit-status-line-align-to 9) + +(defcustom magit-restore-window-configuration nil + "Whether quitting a Magit buffer restores previous window configuration. + +Function `magit-mode-display-buffer' is used to display and +select Magit buffers. Unless the buffer was already displayed in +a window of the selected frame it also stores the previous window +configuration. If this option is non-nil that configuration will +later be restored by `magit-mode-quit-window', provided the +buffer has not since been displayed in another frame. + +This works best when only two windows are usually displayed in a +frame. If this isn't the case setting this to t might often lead +to undesirable behaviour. Also quitting a Magit buffer while +another Magit buffer that was created earlier is still displayed +will cause that buffer to be hidden, which might or might not be +what you want." + :package-version '(magit . "2.0.0") + :group 'magit-modes + :type 'boolean) + +(defcustom magit-refs-namespaces + '(("^\\(HEAD\\)$" magit-log-head-label-head nil) + ("^refs/tags/\\(.+\\)" magit-log-head-label-tags nil) + ("^refs/heads/\\(.+\\)" magit-log-head-label-local nil) + ("^refs/remotes/\\(.+\\)" magit-log-head-label-remote nil) + ("^refs/bisect/\\(bad\\)" magit-log-head-label-bisect-bad nil) + ("^refs/bisect/\\(skip.*\\)" magit-log-head-label-bisect-skip nil) + ("^refs/bisect/\\(good.*\\)" magit-log-head-label-bisect-good nil) + ("^refs/wip/\\(.+\\)" magit-log-head-label-wip nil) + ("^refs/patches/\\(.+\\)" magit-log-head-label-patches nil) + ("^\\(bad\\):" magit-log-head-label-bisect-bad nil) + ("^\\(skip\\):" magit-log-head-label-bisect-skip nil) + ("^\\(good\\):" magit-log-head-label-bisect-good nil) + ("\\(.+\\)" magit-log-head-label-default nil)) + "How different refs should be formatted for display. + +Each entry controls how a certain type of ref is displayed, and +has the form (REGEXP FACE FORMATTER). REGEXP is a regular +expression used to match full refs. The first entry whose REGEXP +matches the reference is used. The first regexp submatch becomes +the \"label\" that represents the ref and is propertized with +font FONT. If FORMATTER is non-nil it should be a function that +takes two arguments, the full ref and the face. It is supposed +to return a propertized label that represents the ref. + +Currently this variable is only used in logs and the branch +manager but it will be used in more places in the future." + :package-version '(magit . "2.0.0") + :group 'magit-modes + :type '(repeat + (list regexp + face + (choice (const :tag "first submatch is label" nil) + (function :tag "format using function"))))) + +;;;;;; Status + +(defcustom magit-status-mode-hook nil + "Hook run when the `magit-status' buffer is created." + :group 'magit-status + :type 'hook) + +(defcustom magit-status-sections-hook + '(magit-insert-status-local-line + magit-insert-status-remote-line + magit-insert-status-head-line + magit-insert-status-tags-line + magit-insert-status-merge-line + magit-insert-status-rebase-lines + magit-insert-empty-line + magit-insert-rebase-sequence + magit-insert-bisect-output + magit-insert-bisect-rest + magit-insert-bisect-log + magit-insert-stashes + magit-insert-untracked-files + magit-insert-pending-commits + magit-insert-unstaged-changes + magit-insert-staged-changes + magit-insert-unpulled-commits + magit-insert-unpushed-commits) + "Hook run to insert sections into the status buffer. + +This option allows reordering the sections and adding sections +that are by default displayed in other Magit buffers. Doing the +latter is currently not recommended because not all functions +that insert sections have been adapted yet. Only inserters that +take no argument can be used and some functions exist that begin +with the `magit-insert-' prefix but do not insert a section. + +Note that there are already plans to improve this and to add +similar hooks for other Magit modes." + :package-version '(magit . "2.0.0") + :group 'magit-status + :type 'hook) + +(defcustom magit-status-buffer-switch-function 'pop-to-buffer + "Function for `magit-status' to use for switching to the status buffer. + +The function is given one argument, the status buffer." + :group 'magit-status + :type '(radio (function-item switch-to-buffer) + (function-item pop-to-buffer) + (function :tag "Other"))) + +(defcustom magit-status-show-sequence-help t + "Whether to show instructions on how to proceed a stopped action. +When this is non-nil and a commit failed to apply during a merge +or rebase, then show instructions on how to continue." + :package-version '(magit . "2.0.0") + :group 'magit-status + :type 'boolean) + +(defcustom magit-status-tags-line-subject 'head + "Whether tag or head is the subject on tags line in status buffer. + +This controls how the words \"ahead\" and \"behind\" are used on +the tags line in the status buffer. The tags line does not +actually display complete sentences, but when thinking about when +to use which term, it helps imagining it did. This option +controls whether the tag names should be considered the subjects +or objects in these sentences. + +`tag' The previous tag is *behind* HEAD by N commits. + The next tag is *ahead* of HEAD by N commits. +`head' HEAD is *ahead* of the previous tag by N commits. + HEAD is *behind* the next tag by N commits. + +If the value is `tag' the commit counts are fontified; otherwise +they are not (due to semantic considerations)." + :package-version '(magit . "2.0.0") + :group 'magit-status + :type '(choice (const :tag "tags are the subjects" tag) + (const :tag "head is the subject" head))) + +;;;;;; Diff + +(defun magit-set-default-diff-options (symbol value) + "Set the default for `magit-diff-options' based on popup value. +Also set the local value in all Magit buffers and refresh them. +\n(fn)" ; The arguments are an internal implementation detail. + (interactive (list 'magit-diff-options magit-custom-options)) + (set-default symbol value) + (when (and (featurep 'magit) (not buffer-file-name)) + (dolist (buffer (buffer-list)) + (when (derived-mode-p 'magit-mode) + (with-current-buffer buffer + (with-no-warnings + (setq-local magit-diff-options value)) + (magit-mode-refresh-buffer)))))) + +(defcustom magit-diff-options nil + "Git options used to display diffs. + +For more information about the options see man:git-diff. +This variable can be conveniently set in Magit buffers +using `magit-key-mode-popup-diff-options' (bound to \ +\\\\[magit-key-mode-popup-diff-options]). + +Please note that not all of these options are supported by older +versions of Git, which could become a problem if you use tramp to +access repositories on a system with such a version. If you see +whitespace where you would have expected a diff, this likely is +the cause, and the only (currently) workaround is to not make the +problematic option a member of the default value." + :package-version '(magit . "2.0.0") + :group 'magit-diff + :set 'magit-set-default-diff-options + :type '(set :greedy t + (const :tag + "--minimal Show smallest possible diff" + "--minimal") + (const :tag + "--patience Use patience diff algorithm" + "--patience") + (const :tag + "--histogram Use histogram diff algorithm" + "--histogram") + (const :tag + "--ignore-space-change Ignore whitespace changes" + "--ignore-space-change") + (const :tag + "--ignore-all-space Ignore all whitespace" + "--ignore-all-space") + (const :tag + "--function-context Show surrounding functions" + "--function-context"))) + +(put 'magit-diff-options 'permanent-local t) + +(defcustom magit-show-diffstat t + "Whether to show diffstat in diff and commit buffers." + :package-version '(magit . "2.0.0") + :group 'magit-diff + :group 'magit-commit + :type 'boolean) + +(defcustom magit-diff-refine-hunk nil + "Show fine (word-granularity) differences within diff hunks. + +There are three possible settings: + +nil never show fine differences +t show fine differences for the selected diff hunk only +`all' show fine differences for all displayed diff hunks" + :group 'magit-diff + :type '(choice (const :tag "Never" nil) + (const :tag "Selected only" t) + (const :tag "All" all)) + :set 'magit-set-variable-and-refresh) + +;;;;;; Commit + +(defcustom magit-commit-ask-to-stage t + "Whether to ask to stage everything when committing and nothing is staged." + :package-version '(magit . "2.0.0") + :group 'magit-commit + :type 'boolean) + +(defcustom magit-commit-extend-override-date nil + "Whether using `magit-commit-extend' changes the committer date." + :package-version '(magit . "2.0.0") + :group 'magit-commit + :type 'boolean) + +(defcustom magit-commit-reword-override-date nil + "Whether using `magit-commit-reword' changes the committer date." + :package-version '(magit . "2.0.0") + :group 'magit-commit + :type 'boolean) + +(defcustom magit-commit-squash-commit nil + "Whether to target the marked or current commit when squashing. + +When this is nil then the command `magit-commit-fixup' and +`magit-commit-squash' always require that the user explicitly +selects a commit. This is also the case when these commands are +used with a prefix argument, in which case this option is ignored. + +Otherwise this controls which commit to target, either the +current or marked commit. Or if both can be used, which should +be preferred." + :package-version '(magit . "2.0.0") + :group 'magit-commit + :type + '(choice + (const :tag "Always prompt" nil) + (const :tag "Prefer current commit, else use marked" current-or-marked) + (const :tag "Prefer marked commit, else use current" marked-or-current) + (const :tag "Use current commit, if any" current) + (const :tag "Use marked commit, if any" marked))) + +(defcustom magit-expand-staged-on-commit nil + "Whether to expand staged changes when creating a commit. +When this is non-nil and the current buffer is the status buffer +expand the section containing staged changes. If this is `full' +always expand all subsections; if it is t subsections that were +previously hidden remain hidden. + +In the event that expanding very large patches takes a long time +\\\\[keyboard-quit] can be used to abort that step. +This is especially useful when you would normally not look at the +changes, e.g. because you are committing some binary files." + :package-version '(magit . "2.0.0") + :group 'magit-commit + :type '(choice (const :tag "Expand all subsections" full) + (const :tag "Expand top section" t) + (const :tag "Don't expand" nil))) + +;;;;;; Log + +(defcustom magit-log-auto-more nil + "Insert more log entries automatically when moving past the last entry. + +Only considered when moving past the last entry with +`magit-goto-*-section' commands." + :group 'magit-log + :type 'boolean) + +(defcustom magit-log-cutoff-length 100 + "The maximum number of commits to show in the log and whazzup buffers." + :group 'magit-log + :type 'integer) + +(defcustom magit-log-infinite-length 99999 + "Number of log used to show as maximum for `magit-log-cutoff-length'." + :group 'magit-log + :type 'integer) + +(defcustom magit-log-format-graph-function nil + "Function used to format graphs in log buffers. +The function is called with one argument, the propertized graph +of a single line in as a string. It has to return the formatted +string. This option can also be nil, in which case the graph is +inserted as is." + :package-version '(magit . "2.1.0") + :group 'magit-log + :type '(choice (const :tag "insert as is" nil) + (function-item magit-log-format-unicode-graph) + function)) + +(defcustom magit-log-format-unicode-graph-alist + '((?/ . ?╱) (?| . ?│) (?\\ . ?╲) (?* . ?◆) (?o . ?◇)) + "Alist used by `magit-log-format-unicode-graph' to translate chars." + :package-version '(magit . "2.1.0") + :group 'magit-log + :type '(repeat (cons :format "%v\n" + (character :format "replace %v ") + (character :format "with %v")))) + +(defcustom magit-log-show-gpg-status nil + "Display signature verification information as part of the log." + :package-version '(magit . "2.0.0") + :group 'magit-log + :type 'boolean) + +(defcustom magit-log-show-margin t + "Whether to use a margin when showing `oneline' logs. +When non-nil the author name and date are displayed in the margin +of the log buffer if that contains a `oneline' log. This can be +toggled temporarily using the command `magit-log-toggle-margin'." + :package-version '(magit . "2.0.0") + :group 'magit-log + :type 'boolean) + +(put 'magit-log-show-margin 'permanent-local t) + +(defcustom magit-log-margin-spec '(25 nil magit-duration-spec) + "How to format the margin for `oneline' logs. + +When the log buffer contains a `oneline' log, then it optionally +uses the right margin to display the author name and author date. +This is also supported in the reflog buffer. + +Logs that are shown together with other non-log information (e.g. +in the status buffer) are never accompanied by a margin. The +same applies to `long' logs, in this case because that would be +redundant. + +This option controls how that margin is formatted, the other +option affecting this is `magit-log-show-margin'; if that is nil +then no margin is displayed at all. To toggle this temporarily +use the command `magit-log-show-margin'. + +The value has the form (WIDTH CHARACTERP DURATION-SPEC). The +width of the margin is controlled using WIDTH, an integer. When +CHARACTERP is non-nil time units are shown as single characters, +otherwise the full name of the unit is displayed. DURATION-SPEC +has to be a variable, its value controls which time units are +used, how many seconds they contain, and what their names are." + :package-version '(magit . "2.0.0") + :group 'magit-log + :type '(list (integer :tag "Margin width") + (choice :tag "Time unit style" + (const :tag "Character" t) + (const :tag "Word" nil)) + (variable :tag "Duration spec variable"))) + +(defcustom magit-duration-spec + `((?Y "year" "years" ,(round (* 60 60 24 365.2425))) + (?M "month" "months" ,(round (* 60 60 24 30.436875))) + (?w "week" "weeks" ,(* 60 60 24 7)) + (?d "day" "days" ,(* 60 60 24)) + (?h "hour" "hours" ,(* 60 60)) + (?m "minute" "minutes" 60) + (?s "second" "seconds" 1)) + "Units used to display durations in a human format. +The value is a list of time units, beginning with the longest. +Each element has the form ((CHAR UNIT UNITS SECONDS)..). UNIT +is the time unit, UNITS is the plural of that unit. CHAR is a +character that can be used as abbreviation and must be unique +amoung all elements. SECONDS is the number of seconds in one +UNIT. Also see option `magit-log-margin-spec'." + :package-version '(magit . "2.0.0") + :group 'magit-log + :type '(repeat (list (character :tag "Unit character") + (string :tag "Unit singular string") + (string :tag "Unit plural string") + (integer :tag "Seconds in unit")))) + +(defcustom magit-ellipsis #x2026 ; "horizontal ellipsis" + "Character appended to abreviated text. +Currently this is used only in the log margin, but might later +be used elsewhere too. Filenames that were abbreviated by Git +are left as-is." + :package-version '(magit . "2.0.0") + :group 'magit-log + :type 'character) + +;;;;;; Others + +(defcustom magit-auto-revert-mode-lighter " MRev" + "String to display when Magit-Auto-Revert mode is active." + :group 'magit-modes) + +(define-minor-mode magit-auto-revert-mode + "Toggle global Magit-Auto-Revert mode. +With prefix ARG, enable Magit-Auto-Revert mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Magit-Auto-Revert mode is a global minor mode that, after Magit +has run a Git command, reverts buffers associated with files that +have changed on disk and are tracked in the current Git repository." + :group 'magit-modes + :lighter magit-auto-revert-mode-lighter + :global t + :init-value t) + +(defcustom magit-merge-warn-dirty-worktree t + "Whether to issue a warning when attempting to start a merge in a dirty worktree." + :package-version '(magit . "2.0.0") + :group 'magit-modes + :type 'boolean) + +(defcustom magit-push-hook '(magit-push-dwim) + "Hook run by `magit-push' to actually do the work. +See `magit-push' and `magit-push-dwim' for more information." + :package-version '(magit . "2.0.0") + :group 'magit-modes + :type 'hook) + +(defcustom magit-set-upstream-on-push nil + "Whether `magit-push' may set upstream when pushing a branch. +This only applies if the branch does not have an upstream set yet. + +nil don't use --set-upstream. +t ask if --set-upstream should be used. +`dontask' always use --set-upstream. +`refuse' refuse to push unless a remote branch has already been set." + :group 'magit-modes + :type '(choice (const :tag "Never" nil) + (const :tag "Ask" t) + (const :tag "Ask if not set" askifnotset) + (const :tag "Refuse" refuse) + (const :tag "Always" dontask))) + +(defcustom magit-wazzup-sections-hook + '(magit-insert-wazzup-head-line + magit-insert-empty-line + magit-insert-wazzup-branches) + "Hook run to insert sections into the wazzup buffer." + :package-version '(magit . "2.0.0") + :group 'magit-modes + :type 'hook) + +(defcustom magit-cherry-sections-hook + '(magit-insert-cherry-head-line + magit-insert-cherry-upstream-line + magit-insert-cherry-help-lines + magit-insert-empty-line + magit-insert-cherry-commits) + "Hook run to insert sections into the cherry buffer." + :package-version '(magit . "2.0.0") + :group 'magit-modes + :type 'hook) + +;;;; Custom Faces + +(defface magit-section-title + '((t :inherit header-line)) + "Face for section titles." + :group 'magit-faces) + +(defface magit-branch + '((((class color) (background light)) + :background "Grey85" + :foreground "LightSkyBlue4") + (((class color) (background dark)) + :background "Grey13" + :foreground "LightSkyBlue1")) + "Face for branches." + :group 'magit-faces) + +(defface magit-tag + '((((class color) (background light)) + :background "LemonChiffon1" + :foreground "goldenrod4") + (((class color) (background dark)) + :background "LemonChiffon1" + :foreground "goldenrod4")) + "Face for tags." + :group 'magit-faces) + +(defface magit-diff-file-header + '((t :inherit diff-file-header)) + "Face for diff file header lines." + :group 'magit-faces) + +(defface magit-diff-hunk-header + '((t :inherit diff-hunk-header)) + "Face for diff hunk header lines." + :group 'magit-faces) + +(defface magit-diff-add + '((t :inherit diff-added)) + "Face for lines in a diff that have been added." + :group 'magit-faces) + +(defface magit-diff-del + '((t :inherit diff-removed)) + "Face for lines in a diff that have been deleted." + :group 'magit-faces) + +(defface magit-diff-none + '((t :inherit diff-context)) + "Face for lines in a diff that are unchanged." + :group 'magit-faces) + +(defface magit-diff-merge-current + '((t :inherit font-lock-preprocessor-face)) + "Face for merge conflict marker 'current' line." + :group 'magit-faces) + +(defface magit-diff-merge-separator + '((t :inherit font-lock-preprocessor-face)) + "Face for merge conflict marker seperator." + :group 'magit-faces) + +(defface magit-diff-merge-diff3-separator + '((t :inherit font-lock-preprocessor-face)) + "Face for merge conflict marker seperator." + :group 'magit-faces) + +(defface magit-diff-merge-proposed + '((t :inherit font-lock-preprocessor-face)) + "Face for merge conflict marker 'proposed' line." + :group 'magit-faces) + +(defface magit-log-graph + '((((class color) (background light)) + :foreground "grey11") + (((class color) (background dark)) + :foreground "grey80")) + "Face for the graph element of the log output." + :group 'magit-faces) + +(defface magit-log-sha1 + '((((class color) (background light)) + :foreground "firebrick") + (((class color) (background dark)) + :foreground "tomato")) + "Face for the sha1 element of the log output." + :group 'magit-faces) + +(defface magit-log-author + '((((class color) (background light)) + :foreground "firebrick") + (((class color) (background dark)) + :foreground "tomato")) + "Face for the author element of the log output." + :group 'magit-faces) + +(defface magit-log-date + '((t)) + "Face for the date element of the log output." + :group 'magit-faces) + +(defface magit-log-message + '((t)) + "Face for the message element of the log output." + :group 'magit-faces) + +(defface magit-cherry-unmatched + '((t :foreground "cyan")) + "Face for unmatched cherry commits.") + +(defface magit-cherry-equivalent + '((t :foreground "magenta")) + "Face for equivalent cherry commits.") + +(defface magit-item-highlight + '((t :inherit secondary-selection)) + "Face for highlighting the current item." + :group 'magit-faces) + +(defface magit-item-mark + '((t :inherit highlight)) + "Face for highlighting marked item." + :group 'magit-faces) + +(defface magit-log-head-label-bisect-good + '((((class color) (background light)) + :box t + :background "light green" + :foreground "dark olive green") + (((class color) (background dark)) + :box t + :background "light green" + :foreground "dark olive green")) + "Face for good bisect refs." + :group 'magit-faces) + +(defface magit-log-head-label-bisect-skip + '((((class color) (background light)) + :box t + :background "light goldenrod" + :foreground "dark goldenrod") + (((class color) (background dark)) + :box t + :background "light goldenrod" + :foreground "dark goldenrod")) + "Face for skipped bisect refs." + :group 'magit-faces) + +(defface magit-log-head-label-bisect-bad + '((((class color) (background light)) + :box t + :background "IndianRed1" + :foreground "IndianRed4") + (((class color) (background dark)) + :box t + :background "IndianRed1" + :foreground "IndianRed4")) + "Face for bad bisect refs." + :group 'magit-faces) + +(defface magit-log-head-label-remote + '((((class color) (background light)) + :box t + :background "Grey85" + :foreground "OliveDrab4") + (((class color) (background dark)) + :box t + :background "Grey11" + :foreground "DarkSeaGreen2")) + "Face for remote branch head labels shown in log buffer." + :group 'magit-faces) + +(defface magit-log-head-label-tags + '((((class color) (background light)) + :box t + :background "LemonChiffon1" + :foreground "goldenrod4") + (((class color) (background dark)) + :box t + :background "LemonChiffon1" + :foreground "goldenrod4")) + "Face for tag labels shown in log buffer." + :group 'magit-faces) + +(defface magit-log-head-label-patches + '((((class color) (background light)) + :box t + :background "IndianRed1" + :foreground "IndianRed4") + (((class color) (background dark)) + :box t + :background "IndianRed1" + :foreground "IndianRed4")) + "Face for Stacked Git patches." + :group 'magit-faces) + +(defface magit-whitespace-warning-face + '((t :inherit trailing-whitespace)) + "Face for highlighting whitespace errors in Magit diffs." + :group 'magit-faces) + +(defface magit-log-head-label-local + '((((class color) (background light)) + :box t + :background "Grey85" + :foreground "LightSkyBlue4") + (((class color) (background dark)) + :box t + :background "Grey13" + :foreground "LightSkyBlue1")) + "Face for local branch head labels shown in log buffer." + :group 'magit-faces) + +(defface magit-log-head-label-head + '((((class color) (background light)) + :box t + :background "Grey70" + :foreground "Black") + (((class color) (background dark)) + :box t + :background "Grey20" + :foreground "White")) + "Face for working branch head labels shown in log buffer." + :group 'magit-faces) + +(defface magit-log-head-label-default + '((((class color) (background light)) + :box t + :background "Grey50") + (((class color) (background dark)) + :box t + :background "Grey50")) + "Face for unknown ref labels shown in log buffer." + :group 'magit-faces) + +(defface magit-log-head-label-wip + '((((class color) (background light)) + :box t + :background "Grey95" + :foreground "LightSkyBlue3") + (((class color) (background dark)) + :box t + :background "Grey07" + :foreground "LightSkyBlue4")) + "Face for git-wip labels shown in log buffer." + :group 'magit-faces) + +(defface magit-signature-good + '((t :foreground "green")) + "Face for good signatures." + :group 'magit-faces) + +(defface magit-signature-bad + '((t :foreground "red")) + "Face for bad signatures." + :group 'magit-faces) + +(defface magit-signature-untrusted + '((t :foreground "cyan")) + "Face for good untrusted signatures." + :group 'magit-faces) + +(defface magit-signature-none + '((t :inherit magit-log-message)) + "Face for unsigned commits." + :group 'magit-faces) + + +(defface magit-log-reflog-label-commit + '((((class color) (background light)) + :box t + :background "LemonChiffon1" + :foreground "goldenrod4") + (((class color) (background dark)) + :box t + :background "LemonChiffon1" + :foreground "goldenrod4")) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-log-reflog-label-amend + '((t :inherit magit-log-reflog-label-commit)) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-log-reflog-label-merge + '((t :inherit magit-log-reflog-label-commit)) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-log-reflog-label-checkout + '((((class color) (background light)) + :box t + :background "Grey85" + :foreground "LightSkyBlue4") + (((class color) (background dark)) + :box t + :background "Grey13" + :foreground "LightSkyBlue1")) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-log-reflog-label-reset + '((((class color) (background light)) + :box t + :background "IndianRed1" + :foreground "IndianRed4") + (((class color) (background dark)) + :box t + :background "IndianRed1" + :foreground "IndianRed4")) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-log-reflog-label-rebase + '((((class color) (background light)) + :box t + :background "Grey85" + :foreground "OliveDrab4") + (((class color) (background dark)) + :box t + :background "Grey11" + :foreground "DarkSeaGreen2")) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-log-reflog-label-cherry-pick +'((((class color) (background light)) + :box t + :background "light green" + :foreground "dark olive green") + (((class color) (background dark)) + :box t + :background "light green" + :foreground "dark olive green")) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-log-reflog-label-remote + '((((class color) (background light)) + :box t + :background "Grey50") + (((class color) (background dark)) + :box t + :background "Grey50")) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-log-reflog-label-other + '((((class color) (background light)) + :box t + :background "Grey50") + (((class color) (background dark)) + :box t + :background "Grey50")) + "Face for reflog subject labels shown in reflog buffer." + :group 'magit-faces) + +(defface magit-process-ok + '((t :inherit magit-section-title + :foreground "green")) + "Face for zero exit-status." + :group 'magit-faces) + +(defface magit-process-ng + '((t :inherit magit-section-title + :foreground "red")) + "Face for non-zero exit-status." + :group 'magit-faces) + +;;;; Keymaps + +;; Not an option to avoid advertising it. +(defvar magit-rigid-key-bindings nil + "Use rigid key bindings instead of thematic key popups. +If you enable this a lot of functionality is lost. You most +likely don't want that. This variable only has an effect if +set before loading libary `magit'.") + +(when (boundp 'git-commit-mode-map) + (define-key git-commit-mode-map (kbd "C-c C-d") 'magit-diff-staged)) + +(defvar magit-mode-map + (let ((map (make-keymap))) + (suppress-keymap map t) + (define-key map (kbd "n") 'magit-goto-next-section) + (define-key map (kbd "p") 'magit-goto-previous-section) + (define-key map (kbd "^") 'magit-goto-parent-section) + (define-key map (kbd "M-n") 'magit-goto-next-sibling-section) + (define-key map (kbd "M-p") 'magit-goto-previous-sibling-section) + (define-key map (kbd "TAB") 'magit-toggle-section) + (define-key map (kbd "") 'magit-expand-collapse-section) + (define-key map (kbd "1") 'magit-show-level-1) + (define-key map (kbd "2") 'magit-show-level-2) + (define-key map (kbd "3") 'magit-show-level-3) + (define-key map (kbd "4") 'magit-show-level-4) + (define-key map (kbd "M-1") 'magit-show-level-1-all) + (define-key map (kbd "M-2") 'magit-show-level-2-all) + (define-key map (kbd "M-3") 'magit-show-level-3-all) + (define-key map (kbd "M-4") 'magit-show-level-4-all) + (define-key map (kbd "M-h") 'magit-show-only-files) + (define-key map (kbd "M-H") 'magit-show-only-files-all) + (define-key map (kbd "M-s") 'magit-show-level-4) + (define-key map (kbd "M-S") 'magit-show-level-4-all) + (define-key map (kbd "g") 'magit-refresh) + (define-key map (kbd "G") 'magit-refresh-all) + (define-key map (kbd "?") 'magit-key-mode-popup-dispatch) + (define-key map (kbd ":") 'magit-git-command) + (define-key map (kbd "C-x 4 a") 'magit-add-change-log-entry-other-window) + (define-key map (kbd "L") 'magit-add-change-log-entry) + (define-key map (kbd "RET") 'magit-visit-item) + (define-key map (kbd "C-") 'magit-dired-jump) + (define-key map (kbd "SPC") 'magit-show-item-or-scroll-up) + (define-key map (kbd "DEL") 'magit-show-item-or-scroll-down) + (define-key map (kbd "C-w") 'magit-copy-item-as-kill) + (cond (magit-rigid-key-bindings + (define-key map (kbd "c") 'magit-commit) + (define-key map (kbd "m") 'magit-merge) + (define-key map (kbd "b") 'magit-checkout) + (define-key map (kbd "M") 'magit-branch-manager) + (define-key map (kbd "r") 'undefined) + (define-key map (kbd "f") 'magit-fetch-current) + (define-key map (kbd "F") 'magit-pull) + (define-key map (kbd "J") 'magit-apply-mailbox) + (define-key map (kbd "!") 'magit-git-command-topdir) + (define-key map (kbd "P") 'magit-push) + (define-key map (kbd "t") 'magit-tag) + (define-key map (kbd "l") 'magit-log) + (define-key map (kbd "o") 'magit-submodule-update) + (define-key map (kbd "B") 'undefined) + (define-key map (kbd "z") 'magit-stash)) + (t + (define-key map (kbd "c") 'magit-key-mode-popup-committing) + (define-key map (kbd "m") 'magit-key-mode-popup-merging) + (define-key map (kbd "b") 'magit-key-mode-popup-branching) + (define-key map (kbd "M") 'magit-key-mode-popup-remoting) + (define-key map (kbd "r") 'magit-key-mode-popup-rewriting) + (define-key map (kbd "f") 'magit-key-mode-popup-fetching) + (define-key map (kbd "F") 'magit-key-mode-popup-pulling) + (define-key map (kbd "J") 'magit-key-mode-popup-apply-mailbox) + (define-key map (kbd "!") 'magit-key-mode-popup-running) + (define-key map (kbd "P") 'magit-key-mode-popup-pushing) + (define-key map (kbd "t") 'magit-key-mode-popup-tagging) + (define-key map (kbd "l") 'magit-key-mode-popup-logging) + (define-key map (kbd "o") 'magit-key-mode-popup-submodule) + (define-key map (kbd "B") 'magit-key-mode-popup-bisecting) + (define-key map (kbd "z") 'magit-key-mode-popup-stashing))) + (define-key map (kbd "$") 'magit-process) + (define-key map (kbd "E") 'magit-interactive-rebase) + (define-key map (kbd "R") 'magit-rebase-step) + (define-key map (kbd "e") 'magit-ediff) + (define-key map (kbd "w") 'magit-wazzup) + (define-key map (kbd "y") 'magit-cherry) + (define-key map (kbd "q") 'magit-mode-quit-window) + (define-key map (kbd "x") 'magit-reset-head) + (define-key map (kbd "v") 'magit-revert-item) + (define-key map (kbd "a") 'magit-apply-item) + (define-key map (kbd "A") 'magit-cherry-pick-item) + (define-key map (kbd "d") 'magit-diff-working-tree) + (define-key map (kbd "D") 'magit-diff) + (define-key map (kbd "-") 'magit-diff-smaller-hunks) + (define-key map (kbd "+") 'magit-diff-larger-hunks) + (define-key map (kbd "0") 'magit-diff-default-hunks) + (define-key map (kbd "h") 'magit-key-mode-popup-diff-options) + (define-key map (kbd "H") 'magit-diff-toggle-refine-hunk) + (define-key map (kbd "S") 'magit-stage-all) + (define-key map (kbd "U") 'magit-unstage-all) + (define-key map (kbd "X") 'magit-reset-working-tree) + (define-key map (kbd "C-c C-c") 'magit-key-mode-popup-dispatch) + (define-key map (kbd "C-c C-e") 'magit-key-mode-popup-dispatch) + map) + "Parent keymap for all keymaps of modes derived from `magit-mode'.") + +(defvar magit-commit-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + (define-key map (kbd "C-c C-b") 'magit-go-backward) + (define-key map (kbd "C-c C-f") 'magit-go-forward) + (define-key map (kbd "SPC") 'scroll-up) + (define-key map (kbd "DEL") 'scroll-down) + (define-key map (kbd "j") 'magit-jump-to-diffstats) + map) + "Keymap for `magit-commit-mode'.") + +(defvar magit-status-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + (define-key map (kbd "s") 'magit-stage-item) + (define-key map (kbd "u") 'magit-unstage-item) + (define-key map (kbd "i") 'magit-ignore-item) + (define-key map (kbd "I") 'magit-ignore-item-locally) + (define-key map (kbd "j") 'magit-section-jump-map) + (define-key map (kbd ".") 'magit-mark-item) + (define-key map (kbd "=") 'magit-diff-with-mark) + (define-key map (kbd "k") 'magit-discard-item) + (define-key map (kbd "C") 'magit-commit-add-log) + map) + "Keymap for `magit-status-mode'.") + +(eval-after-load 'dired-x + '(define-key magit-status-mode-map [remap dired-jump] 'magit-dired-jump)) + +(defvar magit-log-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + (define-key map (kbd ".") 'magit-mark-item) + (define-key map (kbd "=") 'magit-diff-with-mark) + (define-key map (kbd "e") 'magit-log-show-more-entries) + (define-key map (kbd "h") 'magit-log-toggle-margin) + map) + "Keymap for `magit-log-mode'.") + +(defvar magit-cherry-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + map) + "Keymap for `magit-cherry-mode'.") + +(defvar magit-reflog-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-log-mode-map) + map) + "Keymap for `magit-reflog-mode'.") + +(defvar magit-diff-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + (define-key map (kbd "C-c C-b") 'magit-go-backward) + (define-key map (kbd "C-c C-f") 'magit-go-forward) + (define-key map (kbd "SPC") 'scroll-up) + (define-key map (kbd "DEL") 'scroll-down) + (define-key map (kbd "j") 'magit-jump-to-diffstats) + map) + "Keymap for `magit-diff-mode'.") + +(defvar magit-wazzup-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + (define-key map (kbd ".") 'magit-mark-item) + (define-key map (kbd "=") 'magit-diff-with-mark) + (define-key map (kbd "i") 'magit-ignore-item) + map) + "Keymap for `magit-wazzup-mode'.") + +(defvar magit-branch-manager-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + (define-key map (kbd "c") 'magit-create-branch) + (define-key map (kbd "a") 'magit-add-remote) + (define-key map (kbd "r") 'magit-rename-item) + (define-key map (kbd "k") 'magit-discard-item) + (define-key map (kbd "T") 'magit-change-what-branch-tracks) + map) + "Keymap for `magit-branch-manager-mode'.") + +(defvar magit-process-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + map) + "Keymap for `magit-process-mode'.") + +(defvar magit-section-jump-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "z") 'magit-jump-to-stashes) + (define-key map (kbd "n") 'magit-jump-to-untracked) + (define-key map (kbd "u") 'magit-jump-to-unstaged) + (define-key map (kbd "s") 'magit-jump-to-staged) + (define-key map (kbd "f") 'magit-jump-to-unpulled) + (define-key map (kbd "p") 'magit-jump-to-unpushed) + (define-key map (kbd "r") 'magit-jump-to-pending) + map) + "Submap for jumping to sections in `magit-status-mode'.") +(fset 'magit-section-jump-map magit-section-jump-map) + +(easy-menu-define magit-mode-menu magit-mode-map + "Magit menu" + '("Magit" + ["Refresh" magit-refresh t] + ["Refresh all" magit-refresh-all t] + "---" + ["Stage" magit-stage-item t] + ["Stage all" magit-stage-all t] + ["Unstage" magit-unstage-item t] + ["Unstage all" magit-unstage-all t] + ["Commit" magit-key-mode-popup-committing t] + ["Add log entry" magit-commit-add-log t] + ["Tag" magit-tag t] + "---" + ["Diff working tree" magit-diff-working-tree t] + ["Diff" magit-diff t] + ("Log" + ["Short Log" magit-log t] + ["Long Log" magit-log-long t] + ["Reflog" magit-reflog t] + ["Extended..." magit-key-mode-popup-logging t]) + "---" + ["Cherry pick" magit-cherry-pick-item t] + ["Apply" magit-apply-item t] + ["Revert" magit-revert-item t] + "---" + ["Ignore" magit-ignore-item t] + ["Ignore locally" magit-ignore-item-locally t] + ["Discard" magit-discard-item t] + ["Reset head" magit-reset-head t] + ["Reset working tree" magit-reset-working-tree t] + ["Stash" magit-stash t] + ["Snapshot" magit-stash-snapshot t] + "---" + ["Branch..." magit-checkout t] + ["Merge" magit-merge t] + ["Interactive resolve" magit-interactive-resolve t] + ["Rebase" magit-rebase-step t] + ("Rewrite" + ["Start" magit-rewrite-start t] + ["Stop" magit-rewrite-stop t] + ["Finish" magit-rewrite-finish t] + ["Abort" magit-rewrite-abort t] + ["Set used" magit-rewrite-set-used t] + ["Set unused" magit-rewrite-set-unused t]) + "---" + ["Push" magit-push t] + ["Pull" magit-pull t] + ["Remote update" magit-remote-update t] + ("Submodule" + ["Submodule update" magit-submodule-update t] + ["Submodule update and init" magit-submodule-update-init t] + ["Submodule init" magit-submodule-init t] + ["Submodule sync" magit-submodule-sync t]) + "---" + ("Extensions") + "---" + ["Display Git output" magit-process t] + ["Quit Magit" magit-mode-quit-window t])) + + +;;; Utilities (1) +;;;; Minibuffer Input + +(defun magit-iswitchb-completing-read + (prompt choices &optional predicate require-match initial-input hist def) + "iswitchb-based completing-read almost-replacement." + (require 'iswitchb) + (let ((iswitchb-make-buflist-hook + (lambda () + (setq iswitchb-temp-buflist (if (consp (car choices)) + (mapcar #'car choices) + choices))))) + (iswitchb-read-buffer prompt (or initial-input def) require-match))) + +(defun magit-ido-completing-read + (prompt choices &optional predicate require-match initial-input hist def) + "ido-based completing-read almost-replacement." + (require 'ido) + (let ((reply (ido-completing-read + prompt + (if (consp (car choices)) + (mapcar #'car choices) + choices) + predicate require-match initial-input hist def))) + (or (and (consp (car choices)) + (cdr (assoc reply choices))) + reply))) + +(defun magit-builtin-completing-read + (prompt choices &optional predicate require-match initial-input hist def) + "Magit wrapper for standard `completing-read' function." + (let ((reply (completing-read + (if (and def (> (length prompt) 2) + (string-equal ": " (substring prompt -2))) + (format "%s (default %s): " (substring prompt 0 -2) def) + prompt) + choices predicate require-match initial-input hist def))) + (if (string= reply "") + (if require-match + (user-error "Nothing selected") + nil) + reply))) + +(defun magit-completing-read + (prompt collection &optional predicate require-match initial-input hist def) + "Call function in `magit-completing-read-function' to read user input. + +Read `completing-read' documentation for the meaning of the argument." + (funcall magit-completing-read-function + (concat prompt ": ") collection predicate + require-match initial-input hist def)) + +(defvar magit-gpg-secret-key-hist nil) + +(defun magit-read-gpg-secret-key (prompt) + (let ((keys (mapcar + (lambda (key) + (list (epg-sub-key-id (car (epg-key-sub-key-list key))) + (let ((id-obj (car (epg-key-user-id-list key))) + (id-str nil)) + (when id-obj + (setq id-str (epg-user-id-string id-obj)) + (if (stringp id-str) + id-str + (epg-decode-dn id-obj)))))) + (epg-list-keys (epg-make-context epa-protocol) nil t)))) + (magit-completing-read prompt keys nil nil nil 'magit-gpg-secret-key-hist + (car (or magit-gpg-secret-key-hist keys))))) + +;;;; Various Utilities + +(defmacro magit-bind-match-strings (varlist &rest body) + (declare (indent 1)) + (let ((i 0)) + `(let ,(mapcar (lambda (var) + (list var (list 'match-string (cl-incf i)))) + varlist) + ,@body))) + +(defun magit-file-line (file) + "Return the first line of FILE as a string." + (when (file-regular-p file) + (with-temp-buffer + (insert-file-contents file) + (buffer-substring-no-properties (point-min) + (line-end-position))))) + +(defun magit-file-lines (file &optional keep-empty-lines) + "Return a list of strings containing one element per line in FILE. +Unless optional argument KEEP-EMPTY-LINES is t, trim all empty lines." + (when (file-regular-p file) + (with-temp-buffer + (insert-file-contents file) + (split-string (buffer-string) "\n" (not keep-empty-lines))))) + +(defvar-local magit-file-name () + "Name of file the buffer shows a different version of.") + +(defun magit-buffer-file-name (&optional relative) + (let* ((topdir (magit-get-top-dir)) + (filename (or buffer-file-name + (when (buffer-base-buffer) + (with-current-buffer (buffer-base-buffer) + buffer-file-name)) + (when magit-file-name + (expand-file-name magit-file-name topdir))))) + (when filename + (setq filename (file-truename filename)) + (if relative + (file-relative-name filename topdir) + filename)))) + +(defun magit-format-duration (duration spec width) + (cl-destructuring-bind (char unit units weight) + (car spec) + (let ((cnt (round (/ duration weight 1.0)))) + (if (or (not (cdr spec)) + (>= (/ duration weight) 1)) + (if (= width 1) + (format "%3i%c" cnt char) + (format (format "%%3i %%-%is" width) cnt + (if (= cnt 1) unit units))) + (magit-format-duration duration (cdr spec) width))))) + +(defun magit-flatten-onelevel (list) + (cl-mapcan (lambda (elt) + (cond ((consp elt) (copy-sequence elt)) + (elt (list elt)))) + list)) + +(defun magit-insert (string face &rest args) + (if magit-use-overlays + (let ((start (point))) + (insert string) + (let ((ov (make-overlay start (point) nil t))) + (overlay-put ov 'face face) + ;; (overlay-put ov 'priority 10) + (overlay-put ov 'evaporate t))) + (insert (propertize string 'face face))) + (apply #'insert args)) + +(defun magit-put-face-property (start end face) + (if magit-use-overlays + (let ((ov (make-overlay start end nil t))) + (overlay-put ov 'face face) + ;; (overlay-put ov 'priority 10) + (overlay-put ov 'evaporate t)) + (put-text-property start end 'face face))) + +;;;; Buffer Margins + +(defun magit-set-buffer-margin (width enable) + (let ((window (get-buffer-window))) + (when window + (with-selected-window window + (set-window-margins nil (car (window-margins)) (if enable width 0)) + (let ((fn (apply-partially + (lambda (width) + (let ((window (get-buffer-window))) + (when window + (with-selected-window window + (set-window-margins nil (car (window-margins)) + width))))) + width))) + (if enable + (add-hook 'window-configuration-change-hook fn nil t) + (remove-hook 'window-configuration-change-hook fn t))))))) + +(defun magit-make-margin-overlay (&rest strings) + (let ((o (make-overlay (point) (line-end-position) nil t))) + (overlay-put o 'evaporate t) + (overlay-put o 'before-string + (propertize "o" 'display + (list '(margin right-margin) + (apply #'concat strings)))))) + +(defvar-local magit-log-margin-timeunit-width nil) + +(defun magit-log-margin-set-timeunit-width () + (cl-destructuring-bind (width characterp duration-spec) + magit-log-margin-spec + (setq magit-log-margin-timeunit-width + (if characterp + 1 + (apply 'max (mapcar (lambda (e) + (max (length (nth 1 e)) + (length (nth 2 e)))) + (symbol-value duration-spec))))))) + +;;;; Emacsclient Support + +(defmacro magit-with-emacsclient (server-window &rest body) + "Arrange for Git to use Emacsclient as \"the git editor\". + +Git processes that use \"the editor\" have to be asynchronous. +The use of this macro ensures that such processes inside BODY use +Emacsclient as \"the editor\" by setting the environment variable +$GIT_EDITOR accordingly around calls to Git and starting the +server if necessary." + (declare (indent 1)) + `(let* ((process-environment process-environment) + (magit-process-popup-time -1)) + ;; Make sure the client is usable. + (magit-assert-emacsclient "use `magit-with-emacsclient'") + ;; Make sure server-use-tcp's value is valid. + (unless (featurep 'make-network-process '(:family local)) + (setq server-use-tcp t)) + ;; Make sure the server is running. + (unless server-process + (when (server-running-p server-name) + (setq server-name (format "server%s" (emacs-pid))) + (when (server-running-p server-name) + (server-force-delete server-name))) + (server-start)) + ;; Tell Git to use the client. + (setenv "GIT_EDITOR" + (concat magit-emacsclient-executable + ;; Tell the client where the server file is. + (and (not server-use-tcp) + (concat " --socket-name=" + (expand-file-name server-name + server-socket-dir))))) + (when server-use-tcp + (setenv "EMACS_SERVER_FILE" + (expand-file-name server-name server-auth-dir))) + ;; As last resort fallback to a new Emacs instance. + (setenv "ALTERNATE_EDITOR" + (expand-file-name invocation-name invocation-directory)) + ;; Git has to be called asynchronously in BODY or we create a + ;; dead lock. By the time Emacsclient is called the dynamic + ;; binding is no longer in effect and our primitives don't + ;; support callbacks. Temporarily set the default value and + ;; restore the old value using a timer. + (let ((window ,server-window)) + (unless (equal window server-window) + (run-at-time "1 sec" nil + (apply-partially (lambda (value) + (setq server-window value)) + server-window)) + (setq-default server-window window))) + ,@body)) + +(defun magit-use-emacsclient-p () + (and magit-emacsclient-executable + (not (tramp-tramp-file-p default-directory)))) + +(defun magit-assert-emacsclient (action) + (unless magit-emacsclient-executable + (user-error "Cannot %s when `magit-emacsclient-executable' is nil" action)) + (when (tramp-tramp-file-p default-directory) + (user-error "Cannot %s when accessing repository using tramp" action))) + +;;;; Git Config + +(defun magit-get (&rest keys) + "Return the value of Git config entry specified by KEYS." + (magit-git-string "config" (mapconcat 'identity keys "."))) + +(defun magit-get-all (&rest keys) + "Return all values of the Git config entry specified by KEYS." + (magit-git-lines "config" "--get-all" (mapconcat 'identity keys "."))) + +(defun magit-get-boolean (&rest keys) + "Return the boolean value of Git config entry specified by KEYS." + (magit-git-true "config" "--bool" (mapconcat 'identity keys "."))) + +(defun magit-set (val &rest keys) + "Set Git config settings specified by KEYS to VAL." + (if val + (magit-git-string "config" (mapconcat 'identity keys ".") val) + (magit-git-string "config" "--unset" (mapconcat 'identity keys ".")))) + +;;;; Git Low-Level + +(defun magit-git-repo-p (dir) + (file-exists-p (expand-file-name ".git" dir))) + +(defun magit-git-dir (&optional path) + "Return absolute path to the GIT_DIR for the current repository. +If optional PATH is non-nil it has to be a path relative to the +GIT_DIR and its absolute path is returned" + (let ((gitdir (magit-git-string "rev-parse" "--git-dir"))) + (when gitdir + (setq gitdir (file-name-as-directory + (magit-expand-git-file-name gitdir))) + (if path + (expand-file-name (convert-standard-filename path) gitdir) + gitdir)))) + +(defun magit-no-commit-p () + "Return non-nil if there is no commit in the current git repository." + (not (magit-git-string "rev-list" "-1" "HEAD"))) + +(defun magit-get-top-dir (&optional directory) + "Return the top directory for the current repository. + +Determine the repository which contains `default-directory' in +either its work tree or git control directory and return its top +directory. If there is no top directory, because the repository +is bare, return the control directory instead. + +If optional DIRECTORY is non-nil then return the top directory of +the repository that contains that instead. DIRECTORY has to be +an existing directory." + (setq directory (if directory + (file-name-as-directory + (expand-file-name directory)) + default-directory)) + (unless (file-directory-p directory) + (error "%s isn't an existing directory" directory)) + (let* ((default-directory directory) + (top (magit-git-string "rev-parse" "--show-toplevel"))) + (if top + (file-name-as-directory (magit-expand-git-file-name top)) + (let ((gitdir (magit-git-dir))) + (when gitdir + (if (magit-bare-repo-p) + gitdir + (file-name-directory (directory-file-name gitdir)))))))) + +(defun magit-expand-git-file-name (filename) + (when (tramp-tramp-file-p default-directory) + (setq filename (file-relative-name filename + (with-parsed-tramp-file-name + default-directory nil + localname)))) + (expand-file-name filename)) + +(defun magit-file-relative-name (file) + "Return the path of FILE relative to the repository root. +If FILE isn't inside a Git repository then return nil." + (setq file (file-truename file)) + (let ((topdir (magit-get-top-dir (file-name-directory file)))) + (and topdir (substring file (length topdir))))) + +(defun magit-bare-repo-p () + "Return t if the current repository is bare." + (magit-git-true "rev-parse" "--is-bare-repository")) + +(defun magit-get-ref (ref) + (magit-git-string "symbolic-ref" "-q" ref)) + +(defun magit-get-current-branch () + (let ((head (magit-get-ref "HEAD"))) + (when (and head (string-match "^refs/heads/" head)) + (substring head 11)))) + +(defun magit-get-remote/branch (&optional branch verify) + "Return the remote-tracking branch of BRANCH used for pulling. +Return a string of the form \"REMOTE/BRANCH\". + +If optional BRANCH is nil return the remote-tracking branch of +the current branch. If optional VERIFY is non-nil verify that +the remote branch exists; else return nil." + (save-match-data + (let (remote remote-branch remote/branch) + (and (or branch (setq branch (magit-get-current-branch))) + (setq remote (magit-get "branch" branch "remote")) + (setq remote-branch (magit-get "branch" branch "merge")) + (string-match "^refs/heads/\\(.+\\)" remote-branch) + (setq remote/branch + (concat remote "/" (match-string 1 remote-branch))) + (or (not verify) + (magit-git-success "rev-parse" "--verify" remote/branch)) + remote/branch)))) + +(defun magit-get-tracked-branch (&optional branch qualified pretty) + "Return the name of the tracking branch the local branch name BRANCH. + +If optional QUALIFIED is non-nil return the full branch path, +otherwise try to shorten it to a name (which may fail). If +optional PRETTY is non-nil additionally format the branch name +according to option `magit-remote-ref-format'." + (unless branch + (setq branch (magit-get-current-branch))) + (when branch + (let ((remote (magit-get "branch" branch "remote")) + (merge (magit-get "branch" branch "merge"))) + (when (and (not merge) + (not (equal remote "."))) + (setq merge branch)) + (when (and remote merge) + (if (string= remote ".") + (cond (qualified merge) + ((string-match "^refs/heads/" merge) + (substring merge 11)) + ((string-match "^refs/" merge) + merge)) + (let* ((fetch (mapcar (lambda (f) (split-string f "[+:]" t)) + (magit-get-all "remote" remote "fetch"))) + (match (cadr (assoc merge fetch)))) + (unless match + (let* ((prefix (nreverse (split-string merge "/"))) + (unique (list (car prefix)))) + (setq prefix (cdr prefix)) + (setq fetch + (cl-mapcan + (lambda (f) + (cl-destructuring-bind (from to) f + (setq from (nreverse (split-string from "/"))) + (when (equal (car from) "*") + (list (list (cdr from) to))))) + fetch)) + (while (and prefix (not match)) + (if (setq match (cadr (assoc prefix fetch))) + (setq match (concat (substring match 0 -1) + (mapconcat 'identity unique "/"))) + (push (car prefix) unique) + (setq prefix (cdr prefix)))))) + (cond ((not match) nil) + (qualified match) + ((string-match "^refs/remotes/" match) + (if pretty + (magit-format-ref match) + (substring match 13))) + (t match)))))))) + +(defun magit-get-previous-branch () + "Return the refname of the previously checked out branch. +Return nil if the previously checked out branch no longer exists." + (magit-name-rev (magit-git-string "rev-parse" "--verify" "@{-1}"))) + +(defun magit-get-current-tag (&optional with-distance-p) + "Return the closest tag reachable from \"HEAD\". + +If optional WITH-DISTANCE-P is non-nil then return (TAG COMMITS), +if it is `dirty' return (TAG COMMIT DIRTY). COMMITS is the number +of commits in \"HEAD\" but not in TAG and DIRTY is t if there are +uncommitted changes, nil otherwise." + (let ((tag (magit-git-string "describe" "--long" "--tags" + (and (eq with-distance-p 'dirty) "--dirty")))) + (save-match-data + (when tag + (string-match + "\\(.+\\)-\\(?:0[0-9]*\\|\\([0-9]+\\)\\)-g[0-9a-z]+\\(-dirty\\)?$" tag) + (if with-distance-p + (list (match-string 1 tag) + (string-to-number (or (match-string 2 tag) "0")) + (and (match-string 3 tag) t)) + (match-string 1 tag)))))) + +(defun magit-get-next-tag (&optional with-distance-p) + "Return the closest tag from which \"HEAD\" is reachable. + +If no such tag can be found or if the distance is 0 (in which +case it is the current tag, not the next) return nil instead. + +If optional WITH-DISTANCE-P is non-nil then return (TAG COMMITS) +where COMMITS is the number of commits in TAG but not in \"HEAD\"." + (let ((rev (magit-git-string "describe" "--contains" "HEAD"))) + (save-match-data + (when (and rev (string-match "^[^^~]+" rev)) + (let ((tag (match-string 0 rev))) + (unless (equal tag (magit-get-current-tag)) + (if with-distance-p + (list tag (car (magit-rev-diff-count tag "HEAD"))) + tag))))))) + +(defun magit-get-remote (branch) + "Return the name of the remote for BRANCH. +If branch is nil or it has no remote, but a remote named +\"origin\" exists, return that. Otherwise, return nil." + (let ((remote (or (and branch (magit-get "branch" branch "remote")) + (and (magit-get "remote" "origin" "url") "origin")))) + (unless (string= remote "") + remote))) + +(defun magit-get-current-remote () + "Return the name of the remote for the current branch. +If there is no current branch, or no remote for that branch, +but a remote named \"origin\" is configured, return that. +Otherwise, return nil." + (magit-get-remote (magit-get-current-branch))) + +(defun magit-ref-exists-p (ref) + (magit-git-success "show-ref" "--verify" ref)) + +(defun magit-rev-parse (&rest args) + "Execute `git rev-parse ARGS', returning first line of output. +If there is no output return nil." + (apply #'magit-git-string "rev-parse" args)) + +(defun magit-ref-ambiguous-p (ref) + "Return whether or not REF is ambiguous." + ;; An ambiguous ref does not cause `git rev-parse --abbrev-ref' + ;; to exits with a non-zero status. But there is nothing on + ;; stdout in that case. + (not (magit-git-string "rev-parse" "--abbrev-ref" ref))) + +(defun magit-rev-diff-count (a b) + "Return the commits in A but not B and vice versa. +Return a list of two integers: (A>B B>A)." + (mapcar 'string-to-number + (split-string (magit-git-string "rev-list" + "--count" "--left-right" + (concat a "..." b)) + "\t"))) + +(defun magit-name-rev (rev &optional no-trim) + "Return a human-readable name for REV. +Unlike `git name-rev', this will remove \"tags/\" and \"remotes/\" +prefixes if that can be done unambiguously (unless optional arg +NO-TRIM is non-nil). In addition, it will filter out revs +involving HEAD." + (when rev + (let ((name (magit-git-string "name-rev" "--no-undefined" "--name-only" rev))) + ;; There doesn't seem to be a way of filtering HEAD out from name-rev, + ;; so we have to do it manually. + ;; HEAD-based names are too transient to allow. + (when (and (stringp name) + (string-match "^\\(.*\\" name)) + (setq name (magit-rev-parse rev))))) + (setq rev (or name rev)) + (when (string-match "^\\(?:tags\\|remotes\\)/\\(.*\\)" rev) + (let ((plain-name (match-string 1 rev))) + (unless (or no-trim (magit-ref-ambiguous-p plain-name)) + (setq rev plain-name)))) + rev))) + +(defun magit-file-uptodate-p (file) + (magit-git-success "diff" "--quiet" "--" file)) + +(defun magit-anything-staged-p () + (magit-git-failure "diff" "--quiet" "--cached")) + +(defun magit-anything-unstaged-p () + (magit-git-failure "diff" "--quiet")) + +(defun magit-anything-modified-p () + (or (magit-anything-staged-p) + (magit-anything-unstaged-p))) + +(defun magit-commit-parents (commit) + (cdr (split-string (magit-git-string "rev-list" "-1" "--parents" commit)))) + +(defun magit-assert-one-parent (commit command) + (when (> (length (magit-commit-parents commit)) 1) + (user-error "Cannot %s a merge commit" command))) + +(defun magit-decode-git-path (path) + (if (eq (aref path 0) ?\") + (string-as-multibyte (read path)) + path)) + +(defun magit-abbrev-length () + (string-to-number (or (magit-get "core.abbrev") "7"))) + +(defun magit-abbrev-arg () + (format "--abbrev=%d" (magit-abbrev-length))) + +;;;; Git Revisions + +(defvar magit-uninteresting-refs + '("^refs/stash$" + "^refs/remotes/[^/]+/HEAD$" + "^refs/remotes/[^/]+/top-bases$" + "^refs/top-bases$")) + +(cl-defun magit-list-interesting-refs (&optional uninteresting + (refs nil srefs)) + (cl-loop for ref in (if srefs + refs + (mapcar (lambda (l) + (cadr (split-string l " "))) + (magit-git-lines "show-ref"))) + with label + unless (or (cl-loop for i in + (cl-typecase uninteresting + (null magit-uninteresting-refs) + (list uninteresting) + (string (cons (format "^refs/heads/%s$" + uninteresting) + magit-uninteresting-refs))) + thereis (string-match i ref)) + (not (setq label (magit-format-ref ref)))) + collect (cons label ref))) + +(defun magit-format-ref (ref) + (cond ((string-match "refs/heads/\\(.*\\)" ref) + (match-string 1 ref)) + ((string-match "refs/tags/\\(.*\\)" ref) + (format (if (eq magit-remote-ref-format 'branch-then-remote) + "%s (tag)" + "%s") + (match-string 1 ref))) + ((string-match "refs/remotes/\\([^/]+\\)/\\(.+\\)" ref) + (if (eq magit-remote-ref-format 'branch-then-remote) + (format "%s (%s)" + (match-string 2 ref) + (match-string 1 ref)) + (substring ref 13))) + (t ref))) + +(defvar magit-read-file-hist nil) + +(defun magit-read-file-from-rev (revision &optional default) + (unless revision + (setq revision "HEAD")) + (let ((default-directory (magit-get-top-dir))) + (magit-completing-read + (format "Retrieve file from %s" revision) + (magit-git-lines "ls-tree" "-r" "-t" "--name-only" revision) + nil 'require-match + nil 'magit-read-file-hist + (or default (magit-buffer-file-name t))))) + +(defun magit-read-file-trace (ignored) + (let ((file (magit-read-file-from-rev "HEAD")) + (trace (read-string "Trace: "))) + (if (string-match + "^\\(/.+/\\|:[^:]+\\|[0-9]+,[-+]?[0-9]+\\)\\(:\\)?$" trace) + (concat trace (or (match-string 2 trace) ":") file) + (user-error "Trace is invalid, see man git-log")))) + +(defvar magit-read-rev-history nil + "The history of inputs to `magit-read-rev' and `magit-read-tag'.") + +(defun magit-read-tag (prompt &optional require-match) + (magit-completing-read prompt (magit-git-lines "tag") nil + require-match nil 'magit-read-rev-history)) + +(defun magit-read-rev (prompt &optional default uninteresting noselection) + (let* ((interesting-refs + (mapcar (lambda (elt) + (setcdr elt (replace-regexp-in-string + "^refs/heads/" "" (cdr elt))) + elt) + (magit-list-interesting-refs uninteresting))) + (reply (magit-completing-read prompt interesting-refs nil nil nil + 'magit-read-rev-history default)) + (rev (or (cdr (assoc reply interesting-refs)) reply))) + (when (equal rev ".") + (setq rev magit-marked-commit)) + (unless (or rev noselection) + (user-error "No rev selected")) + rev)) + +(defun magit-read-rev-with-default (prompt) + (magit-read-rev prompt + (let ((branch (or (magit-guess-branch) "HEAD"))) + (when branch + (if (string-match "^refs/\\(.*\\)" branch) + (match-string 1 branch) + branch))))) + +(defun magit-read-rev-range (op &optional def-beg def-end) + (let ((beg (magit-read-rev (format "%s range or start" op) def-beg))) + (save-match-data + (if (string-match "^\\(.+\\)\\.\\.\\(.+\\)$" beg) + (cons (match-string 1 beg) (match-string 2 beg)) + (let ((end (magit-read-rev (format "%s end" op) def-end nil t))) + (if end (cons beg end) beg)))))) + +(defun magit-read-stash (prompt) + (let ((n (read-number prompt 0)) + (l (1- (length (magit-git-lines "stash" "list"))))) + (if (> n l) + (user-error "No stash older than stash@{%i}" l) + (format "stash@{%i}" n)))) + +(defun magit-read-remote (prompt &optional default require-match) + (magit-completing-read prompt (magit-git-lines "remote") + nil require-match nil nil + (or default (magit-guess-remote)))) + +(defun magit-read-remote-branch (prompt remote &optional default) + (let ((branch (magit-completing-read + prompt + (cl-mapcan + (lambda (b) + (and (not (string-match " -> " b)) + (string-match (format "^ *%s/\\(.*\\)$" + (regexp-quote remote)) b) + (list (match-string 1 b)))) + (magit-git-lines "branch" "-r")) + nil nil nil nil default))) + (unless (string= branch "") + branch))) + +(defun magit-format-ref-label (ref) + (cl-destructuring-bind (re face fn) + (cl-find-if (lambda (ns) + (string-match (car ns) ref)) + magit-refs-namespaces) + (if fn + (funcall fn ref face) + (propertize (or (match-string 1 ref) ref) 'face face)))) + +(defun magit-format-ref-labels (string) + (save-match-data + (mapconcat 'magit-format-ref-label + (mapcar 'cdr + (magit-list-interesting-refs + nil (split-string string "\\(tag: \\|[(), ]\\)" t))) + " "))) + +(defun magit-insert-ref-labels (string) + (save-match-data + (dolist (ref (split-string string "\\(tag: \\|[(), ]\\)" t) " ") + (cl-destructuring-bind (re face fn) + (cl-find-if (lambda (elt) (string-match (car elt) ref)) + magit-refs-namespaces) + (if fn + (let ((text (funcall fn ref face))) + (magit-insert text (get-text-property 1 'face text) ?\s)) + (magit-insert (or (match-string 1 ref) ref) face ?\s)))))) + +(defun magit-format-rev-summary (rev) + (let ((s (magit-git-string "log" "-1" + (concat "--pretty=format:%h %s") rev))) + (when s + (string-match " " s) + (put-text-property 0 (match-beginning 0) 'face 'magit-log-sha1 s) + s))) + +;;; Magit Api +;;;; Section Api +;;;;; Section Core + +(cl-defstruct magit-section + type info + beginning content-beginning end + hidden needs-refresh-on-show highlight + diff-status diff-file2 diff-range + process + parent children) + +(defvar-local magit-root-section nil + "The root section in the current buffer. +All other sections are descendants of this section. The value +of this variable is set by `magit-with-section' and you should +never modify it.") +(put 'magit-root-section 'permanent-local t) + +;;;;; Section Creation + +(defvar magit-with-section--parent nil + "For use by `magit-with-section' only.") + +(defvar magit-with-section--oldroot nil + "For use by `magit-with-section' only.") + +(defmacro magit-with-section (arglist &rest body) + "\n\n(fn (NAME TYPE &optional INFO HEADING NOHIGHLIGHT COLLAPSE) &rest ARGS)" + (declare (indent 1) (debug ((form form &optional form form form) body))) + (let ((s (car arglist))) + `(let ((,s (make-magit-section + :type ',(nth 1 arglist) + :info ,(nth 2 arglist) + :highlight (not ,(nth 4 arglist)) + :beginning (point-marker) + :content-beginning (point-marker) + :parent magit-with-section--parent))) + (setf (magit-section-hidden ,s) + (let ((old (and magit-with-section--oldroot + (magit-find-section (magit-section-path ,s) + magit-with-section--oldroot)))) + (if old + (magit-section-hidden old) + ,(nth 5 arglist)))) + (let ((magit-with-section--parent ,s) + (magit-with-section--oldroot + (or magit-with-section--oldroot + (unless magit-with-section--parent + (prog1 magit-root-section + (setq magit-root-section ,s)))))) + ,@body) + (when ,s + (set-marker-insertion-type (magit-section-content-beginning ,s) t) + (let ((heading ,(nth 3 arglist))) + (when heading + (save-excursion + (goto-char (magit-section-beginning ,s)) + (insert + (if (string-match-p "\n$" heading) + (substring heading 0 -1) + (propertize + (let (c) + (if (and magit-show-child-count + (string-match-p ":$" heading) + (> (setq c (length (magit-section-children ,s))) 0)) + (format "%s (%s):" (substring heading 0 -1) c) + heading)) + 'face 'magit-section-title))) + (insert "\n")))) + (set-marker-insertion-type (magit-section-beginning ,s) t) + (goto-char (max (point) ; smaller if there is no content + (magit-section-content-beginning ,s))) + (setf (magit-section-end ,s) (point-marker)) + (save-excursion + (goto-char (magit-section-beginning ,s)) + (let ((end (magit-section-end ,s))) + (while (< (point) end) + (let ((next (or (next-single-property-change + (point) 'magit-section) + end))) + (unless (get-text-property (point) 'magit-section) + (put-text-property (point) next 'magit-section ,s)) + (goto-char next))))) + (if (eq ,s magit-root-section) + (magit-section-set-hidden magit-root-section nil) + (setf (magit-section-children (magit-section-parent ,s)) + (nconc (magit-section-children (magit-section-parent ,s)) + (list ,s))))) + ,s))) + +(defmacro magit-cmd-insert-section (arglist washer program &rest args) + "\n\n(fn (TYPE &optional HEADING) WASHER PROGRAM &rest ARGS)" + (declare (indent 2)) + `(magit-with-section (section ,(car arglist) + ',(car arglist) + ,(cadr arglist) t) + (apply #'process-file ,program nil (list t nil) nil + (magit-flatten-onelevel (list ,@args))) + (unless (eq (char-before) ?\n) + (insert "\n")) + (save-restriction + (narrow-to-region (magit-section-content-beginning section) (point)) + (goto-char (point-min)) + (funcall ,washer) + (goto-char (point-max))) + (let ((parent (magit-section-parent section)) + (head-beg (magit-section-beginning section)) + (body-beg (magit-section-content-beginning section))) + (if (= (point) body-beg) + (if (not parent) + (insert "(empty)\n") + (delete-region head-beg body-beg) + (setq section nil)) + (insert "\n"))))) + +(defmacro magit-git-insert-section (arglist washer &rest args) + "\n\n(fn (TYPE &optional HEADING) WASHER &rest ARGS)" + (declare (indent 2)) + `(magit-cmd-insert-section ,arglist + ,washer + magit-git-executable + magit-git-standard-options ,@args)) + +(defmacro magit-insert-line-section (arglist line) + "\n\n(fn (TYPE &optional INFO) line)" + (declare (indent 1)) + (let ((l (cl-gensym "line"))) + `(let ((,l (concat ,line "\n"))) + (when (string-match "^\\([^:]+\\):\\( \\)" ,l) + (setq ,l (replace-match + (make-string (max 1 (- magit-status-line-align-to + (length (match-string 1 ,l)))) + ?\s) + t t ,l 2))) + (magit-with-section (section ,(car arglist) ',(car arglist) ,l t) + (setf (magit-section-info section) ,(cadr arglist)))))) + +;;;;; Section Searching + +(defun magit-find-section (path top) + "Find the section at the path PATH in subsection of section TOP." + (if (null path) + top + (let ((secs (magit-section-children top))) + (while (and secs (not (equal (car path) + (magit-section-info (car secs))))) + (setq secs (cdr secs))) + (when (car secs) + (magit-find-section (cdr path) (car secs)))))) + +(defun magit-section-path (section) + "Return the path of SECTION." + (let ((parent (magit-section-parent section))) + (when parent + (append (magit-section-path parent) + (list (magit-section-info section)))))) + +(defun magit-find-section-after (pos) + "Find the first section that begins after POS." + (magit-find-section-after* pos (list magit-root-section))) + +(defun magit-find-section-after* (pos secs) + "Find the first section that begins after POS in the list SECS +\(including children of sections in SECS)." + (while (and secs + (<= (magit-section-beginning (car secs)) pos)) + (setq secs (if (magit-section-hidden (car secs)) + (cdr secs) + (append (magit-section-children (car secs)) + (cdr secs))))) + (car secs)) + +(defun magit-find-section-before (pos) + "Return the last section that begins before POS." + (let ((section (magit-find-section-at pos))) + (cl-do* ((current (or (magit-section-parent section) + section) + next) + (next (unless (magit-section-hidden current) + (magit-find-section-before* + pos (magit-section-children current))) + (unless (magit-section-hidden current) + (magit-find-section-before* + pos (magit-section-children current))))) + ((null next) current)))) + +(defun magit-find-section-before* (pos secs) + "Find the last section that begins before POS in the list SECS." + (let ((prev nil)) + (while (and secs + (< (magit-section-beginning (car secs)) pos)) + (setq prev (car secs)) + (setq secs (cdr secs))) + prev)) + +(defun magit-current-section () + "Return the Magit section at point." + (magit-find-section-at (point))) + +(defun magit-find-section-at (pos) + "Return the Magit section at POS." + (or (get-text-property pos 'magit-section) + magit-root-section)) + +;;;;; Section Jumping + +(defun magit-goto-next-section () + "Go to the next section." + (interactive) + (let ((next (magit-find-section-after (point)))) + (if next + (magit-goto-section next) + (message "No next section")))) + +(defun magit-goto-previous-section () + "Go to the previous section." + (interactive) + (if (eq (point) 1) + (message "No previous section") + (magit-goto-section (magit-find-section-before (point))))) + +(defun magit-goto-parent-section () + "Go to the parent section." + (interactive) + (let ((parent (magit-section-parent (magit-current-section)))) + (when parent + (goto-char (magit-section-beginning parent))))) + +(defun magit-goto-next-sibling-section () + "Go to the next sibling section." + (interactive) + (let* ((section (magit-current-section)) + (parent (magit-section-parent section)) + (next (and parent (magit-find-section-after* + (1- (magit-section-end section)) + (magit-section-children parent))))) + (if next + (magit-goto-section next) + (magit-goto-next-section)))) + +(defun magit-goto-previous-sibling-section () + "Go to the previous sibling section." + (interactive) + (let* ((section (magit-current-section)) + (parent (magit-section-parent section)) + (prev (and parent (magit-find-section-before* + (magit-section-beginning section) + (magit-section-children parent))))) + (if prev + (magit-goto-section prev) + (magit-goto-previous-section)))) + +(defun magit-goto-section (section) + (goto-char (magit-section-beginning section)) + (cond + ((and magit-log-auto-more + (eq (magit-section-type section) 'longer)) + (magit-log-show-more-entries) + (forward-line -1) + (magit-goto-next-section)) + ((and (eq (magit-section-type section) 'commit) + (derived-mode-p 'magit-log-mode) + (or (eq (car magit-refresh-args) 'oneline) + (get-buffer-window magit-commit-buffer-name))) + (magit-show-commit (magit-section-info section) t)))) + +(defun magit-goto-section-at-path (path) + "Go to the section described by PATH." + (let ((sec (magit-find-section path magit-root-section))) + (if sec + (goto-char (magit-section-beginning sec)) + (message "No such section")))) + +(defmacro magit-define-section-jumper (sym title) + "Define an interactive function to go to section SYM. +TITLE is the displayed title of the section." + (let ((fun (intern (format "magit-jump-to-%s" sym)))) + `(progn + (defun ,fun (&optional expand) ,(format "\ +Jump to section '%s'. +With a prefix argument also expand it." title) + (interactive "P") + (if (magit-goto-section-at-path '(,sym)) + (when expand + (with-local-quit + (if (eq magit-expand-staged-on-commit 'full) + (magit-show-level 4 nil) + (magit-expand-section))) + (recenter 0)) + (message ,(format "Section '%s' wasn't found" title)))) + (put ',fun 'definition-name ',sym)))) + +(magit-define-section-jumper stashes "Stashes") +(magit-define-section-jumper untracked "Untracked files") +(magit-define-section-jumper unstaged "Unstaged changes") +(magit-define-section-jumper staged "Staged changes") +(magit-define-section-jumper unpulled "Unpulled commits") +(magit-define-section-jumper unpushed "Unpushed commits") +(magit-define-section-jumper diffstats "Diffstats") + +;;;;; Section Hooks + +(defun magit-add-section-hook (hook function &optional at append local) + "Add to the value of section hook HOOK the function FUNCTION. + +Add FUNCTION at the beginning of the hook list unless optional +APPEND is non-nil, in which case FUNCTION is added at the end. +If FUNCTION already is a member then move it to the new location. + +If optional AT is non-nil and a member of the hook list, then add +FUNCTION next to that instead. Add before or after AT depending +on APPEND. If only FUNCTION is a member of the list, then leave +it where ever it already is. + +If optional LOCAL is non-nil, then modify the hook's buffer-local +value rather than its global value. This makes the hook local by +copying the default value. That copy is then modified. + +HOOK should be a symbol. If HOOK is void, it is first set to nil. +HOOK's value must not be a single hook function. FUNCTION should +be a function that takes no arguments and inserts one or multiple +sections at point, moving point forward. FUNCTION may choose not +to insert its section(s), when doing so would not make sense. It +should not be abused for other side-effects. To remove FUNCTION +again use `remove-hook'." + (or (boundp hook) (set hook nil)) + (or (default-boundp hook) (set-default hook nil)) + (let ((value (if local + (if (local-variable-p hook) + (symbol-value hook) + (unless (local-variable-if-set-p hook) + (make-local-variable hook)) + (copy-sequence (default-value hook))) + (default-value hook)))) + (if at + (when (setq at (member at value)) + (setq value (delq function value)) + (if append + (push function (cdr at)) + (push (car at) (cdr at)) + (setcar at function))) + (setq value (delq function value))) + (unless (member function value) + (setq value (if append + (append value (list function)) + (cons function value)))) + (if local + (set hook value) + (set-default hook value)))) + +;;;;; Section Utilities + +(defun magit-map-sections (function section) + "Apply FUNCTION to SECTION and recursively its subsections." + (funcall function section) + (mapc (apply-partially 'magit-map-sections function) + (magit-section-children section))) + +(defun magit-wash-sequence (function) + "Repeatedly call FUNCTION until it returns nil or eob is reached. +FUNCTION has to move point forward or return nil." + (while (and (not (eobp)) (funcall function)))) + +(defun magit-section-parent-info (section) + (setq section (magit-section-parent section)) + (when section (magit-section-info section))) + +(defun magit-section-siblings (section &optional direction) + (let ((parent (magit-section-parent section))) + (when parent + (let ((siblings (magit-section-children parent))) + (cl-ecase direction + (prev (member section (reverse siblings))) + (next (member section siblings)) + (nil siblings)))))) + +(defun magit-section-region-siblings (&optional key) + (let ((beg (magit-find-section-at (region-beginning))) + (end (magit-find-section-at (region-end)))) + (if (eq beg end) + (list (if key (funcall key beg) beg)) + (goto-char (region-end)) + (when (bolp) + (setq end (magit-find-section-at (1- (point))))) + (while (> (length (magit-section-path beg)) + (length (magit-section-path end))) + (setq beg (magit-section-parent beg))) + (while (> (length (magit-section-path end)) + (length (magit-section-path beg))) + (setq end (magit-section-parent end))) + (let* ((parent (magit-section-parent beg)) + (siblings (magit-section-children parent))) + (if (eq parent (magit-section-parent end)) + (mapcar (or key #'identity) + (cl-intersection (memq beg siblings) + (memq end (reverse siblings)))) + (user-error "Ambitious cross-section region")))))) + +(defun magit-diff-section-for-diffstat (section) + (let ((file (magit-section-info section))) + (cl-find-if (lambda (s) + (and (eq (magit-section-type s) 'diff) + (string-equal (magit-section-info s) file))) + (magit-section-children magit-root-section)))) + +;;;;; Section Visibility + +(defun magit-section-set-hidden (section hidden) + "Hide SECTION if HIDDEN is not nil, show it otherwise." + (setf (magit-section-hidden section) hidden) + (if (and (not hidden) + (magit-section-needs-refresh-on-show section)) + (magit-refresh) + (let ((inhibit-read-only t) + (beg (save-excursion + (goto-char (magit-section-beginning section)) + (forward-line) + (point))) + (end (magit-section-end section))) + (when (< beg end) + (put-text-property beg end 'invisible hidden))) + (unless hidden + (dolist (c (magit-section-children section)) + (magit-section-set-hidden c (magit-section-hidden c)))))) + +(defun magit-section-any-hidden (section) + "Return true if SECTION or any of its children is hidden." + (or (magit-section-hidden section) + (let ((kids (magit-section-children section))) + (while (and kids (not (magit-section-any-hidden (car kids)))) + (setq kids (cdr kids))) + kids))) + +(defun magit-section-collapse (section) + "Show SECTION and hide all its children." + (dolist (c (magit-section-children section)) + (setf (magit-section-hidden c) t)) + (magit-section-set-hidden section nil)) + +(defun magit-section-expand (section) + "Show SECTION and all its children." + (dolist (c (magit-section-children section)) + (setf (magit-section-hidden c) nil)) + (magit-section-set-hidden section nil)) + +(defun magit-section-expand-all-aux (section) + "Show recursively all SECTION's children." + (dolist (c (magit-section-children section)) + (setf (magit-section-hidden c) nil) + (magit-section-expand-all-aux c))) + +(defun magit-section-expand-all (section) + "Show SECTION and all its children." + (magit-section-expand-all-aux section) + (magit-section-set-hidden section nil)) + +(defun magit-section-hideshow (flag-or-func) + "Show or hide current section depending on FLAG-OR-FUNC. + +If FLAG-OR-FUNC is a function, it will be ran on current section. +IF FLAG-OR-FUNC is a boolean, the section will be hidden if it is +true, shown otherwise." + (let ((section (magit-current-section))) + (when (magit-section-parent section) + (goto-char (magit-section-beginning section)) + (if (functionp flag-or-func) + (funcall flag-or-func section) + (magit-section-set-hidden section flag-or-func))))) + +(defun magit-show-section () + "Show current section." + (interactive) + (magit-section-hideshow nil)) + +(defun magit-hide-section () + "Hide current section." + (interactive) + (magit-section-hideshow t)) + +(defun magit-collapse-section () + "Hide all subsection of current section." + (interactive) + (magit-section-hideshow #'magit-section-collapse)) + +(defun magit-expand-section () + "Show all subsection of current section." + (interactive) + (magit-section-hideshow #'magit-section-expand)) + +(defun magit-toggle-file-section () + "Like `magit-toggle-section' but toggle at file granularity." + (interactive) + (when (eq (magit-section-type (magit-current-section)) 'hunk) + (magit-goto-parent-section)) + (magit-toggle-section)) + +(defun magit-toggle-section () + "Toggle hidden status of current section." + (interactive) + (magit-section-hideshow + (lambda (s) + (magit-section-set-hidden s (not (magit-section-hidden s)))))) + +(defun magit-expand-collapse-section () + "Toggle hidden status of subsections of current section." + (interactive) + (magit-section-hideshow + (lambda (s) + (cond ((magit-section-any-hidden s) + (magit-section-expand-all s)) + (t + (magit-section-collapse s)))))) + +(defun magit-cycle-section () + "Cycle between expanded, hidden and collapsed state for current section. + +Hidden: only the first line of the section is shown +Collapsed: only the first line of the subsection is shown +Expanded: everything is shown." + (interactive) + (magit-section-hideshow + (lambda (s) + (cond ((magit-section-hidden s) + (magit-section-collapse s)) + ((with-no-warnings + (cl-notany #'magit-section-hidden (magit-section-children s))) + (magit-section-set-hidden s t)) + (t + (magit-section-expand s)))))) + +(defun magit-section-lineage (section) + "Return list of parent, grand-parents... for SECTION." + (when section + (cons section (magit-section-lineage (magit-section-parent section))))) + +(defun magit-section-show-level (section level threshold path) + (magit-section-set-hidden section (>= level threshold)) + (when (and (< level threshold) + (not (magit-no-commit-p))) + (if path + (magit-section-show-level (car path) (1+ level) threshold (cdr path)) + (dolist (c (magit-section-children section)) + (magit-section-show-level c (1+ level) threshold nil))))) + +(defun magit-show-level (level all) + "Show section whose level is less than LEVEL, hide the others. +If ALL is non nil, do this in all sections, otherwise do it only +on ancestors and descendants of current section." + (if all + (magit-section-show-level magit-root-section 0 level nil) + (let ((path (reverse (magit-section-lineage (magit-current-section))))) + (magit-section-show-level (car path) 0 level (cdr path))))) + +(defun magit-show-only-files () + "Show section that are files, but not their subsection. + +Do this in on ancestors and descendants of current section." + (interactive) + (if (derived-mode-p 'magit-status-mode) + (call-interactively 'magit-show-level-2) + (call-interactively 'magit-show-level-1))) + +(defun magit-show-only-files-all () + "Show section that are files, but not their subsection. +Do this for all sections" + (interactive) + (if (derived-mode-p 'magit-status-mode) + (call-interactively 'magit-show-level-2-all) + (call-interactively 'magit-show-level-1-all))) + +(defmacro magit-define-level-shower-1 (level all) + "Define an interactive function to show function of level LEVEL. + +If ALL is non nil, this function will affect all section, +otherwise it will affect only ancestors and descendants of +current section." + (let ((fun (intern (format "magit-show-level-%s%s" + level (if all "-all" "")))) + (doc (format "Show sections on level %s." level))) + `(defun ,fun () + ,doc + (interactive) + (magit-show-level ,level ,all)))) + +(defmacro magit-define-level-shower (level) + "Define two interactive function to show function of level LEVEL. +One for all, one for current lineage." + `(progn + (magit-define-level-shower-1 ,level nil) + (magit-define-level-shower-1 ,level t))) + +(magit-define-level-shower 1) +(magit-define-level-shower 2) +(magit-define-level-shower 3) +(magit-define-level-shower 4) + +;;;;; Section Highlighting + +(defvar-local magit-highlighted-section nil) +(defvar-local magit-highlight-overlay nil) + +(defun magit-highlight-section () + "Highlight current section. +If its HIGHLIGHT slot is nil, then don't highlight it." + (let ((section (magit-current-section)) + (refinep (lambda () + (and magit-highlighted-section + (eq magit-diff-refine-hunk t) + (eq (magit-section-type magit-highlighted-section) + 'hunk))))) + (unless (eq section magit-highlighted-section) + (when (funcall refinep) + (magit-diff-unrefine-hunk magit-highlighted-section)) + (setq magit-highlighted-section section) + (unless magit-highlight-overlay + (overlay-put (setq magit-highlight-overlay (make-overlay 1 1)) + 'face magit-item-highlight-face)) + (cond ((and section (magit-section-highlight section)) + (when (funcall refinep) + (magit-diff-refine-hunk section)) + (move-overlay magit-highlight-overlay + (magit-section-beginning section) + (magit-section-end section) + (current-buffer))) + (t + (delete-overlay magit-highlight-overlay)))))) + +;;;;; Section Actions + +(defun magit-section-context-type (section) + (cons (magit-section-type section) + (let ((parent (magit-section-parent section))) + (when parent + (magit-section-context-type parent))))) + +(defun magit-section-match-1 (l1 l2) + (or (null l1) + (if (eq (car l1) '*) + (or (magit-section-match-1 (cdr l1) l2) + (and l2 + (magit-section-match-1 l1 (cdr l2)))) + (and l2 + (equal (car l1) (car l2)) + (magit-section-match-1 (cdr l1) (cdr l2)))))) + +(defun magit-section-match (condition &optional section) + (unless section + (setq section (magit-current-section))) + (cond ((eq condition t) t) + ((not section) nil) + ((listp condition) + (cl-find t condition :test + (lambda (_ condition) + (magit-section-match condition section)))) + (t + (magit-section-match-1 (if (symbolp condition) + (list condition) + (append condition nil)) + (magit-section-context-type section))))) + +(defmacro magit-section-case (slots &rest clauses) + (declare (indent 1)) + `(let* ((it (magit-current-section)) + ,@(mapcar + (lambda (slot) + `(,slot + (and it (,(intern (format "magit-section-%s" slot)) it)))) + slots)) + (cond ,@(mapcar (lambda (clause) + `((magit-section-match ',(car clause) it) + ,@(cdr clause))) + clauses)))) + +(defconst magit-section-action-success + (make-symbol "magit-section-action-success")) + +(defmacro magit-section-action (opname slots &rest clauses) + (declare (indent 2) (debug (sexp &rest (sexp body)))) + (let ((value (cl-gensym "value"))) + `(let ((,value + (or (run-hook-wrapped + ',(intern (format "magit-%s-hook" opname)) + (lambda (fn section) + (when (magit-section-match + (or (get fn 'magit-section-action-context) + (error "%s undefined for %s" + 'magit-section-action-context fn)) + section) + (funcall fn (magit-section-info section)))) + (magit-current-section)) + (magit-section-case ,slots + ,@clauses + (t (user-error + (if (magit-current-section) + ,(format "Cannot %s this section" opname) + ,(format "Nothing to %s here" opname)))))))) + (unless (eq ,value magit-section-action-success) + ,value)))) + +;;;; Process Api +;;;;; Process Commands + +(defun magit-process () + "Display Magit process buffer." + (interactive) + (let ((buf (magit-process-buffer))) + (if (buffer-live-p buf) + (pop-to-buffer buf) + (user-error "Process buffer doesn't exist")))) + +(defun magit-process-kill () + "Kill the process at point." + (interactive) + (magit-section-case (info) + (process (if (eq (process-status info) 'run) + (when (yes-or-no-p "Kill this process? ") + (kill-process info)) + (user-error "Process isn't running"))))) + +(defvar magit-git-command-history nil) + +;;;###autoload +(defun magit-git-command (args directory) + "Execute a Git subcommand asynchronously, displaying the output. +With a prefix argument run Git in the root of the current +repository. Non-interactively run Git in DIRECTORY with ARGS." + (interactive (magit-git-command-read-args)) + (require 'eshell) + (magit-mode-display-buffer (magit-process-buffer nil t) + 'magit-process-mode 'pop-to-buffer) + (goto-char (point-max)) + (let ((default-directory directory)) + (magit-run-git-async + (with-temp-buffer + (insert args) + (mapcar 'eval (eshell-parse-arguments (point-min) + (point-max))))))) + +(defun magit-git-command-topdir (args directory) + "Execute a Git subcommand asynchronously, displaying the output. +Run Git in the root of the current repository. +\n(fn)" ; arguments are for internal use + (interactive (magit-git-command-read-args t)) + (magit-git-command args directory)) + +(defun magit-git-command-read-args (&optional root) + (let ((dir (if (or root current-prefix-arg) + (or (magit-get-top-dir) + (user-error "Not inside a Git repository")) + default-directory))) + (list (read-string (format "Git subcommand (in %s): " + (abbreviate-file-name dir)) + nil 'magit-git-command-history) + dir))) + +;;;;; Process Mode + +(define-derived-mode magit-process-mode magit-mode "Magit Process" + "Mode for looking at git process output.") + +(defvar magit-process-buffer-name "*magit-process*" + "Name of buffer where output of processes is put.") + +(defun magit-process-buffer (&optional topdir create) + (or (magit-mode-get-buffer magit-process-buffer-name + 'magit-process-mode topdir) + (with-current-buffer (magit-mode-get-buffer-create + magit-process-buffer-name + 'magit-process-mode topdir) + (magit-process-mode) + (let* ((inhibit-read-only t) + (s (magit-with-section (section processbuf nil nil t) + (insert "\n")))) + (set-marker-insertion-type (magit-section-beginning s) nil) + (set-marker-insertion-type (magit-section-content-beginning s) nil) + (current-buffer))))) + +;;;;; Synchronous Processes + +(defun magit-git-exit-code (&rest args) + "Execute Git with ARGS, returning its exit code." + (apply #'process-file magit-git-executable nil nil nil + (append magit-git-standard-options + (magit-flatten-onelevel args)))) + +(defun magit-git-success (&rest args) + "Execute Git with ARGS, returning t if its exit code is 0." + (= (apply #'magit-git-exit-code args) 0)) + +(defun magit-git-failure (&rest args) + "Execute Git with ARGS, returning t if its exit code is 1." + (= (apply #'magit-git-exit-code args) 1)) + +(defun magit-git-string (&rest args) + "Execute Git with ARGS, returning the first line of its output. +If there is no output return nil. If the output begins with a +newline return an empty string." + (with-temp-buffer + (apply #'process-file magit-git-executable nil (list t nil) nil + (append magit-git-standard-options + (magit-flatten-onelevel args))) + (unless (= (point-min) (point-max)) + (goto-char (point-min)) + (buffer-substring-no-properties + (line-beginning-position) + (line-end-position))))) + +(defun magit-git-true (&rest args) + "Execute Git with ARGS, returning t if it prints \"true\". +Return t if the first (and usually only) output line is the +string \"true\", otherwise return nil." + (equal (apply #'magit-git-string args) "true")) + +(defun magit-git-false (&rest args) + "Execute Git with ARGS, returning t if it prints \"false\". +Return t if the first (and usually only) output line is the +string \"false\", otherwise return nil." + (equal (apply #'magit-git-string args) "false")) + +(defun magit-git-insert (&rest args) + "Execute Git with ARGS, inserting its output at point." + (apply #'process-file magit-git-executable nil (list t nil) nil + (append magit-git-standard-options + (magit-flatten-onelevel args)))) + +(defun magit-git-lines (&rest args) + "Execute Git with ARGS, returning its output as a list of lines. +Empty lines anywhere in the output are omitted." + (with-temp-buffer + (apply #'process-file magit-git-executable nil (list t nil) nil + (append magit-git-standard-options + (magit-flatten-onelevel args))) + (split-string (buffer-string) "\n" 'omit-nulls))) + +(defun magit-run-git (&rest args) + "Call Git synchronously in a separate process, and refresh. + +The arguments ARGS specify command line arguments. The first +level of ARGS is flattened, so each member of ARGS has to be a +string or a list of strings. + +Option `magit-git-executable' specifies which Git executable is +used. The arguments in option `magit-git-standard-options' are +prepended to ARGS. + +After Git returns, the current buffer (if it is a Magit buffer) +as well as the current repository's status buffer are refreshed. +Unmodified buffers visiting files that are tracked in the current +repository are reverted if `magit-auto-revert-mode' is active. + +Process output goes into a new section in a buffer specified by +variable `magit-process-buffer-name'." + (apply #'magit-call-git (magit-process-quote-arguments args)) + (magit-refresh)) + +(defun magit-call-git (&rest args) + "Call Git synchronously in a separate process. + +The arguments ARGS specify command line arguments. The first +level of ARGS is flattened, so each member of ARGS has to be a +string or a list of strings. + +Option `magit-git-executable' specifies which Git executable is +used. The arguments in option `magit-git-standard-options' are +prepended to ARGS. + +Process output goes into a new section in a buffer specified by +variable `magit-process-buffer-name'." + (apply #'magit-call-process magit-git-executable + (append magit-git-standard-options args))) + +(defun magit-call-process (program &rest args) + "Call PROGRAM synchronously in a separate process. + +The arguments ARGS specify command line arguments. The first +level of ARGS is flattened, so each member of ARGS has to be a +string or a list of strings. + +Process output goes into a new section in a buffer specified by +variable `magit-process-buffer-name'." + (setq args (magit-flatten-onelevel args)) + (cl-destructuring-bind (process-buf . section) + (magit-process-setup program args) + (magit-process-finish + (let ((inhibit-read-only t)) + (apply #'process-file program nil process-buf nil args)) + process-buf (current-buffer) default-directory section))) + +(defun magit-run-git-with-input (input &rest args) + "Call Git in a separate process. + +The first argument, INPUT, has to be a buffer or the name of an +existing buffer. The content of that buffer is used as the +process' standard input. + +The remaining arguments, ARGS, specify command line arguments. +The first level of ARGS is flattened, so each member of ARGS has +to be a string or a list of strings. + +Option `magit-git-executable' specifies which Git executable is +used. The arguments in option `magit-git-standard-options' are +prepended to ARGS. + +After Git returns, the current buffer (if it is a Magit buffer) +as well as the current repository's status buffer are refreshed. +Unmodified buffers visiting files that are tracked in the current +repository are reverted if `magit-auto-revert-mode' is active. + +This function actually starts a asynchronous process, but it then +waits for that process to return." + (apply #'magit-start-git input args) + (magit-process-wait) + (magit-refresh)) + +(defun magit-run-git-with-logfile (file &rest args) + "Call Git in a separate process and log its output. +And log the output to FILE. This function might have a +short halflive. See `magit-run-git' for more information." + (apply #'magit-start-git nil args) + (process-put magit-this-process 'logfile file) + (set-process-filter magit-this-process 'magit-process-logfile-filter) + (magit-process-wait) + (magit-refresh)) + +;;;;; Asynchronous Processes + +(defvar magit-this-process nil) + +(defun magit-run-git-async (&rest args) + "Start Git, prepare for refresh, and return the process object. + +If optional argument INPUT is non-nil, it has to be a buffer or +the name of an existing buffer. The content of that buffer is +used as the process' standard input. + +The remaining arguments, ARGS, specify command line arguments. +The first level of ARGS is flattened, so each member of ARGS has +to be a string or a list of strings. + +Display the command line arguments in the echo area. + +After Git returns some buffers are refreshed: the buffer that was +current when `magit-start-process' was called (if it is a Magit +buffer and still alive), as well as the respective Magit status +buffer. Unmodified buffers visiting files that are tracked in +the current repository are reverted if `magit-auto-revert-mode' +is active. + +See `magit-start-process' for more information." + (message "Running %s %s" magit-git-executable + (mapconcat 'identity (magit-flatten-onelevel args) " ")) + (apply #'magit-start-git nil args)) + +(defun magit-start-git (&optional input &rest args) + "Start Git, prepare for refresh, and return the process object. + +If optional argument INPUT is non-nil, it has to be a buffer or +the name of an existing buffer. The buffer content becomes the +processes standard input. + +The remaining arguments, ARGS, specify command line arguments. +The first level of ARGS is flattened, so each member of ARGS has +to be a string or a list of strings. + +After Git returns some buffers are refreshed: the buffer that was +current when `magit-start-process' was called (if it is a Magit +buffer and still alive), as well as the respective Magit status +buffer. Unmodified buffers visiting files that are tracked in +the current repository are reverted if `magit-auto-revert-mode' +is active. + +See `magit-start-process' for more information." + (apply #'magit-start-process magit-git-executable input + (append magit-git-standard-options + (magit-process-quote-arguments args)))) + +(defun magit-start-process (program &optional input &rest args) + "Start PROGRAM, prepare for refresh, and return the process object. + +If optional argument INPUT is non-nil, it has to be a buffer or +the name of an existing buffer. The buffer content becomes the +processes standard input. + +The remaining arguments, ARGS, specify command line arguments. +The first level of ARGS is flattened, so each member of ARGS has +to be a string or a list of strings. + +The process is started using `start-file-process' and then setup +to use the sentinel `magit-process-sentinel' and the filter +`magit-process-filter'. Information required by these functions +is stored in the process object. When this function returns the +process has not started to run yet so it is possible to override +the sentinel and filter. + +After the process returns, `magit-process-sentinel' refreshes the +buffer that was current when `magit-start-process' was called (if +it is a Magit buffer and still alive), as well as the respective +Magit status buffer. Unmodified buffers visiting files that are +tracked in the current repository are reverted if +`magit-auto-revert-mode' is active." + (setq args (magit-flatten-onelevel args)) + (cl-destructuring-bind (process-buf . section) + (magit-process-setup program args) + (let* ((process-connection-type + ;; Don't use a pty, because it would set icrnl + ;; which would modify the input (issue #20). + (and (not input) magit-process-connection-type)) + (process (apply 'start-file-process + (file-name-nondirectory program) + process-buf program args))) + (set-process-sentinel process #'magit-process-sentinel) + (set-process-filter process #'magit-process-filter) + (set-process-buffer process process-buf) + (process-put process 'section section) + (process-put process 'command-buf (current-buffer)) + (process-put process 'default-dir default-directory) + (setf (magit-section-process section) process) + (with-current-buffer process-buf + (set-marker (process-mark process) (point))) + (when input + (with-current-buffer input + (process-send-region process (point-min) (point-max)) + (process-send-eof process))) + (setq magit-this-process process) + (setf (magit-section-info section) process) + (magit-process-display-buffer process) + process))) + +;;;;; Process Internals + +(defun magit-process-setup (program args) + (magit-process-set-mode-line program args) + (let ((buf (magit-process-buffer))) + (if buf + (magit-process-truncate-log buf) + (setq buf (magit-process-buffer nil t))) + (with-current-buffer buf + (goto-char (1- (point-max))) + (let* ((inhibit-read-only t) + (magit-with-section--parent magit-root-section) + ;; Kids, don't do this ^^^^ at home. + (s (magit-with-section + (section process nil + (mapconcat 'identity (cons program args) " ")) + (insert "\n")))) + (set-marker-insertion-type (magit-section-content-beginning s) nil) + (insert "\n") + (backward-char 2) + (cons (current-buffer) s))))) + +(defun magit-process-truncate-log (buffer) + (with-current-buffer buffer + (let* ((head nil) + (tail (magit-section-children magit-root-section)) + (count (length tail))) + (when (> (1+ count) magit-process-log-max) + (while (and (cdr tail) + (> count (/ magit-process-log-max 2))) + (let* ((inhibit-read-only t) + (section (car tail)) + (process (magit-section-process section))) + (cond ((not process)) + ((memq (process-status process) '(exit signal)) + (delete-region (magit-section-beginning section) + (1+ (magit-section-end section))) + (cl-decf count)) + (t + (push section head)))) + (pop tail)) + (setf (magit-section-children magit-root-section) + (nconc (reverse head) tail)))))) + +(defun magit-process-sentinel (process event) + "Default sentinel used by `magit-start-process'." + (when (memq (process-status process) '(exit signal)) + (setq event (substring event 0 -1)) + (magit-process-unset-mode-line) + (when (string-match "^finished" event) + (message (concat (capitalize (process-name process)) " finished"))) + (magit-process-finish process) + (when (eq process magit-this-process) + (setq magit-this-process nil)) + (magit-refresh (and (buffer-live-p (process-get process 'command-buf)) + (process-get process 'command-buf))))) + +(defun magit-process-filter (proc string) + "Default filter used by `magit-start-process'." + (with-current-buffer (process-buffer proc) + (let ((inhibit-read-only t)) + (magit-process-yes-or-no-prompt proc string) + (magit-process-username-prompt proc string) + (magit-process-password-prompt proc string) + (goto-char (process-mark proc)) + (setq string (propertize string 'invisible + (magit-section-hidden + (process-get proc 'section)))) + ;; Find last ^M in string. If one was found, ignore everything + ;; before it and delete the current line. + (let ((ret-pos (length string))) + (while (and (>= (setq ret-pos (1- ret-pos)) 0) + (/= ?\r (aref string ret-pos)))) + (cond ((>= ret-pos 0) + (goto-char (line-beginning-position)) + (delete-region (point) (line-end-position)) + (insert-and-inherit (substring string (+ ret-pos 1)))) + (t + (insert-and-inherit string)))) + (set-marker (process-mark proc) (point))))) + +(defun magit-process-logfile-filter (process string) + "Special filter used by `magit-run-git-with-logfile'." + (magit-process-filter process string) + (let ((file (process-get process 'logfile))) + (with-temp-file file + (when (file-exists-p file) + (insert-file-contents file) + (goto-char (point-max))) + (insert string) + (write-region (point-min) (point-max) file)))) + +(defun magit-process-yes-or-no-prompt (proc string) + "Forward yes-or-no prompts to the user." + (let ((beg (string-match magit-process-yes-or-no-prompt-regexp string)) + (max-mini-window-height 30)) + (when beg + (process-send-string + proc + (downcase + (concat (match-string (if (yes-or-no-p (substring string 0 beg)) 1 2) + string) + "\n")))))) + +(defun magit-process-password-prompt (proc string) + "Forward password prompts to the user." + (let ((prompt (magit-process-match-prompt + magit-process-password-prompt-regexps string))) + (when prompt + (process-send-string proc (concat (read-passwd prompt) "\n"))))) + +(defun magit-process-username-prompt (proc string) + "Forward username prompts to the user." + (let ((prompt (magit-process-match-prompt + magit-process-username-prompt-regexps string))) + (when prompt + (process-send-string proc + (concat (read-string prompt nil nil + (user-login-name)) + "\n"))))) + +(defun magit-process-match-prompt (prompts string) + (when (cl-find-if (lambda (regex) + (string-match regex string)) + prompts) + (let ((prompt (match-string 0 string))) + (cond ((string-match ": $" prompt) prompt) + ((string-match ":$" prompt) (concat prompt " ")) + (t (concat prompt ": ")))))) + +(defun magit-process-wait () + (while (and magit-this-process + (eq (process-status magit-this-process) 'run)) + (sit-for 0.1 t))) + +(defun magit-process-set-mode-line (program args) + (when (equal program magit-git-executable) + (setq args (nthcdr (1+ (length magit-git-standard-options)) args))) + (magit-map-magit-buffers + (apply-partially (lambda (s) + (setq mode-line-process s)) + (concat " " program + (and args (concat " " (car args))))))) + +(defun magit-process-unset-mode-line () + (magit-map-magit-buffers (lambda () (setq mode-line-process nil)))) + +(defvar magit-process-error-message-re + (concat "^\\(?:error\\|fatal\\|git\\): \\(.*\\)" paragraph-separate)) + +(defun magit-process-finish (arg &optional process-buf command-buf + default-dir section) + (unless (integerp arg) + (setq process-buf (process-buffer arg) + command-buf (process-get arg 'command-buf) + default-dir (process-get arg 'default-dir) + section (process-get arg 'section) + arg (process-exit-status arg))) + (when (featurep 'dired) + (dired-uncache default-dir)) + (when (buffer-live-p process-buf) + (with-current-buffer process-buf + (let ((inhibit-read-only t) + (mark (magit-section-beginning section))) + (set-marker-insertion-type mark nil) + (goto-char mark) + (insert (propertize (format "%3s " arg) + 'magit-section section + 'face (if (= arg 0) + 'magit-process-ok + 'magit-process-ng)))))) + (unless (= arg 0) + (message ; `error' would prevent refresh + "%s ... [%s buffer %s for details]" + (or (and (buffer-live-p process-buf) + (with-current-buffer process-buf + (save-excursion + (goto-char (magit-section-end section)) + (when (re-search-backward + magit-process-error-message-re nil + (magit-section-content-beginning section)) + (match-string 1))))) + "Git failed") + (let ((key (and (buffer-live-p command-buf) + (with-current-buffer command-buf + (car (where-is-internal + 'magit-process-display-buffer)))))) + (if key (format "Hit %s to see" (key-description key)) "See")) + (buffer-name process-buf))) + arg) + +(defun magit-process-display-buffer (process) + (when (process-live-p process) + (let ((buf (process-buffer process))) + (cond ((not (buffer-live-p buf))) + ((= magit-process-popup-time 0) + (pop-to-buffer buf)) + ((> magit-process-popup-time 0) + (run-with-timer magit-process-popup-time nil + (lambda (p) + (when (eq (process-status p) 'run) + (let ((buf (process-buffer p))) + (when (buffer-live-p buf) + (pop-to-buffer buf))))) + process)))))) + +(defun magit-process-quote-arguments (args) + "Quote each argument in list ARGS as an argument to Git. +Except when `magit-process-quote-curly-braces' is non-nil ARGS is +returned unchanged. This is required to works around strangeness +of the Windows \"Powershell\"." + (if magit-process-quote-curly-braces + (mapcar (apply-partially 'replace-regexp-in-string + "{\\([0-9]+\\)}" "\\\\{\\1\\\\}") + (magit-flatten-onelevel args)) + args)) + +;;;; Mode Api +;;;;; Mode Foundation + +(define-derived-mode magit-mode special-mode "Magit" + "Parent major mode from which Magit major modes inherit. + +Please see the manual for a complete description of Magit. + +\\{magit-mode-map}" + (buffer-disable-undo) + (setq truncate-lines t) + (add-hook 'pre-command-hook #'magit-remember-point nil t) + (add-hook 'post-command-hook #'magit-correct-point-after-command t t) + (add-hook 'post-command-hook #'magit-highlight-section t t) + ;; Emacs' normal method of showing trailing whitespace gives weird + ;; results when `magit-whitespace-warning-face' is different from + ;; `trailing-whitespace'. + (when (and magit-highlight-whitespace + magit-highlight-trailing-whitespace) + (setq show-trailing-whitespace nil))) + +(defvar-local magit-refresh-function nil) +(put 'magit-refresh-function 'permanent-local t) + +(defvar-local magit-refresh-args nil) +(put 'magit-refresh-args 'permanent-local t) + +(defmacro magit-mode-setup + (buffer switch-func mode refresh-func &rest refresh-args) + "Display and select BUFFER, turn on MODE, and refresh a first time. +Display BUFFER using `magit-mode-display-buffer', then turn on +MODE in BUFFER, set the local value of `magit-refresh-function' +to REFRESH-FUNC and that of `magit-refresh-args' to REFRESH-ARGS +and finally \"refresh\" a first time. All arguments are +evaluated before switching to BUFFER." + (let ((mode-symb (cl-gensym "mode-symb")) + (toplevel (cl-gensym "toplevel")) + (init-args (cl-gensym "init-args")) + (buf-symb (cl-gensym "buf-symb"))) + `(let* ((,mode-symb ,mode) + (,toplevel (magit-get-top-dir)) + (,init-args (list ,mode-symb ,refresh-func ,@refresh-args)) + (,buf-symb (magit-mode-display-buffer + ,buffer ,mode-symb ,switch-func))) + (if ,toplevel + (with-current-buffer ,buf-symb + (apply #'magit-mode-init ,toplevel ,init-args)) + (user-error "Not inside a Git repository"))))) + +(defun magit-mode-init (dir mode refresh-func &rest refresh-args) + "Turn on MODE and refresh in the current buffer. +Turn on MODE, set the local value of `magit-refresh-function' to +REFRESH-FUNC and that of `magit-refresh-args' to REFRESH-ARGS and +finally \"refresh\" a first time. + +Also see `magit-mode-setup', a more convenient variant." + (cl-case mode + (magit-commit-mode + (magit-setup-xref (cons #'magit-show-commit refresh-args)) + (goto-char (point-min))) + (magit-diff-mode + (magit-setup-xref (cons #'magit-diff refresh-args)) + (goto-char (point-min)))) + (setq default-directory dir + magit-refresh-function refresh-func + magit-refresh-args refresh-args) + (funcall mode) + (magit-mode-refresh-buffer)) + +(defvar-local magit-previous-window-configuration nil) +(put 'magit-previous-window-configuration 'permanent-local t) + +(defun magit-mode-display-buffer (buffer mode &optional switch-function) + "Display BUFFER in some window and select it. +BUFFER may be a buffer or a string, the name of a buffer. Return +the buffer. + +Unless BUFFER is already displayed in the selected frame store the +previous window configuration as a buffer local value, so that it +can later be restored by `magit-mode-quit-window'. + +Then display and select BUFFER using SWITCH-FUNCTION. If that is +nil either use `pop-to-buffer' if the current buffer's major mode +derives from Magit mode; or else use `switch-to-buffer'. + +This is only intended for buffers whose major modes derive from +Magit mode." + (cond ((stringp buffer) + (setq buffer (magit-mode-get-buffer-create buffer mode))) + ((not (bufferp buffer)) + (signal 'wrong-type-argument (list 'bufferp nil)))) + (unless (get-buffer-window buffer (selected-frame)) + (with-current-buffer (get-buffer-create buffer) + (setq magit-previous-window-configuration + (current-window-configuration)))) + (funcall (or switch-function + (if (derived-mode-p 'magit-mode) + 'switch-to-buffer + 'pop-to-buffer)) + buffer) + buffer) + +(defun magit-mode-get-buffer (format mode &optional topdir create) + (if (not (string-match-p "%[Tt]" format)) + (funcall (if create #'get-buffer-create #'get-buffer) format) + (unless topdir + (setq topdir (magit-get-top-dir))) + (let ((name (format-spec + format `((?T . ,topdir) + (?t . ,(file-name-nondirectory + (directory-file-name topdir))))))) + (or (cl-find-if + (lambda (buf) + (with-current-buffer buf + (and (or (not mode) (eq major-mode mode)) + (equal (expand-file-name default-directory) topdir) + (string-match-p (format "^%s\\(?:<[0-9]+>\\)?$" + (regexp-quote name)) + (buffer-name))))) + (buffer-list)) + (and create (generate-new-buffer name)))))) + +(defun magit-mode-get-buffer-create (format mode &optional topdir) + (magit-mode-get-buffer format mode topdir t)) + +(cl-defun magit-mode-refresh-buffer (&optional (buffer (current-buffer))) + (with-current-buffer buffer + (when magit-refresh-function + (let* ((old-line (line-number-at-pos)) + (old-point (point)) + (old-section (magit-current-section)) + (old-path (and old-section + (magit-section-path (magit-current-section))))) + (beginning-of-line) + (let ((inhibit-read-only t) + (section-line (and old-section + (count-lines + (magit-section-beginning old-section) + (point)))) + (line-char (- old-point (point)))) + (erase-buffer) + (apply magit-refresh-function + magit-refresh-args) + (let ((s (and old-path (magit-find-section old-path magit-root-section)))) + (cond (s + (goto-char (magit-section-beginning s)) + (forward-line section-line) + (forward-char line-char)) + (t + (save-restriction + (widen) + (goto-char (point-min)) + (forward-line (1- old-line))))))) + (magit-highlight-section) + (magit-refresh-marked-commits-in-buffer))))) + +(defun magit-mode-quit-window (&optional kill-buffer) + "Bury the current buffer and delete its window. +With a prefix argument, kill the buffer instead. + +If `magit-restore-window-configuration' is non-nil and the last +configuration stored by `magit-mode-display-buffer' originates +from the selected frame then restore it after burrying/killing +the buffer. Finally reset the window configuration to nil." + (interactive "P") + (let ((winconf magit-previous-window-configuration) + (buffer (current-buffer)) + (frame (selected-frame))) + (quit-window kill-buffer (selected-window)) + (when winconf + (when (and magit-restore-window-configuration + (equal frame (window-configuration-frame winconf))) + (set-window-configuration winconf) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (setq magit-previous-window-configuration nil))))) + (run-hook-with-args 'magit-mode-quit-window-hook buffer))) + +;;;;; Mode Utilities + +(defun magit-map-magit-buffers (func &optional dir) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when (and (derived-mode-p 'magit-mode) + (or (null dir) + (equal default-directory dir))) + (funcall func))))) + +;;;;; (section kludges) + +(defvar-local magit-last-point nil) +(put 'magit-last-point 'permanent-local t) + +(defun magit-remember-point () + (setq magit-last-point (point))) + +(defun magit-invisible-region-end (pos) + (while (and (not (= pos (point-max))) (invisible-p pos)) + (setq pos (next-char-property-change pos))) + pos) + +(defun magit-invisible-region-start (pos) + (while (and (not (= pos (point-min))) (invisible-p pos)) + (setq pos (1- (previous-char-property-change pos)))) + pos) + +(defun magit-correct-point-after-command () + "Move point outside of invisible regions. + +Emacs often leaves point in invisible regions, it seems. To fix +this, we move point ourselves and never let Emacs do its own +adjustments. + +When point has to be moved out of an invisible region, it can be +moved to its end or its beginning. We usually move it to its +end, except when that would move point back to where it was +before the last command." + (when (invisible-p (point)) + (let ((end (magit-invisible-region-end (point)))) + (goto-char (if (= end magit-last-point) + (magit-invisible-region-start (point)) + end)))) + (setq disable-point-adjustment t)) + +;;;;; Buffer History + +(defun magit-go-backward () + "Move backward in current buffer's history." + (interactive) + (if help-xref-stack + (help-xref-go-back (current-buffer)) + (user-error "No previous entry in buffer's history"))) + +(defun magit-go-forward () + "Move forward in current buffer's history." + (interactive) + (if help-xref-forward-stack + (help-xref-go-forward (current-buffer)) + (user-error "No next entry in buffer's history"))) + +(defun magit-xref-insert-buttons () + (when (and (or (eq magit-show-xref-buttons t) + (apply 'derived-mode-p magit-show-xref-buttons)) + (or help-xref-stack help-xref-forward-stack)) + (insert "\n") + (when help-xref-stack + (magit-xref-insert-button help-back-label + 'magit-xref-backward)) + (when help-xref-forward-stack + (when help-xref-stack + (insert " ")) + (magit-xref-insert-button help-forward-label + 'magit-xref-forward)))) + +(defun magit-xref-insert-button (label type) + (magit-with-section (section button label) + (insert-text-button label 'type type + 'help-args (list (current-buffer))))) + +(define-button-type 'magit-xref-backward + :supertype 'help-back + 'mouse-face magit-item-highlight-face + 'help-echo (purecopy "mouse-2, RET: go back to previous history entry")) + +(define-button-type 'magit-xref-forward + :supertype 'help-forward + 'mouse-face magit-item-highlight-face + 'help-echo (purecopy "mouse-2, RET: go back to next history entry")) + +(defun magit-setup-xref (item) + (when help-xref-stack-item + (push (cons (point) help-xref-stack-item) help-xref-stack) + (setq help-xref-forward-stack nil)) + (when (called-interactively-p 'interactive) + (let ((tail (nthcdr 10 help-xref-stack))) + (if tail (setcdr tail nil)))) + (setq help-xref-stack-item item)) + +;;;;; Refresh Machinery + +(defun magit-refresh (&optional buffer) + "Refresh some buffers belonging to the current repository. + +Refresh the current buffer if its major mode derives from +`magit-mode', and refresh the corresponding status buffer. +If the global `magit-auto-revert-mode' is turned on, then +also revert all unmodified buffers that visit files being +tracked in the current repository." + (interactive (list (current-buffer))) + (unless buffer + (setq buffer (current-buffer))) + (with-current-buffer buffer + (when (derived-mode-p 'magit-mode) + (magit-mode-refresh-buffer buffer)) + (let (status) + (when (and (not (eq major-mode 'magit-status-mode)) + (setq status (magit-mode-get-buffer + magit-status-buffer-name + 'magit-status-mode))) + (magit-mode-refresh-buffer status)))) + (when magit-auto-revert-mode + (magit-revert-buffers))) + +(defun magit-refresh-all () + "Refresh all buffers belonging to the current repository. + +Refresh all Magit buffers belonging to the current repository. +If the global `magit-auto-revert-mode' is turned on, then also +revert all unmodified buffers that visit files being tracked in +the current repository." + (interactive) + (magit-map-magit-buffers #'magit-mode-refresh-buffer default-directory) + (magit-revert-buffers)) + +(defun magit-revert-buffers () + (let ((topdir (magit-get-top-dir))) + (when topdir + (let ((gitdir (magit-git-dir)) + (tracked (magit-git-lines "ls-tree" "-r" "--name-only" "HEAD"))) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (let ((file (buffer-file-name))) + (and file (string-prefix-p topdir file) + (not (string-prefix-p gitdir file)) + (member (file-relative-name file topdir) tracked) + (let ((auto-revert-mode t)) + (auto-revert-handler) + (run-hooks 'magit-revert-buffer-hook)))))))))) + +;;; (misplaced) +;;;; Diff Options + +(defvar magit-diff-context-lines 3) + +(defun magit-diff-U-arg () + (format "-U%d" magit-diff-context-lines)) + +(defun magit-diff-smaller-hunks (&optional count) + "Decrease the context for diff hunks by COUNT." + (interactive "p") + (setq magit-diff-context-lines (max 0 (- magit-diff-context-lines count))) + (magit-refresh)) + +(defun magit-diff-larger-hunks (&optional count) + "Increase the context for diff hunks by COUNT." + (interactive "p") + (setq magit-diff-context-lines (+ magit-diff-context-lines count)) + (magit-refresh)) + +(defun magit-diff-default-hunks () + "Reset context for diff hunks to the default size." + (interactive) + (setq magit-diff-context-lines 3) + (magit-refresh)) + +(defun magit-set-diff-options () + "Set local `magit-diff-options' based on popup state. +And refresh the current Magit buffer." + (interactive) + (setq-local magit-diff-options magit-custom-options) + (magit-refresh)) + +;; `magit-set-default-diff-options' is defined in "Options"/"Setters". + +(defun magit-save-default-diff-options () + "Set and save the default for `magit-diff-options' based on popup value. +Also set the local value in all Magit buffers and refresh them." + (interactive) + (customize-save-variable 'magit-diff-options magit-custom-options)) + +(defun magit-reset-diff-options () + "Reset local `magit-diff-options' to default value. +And refresh the current Magit buffer." + (interactive) + (setq-local magit-diff-options (default-value 'magit-diff-options)) + (magit-refresh)) + +;;;; Raw Diff Washing + +(defun magit-insert-diff (section file status) + (let ((beg (point))) + (apply 'magit-git-insert "-c" "diff.submodule=short" "diff" + `(,(magit-diff-U-arg) ,@magit-diff-options "--" ,file)) + (unless (eq (char-before) ?\n) + (insert "\n")) + (save-restriction + (narrow-to-region beg (point)) + (goto-char beg) + (magit-wash-diff-section section) + (goto-char (point-max))))) + +(defun magit-wash-raw-diffs (&optional staged) + (let (previous) + (magit-wash-sequence + (lambda () + (setq previous (magit-wash-raw-diff previous staged)))))) + +(defun magit-wash-raw-diff (previous staged) + (when (looking-at + ":\\([0-7]+\\) \\([0-7]+\\) [0-9a-f]+ [0-9a-f]+ \\(.\\)[0-9]*\t\\([^\t\n]+\\)$") + (let ((file (magit-decode-git-path (match-string-no-properties 4))) + (status (cl-ecase (string-to-char (match-string-no-properties 3)) + (?A 'new) + (?C 'copy) + (?D 'deleted) + (?M 'modified) + (?T 'typechange) + (?U 'unmerged) + (?X 'unknown)))) + (delete-region (point) (1+ (line-end-position))) + (unless (or ;; Unmerged files get two entries; we ignore the second. + (equal file previous) + ;; Ignore staged, unmerged files. + (and staged (eq status 'unmerged))) + (magit-with-section (section diff file nil nil + (not (derived-mode-p + 'magit-diff-mode + 'magit-commit-mode))) + (if (not (magit-section-hidden section)) + (magit-insert-diff section file status) + (setf (magit-section-diff-status section) status) + (setf (magit-section-needs-refresh-on-show section) t) + (magit-insert-diff-title status file nil)))) + file))) + +;;; Modes (1) +;;;; Commit Mode +;;;;; Commit Core + +(define-derived-mode magit-commit-mode magit-mode "Magit" + "Mode for looking at a git commit. + +\\Type `\\[magit-visit-item]` to visit the changed file, \ +`\\[magit-toggle-section]` to hide or show a hunk, +`\\[magit-diff-larger-hunks]` and `\\[magit-diff-smaller-hunks]` to change the \ +size of the hunks. +Type `\\[magit-apply-item]` to apply a change to your worktree and \ +`\\[magit-revert-item]` to reverse it. + +\\{magit-commit-mode-map} +Unless shadowed by the mode specific bindings above, bindings +from the parent keymap `magit-mode-map' are also available." + :group 'magit) + +(defvar magit-commit-buffer-name "*magit-commit*" + "Name of buffer used to display a commit.") + +;;;###autoload +(defun magit-show-commit (commit &optional noselect) + "Show information about COMMIT." + (interactive (list (magit-read-rev-with-default + "Show commit (hash or ref)"))) + (when (magit-git-failure "cat-file" "commit" commit) + (user-error "%s is not a commit" commit)) + (magit-mode-setup magit-commit-buffer-name + (if noselect 'display-buffer 'pop-to-buffer) + #'magit-commit-mode + #'magit-refresh-commit-buffer + commit)) + +(defun magit-show-item-or-scroll-up () + "Update commit or status buffer for item at point. + +Either show the commit or stash at point in another buffer, +or if that buffer is already displayed in the current frame +and contains information about that commit or stash, then +instead scroll the buffer up. If there is no commit or +stash at point, then prompt for a commit." + (interactive) + (magit-show-item-or-scroll 'scroll-up)) + +(defun magit-show-item-or-scroll-down () + "Update commit or status buffer for item at point. + +Either show the commit or stash at point in another buffer, +or if that buffer is already displayed in the current frame +and contains information about that commit or stash, then +instead scroll the buffer down. If there is no commit or +stash at point, then prompt for a commit." + (interactive) + (magit-show-item-or-scroll 'scroll-down)) + +(defun magit-show-item-or-scroll (fn) + (let (rev cmd buf win) + (magit-section-case (info) + (commit (setq rev info + cmd 'magit-show-commit + buf magit-commit-buffer-name)) + (stash (setq rev info + cmd 'magit-diff-stash + buf magit-stash-buffer-name))) + (if rev + (if (and (setq buf (get-buffer buf)) + (setq win (get-buffer-window buf)) + (with-current-buffer buf + (equal rev (car magit-refresh-args)))) + (with-selected-window win + (condition-case err + (funcall fn) + (error + (goto-char (cl-case fn + (scroll-up (point-min)) + (scroll-down (point-max))))))) + (funcall cmd rev t)) + (call-interactively 'magit-show-commit)))) + +(defun magit-refresh-commit-buffer (commit) + (magit-git-insert-section (commitbuf nil) + #'magit-wash-commit + "log" "-1" "--decorate=full" + "--pretty=medium" (magit-diff-U-arg) + "--cc" "-p" (and magit-show-diffstat "--stat") + magit-diff-options commit)) + +;;;;; Commit Washing + +(defun magit-wash-commit () + (looking-at "^commit \\([a-z0-9]+\\)\\(?: \\(.+\\)\\)?$") + (let ((rev (match-string 1)) + (refs (match-string 2))) + (delete-region (point) (1+ (line-end-position))) + (magit-with-section + (section headers 'headers + (concat (propertize rev 'face 'magit-log-sha1) + (and refs (concat " "(magit-format-ref-labels refs))) + "\n")) + (while (re-search-forward "^\\([a-z]+\\): +\\(.+\\)$" nil t) + (when (string-match-p (match-string 1) "Merge") + (let ((revs (match-string 2))) + (delete-region (match-beginning 2) (match-end 2)) + (dolist (rev (split-string revs)) + (magit-insert-commit-button rev) + (insert ?\s))))) + (forward-line))) + (forward-line) + (let ((bound (save-excursion + (when (re-search-forward "^diff" nil t) + (copy-marker (match-beginning 0))))) + (summary (buffer-substring-no-properties + (point) (line-end-position)))) + (delete-region (point) (1+ (line-end-position))) + (magit-with-section (section message 'message (concat summary "\n")) + (cond ((re-search-forward "^---" bound t) + (goto-char (match-beginning 0)) + (delete-region (match-beginning 0) (match-end 0))) + ((re-search-forward "^.[^ ]" bound t) + (goto-char (1- (match-beginning 0))))))) + (forward-line) + (when magit-show-diffstat + (magit-wash-diffstats)) + (forward-line) + (magit-wash-diffs)) + +(defun magit-insert-commit-button (hash) + (magit-with-section (section commit hash) + (insert-text-button hash + 'help-echo "Visit commit" + 'action (lambda (button) + (save-excursion + (goto-char button) + (magit-visit-item))) + 'follow-link t + 'mouse-face magit-item-highlight-face + 'face 'magit-log-sha1))) + +;;;; Status Mode + +(define-derived-mode magit-status-mode magit-mode "Magit" + "Mode for looking at git status. + +\\Type `\\[magit-stage-item]` to stage (add) an item, \ +`\\[magit-unstage-item]` to unstage it. +Type `\\[magit-key-mode-popup-committing]` to have a popup to commit, type \ +`\\[magit-key-mode-popup-dispatch]` to see others +available popup. +Type `\\[magit-visit-item]` to visit something, and \ +`\\[magit-toggle-section]` to show or hide section. + +More information can be found in Info node `(magit)Status' + +Other key binding: +\\{magit-status-mode-map}" + :group 'magit) + +(defvar magit-status-buffer-name "*magit: %t*" + "Name of buffer used to display a repository's status.") + +;;;###autoload +(defun magit-status (dir &optional switch-function) + "Open a Magit status buffer for the Git repository containing DIR. +If DIR is not within a Git repository, offer to create a Git +repository in DIR. + +Interactively, a prefix argument means to ask the user which Git +repository to use even if `default-directory' is under Git +control. Two prefix arguments means to ignore `magit-repo-dirs' +when asking for user input. + +Depending on option `magit-status-buffer-switch-function' the +status buffer is shown in another window (the default) or the +current window. Non-interactively optional SWITCH-FUNCTION +can be used to override this." + (interactive (list (if current-prefix-arg + (magit-read-top-dir + (> (prefix-numeric-value current-prefix-arg) + 4)) + (or (magit-get-top-dir) + (magit-read-top-dir nil))))) + (magit-save-some-buffers) + (let ((topdir (magit-get-top-dir dir))) + (when (or topdir + (and (yes-or-no-p + (format "There is no Git repository in %s. Create one? " + dir)) + (magit-init dir) + (setq topdir (magit-get-top-dir dir)))) + (let ((default-directory topdir)) + (magit-mode-setup magit-status-buffer-name + (or switch-function + magit-status-buffer-switch-function) + #'magit-status-mode + #'magit-refresh-status))))) + +(defun magit-refresh-status () + (magit-git-exit-code "update-index" "--refresh") + (magit-with-section (section status 'status nil t) + (run-hooks 'magit-status-sections-hook)) + (run-hooks 'magit-refresh-status-hook)) + +;;; Sections +;;;; Real Sections + +(defun magit-insert-stashes () + ;; #1427 Set log.date to work around an issue in Git <1.7.10.3. + (let ((stashes (magit-git-lines "-c" "log.date=default" "stash" "list"))) + (when stashes + (magit-with-section (section stashes 'stashes "Stashes:" t) + (dolist (stash stashes) + (string-match "^\\(stash@{\\([0-9]+\\)}\\): \\(.+\\)$" stash) + (let ((stash (match-string 1 stash)) + (number (match-string 2 stash)) + (message (match-string 3 stash))) + (magit-with-section (section stash stash) + (insert number ": " message "\n")))) + (insert "\n"))))) + +(defun magit-insert-untracked-files () + (magit-with-section (section untracked 'untracked "Untracked files:" t) + (let ((files (cl-mapcan + (lambda (f) + (when (eq (aref f 0) ??) (list f))) + (magit-git-lines + "status" "--porcelain")))) + (if (not files) + (setq section nil) + (dolist (file files) + (setq file (magit-decode-git-path (substring file 3))) + (magit-with-section (section file file) + (insert "\t" file "\n"))) + (insert "\n"))))) + +(defun magit-insert-pending-commits () + (let* ((info (magit-read-rewrite-info)) + (pending (cdr (assq 'pending info)))) + (when pending + (magit-with-section (section pending 'pending "Pending commits:" t) + (dolist (p pending) + (let* ((commit (car p)) + (properties (cdr p)) + (used (plist-get properties 'used))) + (magit-with-section (section commit commit) + (insert (magit-git-string + "log" "-1" + (if used + "--pretty=format:. %s" + "--pretty=format:* %s") + commit "--") + "\n"))))) + (insert "\n")))) + +(defun magit-insert-unstaged-changes () + (let ((magit-current-diff-range (cons 'index 'working)) + (magit-diff-options (copy-sequence magit-diff-options))) + (magit-git-insert-section (unstaged "Unstaged changes:") + #'magit-wash-raw-diffs + "diff-files"))) + +(defun magit-insert-staged-changes () + (let ((no-commit (not (magit-git-success "log" "-1" "HEAD")))) + (when (or no-commit (magit-anything-staged-p)) + (let ((magit-current-diff-range (cons "HEAD" 'index)) + (base (if no-commit + (magit-git-string "mktree") + "HEAD")) + (magit-diff-options (append '("--cached") magit-diff-options))) + (magit-git-insert-section (staged "Staged changes:") + (apply-partially #'magit-wash-raw-diffs t) + "diff-index" "--cached" base))))) + +(defun magit-insert-unpulled-or-recent-commits () + (let ((tracked (magit-get-tracked-branch nil t))) + (if (and tracked + (not (equal (magit-git-string "rev-parse" "HEAD") + (magit-git-string "rev-parse" tracked)))) + (magit-insert-unpulled-commits) + (magit-git-insert-section (recent "Recent commits:") + (apply-partially 'magit-wash-log 'unique) + "log" "--format=format:%h %s" "-n" "10")))) + +(defun magit-insert-unpulled-commits () + (let ((tracked (magit-get-tracked-branch nil t))) + (when tracked + (magit-git-insert-section (unpulled "Unpulled commits:") + (apply-partially 'magit-wash-log 'unique) + "log" "--format=format:%h %s" (concat "HEAD.." tracked))))) + +(defun magit-insert-unpushed-commits () + (let ((tracked (magit-get-tracked-branch nil t))) + (when tracked + (magit-git-insert-section (unpushed "Unpushed commits:") + (apply-partially 'magit-wash-log 'unique) + "log" "--format=format:%h %s" (concat tracked "..HEAD"))))) + +(defun magit-insert-unpulled-cherries () + (let ((tracked (magit-get-tracked-branch nil t))) + (when tracked + (magit-git-insert-section (unpulled "Unpulled commits:") + (apply-partially 'magit-wash-log 'cherry) + "cherry" "-v" (magit-abbrev-arg) (magit-get-current-branch) tracked)))) + +(defun magit-insert-unpushed-cherries () + (let ((tracked (magit-get-tracked-branch nil t))) + (when tracked + (magit-git-insert-section (unpushed "Unpushed commits:") + (apply-partially 'magit-wash-log 'cherry) + "cherry" "-v" (magit-abbrev-arg) tracked)))) + +;;;; Line Sections + +(defun magit-insert-empty-line () + (insert "\n")) + +(defun magit-insert-status-local-line () + (let ((branch (or (magit-get-current-branch) "(detached)"))) + (magit-insert-line-section (branch branch) + (concat "Local: " + (propertize branch 'face 'magit-branch) + " " (abbreviate-file-name default-directory))))) + +(defun magit-insert-status-remote-line () + (let* ((branch (magit-get-current-branch)) + (tracked (magit-get-tracked-branch branch))) + (when tracked + (magit-insert-line-section (branch tracked) + (concat "Remote: " + (and (magit-get-boolean "branch" branch "rebase") "onto ") + (magit-format-tracked-line tracked branch)))))) + +(defun magit-format-tracked-line (tracked branch) + (when tracked + (setq tracked (propertize tracked 'face 'magit-branch)) + (let ((remote (magit-get "branch" branch "remote"))) + (concat (if (string= "." remote) + (concat "branch " tracked) + (when (string-match (concat "^" remote) tracked) + (setq tracked (substring tracked (1+ (length remote))))) + (concat tracked " @ " remote + " (" (magit-get "remote" remote "url") ")")))))) + +(defun magit-insert-status-head-line () + (let ((hash (magit-git-string "rev-parse" "--verify" "HEAD"))) + (if hash + (magit-insert-line-section (commit hash) + (concat "Head: " (magit-format-rev-summary "HEAD"))) + (magit-insert-line-section (no-commit) + "Head: nothing committed yet")))) + +(defun magit-insert-status-tags-line () + (let* ((current-tag (magit-get-current-tag t)) + (next-tag (magit-get-next-tag t)) + (both-tags (and current-tag next-tag t)) + (tag-subject (eq magit-status-tags-line-subject 'tag))) + (when (or current-tag next-tag) + (magit-insert-line-section (line) + (concat + (if both-tags "Tags: " "Tag: ") + (and current-tag (apply 'magit-format-status-tag-sentence + tag-subject current-tag)) + (and both-tags ", ") + (and next-tag (apply 'magit-format-status-tag-sentence + (not tag-subject) next-tag))))))) + +(defun magit-format-status-tag-sentence (behindp tag cnt &rest ignored) + (concat (propertize tag 'face 'magit-tag) + (and (> cnt 0) + (concat (if (eq magit-status-tags-line-subject 'tag) + (concat " (" (propertize (format "%s" cnt) + 'face 'magit-branch)) + (format " (%i" cnt)) + " " (if behindp "behind" "ahead") ")")))) + +;;;; Progress Sections + +(defun magit-insert-status-merge-line () + (let ((heads (magit-file-lines (magit-git-dir "MERGE_HEAD")))) + (when heads + (magit-insert-line-section (line) + (concat + "Merging: " + (mapconcat 'identity (mapcar 'magit-name-rev heads) ", ") + (and magit-status-show-sequence-help + "; Resolve conflicts, or press \"m A\" to Abort")))))) + +(defun magit-insert-status-rebase-lines () + (let ((rebase (magit-rebase-info))) + (when rebase + (magit-insert-line-section (line) + (concat (if (nth 4 rebase) "Applying" "Rebasing") + (apply 'format ": onto %s (%s of %s)" rebase) + (and magit-status-show-sequence-help + "; Press \"R\" to Abort, Skip, or Continue"))) + (when (and (null (nth 4 rebase)) (nth 3 rebase)) + (magit-insert-line-section (line) + (concat "Stopped: " + (magit-format-rev-summary (nth 3 rebase)))))))) + +(defun magit-insert-rebase-sequence () + (let ((f (magit-git-dir "rebase-merge/git-rebase-todo"))) + (when (file-exists-p f) + (magit-with-section (section rebase-todo 'rebase-todo "Rebasing:" t) + (cl-loop + for line in (magit-file-lines f) + when (string-match + "^\\(pick\\|reword\\|edit\\|squash\\|fixup\\) \\([^ ]+\\) \\(.*\\)$" + line) + do (let ((cmd (match-string 1 line)) + (hash (match-string 2 line)) + (msg (match-string 3 line))) + (magit-with-section (section commit hash) + (insert cmd " ") + (insert (propertize + (magit-git-string "rev-parse" "--short" hash) + 'face 'magit-log-sha1)) + (insert " " msg "\n")))) + (insert "\n"))))) + +(defun magit-insert-bisect-output () + (when (magit-bisecting-p) + (let ((lines + (or (magit-file-lines (magit-git-dir "BISECT_CMD_OUTPUT")) + (list "Bisecting: (no saved bisect output)" + "It appears you have invoked `git bisect' from a shell." + "There is nothing wrong with that, we just cannot display" + "anything useful here. Consult the shell output instead."))) + (done-re "^[a-z0-9]\\{40\\} is the first bad commit$")) + (magit-with-section + (section bisect-output 'bisect-output + (propertize + (or (and (string-match done-re (car lines)) (pop lines)) + (cl-find-if (apply-partially 'string-match done-re) + lines) + (pop lines)) + 'face 'magit-section-title) + t t) + (dolist (line lines) + (insert line "\n")))) + (insert "\n"))) + +(defun magit-insert-bisect-rest () + (when (magit-bisecting-p) + (magit-git-insert-section (bisect-view "Bisect Rest:") + (apply-partially 'magit-wash-log 'bisect-vis) + "bisect" "visualize" "git" "log" + "--pretty=format:%h%d %s" "--decorate=full"))) + +(defun magit-insert-bisect-log () + (when (magit-bisecting-p) + (magit-git-insert-section (bisect-log "Bisect Log:") + #'magit-wash-bisect-log + "bisect" "log"))) + +(defun magit-wash-bisect-log () + (let (beg) + (while (progn (setq beg (point-marker)) + (re-search-forward "^\\(git bisect [^\n]+\n\\)" nil t)) + (let ((heading (match-string-no-properties 1))) + (delete-region (match-beginning 0) (match-end 0)) + (save-restriction + (narrow-to-region beg (point)) + (goto-char (point-min)) + (magit-with-section (section bisect-log 'bisect-log heading nil t) + (magit-wash-sequence + (apply-partially 'magit-wash-log-line 'bisect-log + (magit-abbrev-length))))))) + (when (re-search-forward + "# first bad commit: \\[\\([a-z0-9]\\{40\\}\\)\\] [^\n]+\n" nil t) + (let ((hash (match-string-no-properties 1))) + (delete-region (match-beginning 0) (match-end 0)) + (magit-with-section + (section 'bisect-log 'bisect-log + (concat hash " is the first bad commit\n"))))))) + +(defun magit-bisecting-p () + (file-exists-p (magit-git-dir "BISECT_LOG"))) + +;;; Utilities (2) +;;;; Save Buffers + +(defvar magit-default-directory nil) + +(defun magit-save-some-buffers (&optional msg pred topdir) + "Save some buffers if variable `magit-save-some-buffers' is non-nil. +If variable `magit-save-some-buffers' is set to `dontask' then +don't ask the user before saving the buffers, just go ahead and +do it. + +Optional argument MSG is displayed in the minibuffer if variable +`magit-save-some-buffers' is nil. + +Optional second argument PRED determines which buffers are considered: +If PRED is nil, all the file-visiting buffers are considered. +If PRED is t, then certain non-file buffers will also be considered. +If PRED is a zero-argument function, it indicates for each buffer whether +to consider it or not when called with that buffer current." + (interactive) + (let ((predicate-function (or pred magit-save-some-buffers-predicate)) + (magit-default-directory (or topdir default-directory))) + (if magit-save-some-buffers + (save-some-buffers + (eq magit-save-some-buffers 'dontask) + predicate-function) + (when msg + (message msg))))) + +(defun magit-save-buffers-predicate-all () + "Prompt to save all buffers with unsaved changes." + t) + +(defun magit-save-buffers-predicate-tree-only () + "Only prompt to save buffers which are within the current git project. +As determined by the directory passed to `magit-status'." + (and buffer-file-name + (string= (magit-get-top-dir magit-default-directory) + (magit-get-top-dir (file-name-directory buffer-file-name))))) + +;;; Porcelain +;;;; Apply +;;;;; Apply Commands +;;;;;; Apply + +(defun magit-apply-item () + "Apply the item at point to the current working tree." + (interactive) + (magit-section-action apply (info) + (([* unstaged] [* staged]) + (user-error "Change is already in your working tree")) + (hunk (magit-apply-hunk-item it)) + (diff (magit-apply-diff-item it)) + (stash (magit-stash-apply info)) + (commit (magit-apply-commit info)))) + +;;;;;; Stage + +(defun magit-stage-item (&optional file) + "Add the item at point to the staging area. +With a prefix argument, prompt for a file to be staged instead." + (interactive + (when current-prefix-arg + (list (file-relative-name (read-file-name "File to stage: " nil nil t) + (magit-get-top-dir))))) + (if file + (magit-run-git "add" file) + (magit-section-action stage (info) + ([file untracked] + (magit-run-git + (cond + ((use-region-p) + (cons "add" (magit-section-region-siblings #'magit-section-info))) + ((and (string-match-p "/$" info) + (file-exists-p (expand-file-name ".git" info))) + (let ((repo (read-string + "Add submodule tracking remote repo (empty to abort): " + (let ((default-directory + (file-name-as-directory + (expand-file-name info default-directory)))) + (magit-get "remote.origin.url"))))) + (if (equal repo "") + (user-error "Abort") + (list "submodule" "add" repo (substring info 0 -1))))) + (t + (list "add" info))))) + (untracked + (magit-run-git "add" "--" (magit-git-lines "ls-files" "--other" + "--exclude-standard"))) + ([hunk diff unstaged] + (magit-apply-hunk-item it "--cached")) + ([diff unstaged] + (magit-run-git "add" "-u" + (if (use-region-p) + (magit-section-region-siblings #'magit-section-info) + info))) + (unstaged + (magit-stage-all)) + ([* staged] + (user-error "Already staged")) + (hunk (user-error "Can't stage this hunk")) + (diff (user-error "Can't stage this diff"))))) + +;;;###autoload +(defun magit-stage-all (&optional including-untracked) + "Add all remaining changes in tracked files to staging area. +With a prefix argument, add remaining untracked files as well. +\('git add [-u] .')." + (interactive "P") + (when (or (not magit-stage-all-confirm) + (not (magit-anything-staged-p)) + (yes-or-no-p "Stage all changes? ")) + (if including-untracked + (magit-run-git "add" ".") + (magit-run-git "add" "-u" ".")))) + +;;;;;; Unstage + +(defun magit-unstage-item () + "Remove the item at point from the staging area." + (interactive) + (magit-section-action unstage (info) + ([hunk diff staged] + (magit-apply-hunk-item it "--reverse" "--cached")) + ([diff staged] + (when (eq info 'unmerged) + (user-error "Can't unstage an unmerged file. Resolve it first")) + (let ((files (if (use-region-p) + (magit-section-region-siblings #'magit-section-info) + (list info)))) + (if (magit-no-commit-p) + (magit-run-git "rm" "--cached" "--" files) + (magit-run-git "reset" "-q" "HEAD" "--" files)))) + (staged + (magit-unstage-all)) + ([* unstaged] + (user-error "Already unstaged")) + (hunk (user-error "Can't unstage this hunk")) + (diff (user-error "Can't unstage this diff")))) + +;;;###autoload +(defun magit-unstage-all () + "Remove all changes from staging area. +\('git reset --mixed HEAD')." + (interactive) + (when (or (not magit-unstage-all-confirm) + (and (not (magit-anything-unstaged-p)) + (not (magit-git-lines "ls-files" "--others" "-t" + "--exclude-standard"))) + (yes-or-no-p "Unstage all changes? ")) + (magit-run-git "reset" "HEAD" "--"))) + +;;;;;; Discard + +(defun magit-discard-item () + "Remove the change introduced by the item at point." + (interactive) + (magit-section-action discard (info parent-info) + ([file untracked] + (when (yes-or-no-p (format "Delete %s? " info)) + (if (and (file-directory-p info) + (not (file-symlink-p info))) + (delete-directory info 'recursive) + (delete-file info)) + (magit-refresh))) + (untracked + (when (yes-or-no-p "Delete all untracked files and directories? ") + (magit-run-git "clean" "-df"))) + ([hunk diff unstaged] + (when (yes-or-no-p (if (use-region-p) + "Discard changes in region? " + "Discard hunk? ")) + (magit-apply-hunk-item it "--reverse"))) + ([hunk diff staged] + (if (magit-file-uptodate-p parent-info) + (when (yes-or-no-p (if (use-region-p) + "Discard changes in region? " + "Discard hunk? ")) + (magit-apply-hunk-item it "--reverse" "--index")) + (user-error "Can't discard this hunk. Please unstage it first"))) + ([diff unstaged] + (magit-discard-diff it nil)) + ([diff staged] + (if (magit-file-uptodate-p (magit-section-info it)) + (magit-discard-diff it t) + (user-error "Can't discard staged changes to this file. \ +Please unstage it first"))) + (hunk (user-error "Can't discard this hunk")) + (diff (user-error "Can't discard this diff")) + (stash (when (yes-or-no-p "Discard stash? ") + (magit-stash-drop info))) + (branch (when (yes-or-no-p + (if current-prefix-arg + (concat "Force delete branch [" info "]? ") + (concat "Delete branch [" info "]? "))) + (magit-delete-branch info current-prefix-arg))) + (remote (when (yes-or-no-p "Remove remote? ") + (magit-remove-remote info))))) + +;;;;;; Revert + +(defun magit-revert-item () + "Revert the item at point. +The change introduced by the item is reversed in the current +working tree." + (interactive) + (magit-section-action revert (info) + ([* unstaged] (magit-discard-item)) + (commit (when (or (not magit-revert-item-confirm) + (yes-or-no-p "Revert this commit? ")) + (magit-revert-commit info))) + (diff (when (or (not magit-revert-item-confirm) + (yes-or-no-p "Revert this diff? ")) + (magit-apply-diff-item it "--reverse"))) + (hunk (when (or (not magit-revert-item-confirm) + (yes-or-no-p "Revert this hunk? ")) + (magit-apply-hunk-item it "--reverse"))))) + +(defun magit-revert-commit (commit) + (magit-assert-one-parent commit "revert") + (magit-run-git "revert" "--no-commit" commit)) + +(defconst magit-revert-backup-file "magit/reverted.diff") + +(defun magit-revert-undo () + "Re-apply the previously reverted hunk. +Also see option `magit-revert-backup'." + (interactive) + (let ((file (magit-git-dir magit-revert-backup-file))) + (if (file-readable-p file) + (magit-run-git "apply" file) + (user-error "No backups exist")) + (magit-refresh))) + +;;;;; Apply Core + +(defun magit-discard-diff (diff stagedp) + (let ((file (magit-section-info diff))) + (cl-case (magit-section-diff-status diff) + (deleted + (when (yes-or-no-p (format "Resurrect %s? " file)) + (when stagedp + (magit-run-git "reset" "-q" "--" file)) + (magit-run-git "checkout" "--" file))) + (new + (when (yes-or-no-p (format "Delete %s? " file)) + (magit-run-git "rm" "-f" "--" file))) + (t + (when (yes-or-no-p (format "Discard changes to %s? " file)) + (if stagedp + (magit-run-git "checkout" "HEAD" "--" file) + (magit-run-git "checkout" "--" file))))))) + +(defun magit-apply-commit (commit) + (magit-assert-one-parent commit "cherry-pick") + (magit-run-git "cherry-pick" "--no-commit" commit)) + +(defun magit-apply-diff-item (diff &rest args) + (when (zerop magit-diff-context-lines) + (setq args (cons "--unidiff-zero" args))) + (let ((buf (generate-new-buffer " *magit-input*"))) + (unwind-protect + (progn (magit-insert-diff-item-patch diff buf) + (magit-run-git-with-input + buf "apply" args "--ignore-space-change" "-")) + (kill-buffer buf)))) + +(defun magit-apply-hunk-item (hunk &rest args) + "Apply single hunk or part of a hunk to the index or working file. + +This function is the core of magit's stage, unstage, apply, and +revert operations. HUNK (or the portion of it selected by the +region) will be applied to either the index, if \"--cached\" is a +member of ARGS, or to the working file otherwise." + (when (string-match "^diff --cc" (magit-section-parent-info hunk)) + (user-error (concat "Cannot un-/stage individual resolution hunks. " + "Please stage the whole file."))) + (let ((use-region (use-region-p))) + (when (zerop magit-diff-context-lines) + (setq args (cons "--unidiff-zero" args)) + (when use-region + (user-error (concat "Not enough context to partially apply hunk. " + "Use `+' to increase context.")))) + (let ((buf (generate-new-buffer " *magit-input*"))) + (unwind-protect + (progn (if use-region + (magit-insert-hunk-item-region-patch + hunk (member "--reverse" args) + (region-beginning) (region-end) buf) + (magit-insert-hunk-item-patch hunk buf)) + (magit-revert-backup buf args) + (magit-run-git-with-input + buf "apply" args "--ignore-space-change" "-")) + (kill-buffer buf))))) + +(defun magit-insert-diff-item-patch (diff buf) + (magit-insert-region (magit-section-content-beginning diff) + (magit-section-end diff) + buf)) + +(defun magit-insert-hunk-item-patch (hunk buf) + (magit-diff-item-insert-header (magit-section-parent hunk) buf) + (magit-insert-region (magit-section-beginning hunk) + (magit-section-end hunk) + buf)) + +(defun magit-insert-hunk-item-region-patch (hunk reverse beg end buf) + (magit-diff-item-insert-header (magit-section-parent hunk) buf) + (save-excursion + (goto-char (magit-section-beginning hunk)) + (magit-insert-current-line buf) + (forward-line) + (let ((copy-op (if reverse "+" "-"))) + (while (< (point) (magit-section-end hunk)) + (cond ((and (<= beg (point)) (< (point) end)) + (magit-insert-current-line buf)) + ((looking-at " ") + (magit-insert-current-line buf)) + ((looking-at copy-op) + (let ((text (buffer-substring-no-properties + (+ (point) 1) (line-beginning-position 2)))) + (with-current-buffer buf + (insert " " text))))) + (forward-line)))) + (with-current-buffer buf + (diff-fixup-modifs (point-min) (point-max)))) + +(defun magit-diff-item-insert-header (diff buf) + (magit-insert-region (magit-section-content-beginning diff) + (if (magit-section-children diff) + (magit-section-beginning + (car (magit-section-children diff))) + (magit-section-end diff)) + buf)) + +(defun magit-insert-region (beg end buf) + (let ((text (buffer-substring-no-properties beg end))) + (with-current-buffer buf + (insert text)))) + +(defun magit-insert-current-line (buf) + (let ((text (buffer-substring-no-properties + (line-beginning-position) (line-beginning-position 2)))) + (with-current-buffer buf + (insert text)))) + +(defun magit-revert-backup (buffer args) + (when (and magit-revert-backup (member "--reverse" args)) + (with-current-buffer buffer + (let ((buffer-file-name (magit-git-dir magit-revert-backup-file)) + (make-backup-files t) + (backup-directory-alist nil) + (version-control t) + (kept-old-versions 0) + (kept-new-versions 10)) + (make-directory (file-name-directory buffer-file-name) t) + (save-buffer 16))))) + +;;;; Visit + +(defun magit-visit-item (&optional other-window) + "Visit current item. +With a prefix argument, visit in other window." + (interactive "P") + (magit-section-action visit (info parent-info) + ((diff diffstat [file untracked]) + (magit-visit-file-item info other-window)) + (hunk (magit-visit-file-item parent-info other-window + (magit-hunk-item-target-line it) + (current-column))) + (commit (magit-show-commit info)) + (stash (magit-diff-stash info)) + (branch (magit-checkout info)))) + +(defun magit-visit-file-item (file &optional other-window line column) + (unless file + (user-error "Can't get pathname for this file")) + (unless (file-exists-p file) + (user-error "Can't visit deleted file: %s" file)) + (if (file-directory-p file) + (progn + (setq file (file-name-as-directory (expand-file-name file))) + (if (equal (magit-get-top-dir (file-name-directory file)) + (magit-get-top-dir)) + (magit-dired-jump other-window) + (magit-status file (if other-window + 'pop-to-buffer + 'switch-to-buffer)))) + (if other-window + (find-file-other-window file) + (find-file file)) + (when line + (goto-char (point-min)) + (forward-line (1- line)) + (when (> column 0) + (move-to-column (1- column)))))) + +(defun magit-hunk-item-target-line (hunk) + (save-excursion + (beginning-of-line) + (let ((line (line-number-at-pos))) + (goto-char (magit-section-beginning hunk)) + (unless (looking-at "@@+ .* \\+\\([0-9]+\\)\\(,[0-9]+\\)? @@+") + (user-error "Hunk header not found")) + (let ((target (string-to-number (match-string 1)))) + (forward-line) + (while (< (line-number-at-pos) line) + ;; XXX - deal with combined diffs + (unless (looking-at "-") + (setq target (+ target 1))) + (forward-line)) + target)))) + +;;;###autoload +(defun magit-dired-jump (&optional other-window) + "Visit current item in dired. +With a prefix argument, visit in other window." + (interactive "P") + (require 'dired-x) + (dired-jump other-window + (file-truename + (magit-section-action dired-jump (info parent-info) + ([file untracked] info) + ((diff diffstat) info) + (hunk parent-info) + (t default-directory))))) + +(defvar-local magit-file-log-file nil) +(defvar-local magit-show-current-version nil) + +;;;###autoload +(defun magit-show (rev file &optional switch-function) + "Display and select a buffer containing FILE as stored in REV. + +Insert the contents of FILE as stored in the revision REV into a +buffer. Then select the buffer using `pop-to-buffer' or with a +prefix argument using `switch-to-buffer'. Non-interactivity use +SWITCH-FUNCTION to switch to the buffer, if that is nil simply +return the buffer, without displaying it." + ;; REV may also be one of the symbols `index' or `working' but + ;; that is only intended for use by `magit-ediff'. + (interactive + (let (rev file section) + (magit-section-case (info parent) + (commit (setq file magit-file-log-file rev info)) + (hunk (setq section parent)) + (diff (setq section it))) + (if section + (setq rev (car (magit-diff-range section)) + file (magit-section-info section)) + (unless rev + (setq rev (magit-get-current-branch)))) + (setq rev (magit-read-rev "Retrieve file from revision" rev) + file (cl-case rev + (working (read-file-name "Find file: ")) + (index (magit-read-file-from-rev "HEAD" file)) + (t (magit-read-file-from-rev rev file)))) + (list rev file (if current-prefix-arg + 'switch-to-buffer + 'pop-to-buffer)))) + (let (buffer) + (if (eq rev 'working) + (setq buffer (find-file-noselect file)) + (let ((name (format "%s.%s" file + (if (symbolp rev) + (format "@{%s}" rev) + (replace-regexp-in-string "/" ":" rev))))) + (setq buffer (get-buffer name)) + (when buffer + (with-current-buffer buffer + (if (and (equal file magit-file-name) + (equal rev magit-show-current-version)) + (let ((inhibit-read-only t)) + (erase-buffer)) + (setq buffer nil)))) + (with-current-buffer + (or buffer (setq buffer (create-file-buffer name))) + (setq buffer-read-only t) + (with-silent-modifications + (if (eq rev 'index) + (let ((temp (car (split-string + (magit-git-string "checkout-index" + "--temp" file) + "\t"))) + (inhibit-read-only t)) + (insert-file-contents temp nil nil nil t) + (delete-file temp)) + (magit-git-insert "cat-file" "-p" (concat rev ":" file)))) + (let ((buffer-file-name (expand-file-name file (magit-get-top-dir)))) + (normal-mode t)) + (setq magit-file-name file) + (setq magit-show-current-version rev) + (goto-char (point-min))))) + (when switch-function + (with-current-buffer buffer + (funcall switch-function (current-buffer)))) + buffer)) + +;;;; Act +;;;;; Merging + +;;;###autoload +(defun magit-merge (revision &optional do-commit) + "Merge REVISION into the current 'HEAD', leaving changes uncommitted. +With a prefix argument, skip editing the log message and commit. +\('git merge [--no-commit] REVISION')." + (interactive (list (magit-read-rev "Merge" + (or (magit-guess-branch) + (magit-get-previous-branch))) + current-prefix-arg)) + (when (or (not (magit-anything-modified-p)) + (not magit-merge-warn-dirty-worktree) + (yes-or-no-p + "Running merge in a dirty worktree could cause data loss. Continue?")) + (magit-run-git "merge" revision magit-custom-options + (unless do-commit "--no-commit")) + (when (file-exists-p ".git/MERGE_MSG") + (let ((magit-custom-options nil)) + (magit-commit))))) + +;;;###autoload +(defun magit-merge-abort () + "Abort the current merge operation." + (interactive) + (if (file-exists-p (magit-git-dir "MERGE_HEAD")) + (when (yes-or-no-p "Abort merge? ") + (magit-run-git-async "merge" "--abort")) + (user-error "No merge in progress"))) + +;;;;; Branching + +(defun magit-escape-branch-name (branch) + "Escape branch name BRANCH to remove problematic characters." + (replace-regexp-in-string "[/]" "-" branch)) + +(defun magit-default-tracking-name-remote-plus-branch (remote branch) + "Use the remote name plus a hyphen plus the escaped branch name for tracking branches." + (concat remote "-" (magit-escape-branch-name branch))) + +(defun magit-default-tracking-name-branch-only (remote branch) + "Use just the escaped branch name for tracking branches." + (magit-escape-branch-name branch)) + +(defun magit-get-tracking-name (remote branch) + "Given a REMOTE and a BRANCH name, ask the user for a local +tracking brach name suggesting a sensible default." + (when (yes-or-no-p + (format "Create local tracking branch for %s? " branch)) + (let* ((default-name + (funcall magit-default-tracking-name-function remote branch)) + (chosen-name + (read-string (format "Call local branch (%s): " default-name) + nil nil default-name))) + (when (magit-ref-exists-p (concat "refs/heads/" chosen-name)) + (user-error "'%s' already exists" chosen-name)) + chosen-name))) + +(defun magit-maybe-create-local-tracking-branch (rev) + "Depending on the users wishes, create a tracking branch for +REV... maybe." + (when (string-match "^\\(?:refs/\\)?remotes/\\([^/]+\\)/\\(.+\\)" rev) + (let* ((remote (match-string 1 rev)) + (branch (match-string 2 rev)) + (tracker-name (magit-get-tracking-name remote branch))) + (when tracker-name + (magit-run-git "checkout" "-b" tracker-name rev) + t)))) + +;;;###autoload +(defun magit-checkout (revision) + "Switch 'HEAD' to REVISION and update working tree. +Fails if working tree or staging area contain uncommitted changes. +If REVISION is a remote branch, offer to create a local tracking branch. +\('git checkout [-b] REVISION')." + (interactive + (list (let ((current-branch (magit-get-current-branch)) + (default (or (magit-guess-branch) + (magit-get-previous-branch)))) + (magit-read-rev (format "Switch from '%s' to" current-branch) + (unless (string= current-branch default) + default) + current-branch)))) + (or (magit-maybe-create-local-tracking-branch revision) + (progn + (magit-save-some-buffers) + (magit-run-git "checkout" revision)))) + +;;;###autoload +(defun magit-create-branch (branch parent) + "Switch 'HEAD' to new BRANCH at revision PARENT and update working tree. +Fails if working tree or staging area contain uncommitted changes. +\('git checkout -b BRANCH REVISION')." + (interactive + (list (read-string "Create branch: ") + (magit-read-rev "Parent" (or (magit-guess-branch) + (magit-get-current-branch))))) + (cond ((run-hook-with-args-until-success + 'magit-create-branch-hook branch parent)) + ((and branch (not (string= branch ""))) + (magit-save-some-buffers) + (magit-run-git "checkout" magit-custom-options + "-b" branch parent)))) + +;;;###autoload +(defun magit-delete-branch (branch &optional force) + "Delete the BRANCH. +If the branch is the current one, offers to switch to `master' first. +With prefix, forces the removal even if it hasn't been merged. +Works with local or remote branches. +\('git branch [-d|-D] BRANCH' or 'git push :refs/heads/BRANCH')." + (interactive (list (magit-read-rev "Branch to delete" + (or (magit-guess-branch) + (magit-get-previous-branch))) + current-prefix-arg)) + (if (string-match "^\\(?:refs/\\)?remotes/\\([^/]+\\)/\\(.+\\)" branch) + (magit-run-git-async "push" + (match-string 1 branch) + (concat ":" (match-string 2 branch))) + (let* ((current (magit-get-current-branch)) + (is-current (string= branch current)) + (is-master (string= branch "master")) + (args (list "branch" + (if force "-D" "-d") + branch))) + (cond + ((and is-current is-master) + (message "Cannot delete master branch while it's checked out.")) + (is-current + (if (y-or-n-p "Cannot delete current branch. Switch to master first? ") + (progn + (magit-checkout "master") + (magit-run-git args)) + (message "The current branch was not deleted."))) + (t + (magit-run-git args)))))) + +;;;###autoload +(defun magit-rename-branch (old new &optional force) + "Rename branch OLD to NEW. +With prefix, forces the rename even if NEW already exists. +\('git branch [-m|-M] OLD NEW')." + (interactive + (let* ((old (magit-read-rev-with-default "Old name")) + (new (read-string "New name: " old))) + (list old new current-prefix-arg))) + (if (or (null new) (string= new "") + (string= old new)) + (message "Cannot rename branch \"%s\" to \"%s\"." old new) + (magit-run-git "branch" (if force "-M" "-m") old new))) + +(defun magit-guess-branch () + "Return a branch name depending on the context of cursor. +If no branch is found near the cursor return nil." + (magit-section-case (info parent-info) + (branch info) + ([commit wazzup] parent-info) + ([commit ] (magit-name-rev info)) + ([ wazzup] info))) + +;;;;; Remoting + +;;;###autoload +(defun magit-add-remote (remote url) + "Add the REMOTE and fetch it. +\('git remote add REMOTE URL')." + (interactive (list (read-string "Remote name: ") + (read-string "Remote url: "))) + (magit-run-git-async "remote" "add" "-f" remote url)) + +;;;###autoload +(defun magit-remove-remote (remote) + "Delete the REMOTE. +\('git remote rm REMOTE')." + (interactive (list (magit-read-remote "Delete remote"))) + (magit-run-git "remote" "rm" remote)) + +;;;###autoload +(defun magit-rename-remote (old new) + "Rename remote OLD to NEW. +\('git remote rename OLD NEW')." + (interactive + (let* ((old (magit-read-remote "Old name")) + (new (read-string "New name: " old))) + (list old new))) + (if (or (null old) (string= old "") + (null new) (string= new "") + (string= old new)) + (message "Cannot rename remote \"%s\" to \"%s\"." old new) + (magit-run-git "remote" "rename" old new))) + +(defun magit-guess-remote () + (magit-section-case (info parent-info) + (remote info) + (branch parent-info) + (t (if (string= info ".") info (magit-get-current-remote))))) + +;;;;; Rebase + +(defun magit-rebase-info () + "Return a list indicating the state of an in-progress rebase. + +The returned list has the form (ONTO DONE TOTAL STOPPED AM). +ONTO is the commit being rebased onto. +DONE and TOTAL are integers with obvious meanings. +STOPPED is the SHA-1 of the commit at which rebase stopped. +AM is non-nil if the current rebase is actually a git-am. + +Return nil if there is no rebase in progress." + (let ((m (magit-git-dir "rebase-merge")) + (a (magit-git-dir "rebase-apply"))) + (cond + ((file-directory-p m) ; interactive + (list + (magit-name-rev (magit-file-line (expand-file-name "onto" m))) + (length (magit-file-lines (expand-file-name "done" m))) + (cl-loop for line in (magit-file-lines + (expand-file-name "git-rebase-todo.backup" m)) + count (string-match "^[^#\n]" line)) + (magit-file-line (expand-file-name "stopped-sha" m)) + nil)) + + ((file-regular-p (expand-file-name "onto" a)) ; non-interactive + (list + (magit-name-rev (magit-file-line (expand-file-name "onto" a))) + (1- (string-to-number (magit-file-line (expand-file-name "next" a)))) + (string-to-number (magit-file-line (expand-file-name "last" a))) + (let ((patch-header (magit-file-line + (car (directory-files a t "^[0-9]\\{4\\}$"))))) + (when (string-match "^From \\([a-z0-9]\\{40\\}\\) " patch-header) + (match-string 1 patch-header))) + nil)) + + ((file-regular-p (expand-file-name "applying" a)) ; am + (list + (magit-name-rev "HEAD") + (1- (string-to-number (magit-file-line (expand-file-name "next" a)))) + (string-to-number (magit-file-line (expand-file-name "last" a))) + (let ((patch-header (magit-file-line + (car (directory-files a t "^[0-9]\\{4\\}$"))))) + (when (string-match "^From \\([a-z0-9]\\{40\\}\\) " patch-header) + (match-string 1 patch-header))) + t))))) + +(defun magit-rebase-step () + "Initiate or continue a rebase." + (interactive) + (let ((rebase (magit-rebase-info))) + (if rebase + (let ((cursor-in-echo-area t) + (message-log-max nil) + (am (nth 4 rebase))) + (message "%s in progress. [A]bort, [S]kip, or [C]ontinue? " + (if am "Apply mailbox" "Rebase")) + (cl-case (read-event) + ((?A ?a) (magit-run-git-async (if am "am" "rebase") "--abort")) + ((?S ?s) (magit-run-git-async (if am "am" "rebase") "--skip")) + ((?C ?c) (magit-with-emacsclient magit-server-window-for-commit + (magit-run-git-async (if am "am" "rebase") "--continue"))))) + (let* ((branch (magit-get-current-branch)) + (rev (magit-read-rev + "Rebase to" + (magit-get-tracked-branch branch) + branch))) + (magit-run-git "rebase" rev))))) + +;;;###autoload +(defun magit-interactive-rebase (commit) + "Start a git rebase -i session, old school-style." + (interactive (let ((commit (magit-section-case (info) (commit info)))) + (list (if commit + (concat commit "^") + (magit-read-rev "Interactively rebase to" + (magit-guess-branch)))))) + (magit-assert-emacsclient "rebase interactively") + (magit-with-emacsclient magit-server-window-for-rebase + (magit-run-git-async "rebase" "-i" commit))) + +;;;;; AM + +(defun magit-apply-mailbox (&optional file-or-dir) + "Apply a series of patches from a mailbox." + (interactive "fmbox or Maildir file or directory: ") + (magit-with-emacsclient magit-server-window-for-rebase + (magit-run-git-async "am" file-or-dir))) + +;;;;; Reset + +;;;###autoload +(defun magit-reset-head (revision &optional hard) + "Switch 'HEAD' to REVISION, keeping prior working tree and staging area. +Any differences from REVISION become new changes to be committed. +With prefix argument, all uncommitted changes in working tree +and staging area are lost. +\('git reset [--soft|--hard] REVISION')." + (interactive (list (magit-read-rev (format "%s head to" + (if current-prefix-arg + "Hard reset" + "Reset")) + (or (magit-guess-branch) "HEAD")) + current-prefix-arg)) + (magit-run-git "reset" (if hard "--hard" "--soft") revision "--")) + +;;;###autoload +(defun magit-reset-head-hard (revision) + "Switch 'HEAD' to REVISION, losing all changes. +Uncomitted changes in both working tree and staging area are lost. +\('git reset --hard REVISION')." + (interactive (list (magit-read-rev (format "Hard reset head to") + (or (magit-guess-branch) "HEAD")))) + (magit-reset-head revision t)) + +;;;###autoload +(defun magit-reset-working-tree (&optional arg) + "Revert working tree and clear changes from staging area. +\('git reset --hard HEAD'). + +With a prefix arg, also remove untracked files. +With two prefix args, remove ignored files as well." + (interactive "p") + (let ((include-untracked (>= arg 4)) + (include-ignored (>= arg 16))) + (when (yes-or-no-p (format "Discard all uncommitted changes%s%s? " + (if include-untracked + ", untracked files" + "") + (if include-ignored + ", ignored files" + ""))) + (magit-reset-head-hard "HEAD") + (when include-untracked + (magit-run-git "clean" "-fd" (if include-ignored "-x" "")))))) + +;;;;; Rewriting + +(defun magit-read-rewrite-info () + (when (file-exists-p (magit-git-dir "magit-rewrite-info")) + (with-temp-buffer + (insert-file-contents (magit-git-dir "magit-rewrite-info")) + (goto-char (point-min)) + (read (current-buffer))))) + +(defun magit-write-rewrite-info (info) + (with-temp-file (magit-git-dir "magit-rewrite-info") + (prin1 info (current-buffer)) + (princ "\n" (current-buffer)))) + +(defun magit-rewrite-set-commit-property (commit prop value) + (let* ((info (magit-read-rewrite-info)) + (pending (cdr (assq 'pending info))) + (p (assoc commit pending))) + (when p + (setf (cdr p) (plist-put (cdr p) prop value)) + (magit-write-rewrite-info info) + (magit-refresh)) + t)) + +(add-hook 'magit-apply-hook 'magit-rewrite-apply) +(put 'magit-rewrite-apply 'magit-section-action-context [commit pending]) +(defun magit-rewrite-apply (commit) + (magit-apply-commit commit) + (magit-rewrite-set-commit-property commit 'used t)) + +(add-hook 'magit-cherry-pick-hook 'magit-rewrite-pick) +(put 'magit-rewrite-pick 'magit-section-action-context [commit pending]) +(defun magit-rewrite-pick (commit) + (magit-cherry-pick-commit commit) + (magit-rewrite-set-commit-property commit 'used t)) + +(add-hook 'magit-revert-hook 'magit-rewrite-revert) +(put 'magit-rewrite-revert 'magit-section-action-context [commit pending]) +(defun magit-rewrite-revert (commit) + (when (or (not magit-revert-item-confirm) + (yes-or-no-p "Revert this commit? ")) + (magit-revert-commit commit) + (magit-rewrite-set-commit-property commit 'used nil))) + +(defun magit-rewrite-set-used () + (interactive) + (magit-section-case (info) + ([commit pending] + (magit-rewrite-set-commit-property info 'used t) + (magit-refresh)))) + +(defun magit-rewrite-set-unused () + (interactive) + (magit-section-case (info) + ([commit pending] + (magit-rewrite-set-commit-property info 'used nil) + (magit-refresh)))) + +(defun magit-rewrite-start (from &optional onto) + (interactive (list (magit-read-rev-with-default "Rewrite from"))) + (when (magit-anything-modified-p) + (user-error "You have uncommitted changes")) + (or (not (magit-read-rewrite-info)) + (user-error "Rewrite in progress")) + (let* ((orig (magit-rev-parse "HEAD")) + (base (if (or (eq magit-rewrite-inclusive t) + (and (eq magit-rewrite-inclusive 'ask) + (y-or-n-p "Include selected revision in rewrite? "))) + (or (car (magit-commit-parents from)) + (user-error "Can't rewrite a parentless commit")) + from)) + (pending (magit-git-lines "rev-list" (concat base "..")))) + (magit-write-rewrite-info `((orig ,orig) + (pending ,@(mapcar #'list pending)))) + (magit-run-git "reset" "--hard" base "--"))) + +(defun magit-rewrite-stop (&optional noconfirm) + (interactive) + (let* ((info (magit-read-rewrite-info))) + (or info + (user-error "No rewrite in progress")) + (when (or noconfirm + (yes-or-no-p "Stop rewrite? ")) + (magit-write-rewrite-info nil) + (magit-refresh)))) + +(defun magit-rewrite-abort () + (interactive) + (let* ((info (magit-read-rewrite-info)) + (orig (cadr (assq 'orig info)))) + (or info + (user-error "No rewrite in progress")) + (when (magit-anything-modified-p) + (user-error "You have uncommitted changes")) + (when (yes-or-no-p "Abort rewrite? ") + (magit-write-rewrite-info nil) + (magit-run-git "reset" "--hard" orig "--")))) + +(defun magit-rewrite-finish () + (interactive) + (magit-rewrite-finish-step) + (magit-refresh)) + +(defun magit-rewrite-finish-step () + (let ((info (magit-read-rewrite-info))) + (or info + (user-error "No rewrite in progress")) + (let* ((pending (cdr (assq 'pending info))) + (first-unused + (let ((rpend (reverse pending))) + (while (and rpend (plist-get (cdr (car rpend)) 'used)) + (setq rpend (cdr rpend))) + (car rpend))) + (commit (car first-unused))) + (cond ((not first-unused) + (magit-rewrite-stop t)) + ((magit-git-success "cherry-pick" commit) + (magit-rewrite-set-commit-property commit 'used t) + (magit-rewrite-finish-step)) + (t + (magit-refresh) + (error "Could not apply %s" commit)))))) + +(defun magit-rewrite-diff-pending () + (interactive) + (let* ((info (magit-read-rewrite-info)) + (orig (cadr (assq 'orig info)))) + (if orig + (magit-diff orig nil "-R") + (user-error "No rewrite in progress")))) + +(defun magit-rewrite-diff-pending-transition () + (interactive) + (message "Please remove magit-insert-pending-changes from your magit-status-sections-hook, or move to magit-rewrite-diff-pending")) + +(define-obsolete-function-alias + 'magit-insert-pending-changes 'magit-rewrite-diff-pending-transition + "382351845e" + "https://github.com/magit/magit/commit/382351845eca2425713f640f9bb55756c9ddf723") + +;;;;; Fetching + +;;;###autoload +(defun magit-fetch (remote) + "Fetch from REMOTE." + (interactive (list (magit-read-remote "Fetch remote"))) + (magit-run-git-async "fetch" remote magit-custom-options)) + +;;;###autoload +(defun magit-fetch-current () + "Run fetch for default remote. + +If there is no default remote, ask for one." + (interactive) + (magit-fetch (or (magit-get-current-remote) + (magit-read-remote "Fetch remote")))) + +;;;###autoload +(defun magit-remote-update () + "Update all remotes." + (interactive) + (or (run-hook-with-args-until-success 'magit-remote-update-hook) + (magit-run-git-async "remote" "update" magit-custom-options))) + +;;;;; Pulling + +;;;###autoload +(defun magit-pull () + "Run git pull. + +If there is no default remote, the user is prompted for one and +its values is saved with git config. If there is no default +merge branch, the user is prompted for one and its values is +saved with git config. With a prefix argument, the default +remote is not used and the user is prompted for a remote. With +two prefix arguments, the default merge branch is not used and +the user is prompted for a merge branch. Values entered by the +user because of prefix arguments are not saved with git config." + (interactive) + (or (run-hook-with-args-until-success 'magit-pull-hook) + (let* ((branch (magit-get-current-branch)) + (branch-remote (magit-get-remote branch)) + (branch-merge (magit-get "branch" branch "merge")) + (branch-merge-name (and branch-merge + (save-match-data + (string-match "^refs/heads/\\(.+\\)" branch-merge) + (match-string 1 branch-merge)))) + (choose-remote (>= (prefix-numeric-value current-prefix-arg) 4)) + (choose-branch (>= (prefix-numeric-value current-prefix-arg) 16)) + (remote-needed (or choose-remote + (not branch-remote))) + (branch-needed (or choose-branch + (not branch-merge-name))) + (chosen-branch-remote + (if remote-needed + (magit-read-remote "Pull from remote" branch-remote) + branch-remote)) + (chosen-branch-merge-name + (if branch-needed + (magit-read-remote-branch (format "Pull branch from remote %s" + chosen-branch-remote) + chosen-branch-remote) + branch-merge-name))) + (when (and (not branch-remote) + (not choose-remote)) + (magit-set chosen-branch-remote "branch" branch "remote")) + (when (and (not branch-merge-name) + (not choose-branch)) + (magit-set (format "%s" chosen-branch-merge-name) + "branch" branch "merge")) + (magit-run-git-async + "pull" magit-custom-options + (and choose-remote chosen-branch-remote) + (and (or choose-remote choose-branch) + (list (format "refs/heads/%s:refs/remotes/%s/%s" + chosen-branch-merge-name + chosen-branch-remote + chosen-branch-merge-name))))))) + +;;;;; Pushing + +;;;###autoload +(defun magit-push-tags () + "Push tags to a remote repository. + +Push tags to the current branch's remote. If that isn't set push +to \"origin\" or if that remote doesn't exit but only a single +remote is defined use that. Otherwise or with a prefix argument +ask the user what remote to use." + (interactive) + (let* ((branch (magit-get-current-branch)) + (remotes (magit-git-lines "remote")) + (remote (or (and branch (magit-get-remote branch)) + (car (member "origin" remotes)) + (and (= (length remotes) 1) + (car remotes))))) + (when (or current-prefix-arg (not remote)) + (setq remote (magit-read-remote "Push to remote"))) + (magit-run-git-async "push" remote "--tags" magit-custom-options))) + +;;;###autoload +(defun magit-push () + "Push the current branch to a remote repository. + +This command runs the `magit-push-remote' hook. By default that +means running `magit-push-dwim'. So unless you have customized +the hook this command behaves like this: + +With a single prefix argument ask the user what branch to push +to. With two or more prefix arguments also ask the user what +remote to push to. Otherwise use the remote and branch as +configured using the Git variables `branch..remote' and +`branch..merge'. If the former is undefined ask the user. +If the latter is undefined push without specifing the remote +branch explicitly. + +Also see option `magit-set-upstream-on-push'." + (interactive) + (run-hook-with-args-until-success 'magit-push-hook current-prefix-arg)) + +(defun magit-push-dwim (arg) + "Push the current branch to a remote repository. + +With a single prefix argument ask the user what remote to push +to. With two or more prefix arguments also ask the user the +name of the remote branch to push to. + +Otherwise use the remote and branch as configured using the +Git variables `branch..remote' and `branch..merge'. +If the former is undefined ask the user. If the latter is +undefined push without specifing the remote branch explicitly. + +Also see option `magit-set-upstream-on-push'." + (interactive "P") + (let* ((branch (or (magit-get-current-branch) + (user-error "Don't push a detached head. That's gross"))) + (auto-remote (magit-get-remote branch)) + (used-remote (if (or arg (not auto-remote)) + (magit-read-remote + (format "Push %s to remote" branch) auto-remote) + auto-remote)) + (auto-branch (and (equal used-remote auto-remote) + (magit-get "branch" branch "merge"))) + (used-branch (if (>= (prefix-numeric-value arg) 16) + (magit-read-remote-branch + (format "Push %s as branch" branch) + used-remote auto-branch) + auto-branch))) + (cond ;; Pushing to what's already configured. + ((and auto-branch + (equal auto-branch used-branch) + (equal auto-remote used-remote))) + ;; Setting upstream because of magit-custom-options. + ((member "-u" magit-custom-options)) + ;; Two prefix arguments; ignore magit-set-upstream-on-push. + ((>= (prefix-numeric-value arg) 16) + (and (yes-or-no-p "Set upstream while pushing? ") + (setq magit-custom-options + (cons "-u" magit-custom-options)))) + ;; Else honor magit-set-upstream-on-push. + ((eq magit-set-upstream-on-push 'refuse) + (user-error "Not pushing since no upstream has been set.")) + ((or (eq magit-set-upstream-on-push 'dontask) + (and (eq magit-set-upstream-on-push t) + (yes-or-no-p "Set upstream while pushing? "))) + (setq magit-custom-options (cons "-u" magit-custom-options)))) + (magit-run-git-async + "push" "-v" used-remote + (if used-branch (format "%s:%s" branch used-branch) branch) + magit-custom-options))) + +;;;;; Committing + +;;;###autoload +(defun magit-commit (&optional amendp) + "Create a new commit on HEAD. +With a prefix argument amend to the commit at HEAD instead. +\('git commit [--amend]')." + (interactive "P") + (let ((args magit-custom-options)) + (when amendp + (setq args (cons "--amend" args))) + (when (setq args (magit-commit-assert args)) + (magit-commit-maybe-expand) + (magit-commit-internal "commit" args)))) + +;;;###autoload +(defun magit-commit-amend () + "Amend the last commit. +\('git commit --amend')." + (interactive) + (magit-commit-maybe-expand) + (magit-commit-internal "commit" (cons "--amend" magit-custom-options))) + +;;;###autoload +(defun magit-commit-extend (&optional override-date) + "Amend the last commit, without editing the message. +With a prefix argument do change the committer date, otherwise +don't. The option `magit-commit-extend-override-date' can be +used to inverse the meaning of the prefix argument. +\('git commit --no-edit --amend [--keep-date]')." + (interactive (list (if current-prefix-arg + (not magit-commit-reword-override-date) + magit-commit-reword-override-date))) + (magit-commit-maybe-expand) + (let ((process-environment process-environment)) + (unless override-date + (setenv "GIT_COMMITTER_DATE" + (magit-git-string "log" "-1" "--format:format=%cd"))) + (magit-commit-internal "commit" (nconc (list "--no-edit" "--amend") + magit-custom-options)))) + +;;;###autoload +(defun magit-commit-reword (&optional override-date) + "Reword the last commit, ignoring staged changes. + +With a prefix argument do change the committer date, otherwise +don't. The option `magit-commit-rewrite-override-date' can be +used to inverse the meaning of the prefix argument. + +Non-interactively respect the optional OVERRIDE-DATE argument +and ignore the option. + +\('git commit --only --amend')." + (interactive (list (if current-prefix-arg + (not magit-commit-reword-override-date) + magit-commit-reword-override-date))) + (let ((process-environment process-environment)) + (unless override-date + (setenv "GIT_COMMITTER_DATE" + (magit-git-string "log" "-1" "--format:format=%cd"))) + (magit-commit-internal "commit" (nconc (list "--only" "--amend") + magit-custom-options)))) + +(defvar-local magit-commit-squash-args nil) +(defvar-local magit-commit-squash-fixup nil) + +(defvar magit-commit-unmark-after-squash t) + +;;;###autoload +(defun magit-commit-fixup (&optional commit) + "Create a fixup commit. +With a prefix argument the user is always queried for the commit +to be fixed. Otherwise the current or marked commit may be used +depending on the value of option `magit-commit-squash-commit'. +\('git commit [--no-edit] --fixup=COMMIT')." + (interactive (list (magit-commit-squash-commit))) + (magit-commit-squash commit t)) + +;;;###autoload +(defun magit-commit-squash (&optional commit fixup) + "Create a squash commit. +With a prefix argument the user is always queried for the commit +to be fixed. Otherwise the current or marked commit may be used +depending on the value of option `magit-commit-squash-commit'. +\('git commit [--no-edit] --fixup=COMMIT')." + (interactive (list (magit-commit-squash-commit))) + (let ((args magit-custom-options)) + (cond + ((not commit) + (magit-commit-assert args) + (magit-log) + (setq magit-commit-squash-args args + magit-commit-squash-fixup fixup) + (add-hook 'magit-mark-commit-hook 'magit-commit-squash-marked t t) + (add-hook 'magit-mode-quit-window-hook 'magit-commit-squash-abort t t) + (message "Select commit using \".\", or abort using \"q\"")) + ((setq args (magit-commit-assert args)) + (when (eq args t) (setq args nil)) + (magit-commit-internal + "commit" + (nconc (list "--no-edit" + (concat (if fixup "--fixup=" "--squash=") commit)) + args)))))) + +(defun magit-commit-squash-commit () + (unless (or current-prefix-arg + (eq magit-commit-squash-commit nil)) + (let ((current (magit-section-case (info) (commit info)))) + (cl-ecase magit-commit-squash-commit + (current-or-marked (or current magit-marked-commit)) + (marked-or-current (or magit-marked-commit current)) + (current current) + (marked magit-marked-commit))))) + +(defun magit-commit-squash-marked () + (when magit-marked-commit + (magit-commit-squash magit-marked-commit magit-commit-squash-fixup)) + (when magit-commit-unmark-after-squash + (setq magit-marked-commit nil)) + (kill-local-variable 'magit-commit-squash-fixup) + (remove-hook 'magit-mark-commit-hook 'magit-commit-squash-marked t) + (remove-hook 'magit-mode-quit-window-hook 'magit-commit-squash-abort t) + (magit-mode-quit-window)) + +(defun magit-commit-squash-abort (buffer) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (remove-hook 'magit-mark-commit-hook 'magit-commit-squash-marked t) + (remove-hook 'magit-mode-quit-window-hook 'magit-commit-squash-abort t)))) + +(defun magit-commit-assert (args) + (cond + ((or (magit-anything-staged-p) + (member "--allow-empty" args) + (member "--all" args) + (member "--amend" args)) + (or args (list "--"))) + ((and (magit-rebase-info) + (y-or-n-p "Nothing staged. Continue in-progress rebase? ")) + (magit-run-git-async "rebase" "--continue") + nil) + (magit-commit-ask-to-stage + (magit-commit-maybe-expand t) + (when (y-or-n-p "Nothing staged. Stage and commit everything? ") + (magit-run-git "add" "-u" ".") + (or args (list "--")))) + (t + (user-error "Nothing staged. Set --allow-empty, --all, or --amend in popup")))) + +(defun magit-commit-maybe-expand (&optional unstaged) + (when (and magit-expand-staged-on-commit + (derived-mode-p 'magit-status-mode)) + (if unstaged + (magit-jump-to-unstaged t) + (magit-jump-to-staged t)))) + +(defun magit-commit-internal (subcmd args) + (setq git-commit-previous-winconf (current-window-configuration)) + (if (magit-use-emacsclient-p) + (magit-with-emacsclient magit-server-window-for-commit + (magit-run-git-async subcmd args)) + (let ((topdir (magit-get-top-dir)) + (editmsg (magit-git-dir (if (equal subcmd "tag") + "TAG_EDITMSG" + "COMMIT_EDITMSG")))) + (when (and (member "--amend" args) + (not (file-exists-p editmsg))) + (with-temp-file editmsg + (magit-git-insert "log" "-1" "--format=format:%B" "HEAD"))) + (with-current-buffer (find-file-noselect editmsg) + (funcall (if (functionp magit-server-window-for-commit) + magit-server-window-for-commit + 'switch-to-buffer) + (current-buffer)) + (add-hook 'git-commit-commit-hook + (apply-partially + (lambda (default-directory editmsg args) + (magit-run-git args) + (ignore-errors (delete-file editmsg))) + topdir editmsg + `(,subcmd + ,"--cleanup=strip" + ,(concat "--file=" (file-relative-name + (buffer-file-name) + topdir)) + ,@args)) + nil t))))) + +(defun magit-commit-add-log () + "Add a template for the current hunk to the commit message buffer." + (interactive) + (let* ((section (magit-current-section)) + (fun (if (eq (magit-section-type section) 'hunk) + (save-window-excursion + (save-excursion + (magit-visit-item) + (add-log-current-defun))) + nil)) + (file (magit-section-info + (cl-case (magit-section-type section) + (hunk (magit-section-parent section)) + (diff section) + (t (user-error "No change at point"))))) + (locate-buffer (lambda () + (cl-find-if + (lambda (buf) + (with-current-buffer buf + (derived-mode-p 'git-commit-mode))) + (append (buffer-list (selected-frame)) + (buffer-list))))) + (buffer (funcall locate-buffer))) + (unless buffer + (unless (magit-commit-assert nil) + (user-error "Abort")) + (magit-commit) + (while (not (setq buffer (funcall locate-buffer))) + (sit-for 0.01))) + (pop-to-buffer buffer) + (goto-char (point-min)) + (cond ((not (re-search-forward (format "^\\* %s" (regexp-quote file)) + nil t)) + ;; No entry for file, create it. + (goto-char (point-max)) + (forward-comment -1000) + (unless (or (bobp) (looking-back "\\(\\*[^\n]+\\|\n\\)")) + (insert "\n")) + (insert (format "\n* %s" file)) + (when fun + (insert (format " (%s)" fun))) + (insert ": ")) + (fun + ;; found entry for file, look for fun + (let ((limit (save-excursion + (or (and (re-search-forward "^\\* " nil t) + (match-beginning 0)) + (progn (goto-char (point-max)) + (forward-comment -1000) + (point)))))) + (cond ((re-search-forward + (format "(.*\\_<%s\\_>.*):" (regexp-quote fun)) + limit t) + ;; found it, goto end of current entry + (if (re-search-forward "^(" limit t) + (backward-char 2) + (goto-char limit))) + (t + ;; not found, insert new entry + (goto-char limit) + (if (bolp) + (open-line 1) + (newline)) + (insert (format "(%s): " fun)))))) + (t + ;; found entry for file, look for beginning it + (when (looking-at ":") + (forward-char 2)))))) + +;;;;; Tagging + +;;;###autoload +(defun magit-tag (name rev &optional annotate) + "Create a new tag with the given NAME at REV. +With a prefix argument annotate the tag. +\('git tag [--annotate] NAME REV')." + (interactive (list (magit-read-tag "Tag name") + (magit-read-rev "Place tag on" + (or (magit-guess-branch) "HEAD")) + current-prefix-arg)) + (let ((args (append magit-custom-options (list name rev)))) + (if (or (member "--sign" args) + (member "--annotate" args) + (and annotate (setq args (cons "--annotate" args)))) + (magit-commit-internal "tag" args) + (magit-run-git "tag" args)))) + +;;;###autoload +(defun magit-delete-tag (name) + "Delete the tag with the given NAME. +\('git tag -d NAME')." + (interactive (list (magit-read-tag "Delete Tag" t))) + (magit-run-git "tag" "-d" magit-custom-options name)) + +;;;;; Stashing + +(defvar magit-read-stash-history nil + "The history of inputs to `magit-stash'.") + +;;;###autoload +(defun magit-stash (description) + "Create new stash of working tree and staging area named DESCRIPTION. +Working tree and staging area revert to the current 'HEAD'. +With prefix argument, changes in staging area are kept. +\('git stash save [--keep-index] DESCRIPTION')" + (interactive (list (read-string "Stash description: " nil + 'magit-read-stash-history))) + (magit-run-git "stash" "save" magit-custom-options "--" description)) + +;;;###autoload +(defun magit-stash-snapshot () + "Create new stash of working tree and staging area; keep changes in place. +\('git stash save \"Snapshot...\"; git stash apply stash@{0}')" + (interactive) + (magit-call-git "stash" "save" magit-custom-options + (format-time-string + "Snapshot taken at %Y-%m-%d %H:%M:%S" + (current-time))) + (magit-run-git "stash" "apply" "stash@{0}")) + +(defun magit-stash-apply (stash) + "Apply a stash on top of the current working tree state. +\('git stash apply stash@{N}')" + (interactive (list (magit-read-stash "Apply stash (number): "))) + (magit-run-git "stash" "apply" stash)) + +(defun magit-stash-pop (stash) + "Apply a stash on top of working tree state and remove from stash list. +\('git stash pop stash@{N}')" + (interactive (list (magit-read-stash "Pop stash (number): "))) + (magit-run-git "stash" "pop" stash)) + +(defun magit-stash-drop (stash) + "Remove a stash from the stash list. +\('git stash drop stash@{N}')" + (interactive (list (magit-read-stash "Drop stash (number): "))) + (magit-run-git "stash" "drop" stash)) + +;;;;; Cherry-Pick + +(defun magit-cherry-pick-item () + "Cherry-pick them item at point." + (interactive) + (magit-section-action cherry-pick (info) + (commit (magit-cherry-pick-commit info)) + (stash (magit-stash-pop info)))) + +(defun magit-cherry-pick-commit (commit) + (magit-assert-one-parent commit "cherry-pick") + (magit-run-git "cherry-pick" commit)) + +;;;;; Submoduling + +;;;###autoload +(defun magit-submodule-update (&optional init) + "Update the submodule of the current git repository. +With a prefix arg, do a submodule update --init." + (interactive "P") + (let ((default-directory (magit-get-top-dir))) + (magit-run-git-async "submodule" "update" (and init "--init")))) + +;;;###autoload +(defun magit-submodule-update-init () + "Update and init the submodule of the current git repository." + (interactive) + (magit-submodule-update t)) + +;;;###autoload +(defun magit-submodule-init () + "Initialize the submodules." + (interactive) + (let ((default-directory (magit-get-top-dir))) + (magit-run-git-async "submodule" "init"))) + +;;;###autoload +(defun magit-submodule-sync () + "Synchronizes submodule's remote URL configuration." + (interactive) + (let ((default-directory (magit-get-top-dir))) + (magit-run-git-async "submodule" "sync"))) + +;;;;; Bisecting + +;;;###autoload +(defun magit-bisect-start (bad good) + "Start a bisect session. + +Bisecting a bug means to find the commit that introduced it. +This command starts such a bisect session by asking for a know +good and a bad commit. To move the session forward use the +other actions from the bisect popup (\ +\\\\[magit-key-mode-popup-bisecting])." + (interactive + (if (magit-bisecting-p) + (user-error "Already bisecting") + (list (magit-read-rev "Start bisect with known bad revision" "HEAD") + (magit-read-rev "Good revision" (magit-guess-branch))))) + (magit-run-git-bisect "start" (list bad good) t)) + +;;;###autoload +(defun magit-bisect-reset () + "After bisecting cleanup bisection state and return to original HEAD." + (interactive) + (when (yes-or-no-p "Reset bisect?") + (magit-run-git "bisect" "reset") + (ignore-errors (delete-file (magit-git-dir "BISECT_CMD_OUTPUT"))))) + +;;;###autoload +(defun magit-bisect-good () + "While bisecting, mark the current commit as good. +Use this after you have asserted that the commit does not contain +the bug in question." + (interactive) + (magit-run-git-bisect "good")) + +;;;###autoload +(defun magit-bisect-bad () + "While bisecting, mark the current commit as bad. +Use this after you have asserted that the commit does contain the +bug in question." + (interactive) + (magit-run-git-bisect "bad")) + +;;;###autoload +(defun magit-bisect-skip () + "While bisecting, skip the current commit. +Use this if for some reason the current commit is not a good one +to test. This command lets Git choose a different one." + (interactive) + (magit-run-git-bisect "skip")) + +;;;###autoload +(defun magit-bisect-run (cmdline) + "Bisect automatically by running commands after each step." + (interactive (list (read-shell-command "Bisect shell command: "))) + (magit-run-git-bisect "run" (list cmdline))) + +(defun magit-run-git-bisect (subcommand &optional args no-assert) + (unless (or no-assert (magit-bisecting-p)) + (user-error "Not bisecting")) + (let ((file (magit-git-dir "BISECT_CMD_OUTPUT")) + (default-directory (magit-get-top-dir))) + (ignore-errors (delete-file file)) + (magit-run-git-with-logfile file "bisect" subcommand args) + (magit-process-wait) + (magit-refresh))) + +;;;;; Logging + +;;;###autoload +(defun magit-log (&optional range) + (interactive) + (unless range (setq range "HEAD")) + (magit-mode-setup magit-log-buffer-name nil + #'magit-log-mode + #'magit-refresh-log-buffer + 'oneline range magit-custom-options)) + +;;;###autoload +(defun magit-log-ranged (range) + (interactive (list (magit-read-rev-range "Log" "HEAD"))) + (magit-log range)) + +;;;###autoload +(defun magit-log-long (&optional range) + (interactive) + (unless range (setq range "HEAD")) + (magit-mode-setup magit-log-buffer-name nil + #'magit-log-mode + #'magit-refresh-log-buffer + 'long range magit-custom-options)) + +;;;###autoload +(defun magit-log-long-ranged (range) + (interactive (list (magit-read-rev-range "Long Log" "HEAD"))) + (magit-log-long range)) + +;;;###autoload +(defun magit-file-log (file &optional use-graph) + "Display the log for the currently visited file or another one. +With a prefix argument show the log graph." + (interactive + (list (magit-read-file-from-rev (magit-get-current-branch) + (magit-buffer-file-name t)) + current-prefix-arg)) + (magit-mode-setup magit-log-buffer-name nil + #'magit-log-mode + #'magit-refresh-log-buffer + 'oneline "HEAD" + `(,@(and use-graph (list "--graph")) + ,@magit-custom-options + "--follow") + file)) + +;;;###autoload +(defun magit-reflog (ref) + "Display the reflog of the current branch. +With a prefix argument another branch can be chosen." + (interactive (let ((branch (magit-get-current-branch))) + (if (and branch (not current-prefix-arg)) + (list branch) + (list (magit-read-rev "Reflog of" branch))))) + (magit-mode-setup magit-reflog-buffer-name nil + #'magit-reflog-mode + #'magit-refresh-reflog-buffer ref)) + +;;;###autoload +(defun magit-reflog-head () + "Display the HEAD reflog." + (interactive) + (magit-reflog "HEAD")) + +;;; Modes (2) +;;;; Log Mode +;;;;; Log Core + +(define-derived-mode magit-log-mode magit-mode "Magit Log" + "Mode for looking at git log. + +\\Type `\\[magit-visit-item]` to visit a commit, and \ +`\\[magit-show-item-or-scroll-up]` to just show it. +Type `\\[magit-log-show-more-entries]` to show more commits, \ +and `\\[magit-refresh]` to refresh the log. +Type `\\[magit-diff-working-tree]` to see the diff between current commit and your working tree, +Type `\\[magit-diff]` to see diff between any two version +Type `\\[magit-apply-item]` to apply the change of the current commit to your wortree, +and `\\[magit-cherry-pick-item]` to apply and commit the result. +Type `\\[magit-revert-item]` to revert a commit, and `\\[magit-reset-head]` reset your current head to a commit, + +More information can be found in Info node `(magit)History' + +Other key binding: +\\{magit-log-mode-map}" + :group 'magit) + +(defvar magit-log-buffer-name "*magit-log*" + "Name of buffer used to display log entries.") + +(defun magit-refresh-log-buffer (style range args &optional file) + (magit-set-buffer-margin (car magit-log-margin-spec) + (and magit-log-show-margin + (eq (car magit-refresh-args) 'oneline))) + (magit-log-margin-set-timeunit-width) + (setq magit-file-log-file file) + (when (consp range) + (setq range (concat (car range) ".." (cdr range)))) + (magit-git-insert-section + (logbuf (concat "Commits" + (and file (concat " for file " file)) + (and range (concat " in " range)))) + (apply-partially 'magit-wash-log style 'color t) + "log" + (format "--max-count=%d" magit-log-cutoff-length) + "--decorate=full" "--color" + (cl-case style + (long (if magit-log-show-gpg-status + (list "--stat" "--show-signature") + "--stat")) + (oneline (concat "--pretty=format:%h%d " + (and magit-log-show-gpg-status "%G?") + "[%an][%at]%s"))) + args range "--" file) + (save-excursion + (goto-char (point-min)) + (magit-format-log-margin))) + +;;;;; Log Washing + +(defconst magit-log-oneline-re + (concat "^" + "\\(?4:\\(?:[-_/|\\*o.] *\\)+ *\\)?" ; graph + "\\(?:" + "\\(?1:[0-9a-fA-F]+\\) " ; sha1 + "\\(?:\\(?3:([^()]+)\\) \\)?" ; refs + "\\(?7:[BGUN]\\)?" ; gpg + "\\[\\(?5:[^]]*\\)\\]" ; author + "\\[\\(?6:[^]]*\\)\\]" ; date + "\\(?2:.*\\)" ; msg + "\\)?$")) + +(defconst magit-log-long-re + (concat "^" + "\\(?4:\\(?:[-_/|\\*o.] *\\)+ *\\)?" ; graph + "\\(?:" + "\\(?:commit \\(?1:[0-9a-fA-F]+\\)" ; sha1 + "\\(?: \\(?3:([^()]+)\\)\\)?\\)" ; refs + "\\|" + "\\(?2:.+\\)\\)$")) ; "msg" + +(defconst magit-log-unique-re + (concat "^" + "\\(?1:[0-9a-fA-F]+\\) " ; sha1 + "\\(?2:.*\\)$")) ; msg + +(defconst magit-log-cherry-re + (concat "^" + "\\(?8:[-+]\\) " ; cherry + "\\(?1:[0-9a-fA-F]+\\) " ; sha1 + "\\(?2:.*\\)$")) ; msg + +(defconst magit-log-bisect-vis-re + (concat "^" + "\\(?1:[0-9a-fA-F]+\\) " ; sha1 + "\\(?:\\(?3:([^()]+)\\) \\)?" ; refs + "\\(?2:.+\\)$")) ; msg + +(defconst magit-log-bisect-log-re + (concat "^# " + "\\(?3:bad:\\|skip:\\|good:\\) " ; "refs" + "\\[\\(?1:[^]]+\\)\\] " ; sha1 + "\\(?2:.+\\)$")) ; msg + +(defconst magit-log-reflog-re + (concat "^" + "\\(?1:[^ ]+\\) " ; sha1 + "\\[\\(?5:[^]]*\\)\\] " ; author + "\\(?6:[^ ]*\\) " ; date + "[^@]+@{\\(?9:[^}]+\\)} " ; refsel + "\\(?10:merge\\|[^:]+\\)?:? ?" ; refsub + "\\(?2:.+\\)?$")) ; msg + +(defconst magit-reflog-subject-re + (concat "\\([^ ]+\\) ?" ; command (1) + "\\(\\(?: ?-[^ ]+\\)+\\)?" ; option (2) + "\\(?: ?(\\([^)]+\\))\\)?")) ; type (3) + +(defvar magit-log-count nil) + +(defun magit-wash-log (style &optional color longer) + (when color + (let ((ansi-color-apply-face-function + (lambda (beg end face) + (when face + (put-text-property beg end 'font-lock-face face))))) + (ansi-color-apply-on-region (point-min) (point-max)))) + (when (eq style 'cherry) + (reverse-region (point-min) (point-max))) + (let ((magit-log-count 0)) + (magit-wash-sequence (apply-partially 'magit-wash-log-line style + (magit-abbrev-length))) + (when (and longer + (= magit-log-count magit-log-cutoff-length)) + (magit-with-section (section longer 'longer) + (insert-text-button "type \"e\" to show more history" + 'action (lambda (button) + (magit-log-show-more-entries)) + 'follow-link t + 'mouse-face magit-item-highlight-face))))) + +(defun magit-wash-log-line (style abbrev) + (looking-at (cl-ecase style + (oneline magit-log-oneline-re) + (long magit-log-long-re) + (unique magit-log-unique-re) + (cherry magit-log-cherry-re) + (reflog magit-log-reflog-re) + (bisect-vis magit-log-bisect-vis-re) + (bisect-log magit-log-bisect-log-re))) + (magit-bind-match-strings + (hash msg refs graph author date gpg cherry refsel refsub) + (delete-region (point) (point-at-eol)) + (when cherry + (magit-insert cherry (if (string= cherry "-") + 'magit-cherry-equivalent + 'magit-cherry-unmatched) ?\s)) + (unless (eq style 'long) + (when (eq style 'bisect-log) + (setq hash (magit-git-string "rev-parse" "--short" hash))) + (if hash + (insert (propertize hash 'face 'magit-log-sha1) ?\s) + (insert (make-string (1+ abbrev) ? )))) + (when graph + (if magit-log-format-graph-function + (insert (funcall magit-log-format-graph-function graph)) + (insert graph))) + (when (and hash (eq style 'long)) + (magit-insert (if refs hash (magit-rev-parse hash)) 'magit-log-sha1 ?\s)) + (when refs + (magit-insert-ref-labels refs)) + (when refsub + (insert (format "%-2s " refsel)) + (insert (magit-log-format-reflog refsub))) + (when msg + (magit-insert msg (cl-case (and gpg (aref gpg 0)) + (?G 'magit-signature-good) + (?B 'magit-signature-bad) + (?U 'magit-signature-untrusted) + (?N 'magit-signature-none) + (t 'magit-log-message)))) + (goto-char (line-beginning-position)) + (magit-format-log-margin author date) + (if hash + (magit-with-section (section commit hash) + (when (derived-mode-p 'magit-log-mode) + (cl-incf magit-log-count)) + (forward-line) + (when (eq style 'long) + (magit-wash-sequence + (lambda () + (looking-at magit-log-long-re) + (when (match-string 2) + (magit-wash-log-line 'long abbrev)))))) + (forward-line))) + t) + +(defun magit-log-format-unicode-graph (string) + "Translate ascii characters to unicode characters. +Whether that actually is an improvment depends on the unicode +support of the font in use. The translation is done using the +alist in `magit-log-format-unicode-graph-alist'." + (replace-regexp-in-string + "[/|\\*o ]" + (lambda (str) + (propertize + (string (or (cdr (assq (aref str 0) + magit-log-format-unicode-graph-alist)) + (aref str 0))) + 'face (get-text-property 0 'face str))) + string)) + +(defun magit-format-log-margin (&optional author date) + (when magit-log-show-margin + (cl-destructuring-bind (width characterp duration-spec) + magit-log-margin-spec + (if author + (magit-make-margin-overlay + (propertize (truncate-string-to-width + author (- width 1 3 (if characterp 0 1) + magit-log-margin-timeunit-width 1) + nil ?\s (make-string 1 magit-ellipsis)) + 'face 'magit-log-author) + " " + (propertize (magit-format-duration + (abs (truncate (- (float-time) + (string-to-number date)))) + (symbol-value duration-spec) + magit-log-margin-timeunit-width) + 'face 'magit-log-date) + (propertize " " 'face 'fringe)) + (magit-make-margin-overlay + (propertize (make-string (1- width) ?\s) 'face 'default) + (propertize " " 'face 'fringe)))))) + +;;;;; Log Commands + +(defun magit-log-toggle-margin () + "Show or hide the log margin. +This command can only be used inside log buffers (usually +*magit-log*) and only if that displays a `oneline' log. +Also see option `magit-log-show-margin'." + (interactive) + (unless (derived-mode-p 'magit-log-mode) + (user-error "The log margin cannot be used outside of log buffers")) + (when (eq (car magit-refresh-args) 'long) + (user-error "The log margin cannot be used with verbose logs")) + (if magit-log-show-margin + (magit-set-buffer-margin (car magit-log-margin-spec) + (not (cdr (window-margins)))) + (setq-local magit-log-show-margin t) + (magit-refresh))) + +(defun magit-log-show-more-entries (&optional arg) + "Grow the number of log entries shown. + +With no prefix optional ARG, show twice as many log entries. +With a numerical prefix ARG, add this number to the number of shown log entries. +With a non numeric prefix ARG, show all entries" + (interactive "P") + (setq-local magit-log-cutoff-length + (cond ((numberp arg) (+ magit-log-cutoff-length arg)) + (arg magit-log-infinite-length) + (t (* magit-log-cutoff-length 2)))) + (let ((old-point (point))) + (magit-refresh) + (goto-char old-point))) + +;;;; Cherry Mode + +(define-derived-mode magit-cherry-mode magit-mode "Magit Cherry" + "Mode for looking at commits not merged upstream. + +\\Type `\\[magit-toggle-section]` to show or hide \ +section, `\\[magit-visit-item]` to visit an item and \ +`\\[magit-show-item-or-scroll-up]` to show it. +Type `\\[magit-diff-working-tree]` to display change with your working tree, \ +when `\\[magit-diff]` to display change +between any two commit. +Type `\\[magit-cherry-pick-item]` to cherry-pick a commit, and \ +`\\[magit-apply-item]` to apply its change to your +working tree, without committing, and `\\[magit-key-mode-popup-merging]` to \ +merge. +`\\[magit-refresh]` will refresh current buffer. + + +Other key binding: +\\{magit-cherry-mode-map}") + +(defvar magit-cherry-buffer-name "*magit-cherry*" + "Name of buffer used to display commits not merged upstream.") + +;;;###autoload +(defun magit-cherry (head upstream) + "Show commits in a branch that are not merged in the upstream branch." + (interactive + (let ((head (magit-read-rev "Cherry head" (magit-get-current-branch)))) + (list head (magit-read-rev "Cherry upstream" + (magit-get-tracked-branch head nil t))))) + (magit-mode-setup magit-cherry-buffer-name nil + #'magit-cherry-mode + #'magit-refresh-cherry-buffer upstream head)) + +(defun magit-refresh-cherry-buffer (upstream head) + (magit-with-section (section cherry 'cherry nil t) + (run-hooks 'magit-cherry-sections-hook))) + +(defun magit-insert-cherry-head-line () + (magit-insert-line-section (line) + (concat "Head: " + (propertize (cadr magit-refresh-args) 'face 'magit-branch) " " + (abbreviate-file-name default-directory)))) + +(defun magit-insert-cherry-upstream-line () + (magit-insert-line-section (line) + (concat "Upstream: " + (propertize (car magit-refresh-args) 'face 'magit-branch)))) + +(defun magit-insert-cherry-help-lines () + (when (derived-mode-p 'magit-cherry-mode) + (insert "\n") + (magit-insert-line-section (line) + (concat (propertize "-" 'face 'magit-cherry-equivalent) + " equivalent exists in both refs")) + (magit-insert-line-section (line) + (concat (propertize "+" 'face 'magit-cherry-unmatched) + " unmatched commit tree")))) + +(defun magit-insert-cherry-commits () + (magit-git-insert-section (cherries "Cherry commits:") + (apply-partially 'magit-wash-log 'cherry) + "cherry" "-v" (magit-abbrev-arg) magit-refresh-args)) + +;;;; Reflog Mode + +(defvar magit-reflog-buffer-name "*magit-reflog*" + "Name of buffer used to display reflog entries.") + +(define-derived-mode magit-reflog-mode magit-log-mode "Magit Reflog" + "Mode for looking at git reflog. + +\\Type `\\[magit-visit-item]` to visit a commit, and \ +`\\[magit-show-item-or-scroll-up]` to just show it. +Type `\\[magit-diff-working-tree]` to see the diff between current commit and \ +your working tree, +Type `\\[magit-diff]` to see the between any two version. +Type `\\[magit-reset-head]` to reset your head to the current commit, and \ +`\\[magit-apply-item]` to apply its change +to your working tree and `\\[magit-cherry-pick-item]` to cherry pick it. + +More information can be found in Info node `(magit)Reflogs' + +Other key binding: +\\{magit-reflog-mode-map}" + :group 'magit) + +(defun magit-refresh-reflog-buffer (ref) + (magit-log-margin-set-timeunit-width) + (magit-git-insert-section + (reflogbuf (format "Local history of branch %s" ref)) + (apply-partially 'magit-wash-log 'reflog t) + "reflog" "show" "--format=format:%h [%an] %ct %gd %gs" + (format "--max-count=%d" magit-log-cutoff-length) ref)) + +(defvar magit-reflog-labels + '(("commit" . magit-log-reflog-label-commit) + ("amend" . magit-log-reflog-label-amend) + ("merge" . magit-log-reflog-label-merge) + ("checkout" . magit-log-reflog-label-checkout) + ("branch" . magit-log-reflog-label-checkout) + ("reset" . magit-log-reflog-label-reset) + ("rebase" . magit-log-reflog-label-rebase) + ("cherry-pick" . magit-log-reflog-label-cherry-pick) + ("initial" . magit-log-reflog-label-commit) + ("pull" . magit-log-reflog-label-remote) + ("clone" . magit-log-reflog-label-remote))) + +(defun magit-log-format-reflog (subject) + (let* ((match (string-match magit-reflog-subject-re subject)) + (command (and match (match-string 1 subject))) + (option (and match (match-string 2 subject))) + (type (and match (match-string 3 subject))) + (label (if (string= command "commit") + (or type command) + command)) + (text (if (string= command "commit") + label + (mapconcat #'identity + (delq nil (list command option type)) + " ")))) + (format "%-16s " + (propertize text 'face + (or (cdr (assoc label magit-reflog-labels)) + 'magit-log-reflog-label-other))))) + +;;;; Ediff Support + +(defvar magit-ediff-buffers nil + "List of buffers that may be killed by `magit-ediff-restore'.") + +(defvar magit-ediff-windows nil + "The window configuration that will be restored when Ediff is finished.") + +(defun magit-ediff () + "View the current DIFF section in ediff." + (interactive) + (let ((diff (magit-current-section))) + (when (eq (magit-section-type (magit-current-section)) 'diffstat) + (setq diff (magit-diff-section-for-diffstat diff))) + (when (magit-section-hidden diff) + ;; Range is not set until the first time the diff is visible. + ;; This somewhat hackish code makes sure it's been visible at + ;; least once. + (magit-toggle-section) + (magit-toggle-section) + (setq diff (magit-current-section))) + (when (eq 'hunk (magit-section-type diff)) + (setq diff (magit-section-parent diff))) + (unless (eq 'diff (magit-section-type diff)) + (user-error "No diff at this location")) + (let* ((status (magit-section-diff-status diff)) + (file1 (magit-section-info diff)) + (file2 (magit-section-diff-file2 diff)) + (range (magit-diff-range diff))) + (cond + ((memq status '(new deleted typechange)) + (message "Why ediff a %s file?" status)) + ((and (eq status 'unmerged) + (eq (cdr range) 'working)) + (magit-interactive-resolve file1)) + ((consp (car range)) + (magit-ediff-buffers3 (magit-show (caar range) file2) + (magit-show (cdar range) file2) + (magit-show (cdr range) file1))) + (t + (magit-ediff-buffers (magit-show (car range) file2) + (magit-show (cdr range) file1))))))) + +(defun magit-ediff-buffers (a b) + (setq magit-ediff-buffers (list a b)) + (setq magit-ediff-windows (current-window-configuration)) + (ediff-buffers a b '(magit-ediff-add-cleanup))) + +(defun magit-ediff-buffers3 (a b c) + (setq magit-ediff-buffers (list a b c)) + (setq magit-ediff-windows (current-window-configuration)) + (ediff-buffers3 a b c '(magit-ediff-add-cleanup))) + +(defun magit-diff-range (diff) + (if (eq major-mode 'magit-commit-mode) + (let ((revs (split-string + (magit-git-string "rev-list" "-1" "--parents" + (car (last magit-refresh-args)))))) + (when (= (length revs) 2) + (cons (cadr revs) (car revs)))) + (magit-section-diff-range diff))) + +(defun magit-ediff-add-cleanup () + (make-local-variable 'magit-ediff-buffers) + (setq-default magit-ediff-buffers ()) + + (make-local-variable 'magit-ediff-windows) + (setq-default magit-ediff-windows ()) + + (add-hook 'ediff-cleanup-hook 'magit-ediff-restore 'append 'local)) + +(defun magit-ediff-restore () + "Kill any buffers in `magit-ediff-buffers' that are not visiting files and +restore the window state that was saved before ediff was called." + (dolist (buffer magit-ediff-buffers) + (when (and (null (buffer-file-name buffer)) + (buffer-live-p buffer)) + (with-current-buffer buffer + (when (and (eq magit-show-current-version 'index) + (buffer-modified-p)) + (magit-save-index))) + (kill-buffer buffer))) + (let ((buf (current-buffer))) + (set-window-configuration magit-ediff-windows) + (set-buffer buf))) + +;;;###autoload +(defun magit-save-index () + "Add the content of current file as if it was the index." + (interactive) + (unless (eq magit-show-current-version 'index) + (user-error "Current buffer doesn't visit the index version of a file")) + (when (y-or-n-p (format "Stage current version of %s? " magit-file-name)) + (let ((buf (current-buffer)) + (name (magit-git-dir "magit-add-index"))) + (with-temp-file name + (insert-buffer-substring buf)) + (let ((hash (magit-git-string "hash-object" "-t" "blob" "-w" + (concat "--path=" magit-file-name) + "--" name)) + (perm (substring (magit-git-string "ls-files" "-s" + magit-file-name) + 0 6))) + (magit-run-git "update-index" "--cacheinfo" + perm hash magit-file-name))))) + +;;;###autoload +(defun magit-interactive-resolve (file) + "Resolve a merge conflict using Ediff." + (interactive (list (magit-section-case (info) (diff (cadr info))))) + (require 'ediff) + (let ((merge-status (magit-git-lines "ls-files" "-u" "--" file)) + (base-buffer) + (our-buffer (generate-new-buffer (concat file ".current"))) + (their-buffer (generate-new-buffer (concat file ".merged"))) + (merger-buffer) + (windows (current-window-configuration))) + (unless merge-status + (user-error "Cannot resolve %s" file)) + (when (string-match "^[0-9]+ [0-9a-f]+ 1" (car merge-status)) + (pop merge-status) + (setq base-buffer (generate-new-buffer (concat file ".base"))) + (with-current-buffer base-buffer + (magit-git-insert "cat-file" "blob" (concat ":1:" file)))) + ;; If the second or third version do not exit, we use an empty buffer for the deleted file + (with-current-buffer our-buffer + (when (string-match "^[0-9]+ [0-9a-f]+ 2" (car merge-status)) + (pop merge-status) + (magit-git-insert "cat-file" "blob" (concat ":2:" file))) + (let ((buffer-file-name file)) + (normal-mode t))) + (with-current-buffer their-buffer + (when (string-match "^[0-9]+ [0-9a-f]+ 3" (car merge-status)) + (magit-git-insert "cat-file" "blob" (concat ":3:" file))) + (let ((buffer-file-name file)) + (normal-mode t))) + ;; We have now created the 3 buffer with ours, theirs and the ancestor files + (if base-buffer + (setq merger-buffer (ediff-merge-buffers-with-ancestor + our-buffer their-buffer base-buffer nil nil file)) + (setq merger-buffer (ediff-merge-buffers our-buffer their-buffer nil nil file))) + (with-current-buffer merger-buffer + (setq ediff-show-clashes-only t) + (setq-local magit-ediff-windows windows) + (make-local-variable 'ediff-quit-hook) + (add-hook 'ediff-quit-hook + (lambda () + (let ((buffer-A ediff-buffer-A) + (buffer-B ediff-buffer-B) + (buffer-C ediff-buffer-C) + (buffer-Ancestor ediff-ancestor-buffer) + (windows magit-ediff-windows)) + (ediff-cleanup-mess) + (kill-buffer buffer-A) + (kill-buffer buffer-B) + (when (bufferp buffer-Ancestor) + (kill-buffer buffer-Ancestor)) + (set-window-configuration windows))))))) + +;;;; Diff Mode +;;;;; Diff Core + +(define-derived-mode magit-diff-mode magit-mode "Magit Diff" + "Mode for looking at a git diff. + +\\Type `\\[magit-visit-item]` to visit the changed file, \ +`\\[magit-toggle-section]` to hide or show a hunk, +`\\[magit-diff-larger-hunks]` and `\\[magit-diff-smaller-hunks]` to change \ +the size of the hunks. +Type `\\[magit-apply-item]` to apply a change to your worktree and \ +`\\[magit-revert-item]` to reverse it. +You can also use `\\[magit-ediff]` to see the current change with ediff. + +More information can be found in Info node `(magit)Diffing' + +\\{magit-diff-mode-map}" + :group 'magit) + +(defvar magit-diff-buffer-name "*magit-diff*" + "Name of buffer used to display a diff.") + +(defvar magit-stash-buffer-name "*magit-stash*" + "Name of buffer used to display a stash.") + +;;;;; Diff Entry Commands + +;;;###autoload +(defun magit-diff (range &optional working args) + "Show differences between two commits. +RANGE should be a range (A..B or A...B) but can also be a single +commit. If one side of the range is omitted, then it defaults +to HEAD. If just a commit is given, then changes in the working +tree relative to that commit are shown." + (interactive (list (magit-read-rev-range "Diff"))) + (magit-mode-setup magit-diff-buffer-name + #'pop-to-buffer + #'magit-diff-mode + #'magit-refresh-diff-buffer range working args)) + +;;;###autoload +(defun magit-diff-working-tree (rev) + "Show differences between a commit and the current working tree." + (interactive (list (magit-read-rev-with-default "Diff working tree with"))) + (magit-diff (or rev "HEAD") t)) + +;;;###autoload +(defun magit-diff-staged () + "Show differences between the index and the HEAD commit." + (interactive) + (magit-diff nil nil (list "--cached"))) + +;;;###autoload +(defun magit-diff-unstaged () + "Show differences between the current working tree and index." + (interactive) + (magit-diff nil)) + +;;;###autoload +(defun magit-diff-stash (stash &optional noselect) + "Show changes in a stash. +A Stash consist of more than just one commit. This command uses +a special diff range so that the stashed changes actually were a +single commit." + (interactive (list (magit-read-stash "Show stash (number): "))) + (magit-mode-setup magit-commit-buffer-name + (if noselect 'display-buffer 'pop-to-buffer) + #'magit-diff-mode + #'magit-refresh-diff-buffer + (concat stash "^2^.." stash))) + +(defun magit-diff-with-mark (range) + "Show difference between the marked commit and the one at point. +If there is no commit at point, then prompt for one." + (interactive + (let* ((marked (or magit-marked-commit (user-error "No commit marked"))) + (current (magit-get-current-branch)) + (is-current (string= (magit-name-rev marked) current)) + (commit (or (magit-guess-branch) + (magit-read-rev + (format "Diff marked commit %s with" marked) + (unless is-current current) + current)))) + (list (concat marked ".." commit)))) + (magit-diff range)) + +(defun magit-refresh-diff-buffer (range &optional working args) + (let ((magit-current-diff-range + (cond (working (cons range 'working)) + ((null range) nil) + ((consp range) + (prog1 range + (setq range (concat (car range) ".." (cdr range))))) + ((string-match "^\\([^.]+\\)\\.\\.\\([^.]\\)$" range) + (cons (match-string 1 range) + (match-string 2 range)))))) + (magit-git-insert-section + (diffbuf (cond (working + (format "Changes from %s to working tree" range)) + ((not range) + (if (member "--cached" args) + "Staged changes" + "Unstaged changes")) + (t + (format "Changes in %s" range)))) + #'magit-wash-diffs + "diff" (magit-diff-U-arg) + (and magit-show-diffstat "--patch-with-stat") + range args "--"))) + +;;;;; Diff Washing + +(defconst magit-diff-statline-re + (concat "^ ?" + "\\(.*\\)" ; file + "\\( +| +\\)" ; separator + "\\([0-9]+\\|Bin\\(?: +[0-9]+ -> [0-9]+ bytes\\)?$\\) ?" + "\\(\\+*\\)" ; add + "\\(-*\\)$")) ; del + +(defvar magit-current-diff-range nil + "Used internally when setting up magit diff sections.") + +(defvar-local magit-diffstat-cached-sections nil) +(put 'magit-diffstat-cached-sections 'permanent-local t) + +(defun magit-wash-diffs () + (magit-wash-diffstats) + (when (re-search-forward "^diff" nil t) + (goto-char (line-beginning-position)) + (magit-wash-sequence #'magit-wash-diff)) + (goto-char (point-max)) + (magit-xref-insert-buttons)) + +(defun magit-wash-diffstats () + (let ((beg (point))) + (when (re-search-forward "^ ?\\([0-9]+ +files? change[^\n]*\n\\)" nil t) + (let ((heading (match-string-no-properties 1))) + (delete-region (match-beginning 0) (match-end 0)) + (goto-char beg) + (magit-with-section (section diffstats 'diffstats heading) + (magit-wash-sequence #'magit-wash-diffstat))) + (setq magit-diffstat-cached-sections + (nreverse magit-diffstat-cached-sections))))) + +(defun magit-wash-diffstat () + (when (looking-at magit-diff-statline-re) + (magit-bind-match-strings (file sep cnt add del) + (delete-region (point) (1+ (line-end-position))) + (magit-with-section (section diffstat 'diffstat) + (insert " " file sep cnt " ") + (when add (insert (propertize add 'face 'magit-diff-add))) + (when del (insert (propertize del 'face 'magit-diff-del))) + (insert "\n") + (push section magit-diffstat-cached-sections))))) + +(defun magit-wash-diff () + (magit-with-section (section diff (buffer-substring-no-properties + (line-beginning-position) + (line-end-position))) + (setq section (magit-wash-diff-section section)))) + +(defun magit-wash-diff-section (section) + (cond ((re-search-forward "^\\* Unmerged path \\(.*\\)" nil t) + (forward-line 0) + (let ((file (magit-decode-git-path (match-string-no-properties 1)))) + (delete-region (point) (line-end-position)) + (insert "\tUnmerged " file "\n") + (setf (magit-section-diff-status section) 'unmerged) + (setf (magit-section-info section) file) + section)) + ((re-search-forward "^diff" nil t) + (forward-line 0) + (let ((file (cond + ((looking-at "^diff --git \\(\".*\"\\) \\(\".*\"\\)$") + (substring (magit-decode-git-path + (match-string-no-properties 2)) 2)) + ((looking-at "^diff --git ./\\(.*\\) ./\\(.*\\)$") + (match-string-no-properties 2)) + ((looking-at "^diff --cc +\\(.*\\)$") + (match-string-no-properties 1)))) + (end (save-excursion + (forward-line) ;; skip over "diff" line + (if (re-search-forward "^diff\\|^@@" nil t) + (goto-char (match-beginning 0)) + (goto-char (point-max))) + (point-marker)))) + (when magit-diffstat-cached-sections + (setf (magit-section-info (pop magit-diffstat-cached-sections)) + file)) + (let ((status (cond + ((looking-at "^diff --cc") + 'unmerged) + ((save-excursion + (re-search-forward "^new file" end t)) + 'new) + ((save-excursion + (re-search-forward "^deleted" end t)) + (setf (magit-section-hidden section) t) + 'deleted) + ((save-excursion + (re-search-forward "^rename" end t)) + 'renamed) + (t + 'modified))) + (file2 (cond + ((save-excursion + (re-search-forward "^rename from \\(.*\\)" + end t)) + (match-string-no-properties 1))))) + (setf (magit-section-diff-status section) status) + (setf (magit-section-info section) file) + (setf (magit-section-diff-file2 section) (or file2 file)) + (setf (magit-section-diff-range section) magit-current-diff-range) + (magit-insert-diff-title status file file2) + (when (re-search-forward + "\\(--- \\(.*\\)\n\\+\\+\\+ \\(.*\\)\n\\)" nil t) + (magit-put-face-property (match-beginning 1) (match-end 1) + 'magit-diff-hunk-header) + (magit-put-face-property (match-beginning 2) (match-end 2) + 'magit-diff-file-header) + (magit-put-face-property (match-beginning 3) (match-end 3) + 'magit-diff-file-header)) + (goto-char end) + (magit-wash-sequence #'magit-wash-hunk))) + section))) + +(defun magit-insert-diff-title (status file file2) + (insert (format "\t%-10s " (capitalize (symbol-name status))) + file + (if (eq status 'renamed) (format " (from %s)" file2) "") + "\n")) + +(defun magit-wash-hunk () + (when (looking-at "^@@\\(@\\)?.+") + (let ((merging (match-beginning 1))) + (magit-with-section (section hunk (match-string 0)) + (magit-put-face-property (point) (line-end-position) + 'magit-diff-hunk-header) + (forward-line) + (while (not (or (eobp) (looking-at "^diff\\|^@@"))) + (magit-put-face-property + (point) (line-end-position) + (cond + ((looking-at "^\\+\\+<<<<<<<") 'magit-diff-merge-current) + ((looking-at "^\\+\\+=======") 'magit-diff-merge-separator) + ((looking-at "^\\+\\+|||||||") 'magit-diff-merge-diff3-separator) + ((looking-at "^\\+\\+>>>>>>>") 'magit-diff-merge-proposed) + ((looking-at (if merging "^\\(\\+\\| \\+\\)" "^\\+")) + (magit-diff-highlight-whitespace merging) + 'magit-diff-add) + ((looking-at (if merging "^\\(-\\| \\-\\)" "^-")) + (magit-diff-highlight-whitespace merging) + 'magit-diff-del) + (t + 'magit-diff-none))) + (forward-line)) + (when (eq magit-diff-refine-hunk 'all) + (magit-diff-refine-hunk section)))) + t)) + +(defun magit-diff-highlight-whitespace (merging) + (when (and magit-highlight-whitespace + (or (derived-mode-p 'magit-status-mode) + (not (eq magit-highlight-whitespace 'status)))) + (let ((prefix (if merging "^[-\\+\s]\\{2\\}" "^[-\\+]")) + (indent + (if (local-variable-p 'magit-highlight-indentation) + magit-highlight-indentation + (setq-local + magit-highlight-indentation + (cdr (cl-find-if (lambda (pair) + (string-match-p (car pair) default-directory)) + (default-value 'magit-highlight-indentation) + :from-end t)))))) + (when (and magit-highlight-trailing-whitespace + (looking-at (concat prefix ".*?\\([ \t]+\\)$"))) + (magit-put-face-property (match-beginning 1) (match-end 1) + 'magit-whitespace-warning-face)) + (when (or (and (eq indent 'tabs) + (looking-at (concat prefix "\\( *\t[ \t]*\\)"))) + (and (integerp indent) + (looking-at (format "%s\\([ \t]* \\{%s,\\}[ \t]*\\)" + prefix indent)))) + (magit-put-face-property (match-beginning 1) (match-end 1) + 'magit-whitespace-warning-face))))) + +;;;;; Diff Mode Commands + +(defun magit-diff-toggle-refine-hunk (&optional other) + "Turn diff-hunk refining on or off. + +If hunk refining is currently on, then hunk refining is turned off. +If hunk refining is off, then hunk refining is turned on, in +`selected' mode (only the currently selected hunk is refined). + +With a prefix argument, the \"third choice\" is used instead: +If hunk refining is currently on, then refining is kept on, but +the refining mode (`selected' or `all') is switched. +If hunk refining is off, then hunk refining is turned on, in +`all' mode (all hunks refined). + +Customize variable `magit-diff-refine-hunk' to change the default mode." + (interactive "P") + (let ((hunk (and magit-highlighted-section + (eq (magit-section-type magit-highlighted-section) 'hunk) + magit-highlighted-section)) + (old magit-diff-refine-hunk)) + (setq-local magit-diff-refine-hunk + (if other + (if (eq old 'all) t 'all) + (not old))) + (cond ((or (eq old 'all) + (eq magit-diff-refine-hunk 'all)) + (magit-refresh)) + ((not hunk)) + (magit-diff-refine-hunk + (magit-diff-refine-hunk hunk)) + (t + (magit-diff-unrefine-hunk hunk))) + (message "magit-diff-refine-hunk: %s" magit-diff-refine-hunk))) + +(defun magit-diff-refine-hunk (hunk) + (save-excursion + (goto-char (magit-section-beginning hunk)) + ;; `diff-refine-hunk' does not handle combined diffs. + (unless (looking-at "@@@") + (diff-refine-hunk)))) + +(defun magit-diff-unrefine-hunk (hunk) + (remove-overlays (magit-section-beginning hunk) + (magit-section-end hunk) + 'diff-mode 'fine)) + +;;;; Wazzup Mode + +(define-derived-mode magit-wazzup-mode magit-mode "Magit Wazzup" + "Mode for looking at git commits not merged into current HEAD. + +\\Type `\\[magit-toggle-section]` to show or hide \ +section, `\\[magit-visit-item]` to visit an item \ +`\\[magit-show-item-or-scroll-up]` to show it. +Type `\\[magit-diff-working-tree]` to display change with your working tree, \ +and `\\[magit-diff]` to display change +between any two commit. +Type `\\[magit-cherry-pick-item]` to cherry-pick a commit, and \ +`\\[magit-apply-item]` to apply its change to your +working tree, without committing, and `\\[magit-key-mode-popup-merging]` \ +to merge those change. +Type `\\[magit-refresh]` to refresh current buffer. + +More information can be found in Info node `(magit)Wazzup' + +\\{magit-wazzup-mode-map}" + :group 'magit) + +(defvar magit-wazzup-buffer-name "*magit-wazzup*" + "Name of buffer used to display commits not merged into current HEAD.") + +;;;###autoload +(defun magit-wazzup (branch) + "Show a list of branches in a dedicated buffer. +Unlike in the buffer created by `magit-branch-manager' each +branch can be expanded to show a list of commits not merged +into the selected branch." + (interactive + (let ((branch (magit-get-current-branch))) + (list (if current-prefix-arg + (magit-read-rev "Wazzup branch" branch) + branch)))) + (magit-mode-setup magit-wazzup-buffer-name nil + #'magit-wazzup-mode + #'magit-refresh-wazzup-buffer branch)) + +(defun magit-refresh-wazzup-buffer (head) + (magit-with-section (section wazzupbuf 'wazzupbuf nil t) + (run-hooks 'magit-wazzup-sections-hook))) + +(defun magit-insert-wazzup-head-line () + (magit-insert-line-section (line) + (concat "Head: " + (propertize (car magit-refresh-args) 'face 'magit-branch) " " + (abbreviate-file-name default-directory)))) + +(defun magit-insert-wazzup-branches () + (dolist (upstream (magit-git-lines "show-ref")) + (setq upstream (cadr (split-string upstream " "))) + (when (and (not (string-match-p "HEAD$" upstream)) + (string-match-p "^refs/\\(heads\\|remotes\\)/" upstream)) + (magit-insert-wazzup-commits upstream (car magit-refresh-args))))) + +(defun magit-insert-wazzup-commits (upstream head) + (let ((count (string-to-number + (magit-git-string "rev-list" "--count" "--right-only" + (concat head "..." upstream))))) + (when (> count 0) + (magit-with-section + (section wazzup upstream + (format "%3s %s\n" count (magit-format-ref-label upstream)) + nil t) + (cond + ((magit-section-hidden section) + (setf (magit-section-hidden section) t) + (setf (magit-section-needs-refresh-on-show section) t)) + (t + (let ((beg (point))) + (magit-git-insert "cherry" "-v" "--abbrev" head upstream) + (save-restriction + (narrow-to-region beg (point)) + (goto-char (point-min)) + (magit-wash-log 'cherry))))))))) + +;;;; Branch Manager Mode +;;;;; (core) + +(define-derived-mode magit-branch-manager-mode magit-mode "Magit Branch" + "Mode for looking at git branches. + +\\Type `\\[magit-visit-item]` to checkout a branch, `\\[magit-reset-head]' to reset current branch, +you can also merge the branch with `\\[magit-key-mode-popup-merging]` + +Type `\\[magit-discard-item]' to delete a branch, or `\\[universal-argument] \\[magit-discard-item]' to force the deletion. +Type `\\[magit-rename-item]' to Rename a branch. + +More information can be found in Info node `(magit)The branch list' + +\\{magit-branch-manager-mode-map} +Unless shadowed by the mode specific bindings above, bindings +from the parent keymap `magit-mode-map' are also available.") + +(defvar magit-branches-buffer-name "*magit-branches*" + "Name of buffer used to display and manage branches.") + +;;;###autoload +(defun magit-branch-manager () + "Show a list of branches in a dedicated buffer." + (interactive) + (if (magit-get-top-dir) ; Kludge for #1215 + (magit-mode-setup magit-branches-buffer-name nil + #'magit-branch-manager-mode + #'magit-refresh-branch-manager) + (user-error "There is no Git repository here"))) + +(defun magit-refresh-branch-manager () + (magit-git-insert-section (branchbuf nil) + #'magit-wash-branches + "branch" "-vva" magit-custom-options)) + +;;;;; Branch List Washing + +(defconst magit-wash-branch-line-re + (concat "^\\([ *] \\)" ; 1: current branch marker + "\\(.+?\\) +" ; 2: branch name + "\\(?:" + "\\([0-9a-fA-F]+\\)" ; 3: sha1 + " " + "\\(?:\\[" + "\\([^:\n]+?\\)" ; 4: tracking + "\\(?:: \\)?" + "\\(?:ahead \\([0-9]+\\)\\)?" ; 5: ahead + "\\(?:, \\)?" + "\\(?:behind \\([0-9]+\\)\\)?" ; 6: behind + "\\] \\)?" + "\\(?:.*\\)" ; message + "\\|" ; or + "-> " ; the pointer to + "\\(.+\\)" ; 7: a ref + "\\)\n")) + +(defun magit-wash-branch-line (&optional remote-name) + (when (looking-at magit-wash-branch-line-re) + ;; ^ Kludge for #1162. v Don't reindent for now. + (let* ((marker (match-string 1)) + (branch (match-string 2)) + (sha1 (match-string 3)) + (tracking (match-string 4)) + (ahead (match-string 5)) + (behind (match-string 6)) + (other-ref (match-string 7)) + (branch-face (and (equal marker "* ") 'magit-branch))) + (delete-region (point) (line-beginning-position 2)) + (magit-with-section (section branch branch) + (insert (propertize (or sha1 (make-string 7 ? )) + 'face 'magit-log-sha1) + " " marker + (propertize (if (string-match-p "^remotes/" branch) + (substring branch 8) + branch) + 'face branch-face)) + (when other-ref + (insert " -> " (substring other-ref (+ 1 (length remote-name))))) + (when (and tracking + (equal (magit-get-tracked-branch branch t) + (concat "refs/remotes/" tracking))) + (insert " [") + ;; getting rid of the tracking branch name if it is + ;; the same as the branch name + (let* ((remote (magit-get "branch" branch "remote")) + (merge (substring tracking (+ 1 (length remote))))) + (insert (propertize (if (string= branch merge) + (concat "@ " remote) + (concat merge " @ " remote)) + 'face 'magit-log-head-label-remote))) + (when (or ahead behind) + (insert ":") + (and ahead (insert "ahead " (propertize ahead 'face branch-face))) + (and ahead behind (insert ", ")) + (and behind (insert "behind " + (propertize behind 'face + 'magit-log-head-label-remote)))) + (insert "]")) + (insert "\n"))))) + +(defun magit-wash-remote-branches-group (group) + (let* ((remote (car group)) + (url (magit-get "remote" remote "url")) + (push-url (magit-get "remote" remote "pushurl")) + (urls (concat url (and push-url (concat ", " push-url)))) + (marker (cadr group))) + (magit-with-section + (section remote remote (format "%s (%s):" remote urls) t) + (magit-wash-branches-between-point-and-marker marker remote) + (insert "\n")))) + +(defun magit-wash-branches-between-point-and-marker (marker &optional remote-name) + (save-restriction + (narrow-to-region (point) marker) + (magit-wash-sequence + (apply-partially 'magit-wash-branch-line remote-name)))) + +(defun magit-wash-branches () + ;; get the names of the remotes + (let* ((remotes (magit-git-lines "remote")) + ;; get the location of remotes in the buffer + (markers + (append (mapcar (lambda (remote) + (save-excursion + (when (re-search-forward + (format "^ remotes/%s/" remote) nil t) + (beginning-of-line) + (point-marker)))) + remotes) + (list (save-excursion + (goto-char (point-max)) + (point-marker))))) + ;; list of remote elements to display in the buffer + (remote-groups + (cl-loop for remote in remotes + for end-markers on (cdr markers) + for marker = (cl-loop for x in end-markers thereis x) + collect (list remote marker)))) + ;; actual displaying of information + (magit-with-section (section local "." "Local:" t) + (magit-wash-branches-between-point-and-marker + (cl-loop for x in markers thereis x)) + (insert "\n")) + (mapc 'magit-wash-remote-branches-group remote-groups) + ;; make sure markers point to nil so that they can be garbage collected + (mapc (lambda (marker) + (when marker + (set-marker marker nil))) + markers))) + +;;;;; (commands) + +(defun magit-rename-item () + "Rename the item at point." + (interactive) + (magit-section-action rename () + (branch (call-interactively 'magit-rename-branch)) + (remote (call-interactively 'magit-rename-remote)))) + +(defun magit-change-what-branch-tracks () + "Change which remote branch the current branch tracks." + (interactive) + (let* ((branch (magit-guess-branch)) + (track (magit-read-rev "Track branch")) + (track- + (cond ((string-match "^\\([^ ]+\\) +(\\(.+\\))$" track) + (cons (match-string 2 track) + (concat "refs/heads/" (match-string 1 track)))) + ((string-match "^\\(?:refs/remotes/\\)?\\([^/]+\\)/\\(.+\\)" + track) + (cons (match-string 1 track) + (concat "refs/heads/" (match-string 2 track)))) + (t + (user-error "Cannot parse the remote and branch name"))))) + (magit-set (car track-) "branch" branch "remote") + (magit-set (cdr track-) "branch" branch "merge") + (magit-refresh))) + +;;; Miscellaneous +;;;; Miscellaneous Commands + +;;;###autoload +(defun magit-init (directory) + "Create or reinitialize a Git repository. +Read directory name and initialize it as new Git repository. + +If the directory is below an existing repository, then the user +has to confirm that a new one should be created inside; or when +the directory is the root of the existing repository, whether +it should be reinitialized. + +Non-interactively DIRECTORY is always (re-)initialized." + (interactive + (let* ((dir (file-name-as-directory + (expand-file-name + (read-directory-name "Create repository in: ")))) + (top (magit-get-top-dir dir))) + (if (and top + (not (yes-or-no-p + (if (string-equal top dir) + (format "Reinitialize existing repository %s? " dir) + (format "%s is a repository. Create another in %s? " + top dir))))) + (user-error "Abort") + (list dir)))) + (magit-run-git "init" (expand-file-name directory))) + +(defun magit-copy-item-as-kill () + "Copy sha1 of commit at point into kill ring." + (interactive) + (magit-section-action copy (info) + ((branch commit file diff) + (kill-new info) + (message "%s" info)))) + +(defun magit-ignore-item (edit &optional local) + "Ignore the item at point. +With a prefix argument edit the ignore string." + (interactive "P") + (magit-section-action ignore (info) + ([file untracked] + (magit-ignore-file (concat "/" info) edit local) + (magit-refresh)) + (diff + (when (yes-or-no-p (format "%s is tracked. Untrack and ignore? " info)) + (magit-ignore-file (concat "/" info) edit local) + (magit-run-git "rm" "--cached" info))))) + +(defun magit-ignore-item-locally (edit) + "Ignore the item at point locally only. +With a prefix argument edit the ignore string." + (interactive "P") + (magit-ignore-item edit t)) + +(defun magit-ignore-file (file &optional edit local) + "Add FILE to the list of files to ignore. +If EDIT is non-nil, prompt the user for the string to be ignored +instead of using FILE. The changes are written to .gitignore +except if LOCAL is non-nil in which case they are written to +.git/info/exclude." + (let* ((local-ignore-dir (magit-git-dir "info/")) + (ignore-file (if local + (concat local-ignore-dir "exclude") + ".gitignore"))) + (when edit + (setq file (magit-ignore-edit-string file))) + (when (and local (not (file-exists-p local-ignore-dir))) + (make-directory local-ignore-dir t)) + (with-temp-buffer + (when (file-exists-p ignore-file) + (insert-file-contents ignore-file)) + (goto-char (point-max)) + (unless (bolp) + (insert "\n")) + (insert file "\n") + (write-region nil nil ignore-file)))) + +(defun magit-ignore-edit-string (file) + "Prompt the user for the string to be ignored. +A list of predefined values with wildcards is derived from the +filename FILE." + (let* ((extension (concat "*." (file-name-extension file))) + (extension-in-dir (concat (file-name-directory file) extension)) + (filename (file-name-nondirectory file)) + (completions (list extension extension-in-dir filename file))) + (magit-completing-read "File/pattern to ignore" + completions nil nil nil nil file))) + +;;;; Commit Mark + +(defvar magit-marked-commit nil) + +(defvar-local magit-mark-overlay nil) +(put 'magit-mark-overlay 'permanent-local t) + +(defun magit-mark-item (&optional unmark) + "Mark the commit at point. +Some commands act on the marked commit by default or use it as +default when prompting for a commit." + (interactive "P") + (if unmark + (setq magit-marked-commit nil) + (magit-section-action mark (info) + (commit (setq magit-marked-commit + (if (equal magit-marked-commit info) nil info))))) + (magit-refresh-marked-commits) + (run-hooks 'magit-mark-commit-hook)) + +(defun magit-refresh-marked-commits () + (magit-map-magit-buffers #'magit-refresh-marked-commits-in-buffer)) + +(defun magit-refresh-marked-commits-in-buffer () + (unless magit-mark-overlay + (setq magit-mark-overlay (make-overlay 1 1)) + (overlay-put magit-mark-overlay 'face 'magit-item-mark)) + (delete-overlay magit-mark-overlay) + (magit-map-sections + (lambda (section) + (when (and (eq (magit-section-type section) 'commit) + (equal (magit-section-info section) + magit-marked-commit)) + (move-overlay magit-mark-overlay + (magit-section-beginning section) + (magit-section-end section) + (current-buffer)))) + magit-root-section)) + +;;;; ChangeLog + +;;;###autoload +(defun magit-add-change-log-entry (&optional whoami file-name other-window) + "Find change log file and add date entry and item for current change. +This differs from `add-change-log-entry' (which see) in that +it acts on the current hunk in a Magit buffer instead of on +a position in a file-visiting buffer." + (interactive (list current-prefix-arg + (prompt-for-change-log-name))) + (let (buf pos) + (save-window-excursion + (magit-visit-item) + (setq buf (current-buffer) + pos (point))) + (save-excursion + (with-current-buffer buf + (goto-char pos) + (add-change-log-entry whoami file-name other-window))))) + +;;;###autoload +(defun magit-add-change-log-entry-other-window (&optional whoami file-name) + "Find change log file in other window and add entry and item. +This differs from `add-change-log-entry-other-window' (which see) +in that it acts on the current hunk in a Magit buffer instead of +on a position in a file-visiting buffer." + (interactive (and current-prefix-arg + (list current-prefix-arg + (prompt-for-change-log-name)))) + (magit-add-change-log-entry whoami file-name t)) + +;;;; Read Repository + +(defun magit-read-top-dir (dir) + "Ask the user for a Git repository. +The choices offered by auto-completion will be the repositories +under `magit-repo-dirs'. If `magit-repo-dirs' is nil or DIR is +non-nil, then autocompletion will offer directory names." + (if (and (not dir) magit-repo-dirs) + (let* ((repos (magit-list-repos magit-repo-dirs)) + (reply (magit-completing-read "Git repository" repos))) + (file-name-as-directory + (or (cdr (assoc reply repos)) + (if (file-directory-p reply) + (expand-file-name reply) + (user-error "Not a repository or a directory: %s" reply))))) + (file-name-as-directory + (read-directory-name "Git repository: " + (or (magit-get-top-dir) default-directory))))) + +(defun magit-list-repos (dirs) + (magit-list-repos-remove-conflicts + (cl-loop for dir in dirs + append (cl-loop for repo in + (magit-list-repos* dir magit-repo-dirs-depth) + collect (cons (file-name-nondirectory repo) repo))))) + +(defun magit-list-repos* (dir depth) + "Return a list of repos found in DIR, recursing up to DEPTH levels deep." + (if (magit-git-repo-p dir) + (list (expand-file-name dir)) + (and (> depth 0) + (file-directory-p dir) + (not (member (file-name-nondirectory dir) + '(".." "."))) + (cl-loop for entry in (directory-files dir t nil t) + append (magit-list-repos* entry (1- depth)))))) + +(defun magit-list-repos-remove-conflicts (alist) + (let ((dict (make-hash-table :test 'equal)) + (alist (delete-dups alist)) + (result nil)) + (dolist (a alist) + (puthash (car a) (cons (cdr a) (gethash (car a) dict)) + dict)) + (maphash + (lambda (key value) + (if (= (length value) 1) + (push (cons key (car value)) result) + (let ((sub (magit-list-repos-remove-conflicts + (mapcar + (lambda (entry) + (let ((dir (directory-file-name + (substring entry 0 (- (length key)))))) + (cons (concat (file-name-nondirectory dir) "/" key) + entry))) + value)))) + (setq result (append result sub))))) + dict) + result)) + +;;;; External Tools + +;;;###autoload +(defun magit-run-git-gui () + "Run `git gui' for the current git repository." + (interactive) + (let* ((default-directory (magit-get-top-dir))) + (call-process magit-git-executable nil 0 nil "gui"))) + +;;;###autoload +(defun magit-run-git-gui-blame (commit filename &optional linenum) + "Run `git gui blame' on the given FILENAME and COMMIT. +Interactively run it for the current file and the HEAD, with a +prefix or when the current file cannot be determined let the user +choose. When the current buffer is visiting FILENAME instruct +blame to center around the line point is on." + (interactive + (let (revision filename) + (when (or current-prefix-arg + (not (setq revision "HEAD" + filename (magit-buffer-file-name t)))) + (setq revision (magit-read-rev "Retrieve from revision" "HEAD") + filename (magit-read-file-from-rev revision))) + (list revision filename + (and (equal filename + (ignore-errors + (magit-file-relative-name + (file-name-directory (buffer-file-name))))) + (line-number-at-pos))))) + (let ((default-directory (magit-get-top-dir))) + (apply #'call-process magit-git-executable nil 0 nil "gui" "blame" + `(,@(and linenum (list (format "--line=%d" linenum))) + ,commit + ,filename)))) + +;;;###autoload +(defun magit-run-gitk (arg) + "Run Gitk for the current git repository. +Without a prefix argument run `gitk --all', with +a prefix argument run gitk without any arguments." + (interactive "P") + (apply #'call-process magit-gitk-executable nil 0 nil + (if arg nil (list "--all")))) + +;;;; Maintenance Tools + +(defun magit-describe-item () + "Show information about the section at point. +This command is intended for debugging purposes." + (interactive) + (let* ((section (magit-current-section)) + (head-beg (magit-section-beginning section)) + (body-beg (magit-section-content-beginning section))) + (message "Section: %s %s%s-%s %S %S" + (magit-section-type section) + (marker-position (magit-section-beginning section)) + (if (and body-beg (not (= body-beg head-beg)) + (< body-beg (magit-section-end section))) + (format "-%s" (marker-position body-beg)) + "") + (marker-position (magit-section-end section)) + (magit-section-info section) + (magit-section-context-type section)))) + +;;;; Magit Extensions + +(defun magit-load-config-extensions () + "Try to load magit extensions that are defined at git config layer. +This can be added to `magit-mode-hook' for example" + (dolist (ext (magit-get-all "magit.extension")) + (let ((sym (intern (format "magit-%s-mode" ext)))) + (when (and (fboundp sym) + (not (eq sym 'magit-wip-save-mode))) + (funcall sym 1))))) + +;;; magit.el ends soon + +(defconst magit-font-lock-keywords + (eval-when-compile + `((,(concat "(\\(" (regexp-opt + '("magit-define-level-shower" + "magit-define-section-jumper")) + "\\)\\>[ \t'\(]*\\(\\sw+\\)?") + (1 font-lock-keyword-face) + (2 font-lock-function-name-face nil t)) + (,(concat "(" (regexp-opt + '("magit-with-section" + "magit-cmd-insert-section" + "magit-git-insert-section" + "magit-insert-line-section" + "magit-section-action" + "magit-section-case" + "magit-add-action-clauses" + "magit-bind-match-strings" + "magit-visiting-file-item" + "magit-tests--with-temp-dir" + "magit-tests--with-temp-repo" + "magit-tests--with-temp-clone") t) + "\\>") + . 1))) + "Magit expressions to highlight in Emacs-Lisp mode. +To highlight Magit expressions add something like this to your +init file: + + (require 'magit) + (font-lock-add-keywords 'emacs-lisp-mode + magit-font-lock-keywords)") + +(defun magit-version (&optional noerror) + "The version of Magit that you're using.\n\n\(fn)" + (interactive) + (let ((toplib (or load-file-name buffer-file-name))) + (unless (and toplib + (equal (file-name-nondirectory toplib) "magit.el")) + (setq toplib (locate-library "magit.el"))) + (when toplib + (let* ((dir (file-name-directory toplib)) + (static (expand-file-name "magit-version.el" dir)) + (gitdir (expand-file-name ".git" dir))) + (cond ((file-exists-p gitdir) + (setq magit-version + (let ((default-directory dir)) + (magit-git-string "describe" "--tags" "--dirty"))) + (ignore-errors (delete-file static))) + ((file-exists-p static) + (load-file static)) + ((featurep 'package) + (setq magit-version + (or (ignore-errors ; < 24.3.50 + (package-version-join + (package-desc-vers + (cdr (assq 'magit package-alist))))) + (ignore-errors ; >= 24.3.50 + (package-version-join + (package-desc-version + (cadr (assq 'magit package-alist))))))))))) + (if (stringp magit-version) + (when (called-interactively-p 'any) + (message "magit-%s" magit-version)) + (if noerror + (progn (setq magit-version 'error) + (message "Cannot determine Magit's version")) + (user-error "Cannot determine Magit's version"))) + magit-version)) + +(cl-eval-when (load eval) (magit-version t)) + +(define-obsolete-variable-alias 'magit-cherry-insert-sections-hook + 'magit-cherry-sections-hook "2.0.0") +(define-obsolete-variable-alias 'magit-status-insert-sections-hook + 'magit-status-sections-hook "2.0.0") +(define-obsolete-variable-alias 'magit-wazzup-insert-sections-hook + 'magit-wazzup-sections-hook "2.0.0") + +(define-obsolete-variable-alias 'magit-quote-curly-braces + 'magit-process-quote-curly-braces "2.0.0") + +(provide 'magit) + +;; rest of magit core +(require 'magit-key-mode) + +;; If `magit-log-edit' is available and `git-commit-mode' is not +;; loaded, then we have no choice but to assume the user actually +;; wants to use the former. +(unless (featurep 'git-commit-mode) + (require 'magit-log-edit nil t)) + +;; Local Variables: +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: +;;; magit.el ends here diff --git a/elpa/magit-20140807.909/magit.elc b/elpa/magit-20140807.909/magit.elc new file mode 100644 index 000000000..f9993639a Binary files /dev/null and b/elpa/magit-20140807.909/magit.elc differ diff --git a/elpa/magit-20140807.909/magit.info b/elpa/magit-20140807.909/magit.info new file mode 100644 index 000000000..02bf47ed9 --- /dev/null +++ b/elpa/magit-20140807.909/magit.info @@ -0,0 +1,1565 @@ +This is /tmp/magit30835t5i/magit-20140807.909/magit.info, produced by +makeinfo version 4.13 from /home/melpa/melpa/working/magit/magit.texi. + +INFO-DIR-SECTION Emacs +START-INFO-DIR-ENTRY +* Magit: (magit). Using Git from Emacs with Magit. +END-INFO-DIR-ENTRY + + Copyright (C) 2008-2013 Magit contributors. (See the header of +magit.el for the lengthy list of Magit contributors.) + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or any later version published by the Free Software + Foundation; with no Invariant Sections, with no Front-Cover Texts, + and with no Back-Cover Texts. A copy of the license is included + in the section entitled "GNU Free Documentation License". + + +File: magit.info, Node: Top, Next: Introduction, Up: (dir) + +Magit User Manual +***************** + +Magit is an interface to the version control system Git, implemented as +an Emacs extension. + + Unlike Emacs's native Version Control package which strives to +provide a unified interface to various version control systems, Magit +only supports Git and can therefor better take advantage of its native +features. + + Magit supports GNU Emacs 23.2 or later; 24.1 or later is recommended. +Magit supports Git 1.7.2.5 or later; 1.8.2 or later is recommended. +The minimal versions are those available in Debian oldstable. + + When something breaks please see the curated list of known issues +(https://github.com/magit/magit/wiki/Known-Issues) and the FAQ +(https://github.com/magit/magit/wiki/FAQ). If that doesn't help check +the list of all open issues issues +(https://github.com/magit/magit/issues). + + If everything else fails please open a new issue or ask for help on +the mailing list +(https://groups.google.com/forum/?fromgroups#!forum/magit). + +* Menu: + +* Introduction:: +* Acknowledgments:: +* Sections:: +* Status:: +* Untracked files:: +* Staging and Committing:: +* History:: +* Reflogs:: +* Commit Buffer:: +* Diffing:: +* Tagging:: +* Resetting:: +* Stashing:: +* Branches and Remotes:: +* Wazzup:: +* Merging:: +* Rebasing:: +* Interactive Rebasing:: +* Rewriting:: +* Pushing and Pulling:: +* Submodules:: +* Bisecting:: +* Finding commits not merged upstream:: +* Using Magit Extensions:: +* Using Git Directly:: +* GNU Free Documentation License:: + + +File: magit.info, Node: Introduction, Next: Acknowledgments, Prev: Top, Up: Top + +1 Introduction +************** + +With Magit, you can inspect and modify your Git repositories with +Emacs. You can review and commit the changes you have made to the +tracked files, for example, and you can browse the history of past +changes. There is support for cherry picking, reverting, merging, +rebasing, and other common Git operations. + + Magit is not a complete interface to Git; it just aims to make the +most common Git operations convenient. Thus, Magit will likely not +save you from learning Git itself. + + This manual provides a tour of many Magit features. It isn't an +introduction to version control in general, or to Git in particular. + + The main entry point to Magit is `M-x magit-status', which puts you +in Magit's status buffer. You will be using it frequently, so it is +probably a good idea to globally bind `magit-status' to a key of your +choice. + + In addition to the status buffer, Magit will also create buffers that +show lists of commits, buffers with diffs, and other kinds of buffers. +All these buffers are in a mode derived from `magit-mode' and have the +similar key bindings. Not all commands make sense in all contexts, but +a given key will do the same thing in different Magit buffers. + + Naturally, Magit runs the `git' command to do most of the work. The +`*magit-process*' buffer contains the transcript of the most recent +command. You can switch to it with `$'. + + +File: magit.info, Node: Acknowledgments, Next: Sections, Prev: Introduction, Up: Top + +2 Acknowledgments +***************** + +Our thank goes to all current and past contributors, Marius Vollmer who +started the project, and all retired and current maintainers, Phil +Jackson, Peter J. Weisberg, Rémi Vanicat, Nicolas Dudebout, Yann +Hodique, and Jonas Bernoulli. + + For a full list of contributors, see the AUTHORS.md file at the +top-level directory of this distribution or at +`https://github.com/magit/magit/tree/master/AUTHORS.md'. + + +File: magit.info, Node: Sections, Next: Status, Prev: Acknowledgments, Up: Top + +3 Sections +********** + +All Magit buffers are structured into nested 'sections'. These +sections can be hidden and shown individually. When a section is +hidden, only its first line is shown and all its children are +completely invisible. + + The most fine-grained way to control the visibility of sections is +the `TAB' key. It will to toggle the current section (the section that +contains point) between being hidden and being shown. + + Typing `S-TAB' toggles the visibility of the children of the current +section. When all of them are shown, they will all be hidden. +Otherwise, when some or all are hidden, they will all be shown. + + The digit keys `1', `2', `3', and `4' control the visibility of +sections based on levels. Hitting `2', for example, will show sections +on levels one and two, and will hide sections on level 3. However, +only sections that are a parent or child of the current section are +affected. + + For example, when the current section is on level 3 and you hit `1', +the grand-parent of the current section (which is on level one) will be +shown, and the parent of the current section (level 2) will be hidden. +The visibility of no other section will be changed. + + This sounds a bit complicated, but you'll figure it out. + + Using `M-1', `M-2', `M-3', and `M-4' is similar to the unmodified +digits, but now all sections on the respective level are affected, +regardless of whether or not they are related to the current section. + + For example, `M-1' will only show the first lines of the top-level +sections and will hide everything else. Typing `M-4' on the other hand +will show everything. + + Because of the way the status buffer is set up, some changes to +section visibility are more common than others. Files are on level 2 +and diff hunks are on level 4. Thus, you can type `2' to collapse the +diff of the current file, and `M-2' to collapse all files. This +returns the status buffer to its default setup and is a quick way to +unclutter it after drilling down into the modified files. + + Because `2' and `M-2' are so common in the status buffer, they are +bound to additional, more mnemonic keys: `M-h' (hide) and `M-H' (hide +all). Likewise `4' and `M-4' are also available as `M-s' (show) and +`M-S' (show all). + + In other buffers than the status buffer, `M-h', `M-H', `M-s', and +`M-S' might work on different levels than on 2 and 4, but they keep +their general meaning: `M-H' hides all detail, and `M-S' shows +everything. + + +File: magit.info, Node: Status, Next: Untracked files, Prev: Sections, Up: Top + +4 Status +******** + +Running `M-x magit-status' displays the main interface of Magit, the +status buffer. You can have multiple status buffers active at the same +time, each associated with its own Git repository. + + When invoking `M-x magit-status' from within a Git repository, it +will switch to the status buffer of that repository. Otherwise, it +will prompt for a directory. With a prefix argument, it will always +prompt. + + You can set `magit-repo-dirs' to customize how `magit-status' asks +for the repository to work on. When `magit-repo-dirs' is nil, +`magit-status' will simply ask for a directory. + + If you specify a directory that is not a Git repository, `M-x +magit-status' will offer to initialize it as one. + + When `magit-repo-dirs' is not nil, it is treated as a list of +directory names, and `magit-status' will find all Git repositories in +those directories and offer them for completion. (Magit will only look +`magit-repo-dirs-depth' levels deep, however.) + + With two prefix arguments, `magit-status' will always prompt for a +raw directory. + + Thus, you would normally set `magit-repo-dirs' to the places where +you keep most of your Git repositories and switch between them with +`C-u M-x magit-status'. If you want to go to a repository outside of +your normal working areas, or if you want to create a new repository, +you would use `C-u C-u M-x magit-status'. + + You need to explicitly refresh the status buffer when you have made +changes to the repository from outside of Emacs. You can type `g' in +the status buffer itself, or just use `M-x magit-status' instead of +`C-x b' when switching to it. You also need to refresh the status +buffer in this way after saving a file in Emacs. + + The header at the top of the status buffer shows a short summary of +the repository state: where it is located, which branch is checked out, +etc. Below the header are a number of sections that show details about +the working tree and the staging area. You can hide and show them as +described in the previous section. + + The first section shows _Untracked files_, if there are any. See +*note Untracked files:: for more details. + + The next two sections show your local changes. They are explained +fully in the next chapter, *note Staging and Committing::. + + If the current branch is associated with a remote tracking branch, +the status buffer shows the differences between the current branch and +the tracking branch. See *note Pushing and Pulling:: for more +information. + + During a history rewriting session, the status buffer shows the +_Pending changes_ and _Pending commits_ sections. See *note +Rewriting:: for more details. + + +File: magit.info, Node: Untracked files, Next: Staging and Committing, Prev: Status, Up: Top + +5 Untracked files +***************** + +Untracked files are shown in the _Untracked files_ section. + + You can add an untracked file to the staging area with `s'. If +point is on the _Untracked files_ section title when you hit `s', all +untracked files are staged. + + Typing `C-u S' anywhere will also stage all untracked files, +together with all changes to the tracked files. + + You can instruct Git to ignore them by typing `i'. This will add +the filename to the `.gitignore' file. Typing `C-u i' will ask you for +the name of the file to ignore. This is useful to ignore whole +directories, for example. In this case, the minibuffer's future history +(accessible with `M-n') contains predefined values (such as wildcards) +that might be of interest. If prefix argument is negative (for example +after typing `C-- i'), the prompt proposes wildcard by default. The +`I' command is similar to `i' but will add the file to +`.git/info/exclude' instead. + + To delete an untracked file forever, use `k'. If point is on the +_Untracked files_ section title when you hit `k', all untracked files +are deleted. + + +File: magit.info, Node: Staging and Committing, Next: History, Prev: Untracked files, Up: Top + +6 Staging and Committing +************************ + +Committing with Git is a two step process: first you add the changes +you want to commit to a 'staging area' or 'index', and then you commit +them to the repository. This allows you to only commit a subset of the +changes in the working tree. If you are not familiar with this concept +yet, then you should change that as soon as possible using one of the +fine Git tutorials. If you don't, then Git and by extension Magit will +seem rather strange. + + Magit shows uncommitted changes in two sections, depending on whether +the changes have been staged yet. The _Staged changes_ section shows +the changes that will be included in the next commit, while the +_Unstaged changes_ section shows the changes that will be left out. + + To move an unstaged hunk into the staging area, move point into the +hunk and type `s'. Likewise, to unstage a hunk, move point into it and +type `u'. If point is in a diff header when you type `s' or `u', all +hunks belonging to that diff are moved at the same time. + + Currently it is only possible to stage from the status buffer. +Staging and unstaging from diff buffers that show unstaged and staged +changes is not possible yet. + + If the region is active when you type `s' or `u', only the changes +in the region are staged or unstaged. (This works line by line: if the +beginning of a line is in the region it is included in the changes, +otherwise it is not.) + + To change the size of the hunks, you can type `+' or `-' to increase +and decrease, respectively. Typing `0' will reset the hunk size to the +default. + + Typing `C-u s' will ask you for a name of a file to be staged, for +example to stage files that are hidden. + + To move all hunks of all diffs into the staging area in one go, type +`S'. To unstage everything, type `U'. + + Typing `C-u S' will stage all untracked files in addition to the +changes to tracked files. + + You can discard uncommitted changes by moving point into a hunk and +typing `k'. The changes to discard are selected as with `s' and `u'. + + Before committing, you should write a short description of the +changes. + + Type `c c' to pop up a buffer where you can write your change +description. Once you are happy with the description, type `C-c C-c' +in that buffer to perform the commit. + + If you want to write changes in a `ChangeLog' file, you can use `C-x +4 a' on a diff hunk. + + Typing `c c' when the staging area is unused is a special situation. +Normally, the next commit would be empty, but you can configure Magit +to do something more useful by customizing the +`magit-commit-all-when-nothing-staged' variable. One choice is to +instruct the subsequent `C-c C-c' to commit all changes. Another +choice is stage everything at the time of hitting `c c'. + + Typing `M-n' or `M-p' will cycle through the +`log-edit-comment-ring', which will have your previous log messages. +This is particularly useful if you have a hook that occasionally causes +git to refuse your commit. + + To abort a commit use `C-c C-k'. The commit message is saved and +can later be retrieved in the commit message buffer using `M-p' and +`M-a'. + + Typing `C' will also pop up the change description buffer, but in +addition, it will try to insert a ChangeLog-style entry for the change +that point is in. + + +File: magit.info, Node: History, Next: Reflogs, Prev: Staging and Committing, Up: Top + +7 History +********* + +To show the repository history of your current head, type `l l'. A new +buffer will be shown that displays the history in a terse form. The +first paragraph of each commit message is displayed, next to a +representation of the relationships between commits. + + To show the repository history between two branches or between any +two points of the history, type `l r l'. You will be prompted to enter +references for starting point and ending point of the history range; you +can use auto-completion to specify them. A typical use case for ranged +history log display would be `l r l master RET new-feature RET' that +will display commits on the new-feature branch that are not in master; +these commits can then be inspected and cherry-picked, for example. + + More thorough filtering can be done by supplying `l' with one or +more suffix arguments, as displayed in its popup. `=g' ('Grep') for +example, limits the output to commits of which the log message matches +a specific string/regex. + + Typing `l L' (or `l C-u L') will show the log in a more verbose form. + + Magit will show only `magit-log-cutoff-length' entries. `e' will +show twice as many entries. `C-u e' will show all entries, and given a +numeric prefix argument, `e' will add this number of entries. + + You can move point to a commit and then cause various things to +happen with it. (The following commands work in any list of commits, +such as the one shown in the _Unpushed commits_ section.) + + Typing `RET' will pop up more information about the current commit +and move point into the new buffer. *Note Commit Buffer::. Typing +`SPC' and `DEL' will also show the information, but will scroll the new +buffer up or down (respectively) when typed again. + + Typing `a' will apply the current commit to your current branch. +This is useful when you are browsing the history of some other branch +and you want to `cherry-pick' some changes from it. A typical +situation is applying selected bug fixes from the development version +of a program to a release branch. The cherry-picked changes will not +be committed automatically; you need to do that explicitly. + + Typing `A' will cherry-pick the current commit and will also commit +the changes automatically when there have not been any conflicts. + + Typing `v' will revert the current commit. Thus, it will apply the +changes made by that commit in reverse. This is obviously useful to +cleanly undo changes that turned out to be wrong. As with `a', you +need to commit the changes explicitly. + + Typing `C-w' will copy the sha1 of the current commit into the kill +ring. + + Typing `=' will show the differences from the current commit to the +"marked" commit. + + You can mark the current commit by typing `.'. When the current +commit is already marked, typing `.' will unmark it. To unmark the +marked commit no matter where point is, use `C-u .'. + + Some commands, such as `=', will use the current commit and the +marked commit as implicit arguments. Other commands will offer the +marked commit as a default when prompting for their arguments. + + +File: magit.info, Node: Reflogs, Next: Commit Buffer, Prev: History, Up: Top + +8 Reflogs +********* + +You can use `l h' and `l H' to browse your _reflog_, the local history +of changes made to your repository heads. Typing `H' will ask for a +head, while `l h' will show the reflog of `HEAD'. + + The resulting buffer is just like the buffer produced by `l l' and +`l L' that shows the commit history. + + +File: magit.info, Node: Commit Buffer, Next: Diffing, Prev: Reflogs, Up: Top + +9 Commit Buffer +*************** + +When you view a commit (perhaps by selecting it in the log buffer, +*note History::), the "commit buffer" is displayed, showing you +information about the commit and letting you interact with it. + + By placing your cursor within the diff or hunk and typing `a', you +can apply the same patch to your working copy. This is useful when you +want to copy a change from another branch, but don't necessarily want +to cherry-pick the whole commit. + + By typing `v' you can apply the patch in reverse, removing all the +lines that were added and adding all the lines that were removed. This +is a convenient way to remove a change after determining that it +introduced a bug. + + If the commit message refers to any other commits in the repository +by their unique hash, the hash will be highlighted and you will be able +to visit the referenced commit either by clicking on it or by moving +your cursor onto it and pressing `RET'. + + The commit buffer maintains a history of the commits it has shown. +After visiting a referenced commit you can type `C-c C-b' to get back +to where you came from. To go forward in the history, type `C-c C-f'. +There are also `[back]' and `[forward]' buttons at the bottom of the +buffer. + + +File: magit.info, Node: Diffing, Next: Tagging, Prev: Commit Buffer, Up: Top + +10 Diffing +********** + +Magit typically shows diffs in the "unified" format. + + In any buffer that shows a diff, you can type `e' anywhere within +the diff to show the two versions of the file in Ediff. If the diff is +of a file in the status buffer that needs to be merged, you will be +able to use Ediff as an interactive merge tool. Otherwise, Ediff will +simply show the two versions of the file. + + To show the changes from your working tree to another revision, type +`d'. To show the changes between two arbitrary revisions, type `D'. + + You can use `a' within the diff output to apply the changes to your +working tree. As usual when point is in a diff header for a file, all +changes for that file are applied, and when it is in a hunk, only that +hunk is. When the region is active, the applied changes are restricted +to that region. + + Typing `v' will apply the selected changes in reverse. + + +File: magit.info, Node: Tagging, Next: Resetting, Prev: Diffing, Up: Top + +11 Tagging +********** + +Typing `t t' will make a lightweight tag. Typing `t a' will make an +annotated tag. It will put you in the normal `*magit-log-edit' buffer +for writing commit messages, but typing `C-c C-c' in it will make the +tag instead. This is controlled by the `Tag' field that will be added +to the `*magit-log-edit*' buffer. You can edit it, if you like. + + +File: magit.info, Node: Resetting, Next: Stashing, Prev: Tagging, Up: Top + +12 Resetting +************ + +Once you have added a commit to your local repository, you can not +change that commit anymore in any way. But you can reset your current +head to an earlier commit and start over. + + If you have published your history already, rewriting it in this way +can be confusing and should be avoided. However, rewriting your local +history is fine and it is often cleaner to fix mistakes this way than +by reverting commits (with `v', for example). + + Typing `x' will ask for a revision and reset your current head to +it. No changes will be made to your working tree and staging area. +Thus, the _Staged changes_ section in the status buffer will show the +changes that you have removed from your commit history. You can commit +the changes again as if you had just made them, thus rewriting history. + + Typing `x' while point is in a line that describes a commit will +offer this commit as the default revision to reset to. Thus, you can +move point to one of the commits in the _Unpushed commits_ section and +hit `x RET' to reset your current head to it. + + Type `X' to reset your working tree and staging area to the most +recently committed state. This will discard your local modifications, +so be careful. + + You can give a prefix to `x' if you want to reset both the current +head and your working tree to a given commit. This is the same as +first using an unprefixed `x' to reset only the head, and then using +`X'. + + +File: magit.info, Node: Stashing, Next: Branches and Remotes, Prev: Resetting, Up: Top + +13 Stashing +*********** + +You can create a new stash with `z z'. Your stashes will be listed in +the status buffer, and you can apply them with `a' and pop them with +`A'. To drop a stash, use `k'. + + With a prefix argument, both `a' and `A' will attempt to reinstate +the index as well as the working tree from the stash. + + Typing `z -k z' will create a stash just like `z z', but will leave +the changes in your working tree and index. This makes it easier to, +for example, test multiple variations of the same change. + + If you just want to make quick snapshots in between edits, you can +use `z s', which automatically enters a timestamp as description, and +keeps your working tree and index intact by default. + + You can visit and show stashes in the usual way: Typing `SPC' and +`DEL' will pop up a buffer with the description of the stash and scroll +it, typing `RET' will move point into that buffer. Using `C-u RET' +will move point into that buffer in other window. + + +File: magit.info, Node: Branches and Remotes, Next: Wazzup, Prev: Stashing, Up: Top + +14 Branches and Remotes +*********************** + +The current branch is indicated in the header of the status buffer. If +this branch is tracking a remote branch, the latter is also indicated. + + Branches and remotes can be manipulated directly with a popup menu or +through the branch manager. Using the popup menu allows you to quickly +make changes from any magit buffer. The branch manager is a separate +buffer called `*magit-branches*'. It displays information about +branches and remotes and offers a local key map for shorter key +bindings. The two interaction methods are described in more details +below. + +* Menu: + +* Branches Popup:: +* Remotes Popup:: +* Branches in the Branch Manager:: +* Remotes in the Branch Manager:: + + +File: magit.info, Node: Branches Popup, Next: Remotes Popup, Up: Branches and Remotes + +14.1 Branches Popup +=================== + +Typing `b' will display a popup menu to manipulate branches. + + You can switch to a different branch by typing `b b'. This will +immediately checkout the branch into your working copy, so you +shouldn't have any local modifications when switching branches. + + If you try to switch to a remote branch, Magit will offer to create a +local tracking branch for it instead. This way, you can easily start +working on new branches that have appeared in a remote repository. + + Typing `b b' while point is at a commit description will offer that +commit as the default to switch to. This will result in a detached +head. + + To create a new branch and switch to it immediately, type `b c'. + + To delete a branch, type `b k'. If you're currently on that branch, +Magit will offer to switch to the 'master' branch. + + Typing `b r' will let you rename a branch. Unless a branch with +the same name already exists, obviously... + + Deleting a branch is only possible if it's already fully merged into +HEAD or its upstream branch. Unless you type `b C-u k', that is. Here +be dragons... + + Typing `b v' will launch the branch manager. + + +File: magit.info, Node: Remotes Popup, Next: Branches in the Branch Manager, Prev: Branches Popup, Up: Branches and Remotes + +14.2 Remotes Popup +================== + +Typing `M' will display a popup menu to manipulate remotes. + + To add a new remote, type `M a'. + + To delete a remote type `M k'. + + Typing `M r' will let you rename a remote. + + +File: magit.info, Node: Branches in the Branch Manager, Next: Remotes in the Branch Manager, Prev: Remotes Popup, Up: Branches and Remotes + +14.3 Branches in the Branch Manager +=================================== + +In the branch manager, each branch is displayed on a separate line. The +current local branch is marked by a "#" in front of the name. Remote +branches are grouped by the remote they come from. + + If a local branch tracks a remote branch some extra information is +printed on the branch line. The format is the following: " +[ : ahead , behind ]". "" +is omitted if it is identical to "". "ahead" and "behind" +information are only displayed if necessary. + + To check out a branch, move your cursor to the desired branch and +press `RET'. + + Typing `c' will create a new branch. + + Typing `k' will delete the branch in the current line, and `C-u k' +deletes it even if it hasn't been merged into the current local branch. +Deleting works for both local and remote branches. + + Typing `r' on a branch will rename it. + + Typing `T' on a local branch, changes which remote branch it tracks. + + +File: magit.info, Node: Remotes in the Branch Manager, Prev: Branches in the Branch Manager, Up: Branches and Remotes + +14.4 Remotes in the Branch Manager +================================== + +In the branch manager, each remote is displayed on a separate line. The +format is the following " (, )". "" +is omitted if it is not set. The associated branches are listed under +this line. + + Typing `a' will add a new remote. + + Typing `k' will delete the remote in the current line. + + Typing `r' on a remote will rename it. + + +File: magit.info, Node: Wazzup, Next: Merging, Prev: Branches and Remotes, Up: Top + +15 Wazzup +********* + +Typing `w' will show a summary of how your other branches relate to the +current branch. + + For each branch, you will get a section that lists the commits in +that branch that are not in the current branch. The sections are +initially collapsed; you need to explicitly open them with `TAB' (or +similar) to show the lists of commits. + + When point is on a _N unmerged commits in ..._ title, the +corresponding branch will be offered as the default for a merge. + + Hitting `i' on a branch title will ignore this branch in the wazzup +view. You can use `C-u w' to show all branches, including the ignored +ones. Hitting `i' on an already ignored branch in that view will +unignore it. + + +File: magit.info, Node: Merging, Next: Rebasing, Prev: Wazzup, Up: Top + +16 Merging +********** + +Magit offers two ways to merge branches: manual and automatic. A +manual merge will apply all changes to your working tree and staging +area, but will not commit them, while an automatic merge will go ahead +and commit them immediately. + + Type `m m' to initiate merge. + + After initiating a merge, the header of the status buffer might +remind you that the next commit will be a merge commit (with more than +one parent). If you want to abort a manual merge, just do a hard reset +to HEAD with `X'. + + Merges can fail if the two branches you want to merge introduce +conflicting changes. In that case, the automatic merge stops before the +commit, essentially falling back to a manual merge. You need to resolve +the conflicts for example with `e' and stage the resolved files, for +example with `S'. + + You can not stage individual hunks one by one as you resolve them, +you can only stage whole files once all conflicts in them have been +resolved. + + +File: magit.info, Node: Rebasing, Next: Interactive Rebasing, Prev: Merging, Up: Top + +17 Rebasing +*********** + +Typing `R' in the status buffer will initiate a rebase or, if one is +already in progress, ask you how to continue. + + When a rebase is stopped in the middle because of a conflict, the +header of the status buffer will indicate how far along you are in the +series of commits that are being replayed. When that happens, you +should resolve the conflicts and stage everything and hit `R c' to +continue the rebase. Alternatively, hitting `c' or `C' while in the +middle of a rebase will also ask you whether to continue the rebase. + + Of course, you can initiate a rebase in any number of ways, by +configuring `git pull' to rebase instead of merge, for example. Such a +rebase can be finished with `R' as well. + + +File: magit.info, Node: Interactive Rebasing, Next: Rewriting, Prev: Rebasing, Up: Top + +18 Interactive Rebasing +*********************** + +Typing `E' in the status buffer will initiate an interactive rebase. +This is equivalent to running `git rebase --interactive' at the command +line. The `git-rebase-todo' file will be opened in an Emacs buffer for +you to edit. This file is opened using `emacsclient', so just edit +this file as you normally would, then call the `server-edit' function +(typically bound to `C-x #') to tell Emacs you are finished editing, +and the rebase will proceed as usual. + + If you have loaded `rebase-mode.el' (which is included in the Magit +distribution), the `git-rebase-todo' buffer will be in `rebase-mode'. +This mode disables normal text editing but instead provides single-key +commands (shown in the buffer) to perform all the edits that you would +normally do manually, including changing the operation to be performed +each commit ("pick", "squash", etc.), deleting (commenting out) commits +from the list, and reordering commits. You can finish editing the +buffer and proceed with the rebase by pressing `C-c C-c', which is +bound to `server-edit' in this mode, and you can abort the rebase with +`C-c C-k', just like when editing a commit message in Magit. + + +File: magit.info, Node: Rewriting, Next: Pushing and Pulling, Prev: Interactive Rebasing, Up: Top + +19 Rewriting +************ + +As hinted at earlier, you can rewrite your commit history. For +example, you can reset the current head to an earlier commit with `x'. +This leaves the working tree unchanged, and the status buffer will show +all the changes that have been made since that new value of the current +head. You can commit these changes again, possibly splitting them into +multiple commits as you go along. + + Amending your last commit is a common special case of rewriting +history like this. + + Another common way to rewrite history is to reset the head to an +earlier commit, and then to cherry pick the previous commits in a +different order. You could pick them from the reflog, for example. + + Magit has several commands that can simplify the book keeping +associated with rewriting. These commands all start with the `r' +prefix key. + + (Unless you already do so, we recommend that you don't use the +functionality described here. It is semi-deprecated and will be +removed once its unique features have been ported to the `git rebase +--interactive' workflow. Even now the latter is almost always the +better option.) + + Typing `r b' will start a rewrite operation. You will be prompted +for a _base_ commit. This commit and all subsequent commits up until +the current head are then put in a list of _Pending commits_, after +which the current head will be reset to the _parent_ of the base +commit. This can be configured to behave like `git rebase', i.e. +exclude the selected base commit from the rewrite operation, with the +`magit-rewrite-inclusive' variable. + + You would then typically use `a' and `A' to cherry pick commits from +the list of pending commits in the desired order, until all have been +applied. Magit shows which commits have been applied by changing their +marker from `*' to `.'. + + Using `A' will immediately commit the commit (as usual). If you +want to combine multiple previous commits into a single new one, use +`a' to apply them all to your working tree, and then commit them +together. + + Magit has no explicit support for rewriting merge commits. It will +happily include merge commits in the list of pending commits, but there +is no way of replaying them automatically. You have to redo the merge +explicitly. + + You can also use `v' to revert a commit when you have changed your +mind. This will change the `.' mark back to `*'. + + Once you are done with the rewrite, type `r s' to remove the book +keeping information from the status buffer. + + If you rather wish to start over, type `r a'. This will abort the +rewriting, resetting the current head back to the value it had before +the rewrite was started with `r b'. + + Typing `r f' will _finish_ the rewrite: it will apply all unused +commits one after the other, as if you would us `A' with all of them. + + You can change the `*' and `.' marks of a pending commit explicitly +with `r *' and `r .'. + + In addition to a list of pending commits, the status buffer will show +the _Pending changes_. This section shows the diff between the +original head and the current head. You can use it to review the +changes that you still need to rewrite, and you can apply hunks from +it, like from any other diff. + + +File: magit.info, Node: Pushing and Pulling, Next: Submodules, Prev: Rewriting, Up: Top + +20 Pushing and Pulling +********************** + +Magit will run `git push' when you type `P P'. If you give a prefix +argument to `P P', you will be prompted for the repository to push to. +When no default remote repository has been configured yet for the +current branch, you will be prompted as well. Typing `P P' will only +push the current branch to the remote. In other words, it will run +`git push '. The branch will be created in the remote +if it doesn't exist already. The local branch will be configured so +that it pulls from the new remote branch. If you give a double prefix +argument to `P P', you will be prompted in addition for the target +branch to push to. In other words, it will run `git push +:'. + + Typing `f f' will run `git fetch'. It will prompt for the name of +the remote to update if there is no default one. Typing `f o' will +always prompt for the remote. Typing `F F' will run `git pull'. When +you don't have a default branch configured to be pulled into the +current one, you will be asked for it. + + If there is a default remote repository for the current branch, Magit +will show that repository in the status buffer header. + + In this case, the status buffer will also have a _Unpushed commits_ +section that shows the commits on your current head that are not in the +branch named `/'. This section works just like the +history buffer: you can see details about a commit with `RET', compare +two of them with `.' and `=', and you can reset your current head to +one of them with `x', for example. If you want to push the changes +then type `P P'. + + When the remote branch has changes that are not in the current +branch, Magit shows them in a section called _Unpulled changes_. Typing +`F F' will fetch and merge them into the current branch. + + +File: magit.info, Node: Submodules, Next: Bisecting, Prev: Pushing and Pulling, Up: Top + +21 Submodules +************* + +`o u' + Update the submodules, with a prefix argument it will also + initialize them. + +`o i' + Initialize the submodules. + +`o b' + Update and initialize the submodules in one go (same as C-u o u). + +`o s' + Synchronizes submodules' remote URL configuration setting to the + value specified in .gitmodules. + + +File: magit.info, Node: Bisecting, Next: Finding commits not merged upstream, Prev: Submodules, Up: Top + +22 Bisecting +************ + +Magit supports bisecting by showing how many revisions and steps are +left to be tested in the status buffer. You can control the bisect +session from both the status and from log buffers with the `B' key menu. + + Typing `B s' will start a bisect session. You will be prompted for +a revision that is known to be bad (defaults to _HEAD_) and for a +revision that is known to be good (defaults to the revision at point if +there is one). git will select a revision for you to test, and Magit +will update its status buffer accordingly. + + You can tell git that the current revision is good with `B g', that +it is bad with `B b' or that git should skip it with `B k'. You can +also tell git to go into full automatic mode by giving it the name of a +script to run for each revision to test with `B u'. + + The current status can be shown as a log with `B l'. It contains +the revisions that have already been tested and your decisions about +their state. + + The revisions left to test can be visualized in gitk with `B v'. + + When you're finished bisecting you have to reset the session with `B +r'. + + +File: magit.info, Node: Finding commits not merged upstream, Next: Using Magit Extensions, Prev: Bisecting, Up: Top + +23 Finding commits not merged upstream +************************************** + +One of the comforts of git is that it can tell you which commits have +been merged upstream but not locally and vice versa. Git's sub-command +for this is `cherry' (not to be confused with `cherry-pick'). Magit +has support for this by invoking `magit-cherry' which is bound to `y' +by default. + + Magit will then ask you first for the upstream revision (which +defaults to the currently tracked remote branch if any) and the head +revision (which defaults to the current branch) to use in the +comparison. You will then see a new buffer in which all commits are +listed with a directional marker, their revision and the commit +message's first line. The directional marker is either `+' indicating +a commit that's present in upstream but not in head or `-' which +indicates a commit present in head but not in upstream. + + From this list you can use the usual key bindings for cherry-picking +individual commits (`a' for cherry-picking without committing and `A' +for the same plus the automatic commit). The buffer is refreshed +automatically after each cherry-pick. + + +File: magit.info, Node: Using Magit Extensions, Next: Using Git Directly, Prev: Finding commits not merged upstream, Up: Top + +24 Magit Extensions +******************* + +* Menu: + +* Activating extensions:: +* Interfacing with Subversion:: +* Interfacing with Topgit:: +* Interfacing with StGit:: + + +File: magit.info, Node: Activating extensions, Next: Interfacing with Subversion, Up: Using Magit Extensions + +24.1 Activating extensions +========================== + +Magit comes with a couple of shipped extensions that allow interaction +with `git-svn', `topgit' and `stgit'. See following sections for +specific details on how to use them. + + Extensions can be activated globally or on a per-repository basis. +Since those extensions are implemented as minor modes, one can use for +example `M-x magit-topgit-mode' to toggle the `topgit' extension, +making the corresponding section and commands (un)available. + + In order to do that automatically (and for every repository), one can +use for example: + + (add-hook 'magit-mode-hook 'turn-on-magit-topgit) + + Magit also allows configuring different extensions, based on the git +repository configuration. + + (add-hook 'magit-mode-hook 'magit-load-config-extensions) + + This will read git configuration variables and activate the relevant +extensions. + + For example, after running the following commands, the `topgit' +extension will be loaded for every repository, while the `svn' one will +be loaded only for the current one. + + $ git config --global --add magit.extension topgit + $ git config --add magit.extension svn + + Note the `--add' flag, which means that each extension gets its own +line in the `config' file. + + +File: magit.info, Node: Interfacing with Subversion, Next: Interfacing with Topgit, Prev: Activating extensions, Up: Using Magit Extensions + +24.2 Interfacing with Subversion +================================ + +Typing `N r' runs `git svn rebase', typing `N c' runs `git svn dcommit' +and typing `N f' runs `git svn fetch'. + + `N s' will prompt you for a (numeric, Subversion) revision and then +search for a corresponding Git sha1 for the commit. This is limited to +the path of the remote Subversion repository. With a prefix (`C-u N s' +the user will also be prompted for a branch to search in. + + +File: magit.info, Node: Interfacing with Topgit, Next: Interfacing with StGit, Prev: Interfacing with Subversion, Up: Using Magit Extensions + +24.3 Interfacing with Topgit +============================ + +Topgit (http://repo.or.cz/r/topgit.git) is a patch queue manager that +aims at being close as possible to raw Git, which makes it easy to use +with Magit. In particular, it does not require to use a different set +of commands for "commit", "update", and other operations. + + `magit-topgit.el' provides basic integration with Magit, mostly by +providing a "Topics" section. + + Topgit branches can be created the regular way, by using a "t/" +prefix by convention. So, creating a "t/foo" branch will actually +populate the "Topics" section with one more branch after committing +`.topdeps' and `.topmsg'. + + Also, the way we pull (see *note Pushing and Pulling::) such a +branch is slightly different, since it requires updating the various +dependencies of that branch. This should be mostly transparent, except +in case of conflicts. + + +File: magit.info, Node: Interfacing with StGit, Prev: Interfacing with Topgit, Up: Using Magit Extensions + +24.4 Interfacing with StGit +=========================== + +StGit (http://www.procode.org/stgit) is a Python application providing +similar functionality to Quilt (i.e. pushing/popping patches to/from a +stack) on top of Git. These operations are performed using Git +commands and the patches are stored as Git commit objects, allowing +easy merging of the StGit patches into other repositories using +standard Git functionality. + + `magit-stgit.el' provides basic integration with Magit, mostly by +providing a "Series" section, whose patches can be seen as regular +commits through the "visit" action. + + You can change the current patch in a series with the "apply" action, +as well as you can delete them using the "discard" action. + + Additionally, the `magit-stgit-refresh' and `magit-stgit-rebase' +commands let you perform the respective StGit operations. + + +File: magit.info, Node: Using Git Directly, Next: GNU Free Documentation License, Prev: Using Magit Extensions, Up: Top + +25 Using Git Directly +********************* + +For situations when Magit doesn't do everything you need, you can run +raw Git commands using `:'. This will prompt for a Git command, run +it, and refresh the status buffer. The output can be viewed by typing +`$'. + + +File: magit.info, Node: GNU Free Documentation License, Prev: Using Git Directly, Up: Top + +Appendix A GNU Free Documentation License +***************************************** + + Version 1.2, November 2002 + + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document "free" in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it + can be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + "Document", below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as "you". You + accept the license if you copy, modify or distribute the work in a + way requiring permission under copyright law. + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document's overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. If a section does not fit the above definition of + Secondary then it is not allowed to be designated as Invariant. + The Document may contain zero Invariant Sections. If the Document + does not identify any Invariant Sections then there are none. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup, or absence of + markup, has been arranged to thwart or discourage subsequent + modification by readers is not Transparent. An image format is + not Transparent if used for any substantial amount of text. A + copy that is not "Transparent" is called "Opaque". + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML, PostScript or PDF designed for + human modification. Examples of transparent image formats include + PNG, XCF and JPG. Opaque formats include proprietary formats that + can be read and edited only by proprietary word processors, SGML or + XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML, PostScript or PDF + produced by some word processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + A section "Entitled XYZ" means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + "Acknowledgements", "Dedications", "Endorsements", or "History".) + To "Preserve the Title" of such a section when you modify the + Document means that it remains a section "Entitled XYZ" according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document's license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a computer-network location from + which the general network-using public has access to download + using public-standard network protocols a complete Transparent + copy of the Document, free of added material. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of + previous versions (which should, if there were any, be listed + in the History section of the Document). You may use the + same title as a previous version if the original publisher of + that version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled "History", Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on + the Title Page. If there is no section Entitled "History" in + the Document, create one stating the title, year, authors, + and publisher of the Document as given on its Title Page, + then add an item describing the Modified Version as stated in + the previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in + the "History" section. You may omit a network location for a + work that was published at least four years before the + Document itself, or if the original publisher of the version + it refers to gives permission. + + K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the + section all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section + titles. + + M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + "Endorsements" or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section Entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties--for example, statements of peer review or that the text + has been approved by an organization as the authoritative + definition of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + "History" in the various original documents, forming one section + Entitled "History"; likewise combine any sections Entitled + "Acknowledgements", and any sections Entitled "Dedications". You + must delete all sections Entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, is called an "aggregate" if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation's users beyond what the individual + works permit. When the Document is included in an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document's Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled "Acknowledgements", + "Dedications", or "History", the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document 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. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation 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. See + `http://www.gnu.org/copyleft/'. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + + +Tag Table: +Node: Top795 +Node: Introduction2330 +Node: Acknowledgments3823 +Node: Sections4360 +Node: Status6910 +Node: Untracked files9649 +Node: Staging and Committing10854 +Node: History14259 +Node: Reflogs17441 +Node: Commit Buffer17845 +Node: Diffing19171 +Node: Tagging20158 +Node: Resetting20608 +Node: Stashing22132 +Node: Branches and Remotes23203 +Node: Branches Popup24024 +Node: Remotes Popup25286 +Node: Branches in the Branch Manager25637 +Node: Remotes in the Branch Manager26809 +Node: Wazzup27370 +Node: Merging28163 +Node: Rebasing29213 +Node: Interactive Rebasing30039 +Node: Rewriting31334 +Node: Pushing and Pulling34643 +Node: Submodules36573 +Node: Bisecting37021 +Node: Finding commits not merged upstream38256 +Node: Using Magit Extensions39522 +Node: Activating extensions39818 +Node: Interfacing with Subversion41203 +Node: Interfacing with Topgit41803 +Node: Interfacing with StGit42841 +Node: Using Git Directly43810 +Node: GNU Free Documentation License44198 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/elpa/paredit-20140128.1248/paredit-autoloads.el b/elpa/paredit-20140128.1248/paredit-autoloads.el new file mode 100644 index 000000000..b1d9a3b9f --- /dev/null +++ b/elpa/paredit-20140128.1248/paredit-autoloads.el @@ -0,0 +1,40 @@ +;;; paredit-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (enable-paredit-mode paredit-mode) "paredit" "paredit.el" +;;;;;; (21478 16660 0 0)) +;;; Generated autoloads from paredit.el + +(autoload 'paredit-mode "paredit" "\ +Minor mode for pseudo-structurally editing Lisp code. +With a prefix argument, enable Paredit Mode even if there are + unbalanced parentheses in the buffer. +Paredit behaves badly if parentheses are unbalanced, so exercise + caution when forcing Paredit Mode to be enabled, and consider + fixing unbalanced parentheses instead. +\\ + +\(fn &optional ARG)" t nil) + +(autoload 'enable-paredit-mode "paredit" "\ +Turn on pseudo-structural editing of Lisp code. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("paredit-pkg.el") (21478 16660 607181 +;;;;;; 0)) + +;;;*** + +(provide 'paredit-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; paredit-autoloads.el ends here diff --git a/elpa/paredit-20140128.1248/paredit-pkg.el b/elpa/paredit-20140128.1248/paredit-pkg.el new file mode 100644 index 000000000..5d1f5d55f --- /dev/null +++ b/elpa/paredit-20140128.1248/paredit-pkg.el @@ -0,0 +1 @@ +(define-package "paredit" "20140128.1248" "minor mode for editing parentheses" (quote nil)) diff --git a/elpa/paredit-20140128.1248/paredit-pkg.elc b/elpa/paredit-20140128.1248/paredit-pkg.elc new file mode 100644 index 000000000..5f771b1cf Binary files /dev/null and b/elpa/paredit-20140128.1248/paredit-pkg.elc differ diff --git a/elpa/paredit-20140128.1248/paredit.el b/elpa/paredit-20140128.1248/paredit.el new file mode 100644 index 000000000..7b151145e --- /dev/null +++ b/elpa/paredit-20140128.1248/paredit.el @@ -0,0 +1,2919 @@ +;;; paredit.el --- minor mode for editing parentheses -*- Mode: Emacs-Lisp -*- + +;; Copyright (C) 2005--2014 Taylor R. Campbell + +;; Author: Taylor R. Campbell +;; Version: 20140128.1248 +;; X-Original-Version: 24 (beta) +;; Created: 2005-07-31 +;; Keywords: lisp + +;; NOTE: THIS IS A BETA VERSION OF PAREDIT. USE AT YOUR OWN RISK. +;; THIS FILE IS SUBJECT TO CHANGE, AND NOT SUITABLE FOR DISTRIBUTION +;; BY PACKAGE MANAGERS SUCH AS APT, PKGSRC, MACPORTS, &C. + +;; Paredit 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. +;; +;; Paredit 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 paredit. If not, see . + +;;; The currently released version of paredit is available at +;;; . +;;; +;;; The latest beta version of paredit is available at +;;; . +;;; +;;; The Git repository for paredit is available at +;;; +;;; +;;; Release notes are available at +;;; . + +;;; Install paredit by placing `paredit.el' in `/path/to/elisp', a +;;; directory of your choice, and adding to your .emacs file: +;;; +;;; (add-to-list 'load-path "/path/to/elisp") +;;; (autoload 'enable-paredit-mode "paredit" +;;; "Turn on pseudo-structural editing of Lisp code." +;;; t) +;;; +;;; Start Paredit Mode on the fly with `M-x enable-paredit-mode RET', +;;; or always enable it in a major mode `M' (e.g., `lisp') with: +;;; +;;; (add-hook M-mode-hook 'enable-paredit-mode) +;;; +;;; Customize paredit using `eval-after-load': +;;; +;;; (eval-after-load 'paredit +;;; '(progn +;;; (define-key paredit-mode-map (kbd "ESC M-A-C-s-)") +;;; 'paredit-dwim))) +;;; +;;; Send questions, bug reports, comments, feature suggestions, &c., +;;; via email to the author's surname at mumble.net. +;;; +;;; Paredit should run in GNU Emacs 21 or later and XEmacs 21.5.28 or +;;; later. + +;;; The paredit minor mode, Paredit Mode, binds common character keys, +;;; such as `(', `)', `"', and `\', to commands that carefully insert +;;; S-expression structures in the buffer: +;;; +;;; ( inserts `()', leaving the point in the middle; +;;; ) moves the point over the next closing delimiter; +;;; " inserts `""' if outside a string, or inserts an escaped +;;; double-quote if in the middle of a string, or moves over the +;;; closing double-quote if at the end of a string; and +;;; \ prompts for the character to escape, to avoid inserting lone +;;; backslashes that may break structure. +;;; +;;; In comments, these keys insert themselves. If necessary, you can +;;; insert these characters literally outside comments by pressing +;;; `C-q' before these keys, in case a mistake has broken the +;;; structure. +;;; +;;; These key bindings are designed so that when typing new code in +;;; Paredit Mode, you can generally type exactly the same sequence of +;;; keys you would have typed without Paredit Mode. +;;; +;;; Paredit Mode also binds common editing keys, such as `DEL', `C-d', +;;; and `C-k', to commands that respect S-expression structures in the +;;; buffer: +;;; +;;; DEL deletes the previous character, unless it is a delimiter: DEL +;;; will move the point backward over a closing delimiter, and +;;; will delete a delimiter pair together if between an open and +;;; closing delimiter; +;;; +;;; C-d deletes the next character in much the same manner; and +;;; +;;; C-k kills all S-expressions that begin anywhere between the point +;;; and the end of the line or the closing delimiter of the +;;; enclosing list, whichever is first. +;;; +;;; If necessary, you can delete a character, kill a line, &c., +;;; irrespective of S-expression structure, by pressing `C-u' before +;;; these keys, in case a mistake has broken the structure. +;;; +;;; Finally, Paredit Mode binds some keys to complex S-expression +;;; editing operations. For example, `C-' makes the enclosing +;;; list slurp up an S-expression to its right (here `|' denotes the +;;; point): +;;; +;;; (foo (bar | baz) quux) C- (foo (bar | baz quux)) +;;; +;;; Some paredit commands automatically reindent code. When they do, +;;; they try to indent as locally as possible, to avoid interfering +;;; with any indentation you might have manually written. Only the +;;; advanced S-expression manipulation commands automatically reindent, +;;; and only the forms that they immediately operated upon (and their +;;; subforms). +;;; +;;; This code is written for clarity, not efficiency. It frequently +;;; walks over S-expressions redundantly. If you have problems with +;;; the time it takes to execute some of the commands, let me know. + +;;; This assumes Unix-style LF line endings. + +(defconst paredit-version 24) +(defconst paredit-beta-p t) + +(eval-and-compile + + (defun paredit-xemacs-p () + ;; No idea where I got this definition from. Edward O'Connor + ;; (hober in #emacs) suggested the current definition. + ;; (and (boundp 'running-xemacs) + ;; running-xemacs) + (featurep 'xemacs)) + + (defun paredit-gnu-emacs-p () + ;++ This could probably be improved. + (not (paredit-xemacs-p))) + + (defmacro xcond (&rest clauses) + "Exhaustive COND. +Signal an error if no clause matches." + `(cond ,@clauses + (t (error "XCOND lost.")))) + + (defalias 'paredit-warn (if (fboundp 'warn) 'warn 'message)) + + (defvar paredit-sexp-error-type + (with-temp-buffer + (insert "(") + (condition-case condition + (backward-sexp) + (error (if (eq (car condition) 'error) + (paredit-warn "%s%s%s%s%s" + "Paredit is unable to discriminate" + " S-expression parse errors from" + " other errors. " + " This may cause obscure problems. " + " Please upgrade Emacs.")) + (car condition))))) + + (defmacro paredit-handle-sexp-errors (body &rest handler) + `(condition-case () + ,body + (,paredit-sexp-error-type ,@handler))) + + (put 'paredit-handle-sexp-errors 'lisp-indent-function 1) + + (defmacro paredit-ignore-sexp-errors (&rest body) + `(paredit-handle-sexp-errors (progn ,@body) + nil)) + + (put 'paredit-ignore-sexp-errors 'lisp-indent-function 0) + + (defmacro paredit-preserving-column (&rest body) + "Evaluate BODY and restore point to former column, relative to code. +Assumes BODY will change only indentation. +If point was on code, it moves with the code. +If point was on indentation, it stays in indentation." + (let ((column (make-symbol "column")) + (indentation (make-symbol "indentation"))) + `(let ((,column (current-column)) + (,indentation (paredit-current-indentation))) + (let ((value (progn ,@body))) + (paredit-restore-column ,column ,indentation) + value)))) + + (put 'paredit-preserving-column 'lisp-indent-function 0) + + nil) + +;;;; Minor Mode Definition + +(defvar paredit-mode-map (make-sparse-keymap) + "Keymap for the paredit minor mode.") + +(defvar paredit-override-check-parens-function + (lambda (condition) condition nil) + "Function to tell whether unbalanced text should inhibit Paredit Mode.") + +;;;###autoload +(define-minor-mode paredit-mode + "Minor mode for pseudo-structurally editing Lisp code. +With a prefix argument, enable Paredit Mode even if there are + unbalanced parentheses in the buffer. +Paredit behaves badly if parentheses are unbalanced, so exercise + caution when forcing Paredit Mode to be enabled, and consider + fixing unbalanced parentheses instead. +\\" + :lighter " Paredit" + ;; Setting `paredit-mode' to false here aborts enabling Paredit Mode. + (if (and paredit-mode + (not current-prefix-arg)) + (condition-case condition + (check-parens) + (error + (if (not (funcall paredit-override-check-parens-function condition)) + (progn (setq paredit-mode nil) + (signal (car condition) (cdr condition)))))))) + +(defun paredit-override-check-parens-interactively (condition) + (y-or-n-p (format "Enable Paredit Mode despite condition %S? " condition))) + +;;;###autoload +(defun enable-paredit-mode () + "Turn on pseudo-structural editing of Lisp code." + (interactive) + (paredit-mode +1)) + +(defun disable-paredit-mode () + "Turn off pseudo-structural editing of Lisp code." + (interactive) + (paredit-mode -1)) + +(defvar paredit-backward-delete-key + (xcond ((paredit-xemacs-p) "BS") + ((paredit-gnu-emacs-p) "DEL"))) + +(defvar paredit-forward-delete-keys + (xcond ((paredit-xemacs-p) '("DEL")) + ((paredit-gnu-emacs-p) '("" "")))) + +;;;; Paredit Keys + +;;; Separating the definition and initialization of this variable +;;; simplifies the development of paredit, since re-evaluating DEFVAR +;;; forms doesn't actually do anything. + +(defvar paredit-commands nil + "List of paredit commands with their keys and examples.") + +;;; Each specifier is of the form: +;;; (key[s] function (example-input example-output) ...) +;;; where key[s] is either a single string suitable for passing to KBD +;;; or a list of such strings. Entries in this list may also just be +;;; strings, in which case they are headings for the next entries. + +(progn (setq paredit-commands + `( + "Basic Insertion Commands" + ("(" paredit-open-round + ("(a b |c d)" + "(a b (|) c d)") + ("(foo \"bar |baz\" quux)" + "(foo \"bar (|baz\" quux)")) + (")" paredit-close-round + ("(a b |c )" "(a b c)|") + ("; Hello,| world!" + "; Hello,)| world!")) + ("M-)" paredit-close-round-and-newline + ("(defun f (x| ))" + "(defun f (x)\n |)") + ("; (Foo.|" + "; (Foo.)|")) + ("[" paredit-open-square + ("(a b |c d)" + "(a b [|] c d)") + ("(foo \"bar |baz\" quux)" + "(foo \"bar [|baz\" quux)")) + ("]" paredit-close-square + ("(define-key keymap [frob| ] 'frobnicate)" + "(define-key keymap [frob]| 'frobnicate)") + ("; [Bar.|" + "; [Bar.]|")) + + ("\"" paredit-doublequote + ("(frob grovel |full lexical)" + "(frob grovel \"|\" full lexical)" + "(frob grovel \"\"| full lexical)") + ("(foo \"bar |baz\" quux)" + "(foo \"bar \\\"|baz\" quux)") + ("(frob grovel) ; full |lexical" + "(frob grovel) ; full \"|lexical")) + ("M-\"" paredit-meta-doublequote + ("(foo \"bar |baz\" quux)" + "(foo \"bar baz\"| quux)") + ("(foo |(bar #\\x \"baz \\\\ quux\") zot)" + ,(concat "(foo \"|(bar #\\\\x \\\"baz \\\\" + "\\\\ quux\\\")\" zot)"))) + ("\\" paredit-backslash + ("(string #|)\n ; Character to escape: x" + "(string #\\x|)") + ("\"foo|bar\"\n ; Character to escape: \"" + "\"foo\\\"|bar\"")) + (";" paredit-semicolon + ("|(frob grovel)" + ";|(frob grovel)") + ("(frob |grovel)" + "(frob ;|grovel\n )") + ("(frob |grovel (bloit\n zargh))" + "(frob ;|grovel\n (bloit\n zargh))") + ("(frob grovel) |" + "(frob grovel) ;|")) + ("M-;" paredit-comment-dwim + ("(foo |bar) ; baz" + "(foo bar) ; |baz") + ("(frob grovel)|" + "(frob grovel) ;|") + ("(zot (foo bar)\n|\n (baz quux))" + "(zot (foo bar)\n ;; |\n (baz quux))") + ("(zot (foo bar) |(baz quux))" + "(zot (foo bar)\n ;; |\n (baz quux))") + ("|(defun hello-world ...)" + ";;; |\n(defun hello-world ...)")) + + ("C-j" paredit-newline + ("(let ((n (frobbotz))) |(display (+ n 1)\nport))" + ,(concat "(let ((n (frobbotz)))" + "\n |(display (+ n 1)" + "\n port))"))) + + "Deleting & Killing" + (("C-d" ,@paredit-forward-delete-keys) + paredit-forward-delete + ("(quu|x \"zot\")" "(quu| \"zot\")") + ("(quux |\"zot\")" + "(quux \"|zot\")" + "(quux \"|ot\")") + ("(foo (|) bar)" "(foo | bar)") + ("|(foo bar)" "(|foo bar)")) + (,paredit-backward-delete-key + paredit-backward-delete + ("(\"zot\" q|uux)" "(\"zot\" |uux)") + ("(\"zot\"| quux)" + "(\"zot|\" quux)" + "(\"zo|\" quux)") + ("(foo (|) bar)" "(foo | bar)") + ("(foo bar)|" "(foo bar|)")) + ("C-k" paredit-kill + ("(foo bar)| ; Useless comment!" + "(foo bar)|") + ("(|foo bar) ; Useful comment!" + "(|) ; Useful comment!") + ("|(foo bar) ; Useless line!" + "|") + ("(foo \"|bar baz\"\n quux)" + "(foo \"|\"\n quux)")) + ("M-d" paredit-forward-kill-word + ("|(foo bar) ; baz" + "(| bar) ; baz" + "(|) ; baz" + "() ;|") + (";;;| Frobnicate\n(defun frobnicate ...)" + ";;;|\n(defun frobnicate ...)" + ";;;\n(| frobnicate ...)")) + (,(concat "M-" paredit-backward-delete-key) + paredit-backward-kill-word + ("(foo bar) ; baz\n(quux)|" + "(foo bar) ; baz\n(|)" + "(foo bar) ; |\n()" + "(foo |) ; \n()" + "(|) ; \n()")) + + "Movement & Navigation" + ("C-M-f" paredit-forward + ("(foo |(bar baz) quux)" + "(foo (bar baz)| quux)") + ("(foo (bar)|)" + "(foo (bar))|")) + ("C-M-b" paredit-backward + ("(foo (bar baz)| quux)" + "(foo |(bar baz) quux)") + ("(|(foo) bar)" + "|((foo) bar)")) + ("C-M-u" paredit-backward-up) + ("C-M-d" paredit-forward-down) + ("C-M-p" paredit-backward-down) ; Built-in, these are FORWARD- + ("C-M-n" paredit-forward-up) ; & BACKWARD-LIST, which have + ; no need given C-M-f & C-M-b. + + "Depth-Changing Commands" + ("M-(" paredit-wrap-round + ("(foo |bar baz)" + "(foo (|bar) baz)")) + ("M-s" paredit-splice-sexp + ("(foo (bar| baz) quux)" + "(foo bar| baz quux)")) + (("M-" "ESC ") + paredit-splice-sexp-killing-backward + ("(foo (let ((x 5)) |(sqrt n)) bar)" + "(foo |(sqrt n) bar)")) + (("M-" "ESC ") + paredit-splice-sexp-killing-forward + ("(a (b c| d e) f)" + "(a b c| f)")) + ("M-r" paredit-raise-sexp + ("(dynamic-wind in (lambda () |body) out)" + "(dynamic-wind in |body out)" + "|body")) + ("M-?" paredit-convolute-sexp + ("(let ((x 5) (y 3)) (frob |(zwonk)) (wibblethwop))" + "(frob |(let ((x 5) (y 3)) (zwonk) (wibblethwop)))")) + + "Barfage & Slurpage" + (("C-)" "C-") + paredit-forward-slurp-sexp + ("(foo (bar |baz) quux zot)" + "(foo (bar |baz quux) zot)") + ("(a b ((c| d)) e f)" + "(a b ((c| d) e) f)")) + (("C-}" "C-") + paredit-forward-barf-sexp + ("(foo (bar |baz quux) zot)" + "(foo (bar |baz) quux zot)")) + (("C-(" "C-M-" "ESC C-") + paredit-backward-slurp-sexp + ("(foo bar (baz| quux) zot)" + "(foo (bar baz| quux) zot)") + ("(a b ((c| d)) e f)" + "(a (b (c| d)) e f)")) + (("C-{" "C-M-" "ESC C-") + paredit-backward-barf-sexp + ("(foo (bar baz |quux) zot)" + "(foo bar (baz |quux) zot)")) + + "Miscellaneous Commands" + ("M-S" paredit-split-sexp + ("(hello| world)" + "(hello)| (world)") + ("\"Hello, |world!\"" + "\"Hello, \"| \"world!\"")) + ("M-J" paredit-join-sexps + ("(hello)| (world)" + "(hello| world)") + ("\"Hello, \"| \"world!\"" + "\"Hello, |world!\"") + ("hello-\n| world" + "hello-|world")) + ("C-c C-M-l" paredit-recenter-on-sexp) + ("M-q" paredit-reindent-defun) + )) + nil) ; end of PROGN + +;;;;; Command Examples + +(eval-and-compile + (defmacro paredit-do-commands (vars string-case &rest body) + (let ((spec (nth 0 vars)) + (keys (nth 1 vars)) + (fn (nth 2 vars)) + (examples (nth 3 vars))) + `(dolist (,spec paredit-commands) + (if (stringp ,spec) + ,string-case + (let ((,keys (let ((k (car ,spec))) + (cond ((stringp k) (list k)) + ((listp k) k) + (t (error "Invalid paredit command %s." + ,spec))))) + (,fn (cadr ,spec)) + (,examples (cddr ,spec))) + ,@body))))) + + (put 'paredit-do-commands 'lisp-indent-function 2)) + +(defun paredit-define-keys () + (paredit-do-commands (spec keys fn examples) + nil ; string case + (dolist (key keys) + (define-key paredit-mode-map (read-kbd-macro key) fn)))) + +(defun paredit-function-documentation (fn) + (let ((original-doc (get fn 'paredit-original-documentation)) + (doc (documentation fn 'function-documentation))) + (or original-doc + (progn (put fn 'paredit-original-documentation doc) + doc)))) + +(defun paredit-annotate-mode-with-examples () + (let ((contents + (list (paredit-function-documentation 'paredit-mode)))) + (paredit-do-commands (spec keys fn examples) + (push (concat "\n \n" spec "\n") + contents) + (let ((name (symbol-name fn))) + (if (string-match (symbol-name 'paredit-) name) + (push (concat "\n\n\\[" name "]\t" name + (if examples + (mapconcat (lambda (example) + (concat + "\n" + (mapconcat 'identity + example + "\n --->\n") + "\n")) + examples + "") + "\n (no examples)\n")) + contents)))) + (put 'paredit-mode 'function-documentation + (apply 'concat (reverse contents)))) + ;; PUT returns the huge string we just constructed, which we don't + ;; want it to return. + nil) + +(defun paredit-annotate-functions-with-examples () + (paredit-do-commands (spec keys fn examples) + nil ; string case + (put fn 'function-documentation + (concat (paredit-function-documentation fn) + "\n\n\\\\[" (symbol-name fn) "]\n" + (mapconcat (lambda (example) + (concat "\n" + (mapconcat 'identity + example + "\n ->\n") + "\n")) + examples + ""))))) + +;;;;; HTML Examples + +(defun paredit-insert-html-examples () + "Insert HTML for a paredit quick reference table." + (interactive) + (let ((insert-lines + (lambda (&rest lines) (dolist (line lines) (insert line) (newline)))) + (initp nil)) + (paredit-do-commands (spec keys fn examples) + (progn (if initp + (funcall insert-lines "") + (setq initp t)) + (funcall insert-lines (concat "

" spec "

")) + (funcall insert-lines "")) + (let ((name (symbol-name fn)) + (keys + (mapconcat (lambda (key) + (concat "" (paredit-html-quote key) "")) + keys + ", "))) + (funcall insert-lines "") + (funcall insert-lines (concat " ")) + (funcall insert-lines (concat " ")) + (funcall insert-lines "") + (funcall insert-lines + ""))) + (funcall insert-lines "
" keys "" name "
") + (dolist (example examples) + (let ((prefix "")) + (funcall insert-lines (concat prefix examples suffix)))) + (funcall insert-lines "
" + "" + "
")
+                (examples
+                 (mapconcat 'paredit-html-quote
+                            example
+                            (concat "
")))
+                (suffix "
"))) + +(defun paredit-html-quote (string) + (with-temp-buffer + (dotimes (i (length string)) + (insert (let ((c (elt string i))) + (cond ((eq c ?\<) "<") + ((eq c ?\>) ">") + ((eq c ?\&) "&") + ((eq c ?\') "'") + ((eq c ?\") """) + (t c))))) + (buffer-string))) + +;;;; Delimiter Insertion + +(eval-and-compile + (defun paredit-conc-name (&rest strings) + (intern (apply 'concat strings))) + + (defmacro define-paredit-pair (open close name) + `(progn + (defun ,(paredit-conc-name "paredit-open-" name) (&optional n) + ,(concat "Insert a balanced " name " pair. +With a prefix argument N, put the closing " name " after N + S-expressions forward. +If the region is active, `transient-mark-mode' is enabled, and the + region's start and end fall in the same parenthesis depth, insert a + " name " pair around the region. +If in a string or a comment, insert a single " name ". +If in a character literal, do nothing. This prevents changing what was + in the character literal to a meaningful delimiter unintentionally.") + (interactive "P") + (cond ((or (paredit-in-string-p) + (paredit-in-comment-p)) + (insert ,open)) + ((not (paredit-in-char-p)) + (paredit-insert-pair n ,open ,close 'goto-char) + (save-excursion (backward-up-list) (indent-sexp))))) + (defun ,(paredit-conc-name "paredit-close-" name) () + ,(concat "Move past one closing delimiter and reindent. +\(Agnostic to the specific closing delimiter.) +If in a string or comment, insert a single closing " name ". +If in a character literal, do nothing. This prevents changing what was + in the character literal to a meaningful delimiter unintentionally.") + (interactive) + (paredit-move-past-close ,close)) + (defun ,(paredit-conc-name "paredit-close-" name "-and-newline") () + ,(concat "Move past one closing delimiter, add a newline," + " and reindent. +If there was a margin comment after the closing delimiter, preserve it + on the same line.") + (interactive) + (paredit-move-past-close-and-newline ,close)) + (defun ,(paredit-conc-name "paredit-wrap-" name) + (&optional argument) + ,(concat "Wrap the following S-expression. +See `paredit-wrap-sexp' for more details.") + (interactive "P") + (paredit-wrap-sexp argument ,open ,close)) + (add-to-list 'paredit-wrap-commands + ',(paredit-conc-name "paredit-wrap-" name))))) + +(defvar paredit-wrap-commands '(paredit-wrap-sexp) + "List of paredit commands that wrap S-expressions. +Used by `paredit-yank-pop'; for internal paredit use only.") + +(define-paredit-pair ?\( ?\) "round") +(define-paredit-pair ?\[ ?\] "square") +(define-paredit-pair ?\{ ?\} "curly") +(define-paredit-pair ?\< ?\> "angled") + +;;; Aliases for the old names. + +(defalias 'paredit-open-parenthesis 'paredit-open-round) +(defalias 'paredit-close-parenthesis 'paredit-close-round) +(defalias 'paredit-close-parenthesis-and-newline + 'paredit-close-round-and-newline) + +(defalias 'paredit-open-bracket 'paredit-open-square) +(defalias 'paredit-close-bracket 'paredit-close-square) +(defalias 'paredit-close-bracket-and-newline + 'paredit-close-square-and-newline) + +(defun paredit-move-past-close (close) + (paredit-move-past-close-and close + (lambda () + (paredit-blink-paren-match nil)))) + +(defun paredit-move-past-close-and-newline (close) + (paredit-move-past-close-and close + (lambda () + (let ((comment.point (paredit-find-comment-on-line))) + (newline) + (if comment.point + (save-excursion + (forward-line -1) + (end-of-line) + (indent-to (cdr comment.point)) + (insert (car comment.point))))) + (lisp-indent-line) + (paredit-ignore-sexp-errors (indent-sexp)) + (paredit-blink-paren-match t)))) + +(defun paredit-move-past-close-and (close if-moved) + (if (or (paredit-in-string-p) + (paredit-in-comment-p)) + (insert close) + (if (paredit-in-char-p) (forward-char)) + (paredit-move-past-close-and-reindent close) + (funcall if-moved))) + +(defun paredit-find-comment-on-line () + "Find a margin comment on the current line. +Return nil if there is no such comment or if there is anything but + whitespace until such a comment. +If such a comment exists, delete the comment (including all leading + whitespace) and return a cons whose car is the comment as a string + and whose cdr is the point of the comment's initial semicolon, + relative to the start of the line." + (save-excursion + (paredit-skip-whitespace t (point-at-eol)) + (and (eq ?\; (char-after)) + (not (eq ?\; (char-after (1+ (point))))) + (not (or (paredit-in-string-p) + (paredit-in-char-p))) + (let* ((start ;Move to before the semicolon. + (progn (backward-char) (point))) + (comment + (buffer-substring start (point-at-eol)))) + (paredit-skip-whitespace nil (point-at-bol)) + (delete-region (point) (point-at-eol)) + (cons comment (- start (point-at-bol))))))) + +(defun paredit-insert-pair (n open close forward) + (let* ((regionp + (and (paredit-region-active-p) + (paredit-region-safe-for-insert-p))) + (end + (and regionp + (not n) + (prog1 (region-end) (goto-char (region-beginning)))))) + (let ((spacep (paredit-space-for-delimiter-p nil open))) + (if spacep (insert " ")) + (insert open) + (save-excursion + ;; Move past the desired region. + (cond (n + (funcall forward + (paredit-scan-sexps-hack (point) + (prefix-numeric-value n)))) + (regionp + (funcall forward (+ end (if spacep 2 1))))) + ;; The string case can happen if we are inserting string + ;; delimiters. The comment case may happen by moving to the + ;; end of a buffer that has a comment with no trailing newline. + (if (and (not (paredit-in-string-p)) + (paredit-in-comment-p)) + (newline)) + (insert close) + (if (paredit-space-for-delimiter-p t close) + (insert " ")))))) + +;++ This needs a better name... + +(defun paredit-scan-sexps-hack (point n) + (save-excursion + (goto-char point) + (let ((direction (if (< 0 n) +1 -1)) + (magnitude (abs n)) + (count 0)) + (catch 'exit + (while (< count magnitude) + (let ((p + (paredit-handle-sexp-errors (scan-sexps (point) direction) + nil))) + (if (not p) (throw 'exit nil)) + (goto-char p)) + (setq count (+ count 1))))) + (point))) + +(defun paredit-region-safe-for-insert-p () + (save-excursion + (let ((beginning (region-beginning)) + (end (region-end))) + (goto-char beginning) + (let* ((beginning-state (paredit-current-parse-state)) + (end-state + (parse-partial-sexp beginning end nil nil beginning-state))) + (and (= (nth 0 beginning-state) ; 0. depth in parens + (nth 0 end-state)) + (eq (nth 3 beginning-state) ; 3. non-nil if inside a + (nth 3 end-state)) ; string + (eq (nth 4 beginning-state) ; 4. comment status, yada + (nth 4 end-state)) + (eq (nth 5 beginning-state) ; 5. t if following char + (nth 5 end-state))))))) ; quote + +(defvar paredit-space-for-delimiter-predicates nil + "List of predicates for whether to put space by delimiter at point. +Each predicate is a function that is is applied to two arguments, ENDP + and DELIMITER, and that returns a boolean saying whether to put a + space next to the delimiter -- before the delimiter if ENDP is false, + after the delimiter if ENDP is true. +If any predicate returns false, no space is inserted: every predicate + has veto power. +Each predicate may assume that the point is not at the beginning of the + buffer, if ENDP is false, or at the end of the buffer, if ENDP is + true; and that the point is not preceded, if ENDP is false, or + followed, if ENDP is true, by a word or symbol constituent, a quote, + or the delimiter matching DELIMITER. +Each predicate should examine only text before the point, if ENDP is + false, or only text after the point, if ENDP is true.") + +(defun paredit-space-for-delimiter-p (endp delimiter) + ;; If at the buffer limit, don't insert a space. If there is a word, + ;; symbol, other quote, or non-matching parenthesis delimiter (i.e. a + ;; close when want an open the string or an open when we want to + ;; close the string), do insert a space. + (and (not (if endp (eobp) (bobp))) + (memq (char-syntax (if endp (char-after) (char-before))) + (list ?w ?_ ?\" + (let ((matching (matching-paren delimiter))) + (and matching (char-syntax matching))) + (and (not endp) + (eq ?\" (char-syntax delimiter)) + ?\) ))) + (catch 'exit + (dolist (predicate paredit-space-for-delimiter-predicates) + (if (not (funcall predicate endp delimiter)) + (throw 'exit nil))) + t))) + +(defun paredit-move-past-close-and-reindent (close) + (let ((open (paredit-missing-close))) + (if open + (if (eq close (matching-paren open)) + (save-excursion + (message "Missing closing delimiter: %c" close) + (insert close)) + (error "Mismatched missing closing delimiter: %c ... %c" + open close)))) + (up-list) + (if (catch 'return ; This CATCH returns T if it + (while t ; should delete leading spaces + (save-excursion ; and NIL if not. + (let ((before-paren (1- (point)))) + (back-to-indentation) + (cond ((not (eq (point) before-paren)) + ;; Can't call PAREDIT-DELETE-LEADING-WHITESPACE + ;; here -- we must return from SAVE-EXCURSION + ;; first. + (throw 'return t)) + ((save-excursion (forward-line -1) + (end-of-line) + (paredit-in-comment-p)) + ;; Moving the closing delimiter any further + ;; would put it into a comment, so we just + ;; indent the closing delimiter where it is and + ;; abort the loop, telling its continuation that + ;; no leading whitespace should be deleted. + (lisp-indent-line) + (throw 'return nil)) + (t (delete-indentation))))))) + (paredit-delete-leading-whitespace))) + +(defun paredit-missing-close () + (save-excursion + (paredit-handle-sexp-errors (backward-up-list) + (error "Not inside a list.")) + (let ((open (char-after))) + (paredit-handle-sexp-errors (progn (forward-sexp) nil) + open)))) + +(defun paredit-delete-leading-whitespace () + ;; This assumes that we're on the closing delimiter already. + (save-excursion + (backward-char) + (while (let ((syn (char-syntax (char-before)))) + (and (or (eq syn ?\ ) (eq syn ?-)) ; whitespace syntax + ;; The above line is a perfect example of why the + ;; following test is necessary. + (not (paredit-in-char-p (1- (point)))))) + (delete-char -1)))) + +(defun paredit-blink-paren-match (another-line-p) + (if (and blink-matching-paren + (or (not show-paren-mode) another-line-p)) + (paredit-ignore-sexp-errors + (save-excursion + (backward-sexp) + (forward-sexp) + ;; SHOW-PAREN-MODE inhibits any blinking, so we disable it + ;; locally here. + (let ((show-paren-mode nil)) + (blink-matching-open)))))) + +(defun paredit-doublequote (&optional n) + "Insert a pair of double-quotes. +With a prefix argument N, wrap the following N S-expressions in + double-quotes, escaping intermediate characters if necessary. +If the region is active, `transient-mark-mode' is enabled, and the + region's start and end fall in the same parenthesis depth, insert a + pair of double-quotes around the region, again escaping intermediate + characters if necessary. +Inside a comment, insert a literal double-quote. +At the end of a string, move past the closing double-quote. +In the middle of a string, insert a backslash-escaped double-quote. +If in a character literal, do nothing. This prevents accidentally + changing a what was in the character literal to become a meaningful + delimiter unintentionally." + (interactive "P") + (cond ((paredit-in-string-p) + (if (eq (point) (- (paredit-enclosing-string-end) 1)) + (forward-char) ; Just move past the closing quote. + ;; Don't split a \x into an escaped backslash and a string end. + (if (paredit-in-string-escape-p) (forward-char)) + (insert ?\\ ?\" ))) + ((paredit-in-comment-p) + (insert ?\" )) + ((not (paredit-in-char-p)) + (paredit-insert-pair n ?\" ?\" 'paredit-forward-for-quote)))) + +(defun paredit-meta-doublequote (&optional n) + "Move to the end of the string. +If not in a string, act as `paredit-doublequote'; if not prefix argument + is specified and the region is not active or `transient-mark-mode' is + disabled, the default is to wrap one S-expression, however, not zero." + (interactive "P") + (if (not (paredit-in-string-p)) + (paredit-doublequote (or n (and (not (paredit-region-active-p)) 1))) + (goto-char (paredit-enclosing-string-end)))) + +(defun paredit-meta-doublequote-and-newline (&optional n) + "Move to the end of the string, insert a newline, and indent. +If not in a string, act as `paredit-doublequote'; if not prefix argument + is specified and the region is not active or `transient-mark-mode' is + disabled, the default is to wrap one S-expression, however, not zero." + (interactive "P") + (if (not (paredit-in-string-p)) + (paredit-doublequote (or n (and (not (paredit-region-active-p)) 1))) + (progn (goto-char (paredit-enclosing-string-end)) + (newline) + (lisp-indent-line) + (paredit-ignore-sexp-errors (indent-sexp))))) + +(defun paredit-forward-for-quote (end) + (let ((state (paredit-current-parse-state))) + (while (< (point) end) + (let ((new-state (parse-partial-sexp (point) (1+ (point)) + nil nil state))) + (if (paredit-in-string-p new-state) + (if (not (paredit-in-string-escape-p)) + (setq state new-state) + ;; Escape character: turn it into an escaped escape + ;; character by appending another backslash. + (insert ?\\ ) + ;; Now the point is after both escapes, and we want to + ;; rescan from before the first one to after the second + ;; one. + (setq state + (parse-partial-sexp (- (point) 2) (point) + nil nil state)) + ;; Advance the end point, since we just inserted a new + ;; character. + (setq end (1+ end))) + ;; String: escape by inserting a backslash before the quote. + (backward-char) + (insert ?\\ ) + ;; The point is now between the escape and the quote, and we + ;; want to rescan from before the escape to after the quote. + (setq state + (parse-partial-sexp (1- (point)) (1+ (point)) + nil nil state)) + ;; Advance the end point for the same reason as above. + (setq end (1+ end))))))) + +;;;; Escape Insertion + +(defun paredit-backslash () + "Insert a backslash followed by a character to escape." + (interactive) + (cond ((paredit-in-string-p) (paredit-backslash-interactive)) + ((paredit-in-comment-p) (insert ?\\)) + ((paredit-in-char-p) (forward-char) (paredit-backslash-interactive)) + (t (paredit-backslash-interactive)))) + +(defun paredit-backslash-interactive () + (insert ?\\ ) + ;; Read a character to insert after the backslash. If anything + ;; goes wrong -- the user hits delete (entering the rubout + ;; `character'), aborts with C-g, or enters non-character input + ;; -- then delete the backslash to avoid a dangling escape. + (let ((delete-p t)) + (unwind-protect + (let ((char (read-char "Character to escape: "))) + (if (not (eq char ?\^?)) + (progn (message "Character to escape: %c" char) + (insert char) + (setq delete-p nil)))) + (if delete-p + (progn (message "Deleting escape.") + (delete-char -1)))))) + +(defun paredit-newline () + "Insert a newline and indent it. +This is like `newline-and-indent', but it not only indents the line + that the point is on but also the S-expression following the point, + if there is one. +Move forward one character first if on an escaped character. +If in a string, just insert a literal newline. +If in a comment and if followed by invalid structure, call + `indent-new-comment-line' to keep the invalid structure in a + comment." + (interactive) + (cond ((paredit-in-string-p) + (newline)) + ((paredit-in-comment-p) + (if (paredit-region-ok-p (point) (point-at-eol)) + (progn (newline-and-indent) + (paredit-ignore-sexp-errors (indent-sexp))) + (indent-new-comment-line))) + (t + (if (paredit-in-char-p) + (forward-char)) + (newline-and-indent) + ;; Indent the following S-expression, but don't signal an + ;; error if there's only a closing delimiter after the point. + (paredit-ignore-sexp-errors (indent-sexp))))) + +(defun paredit-reindent-defun (&optional argument) + "Reindent the definition that the point is on. +If the point is in a string or a comment, fill the paragraph instead, + and with a prefix argument, justify as well." + (interactive "P") + (if (or (paredit-in-string-p) + (paredit-in-comment-p)) + (lisp-fill-paragraph argument) + (paredit-preserving-column + (save-excursion + (end-of-defun) + (beginning-of-defun) + (indent-sexp))))) + +;;;; Comment Insertion + +(defun paredit-semicolon (&optional n) + "Insert a semicolon. +With a prefix argument N, insert N semicolons. +If in a string, do just that and nothing else. +If in a character literal, move to the beginning of the character + literal before inserting the semicolon. +If the enclosing list ends on the line after the point, break the line + after the last S-expression following the point. +If a list begins on the line after the point but ends on a different + line, break the line after the last S-expression following the point + before the list." + (interactive "p") + (if (or (paredit-in-string-p) (paredit-in-comment-p)) + (insert (make-string (or n 1) ?\; )) + (if (paredit-in-char-p) + (backward-char 2)) + (let ((line-break-point (paredit-semicolon-find-line-break-point))) + (if line-break-point + (paredit-semicolon-with-line-break line-break-point (or n 1)) + (insert (make-string (or n 1) ?\; )))))) + +(defun paredit-semicolon-find-line-break-point () + (and (not (eolp)) ;Implies (not (eobp)). + (let ((eol (point-at-eol))) + (save-excursion + (catch 'exit + (while t + (let ((line-break-point (point))) + (cond ((paredit-handle-sexp-errors (progn (forward-sexp) t) + nil) + ;; Successfully advanced by an S-expression. + ;; If that S-expression started on this line + ;; and ended on another one, break here. + (cond ((not (eq eol (point-at-eol))) + (throw 'exit + (and (save-excursion + (backward-sexp) + (eq eol (point-at-eol))) + line-break-point))) + ((eobp) + (throw 'exit nil)))) + ((save-excursion + (paredit-skip-whitespace t (point-at-eol)) + (or (eolp) (eobp) (eq (char-after) ?\;))) + ;; Can't move further, but there's no closing + ;; delimiter we're about to clobber -- either + ;; it's on the next line or we're at the end of + ;; the buffer. Don't break the line. + (throw 'exit nil)) + (t + ;; Can't move because we hit a delimiter at the + ;; end of this line. Break here. + (throw 'exit line-break-point)))))))))) + +(defun paredit-semicolon-with-line-break (line-break-point n) + (let ((line-break-marker (make-marker))) + (set-marker line-break-marker line-break-point) + (set-marker-insertion-type line-break-marker t) + (insert (make-string (or n 1) ?\; )) + (save-excursion + (goto-char line-break-marker) + (set-marker line-break-marker nil) + (newline) + (lisp-indent-line) + ;; This step is redundant if we are inside a list, but even if we + ;; are at the top level, we want at least to indent whatever we + ;; bumped off the line. + (paredit-ignore-sexp-errors (indent-sexp)) + (paredit-indent-sexps)))) + +;;; This is all a horrible, horrible hack, primarily for GNU Emacs 21, +;;; in which there is no `comment-or-uncomment-region'. + +(autoload 'comment-forward "newcomment") +(autoload 'comment-normalize-vars "newcomment") +(autoload 'comment-region "newcomment") +(autoload 'comment-search-forward "newcomment") +(autoload 'uncomment-region "newcomment") + +(defun paredit-initialize-comment-dwim () + (require 'newcomment) + (if (not (fboundp 'comment-or-uncomment-region)) + (defalias 'comment-or-uncomment-region + (lambda (beginning end &optional argument) + (interactive "*r\nP") + (if (save-excursion (goto-char beginning) + (comment-forward (point-max)) + (<= end (point))) + (uncomment-region beginning end argument) + (comment-region beginning end argument))))) + (defalias 'paredit-initialize-comment-dwim 'comment-normalize-vars) + (comment-normalize-vars)) + +(defun paredit-comment-dwim (&optional argument) + "Call the Lisp comment command you want (Do What I Mean). +This is like `comment-dwim', but it is specialized for Lisp editing. +If transient mark mode is enabled and the mark is active, comment or + uncomment the selected region, depending on whether it was entirely + commented not not already. +If there is already a comment on the current line, with no prefix + argument, indent to that comment; with a prefix argument, kill that + comment. +Otherwise, insert a comment appropriate for the context and ensure that + any code following the comment is moved to the next line. +At the top level, where indentation is calculated to be at column 0, + insert a triple-semicolon comment; within code, where the indentation + is calculated to be non-zero, and on the line there is either no code + at all or code after the point, insert a double-semicolon comment; + and if the point is after all code on the line, insert a single- + semicolon margin comment at `comment-column'." + (interactive "*P") + (paredit-initialize-comment-dwim) + (cond ((paredit-region-active-p) + (comment-or-uncomment-region (region-beginning) + (region-end) + argument)) + ((paredit-comment-on-line-p) + (if argument + (comment-kill (if (integerp argument) argument nil)) + (comment-indent))) + (t (paredit-insert-comment)))) + +(defun paredit-comment-on-line-p () + "True if there is a comment on the line following point. +This is expected to be called only in `paredit-comment-dwim'; do not + call it elsewhere." + (save-excursion + (beginning-of-line) + (let ((comment-p nil)) + ;; Search forward for a comment beginning. If there is one, set + ;; COMMENT-P to true; if not, it will be nil. + (while (progn + (setq comment-p ;t -> no error + (comment-search-forward (point-at-eol) t)) + (and comment-p + (or (paredit-in-string-p) + (paredit-in-char-p (1- (point)))))) + (forward-char)) + comment-p))) + +(defun paredit-insert-comment () + (let ((code-after-p + (save-excursion (paredit-skip-whitespace t (point-at-eol)) + (not (eolp)))) + (code-before-p + (save-excursion (paredit-skip-whitespace nil (point-at-bol)) + (not (bolp))))) + (cond ((and (bolp) + (let ((indent + (let ((indent (calculate-lisp-indent))) + (if (consp indent) (car indent) indent)))) + (and indent (zerop indent)))) + ;; Top-level comment + (if code-after-p (save-excursion (newline))) + (insert ";;; ")) + ((or code-after-p (not code-before-p)) + ;; Code comment + (if code-before-p + (newline-and-indent) + (lisp-indent-line)) + (insert ";; ") + (if code-after-p + (save-excursion + (newline) + (lisp-indent-line) + (paredit-indent-sexps)))) + (t + ;; Margin comment + (indent-to comment-column 1) ; 1 -> force one leading space + (insert ?\; ))))) + +;;;; Character Deletion + +(defun paredit-forward-delete (&optional argument) + "Delete a character forward or move forward over a delimiter. +If on an opening S-expression delimiter, move forward into the + S-expression. +If on a closing S-expression delimiter, refuse to delete unless the + S-expression is empty, in which case delete the whole S-expression. +With a numeric prefix argument N, delete N characters forward. +With a `C-u' prefix argument, simply delete a character forward, + without regard for delimiter balancing." + (interactive "P") + (cond ((or (consp argument) (eobp)) + (delete-char +1)) + ((integerp argument) + (if (< argument 0) + (paredit-backward-delete argument) + (while (> argument 0) + (paredit-forward-delete) + (setq argument (- argument 1))))) + ((paredit-in-string-p) + (paredit-forward-delete-in-string)) + ((paredit-in-comment-p) + (paredit-forward-delete-in-comment)) + ((paredit-in-char-p) ; Escape -- delete both chars. + (delete-char -1) + (delete-char +1)) + ((eq (char-after) ?\\ ) ; ditto + (delete-char +2)) + ((let ((syn (char-syntax (char-after)))) + (or (eq syn ?\( ) + (eq syn ?\" ))) + (if (save-excursion + (paredit-handle-sexp-errors (progn (forward-sexp) t) + nil)) + (forward-char) + (message "Deleting spurious opening delimiter.") + (delete-char +1))) + ((and (not (paredit-in-char-p (1- (point)))) + (eq (char-syntax (char-after)) ?\) ) + (eq (char-before) (matching-paren (char-after)))) + (delete-char -1) ; Empty list -- delete both + (delete-char +1)) ; delimiters. + ((eq ?\; (char-after)) + (paredit-forward-delete-comment-start)) + ((eq (char-syntax (char-after)) ?\) ) + (if (paredit-handle-sexp-errors + (save-excursion (forward-char) (backward-sexp) t) + nil) + (message "End of list!") + (progn + (message "Deleting spurious closing delimiter.") + (delete-char +1)))) + ;; Just delete a single character, if it's not a closing + ;; delimiter. (The character literal case is already handled + ;; by now.) + (t (delete-char +1)))) + +(defun paredit-forward-delete-in-string () + (let ((start+end (paredit-string-start+end-points))) + (cond ((not (eq (point) (cdr start+end))) + ;; If it's not the close-quote, it's safe to delete. But + ;; first handle the case that we're in a string escape. + (cond ((paredit-in-string-escape-p) + ;; We're right after the backslash, so backward + ;; delete it before deleting the escaped character. + (delete-char -1)) + ((eq (char-after) ?\\ ) + ;; If we're not in a string escape, but we are on a + ;; backslash, it must start the escape for the next + ;; character, so delete the backslash before deleting + ;; the next character. + (delete-char +1))) + (delete-char +1)) + ((eq (1- (point)) (car start+end)) + ;; If it is the close-quote, delete only if we're also right + ;; past the open-quote (i.e. it's empty), and then delete + ;; both quotes. Otherwise we refuse to delete it. + (delete-char -1) + (delete-char +1))))) + +(defun paredit-check-forward-delete-in-comment () + ;; Point is in a comment, possibly at eol. We are about to delete + ;; some characters forward; if we are at eol, we are about to delete + ;; the line break. Refuse to do so if if moving the next line into + ;; the comment would break structure. + (if (eolp) + (let ((next-line-start (point-at-bol 2)) + (next-line-end (point-at-eol 2))) + (paredit-check-region next-line-start next-line-end)))) + +(defun paredit-forward-delete-in-comment () + (paredit-check-forward-delete-in-comment) + (delete-char +1)) + +(defun paredit-forward-delete-comment-start () + ;; Point precedes a comment start (not at eol). Refuse to delete a + ;; comment start if the comment contains unbalanced junk. + (paredit-check-region (+ (point) 1) (point-at-eol)) + (delete-char +1)) + +(defun paredit-backward-delete (&optional argument) + "Delete a character backward or move backward over a delimiter. +If on a closing S-expression delimiter, move backward into the + S-expression. +If on an opening S-expression delimiter, refuse to delete unless the + S-expression is empty, in which case delete the whole S-expression. +With a numeric prefix argument N, delete N characters backward. +With a `C-u' prefix argument, simply delete a character backward, + without regard for delimiter balancing." + (interactive "P") + (cond ((or (consp argument) (bobp)) + ;++ Should this untabify? + (delete-char -1)) + ((integerp argument) + (if (< argument 0) + (paredit-forward-delete (- 0 argument)) + (while (> argument 0) + (paredit-backward-delete) + (setq argument (- argument 1))))) + ((paredit-in-string-p) + (paredit-backward-delete-in-string)) + ((paredit-in-comment-p) + (paredit-backward-delete-in-comment)) + ((paredit-in-char-p) ; Escape -- delete both chars. + (delete-char -1) + (delete-char +1)) + ((paredit-in-char-p (1- (point))) + (delete-char -2)) ; ditto + ((let ((syn (char-syntax (char-before)))) + (or (eq syn ?\) ) + (eq syn ?\" ))) + (if (save-excursion + (paredit-handle-sexp-errors (progn (backward-sexp) t) + nil)) + (backward-char) + (message "Deleting spurious closing delimiter.") + (delete-char -1))) + ((and (eq (char-syntax (char-before)) ?\( ) + (eq (char-after) (matching-paren (char-before)))) + (delete-char -1) ; Empty list -- delete both + (delete-char +1)) ; delimiters. + ((bolp) + (paredit-backward-delete-maybe-comment-end)) + ((eq (char-syntax (char-before)) ?\( ) + (if (paredit-handle-sexp-errors + (save-excursion (backward-char) (forward-sexp) t) + nil) + (message "Beginning of list!") + (progn + (message "Deleting spurious closing delimiter.") + (delete-char -1)))) + ;; Delete it, unless it's an opening delimiter. The case of + ;; character literals is already handled by now. + (t + ;; Turn off the @#&*&!^&(%^ botch in GNU Emacs 24 that changed + ;; `backward-delete-char' and `backward-delete-char-untabify' + ;; semantically so that they delete the region in transient + ;; mark mode. + (let ((delete-active-region nil)) + (backward-delete-char-untabify +1))))) + +(defun paredit-backward-delete-in-string () + (let ((start+end (paredit-string-start+end-points))) + (cond ((not (eq (1- (point)) (car start+end))) + ;; If it's not the open-quote, it's safe to delete. + (if (paredit-in-string-escape-p) + ;; If we're on a string escape, since we're about to + ;; delete the backslash, we must first delete the + ;; escaped char. + (delete-char +1)) + (delete-char -1) + (if (paredit-in-string-escape-p) + ;; If, after deleting a character, we find ourselves in + ;; a string escape, we must have deleted the escaped + ;; character, and the backslash is behind the point, so + ;; backward delete it. + (delete-char -1))) + ((eq (point) (cdr start+end)) + ;; If it is the open-quote, delete only if we're also right + ;; past the close-quote (i.e. it's empty), and then delete + ;; both quotes. Otherwise we refuse to delete it. + (delete-char -1) + (delete-char +1))))) + +(defun paredit-backward-delete-in-comment () + ;; Point is in a comment, possibly just after the comment start. + ;; Refuse to delete a comment start if the comment contains + ;; unbalanced junk. + (if (save-excursion + (backward-char) + ;; Must call `paredit-in-string-p' before + ;; `paredit-in-comment-p'. + (not (or (paredit-in-string-p) (paredit-in-comment-p)))) + (paredit-check-region (point) (point-at-eol))) + (backward-delete-char-untabify +1)) + +(defun paredit-backward-delete-maybe-comment-end () + ;; Point is at bol, possibly just after a comment end (i.e., the + ;; previous line may have had a line comment). Refuse to delete a + ;; comment end if moving the current line into the previous line's + ;; comment would break structure. + (if (save-excursion + (backward-char) + (and (not (paredit-in-string-p)) (paredit-in-comment-p))) + (paredit-check-region (point-at-eol) (point-at-bol))) + (delete-char -1)) + +;;;; Killing + +(defun paredit-kill (&optional argument) + "Kill a line as if with `kill-line', but respecting delimiters. +In a string, act exactly as `kill-line' but do not kill past the + closing string delimiter. +On a line with no S-expressions on it starting after the point or + within a comment, act exactly as `kill-line'. +Otherwise, kill all S-expressions that start after the point. +With a `C-u' prefix argument, just do the standard `kill-line'. +With a numeric prefix argument N, do `kill-line' that many times." + (interactive "P") + (cond (argument + (kill-line (if (integerp argument) argument 1))) + ((paredit-in-string-p) + (paredit-kill-line-in-string)) + ((paredit-in-comment-p) + (paredit-kill-line-in-comment)) + ((save-excursion (paredit-skip-whitespace t (point-at-eol)) + (or (eolp) (eq (char-after) ?\; ))) + ;** Be careful about trailing backslashes. + (if (paredit-in-char-p) + (backward-char)) + (kill-line)) + (t (paredit-kill-sexps-on-line)))) + +(defun paredit-kill-line-in-string () + (if (save-excursion (paredit-skip-whitespace t (point-at-eol)) + (eolp)) + (kill-line) + (save-excursion + ;; Be careful not to split an escape sequence. + (if (paredit-in-string-escape-p) + (backward-char)) + (kill-region (point) + (min (point-at-eol) + (cdr (paredit-string-start+end-points))))))) + +(defun paredit-kill-line-in-comment () + ;; The variable `kill-whole-line' is not relevant: the point is in a + ;; comment, and hence not at the beginning of the line. + (paredit-check-forward-delete-in-comment) + (kill-line)) + +(defun paredit-kill-sexps-on-line () + (if (paredit-in-char-p) ; Move past the \ and prefix. + (backward-char 2)) ; (# in Scheme/CL, ? in elisp) + (let ((beginning (point)) + (eol (point-at-eol))) + (let ((end-of-list-p (paredit-forward-sexps-to-kill beginning eol))) + ;; If we got to the end of the list and it's on the same line, + ;; move backward past the closing delimiter before killing. (This + ;; allows something like killing the whitespace in ( ).) + (if end-of-list-p (progn (up-list) (backward-char))) + (if kill-whole-line + (paredit-kill-sexps-on-whole-line beginning) + (kill-region beginning + ;; If all of the S-expressions were on one line, + ;; i.e. we're still on that line after moving past + ;; the last one, kill the whole line, including + ;; any comments; otherwise just kill to the end of + ;; the last S-expression we found. Be sure, + ;; though, not to kill any closing parentheses. + (if (and (not end-of-list-p) + (eq (point-at-eol) eol)) + eol + (point))))))) + +;;; Please do not try to understand this code unless you have a VERY +;;; good reason to do so. I gave up trying to figure it out well +;;; enough to explain it, long ago. + +(defun paredit-forward-sexps-to-kill (beginning eol) + (let ((end-of-list-p nil) + (firstp t)) + ;; Move to the end of the last S-expression that started on this + ;; line, or to the closing delimiter if the last S-expression in + ;; this list is on the line. + (catch 'return + (while t + ;; This and the `kill-whole-line' business below fix a bug that + ;; inhibited any S-expression at the very end of the buffer + ;; (with no trailing newline) from being deleted. It's a + ;; bizarre fix that I ought to document at some point, but I am + ;; too busy at the moment to do so. + (if (and kill-whole-line (eobp)) (throw 'return nil)) + (save-excursion + (paredit-handle-sexp-errors (forward-sexp) + (up-list) + (setq end-of-list-p (eq (point-at-eol) eol)) + (throw 'return nil)) + (if (or (and (not firstp) + (not kill-whole-line) + (eobp)) + (paredit-handle-sexp-errors + (progn (backward-sexp) nil) + t) + (not (eq (point-at-eol) eol))) + (throw 'return nil))) + (forward-sexp) + (if (and firstp + (not kill-whole-line) + (eobp)) + (throw 'return nil)) + (setq firstp nil))) + end-of-list-p)) + +(defun paredit-kill-sexps-on-whole-line (beginning) + (kill-region beginning + (or (save-excursion ; Delete trailing indentation... + (paredit-skip-whitespace t) + (and (not (eq (char-after) ?\; )) + (point))) + ;; ...or just use the point past the newline, if + ;; we encounter a comment. + (point-at-eol))) + (cond ((save-excursion (paredit-skip-whitespace nil (point-at-bol)) + (bolp)) + ;; Nothing but indentation before the point, so indent it. + (lisp-indent-line)) + ((eobp) nil) ; Protect the CHAR-SYNTAX below against NIL. + ;; Insert a space to avoid invalid joining if necessary. + ((let ((syn-before (char-syntax (char-before))) + (syn-after (char-syntax (char-after)))) + (or (and (eq syn-before ?\) ) ; Separate opposing + (eq syn-after ?\( )) ; parentheses, + (and (eq syn-before ?\" ) ; string delimiter + (eq syn-after ?\" )) ; pairs, + (and (memq syn-before '(?_ ?w)) ; or word or symbol + (memq syn-after '(?_ ?w))))) ; constituents. + (insert " ")))) + +;;;;; Killing Words + +;;; This is tricky and asymmetrical because backward parsing is +;;; extraordinarily difficult or impossible, so we have to implement +;;; killing in both directions by parsing forward. + +(defun paredit-forward-kill-word () + "Kill a word forward, skipping over intervening delimiters." + (interactive) + (let ((beginning (point))) + (skip-syntax-forward " -") + (let* ((parse-state (paredit-current-parse-state)) + (state (paredit-kill-word-state parse-state 'char-after))) + (while (not (or (eobp) + (eq ?w (char-syntax (char-after))))) + (setq parse-state + (progn (forward-char 1) (paredit-current-parse-state)) +;; (parse-partial-sexp (point) (1+ (point)) +;; nil nil parse-state) + ) + (let* ((old-state state) + (new-state + (paredit-kill-word-state parse-state 'char-after))) + (cond ((not (eq old-state new-state)) + (setq parse-state + (paredit-kill-word-hack old-state + new-state + parse-state)) + (setq state + (paredit-kill-word-state parse-state + 'char-after)) + (setq beginning (point))))))) + (goto-char beginning) + (kill-word 1))) + +(defun paredit-backward-kill-word () + "Kill a word backward, skipping over any intervening delimiters." + (interactive) + (if (not (or (bobp) + (eq (char-syntax (char-before)) ?w))) + (let ((end (point))) + (backward-word 1) + (forward-word 1) + (goto-char (min end (point))) + (let* ((parse-state (paredit-current-parse-state)) + (state + (paredit-kill-word-state parse-state 'char-before))) + (while (and (< (point) end) + (progn + (setq parse-state + (parse-partial-sexp (point) (1+ (point)) + nil nil parse-state)) + (or (eq state + (paredit-kill-word-state parse-state + 'char-before)) + (progn (backward-char 1) nil))))) + (if (and (eq state 'comment) + (eq ?\# (char-after (point))) + (eq ?\| (char-before (point)))) + (backward-char 1))))) + (backward-kill-word 1)) + +;;;;;; Word-Killing Auxiliaries + +(defun paredit-kill-word-state (parse-state adjacent-char-fn) + (cond ((paredit-in-comment-p parse-state) 'comment) + ((paredit-in-string-p parse-state) 'string) + ((memq (char-syntax (funcall adjacent-char-fn)) + '(?\( ?\) )) + 'delimiter) + (t 'other))) + +;;; This optionally advances the point past any comment delimiters that +;;; should probably not be touched, based on the last state change and +;;; the characters around the point. It returns a new parse state, +;;; starting from the PARSE-STATE parameter. + +(defun paredit-kill-word-hack (old-state new-state parse-state) + (cond ((and (not (eq old-state 'comment)) + (not (eq new-state 'comment)) + (not (paredit-in-string-escape-p)) + (eq ?\# (char-before)) + (eq ?\| (char-after))) + (forward-char 1) + (paredit-current-parse-state) +;; (parse-partial-sexp (point) (1+ (point)) +;; nil nil parse-state) + ) + ((and (not (eq old-state 'comment)) + (eq new-state 'comment) + (eq ?\; (char-before))) + (skip-chars-forward ";") + (paredit-current-parse-state) +;; (parse-partial-sexp (point) (save-excursion +;; (skip-chars-forward ";")) +;; nil nil parse-state) + ) + (t parse-state))) + +(defun paredit-copy-as-kill () + "Save in the kill ring the region that `paredit-kill' would kill." + (interactive) + (cond ((paredit-in-string-p) + (paredit-copy-as-kill-in-string)) + ((paredit-in-comment-p) + (copy-region-as-kill (point) (point-at-eol))) + ((save-excursion (paredit-skip-whitespace t (point-at-eol)) + (or (eolp) (eq (char-after) ?\; ))) + ;** Be careful about trailing backslashes. + (save-excursion + (if (paredit-in-char-p) + (backward-char)) + (copy-region-as-kill (point) (point-at-eol)))) + (t (paredit-copy-sexps-as-kill)))) + +(defun paredit-copy-as-kill-in-string () + (save-excursion + (if (paredit-in-string-escape-p) + (backward-char)) + (copy-region-as-kill (point) + (min (point-at-eol) + (cdr (paredit-string-start+end-points)))))) + +(defun paredit-copy-sexps-as-kill () + (save-excursion + (if (paredit-in-char-p) + (backward-char 2)) + (let ((beginning (point)) + (eol (point-at-eol))) + (let ((end-of-list-p (paredit-forward-sexps-to-kill beginning eol))) + (if end-of-list-p (progn (up-list) (backward-char))) + (copy-region-as-kill beginning + (cond (kill-whole-line + (or (save-excursion + (paredit-skip-whitespace t) + (and (not (eq (char-after) ?\; )) + (point))) + (point-at-eol))) + ((and (not end-of-list-p) + (eq (point-at-eol) eol)) + eol) + (t + (point)))))))) + +;;;; Deleting Regions + +(defun paredit-delete-region (start end) + "Delete the text between point and mark, like `delete-region'. +If that text is unbalanced, signal an error instead. +With a prefix argument, skip the balance check." + (interactive "r") + (if (and start end (not current-prefix-arg)) + (paredit-check-region-for-delete start end)) + (setq this-command 'delete-region) + (delete-region start end)) + +(defun paredit-kill-region (start end) + "Kill the text between point and mark, like `kill-region'. +If that text is unbalanced, signal an error instead. +With a prefix argument, skip the balance check." + (interactive "r") + (if (and start end (not current-prefix-arg)) + (paredit-check-region-for-delete start end)) + (setq this-command 'kill-region) + (kill-region start end)) + +(defun paredit-check-region-for-delete (start end) + "Signal an error deleting text between START and END is unsafe." + (save-excursion + (goto-char start) + (let* ((start-state (paredit-current-parse-state)) + (end-state (parse-partial-sexp start end nil nil start-state))) + (paredit-check-region-for-delete:depth start start-state end end-state) + (paredit-check-region-for-delete:string start start-state end end-state) + (paredit-check-region-for-delete:comment start start-state end end-state) + (paredit-check-region-for-delete:char-quote start start-state + end end-state)))) + +(defun paredit-check-region-for-delete:depth (start start-state end end-state) + (let ((start-depth (nth 0 start-state)) + (end-depth (nth 0 end-state))) + (if (not (= start-depth end-depth)) + (error "Mismatched parenthesis depth: %S at start, %S at end." + start-depth + end-depth)))) + +(defun paredit-check-region-for-delete:string (start start-state end end-state) + (let ((start-string-p (nth 3 start-state)) + (end-string-p (nth 3 end-state))) + (if (not (eq start-string-p end-string-p)) + (error "Mismatched string state: start %sin string, end %sin string." + (if start-string-p "" "not ") + (if end-string-p "" "not "))))) + +(defun paredit-check-region-for-delete:comment + (start start-state end end-state) + (let ((start-comment-state (nth 4 start-state)) + (end-comment-state (nth 4 end-state))) + (if (not (or (eq start-comment-state end-comment-state) + ;; If we are moving text into or out of a line + ;; comment, make sure that the text is balanced. (The + ;; comment state may be a number, not t or nil at all, + ;; for nestable comments, which are not handled by + ;; this heuristic (or any of paredit, really).) + (and (or (and (eq start-comment-state nil) + (eq end-comment-state t)) + (and (eq start-comment-state t) + (eq end-comment-state nil))) + (save-excursion + (goto-char end) + (paredit-region-ok-p (point) (point-at-eol)))))) + (error "Mismatched comment state: %s" + (cond ((and (integerp start-comment-state) + (integerp end-comment-state)) + (format "depth %S at start, depth %S at end." + start-comment-state + end-comment-state)) + ((integerp start-comment-state) + "start in nested comment, end otherwise.") + ((integerp end-comment-state) + "end in nested comment, start otherwise.") + (start-comment-state + "start in comment, end not in comment.") + (end-comment-state + "end in comment, start not in comment.") + (t + (format "start %S, end %S." + start-comment-state + end-comment-state))))))) + +(defun paredit-check-region-for-delete:char-quote + (start start-state end end-state) + (let ((start-char-quote (nth 5 start-state)) + (end-char-quote (nth 5 end-state))) + (if (not (eq start-char-quote end-char-quote)) + (let ((phrase "character quotation")) + (error "Mismatched %s: start %sin %s, end %sin %s." + phrase + (if start-char-quote "" "not ") + phrase + (if end-char-quote "" "not ") + phrase))))) + +;;;; Point Motion + +(eval-and-compile + (defmacro defun-motion (name bvl doc &rest body) + `(defun ,name ,bvl + ,doc + ,(xcond ((paredit-xemacs-p) + '(interactive "_")) + ((paredit-gnu-emacs-p) + ;++ Not sure this is sufficient for the `^'. + (if (fboundp 'handle-shift-selection) + '(interactive "^p") + '(interactive "p")))) + ,@body))) + +(defun-motion paredit-forward (&optional arg) + "Move forward an S-expression, or up an S-expression forward. +If there are no more S-expressions in this one before the closing + delimiter, move past that closing delimiter; otherwise, move forward + past the S-expression following the point." + (let ((n (or arg 1))) + (cond ((< 0 n) (dotimes (i n) (paredit-move-forward))) + ((< n 0) (dotimes (i (- n)) (paredit-move-backward)))))) + +(defun-motion paredit-backward (&optional arg) + "Move backward an S-expression, or up an S-expression backward. +If there are no more S-expressions in this one before the opening + delimiter, move past that opening delimiter backward; otherwise, move + move backward past the S-expression preceding the point." + (let ((n (or arg 1))) + (cond ((< 0 n) (dotimes (i n) (paredit-move-backward))) + ((< n 0) (dotimes (i (- n)) (paredit-move-forward)))))) + +(defun paredit-move-forward () + (cond ((paredit-in-string-p) + (let ((end (paredit-enclosing-string-end))) + ;; `forward-sexp' and `up-list' may move into the next string + ;; in the buffer. Don't do that; move out of the current one. + (if (paredit-handle-sexp-errors + (progn (paredit-handle-sexp-errors (forward-sexp) + (up-list)) + (<= end (point))) + t) + (goto-char end)))) + ((paredit-in-char-p) + (forward-char)) + (t + (paredit-handle-sexp-errors (forward-sexp) + (up-list))))) + +(defun paredit-move-backward () + (cond ((paredit-in-string-p) + (let ((start (paredit-enclosing-string-start))) + (if (paredit-handle-sexp-errors + (progn (paredit-handle-sexp-errors (backward-sexp) + (backward-up-list)) + (<= (point) start)) + t) + (goto-char start)))) + ((paredit-in-char-p) + ;++ Corner case: a buffer of `\|x'. What to do? + (backward-char 2)) + (t + (paredit-handle-sexp-errors (backward-sexp) + (backward-up-list))))) + +;;;; Window Positioning + +(defalias 'paredit-recentre-on-sexp 'paredit-recenter-on-sexp) + +(defun paredit-recenter-on-sexp (&optional n) + "Recenter the screen on the S-expression following the point. +With a prefix argument N, encompass all N S-expressions forward." + (interactive "P") + (let* ((p (point)) + (end-point (progn (forward-sexp n) (point))) + (start-point (progn (goto-char end-point) (backward-sexp n) (point)))) + ;; Point is at beginning of first S-expression. + (let ((p-visible nil) (start-visible nil)) + (save-excursion + (forward-line (/ (count-lines start-point end-point) 2)) + (recenter) + (setq p-visible (pos-visible-in-window-p p)) + (setq start-visible (pos-visible-in-window-p start-point))) + (cond ((not start-visible) + ;; Implies (not p-visible). Put the start at the top of + ;; the screen. + (recenter 0)) + (p-visible + ;; Go back to p if we can. + (goto-char p)))))) + +(defun paredit-recenter-on-defun () + "Recenter the screen on the definition at point." + (interactive) + (save-excursion + (beginning-of-defun) + (paredit-recenter-on-sexp))) + +(defun paredit-focus-on-defun () + "Moves display to the top of the definition at point." + (interactive) + (beginning-of-defun) + (recenter 0)) + +;;;; Generalized Upward/Downward Motion + +(defun paredit-up/down (n vertical-direction) + (let ((horizontal-direction (if (< 0 n) +1 -1))) + (while (/= n 0) + (goto-char + (paredit-next-up/down-point horizontal-direction vertical-direction)) + (setq n (- n horizontal-direction))))) + +(defun paredit-next-up/down-point (horizontal-direction vertical-direction) + (let ((state (paredit-current-parse-state)) + (scan-lists + (lambda () + (scan-lists (point) horizontal-direction vertical-direction)))) + (cond ((paredit-in-string-p state) + (let ((start+end (paredit-string-start+end-points state))) + (if (< 0 vertical-direction) + (if (< 0 horizontal-direction) + (+ 1 (cdr start+end)) + (car start+end)) + ;; We could let the user try to descend into lists + ;; within the string, but that would be asymmetric + ;; with the up case, which rises out of the whole + ;; string and not just out of a list within the + ;; string, so this case will just be an error. + (error "Can't descend further into string.")))) + ((< 0 vertical-direction) + ;; When moving up, just try to rise up out of the list. + (or (funcall scan-lists) + (buffer-end horizontal-direction))) + ((< vertical-direction 0) + ;; When moving down, look for a string closer than a list, + ;; and use that if we find it. + (let* ((list-start + (paredit-handle-sexp-errors (funcall scan-lists) nil)) + (string-start + (paredit-find-next-string-start horizontal-direction + list-start))) + (if (and string-start list-start) + (if (< 0 horizontal-direction) + (min string-start list-start) + (max string-start list-start)) + (or string-start + ;; Scan again: this is a kludgey way to report the + ;; error if there really was one. + (funcall scan-lists) + (buffer-end horizontal-direction))))) + (t + (error "Vertical direction must be nonzero in `%s'." + 'paredit-up/down))))) + +(defun paredit-find-next-string-start (horizontal-direction limit) + (let ((buffer-limit-p (if (< 0 horizontal-direction) 'eobp 'bobp)) + (next-char (if (< 0 horizontal-direction) 'char-after 'char-before)) + (pastp (if (< 0 horizontal-direction) '> '<))) + (paredit-handle-sexp-errors + (save-excursion + (catch 'exit + (while t + (if (or (funcall buffer-limit-p) + (and limit (funcall pastp (point) limit))) + (throw 'exit nil)) + (forward-sexp horizontal-direction) + (save-excursion + (backward-sexp horizontal-direction) + (if (eq ?\" (char-syntax (funcall next-char))) + (throw 'exit (+ (point) horizontal-direction))))))) + nil))) + +(defun-motion paredit-forward-down (&optional argument) + "Move forward down into a list. +With a positive argument, move forward down that many levels. +With a negative argument, move backward down that many levels." + (paredit-up/down (or argument +1) -1)) + +(defun-motion paredit-backward-up (&optional argument) + "Move backward up out of the enclosing list. +With a positive argument, move backward up that many levels. +With a negative argument, move forward up that many levels. +If in a string initially, that counts as one level." + (paredit-up/down (- 0 (or argument +1)) +1)) + +(defun-motion paredit-forward-up (&optional argument) + "Move forward up out of the enclosing list. +With a positive argument, move forward up that many levels. +With a negative argument, move backward up that many levels. +If in a string initially, that counts as one level." + (paredit-up/down (or argument +1) +1)) + +(defun-motion paredit-backward-down (&optional argument) + "Move backward down into a list. +With a positive argument, move backward down that many levels. +With a negative argument, move forward down that many levels." + (paredit-up/down (- 0 (or argument +1)) -1)) + +;;;; Depth-Changing Commands: Wrapping, Splicing, & Raising + +(defun paredit-wrap-sexp (&optional argument open close) + "Wrap the following S-expression. +If a `C-u' prefix argument is given, wrap all S-expressions following + the point until the end of the buffer or of the enclosing list. +If a numeric prefix argument N is given, wrap N S-expressions. +Automatically indent the newly wrapped S-expression. +As a special case, if the point is at the end of a list, simply insert + a parenthesis pair, rather than inserting a lone opening delimiter + and then signalling an error, in the interest of preserving + structure. +By default OPEN and CLOSE are round delimiters." + (interactive "P") + (paredit-lose-if-not-in-sexp 'paredit-wrap-sexp) + (let ((open (or open ?\( )) + (close (or close ?\) ))) + (paredit-handle-sexp-errors + ((lambda (n) (paredit-insert-pair n open close 'goto-char)) + (cond ((integerp argument) argument) + ((consp argument) (paredit-count-sexps-forward)) + ((paredit-region-active-p) nil) + (t 1))) + (insert close) + (backward-char))) + (save-excursion (backward-up-list) (indent-sexp))) + +(defun paredit-yank-pop (&optional argument) + "Replace just-yanked text with the next item in the kill ring. +If this command follows a `yank', just run `yank-pop'. +If this command follows a `paredit-wrap-sexp', or any other paredit + wrapping command (see `paredit-wrap-commands'), run `yank' and + reindent the enclosing S-expression. +If this command is repeated, run `yank-pop' and reindent the enclosing + S-expression. + +The argument is passed on to `yank' or `yank-pop'; see their + documentation for details." + (interactive "*p") + (cond ((eq last-command 'yank) + (yank-pop argument)) + ((memq last-command paredit-wrap-commands) + (yank argument) + ;; `yank' futzes with `this-command'. + (setq this-command 'paredit-yank-pop) + (save-excursion (backward-up-list) (indent-sexp))) + ((eq last-command 'paredit-yank-pop) + ;; Pretend we just did a `yank', so that we can use + ;; `yank-pop' without duplicating its definition. + (setq last-command 'yank) + (yank-pop argument) + ;; Return to our original state. + (setq last-command 'paredit-yank-pop) + (setq this-command 'paredit-yank-pop) + (save-excursion (backward-up-list) (indent-sexp))) + (t (error "Last command was not a yank or a wrap: %s" last-command)))) + +(defun paredit-splice-sexp (&optional argument) + "Splice the list that the point is on by removing its delimiters. +With a prefix argument as in `C-u', kill all S-expressions backward in + the current list before splicing all S-expressions forward into the + enclosing list. +With two prefix arguments as in `C-u C-u', kill all S-expressions + forward in the current list before splicing all S-expressions + backward into the enclosing list. +With a numerical prefix argument N, kill N S-expressions backward in + the current list before splicing the remaining S-expressions into the + enclosing list. If N is negative, kill forward. +Inside a string, unescape all backslashes, or signal an error if doing + so would invalidate the buffer's structure." + (interactive "P") + (if (paredit-in-string-p) + (paredit-splice-string argument) + (if (paredit-in-comment-p) + (error "Can't splice comment.")) + (paredit-handle-sexp-errors (paredit-enclosing-list-start) + (error "Can't splice top level.")) + (paredit-kill-surrounding-sexps-for-splice argument) + (let ((delete-start (paredit-enclosing-list-start)) + (delete-end + (let ((limit + (save-excursion + (paredit-ignore-sexp-errors (forward-sexp) (backward-sexp)) + (point)))) + (save-excursion + (backward-up-list) + (forward-char +1) + (paredit-skip-whitespace t limit) + (point))))) + (let ((end-marker (make-marker))) + (save-excursion + (up-list) + (delete-char -1) + (set-marker end-marker (point))) + (delete-region delete-start delete-end) + (paredit-splice-reindent delete-start (marker-position end-marker)))))) + +(defun paredit-splice-reindent (start end) + (paredit-preserving-column + ;; If we changed the first subform of the enclosing list, we must + ;; reindent the whole enclosing list. + (if (paredit-handle-sexp-errors + (save-excursion + (backward-up-list) + (down-list) + (paredit-ignore-sexp-errors (forward-sexp)) + (< start (point))) + nil) + (save-excursion (backward-up-list) (indent-sexp)) + (paredit-indent-region start end)))) + +(defun paredit-kill-surrounding-sexps-for-splice (argument) + (cond ((or (paredit-in-string-p) + (paredit-in-comment-p)) + (error "Invalid context for splicing S-expressions.")) + ((or (not argument) (eq argument 0)) nil) + ((or (numberp argument) (eq argument '-)) + ;; Kill S-expressions before/after the point by saving the + ;; point, moving across them, and killing the region. + (let* ((argument (if (eq argument '-) -1 argument)) + (saved (paredit-point-at-sexp-boundary (- argument)))) + (goto-char saved) + (paredit-ignore-sexp-errors (backward-sexp argument)) + (paredit-hack-kill-region saved (point)))) + ((consp argument) + (let ((v (car argument))) + (if (= v 4) ;One `C-u'. + ;; Move backward until we hit the open paren; then + ;; kill that selected region. + (let ((end (point))) + (paredit-ignore-sexp-errors + (while (not (bobp)) + (backward-sexp))) + (paredit-hack-kill-region (point) end)) + ;; Move forward until we hit the close paren; then + ;; kill that selected region. + (let ((beginning (point))) + (paredit-ignore-sexp-errors + (while (not (eobp)) + (forward-sexp))) + (paredit-hack-kill-region beginning (point)))))) + (t (error "Bizarre prefix argument `%s'." argument)))) + +(defun paredit-splice-sexp-killing-backward (&optional n) + "Splice the list the point is on by removing its delimiters, and + also kill all S-expressions before the point in the current list. +With a prefix argument N, kill only the preceding N S-expressions." + (interactive "P") + (paredit-splice-sexp (if n + (prefix-numeric-value n) + '(4)))) + +(defun paredit-splice-sexp-killing-forward (&optional n) + "Splice the list the point is on by removing its delimiters, and + also kill all S-expressions after the point in the current list. +With a prefix argument N, kill only the following N S-expressions." + (interactive "P") + (paredit-splice-sexp (if n + (- (prefix-numeric-value n)) + '(16)))) + +(defun paredit-raise-sexp (&optional argument) + "Raise the following S-expression in a tree, deleting its siblings. +With a prefix argument N, raise the following N S-expressions. If N + is negative, raise the preceding N S-expressions. +If the point is on an S-expression, such as a string or a symbol, not + between them, that S-expression is considered to follow the point." + (interactive "P") + (save-excursion + (cond ((paredit-in-string-p) + (goto-char (car (paredit-string-start+end-points)))) + ((paredit-in-char-p) + (backward-sexp)) + ((paredit-in-comment-p) + (error "No S-expression to raise in comment."))) + ;; Select the S-expressions we want to raise in a buffer substring. + (let* ((n (prefix-numeric-value argument)) + (bound (scan-sexps (point) n)) + (sexps + (if (< n 0) + (buffer-substring bound (paredit-point-at-sexp-end)) + (buffer-substring (paredit-point-at-sexp-start) bound)))) + ;; Move up to the list we're raising those S-expressions out of and + ;; delete it. + (backward-up-list) + (delete-region (point) (scan-sexps (point) 1)) + (let* ((indent-start (point)) + (indent-end (save-excursion (insert sexps) (point)))) + (indent-region indent-start indent-end nil))))) + +;;; The effects of convolution on the surrounding whitespace are pretty +;;; random. If you have better suggestions, please let me know. + +(defun paredit-convolute-sexp (&optional n) + "Convolute S-expressions. +Save the S-expressions preceding point and delete them. +Splice the S-expressions following point. +Wrap the enclosing list in a new list prefixed by the saved text. +With a prefix argument N, move up N lists before wrapping." + (interactive "p") + (paredit-lose-if-not-in-sexp 'paredit-convolute-sexp) + ;; Make sure we can move up before destroying anything. + (save-excursion (backward-up-list n) (backward-up-list)) + (let (open close) ;++ Is this a good idea? + (let ((prefix + (let ((end (point))) + (paredit-ignore-sexp-errors + (while (not (bobp)) (backward-sexp))) + (prog1 (buffer-substring (point) end) + (backward-up-list) + (save-excursion (forward-sexp) + (setq close (char-before)) + (delete-char -1)) + (setq open (char-after)) + (delete-region (point) end) + ;; I'm not sure this makes sense... + (if (not (eolp)) (just-one-space)))))) + (backward-up-list n) + (paredit-insert-pair 1 open close 'goto-char) + (insert prefix) + ;; I'm not sure this makes sense either... + (if (not (eolp)) (just-one-space)) + (save-excursion + (backward-up-list) + (paredit-ignore-sexp-errors (indent-sexp)))))) + +(defun paredit-splice-string (argument) + (let ((original-point (point)) + (start+end (paredit-string-start+end-points))) + (let ((start (car start+end)) + (end (cdr start+end))) + ;; START and END both lie before the respective quote + ;; characters, which we want to delete; thus we increment START + ;; by one to extract the string, and we increment END by one to + ;; delete the string. + (let* ((escaped-string + (cond ((not (consp argument)) + (buffer-substring (1+ start) end)) + ((= 4 (car argument)) + (buffer-substring original-point end)) + (t + (buffer-substring (1+ start) original-point)))) + (unescaped-string + (paredit-unescape-string escaped-string))) + (if (not unescaped-string) + (error "Unspliceable string.") + (save-excursion + (goto-char start) + (delete-region start (1+ end)) + (insert unescaped-string)) + (if (not (and (consp argument) + (= 4 (car argument)))) + (goto-char (- original-point 1)))))))) + +(defun paredit-unescape-string (string) + (with-temp-buffer + (insert string) + (goto-char (point-min)) + (while (and (not (eobp)) + ;; nil -> no bound; t -> no errors. + (search-forward "\\" nil t)) + (delete-char -1) + (forward-char)) + (paredit-handle-sexp-errors + (progn (scan-sexps (point-min) (point-max)) + (buffer-string)) + nil))) + +;;;; Slurpage & Barfage + +(defun paredit-forward-slurp-sexp (&optional argument) + "Add the S-expression following the current list into that list + by moving the closing delimiter. +Automatically reindent the newly slurped S-expression with respect to + its new enclosing form. +If in a string, move the opening double-quote forward by one + S-expression and escape any intervening characters as necessary, + without altering any indentation or formatting." + (interactive "P") + (save-excursion + (cond ((paredit-in-comment-p) + (error "Invalid context for slurping S-expressions.")) + ((numberp argument) + (if (< argument 0) + (paredit-forward-barf-sexp (- 0 argument)) + (while (< 0 argument) + (paredit-forward-slurp-sexp) + (setq argument (- argument 1))))) + ((paredit-in-string-p) + ;; If there is anything to slurp into the string, take that. + ;; Otherwise, try to slurp into the enclosing list. + (if (save-excursion + (goto-char (paredit-enclosing-string-end)) + (paredit-handle-sexp-errors (progn (forward-sexp) nil) + t)) + (progn + (goto-char (paredit-enclosing-string-end)) + (paredit-forward-slurp-into-list argument)) + (paredit-forward-slurp-into-string argument))) + (t + (paredit-forward-slurp-into-list argument))))) + +(defun paredit-forward-slurp-into-list (&optional argument) + (let ((nestedp nil)) + (save-excursion + (up-list) ; Up to the end of the list to + (let ((close (char-before))) ; save and delete the closing + (delete-char -1) ; delimiter. + (let ((start (point))) + (catch 'return ; Go to the end of the desired + (while t ; S-expression, going up a + (paredit-handle-sexp-errors ; list if it's not in this, + (progn (forward-sexp) + (if argument + (paredit-ignore-sexp-errors + (while (not (eobp)) + (forward-sexp)))) + (throw 'return nil)) + (setq nestedp t) + (up-list) + (setq close ; adjusting for mixed + (prog1 (char-before) ; delimiters as necessary, + (delete-char -1) + (insert close)))))) + (insert close) ; to insert that delimiter. + (indent-region start (point) nil)))) + (if (and (not nestedp) + (eq (save-excursion (paredit-skip-whitespace nil) (point)) + (save-excursion (backward-up-list) (forward-char) (point))) + (eq (save-excursion (forward-sexp) (backward-sexp) (point)) + (save-excursion (paredit-skip-whitespace t) (point)))) + (delete-region (save-excursion (paredit-skip-whitespace nil) (point)) + (save-excursion (paredit-skip-whitespace t) (point)))))) + +(defun paredit-forward-slurp-into-string (&optional argument) + (let ((start (paredit-enclosing-string-start)) + (end (paredit-enclosing-string-end))) + (goto-char end) + ;; Signal any errors that we might get first, before mucking with + ;; the buffer's contents. + (save-excursion (forward-sexp)) + (let ((close (char-before))) + ;; Skip intervening whitespace if we're slurping into an empty + ;; string. XXX What about nonempty strings? + (if (and (= (+ start 2) end) + (eq (save-excursion (paredit-skip-whitespace t) (point)) + (save-excursion (forward-sexp) (backward-sexp) (point)))) + (delete-region (- (point) 1) + (save-excursion (paredit-skip-whitespace t) (point))) + (delete-char -1)) + (paredit-forward-for-quote + (save-excursion + (forward-sexp) + (if argument + (while (paredit-handle-sexp-errors (progn (forward-sexp) t) nil))) + (point))) + (insert close)))) + +(defun paredit-forward-barf-sexp (&optional argument) + "Remove the last S-expression in the current list from that list + by moving the closing delimiter. +Automatically reindent the newly barfed S-expression with respect to + its new enclosing form." + (interactive "P") + (paredit-lose-if-not-in-sexp 'paredit-forward-barf-sexp) + (if (and (numberp argument) (< argument 0)) + (paredit-forward-slurp-sexp (- 0 argument)) + (let ((start (point)) (end nil)) + (save-excursion + (up-list) ; Up to the end of the list to + (let ((close (char-before))) ; save and delete the closing + (delete-char -1) ; delimiter. + (setq end (point)) + (paredit-ignore-sexp-errors ; Go back to where we want to + (if (or (not argument) ; insert the delimiter. + (numberp argument)) + (backward-sexp argument) + (while (paredit-handle-sexp-errors + (save-excursion (backward-sexp) (<= start (point))) + nil) + (backward-sexp)))) + (paredit-skip-whitespace nil) ; Skip leading whitespace. + (cond ((bobp) + ;++ We'll have deleted the close, but there's no open. + ;++ Is that OK? + (error "Barfing all subexpressions with no open-paren?")) + ((paredit-in-comment-p) ; Don't put the close-paren in + (newline))) ; a comment. + (insert close)) + ;; Reindent all of the newly barfed S-expressions. Start at the + ;; start of the first barfed S-expression, not at the close we + ;; just inserted. + (forward-sexp) + (backward-sexp) + (if (or (not argument) (numberp argument)) + (paredit-forward-and-indent argument) + (indent-region (point) end)))))) + +(defun paredit-backward-slurp-sexp (&optional argument) + "Add the S-expression preceding the current list into that list + by moving the closing delimiter. +Automatically reindent the whole form into which new S-expression was + slurped. +If in a string, move the opening double-quote backward by one + S-expression and escape any intervening characters as necessary, + without altering any indentation or formatting." + (interactive "P") + (save-excursion + (cond ((paredit-in-comment-p) + (error "Invalid context for slurping S-expressions.")) + ((numberp argument) + (if (< argument 0) + (paredit-backward-barf-sexp (- 0 argument)) + (while (< 0 argument) + (paredit-backward-slurp-sexp) + (setq argument (- argument 1))))) + ((paredit-in-string-p) + ;; If there is anything to slurp into the string, take that. + ;; Otherwise, try to slurp into the enclosing list. + (if (save-excursion + (goto-char (paredit-enclosing-string-start)) + (paredit-handle-sexp-errors (progn (backward-sexp) nil) + t)) + (progn + (goto-char (paredit-enclosing-string-start)) + (paredit-backward-slurp-into-list argument)) + (paredit-backward-slurp-into-string argument))) + (t + (paredit-backward-slurp-into-list argument))))) + +(defun paredit-backward-slurp-into-list (&optional argument) + (let ((nestedp nil)) + (save-excursion + (backward-up-list) + (let ((open (char-after))) + (delete-char +1) + (catch 'return + (while t + (paredit-handle-sexp-errors + (progn (backward-sexp) + (if argument + (paredit-ignore-sexp-errors + (while (not (bobp)) + (backward-sexp)))) + (throw 'return nil)) + (setq nestedp t) + (backward-up-list) + (setq open + (prog1 (char-after) + (save-excursion (insert open) (delete-char +1))))))) + (insert open)) + ;; Reindent the line at the beginning of wherever we inserted the + ;; opening delimiter, and then indent the whole S-expression. + (backward-up-list) + (lisp-indent-line) + (indent-sexp)) + ;; If we slurped into an empty list, don't leave dangling space: + ;; (foo |). + (if (and (not nestedp) + (eq (save-excursion (paredit-skip-whitespace nil) (point)) + (save-excursion (backward-sexp) (forward-sexp) (point))) + (eq (save-excursion (up-list) (backward-char) (point)) + (save-excursion (paredit-skip-whitespace t) (point)))) + (delete-region (save-excursion (paredit-skip-whitespace nil) (point)) + (save-excursion (paredit-skip-whitespace t) (point)))))) + +(defun paredit-backward-slurp-into-string (&optional argument) + (let ((start (paredit-enclosing-string-start)) + (end (paredit-enclosing-string-end))) + (goto-char start) + ;; Signal any errors that we might get first, before mucking with + ;; the buffer's contents. + (save-excursion (backward-sexp)) + (let ((open (char-after)) + (target (point))) + ;; Skip intervening whitespace if we're slurping into an empty + ;; string. XXX What about nonempty strings? + (if (and (= (+ start 2) end) + (eq (save-excursion (paredit-skip-whitespace nil) (point)) + (save-excursion (backward-sexp) (forward-sexp) (point)))) + (delete-region (save-excursion (paredit-skip-whitespace nil) (point)) + (+ (point) 1)) + (delete-char +1)) + (backward-sexp) + (if argument + (paredit-ignore-sexp-errors + (while (not (bobp)) + (backward-sexp)))) + (insert open) + (paredit-forward-for-quote target)))) + +(defun paredit-backward-barf-sexp (&optional argument) + "Remove the first S-expression in the current list from that list + by moving the closing delimiter. +Automatically reindent the barfed S-expression and the form from which + it was barfed." + (interactive "P") + (paredit-lose-if-not-in-sexp 'paredit-backward-barf-sexp) + (if (and (numberp argument) (< argument 0)) + (paredit-backward-slurp-sexp (- 0 argument)) + (let ((end (make-marker))) + (set-marker end (point)) + (save-excursion + (backward-up-list) + (let ((open (char-after))) + (delete-char +1) + (paredit-ignore-sexp-errors + (paredit-forward-and-indent + (if (or (not argument) (numberp argument)) + argument + (let ((n 0)) + (save-excursion + (while (paredit-handle-sexp-errors + (save-excursion + (forward-sexp) + (<= (point) end)) + nil) + (forward-sexp) + (setq n (+ n 1)))) + n)))) + (while (progn (paredit-skip-whitespace t) (eq (char-after) ?\; )) + (forward-line 1)) + (if (eobp) + ;++ We'll have deleted the close, but there's no open. + ;++ Is that OK? + (error "Barfing all subexpressions with no close-paren?")) + ;** Don't use `insert' here. Consider, e.g., barfing from + ;** (foo|) + ;** and how `save-excursion' works. + (insert-before-markers open)) + (backward-up-list) + (lisp-indent-line) + (indent-sexp))))) + +;;;; Splitting & Joining + +(defun paredit-split-sexp () + "Split the list or string the point is on into two." + (interactive) + (cond ((paredit-in-string-p) + (insert "\"") + (save-excursion (insert " \""))) + ((or (paredit-in-comment-p) + (paredit-in-char-p)) + (error "Invalid context for splitting S-expression.")) + (t + (let ((open (save-excursion (backward-up-list) (char-after))) + (close (save-excursion (up-list) (char-before)))) + (delete-horizontal-space) + (insert close) + (save-excursion + (insert ?\ ) + (insert open) + (backward-char) + (indent-sexp)))))) + +(defun paredit-join-sexps () + "Join the S-expressions adjacent on either side of the point. +Both must be lists, strings, or atoms; error if there is a mismatch." + (interactive) + (cond ((paredit-in-comment-p) (error "Can't join S-expressions in comment.")) + ((paredit-in-string-p) (error "Nothing to join in a string.")) + ((paredit-in-char-p) (error "Can't join characters."))) + (let ((left-point (paredit-point-at-sexp-end)) + (right-point (paredit-point-at-sexp-start))) + (let ((left-char (char-before left-point)) + (right-char (char-after right-point))) + (let ((left-syntax (char-syntax left-char)) + (right-syntax (char-syntax right-char))) + (cond ((< right-point left-point) + (error "Can't join a datum with itself.")) + ((and (eq left-syntax ?\) ) + (eq right-syntax ?\( ) + (eq left-char (matching-paren right-char)) + (eq right-char (matching-paren left-char))) + (paredit-join-lists-internal left-point right-point) + (paredit-preserving-column + (save-excursion + (backward-up-list) + (indent-sexp)))) + ((and (eq left-syntax ?\" ) + (eq right-syntax ?\" )) + ;; Delete any intermediate formatting. + (delete-region (1- left-point) (1+ right-point))) + ((and (memq left-syntax '(?w ?_)) ; Word or symbol + (memq right-syntax '(?w ?_))) + (delete-region left-point right-point)) + (t (error "Mismatched S-expressions to join."))))))) + +(defun paredit-join-lists-internal (left-point right-point) + (save-excursion + ;; Leave intermediate formatting alone. + (goto-char right-point) + (delete-char +1) + (goto-char left-point) + (delete-char -1) + ;; Kludge: Add an extra space in several conditions. + (if (or + ;; (foo)| ;x\n(bar) => (foo | ;x\nbar), not (foo| ;x\nbar). + (and (not (eolp)) + (save-excursion + (paredit-skip-whitespace t (point-at-eol)) + (eq (char-after) ?\;))) + ;; (foo)|(bar) => (foo| bar), not (foo|bar). + (and (= left-point right-point) + (not (or (eq ?\ (char-syntax (char-before))) + (eq ?\ (char-syntax (char-after))))))) + (insert ?\ )))) + +;++ How ought paredit-join to handle comments intervening symbols or strings? +;++ Idea: +;++ +;++ "foo" | ;bar +;++ "baz" ;quux +;++ +;++ => +;++ +;++ "foo|baz" ;bar +;++ ;quux +;++ +;++ The point should stay where it is relative to the comments, and the +;++ the comments' columns should all be preserved, perhaps. Hmmmm... +;++ What about this? +;++ +;++ "foo" ;bar +;++ | ;baz +;++ "quux" ;zot + +;++ Should rename: +;++ paredit-point-at-sexp-start -> paredit-start-of-sexp-after-point +;++ paredit-point-at-sexp-end -> paredit-end-of-sexp-before-point + +;;;; Variations on the Lurid Theme + +;;; I haven't the imagination to concoct clever names for these. + +(defun paredit-add-to-previous-list () + "Add the S-expression following point to the list preceding point." + (interactive) + (paredit-lose-if-not-in-sexp 'paredit-add-to-previous-list) + (save-excursion + (down-list -1) ;++ backward-down-list... + (paredit-forward-slurp-sexp))) + +(defun paredit-add-to-next-list () + "Add the S-expression preceding point to the list following point. +If no S-expression precedes point, move up the tree until one does." + (interactive) + (paredit-lose-if-not-in-sexp 'paredit-add-to-next-list) + (save-excursion + (down-list) + (paredit-backward-slurp-sexp))) + +(defun paredit-join-with-previous-list () + "Join the list the point is on with the previous list in the buffer." + (interactive) + (paredit-lose-if-not-in-sexp 'paredit-join-with-previous-list) + (save-excursion + (while (paredit-handle-sexp-errors (save-excursion (backward-sexp) nil) + (backward-up-list) + t)) + (paredit-join-sexps))) + +(defun paredit-join-with-next-list () + "Join the list the point is on with the next list in the buffer." + (interactive) + (paredit-lose-if-not-in-sexp 'paredit-join-with-next-list) + (save-excursion + (while (paredit-handle-sexp-errors (save-excursion (forward-sexp) nil) + (up-list) + t)) + (paredit-join-sexps))) + +;;;; Utilities + +(defun paredit-in-string-escape-p () + "True if the point is on a character escape of a string. +This is true only if the character is preceded by an odd number of + backslashes. +This assumes that `paredit-in-string-p' has already returned true." + (let ((oddp nil)) + (save-excursion + (while (eq (char-before) ?\\ ) + (setq oddp (not oddp)) + (backward-char))) + oddp)) + +(defun paredit-in-char-p (&optional position) + "True if point is on a character escape outside a string." + (save-excursion + (goto-char (or position (point))) + (paredit-in-string-escape-p))) + +(defun paredit-skip-whitespace (trailing-p &optional limit) + "Skip past any whitespace, or until the point LIMIT is reached. +If TRAILING-P is nil, skip leading whitespace; otherwise, skip trailing + whitespace." + (funcall (if trailing-p 'skip-chars-forward 'skip-chars-backward) + " \t\n " ; This should skip using the syntax table, but LF + limit)) ; is a comment end, not newline, in Lisp mode. + +(defalias 'paredit-region-active-p + (xcond ((paredit-xemacs-p) 'region-active-p) + ((paredit-gnu-emacs-p) + (lambda () + (and mark-active transient-mark-mode))))) + +(defun paredit-hack-kill-region (start end) + "Kill the region between START and END. +Do not append to any current kill, and + do not let the next kill append to this one." + (interactive "r") ;Eh, why not? + ;; KILL-REGION sets THIS-COMMAND to tell the next kill that the last + ;; command was a kill. It also checks LAST-COMMAND to see whether it + ;; should append. If we bind these locally, any modifications to + ;; THIS-COMMAND will be masked, and it will not see LAST-COMMAND to + ;; indicate that it should append. + (let ((this-command nil) + (last-command nil)) + (kill-region start end))) + +;;;;; Reindentation utilities + +;++ Should `paredit-indent-sexps' and `paredit-forward-and-indent' use +;++ `paredit-indent-region' rather than `indent-region'? + +(defun paredit-indent-sexps () + "If in a list, indent all following S-expressions in the list." + (let* ((start (point)) + (end (paredit-handle-sexp-errors (progn (up-list) (point)) nil))) + (if end + (indent-region start end nil)))) + +(defun paredit-forward-and-indent (&optional n) + "Move forward by N S-expressions, indenting them with `indent-region'." + (let ((start (point))) + (forward-sexp n) + (indent-region start (point) nil))) + +(defun paredit-indent-region (start end) + "Indent the region from START to END. +Don't reindent the line starting at START, however." + (if (not (<= start end)) + (error "Incorrectly related points: %S, %S" start end)) + (save-excursion + (goto-char start) + (let ((bol (point-at-bol))) + ;; Skip all S-expressions that end on the starting line, but + ;; don't go past `end'. + (if (and (save-excursion (goto-char end) (not (eq bol (point-at-bol)))) + (paredit-handle-sexp-errors + (catch 'exit + (while t + (save-excursion + (forward-sexp) + (if (not (eq bol (point-at-bol))) + (throw 'exit t)) + (if (not (< (point) end)) + (throw 'exit nil))) + (forward-sexp))) + nil)) + (progn + ;; Point is still on the same line, but precedes an + ;; S-expression that ends on a different line. + (if (not (eq bol (point-at-bol))) + (error "Internal error -- we moved forward a line!")) + (goto-char (+ 1 (point-at-eol))) + (if (not (<= (point) end)) + (error "Internal error -- we frobnitzed the garfnut!")) + (indent-region (point) end nil)))))) + +;;;;; S-expression Parsing Utilities + +;++ These routines redundantly traverse S-expressions a great deal. +;++ If performance issues arise, this whole section will probably have +;++ to be refactored to preserve the state longer, like paredit.scm +;++ does, rather than to traverse the definition N times for every key +;++ stroke as it presently does. + +(defun paredit-current-parse-state () + "Return parse state of point from beginning of defun." + (let ((point (point))) + (beginning-of-defun) + ;; Calling PARSE-PARTIAL-SEXP will advance the point to its second + ;; argument (unless parsing stops due to an error, but we assume it + ;; won't in paredit-mode). + (parse-partial-sexp (point) point))) + +(defun paredit-in-string-p (&optional state) + "True if the parse state is within a double-quote-delimited string. +If no parse state is supplied, compute one from the beginning of the + defun to the point." + ;; 3. non-nil if inside a string (the terminator character, really) + (and (nth 3 (or state (paredit-current-parse-state))) + t)) + +(defun paredit-string-start+end-points (&optional state) + "Return a cons of the points of open and close quotes of the string. +The string is determined from the parse state STATE, or the parse state + from the beginning of the defun to the point. +This assumes that `paredit-in-string-p' has already returned true, i.e. + that the point is already within a string." + (save-excursion + ;; 8. character address of start of comment or string; nil if not + ;; in one + (let ((start (nth 8 (or state (paredit-current-parse-state))))) + (goto-char start) + (forward-sexp 1) + (cons start (1- (point)))))) + +(defun paredit-enclosing-string-start () + (car (paredit-string-start+end-points))) + +(defun paredit-enclosing-string-end () + (+ 1 (cdr (paredit-string-start+end-points)))) + +(defun paredit-enclosing-list-start () + (save-excursion + (backward-up-list) + (point))) + +(defun paredit-enclosing-list-end () + (save-excursion + (up-list) + (point))) + +(defun paredit-in-comment-p (&optional state) + "True if parse state STATE is within a comment. +If no parse state is supplied, compute one from the beginning of the + defun to the point." + ;; 4. nil if outside a comment, t if inside a non-nestable comment, + ;; else an integer (the current comment nesting) + (and (nth 4 (or state (paredit-current-parse-state))) + t)) + +(defun paredit-prefix-numeric-value (argument) + ;++ Kludgerific. + (cond ((integerp argument) argument) + ((eq argument '-) -1) + ((consp argument) + (cond ((equal argument '(4)) (paredit-count-sexps-forward)) ;C-u + ((equal argument '(16)) (paredit-count-sexps-backward)) ;C-u C-u + (t (error "Invalid prefix argument: %S" argument)))) + ((paredit-region-active-p) + (save-excursion + (save-restriction + (narrow-to-region (region-beginning) (region-end)) + (cond ((= (point) (point-min)) (paredit-count-sexps-forward)) + ((= (point) (point-max)) (paredit-count-sexps-backward)) + (t + (error "Point %S is not start or end of region: %S..%S" + (point) (region-beginning) (region-end))))))) + (t 1))) + +(defun paredit-count-sexps-forward () + (save-excursion + (let ((n 0) (p nil)) ;hurk + (paredit-ignore-sexp-errors + (while (setq p (scan-sexps (point) +1)) + (goto-char p) + (setq n (+ n 1)))) + n))) + +(defun paredit-count-sexps-backward () + (save-excursion + (let ((n 0) (p nil)) ;hurk + (paredit-ignore-sexp-errors + (while (setq p (scan-sexps (point) -1)) + (goto-char p) + (setq n (+ n 1)))) + n))) + +(defun paredit-point-at-sexp-boundary (n) + (cond ((< n 0) (paredit-point-at-sexp-start)) + ((= n 0) (point)) + ((> n 0) (paredit-point-at-sexp-end)))) + +(defun paredit-point-at-sexp-start () + (save-excursion + (forward-sexp) + (backward-sexp) + (point))) + +(defun paredit-point-at-sexp-end () + (save-excursion + (backward-sexp) + (forward-sexp) + (point))) + +(defun paredit-lose-if-not-in-sexp (command) + (if (or (paredit-in-string-p) + (paredit-in-comment-p) + (paredit-in-char-p)) + (error "Invalid context for command `%s'." command))) + +(defun paredit-check-region (start end) + "Signal an error if text between `start' and `end' is unbalanced." + ;; `narrow-to-region' will move the point, so avoid calling it if we + ;; don't need to. We don't want to use `save-excursion' because we + ;; want the point to move if `check-parens' reports an error. + (if (not (paredit-region-ok-p start end)) + (save-restriction + (narrow-to-region start end) + (check-parens)))) + +(defun paredit-region-ok-p (start end) + "Return true iff the region between `start' and `end' is balanced. +This is independent of context -- it doesn't check what state the + text at `start' is in." + (save-excursion + (paredit-handle-sexp-errors + (progn + (save-restriction + (narrow-to-region start end) + (scan-sexps (point-min) (point-max))) + t) + nil))) + +(defun paredit-current-indentation () + (save-excursion + (back-to-indentation) + (current-column))) + +(defun paredit-restore-column (column indentation) + ;; Preserve the point's position either in the indentation or in the + ;; code: if on code, move with the code; if in indentation, leave it + ;; in the indentation, either where it was (if still on indentation) + ;; or at the end of the indentation (if the code moved far enough + ;; left). + (let ((indentation* (paredit-current-indentation))) + (goto-char + (+ (point-at-bol) + (cond ((not (< column indentation)) + (+ column (- indentation* indentation))) + ((<= indentation* column) indentation*) + (t column)))))) + +;;;; Initialization + +(paredit-define-keys) +(paredit-annotate-mode-with-examples) +(paredit-annotate-functions-with-examples) + +(provide 'paredit) + +;;; Local Variables: +;;; outline-regexp: " \n;;;;+" +;;; End: + +;;; paredit.el ends here diff --git a/elpa/paredit-20140128.1248/paredit.elc b/elpa/paredit-20140128.1248/paredit.elc new file mode 100644 index 000000000..5b332f8c5 Binary files /dev/null and b/elpa/paredit-20140128.1248/paredit.elc differ diff --git a/elpa/pkg-info-20140610.630/pkg-info-autoloads.el b/elpa/pkg-info-20140610.630/pkg-info-autoloads.el new file mode 100644 index 000000000..e1473d878 --- /dev/null +++ b/elpa/pkg-info-20140610.630/pkg-info-autoloads.el @@ -0,0 +1,131 @@ +;;; pkg-info-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (pkg-info-version-info pkg-info-package-version +;;;;;; pkg-info-defining-library-version pkg-info-defining-library-original-version +;;;;;; pkg-info-library-version pkg-info-library-original-version) +;;;;;; "pkg-info" "pkg-info.el" (21478 16658 0 0)) +;;; Generated autoloads from pkg-info.el + +(autoload 'pkg-info-library-original-version "pkg-info" "\ +Get the original version in the header of LIBRARY. + +The original version is stored in the X-Original-Version header. +This header is added by the MELPA package archive to preserve +upstream version numbers. + +LIBRARY is either a symbol denoting a named feature, or a library +name as string. + +If SHOW is non-nil, show the version in the minibuffer. + +Return the version from the header of LIBRARY as list. Signal an +error if the LIBRARY was not found or had no X-Original-Version +header. + +See Info node `(elisp)Library Headers' for more information +about library headers. + +\(fn LIBRARY &optional SHOW)" t nil) + +(autoload 'pkg-info-library-version "pkg-info" "\ +Get the version in the header of LIBRARY. + +LIBRARY is either a symbol denoting a named feature, or a library +name as string. + +If SHOW is non-nil, show the version in the minibuffer. + +Return the version from the header of LIBRARY as list. Signal an +error if the LIBRARY was not found or had no proper header. + +See Info node `(elisp)Library Headers' for more information +about library headers. + +\(fn LIBRARY &optional SHOW)" t nil) + +(autoload 'pkg-info-defining-library-original-version "pkg-info" "\ +Get the original version of the library defining FUNCTION. + +The original version is stored in the X-Original-Version header. +This header is added by the MELPA package archive to preserve +upstream version numbers. + +If SHOW is non-nil, show the version in mini-buffer. + +This function is mainly intended to find the version of a major +or minor mode, i.e. + + (pkg-info-defining-library-version 'flycheck-mode) + +Return the version of the library defining FUNCTION. Signal an +error if FUNCTION is not a valid function, if its defining +library was not found, or if the library had no proper version +header. + +\(fn FUNCTION &optional SHOW)" t nil) + +(autoload 'pkg-info-defining-library-version "pkg-info" "\ +Get the version of the library defining FUNCTION. + +If SHOW is non-nil, show the version in mini-buffer. + +This function is mainly intended to find the version of a major +or minor mode, i.e. + + (pkg-info-defining-library-version 'flycheck-mode) + +Return the version of the library defining FUNCTION. Signal an +error if FUNCTION is not a valid function, if its defining +library was not found, or if the library had no proper version +header. + +\(fn FUNCTION &optional SHOW)" t nil) + +(autoload 'pkg-info-package-version "pkg-info" "\ +Get the version of an installed PACKAGE. + +If SHOW is non-nil, show the version in the minibuffer. + +Return the version as list, or nil if PACKAGE is not installed. + +\(fn PACKAGE &optional SHOW)" t nil) + +(autoload 'pkg-info-version-info "pkg-info" "\ +Obtain complete version info for LIBRARY and PACKAGE. + +LIBRARY is a symbol denoting a named feature, or a library name +as string. PACKAGE is a symbol denoting an ELPA package. If +omitted or nil, default to LIBRARY. + +If SHOW is non-nil, show the version in the minibuffer. + +When called interactively, prompt for LIBRARY. When called +interactively with prefix argument, prompt for PACKAGE as well. + +Return a string with complete version information for LIBRARY. +This version information contains the version from the headers of +LIBRARY, and the version of the installed PACKAGE, the LIBRARY is +part of. If PACKAGE is not installed, or if the PACKAGE version +is the same as the LIBRARY version, do not include a package +version. + +\(fn LIBRARY &optional PACKAGE SHOW)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("pkg-info-pkg.el") (21478 16658 877262 +;;;;;; 0)) + +;;;*** + +(provide 'pkg-info-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; pkg-info-autoloads.el ends here diff --git a/elpa/pkg-info-20140610.630/pkg-info-pkg.el b/elpa/pkg-info-20140610.630/pkg-info-pkg.el new file mode 100644 index 000000000..9e603b6d0 --- /dev/null +++ b/elpa/pkg-info-20140610.630/pkg-info-pkg.el @@ -0,0 +1 @@ +(define-package "pkg-info" "20140610.630" "Information about packages" (quote ((epl "0.4")))) diff --git a/elpa/pkg-info-20140610.630/pkg-info-pkg.elc b/elpa/pkg-info-20140610.630/pkg-info-pkg.elc new file mode 100644 index 000000000..06da90747 Binary files /dev/null and b/elpa/pkg-info-20140610.630/pkg-info-pkg.elc differ diff --git a/elpa/pkg-info-20140610.630/pkg-info.el b/elpa/pkg-info-20140610.630/pkg-info.el new file mode 100644 index 000000000..5c36a81d0 --- /dev/null +++ b/elpa/pkg-info-20140610.630/pkg-info.el @@ -0,0 +1,279 @@ +;;; pkg-info.el --- Information about packages -*- lexical-binding: t; -*- + +;; Copyright (C) 2013, 2014 Sebastian Wiesner + +;; Author: Sebastian Wiesner +;; URL: https://github.com/lunaryorn/pkg-info.el +;; Keywords: convenience +;; Version: 20140610.630 +;; X-Original-Version: 0.6-cvs +;; Package-Requires: ((epl "0.4")) + +;; 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 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 . + +;;; Commentary: + +;; This library extracts information from installed packages. + +;;;; Functions: + +;; `pkg-info-library-version' extracts the version from the header of a library. +;; +;; `pkg-info-defining-library-version' extracts the version from the header of a +;; library defining a function. +;; +;; `pkg-info-package-version' gets the version of an installed package. +;; +;; `pkg-info-format-version' formats a version list as human readable string. +;; +;; `pkg-info-version-info' returns complete version information for a specific +;; package. + +;;; Code: + +(require 'epl) + +(require 'lisp-mnt) +(require 'find-func) + + +;;; Version information +(defun pkg-info-format-version (version) + "Format VERSION as human-readable string. + +Return a human-readable string representing VERSION." + ;; XXX: Find a better, more flexible way of formatting? + (package-version-join version)) + +(defsubst pkg-info--show-version-and-return (version show) + "Show and return VERSION. + +When SHOW is non-nil, show VERSION in minibuffer. + +Return VERSION." + (when show + (message (if (listp version) (pkg-info-format-version version) version))) + version) + +(defun pkg-info--read-library () + "Read a library from minibuffer." + (completing-read "Load library: " + (apply-partially 'locate-file-completion-table + load-path + (get-load-suffixes)))) + +(defun pkg-info--read-function () + "Read a function name from minibuffer." + (let ((input (completing-read "Function: " obarray #'boundp :require-match))) + (if (string= input "") nil (intern input)))) + +(defun pkg-info--read-package () + "Read a package name from minibuffer." + (let* ((installed (epl-installed-packages)) + (names (sort (mapcar (lambda (pkg) + (symbol-name (epl-package-name pkg))) + installed) + #'string<)) + (default (car names))) + (completing-read "Installed package: " names nil 'require-match + nil nil default))) + +(defun pkg-info-library-source (library) + "Get the source file of LIBRARY. + +LIBRARY is either a symbol denoting a named feature, or a library +name as string. + +Return the source file of LIBRARY as string." + (find-library-name (if (symbolp library) (symbol-name library) library))) + +(defun pkg-info-defining-library (function) + "Get the source file of the library defining FUNCTION. + +FUNCTION is a function symbol. + +Return the file name of the library as string. Signal an error +if the library does not exist, or if the definition of FUNCTION +was not found." + (unless (functionp function) + (signal 'wrong-type-argument (list 'functionp function))) + (let ((library (symbol-file function 'defun))) + (unless library + (error "Can't find definition of %s" function)) + library)) + +(defun pkg-info-x-original-version (file) + "Read the X-Original-Version header from FILE. + +Return the value as version list, or return nil if FILE lacks +this header. Signal an error, if the value of the header is not +a valid version." + (let ((version-str (with-temp-buffer + (insert-file-contents file) + (lm-header "X-Original-Version")))) + (when version-str + (version-to-list version-str)))) + +;;;###autoload +(defun pkg-info-library-original-version (library &optional show) + "Get the original version in the header of LIBRARY. + +The original version is stored in the X-Original-Version header. +This header is added by the MELPA package archive to preserve +upstream version numbers. + +LIBRARY is either a symbol denoting a named feature, or a library +name as string. + +If SHOW is non-nil, show the version in the minibuffer. + +Return the version from the header of LIBRARY as list. Signal an +error if the LIBRARY was not found or had no X-Original-Version +header. + +See Info node `(elisp)Library Headers' for more information +about library headers." + (interactive (list (pkg-info--read-library) t)) + (let ((version (pkg-info-x-original-version + (pkg-info-library-source library)))) + (if version + (pkg-info--show-version-and-return version show) + (error "Library %s has no original version" library)))) + +;;;###autoload +(defun pkg-info-library-version (library &optional show) + "Get the version in the header of LIBRARY. + +LIBRARY is either a symbol denoting a named feature, or a library +name as string. + +If SHOW is non-nil, show the version in the minibuffer. + +Return the version from the header of LIBRARY as list. Signal an +error if the LIBRARY was not found or had no proper header. + +See Info node `(elisp)Library Headers' for more information +about library headers." + (interactive (list (pkg-info--read-library) t)) + (let* ((source (pkg-info-library-source library)) + (version (epl-package-version (epl-package-from-file source)))) + (pkg-info--show-version-and-return version show))) + +;;;###autoload +(defun pkg-info-defining-library-original-version (function &optional show) + "Get the original version of the library defining FUNCTION. + +The original version is stored in the X-Original-Version header. +This header is added by the MELPA package archive to preserve +upstream version numbers. + +If SHOW is non-nil, show the version in mini-buffer. + +This function is mainly intended to find the version of a major +or minor mode, i.e. + + (pkg-info-defining-library-version 'flycheck-mode) + +Return the version of the library defining FUNCTION. Signal an +error if FUNCTION is not a valid function, if its defining +library was not found, or if the library had no proper version +header." + (interactive (list (pkg-info--read-function) t)) + (pkg-info-library-original-version (pkg-info-defining-library function) show)) + +;;;###autoload +(defun pkg-info-defining-library-version (function &optional show) + "Get the version of the library defining FUNCTION. + +If SHOW is non-nil, show the version in mini-buffer. + +This function is mainly intended to find the version of a major +or minor mode, i.e. + + (pkg-info-defining-library-version 'flycheck-mode) + +Return the version of the library defining FUNCTION. Signal an +error if FUNCTION is not a valid function, if its defining +library was not found, or if the library had no proper version +header." + (interactive (list (pkg-info--read-function) t)) + (pkg-info-library-version (pkg-info-defining-library function) show)) + +;;;###autoload +(defun pkg-info-package-version (package &optional show) + "Get the version of an installed PACKAGE. + +If SHOW is non-nil, show the version in the minibuffer. + +Return the version as list, or nil if PACKAGE is not installed." + (interactive (list (pkg-info--read-package) t)) + (let* ((name (if (stringp package) (intern package) package)) + (package (epl-find-installed-package name))) + (unless package + (error "Can't find installed package %s" name)) + (pkg-info--show-version-and-return (epl-package-version package) show))) + +;;;###autoload +(defun pkg-info-version-info (library &optional package show) + "Obtain complete version info for LIBRARY and PACKAGE. + +LIBRARY is a symbol denoting a named feature, or a library name +as string. PACKAGE is a symbol denoting an ELPA package. If +omitted or nil, default to LIBRARY. + +If SHOW is non-nil, show the version in the minibuffer. + +When called interactively, prompt for LIBRARY. When called +interactively with prefix argument, prompt for PACKAGE as well. + +Return a string with complete version information for LIBRARY. +This version information contains the version from the headers of +LIBRARY, and the version of the installed PACKAGE, the LIBRARY is +part of. If PACKAGE is not installed, or if the PACKAGE version +is the same as the LIBRARY version, do not include a package +version." + (interactive (list (pkg-info--read-library) + (when current-prefix-arg + (pkg-info--read-package)) + t)) + (let* ((package (or package (if (stringp library) (intern library) library))) + (orig-version (condition-case nil + (pkg-info-library-original-version library) + (error nil))) + ;; If we have X-Original-Version, we assume that MELPA replaced the + ;; library version with its generated version, so we use the + ;; X-Original-Version header instead, and ignore the library version + ;; header + (lib-version (or orig-version (pkg-info-library-version library))) + (pkg-version (condition-case nil + (pkg-info-package-version package) + (error nil))) + (version (if (and pkg-version + (not (version-list-= lib-version pkg-version))) + (format "%s (package: %s)" + (pkg-info-format-version lib-version) + (pkg-info-format-version pkg-version)) + (pkg-info-format-version lib-version)))) + (pkg-info--show-version-and-return version show))) + +(provide 'pkg-info) + +;; Local Variables: +;; indent-tabs-mode: nil +;; coding: utf-8 +;; End: + +;;; pkg-info.el ends here diff --git a/elpa/pkg-info-20140610.630/pkg-info.elc b/elpa/pkg-info-20140610.630/pkg-info.elc new file mode 100644 index 000000000..546153919 Binary files /dev/null and b/elpa/pkg-info-20140610.630/pkg-info.elc differ diff --git a/elpa/popup-20140207.1702/popup-autoloads.el b/elpa/popup-20140207.1702/popup-autoloads.el new file mode 100644 index 000000000..3474b028d --- /dev/null +++ b/elpa/popup-20140207.1702/popup-autoloads.el @@ -0,0 +1,18 @@ +;;; popup-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("popup-pkg.el" "popup.el") (21478 16656 +;;;;;; 601786 0)) + +;;;*** + +(provide 'popup-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; popup-autoloads.el ends here diff --git a/elpa/popup-20140207.1702/popup-pkg.el b/elpa/popup-20140207.1702/popup-pkg.el new file mode 100644 index 000000000..79df43d34 --- /dev/null +++ b/elpa/popup-20140207.1702/popup-pkg.el @@ -0,0 +1 @@ +(define-package "popup" "20140207.1702" "Visual Popup User Interface" (quote ((cl-lib "0.3")))) diff --git a/elpa/popup-20140207.1702/popup-pkg.elc b/elpa/popup-20140207.1702/popup-pkg.elc new file mode 100644 index 000000000..bb726814b Binary files /dev/null and b/elpa/popup-20140207.1702/popup-pkg.elc differ diff --git a/elpa/popup-20140207.1702/popup.el b/elpa/popup-20140207.1702/popup.el new file mode 100644 index 000000000..287785435 --- /dev/null +++ b/elpa/popup-20140207.1702/popup.el @@ -0,0 +1,1411 @@ +;;; popup.el --- Visual Popup User Interface + +;; Copyright (C) 2009, 2010, 2011, 2012, 2013 Tomohiro Matsuyama + +;; Author: Tomohiro Matsuyama +;; Keywords: lisp +;; Version: 20140207.1702 +;; X-Original-Version: 0.5.0 +;; Package-Requires: ((cl-lib "0.3")) + +;; 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 . + +;;; Commentary: + +;; popup.el is a visual popup user interface library for Emacs. This +;; provides a basic API and common UI widgets such as popup tooltips +;; and popup menus. +;; See README.markdown for more information. + +;;; Code: + +(require 'cl-lib) + +(defconst popup-version "0.5.0") + + + +;;; Utilities + +(defun popup-calculate-max-width (max-width) + "Determines whether the width desired is +character or window proportion based, And returns the result." + (cl-typecase max-width + (integer max-width) + (float (* (ceiling (/ (round (* max-width (window-width))) 10.0)) 10)))) + +(defvar popup-use-optimized-column-computation t + "Use the optimized column computation routine. +If there is a problem, please set it nil.") + +(defmacro popup-aif (test then &rest else) + "Anaphoric if." + (declare (indent 2)) + `(let ((it ,test)) + (if it ,then ,@else))) + +(defmacro popup-awhen (test &rest body) + "Anaphoric when." + (declare (indent 1)) + `(let ((it ,test)) + (when it ,@body))) + +(defun popup-x-to-string (x) + "Convert any object to string effeciently. +This is faster than `prin1-to-string' in many cases." + (cl-typecase x + (string x) + (symbol (symbol-name x)) + (integer (number-to-string x)) + (float (number-to-string x)) + (t (format "%s" x)))) + +(defun popup-substring-by-width (string width) + "Return a cons cell of substring and remaining string by +splitting with WIDTH." + ;; Expand tabs into 4 spaces + (setq string (replace-regexp-in-string "\t" " " string)) + (cl-loop with len = (length string) + with w = 0 + for l from 0 + for c in (append string nil) + while (<= (cl-incf w (char-width c)) width) + finally return + (if (< l len) + (cons (substring string 0 l) (substring string l)) + (list string)))) + +(defun popup-fill-string (string &optional width max-width justify squeeze) + "Split STRING into fixed width strings and return a cons cell +like \(WIDTH . ROWS). Here, the car WIDTH indicates the actual +maxim width of ROWS. + +The argument WIDTH specifies the width of filling each +paragraph. WIDTH nil means don't perform any justification and +word wrap. Note that this function doesn't add any padding +characters at the end of each row. + +MAX-WIDTH, if WIDTH is nil, specifies the maximum number of +columns. + +The optional fourth argument JUSTIFY specifies which kind of +justification to do: `full', `left', `right', `center', or +`none' (equivalent to nil). A value of t means handle each +paragraph as specified by its text properties. + +SQUEEZE nil means leave whitespaces other than line breaks +untouched." + (if (eq width 0) + (error "Can't fill string with 0 width")) + (if width + (setq max-width width)) + (with-temp-buffer + (let ((tab-width 4) + (fill-column width) + (left-margin 0) + (kinsoku-limit 1) + indent-tabs-mode + row rows) + (insert string) + (untabify (point-min) (point-max)) + (if width + (fill-region (point-min) (point-max) justify (not squeeze))) + (goto-char (point-min)) + (setq width 0) + (while (prog2 + (let ((line (buffer-substring + (point) (progn (end-of-line) (point))))) + (if max-width + (while (progn + (setq row (truncate-string-to-width line max-width) + width (max width (string-width row))) + (push row rows) + (if (not (= (length row) (length line))) + (setq line (substring line (length row)))))) + (setq width (max width (string-width line))) + (push line rows))) + (< (point) (point-max)) + (beginning-of-line 2))) + (cons width (nreverse rows))))) + +(defmacro popup-save-buffer-state (&rest body) + (declare (indent 0)) + `(save-excursion + (let ((buffer-undo-list t) + (inhibit-read-only t) + (modified (buffer-modified-p))) + (unwind-protect + (progn ,@body) + (set-buffer-modified-p modified))))) + +(defun popup-window-full-width-p (&optional window) + "A portable version of `window-full-width-p'." + (if (fboundp 'window-full-width-p) + (window-full-width-p window) + (= (window-width window) (frame-width (window-frame (or window (selected-window))))))) + +(defun popup-truncated-partial-width-window-p (&optional window) + "A portable version of `truncated-partial-width-window-p'." + (unless window + (setq window (selected-window))) + (unless (popup-window-full-width-p window) + (let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows + (window-buffer window)))) + (if (integerp t-p-w-w) + (< (window-width window) t-p-w-w) + t-p-w-w)))) + +(defun popup-current-physical-column () + "Return the current physical column." + (or (when (and popup-use-optimized-column-computation + (eq (window-hscroll) 0)) + (let ((current-column (current-column))) + (if (or (popup-truncated-partial-width-window-p) + truncate-lines + (< current-column (window-width))) + current-column))) + (car (posn-col-row (posn-at-point))))) + +(defun popup-vertical-motion (column direction) + "A portable version of `vertical-motion'." + (if (>= emacs-major-version 23) + (vertical-motion (cons column direction)) + (vertical-motion direction) + (move-to-column (+ (current-column) column)))) + +(defun popup-last-line-of-buffer-p () + "Return non-nil if the cursor is at the last line of the +buffer." + (save-excursion (end-of-line) (/= (forward-line) 0))) + +(defun popup-lookup-key-by-event (function event) + (or (funcall function (vector event)) + (if (symbolp event) + (popup-aif (get event 'event-symbol-element-mask) + (funcall function + (vector (logior (or (get (car it) 'ascii-character) + 0) + (cadr it)))))))) + + + +;;; Core + +(defgroup popup nil + "Visual Popup User Interface" + :group 'lisp + :prefix "popup-") + +(defface popup-face + '((t (:background "lightgray" :foreground "black"))) + "Face for popup." + :group 'popup) + +(defface popup-summary-face + '((t (:inherit popup-face :foreground "dimgray"))) + "Face for popup summary." + :group 'popup) + +(defface popup-scroll-bar-foreground-face + '((t (:background "black"))) + "Foreground face for scroll-bar." + :group 'popup) + +(defface popup-scroll-bar-background-face + '((t (:background "gray"))) + "Background face for scroll-bar." + :group 'popup) + +(defvar popup-instances nil + "Popup instances.") + +(defvar popup-scroll-bar-foreground-char + (propertize " " 'face 'popup-scroll-bar-foreground-face) + "Foreground character for scroll-bar.") + +(defvar popup-scroll-bar-background-char + (propertize " " 'face 'popup-scroll-bar-background-face) + "Background character for scroll-bar.") + +(cl-defstruct popup + point row column width height min-height direction overlays keymap + parent depth + face mouse-face selection-face summary-face + margin-left margin-right margin-left-cancel scroll-bar symbol + cursor offset scroll-top current-height list newlines + pattern original-list) + +(defun popup-item-propertize (item &rest properties) + "Same as `propertize' except that this avoids overriding +existed value with `nil' property." + (cl-loop for (k v) on properties by 'cddr + if v append (list k v) into props + finally return + (apply 'propertize + (popup-x-to-string item) + props))) + +(defun popup-item-property (item property) + "Same as `get-text-property' except that this returns nil if +ITEM is not string." + (if (stringp item) + (get-text-property 0 property item))) + +(cl-defun popup-make-item (name + &key + value + face + mouse-face + selection-face + sublist + document + symbol + summary) + "Utility function to make popup item. See also +`popup-item-propertize'." + (popup-item-propertize name + 'value value + 'popup-face face + 'popup-mouse-face mouse-face + 'selection-face selection-face + 'document document + 'symbol symbol + 'summary summary + 'sublist sublist)) + +(defsubst popup-item-value (item) (popup-item-property item 'value)) +(defsubst popup-item-value-or-self (item) (or (popup-item-value item) item)) +(defsubst popup-item-face (item) (popup-item-property item 'popup-face)) +(defsubst popup-item-mouse-face (item) (popup-item-property item 'popup-mouse-face)) +(defsubst popup-item-selection-face (item) (popup-item-property item 'selection-face)) +(defsubst popup-item-document (item) (popup-item-property item 'document)) +(defsubst popup-item-summary (item) (popup-item-property item 'summary)) +(defsubst popup-item-symbol (item) (popup-item-property item 'symbol)) +(defsubst popup-item-sublist (item) (popup-item-property item 'sublist)) + +(defun popup-item-documentation (item) + (let ((doc (popup-item-document item))) + (if (functionp doc) + (setq doc (funcall doc (popup-item-value-or-self item)))) + doc)) + +(defun popup-item-show-help-1 (item) + (let ((doc (popup-item-documentation item))) + (when doc + (with-current-buffer (get-buffer-create " *Popup Help*") + (erase-buffer) + (insert doc) + (goto-char (point-min)) + (display-buffer (current-buffer))) + t))) + +(defun popup-item-show-help-with-event-loop (item) + (save-window-excursion + (when (popup-item-show-help-1 item) + (cl-loop do (clear-this-command-keys) + for key = (read-key-sequence-vector nil) + do + (cl-case (key-binding key) + (scroll-other-window + (scroll-other-window)) + (scroll-other-window-down + (scroll-other-window-down nil)) + (otherwise + (setq unread-command-events (append key unread-command-events)) + (cl-return))))))) + +(defun popup-item-show-help (item &optional persist) + "Display the documentation of ITEM with `display-buffer'. If +PERSIST is nil, the documentation buffer will be closed +automatically, meaning interal event loop ensures the buffer to +be closed. Otherwise, the buffer will be just displayed as +usual." + (when item + (if (not persist) + (popup-item-show-help-with-event-loop item) + (popup-item-show-help-1 item)))) + +(defun popup-set-list (popup list) + (popup-set-filtered-list popup list) + (setf (popup-pattern popup) nil) + (setf (popup-original-list popup) list)) + +(defun popup-set-filtered-list (popup list) + (let ((offset + (if (> (popup-direction popup) 0) + 0 + (max (- (popup-height popup) (length list)) 0)))) + (setf (popup-list popup) list + (popup-offset popup) offset))) + +(defun popup-selected-item (popup) + (nth (popup-cursor popup) (popup-list popup))) + +(defun popup-selected-line (popup) + (- (popup-cursor popup) (popup-scroll-top popup))) + +(defun popup-line-overlay (popup line) + (aref (popup-overlays popup) line)) + +(defun popup-selected-line-overlay (popup) + (popup-line-overlay popup (popup-selected-line popup))) + +(defun popup-hide-line (popup line) + (let ((overlay (popup-line-overlay popup line))) + (overlay-put overlay 'display nil) + (overlay-put overlay 'after-string nil))) + +(defun popup-line-hidden-p (popup line) + (let ((overlay (popup-line-overlay popup line))) + (and (eq (overlay-get overlay 'display) nil) + (eq (overlay-get overlay 'after-string) nil)))) + +(cl-defun popup-set-line-item (popup + line + &key + item + face + mouse-face + margin-left + margin-right + scroll-bar-char + symbol + summary + summary-face + keymap) + (let* ((overlay (popup-line-overlay popup line)) + (content (popup-create-line-string popup (popup-x-to-string item) + :margin-left margin-left + :margin-right margin-right + :symbol symbol + :summary summary + :summary-face summary-face)) + (start 0) + (prefix (overlay-get overlay 'prefix)) + (postfix (overlay-get overlay 'postfix)) + end) + (put-text-property 0 (length content) 'popup-item item content) + (put-text-property 0 (length content) 'keymap keymap content) + ;; Overlap face properties + (when (get-text-property start 'face content) + (setq start (next-single-property-change start 'face content))) + (while (and start (setq end (next-single-property-change start 'face content))) + (put-text-property start end 'face face content) + (setq start (next-single-property-change end 'face content))) + (when start + (put-text-property start (length content) 'face face content)) + (when mouse-face + (put-text-property 0 (length content) 'mouse-face mouse-face content)) + (unless (overlay-get overlay 'dangle) + (overlay-put overlay 'display (concat prefix (substring content 0 1))) + (setq prefix nil + content (concat (substring content 1)))) + (overlay-put overlay + 'after-string + (concat prefix + content + scroll-bar-char + postfix)))) + +(cl-defun popup-create-line-string (popup + string + &key + margin-left + margin-right + symbol + summary + summary-face) + (let* ((popup-width (popup-width popup)) + (summary-width (string-width summary)) + (content-width (max + (min popup-width (string-width string)) + (- popup-width + (if (> summary-width 0) + (+ summary-width 2) + 0)))) + (string (car (popup-substring-by-width string content-width))) + (string-width (string-width string)) + (spacing (max (- popup-width string-width summary-width) + (if (> popup-width string-width) 1 0))) + (truncated-summary + (car (popup-substring-by-width + summary (max (- popup-width string-width spacing) 0))))) + (when summary-face + (put-text-property 0 (length truncated-summary) + 'face summary-face truncated-summary)) + (concat margin-left + string + (make-string spacing ? ) + truncated-summary + symbol + margin-right))) + +(defun popup-live-p (popup) + "Return non-nil if POPUP is alive." + (and popup (popup-overlays popup) t)) + +(defun popup-child-point (popup &optional offset) + (overlay-end + (popup-line-overlay + popup + (or offset + (popup-selected-line popup))))) + +(defun popup-calculate-direction (height row) + "Return a proper direction when displaying a popup on this +window. HEIGHT is the a height of the popup, and ROW is a line +number at the point." + (let* ((remaining-rows (- (max 1 (- (window-height) + (if mode-line-format 1 0) + (if header-line-format 1 0))) + (count-lines (window-start) (point)))) + (enough-space-above (> row height)) + (enough-space-below (<= height remaining-rows))) + (if (and enough-space-above + (not enough-space-below)) + -1 + 1))) + +(cl-defun popup-create (point + width + height + &key + min-height + max-width + around + (face 'popup-face) + mouse-face + (selection-face face) + (summary-face 'popup-summary-face) + scroll-bar + margin-left + margin-right + symbol + parent + parent-offset + keymap) + "Create a popup instance at POINT with WIDTH and HEIGHT. + +MIN-HEIGHT is a minimal height of the popup. The default value is +0. + +MAX-WIDTH is the maximum width of the popup. The default value is +nil (no limit). If a floating point, the value refers to the ratio of +the window. If an integer, limit is in characters. + +If AROUND is non-nil, the popup will be displayed around the +point but not at the point. + +FACE is a background face of the popup. The default value is POPUP-FACE. + +SELECTION-FACE is a foreground (selection) face of the popup The +default value is POPUP-FACE. + +If SCROLL-BAR is non-nil, the popup will have a scroll bar at the +right. + +If MARGIN-LEFT is non-nil, the popup will have a margin at the +left. + +If MARGIN-RIGHT is non-nil, the popup will have a margin at the +right. + +SYMBOL is a single character which indicates a kind of the item. + +PARENT is a parent popup instance. If PARENT is omitted, the +popup will be a root instance. + +PARENT-OFFSET is a row offset from the parent popup. + +KEYMAP is a keymap that will be put on the popup contents." + (or margin-left (setq margin-left 0)) + (or margin-right (setq margin-right 0)) + (unless point + (setq point + (if parent (popup-child-point parent parent-offset) (point)))) + (when max-width + (setq width (min width (popup-calculate-max-width max-width)))) + (save-excursion + (goto-char point) + (let* ((row (line-number-at-pos)) + (column (popup-current-physical-column)) + (overlays (make-vector height nil)) + (popup-width (+ width + (if scroll-bar 1 0) + margin-left + margin-right + (if symbol 2 0))) + margin-left-cancel + (window (selected-window)) + (window-start (window-start)) + (window-hscroll (window-hscroll)) + (window-width (window-width)) + (right (+ column popup-width)) + (overflow (and (> right window-width) + (>= right popup-width))) + (foldable (and (null parent) + (>= column popup-width))) + (direction (or + ;; Currently the direction of cascade popup won't be changed + (and parent (popup-direction parent)) + + ;; Calculate direction + (popup-calculate-direction height row))) + (depth (if parent (1+ (popup-depth parent)) 0)) + (newlines (max 0 (+ (- height (count-lines point (point-max))) (if around 1 0)))) + current-column) + ;; Case: no newlines at the end of the buffer + (when (> newlines 0) + (popup-save-buffer-state + (goto-char (point-max)) + (insert (make-string newlines ?\n)))) + + ;; Case: the popup overflows + (if overflow + (if foldable + (progn + (cl-decf column (- popup-width margin-left margin-right)) + (unless around (move-to-column column))) + (when (not truncate-lines) + ;; Truncate. + (let ((d (1+ (- popup-width (- window-width column))))) + (cl-decf popup-width d) + (cl-decf width d))) + (cl-decf column margin-left)) + (cl-decf column margin-left)) + + ;; Case: no space at the left + (when (and (null parent) + (< column 0)) + ;; Cancel margin left + (setq column 0) + (cl-decf popup-width margin-left) + (setq margin-left-cancel t)) + + (dotimes (i height) + (let (overlay begin w (dangle t) (prefix "") (postfix "")) + (when around + (popup-vertical-motion column direction)) + (setq around t + current-column (popup-current-physical-column)) + + (when (> current-column column) + (backward-char) + (setq current-column (popup-current-physical-column))) + (when (< current-column column) + ;; Extend short buffer lines by popup prefix (line of spaces) + (setq prefix (make-string + (+ (if (= current-column 0) + (- window-hscroll (current-column)) + 0) + (- column current-column)) + ? ))) + + (setq begin (point)) + (setq w (+ popup-width (length prefix))) + (while (and (not (eolp)) (> w 0)) + (setq dangle nil) + (cl-decf w (char-width (char-after))) + (forward-char)) + (if (< w 0) + (setq postfix (make-string (- w) ? ))) + + (setq overlay (make-overlay begin (point))) + (overlay-put overlay 'window window) + (overlay-put overlay 'dangle dangle) + (overlay-put overlay 'prefix prefix) + (overlay-put overlay 'postfix postfix) + (overlay-put overlay 'width width) + (aset overlays + (if (> direction 0) i (- height i 1)) + overlay))) + (cl-loop for p from (- 10000 (* depth 1000)) + for overlay in (nreverse (append overlays nil)) + do (overlay-put overlay 'priority p)) + (let ((it (make-popup :point point + :row row + :column column + :width width + :height height + :min-height min-height + :direction direction + :parent parent + :depth depth + :face face + :mouse-face mouse-face + :selection-face selection-face + :summary-face summary-face + :margin-left margin-left + :margin-right margin-right + :margin-left-cancel margin-left-cancel + :scroll-bar scroll-bar + :symbol symbol + :cursor 0 + :offset 0 + :scroll-top 0 + :current-height 0 + :list nil + :newlines newlines + :overlays overlays + :keymap keymap))) + (push it popup-instances) + it)))) + +(defun popup-delete (popup) + "Delete POPUP instance." + (when (popup-live-p popup) + (popup-hide popup) + (mapc 'delete-overlay (popup-overlays popup)) + (setf (popup-overlays popup) nil) + (setq popup-instances (delq popup popup-instances)) + ;; Restore newlines state + (let ((newlines (popup-newlines popup))) + (when (> newlines 0) + (popup-save-buffer-state + (goto-char (point-max)) + (dotimes (i newlines) + (if (= (char-before) ?\n) + (delete-char -1))))))) + nil) + +(defun popup-draw (popup) + "Draw POPUP." + (cl-loop with height = (popup-height popup) + with min-height = (popup-min-height popup) + with popup-face = (popup-face popup) + with mouse-face = (popup-mouse-face popup) + with selection-face = (popup-selection-face popup) + with summary-face-0 = (popup-summary-face popup) + with list = (popup-list popup) + with length = (length list) + with thum-size = (max (/ (* height height) (max length 1)) 1) + with page-size = (/ (+ 0.0 (max length 1)) height) + with scroll-bar = (popup-scroll-bar popup) + with margin-left = (make-string (if (popup-margin-left-cancel popup) 0 (popup-margin-left popup)) ? ) + with margin-right = (make-string (popup-margin-right popup) ? ) + with symbol = (popup-symbol popup) + with cursor = (popup-cursor popup) + with scroll-top = (popup-scroll-top popup) + with offset = (popup-offset popup) + with keymap = (popup-keymap popup) + for o from offset + for i from scroll-top + while (< o height) + for item in (nthcdr scroll-top list) + for page-index = (* thum-size (/ o thum-size)) + for face = (if (= i cursor) + (or (popup-item-selection-face item) selection-face) + (or (popup-item-face item) popup-face)) + for summary-face = (unless (= i cursor) summary-face-0) + for empty-char = (propertize " " 'face face) + for scroll-bar-char = (if scroll-bar + (cond + ((and (not (eq scroll-bar :always)) + (<= page-size 1)) + empty-char) + ((and (> page-size 1) + (>= cursor (* page-index page-size)) + (< cursor (* (+ page-index thum-size) page-size))) + popup-scroll-bar-foreground-char) + (t + popup-scroll-bar-background-char)) + "") + for sym = (if symbol + (concat " " (or (popup-item-symbol item) " ")) + "") + for summary = (or (popup-item-summary item) "") + + do + ;; Show line and set item to the line + (popup-set-line-item popup o + :item item + :face face + :mouse-face mouse-face + :margin-left margin-left + :margin-right margin-right + :scroll-bar-char scroll-bar-char + :symbol sym + :summary summary + :summary-face summary-face + :keymap keymap) + + finally + ;; Remember current height + (setf (popup-current-height popup) (- o offset)) + + ;; Hide remaining lines + (let ((scroll-bar-char (if scroll-bar (propertize " " 'face popup-face) "")) + (symbol (if symbol " " ""))) + (if (> (popup-direction popup) 0) + (progn + (when min-height + (while (< o min-height) + (popup-set-line-item popup o + :item "" + :face popup-face + :margin-left margin-left + :margin-right margin-right + :scroll-bar-char scroll-bar-char + :symbol symbol + :summary "") + (cl-incf o))) + (while (< o height) + (popup-hide-line popup o) + (cl-incf o))) + (cl-loop with h = (if min-height (- height min-height) offset) + for o from 0 below offset + if (< o h) + do (popup-hide-line popup o) + if (>= o h) + do (popup-set-line-item popup o + :item "" + :face popup-face + :margin-left margin-left + :margin-right margin-right + :scroll-bar-char scroll-bar-char + :symbol symbol + :summary "")))))) + +(defun popup-hide (popup) + "Hide POPUP." + (dotimes (i (popup-height popup)) + (popup-hide-line popup i))) + +(defun popup-hidden-p (popup) + "Return non-nil if POPUP is hidden." + (let ((hidden t)) + (when (popup-live-p popup) + (dotimes (i (popup-height popup)) + (unless (popup-line-hidden-p popup i) + (setq hidden nil)))) + hidden)) + +(defun popup-jump (popup cursor) + "Jump to a position specified by CURSOR of POPUP and draw." + (let ((scroll-top (popup-scroll-top popup))) + ;; Do not change page as much as possible. + (unless (and (<= scroll-top cursor) + (< cursor (+ scroll-top (popup-height popup)))) + (setf (popup-scroll-top popup) cursor)) + (setf (popup-cursor popup) cursor) + (popup-draw popup))) + +(defun popup-select (popup i) + "Select the item at I of POPUP and draw." + (setq i (+ i (popup-offset popup))) + (when (and (<= 0 i) (< i (popup-height popup))) + (setf (popup-cursor popup) i) + (popup-draw popup) + t)) + +(defun popup-next (popup) + "Select the next item of POPUP and draw." + (let ((height (popup-height popup)) + (cursor (1+ (popup-cursor popup))) + (scroll-top (popup-scroll-top popup)) + (length (length (popup-list popup)))) + (cond + ((>= cursor length) + ;; Back to first page + (setq cursor 0 + scroll-top 0)) + ((= cursor (+ scroll-top height)) + ;; Go to next page + (setq scroll-top (min (1+ scroll-top) (max (- length height) 0))))) + (setf (popup-cursor popup) cursor + (popup-scroll-top popup) scroll-top) + (popup-draw popup))) + +(defun popup-previous (popup) + "Select the previous item of POPUP and draw." + (let ((height (popup-height popup)) + (cursor (1- (popup-cursor popup))) + (scroll-top (popup-scroll-top popup)) + (length (length (popup-list popup)))) + (cond + ((< cursor 0) + ;; Go to last page + (setq cursor (1- length) + scroll-top (max (- length height) 0))) + ((= cursor (1- scroll-top)) + ;; Go to previous page + (cl-decf scroll-top))) + (setf (popup-cursor popup) cursor + (popup-scroll-top popup) scroll-top) + (popup-draw popup))) + +(defun popup-page-next (popup) + "Select next item of POPUP per `popup-height' range. +Pages down through POPUP." + (dotimes (counter (1- (popup-height popup))) + (popup-next popup))) + +(defun popup-page-previous (popup) + "Select previous item of POPUP per `popup-height' range. +Pages up through POPUP." + (dotimes (counter (1- (popup-height popup))) + (popup-previous popup))) + +(defun popup-scroll-down (popup &optional n) + "Scroll down N of POPUP and draw." + (let ((scroll-top (min (+ (popup-scroll-top popup) (or n 1)) + (- (length (popup-list popup)) (popup-height popup))))) + (setf (popup-cursor popup) scroll-top + (popup-scroll-top popup) scroll-top) + (popup-draw popup))) + +(defun popup-scroll-up (popup &optional n) + "Scroll up N of POPUP and draw." + (let ((scroll-top (max (- (popup-scroll-top popup) (or n 1)) + 0))) + (setf (popup-cursor popup) scroll-top + (popup-scroll-top popup) scroll-top) + (popup-draw popup))) + + + +;;; Popup Incremental Search + +(defface popup-isearch-match + '((t (:background "sky blue"))) + "Popup isearch match face." + :group 'popup) + +(defvar popup-isearch-cursor-color "blue") + +(defvar popup-isearch-keymap + (let ((map (make-sparse-keymap))) + ;(define-key map "\r" 'popup-isearch-done) + (define-key map "\C-g" 'popup-isearch-cancel) + (define-key map "\C-b" 'popup-isearch-close) + (define-key map [left] 'popup-isearch-close) + (define-key map "\C-h" 'popup-isearch-delete) + (define-key map (kbd "DEL") 'popup-isearch-delete) + map)) + +(defvar popup-menu-show-quick-help-function 'popup-menu-show-quick-help + "Function used for showing quick help by `popup-menu*'.") + +(defsubst popup-isearch-char-p (char) + (and (integerp char) + (<= 32 char) + (<= char 126))) + +(defun popup-isearch-filter-list (pattern list) + (cl-loop with regexp = (regexp-quote pattern) + for item in list + do + (unless (stringp item) + (setq item (popup-item-propertize (popup-x-to-string item) + 'value item))) + if (string-match regexp item) + collect + (let ((beg (match-beginning 0)) + (end (match-end 0))) + (alter-text-property 0 (length item) 'face + (lambda (prop) + (unless (eq prop 'popup-isearch-match) + prop)) + item) + (put-text-property beg end + 'face 'popup-isearch-match + item) + item))) + +(defun popup-isearch-prompt (popup pattern) + (format "Pattern: %s" (if (= (length (popup-list popup)) 0) + (propertize pattern 'face 'isearch-fail) + pattern))) + +(defun popup-isearch-update (popup pattern &optional callback) + (setf (popup-cursor popup) 0 + (popup-scroll-top popup) 0 + (popup-pattern popup) pattern) + (let ((list (popup-isearch-filter-list pattern (popup-original-list popup)))) + (popup-set-filtered-list popup list) + (if callback + (funcall callback list))) + (popup-draw popup)) + +(cl-defun popup-isearch (popup + &key + (cursor-color popup-isearch-cursor-color) + (keymap popup-isearch-keymap) + callback + help-delay) + "Start isearch on POPUP. This function is synchronized, meaning +event loop waits for quiting of isearch. + +CURSOR-COLOR is a cursor color during isearch. The default value +is `popup-isearch-cursor-color'. + +KEYMAP is a keymap which is used when processing events during +event loop. The default value is `popup-isearch-keymap'. + +CALLBACK is a function taking one argument. `popup-isearch' calls +CALLBACK, if specified, after isearch finished or isearch +canceled. The arguments is whole filtered list of items. + +HELP-DELAY is a delay of displaying helps." + (let ((list (popup-original-list popup)) + (pattern (or (popup-pattern popup) "")) + (old-cursor-color (frame-parameter (selected-frame) 'cursor-color)) + prompt key binding) + (unwind-protect + (cl-block nil + (if cursor-color + (set-cursor-color cursor-color)) + (while t + (setq prompt (popup-isearch-prompt popup pattern)) + (setq key (popup-menu-read-key-sequence keymap prompt help-delay)) + (if (null key) + (unless (funcall popup-menu-show-quick-help-function popup nil :prompt prompt) + (clear-this-command-keys) + (push (read-event prompt) unread-command-events)) + (setq binding (lookup-key keymap key)) + (cond + ((and (stringp key) + (popup-isearch-char-p (aref key 0))) + (setq pattern (concat pattern key))) + ((eq binding 'popup-isearch-done) + (cl-return nil)) + ((eq binding 'popup-isearch-cancel) + (popup-isearch-update popup "" callback) + (cl-return t)) + ((eq binding 'popup-isearch-close) + (popup-isearch-update popup "" callback) + (setq unread-command-events + (append (listify-key-sequence key) unread-command-events)) + (cl-return nil)) + ((eq binding 'popup-isearch-delete) + (if (> (length pattern) 0) + (setq pattern (substring pattern 0 (1- (length pattern)))))) + (t + (setq unread-command-events + (append (listify-key-sequence key) unread-command-events)) + (cl-return nil))) + (popup-isearch-update popup pattern callback)))) + (if old-cursor-color + (set-cursor-color old-cursor-color))))) + + + +;;; Popup Tip + +(defface popup-tip-face + '((t (:background "khaki1" :foreground "black"))) + "Face for popup tip." + :group 'popup) + +(defvar popup-tip-max-width 80) + +(cl-defun popup-tip (string + &key + point + (around t) + width + (height 15) + min-height + max-width + truncate + margin + margin-left + margin-right + scroll-bar + parent + parent-offset + nowait + nostrip + prompt + &aux tip lines) + "Show a tooltip of STRING at POINT. This function is +synchronized unless NOWAIT specified. Almost arguments are same +as `popup-create' except for TRUNCATE, NOWAIT, and PROMPT. + +If TRUNCATE is non-nil, the tooltip can be truncated. + +If NOWAIT is non-nil, this function immediately returns the +tooltip instance without entering event loop. + +If `NOSTRIP` is non-nil, `STRING` properties are not stripped. + +PROMPT is a prompt string when reading events during event loop." + (if (bufferp string) + (setq string (with-current-buffer string (buffer-string)))) + + (unless nostrip + ;; TODO strip text (mainly face) properties + (setq string (substring-no-properties string))) + + (and (eq margin t) (setq margin 1)) + (or margin-left (setq margin-left margin)) + (or margin-right (setq margin-right margin)) + + (let ((it (popup-fill-string string width popup-tip-max-width))) + (setq width (car it) + lines (cdr it))) + + (setq tip (popup-create point width height + :min-height min-height + :max-width max-width + :around around + :margin-left margin-left + :margin-right margin-right + :scroll-bar scroll-bar + :face 'popup-tip-face + :parent parent + :parent-offset parent-offset)) + + (unwind-protect + (when (> (popup-width tip) 0) ; not to be corrupted + (when (and (not (eq width (popup-width tip))) ; truncated + (not truncate)) + ;; Refill once again to lines be fitted to popup width + (setq width (popup-width tip)) + (setq lines (cdr (popup-fill-string string width width)))) + + (popup-set-list tip lines) + (popup-draw tip) + (if nowait + tip + (clear-this-command-keys) + (push (read-event prompt) unread-command-events) + t)) + (unless nowait + (popup-delete tip)))) + + + +;;; Popup Menu + +(defface popup-menu-face + '((t (:inherit popup-face))) + "Face for popup menu." + :group 'popup) + +(defface popup-menu-mouse-face + '((t (:background "blue" :foreground "white"))) + "Face for popup menu." + :group 'popup) + +(defface popup-menu-selection-face + '((t (:background "steelblue" :foreground "white"))) + "Face for popup menu selection." + :group 'popup) + +(defface popup-menu-summary-face + '((t (:inherit popup-summary-face))) + "Face for popup summary." + :group 'popup) + +(defvar popup-menu-show-tip-function 'popup-tip + "Function used for showing tooltip by `popup-menu-show-quick-help'.") + +(defun popup-menu-show-help (menu &optional persist item) + (popup-item-show-help (or item (popup-selected-item menu)) persist)) + +(defun popup-menu-documentation (menu &optional item) + (popup-item-documentation (or item (popup-selected-item menu)))) + +(defun popup-menu-show-quick-help (menu &optional item &rest args) + (let* ((point (plist-get args :point)) + (height (or (plist-get args :height) (popup-height menu))) + (min-height (min height (popup-current-height menu))) + (around nil) + (parent-offset (popup-offset menu)) + (doc (popup-menu-documentation menu item))) + (when (stringp doc) + (if (popup-hidden-p menu) + (setq around t + menu nil + parent-offset nil) + (setq point nil)) + (let ((popup-use-optimized-column-computation nil)) ; To avoid wrong positioning + (apply popup-menu-show-tip-function + doc + :point point + :height height + :min-height min-height + :around around + :parent menu + :parent-offset parent-offset + args))))) + +(defun popup-menu-item-of-mouse-event (event) + (when (and (consp event) + (memq (cl-first event) '(mouse-1 mouse-2 mouse-3 mouse-4 mouse-5))) + (let* ((position (cl-second event)) + (object (elt position 4))) + (when (consp object) + (get-text-property (cdr object) 'popup-item (car object)))))) + +(defun popup-menu-read-key-sequence (keymap &optional prompt timeout) + (catch 'timeout + (let ((timer (and timeout + (run-with-timer timeout nil + (lambda () + (if (zerop (length (this-command-keys))) + (throw 'timeout nil)))))) + (old-global-map (current-global-map)) + (temp-global-map (make-sparse-keymap)) + (overriding-terminal-local-map (make-sparse-keymap))) + (substitute-key-definition 'keyboard-quit 'keyboard-quit + temp-global-map old-global-map) + (define-key temp-global-map [menu-bar] (lookup-key old-global-map [menu-bar])) + (define-key temp-global-map [tool-bar] (lookup-key old-global-map [tool-bar])) + (set-keymap-parent overriding-terminal-local-map keymap) + (if (current-local-map) + (define-key overriding-terminal-local-map [menu-bar] + (lookup-key (current-local-map) [menu-bar]))) + (unwind-protect + (progn + (use-global-map temp-global-map) + (clear-this-command-keys) + (with-temp-message prompt + (read-key-sequence nil))) + (use-global-map old-global-map) + (if timer (cancel-timer timer)))))) + +(defun popup-menu-fallback (event default)) + +(cl-defun popup-menu-event-loop (menu + keymap + fallback + &key + prompt + help-delay + isearch + isearch-cursor-color + isearch-keymap + isearch-callback + &aux key binding) + (cl-block nil + (while (popup-live-p menu) + (and isearch + (popup-isearch menu + :cursor-color isearch-cursor-color + :keymap isearch-keymap + :callback isearch-callback + :help-delay help-delay) + (keyboard-quit)) + (setq key (popup-menu-read-key-sequence keymap prompt help-delay)) + (setq binding (and key (lookup-key keymap key))) + (cond + ((or (null key) (zerop (length key))) + (unless (funcall popup-menu-show-quick-help-function menu nil :prompt prompt) + (clear-this-command-keys) + (push (read-event prompt) unread-command-events))) + ((eq (lookup-key (current-global-map) key) 'keyboard-quit) + (keyboard-quit) + (cl-return)) + ((eq binding 'popup-close) + (if (popup-parent menu) + (cl-return))) + ((memq binding '(popup-select popup-open)) + (let* ((item (or (popup-menu-item-of-mouse-event (elt key 0)) + (popup-selected-item menu))) + (index (cl-position item (popup-list menu))) + (sublist (popup-item-sublist item))) + (unless index (cl-return)) + (if sublist + (popup-aif (let (popup-use-optimized-column-computation) + (popup-cascade-menu sublist + :around nil + :margin-left (popup-margin-left menu) + :margin-right (popup-margin-right menu) + :scroll-bar (popup-scroll-bar menu) + :parent menu + :parent-offset index + :help-delay help-delay + :isearch isearch + :isearch-cursor-color isearch-cursor-color + :isearch-keymap isearch-keymap + :isearch-callback isearch-callback)) + (and it (cl-return it))) + (if (eq binding 'popup-select) + (cl-return (popup-item-value-or-self item)))))) + ((eq binding 'popup-next) + (popup-next menu)) + ((eq binding 'popup-previous) + (popup-previous menu)) + ((eq binding 'popup-page-next) + (popup-page-next menu)) + ((eq binding 'popup-page-previous) + (popup-page-previous menu)) + ((eq binding 'popup-help) + (popup-menu-show-help menu)) + ((eq binding 'popup-isearch) + (popup-isearch menu + :cursor-color isearch-cursor-color + :keymap isearch-keymap + :callback isearch-callback + :help-delay help-delay)) + ((commandp binding) + (call-interactively binding)) + (t + (funcall fallback key (key-binding key))))))) + +(defun popup-preferred-width (list) + "Return the preferred width to show LIST beautifully." + (cl-loop with tab-width = 4 + for item in list + for summary = (popup-item-summary item) + maximize (string-width (popup-x-to-string item)) into width + if (stringp summary) + maximize (+ (string-width summary) 2) into summary-width + finally return + (let ((total (+ (or width 0) (or summary-width 0)))) + (* (ceiling (/ total 10.0)) 10)))) + +(defvar popup-menu-keymap + (let ((map (make-sparse-keymap))) + (define-key map "\r" 'popup-select) + (define-key map "\C-f" 'popup-open) + (define-key map [right] 'popup-open) + (define-key map "\C-b" 'popup-close) + (define-key map [left] 'popup-close) + + (define-key map "\C-n" 'popup-next) + (define-key map [down] 'popup-next) + (define-key map "\C-p" 'popup-previous) + (define-key map [up] 'popup-previous) + + (define-key map [next] 'popup-page-next) + (define-key map [prior] 'popup-page-previous) + + (define-key map [f1] 'popup-help) + (define-key map (kbd "\C-?") 'popup-help) + + (define-key map "\C-s" 'popup-isearch) + + (define-key map [mouse-1] 'popup-select) + (define-key map [mouse-4] 'popup-previous) + (define-key map [mouse-5] 'popup-next) + map)) + +(cl-defun popup-menu* (list + &key + point + (around t) + (width (popup-preferred-width list)) + (height 15) + max-width + margin + margin-left + margin-right + scroll-bar + symbol + parent + parent-offset + cursor + (keymap popup-menu-keymap) + (fallback 'popup-menu-fallback) + help-delay + nowait + prompt + isearch + (isearch-cursor-color popup-isearch-cursor-color) + (isearch-keymap popup-isearch-keymap) + isearch-callback + &aux menu event) + "Show a popup menu of LIST at POINT. This function returns a +value of the selected item. Almost arguments are same as +`popup-create' except for KEYMAP, FALLBACK, HELP-DELAY, PROMPT, +ISEARCH, ISEARCH-CURSOR-COLOR, ISEARCH-KEYMAP, and +ISEARCH-CALLBACK. + +If KEYMAP is a keymap which is used when processing events during +event loop. + +If FALLBACK is a function taking two arguments; a key and a +command. FALLBACK is called when no special operation is found on +the key. The default value is `popup-menu-fallback', which does +nothing. + +HELP-DELAY is a delay of displaying helps. + +If NOWAIT is non-nil, this function immediately returns the menu +instance without entering event loop. + +PROMPT is a prompt string when reading events during event loop. + +If ISEARCH is non-nil, do isearch as soon as displaying the popup +menu. + +ISEARCH-CURSOR-COLOR is a cursor color during isearch. The +default value is `popup-isearch-cursor-color'. + +ISEARCH-KEYMAP is a keymap which is used when processing events +during event loop. The default value is `popup-isearch-keymap'. + +ISEARCH-CALLBACK is a function taking one argument. `popup-menu' +calls ISEARCH-CALLBACK, if specified, after isearch finished or +isearch canceled. The arguments is whole filtered list of items." + (and (eq margin t) (setq margin 1)) + (or margin-left (setq margin-left margin)) + (or margin-right (setq margin-right margin)) + (if (and scroll-bar + (integerp margin-right) + (> margin-right 0)) + ;; Make scroll-bar space as margin-right + (cl-decf margin-right)) + (setq menu (popup-create point width height + :max-width max-width + :around around + :face 'popup-menu-face + :mouse-face 'popup-menu-mouse-face + :selection-face 'popup-menu-selection-face + :summary-face 'popup-menu-summary-face + :margin-left margin-left + :margin-right margin-right + :scroll-bar scroll-bar + :symbol symbol + :parent parent + :parent-offset parent-offset)) + (unwind-protect + (progn + (popup-set-list menu list) + (if cursor + (popup-jump menu cursor) + (popup-draw menu)) + (if nowait + menu + (popup-menu-event-loop menu keymap fallback + :prompt prompt + :help-delay help-delay + :isearch isearch + :isearch-cursor-color isearch-cursor-color + :isearch-keymap isearch-keymap + :isearch-callback isearch-callback))) + (unless nowait + (popup-delete menu)))) + +(defun popup-cascade-menu (list &rest args) + "Same as `popup-menu' except that an element of LIST can be +also a sub-menu if the element is a cons cell formed (ITEM +. SUBLIST) where ITEM is an usual item and SUBLIST is a list of +the sub menu." + (apply 'popup-menu* + (mapcar (lambda (item) + (if (consp item) + (popup-make-item (car item) + :sublist (cdr item) + :symbol ">") + item)) + list) + :symbol t + args)) + +(provide 'popup) +;;; popup.el ends here diff --git a/elpa/popup-20140207.1702/popup.elc b/elpa/popup-20140207.1702/popup.elc new file mode 100644 index 000000000..6d4b71036 Binary files /dev/null and b/elpa/popup-20140207.1702/popup.elc differ diff --git a/elpa/projectile-20140808.941/projectile-autoloads.el b/elpa/projectile-20140808.941/projectile-autoloads.el new file mode 100644 index 000000000..d7c680f42 --- /dev/null +++ b/elpa/projectile-20140808.941/projectile-autoloads.el @@ -0,0 +1,85 @@ +;;; projectile-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (projectile-global-mode projectile-mode projectile-mode-line +;;;;;; projectile-commander) "projectile" "projectile.el" (21478 +;;;;;; 16652 0 0)) +;;; Generated autoloads from projectile.el + +(autoload 'projectile-commander "projectile" "\ +Execute a Projectile command with a single letter. +The user is prompted for a single character indicating the action to invoke. +The `?' character describes then +available actions. + +See `def-projectile-commander-method' for defining new methods. + +\(fn)" t nil) + +(defvar projectile-mode-line '(:eval (format " Projectile[%s]" (projectile-project-name))) "\ +Mode line ligher for Projectile. + +The value of this variable is a mode line template as in +`mode-line-format'. See Info Node `(elisp)Mode Line Format' for +details about mode line templates. + +Customize this variable to change how Projectile displays its +status in the mode line. The default value displays the project +name. Set this variable to nil to disable the mode line +entirely.") + +(custom-autoload 'projectile-mode-line "projectile" t) + +(autoload 'projectile-mode "projectile" "\ +Minor mode to assist project management and navigation. + +When called interactively, toggle `projectile-mode'. With prefix +ARG, enable `projectile-mode' if ARG is positive, otherwise disable +it. + +When called from Lisp, enable `projectile-mode' if ARG is omitted, +nil or positive. If ARG is `toggle', toggle `projectile-mode'. +Otherwise behave as if called interactively. + +\\{projectile-mode-map} + +\(fn &optional ARG)" t nil) + +(defvar projectile-global-mode nil "\ +Non-nil if Projectile-Global mode is enabled. +See the command `projectile-global-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `projectile-global-mode'.") + +(custom-autoload 'projectile-global-mode "projectile" nil) + +(autoload 'projectile-global-mode "projectile" "\ +Toggle Projectile mode in all buffers. +With prefix ARG, enable Projectile-Global mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Projectile mode is enabled in all buffers where +`projectile-on' would do it. +See `projectile-mode' for more information on Projectile mode. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("projectile-pkg.el") (21478 16652 522634 +;;;;;; 0)) + +;;;*** + +(provide 'projectile-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; projectile-autoloads.el ends here diff --git a/elpa/projectile-20140808.941/projectile-pkg.el b/elpa/projectile-20140808.941/projectile-pkg.el new file mode 100644 index 000000000..093aa968b --- /dev/null +++ b/elpa/projectile-20140808.941/projectile-pkg.el @@ -0,0 +1 @@ +(define-package "projectile" "20140808.941" "Manage and navigate projects in Emacs easily" (quote ((s "1.6.0") (dash "1.5.0") (pkg-info "0.4")))) diff --git a/elpa/projectile-20140808.941/projectile-pkg.elc b/elpa/projectile-20140808.941/projectile-pkg.elc new file mode 100644 index 000000000..5d5bcc669 Binary files /dev/null and b/elpa/projectile-20140808.941/projectile-pkg.elc differ diff --git a/elpa/projectile-20140808.941/projectile.el b/elpa/projectile-20140808.941/projectile.el new file mode 100644 index 000000000..90b4e3b33 --- /dev/null +++ b/elpa/projectile-20140808.941/projectile.el @@ -0,0 +1,2255 @@ +;;; projectile.el --- Manage and navigate projects in Emacs easily -*- lexical-binding: t -*- + +;; Copyright © 2011-2014 Bozhidar Batsov + +;; Author: Bozhidar Batsov +;; URL: https://github.com/bbatsov/projectile +;; Keywords: project, convenience +;; Version: 20140808.941 +;; X-Original-Version: 0.11.0 +;; Package-Requires: ((s "1.6.0") (dash "1.5.0") (pkg-info "0.4")) + +;; 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 3, 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; +;; This library provides easy project management and navigation. The +;; concept of a project is pretty basic - just a folder containing +;; special file. Currently git, mercurial and bazaar repos are +;; considered projects by default. If you want to mark a folder +;; manually as a project just create an empty .projectile file in +;; it. See the README for more details. +;; +;;; Code: + +(require 'thingatpt) +(require 's) +(require 'dash) +(require 'grep) ; For `rgrep' +(require 'pkg-info) ; For `pkg-info-version-info' +(require 'ibuffer) +(require 'ibuf-ext) + +(eval-when-compile + (defvar ack-and-a-half-arguments) + (defvar ggtags-completion-table)) + +;;;; Compatibility +(eval-and-compile + (unless (fboundp 'defvar-local) + (defmacro defvar-local (var val &optional docstring) + "Define VAR as a buffer-local variable with default value VAL. +Like `defvar' but additionally marks the variable as being automatically +buffer-local wherever it is set." + (declare (debug defvar) (doc-string 3)) + `(progn + (defvar ,var ,val ,docstring) + (make-variable-buffer-local ',var))))) + + +;;; Customization +(defgroup projectile nil + "Manage and navigate projects easily." + :group 'tools + :group 'convenience) + +(defcustom projectile-indexing-method (if (eq system-type 'windows-nt) 'native 'alien) + "Specifies the indexing method used by Projectile. + +There are two indexing methods - native and alien. + +The native method is implemented in Emacs Lisp (therefore it is +native to Emacs). It's advantage is that is portable and will +work everywhere that Emacs does. It's disadvantage is that is a +bit slow (especially for large projects). Generally it's a good +idea to pair the native indexing method with caching. + +The alien indexing method uses external tools (e.g. git, find, +etc) to speed up the indexing process. The disadvantage of this +method is that it's not well supported on Windows systems. + +By default alien indexing is the default on all operating +systems, except Windows." + :group 'projectile + :type 'symbol + :options '(native alien)) + +(defcustom projectile-enable-caching (eq projectile-indexing-method 'native) + "When t enables project files caching. + +Project caching is automatically enabled by default if you're +using the native indexing method." + :group 'projectile + :type 'boolean) + +(defcustom projectile-file-exists-local-cache-expire nil + "Number of seconds before file existence cache expires for a +file on a local file system. + + A value of nil disables this cache." + + :group 'projectile + :type '(choice (const :tag "Disabled" nil) + (integer :tag "Seconds"))) + +(defcustom projectile-file-exists-remote-cache-expire (* 5 60) + "Number of seconds before file existence cache expires for a +file on a remote file system such as tramp. + + A value of nil disables this cache." + :group 'projectile + :type '(choice (const :tag "Disabled" nil) + (integer :tag "Seconds"))) + +(defcustom projectile-require-project-root t + "Require the presence of a project root to operate when true. +Otherwise consider the current directory the project root." + :group 'projectile + :type 'boolean) + +(defcustom projectile-completion-system 'ido + "The completion system to be used by Projectile." + :group 'projectile + :type 'symbol + :options '(ido grizzl helm default)) + +(defcustom projectile-keymap-prefix (kbd "C-c p") + "Projectile keymap prefix." + :group 'projectile + :type 'string) + +(defcustom projectile-cache-file + (expand-file-name "projectile.cache" user-emacs-directory) + "The name of Projectile's cache file." + :group 'projectile + :type 'string) + +(defcustom projectile-tags-file-name "TAGS" + "The tags filename Projectile's going to use." + :group 'projectile + :type 'string) + +(defcustom projectile-tags-command "ctags -Re -f %s %s" + "The command Projectile's going to use to generate a TAGS file." + :group 'projectile + :type 'string) + +(defcustom projectile-sort-order 'default + "The sort order used for a project's files." + :group 'projectile + :type 'symbol + :options '(default recentf recently-active access-time modification-time)) + +(defcustom projectile-buffers-filter-function nil + "A function used to filter the buffers in `projectile-project-buffers'. + +The function should accept and return a list of Emacs buffers. +Two example filter functions are shipped by default - `projectile-buffers-with-file' +and `projectile-buffers-with-file-or-process'." + :group 'projectile + :type 'symbol) + +(defcustom projectile-project-root-files + '("rebar.config" ; Rebar project file + "project.clj" ; Leiningen project file + "pom.xml" ; Maven project file + "build.sbt" ; SBT project file + "build.gradle" ; Gradle project file + "Gemfile" ; Bundler file + "requirements.txt" ; Pip file + "package.json" ; npm package file + "gulpfile.js" ; Gulp build file + "Gruntfile.js" ; Grunt project file + "bower.json" ; Bower project file + "composer.json" ; Composer project file + "Cargo.toml" ; Cargo project file + "mix.exs" ; Elixir mix project file + ) + "A list of files considered to mark the root of a project." + :group 'projectile + :type '(repeat string)) + +(defcustom projectile-project-root-files-top-down-recurring + '(".svn" ; Svn VCS root dir + "CVS" ; Csv VCS root dir + ) + "A list of files considered to mark the root of a project. +This root files pattern stops at the parentmost match." + :group 'projectile + :type '(repeat string)) + +(defcustom projectile-project-root-files-bottom-up + '(".projectile" ; projectile project marker + ".git" ; Git VCS root dir + ".hg" ; Mercurial VCS root dir + ".fslckout" ; Fossil VCS root dir + ".bzr" ; Bazaar VCS root dir + "_darcs" ; Darcs VCS root dir + ) + "A list of files considered to mark the root of a project. +This root files pattern overrides discovery of any root files +pattern that would have found a project root in a subdirectory." + :group 'projectile + :type '(repeat string)) + +(defcustom projectile-project-root-files-functions + '(projectile-root-bottom-up + projectile-root-top-down + projectile-root-top-down-recurring) + "A list of functions for finding project roots." + :group 'projectile + :type '(repeat function)) + +(defcustom projectile-globally-ignored-files + (list projectile-tags-file-name) + "A list of files globally ignored by projectile." + :group 'projectile + :type '(repeat string)) + +(defcustom projectile-globally-ignored-directories + '(".idea" + ".eunit" + ".git" + ".hg" + ".fslckout" + ".bzr" + "_darcs" + ".tox" + ".svn" + "build") + "A list of directories globally ignored by projectile." + :group 'projectile + :type '(repeat string)) + +(defcustom projectile-globally-ignored-modes + '("erc-mode" + "help-mode" + "completion-list-mode" + "Buffer-menu-mode" + "gnus-.*-mode" + "occur-mode") + "A list of regular expressions for major modes ignored by projectile. + +If a buffer is using a given major mode, projectile will ignore +it for functions working with buffers." + :group 'projectile + :type '(repeat string)) + +(defcustom projectile-find-file-hook nil + "Hooks run when a file is opened with `projectile-find-file'." + :group 'projectile + :type 'hook) + +(defcustom projectile-find-dir-hook nil + "Hooks run when a directory is opened with `projectile-find-dir'." + :group 'projectile + :type 'hook) + +(defcustom projectile-switch-project-action 'projectile-find-file + "Action invoked after switching projects with `projectile-switch-project'. + +Any function that does not take arguments will do." + :group 'projectile + :type 'symbol) + +(defcustom projectile-find-dir-includes-top-level nil + "If true, add top-level dir to options offered by `projectile-find-dir'." + :group 'projectile + :type 'boolean) + +(defcustom projectile-use-git-grep nil + "If true, use `vc-git-grep' in git projects." + :group 'projectile + :type 'boolean) + +(defcustom projectile-remember-window-configs nil + "If true, restore the last window configuration when switching projects. +If no configuration exists, just run `projectile-switch-project-action' as usual." + :group 'projectile + :type 'boolean) + +;;; Idle Timer +(defvar projectile-idle-timer nil + "The timer object created when `project-enable-idle-timer' is non-nil.") + +(defcustom projectile-idle-timer-seconds 30 + "The idle period to use when `projectile-enable-idle-timer' is non-nil." + :group 'projectile + :type 'number) + +(defcustom projectile-idle-timer-hook '(projectile-regenerate-tags) + "The hook run when `projectile-enable-idle-timer' is non-nil." + :group 'projectile + :type '(repeat symbol)) + +(defcustom projectile-enable-idle-timer nil + "Enables idle timer hook `projectile-idle-timer-functions'. + +When `projectile-enable-idle-timer' is non-nil, the hook +`projectile-idle-timer-hook' is run each time Emacs has been idle +for `projectile-idle-timer-seconds' seconds and we're in a +project." + :group 'projectile + :set (lambda (symbol value) + (set symbol value) + (when projectile-idle-timer + (cancel-timer projectile-idle-timer)) + (setq projectile-idle-timer nil) + (when projectile-enable-idle-timer + (setq projectile-idle-timer (run-with-idle-timer + projectile-idle-timer-seconds t + (lambda () + (when (projectile-project-p) + (run-hooks 'projectile-idle-timer-hook))))))) + :type 'boolean) + +;;; Serialization +(defun projectile-serialize (data filename) + "Serialize DATA to FILENAME. + +The saved data can be restored with `projectile-unserialize'." + (when (file-writable-p filename) + (with-temp-file filename + (insert (let (print-length) (prin1-to-string data)))))) + +(defun projectile-unserialize (filename) + "Read data serialized by `projectile-serialize' from FILENAME." + (when (file-exists-p filename) + (with-temp-buffer + (insert-file-contents filename) + (read (buffer-string))))) + +(defvar projectile-projects-cache + (or (projectile-unserialize projectile-cache-file) + (make-hash-table :test 'equal)) + "A hashmap used to cache project file names to speed up related operations.") + +(defvar projectile-known-projects nil + "List of locations where we have previously seen projects. +The list of projects is ordered by the time they have been accessed.") + +(defcustom projectile-known-projects-file + (expand-file-name "projectile-bookmarks.eld" + user-emacs-directory) + "Name and location of the Projectile's known projects file." + :group 'projectile + :type 'string) + +(defcustom projectile-ignored-projects nil + "A list of projects not to be added to `projectile-known-projects'." + :group 'projectile + :type 'list + :package-version '(projectile . "0.11.0")) + + +;;; Version information + +(defun projectile-version (&optional show-version) + "Get the Projectile version as string. + +If called interactively or if SHOW-VERSION is non-nil, show the +version in the echo area and the messages buffer. + +The returned string includes both, the version from package.el +and the library version, if both a present and different. + +If the version number could not be determined, signal an error, +if called interactively, or if SHOW-VERSION is non-nil, otherwise +just return nil." + (interactive (list t)) + (let ((version (pkg-info-version-info 'projectile))) + (when show-version + (message "Projectile version: %s" version)) + version)) + + +;;; Caching +(defvar projectile-file-exists-cache + (make-hash-table :test 'equal) + "Cached `projectile-file-exists-p' results.") + +(defvar projectile-file-exists-cache-timer nil + "Timer for scheduling`projectile-file-exists-cache-cleanup'.") + +(defun projectile-file-exists-cache-cleanup () + "Removed timed out cache entries and reschedules or remove the +timer if no more items are in the cache." + (let ((now (current-time))) + (maphash (lambda (key value) + (if (time-less-p (cdr value) now) + (remhash key projectile-file-exists-cache))) + projectile-file-exists-cache) + (setq projectile-file-exists-cache-timer + (if (> (hash-table-count projectile-file-exists-cache) 0) + (run-with-timer 10 nil 'projectile-file-exists-cache-cleanup))))) + +(defun projectile-file-exists-p (filename) + "Return t if file FILENAME exist. +A wrapper around `file-exists-p' with additional caching support." + (let* ((file-remote (file-remote-p filename)) + (expire-seconds + (if file-remote + (and projectile-file-exists-remote-cache-expire + (> projectile-file-exists-remote-cache-expire 0) + projectile-file-exists-remote-cache-expire) + (and projectile-file-exists-local-cache-expire + (> projectile-file-exists-local-cache-expire 0) + projectile-file-exists-local-cache-expire))) + (remote-file-name-inhibit-cache (if expire-seconds + expire-seconds + remote-file-name-inhibit-cache))) + (if (not expire-seconds) + (file-exists-p filename) + (let* ((current-time (current-time)) + (cached (gethash filename projectile-file-exists-cache)) + (cached-value (if cached (car cached))) + (cached-expire (if cached (cdr cached))) + (cached-expired (if cached (time-less-p cached-expire current-time) t)) + (value (or (and (not cached-expired) cached-value) + (if (file-exists-p filename) 'found 'notfound)))) + (when (or (not cached) cached-expired) + (puthash filename + (cons value (time-add current-time (seconds-to-time expire-seconds))) + projectile-file-exists-cache)) + (unless projectile-file-exists-cache-timer + (setq projectile-file-exists-cache-timer + (run-with-timer 10 nil 'projectile-file-exists-cache-cleanup))) + (equal value 'found))))) + +(defun projectile-invalidate-cache (arg) + "Remove the current project's files from `projectile-projects-cache'. + +With a prefix argument ARG prompts for the name of the project whose cache +to invalidate." + (interactive "P") + (let ((project-root + (if arg + (completing-read "Remove cache for: " + (projectile-hash-keys projectile-projects-cache)) + (projectile-project-root)))) + (remhash project-root projectile-projects-cache) + (projectile-serialize-cache) + (message "Invalidated Projectile cache for %s." + (propertize project-root 'face 'font-lock-keyword-face)))) + +(defun projectile-cache-project (project files) + "Cache PROJECTs FILES. +The cache is created both in memory and on the hard drive." + (when projectile-enable-caching + (puthash project files projectile-projects-cache) + (projectile-serialize-cache))) + +(defun projectile-purge-file-from-cache (file) + "Purge FILE from the cache of the current project." + (interactive + (list (projectile-completing-read + "Remove file from cache: " + (projectile-current-project-files)))) + (let* ((project-root (projectile-project-root)) + (project-cache (gethash project-root projectile-projects-cache))) + (if (projectile-file-cached-p file project-root) + (progn + (puthash project-root (remove file project-cache) projectile-projects-cache) + (projectile-serialize-cache) + (message "%s removed from cache" file)) + (error "%s is not in the cache" file)))) + +(defun projectile-purge-dir-from-cache (dir) + "Purge DIR from the cache of the current project." + (interactive + (list (projectile-completing-read + "Remove directory from cache: " + (projectile-current-project-dirs)))) + (let* ((project-root (projectile-project-root)) + (project-cache (gethash project-root projectile-projects-cache))) + (puthash project-root + (-filter (lambda (file) + (s-starts-with-p dir file)) + project-cache) + projectile-projects-cache))) + +(defun projectile-file-cached-p (file project) + "Check if FILE is already in PROJECT cache." + (member file (gethash project projectile-projects-cache))) + +(defun projectile-cache-current-file () + "Add the currently visited file to the cache." + (interactive) + (let* ((current-project (projectile-project-root)) + (abs-current-file (buffer-file-name (current-buffer))) + (current-file (file-relative-name abs-current-file current-project))) + (unless (or (projectile-file-cached-p current-file current-project) + (projectile-ignored-directory-p (file-name-directory abs-current-file)) + (projectile-ignored-file-p abs-current-file)) + (puthash current-project + (cons current-file (gethash current-project projectile-projects-cache)) + projectile-projects-cache) + (projectile-serialize-cache) + (message "File %s added to project %s cache." + (propertize current-file 'face 'font-lock-keyword-face) + (propertize current-project 'face 'font-lock-keyword-face))))) + +;; cache opened files automatically to reduce the need for cache invalidation +(defun projectile-cache-files-find-file-hook () + "Function for caching files with `find-file-hook'." + (when (and (projectile-project-p) projectile-enable-caching) + (projectile-cache-current-file))) + +(defun projectile-cache-projects-find-file-hook () + "Function for caching projects with `find-file-hook'." + (when (projectile-project-p) + (projectile-add-known-project (projectile-project-root)) + (projectile-save-known-projects))) + +(defun projectile-maybe-invalidate-cache (force) + "Invalidate if FORCE or project's dirconfig newer than cache." + (when (or force (file-newer-than-file-p (projectile-dirconfig-file) + projectile-cache-file)) + (projectile-invalidate-cache nil))) + + +;;; Window configurations +(defvar projectile-window-config-map + (make-hash-table :test 'equal) + "A mapping from project names to their latest window configurations.") + +(defun projectile-save-window-config (project-name) + "Save PROJECT-NAME's configuration to `projectile-window-config-map'." + (puthash project-name (current-window-configuration) projectile-window-config-map)) + +(defun projectile-get-window-config (project-name) + "Return the window configuration corresponding to PROJECT-NAME. +If no such window configuration exists, +returns nil." + (gethash project-name projectile-window-config-map)) + +(defun projectile-restore-window-config (project-name) + "Restore the window configuration corresponding to the PROJECT-NAME. +Returns nil if no window configuration was found" + (let ((window-config (projectile-get-window-config project-name))) + (when window-config + (set-window-configuration window-config)))) + +(defadvice projectile-switch-project (before projectile-save-window-configuration-before-switching-projects activate) + "Save the current project's window configuration before switching projects." + (when (and projectile-remember-window-configs + (projectile-project-p)) + (projectile-save-window-config (projectile-project-name)))) + +(defadvice projectile-kill-buffers (before projectile-remove-window-configuration-before-kill-buffers activate) + "Remove's this project's window configuration from the table before killing buffers." + (remhash (projectile-project-name) projectile-window-config-map)) + +(defadvice projectile-kill-buffers (after projectile-restore-window-configuration-after-kill-buffers activate) + "Restore previous (if any) project's window configuration after killing a project's buffers." + (when (and projectile-remember-window-configs + (projectile-project-p)) + (projectile-restore-window-config (projectile-project-name)))) + + +;;; Project root related utilities +(defun projectile-parent (path) + "Return the parent directory of PATH. +PATH may be a file or directory and directory paths may end with a slash." + (directory-file-name (file-name-directory (directory-file-name (expand-file-name path))))) + +(defun projectile-locate-dominating-file (file name) + "Look up the directory hierarchy from FILE for a directory containing NAME. +Stop at the first parent directory containing a file NAME, +and return the directory. Return nil if not found. +Instead of a string, NAME can also be a predicate taking one argument +\(a directory) and returning a non-nil value if that directory is the one for +which we're looking." + ;; copied from files.el (stripped comments) emacs-24 bzr branch 2014-03-28 10:20 + (setq file (abbreviate-file-name file)) + (let ((root nil) + try) + (while (not (or root + (null file) + (string-match locate-dominating-stop-dir-regexp file))) + (setq try (if (stringp name) + (projectile-file-exists-p (expand-file-name name file)) + (funcall name file))) + (cond (try (setq root file)) + ((equal file (setq file (file-name-directory + (directory-file-name file)))) + (setq file nil)))) + (if root (file-name-as-directory root)))) + +(defun projectile-root-bottom-up (dir &optional list) + "Identify a project root in DIR by looking at `projectile-project-root-files-bottom-up'. +Returns a project root directory path or nil if not found." + (--reduce-from + (or acc + (projectile-locate-dominating-file dir it)) + nil + (or list projectile-project-root-files-bottom-up (list)))) + +(defun projectile-root-top-down (dir &optional list) + "Identify a project root in DIR by looking at `projectile-project-root-files-top-down'. +Returns a project root directory path or nil if not found." + (projectile-locate-dominating-file + dir + (lambda (dir) + (--first (projectile-file-exists-p (expand-file-name it dir)) + (or list projectile-project-root-files (list)))))) + +(defun projectile-root-top-down-recurring (dir &optional list) + "Identify a project root in DIR by looking at `projectile-project-root-files-top-down-recurring'. +Returns a project root directory path or nil if not found." + (--reduce-from + (or acc + (projectile-locate-dominating-file + dir + (lambda (dir) + (and (projectile-file-exists-p (expand-file-name it dir)) + (or (string-match locate-dominating-stop-dir-regexp (projectile-parent dir)) + (not (projectile-file-exists-p (expand-file-name it (projectile-parent dir))))))))) + nil + (or list projectile-project-root-files-top-down-recurring (list)))) + +(defun projectile-project-root () + "Retrieves the root directory of a project if available. +The current directory is assumed to be the project's root otherwise." + (file-truename + (let ((dir (file-truename default-directory))) + (or (--reduce-from + (or acc (funcall it dir)) nil + projectile-project-root-files-functions) + (if projectile-require-project-root + (error "You're not in a project") + default-directory))))) + +(defun projectile-file-truename (file-name) + "Return the truename of FILE-NAME. +A thin wrapper around `file-truename' that handles nil." + (when file-name + (file-truename file-name))) + +(defun projectile-project-p () + "Check if we're in a project." + (condition-case nil + (projectile-project-root) + (error nil))) + +(defun projectile-project-name () + "Return project name." + (let ((project-root + (condition-case nil + (projectile-project-root) + (error default-directory)))) + (file-name-nondirectory (directory-file-name project-root)))) + + +;;; Project indexing +(defun projectile-get-project-directories () + "Get the list of project directories that are of interest to the user." + (-map (lambda (subdir) (concat (projectile-project-root) subdir)) + (or (car (projectile-parse-dirconfig-file)) '("")))) + +(defun projectile-dir-files (directory) + "List the files in DIRECTORY and in its sub-directories. +Files are returned as relative paths to the project root." + ;; check for a cache hit first if caching is enabled + (let ((files-list (and projectile-enable-caching + (gethash directory projectile-projects-cache))) + (root (projectile-project-root))) + ;; cache disabled or cache miss + (or files-list + (if (eq projectile-indexing-method 'native) + (projectile-dir-files-native root directory) + ;; use external tools to get the project files + (projectile-remove-ignored (projectile-dir-files-external root directory)))))) + +(defun projectile-dir-files-native (root directory) + "Get the files for ROOT under DIRECTORY using just Emacs Lisp." + (message "Projectile is indexing %s. This may take a while." + (propertize directory 'face 'font-lock-keyword-face)) + ;; we need the files with paths relative to the project root + (-map (lambda (file) (file-relative-name file root)) + (projectile-index-directory directory (projectile-patterns-to-ignore)))) + +(defun projectile-dir-files-external (root directory) + "Get the files for ROOT under DIRECTORY using external tools." + (let ((default-directory directory) + (files-list nil)) + (setq files-list (-map (lambda (f) + (file-relative-name (expand-file-name f directory) root)) + (projectile-get-repo-files))) + files-list)) + +(defcustom projectile-git-command "git ls-files -zco --exclude-standard" + "Command used by projectile to get the files in a git project." + :group 'projectile + :type 'string) + +(defcustom projectile-hg-command "hg locate -0 -I ." + "Command used by projectile to get the files in a hg project." + :group 'projectile + :type 'string) + +(defcustom projectile-fossil-command "fossil ls" + "Command used by projectile to get the files in a fossil project." + :group 'projectile + :type 'string) + +(defcustom projectile-bzr-command "bzr ls -R --versioned -0" + "Command used by projectile to get the files in a bazaar project." + :group 'projectile + :type 'string) + +(defcustom projectile-darcs-command "darcs show files -0 . " + "Command used by projectile to get the files in a darcs project." + :group 'projectile + :type 'string) + +(defcustom projectile-svn-command "svn list -R . | grep -v '$/' | tr '\\n' '\\0'" + "Command used by projectile to get the files in a svn project." + :group 'projectile + :type 'string) + +(defcustom projectile-generic-command "find . -type f -print0" + "Command used by projectile to get the files in a generic project." + :group 'projectile + :type 'string) + +(defun projectile-get-ext-command () + "Determine which external command to invoke based on the project's VCS." + (let ((vcs (projectile-project-vcs))) + (cond + ((eq vcs 'git) projectile-git-command) + ((eq vcs 'hg) projectile-hg-command) + ((eq vcs 'fossil) projectile-fossil-command) + ((eq vcs 'bzr) projectile-bzr-command) + ((eq vcs 'darcs) projectile-darcs-command) + ((eq vcs 'svn) projectile-svn-command) + (t projectile-generic-command)))) + +(defun projectile-get-repo-files () + "Get a list of the files in the project." + (projectile-files-via-ext-command (projectile-get-ext-command))) + +(defun projectile-files-via-ext-command (command) + "Get a list of relative file names in the project root by executing COMMAND." + (split-string (shell-command-to-string command) "\0" t)) + +(defun projectile-index-directory (directory patterns) + "Index DIRECTORY taking into account PATTERNS. +The function calls itself recursively until all sub-directories +have been indexed." + (let (files-list) + (dolist (current-file (file-name-all-completions "" directory) files-list) + (let ((absolute-file (expand-file-name current-file directory))) + (cond + ;; check for directories that are not ignored + ((and (s-ends-with-p "/" current-file) + ;; avoid loops & ignore some well known directories + (not (-any? (lambda (file) + (string= (s-chop-suffix "/" current-file) file)) + '("." ".." ".svn" ".cvs"))) + (not (projectile-ignored-directory-p absolute-file)) + (not (and patterns + (projectile-ignored-rel-p absolute-file + directory patterns)))) + (setq files-list (append files-list + (projectile-index-directory + (expand-file-name current-file directory) + patterns)))) + ;; check for regular files that are not ignored + ((and (not (s-ends-with-p "/" current-file)) + (not (projectile-ignored-file-p absolute-file)) + (not (and patterns + (projectile-ignored-rel-p absolute-file + directory patterns)))) + (setq files-list (cons + (expand-file-name current-file directory) + files-list)))))))) + +(defun projectile-remove-ignored (files) + "Remove ignored files and folders from FILES. + +Operates on filenames relative to the project root." + (let ((ignored (append (projectile-ignored-files-rel) + (projectile-ignored-directories-rel)))) + (-remove (lambda (file) + (--any-p (s-starts-with-p it file) ignored)) + files))) + +(defun projectile-buffers-with-file (buffers) + "Return only those BUFFERS backed by files." + (--filter (buffer-file-name it) buffers)) + +(defun projectile-buffers-with-file-or-process (buffers) + "Return only those BUFFERS backed by files or processes." + (--filter (or (buffer-file-name it) + (get-buffer-process it)) buffers)) + +(defun projectile-project-buffers () + "Get a list of project buffers." + (let* ((project-root (projectile-project-root)) + (all-buffers (-filter (lambda (buffer) + (projectile-project-buffer-p buffer project-root)) + (buffer-list)))) + (if projectile-buffers-filter-function + (funcall projectile-buffers-filter-function all-buffers) + all-buffers))) + +(defun projectile-process-current-project-buffers (action) + "Process the current project's buffers using ACTION." + (let ((project-buffers (projectile-project-buffers))) + (dolist (buffer project-buffers) + (funcall action buffer)))) + +(defun projectile-project-buffer-files () + "Get a list of project buffer files." + (let ((project-root (projectile-project-root))) + (->> (projectile-buffers-with-file (projectile-project-buffers)) + (-map (lambda (buffer) + (file-relative-name (buffer-file-name buffer) project-root)))))) + +(defun projectile-project-buffer-p (buffer project-root) + "Check if BUFFER is under PROJECT-ROOT." + (with-current-buffer buffer + (and (not (s-starts-with? " " (buffer-name buffer))) + (not (projectile-ignored-buffer-p buffer)) + (s-equals? (file-remote-p default-directory) (file-remote-p project-root)) + (s-starts-with? project-root (file-truename default-directory))))) + +(defun projectile-ignored-buffer-p (buffer) + "Check if BUFFER should be ignored." + (with-current-buffer buffer + (--any-p (s-matches? (concat "^" it "$") + (symbol-name major-mode)) + projectile-globally-ignored-modes))) + +(defun projectile-recently-active-files () + "Get list of recently active files. + +Files are ordered by recently active buffers, and then recently +opened through use of recentf." + (let ((project-buffer-files (projectile-project-buffer-files))) + (append project-buffer-files + (-difference (projectile-recentf-files) + project-buffer-files)))) + +(defun projectile-project-buffer-names () + "Get a list of project buffer names." + (-map 'buffer-name (projectile-project-buffers))) + +(defun projectile-prepend-project-name (string) + "Prepend the current project's name to STRING." + (format "[%s] %s" (projectile-project-name) string)) + +(defun projectile-switch-to-buffer () + "Switch to a project buffer." + (interactive) + (switch-to-buffer + (projectile-completing-read + "Switch to buffer: " + (projectile-project-buffer-names)))) + +(defun projectile-switch-to-buffer-other-window () + "Switch to a project buffer and show it in another window." + (interactive) + (switch-to-buffer-other-window + (projectile-completing-read + "Switch to buffer: " + (projectile-project-buffer-names)))) + +(defun projectile-display-buffer () + "Display a project buffer in another window without selecting it." + (interactive) + (display-buffer + (projectile-completing-read + "Display buffer: " + (projectile-project-buffer-names)))) + +(defun projectile-project-buffers-other-buffer () + "Switch to the most recently selected buffer project buffer. +Only buffers not visible in windows are returned." + (interactive) + (switch-to-buffer (car (projectile-project-buffers-non-visible))) nil t) + +(defun projectile-project-buffers-non-visible () + "Get a list of non visible project buffers." + (-filter (lambda (buffer) + (not (get-buffer-window buffer 'visible))) + (projectile-project-buffers))) + +(defun projectile-multi-occur () + "Do a `multi-occur' in the project's buffers." + (interactive) + (multi-occur (projectile-project-buffers) + (car (occur-read-primary-args)))) + +(defun projectile-ignored-directory-p (directory) + "Check if DIRECTORY should be ignored." + (member directory (projectile-ignored-directories))) + +(defun projectile-ignored-file-p (file) + "Check if FILE should be ignored." + (member file (projectile-ignored-files))) + +(defun projectile-ignored-rel-p (file directory patterns) + "Check if FILE should be ignored relative to DIRECTORY according to PATTERNS." + (let ((default-directory directory)) + (-any? (lambda (pattern) + (or (s-ends-with? (s-chop-suffix "/" pattern) + (s-chop-suffix "/" file)) + (member file (file-expand-wildcards pattern t)))) + patterns))) + +(defun projectile-ignored-files () + "Return list of ignored files." + (-map + 'projectile-expand-root + (append + projectile-globally-ignored-files + (projectile-project-ignored-files)))) + +(defun projectile-ignored-directories () + "Return list of ignored directories." + (-map + 'file-name-as-directory + (-map + 'projectile-expand-root + (append + projectile-globally-ignored-directories + (projectile-project-ignored-directories))))) + +(defun projectile-ignored-directories-rel () + "Return list of ignored directories, relative to the root." + (let ((project-root (projectile-project-root))) + (--map (file-relative-name it project-root) (projectile-ignored-directories)))) + +(defun projectile-ignored-files-rel () + "Return list of ignored files, relative to the root." + (let ((project-root (projectile-project-root))) + (--map (file-relative-name it project-root) (projectile-ignored-files)))) + +(defun projectile-project-ignored-files () + "Return list of project ignored files." + (-remove 'file-directory-p (projectile-project-ignored))) + +(defun projectile-project-ignored-directories () + "Return list of project ignored directories." + (-filter 'file-directory-p (projectile-project-ignored))) + +(defun projectile-paths-to-ignore () + "Return a list of ignored project paths." + (-map (lambda (pattern) + (s-chop-prefix "/" pattern)) + (-filter (lambda (pattern) + (s-starts-with? "/" pattern)) + (cdr (projectile-parse-dirconfig-file))))) + +(defun projectile-patterns-to-ignore () + "Return a list of relative file patterns." + (-remove (lambda (pattern) + (s-starts-with? "/" pattern)) + (cdr (projectile-parse-dirconfig-file)))) + +(defun projectile-project-ignored () + "Return list of project ignored files/directories." + (let ((paths (projectile-paths-to-ignore)) + (default-directory (projectile-project-root))) + (-flatten (-map + (lambda (pattern) + (or (file-expand-wildcards pattern t) + (projectile-expand-root pattern))) + paths)))) + +(defun projectile-dirconfig-file () + "Return the absolute path to the project's dirconfig file." + (expand-file-name ".projectile" (projectile-project-root))) + +(defun projectile-parse-dirconfig-file () + "Parse project ignore file and return directories to ignore and keep. + +The return value will be a cons, the car being the list of +directories to keep, and the cdr being the list of files or +directories to ignore. + +Strings starting with + will be added to the list of directories +to keep, and strings starting with - will be added to the list of +directories to ignore. For backward compatibility, without a +prefix the string will be assumed to be an ignore string." + (let ((dirconfig-file (projectile-dirconfig-file))) + (when (projectile-file-exists-p dirconfig-file) + (with-temp-buffer + (insert-file-contents-literally dirconfig-file) + (let* ((split-string-default-separators "[\r\n]") + (strings (-map 's-trim (delete "" (split-string (buffer-string))))) + (separated-vals (--separate (s-starts-with? "+" it) strings))) + (cons (-map (lambda (dir) (projectile-ensure-trailing-slash + (projectile-strip-dir-prefix dir))) (car separated-vals)) + (-map 'projectile-strip-dir-prefix (cadr separated-vals)))))))) + +(defun projectile-ensure-trailing-slash (dir) + "Append / to DIR if missing." + (if (s-ends-with? "/" dir) dir + (concat dir "/"))) + +(defun projectile-strip-dir-prefix (dir) + "Strip + or - prefix from DIR." + (s-chop-prefixes '("-" "+") dir)) + +(defun projectile-expand-root (name) + "Expand NAME to project root. + +Never use on many files since it's going to recalculate the +project-root for every file." + (expand-file-name name (projectile-project-root))) + +(defun projectile-completing-read (prompt choices &optional initial-input) + "Present a project tailored PROMPT with CHOICES." + (let ((prompt (projectile-prepend-project-name prompt))) + (cond + ((eq projectile-completion-system 'ido) + (ido-completing-read prompt choices nil nil initial-input)) + ((eq projectile-completion-system 'default) + (completing-read prompt choices nil nil initial-input)) + ((eq projectile-completion-system 'helm) + (if (fboundp 'helm-comp-read) + (helm-comp-read prompt choices + :initial-input initial-input + :candidates-in-buffer t + :must-match 'confirm) + (user-error "Please install helm from \ +https://github.com/emacs-helm/helm"))) + ((eq projectile-completion-system 'grizzl) + (if (and (fboundp 'grizzl-completing-read) + (fboundp 'grizzl-make-index)) + (grizzl-completing-read prompt (grizzl-make-index choices)) + (user-error "Please install grizzl from \ +https://github.com/d11wtq/grizzl"))) + (t (funcall projectile-completion-system prompt choices))))) + +(defun projectile-current-project-files () + "Return a list of files for the current project." + (let ((files (and projectile-enable-caching + (gethash (projectile-project-root) projectile-projects-cache)))) + ;; nothing is cached + (unless files + (setq files (-mapcat 'projectile-dir-files + (projectile-get-project-directories))) + ;; cache the resulting list of files + (when projectile-enable-caching + (projectile-cache-project (projectile-project-root) files))) + (projectile-sort-files files))) + +(defun projectile-process-current-project-files (action) + "Process the current project's files using ACTION." + (let ((project-files (projectile-current-project-files)) + default-directory (projectile-project-root)) + (dolist (filename project-files) + (funcall action filename)))) + +(defun projectile-current-project-dirs () + "Return a list of dirs for the current project." + (-remove 'null (-distinct + (-map 'file-name-directory + (projectile-current-project-files))))) + +(defun projectile-hash-keys (hash) + "Return a list of all HASH keys." + (let (allkeys) + (maphash (lambda (k _v) (setq allkeys (cons k allkeys))) hash) + allkeys)) + + +;;; Interactive commands +(defun projectile-find-file (&optional arg) + "Jump to a project's file using completion. + +With a prefix ARG invalidates the cache first." + (interactive "P") + (projectile-maybe-invalidate-cache arg) + (let ((file (projectile-completing-read "Find file: " + (projectile-current-project-files)))) + (find-file (expand-file-name file (projectile-project-root))) + (run-hooks 'projectile-find-file-hook))) + +(defun projectile-find-file-other-window (&optional arg) + "Jump to a project's file using completion and show it in another window. + +With a prefix ARG invalidates the cache first." + (interactive "P") + (projectile-maybe-invalidate-cache arg) + (let ((file (projectile-completing-read "Find file: " + (projectile-current-project-files)))) + (find-file-other-window (expand-file-name file (projectile-project-root))) + (run-hooks 'projectile-find-file-hook))) + +(defun projectile-sort-files (files) + "Sort FILES according to `projectile-sort-order'." + (pcase projectile-sort-order + (`default files) + (`recentf (projectile-sort-by-recentf-first files)) + (`recently-active (projectile-sort-by-recently-active-first files)) + (`modification-time (projectile-sort-by-modification-time files)) + (`access-time (projectile-sort-by-access-time files)))) + +(defun projectile-sort-by-recentf-first (files) + "Sort FILES by a recent first scheme." + (let ((project-recentf-files (projectile-recentf-files))) + (append project-recentf-files + (-difference files project-recentf-files)))) + +(defun projectile-sort-by-recently-active-first (files) + "Sort FILES by most recently active buffers or opened files." + (let ((project-recently-active-files (projectile-recently-active-files))) + (append project-recently-active-files + (-difference files project-recently-active-files)))) + +(defun projectile-sort-by-modification-time (files) + "Sort FILES by modification time." + (let ((default-directory (projectile-project-root))) + (-sort (lambda (file1 file2) + (let ((file1-mtime (nth 5 (file-attributes file1))) + (file2-mtime (nth 5 (file-attributes file2)))) + (not (time-less-p file1-mtime file2-mtime)))) + files))) + +(defun projectile-sort-by-access-time (files) + "Sort FILES by access time." + (let ((default-directory (projectile-project-root))) + (-sort (lambda (file1 file2) + (let ((file1-atime (nth 4 (file-attributes file1))) + (file2-atime (nth 4 (file-attributes file2)))) + (not (time-less-p file1-atime file2-atime)))) + files))) + +(defun projectile-find-dir (&optional arg) + "Jump to a project's directory using completion. + +With a prefix ARG invalidates the cache first." + (interactive "P") + (projectile-maybe-invalidate-cache arg) + (let ((dir (projectile-complete-dir))) + (dired (expand-file-name dir (projectile-project-root))) + (run-hooks 'projectile-find-dir-hook))) + +(defun projectile-find-dir-other-window (&optional arg) + "Jump to a project's directory in other window using completion. + +With a prefix ARG invalidates the cache first." + (interactive "P") + (when arg + (projectile-invalidate-cache nil)) + (let ((dir (projectile-complete-dir))) + (dired-other-window (expand-file-name dir (projectile-project-root))) + (run-hooks 'projectile-find-dir-hook))) + +(defun projectile-complete-dir () + (projectile-completing-read + "Find dir: " + (if projectile-find-dir-includes-top-level + (append '("./") (projectile-current-project-dirs)) + (projectile-current-project-dirs)))) + +(defun projectile-find-test-file (&optional arg) + "Jump to a project's test file using completion. + +With a prefix ARG invalidates the cache first." + (interactive "P") + (projectile-maybe-invalidate-cache arg) + (let ((file (projectile-completing-read "Find test file: " + (projectile-current-project-test-files)))) + (find-file (expand-file-name file (projectile-project-root))))) + +(defcustom projectile-test-files-prefixes '("test_") + "Some common prefixes of test files." + :group 'projectile + :type '(repeat string)) + +(defcustom projectile-test-files-suffices '("_test" "_spec" "Spec" "Test" "-test") + "Some common suffices of test files." + :group 'projectile + :type '(repeat string)) + +(defun projectile-test-files (files) + "Return only the test FILES." + (-filter 'projectile-test-file-p files)) + +(defun projectile-test-file-p (file) + "Check if FILE is a test file." + (or (-any? (lambda (prefix) + (s-starts-with? prefix (file-name-nondirectory file))) + projectile-test-files-prefixes) + (-any? (lambda (suffix) + (s-ends-with? suffix (file-name-sans-extension file))) + projectile-test-files-suffices))) + +(defun projectile-current-project-test-files () + "Return a list of test files for the current project." + (projectile-test-files (projectile-current-project-files))) + +(defvar projectile-rails-rspec '("Gemfile" "app" "lib" "db" "config" "spec")) +(defvar projectile-rails-test '("Gemfile" "app" "lib" "db" "config" "test")) +(defvar projectile-symfony '("composer.json" "app" "src" "vendor")) +(defvar projectile-ruby-rspec '("Gemfile" "lib" "spec")) +(defvar projectile-ruby-test '("Gemfile" "lib" "test")) +(defvar projectile-django '("manage.py")) +(defvar projectile-python-pip '("requirements.txt")) +(defvar projectile-python-egg '("setup.py")) +(defvar projectile-maven '("pom.xml")) +(defvar projectile-gradle '("build.gradle")) +(defvar projectile-grails '("application.properties" "grails-app")) +(defvar projectile-lein '("project.clj")) +(defvar projectile-rebar '("rebar")) +(defvar projectile-sbt '("build.sbt")) +(defvar projectile-make '("Makefile")) +(defvar projectile-grunt '("Gruntfile.js")) +(defvar projectile-gulp '("gulpfile.js")) + +(defun projectile-go () + (-any? (lambda (file) + (string= (file-name-extension file) "go")) (projectile-current-project-files))) + +(defcustom projectile-go-function 'projectile-go + "Function to determine if project's type is go." + :group 'projectile + :type 'function) + +(defun projectile-project-type () + "Determine the project's type based on its structure." + (cond + ((projectile-verify-files projectile-rails-rspec) 'rails-rspec) + ((projectile-verify-files projectile-rails-test) 'rails-test) + ((projectile-verify-files projectile-ruby-rspec) 'ruby-rspec) + ((projectile-verify-files projectile-ruby-test) 'ruby-test) + ((projectile-verify-files projectile-django) 'django) + ((projectile-verify-files projectile-python-pip)'python) + ((projectile-verify-files projectile-python-egg) 'python) + ((projectile-verify-files projectile-symfony) 'symfony) + ((projectile-verify-files projectile-lein) 'lein) + ((projectile-verify-files projectile-maven) 'maven) + ((projectile-verify-files projectile-gradle) 'gradle) + ((projectile-verify-files projectile-grails) 'grails) + ((projectile-verify-files projectile-rebar) 'rebar) + ((projectile-verify-files projectile-sbt) 'sbt) + ((projectile-verify-files projectile-make) 'make) + ((projectile-verify-files projectile-gulp) 'gulp) + ((projectile-verify-files projectile-grunt) 'grunt) + ((funcall projectile-go-function) 'go) + (t 'generic))) + +(defun projectile-verify-files (files) + "Check whether all FILES exist in the current project." + (-all? 'projectile-verify-file files)) + +(defun projectile-verify-file (file) + "Check whether FILE exists in the current project." + (projectile-file-exists-p (projectile-expand-root file))) + +(defun projectile-project-vcs () + "Determine the VCS used by the project if any." + (let ((project-root (projectile-project-root))) + (cond + ((projectile-file-exists-p (expand-file-name ".git" project-root)) 'git) + ((projectile-file-exists-p (expand-file-name ".hg" project-root)) 'hg) + ((projectile-file-exists-p (expand-file-name ".fossil" project-root)) 'fossil) + ((projectile-file-exists-p (expand-file-name ".bzr" project-root)) 'bzr) + ((projectile-file-exists-p (expand-file-name "_darcs" project-root)) 'darcs) + ((projectile-file-exists-p (expand-file-name ".svn" project-root)) 'svn) + ((projectile-locate-dominating-file project-root ".git") 'git) + ((projectile-locate-dominating-file project-root ".hg") 'hg) + ((projectile-locate-dominating-file project-root ".fossil") 'fossil) + ((projectile-locate-dominating-file project-root ".bzr") 'bzr) + ((projectile-locate-dominating-file project-root "_darcs") 'darcs) + ((projectile-locate-dominating-file project-root ".svn") 'svn) + (t 'none)))) + +(defun projectile-find-implementation-or-test (file-name) + "Given a FILE-NAME return the matching implementation or test filename." + (unless file-name (error "The current buffer is not visiting a file")) + (if (projectile-test-file-p file-name) + ;; find the matching impl file + (let ((impl-file (projectile-find-matching-file file-name))) + (if impl-file + (projectile-expand-root impl-file) + (error "No matching source file found"))) + ;; find the matching test file + (let ((test-file (projectile-find-matching-test file-name))) + (if test-file + (projectile-expand-root test-file) + (error "No matching test file found"))))) + +(defun projectile-find-implementation-or-test-other-window () + "Open matching implementation or test file in other window." + (interactive) + (find-file-other-window + (projectile-find-implementation-or-test (buffer-file-name)))) + +(defun projectile-toggle-between-implementation-and-test () + "Toggle between an implementation file and its test file." + (interactive) + (find-file + (projectile-find-implementation-or-test (buffer-file-name)))) + +(defun projectile-test-affix (project-type) + "Find test files affix based on PROJECT-TYPE." + (or (funcall projectile-test-prefix-function project-type) + (funcall projectile-test-suffix-function project-type) + (error "Project type not supported!"))) + +(defcustom projectile-test-prefix-function 'projectile-test-prefix + "Function to find test files prefix based on PROJECT-TYPE." + :group 'projectile + :type 'function) + +(defcustom projectile-test-suffix-function 'projectile-test-suffix + "Function to find test files suffix based on PROJECT-TYPE." + :group 'projectile + :type 'function) + +(defun projectile-test-prefix (project-type) + "Find default test files prefix based on PROJECT-TYPE." + (cond + ((member project-type '(django python)) "test_"))) + +(defun projectile-test-suffix (project-type) + "Find default test files suffix based on PROJECT-TYPE." + (cond + ((member project-type '(rails-rspec ruby-rspec)) "_spec") + ((member project-type '(rails-test ruby-test lein go)) "_test") + ((member project-type '(maven symfony)) "Test") + ((member project-type '(gradle grails)) "Spec"))) + +(defun projectile-find-matching-test (file) + "Compute the name of the test matching FILE." + (let ((basename (file-name-nondirectory (file-name-sans-extension file))) + (test-affix (projectile-test-affix (projectile-project-type)))) + (-first (lambda (current-file) + (let ((current-file-basename (file-name-nondirectory (file-name-sans-extension current-file)))) + (or (s-equals? current-file-basename (concat test-affix basename)) + (s-equals? current-file-basename (concat basename test-affix))))) + (projectile-current-project-files)))) + +(defun projectile-find-matching-file (test-file) + "Compute the name of a file matching TEST-FILE." + (let ((basename (file-name-nondirectory (file-name-sans-extension test-file))) + (test-affix (projectile-test-affix (projectile-project-type)))) + (-first (lambda (current-file) + (let ((current-file-basename (file-name-nondirectory (file-name-sans-extension current-file)))) + (or (s-equals? (concat test-affix current-file-basename) basename) + (s-equals? (concat current-file-basename test-affix) basename)))) + (projectile-current-project-files)))) + +(defun projectile-grep-default-files () + "Try to find a default pattern for `projectile-grep'. +This is a subset of `grep-read-files', where either a matching entry from +`grep-files-aliases' or file name extension pattern is returned." + (when buffer-file-name + (let* ((fn (file-name-nondirectory buffer-file-name)) + (default-alias + (let ((aliases (remove (assoc "all" grep-files-aliases) + grep-files-aliases)) + alias) + (while aliases + (setq alias (car aliases) + aliases (cdr aliases)) + (if (string-match (mapconcat + 'wildcard-to-regexp + (split-string (cdr alias) nil t) + "\\|") + fn) + (setq aliases nil) + (setq alias nil))) + (cdr alias))) + (default-extension + (let ((ext (file-name-extension fn))) + (and ext (concat "*." ext))))) + (or default-alias default-extension)))) + +(defun projectile-grep (&optional arg) + "Perform rgrep in the project. + +With a prefix ARG asks for files (globbing-aware) which to grep in. +With prefix ARG of `-' (such as `M--'), default the files (without prompt), +to `projectile-grep-default-files'." + (interactive "P") + (let* ((roots (projectile-get-project-directories)) + (search-regexp (if (and transient-mark-mode mark-active) + (buffer-substring (region-beginning) (region-end)) + (read-string (projectile-prepend-project-name "Grep for: ") + (projectile-symbol-at-point)))) + (files (and arg (or (and (equal current-prefix-arg '-) + (projectile-grep-default-files)) + (read-string (projectile-prepend-project-name "Grep in: ") + (projectile-grep-default-files)))))) + (dolist (root-dir roots) + (require 'grep) + ;; in git projects users have the option to use `vc-git-grep' instead of `rgrep' + (if (and (eq (projectile-project-vcs) 'git) projectile-use-git-grep) + (vc-git-grep search-regexp (or files "") root-dir) + ;; paths for find-grep should relative and without trailing / + (let ((grep-find-ignored-directories (-union (-map (lambda (dir) (s-chop-suffix "/" (file-relative-name dir root-dir))) + (cdr (projectile-ignored-directories))) grep-find-ignored-directories)) + (grep-find-ignored-files (-union (-map (lambda (file) (file-relative-name file root-dir)) (projectile-ignored-files)) grep-find-ignored-files))) + (grep-compute-defaults) + (rgrep search-regexp (or files "* .*") root-dir)))))) + +(defun projectile-ack (regexp &optional arg) + "Run an ack search with REGEXP in the project. + +With a prefix argument ARG prompts you for a directory on which the search is performed ." + (interactive + (list (read-from-minibuffer + (projectile-prepend-project-name "Ack search for: ") + (projectile-symbol-at-point)) + current-prefix-arg)) + (if (require 'ack-and-a-half nil 'noerror) + (let* ((saved-arguments ack-and-a-half-arguments) + (root (if arg + (expand-file-name (projectile-complete-dir) (projectile-project-root)) + (projectile-project-root))) + (ack-and-a-half-arguments + (append saved-arguments + (-union (-map (lambda (path) + (concat "--ignore-dir=" (file-name-nondirectory (directory-file-name path)))) + (projectile-ignored-directories)) + (-map (lambda (path) + (concat "--ignore-file=is:" (file-relative-name path root))) + (projectile-ignored-files)))))) + (ack-and-a-half regexp t root)) + (error "ack-and-a-half not available"))) + +(defun projectile-ag (search-term &optional arg) + "Run an ag search with SEARCH-TERM in the project. + +With an optional prefix argument ARG SEARCH-TERM is interpreted as a +regular expression." + (interactive + (list (read-from-minibuffer + (projectile-prepend-project-name (format "Ag %ssearch for: " (if current-prefix-arg "regexp " ""))) + (projectile-symbol-at-point)) + current-prefix-arg)) + (if (fboundp 'ag-regexp) + (let ((ag-command (if arg 'ag-regexp 'ag)) + ;; reset the prefix arg, otherwise it will affect the ag-command + (current-prefix-arg nil)) + (funcall ag-command search-term (projectile-project-root))) + (error "Ag is not available"))) + +(defun projectile-tags-exclude-patterns () + "Return a string with exclude patterns for ctags." + (mapconcat (lambda (pattern) (format "--exclude=%s" + (directory-file-name pattern))) + (projectile-ignored-directories-rel) " ")) + +(defun projectile-regenerate-tags () + "Regenerate the project's [e|g]tags." + (interactive) + (if (boundp 'ggtags-mode) + (progn + (let* ((ggtags-project-root (projectile-project-root)) + (default-directory ggtags-project-root)) + (ggtags-ensure-project) + (ggtags-update-tags t))) + (let* ((project-root (projectile-project-root)) + (tags-exclude (projectile-tags-exclude-patterns)) + (default-directory project-root) + (tags-file (expand-file-name projectile-tags-file-name)) + (command (format projectile-tags-command tags-file tags-exclude)) + shell-output exit-code) + (with-temp-buffer + (setq exit-code + (call-process-shell-command command nil (current-buffer)) + shell-output + (s-trim (buffer-substring (point-min) (point-max))))) + (unless (zerop exit-code) + (error shell-output)) + (visit-tags-table tags-file)))) + +(defun projectile-visit-project-tags-table () + "Visit the current project's tags table." + (when (projectile-project-p) + (let ((tags-file (projectile-expand-root projectile-tags-file-name))) + (when (file-exists-p tags-file) + (with-demoted-errors + "Error loading tags-file: %s" + (visit-tags-table tags-file t)))))) + +(defun projectile-find-tag () + "Find tag in project." + (interactive) + (let ((find-tag-function (if (boundp 'ggtags-mode) 'ggtags-find-tag 'find-tag)) + (tags (if (boundp 'ggtags-mode) + (projectile--tags (all-completions "" ggtags-completion-table)) + ;; we have to manually reset the tags-completion-table every time + (setq tags-completion-table nil) + (tags-completion-table) + (projectile--tags tags-completion-table)))) + (funcall find-tag-function (projectile-completing-read "Find tag: " + tags + (projectile-symbol-at-point))))) + +(defun projectile--tags (completion-table) + "Find tags using COMPLETION-TABLE." + (-reject 'null + (-map (lambda (x) + (unless (integerp x) + (prin1-to-string x t))) + completion-table))) + +(defmacro projectile-with-default-dir (dir &rest body) + "Invoke in DIR the BODY." + (declare (debug t) (indent 1)) + `(let ((default-directory ,dir)) + ,@body)) + +(defun projectile-run-command-in-root () + "Invoke `execute-extended-command' in the project's root." + (interactive) + (projectile-with-default-dir (projectile-project-root) + (call-interactively 'execute-extended-command))) + +(defun projectile-run-shell-command-in-root () + "Invoke `shell-command' in the project's root." + (interactive) + (projectile-with-default-dir (projectile-project-root) + (call-interactively 'shell-command))) + +(defun projectile-run-async-shell-command-in-root () + "Invoke `async-shell-command' in the project's root." + (interactive) + (projectile-with-default-dir (projectile-project-root) + (call-interactively 'async-shell-command))) + +(defun projectile-files-in-project-directory (directory) + "Return a list of files in DIRECTORY." + (let ((dir (file-relative-name (expand-file-name directory) (projectile-project-root)))) + (-filter (lambda (file) (s-starts-with-p dir file)) + (projectile-current-project-files)))) + +(defun projectile-unixy-system-p () + "Check to see if unixy text utilities are installed." + (--all? (executable-find it) '("grep" "cut" "uniq"))) + +(defun projectile-files-from-cmd (cmd directory) + "Use a grep-like CMD to search for files within DIRECTORY. + +CMD should include the necessary search params and should output +equivalently to grep -H (colon-deliminated, with the relative +filename as the first column). Returns a list of expanded +filenames." + (let ((default-directory directory)) + (->> (s-trim (shell-command-to-string + (concat cmd " | cut -d: -f1 | uniq"))) + (s-split "\n+") + (-filter 's-present?) + (--map (concat directory (s-chop-prefix "./" it)))))) + +(defun projectile-files-with-string (string directory) + "Return a list of all files containing STRING in DIRECTORY. + +Tries to use ag, ack, git-grep, and grep in that order. If those +are impossible (for instance on Windows), returns a list of all +files in the project." + (if (projectile-unixy-system-p) + (let* ((search-term (shell-quote-argument string)) + (cmd (cond ((executable-find "ag") + (concat "ag --literal --nocolor --noheading -- " + search-term)) + ((executable-find "ack") + (concat "ack --noheading --nocolor -- " + search-term)) + ((and (executable-find "git") + (eq (projectile-project-vcs) 'git)) + (concat "git grep -H " + search-term)) + (t + (concat "grep -rH " + search-term + " ."))))) + (projectile-files-from-cmd cmd directory)) + ;; we have to reject directories as a workaround to work with git submodules + (-reject 'file-directory-p + (-map 'projectile-expand-root (projectile-dir-files directory))))) + +(defun projectile-replace (arg) + "Replace a string in the project using `tags-query-replace'. + +With a prefix argument ARG prompts you for a directory on which +to run the replacement." + (interactive "P") + (let* ((old-text (read-string + (projectile-prepend-project-name "Replace: ") + (projectile-symbol-at-point))) + (new-text (read-string + (projectile-prepend-project-name + (format "Replace %s with: " old-text)))) + (directory (if arg + (read-directory-name "Replace in directory: ") + (projectile-project-root))) + (files (projectile-files-with-string old-text directory))) + (tags-query-replace old-text new-text nil (cons 'list files)))) + +(defun projectile-symbol-at-point () + "Get the symbol at point and strip its properties." + (substring-no-properties (or (thing-at-point 'symbol) ""))) + +(defun projectile-kill-buffers () + "Kill all project buffers." + (interactive) + (let* ((buffers (projectile-project-buffers)) + (question + (format + "Are you sure you want to kill %d buffer(s) for '%s'? " + (length buffers) + (projectile-project-name)))) + (if (yes-or-no-p question) + ;; we take care not to kill indirect buffers directly + ;; as we might encounter them after their base buffers are killed + (mapc 'kill-buffer (-remove 'buffer-base-buffer buffers))))) + +(defun projectile-save-project-buffers () + "Save all project buffers." + (interactive) + (--each (projectile-project-buffers) + (with-current-buffer it + (when buffer-file-name + (save-buffer))))) + +(defun projectile-dired () + "Open `dired' at the root of the project." + (interactive) + (dired (projectile-project-root))) + +(defun projectile-vc () + "Open `vc-dir' at the root of the project. + +For git projects `magit-status' is used if available." + (interactive) + (cond + ((and (eq (projectile-project-vcs) 'git) (fboundp 'magit-status)) + (magit-status (projectile-project-root))) + (t (vc-dir (projectile-project-root))))) + +(defun projectile-recentf () + "Show a list of recently visited files in a project." + (interactive) + (if (boundp 'recentf-list) + (find-file (projectile-expand-root (projectile-completing-read "Recently visited files: " (projectile-recentf-files)))) + (message "recentf is not enabled"))) + +(defun projectile-recentf-files () + "Return a list of recently visited files in a project." + (if (boundp 'recentf-list) + (let ((project-root (projectile-project-root))) + (->> recentf-list + (-filter (lambda (file) (s-starts-with-p project-root file))) + (-map (lambda (file) (file-relative-name file project-root))))) + nil)) + +(defun projectile-serialize-cache () + "Serializes the memory cache to the hard drive." + (projectile-serialize projectile-projects-cache projectile-cache-file)) + +(defvar projectile-rails-compile-cmd "bundle exec rails server") +(defvar projectile-ruby-compile-cmd "bundle exec rake build") +(defvar projectile-ruby-test-cmd "bundle exec rake test") +(defvar projectile-ruby-rspec-cmd "bundle exec rspec") +(defvar projectile-django-compile-cmd "python manage.py runserver") +(defvar projectile-django-test-cmd "python manage.py test") +(defvar projectile-python-compile-cmd "python setup.py build") +(defvar projectile-python-test-cmd "python -m unittest discover") +(defvar projectile-symfony-compile-cmd "app/console server:run") +(defvar projectile-symfony-test-cmd "phpunit -c app ") +(defvar projectile-maven-compile-cmd "mvn clean install") +(defvar projectile-maven-test-cmd "mvn test") +(defvar projectile-gradle-compile-cmd "gradle build") +(defvar projectile-gradle-test-cmd "gradle test") +(defvar projectile-grails-compile-cmd "grails package") +(defvar projectile-grails-test-cmd "grails test-app") +(defvar projectile-lein-compile-cmd "lein compile") +(defvar projectile-lein-test-cmd "lein test") +(defvar projectile-rebar-compile-cmd "rebar") +(defvar projectile-rebar-test-cmd "rebar eunit") +(defvar projectile-sbt-compile-cmd "sbt compile") +(defvar projectile-sbt-test-cmd "sbt test") +(defvar projectile-make-compile-cmd "make") +(defvar projectile-make-test-cmd "make test") +(defvar projectile-grunt-compile-cmd "grunt") +(defvar projectile-grunt-test-cmd "grunt test") +(defvar projectile-gulp-compile-cmd "gulp") +(defvar projectile-gulp-test-cmd "gulp test") +(defvar projectile-go-compile-cmd "go build ./...") +(defvar projectile-go-test-cmd "go test ./...") + +(cl-dolist (var '(projectile-rails-compile-cmd + projectile-ruby-compile-cmd + projectile-ruby-test-cmd + projectile-ruby-rspec-cmd + projectile-django-compile-cmd + projectile-django-test-cmd + projectile-python-compile-cmd + projectile-python-test-cmd + projectile-symfony-compile-cmd + projectile-symfony-test-cmd + projectile-maven-compile-cmd + projectile-maven-test-cmd + projectile-lein-compile-cmd + projectile-lein-test-cmd + projectile-rebar-compile-cmd + projectile-rebar-test-cmd + projectile-sbt-compile-cmd + projectile-sbt-test-cmd + projectile-make-compile-cmd + projectile-make-test-cmd + projectile-grunt-compile-cmd + projectile-grunt-test-cmd)) + (put var 'safe-local-variable #'stringp)) + + +(defvar projectile-compilation-cmd-map + (make-hash-table :test 'equal) + "A mapping between projects and the last compilation command used on them.") +(defvar projectile-test-cmd-map + (make-hash-table :test 'equal) + "A mapping between projects and the last test command used on them.") + +(defun projectile-default-compilation-command (project-type) + "Retrieve default compilation command for PROJECT-TYPE." + (cond + ((member project-type '(rails-rspec rails-test)) projectile-rails-compile-cmd) + ((member project-type '(ruby-rspec ruby-test)) projectile-ruby-compile-cmd) + ((eq project-type 'django) projectile-django-compile-cmd) + ((eq project-type 'python) projectile-python-compile-cmd) + ((eq project-type 'symfony) projectile-symfony-compile-cmd) + ((eq project-type 'lein) projectile-lein-compile-cmd) + ((eq project-type 'make) projectile-make-compile-cmd) + ((eq project-type 'rebar) projectile-rebar-compile-cmd) + ((eq project-type 'maven) projectile-maven-compile-cmd) + ((eq project-type 'gradle) projectile-gradle-compile-cmd) + ((eq project-type 'grails) projectile-grails-compile-cmd) + ((eq project-type 'sbt) projectile-sbt-compile-cmd) + ((eq project-type 'grunt) projectile-grunt-compile-cmd) + ((eq project-type 'gulp) projectile-gulp-compile-cmd) + ((eq project-type 'go) projectile-go-compile-cmd) + (t projectile-make-compile-cmd))) + +(defun projectile-default-test-command (project-type) + "Retrieve default test command for PROJECT-TYPE." + (cond + ((member project-type '(rails-rspec ruby-rspec)) projectile-ruby-rspec-cmd) + ((member project-type '(rails-test ruby-test)) projectile-ruby-test-cmd) + ((eq project-type 'django) projectile-django-test-cmd) + ((eq project-type 'python) projectile-python-test-cmd) + ((eq project-type 'symfony) projectile-symfony-test-cmd) + ((eq project-type 'lein) projectile-lein-test-cmd) + ((eq project-type 'make) projectile-make-test-cmd) + ((eq project-type 'rebar) projectile-rebar-test-cmd) + ((eq project-type 'maven) projectile-maven-test-cmd) + ((eq project-type 'gradle) projectile-gradle-test-cmd) + ((eq project-type 'grails) projectile-grails-test-cmd) + ((eq project-type 'sbt) projectile-sbt-test-cmd) + ((eq project-type 'grunt) projectile-grunt-test-cmd) + ((eq project-type 'gulp) projectile-gulp-test-cmd) + ((eq project-type 'go) projectile-go-test-cmd) + (t projectile-make-test-cmd))) + +(defun projectile-compilation-command (project) + "Retrieve the compilation command for PROJECT." + (or (gethash project projectile-compilation-cmd-map) + (projectile-default-compilation-command (projectile-project-type)))) + +(defun projectile-test-command (project) + "Retrieve the test command for PROJECT." + (or (gethash project projectile-test-cmd-map) + (projectile-default-test-command (projectile-project-type)))) + +(defun projectile-compile-project (arg) + "Run project compilation command. + +Normally you'll be prompted for a compilation command, unless +variable `compilation-read-command'. You can force the prompt +with a prefix ARG." + (interactive "P") + (let* ((project-root (projectile-project-root)) + (default-cmd (projectile-compilation-command project-root)) + (compilation-cmd (if (or compilation-read-command arg) + (compilation-read-command default-cmd) + default-cmd)) + (default-directory project-root)) + (puthash project-root compilation-cmd projectile-compilation-cmd-map) + (compilation-start compilation-cmd))) + +(defadvice compilation-find-file (around projectile-compilation-find-file) + "Try to find a buffer for FILENAME, if we cannot find it, +fallback to the original function." + (let ((filename (ad-get-arg 1))) + (setf ad-return-value + (or + (if (file-exists-p (expand-file-name filename)) + (find-file-noselect filename)) + ;; Try to find the filename using projectile + (and (projectile-project-p) + (loop with root = (projectile-project-root) + for dir in (cons "" (projectile-current-project-dirs)) + for file = (expand-file-name filename + (expand-file-name dir root)) + if (file-exists-p file) + return (find-file-noselect file))) + ;; Fall back to the old function `compilation-find-file' + ad-do-it)))) + +;; TODO - factor this duplication out +(defun projectile-test-project (arg) + "Run project test command. + +Normally you'll be prompted for a compilation command, unless +variable `compilation-read-command'. You can force the prompt +with a prefix ARG." + (interactive "P") + (let* ((project-root (projectile-project-root)) + (default-cmd (projectile-test-command project-root)) + (test-cmd (if (or compilation-read-command arg) + (compilation-read-command default-cmd) + default-cmd)) + (default-directory project-root)) + (puthash project-root test-cmd projectile-test-cmd-map) + (compilation-start test-cmd))) + +(defun projectile-relevant-known-projects () + "Return a list of known projects except the current one (if present)." + (if (projectile-project-p) + (-difference projectile-known-projects + (list (abbreviate-file-name (projectile-project-root)))) + projectile-known-projects)) + +(defun projectile-switch-project (&optional arg) + "Switch to a project we have visited before. +Invokes the command referenced by `projectile-switch-project-action' on switch. +With a prefix ARG invokes `projectile-commander' instead of +`projectile-switch-project-action.'" + (interactive "P") + (let ((relevant-projects (projectile-relevant-known-projects))) + (if relevant-projects + (projectile-switch-project-by-name + (projectile-completing-read "Switch to project: " relevant-projects) + arg) + (error "There are no known projects")))) + +(defun projectile-switch-project-by-name (project-to-switch &optional arg) + "Switch to project by project name PROJECT-TO-SWITCH. +Invokes the command referenced by `projectile-switch-project-action' on switch. +With a prefix ARG invokes `projectile-commander' instead of +`projectile-switch-project-action.'" + (let* ((default-directory project-to-switch) + (switch-project-action (if arg + 'projectile-commander + projectile-switch-project-action))) + (if projectile-remember-window-configs + (unless (projectile-restore-window-config (projectile-project-name)) + (funcall switch-project-action) + (delete-other-windows)) + (funcall switch-project-action)) + (run-hooks 'projectile-switch-project-hook))) + + +(defun projectile-find-file-in-directory (&optional directory) + "Jump to a file in a (maybe regular) DIRECTORY. + +This command will first prompt for the directory the file is in." + (interactive "DFind file in directory: ") + (let ((default-directory directory) + (projectile-require-project-root nil)) + (if (projectile-project-p) + ;; target directory is in a project + (let ((file (projectile-completing-read "Find file: " + (projectile-dir-files directory)))) + (find-file (expand-file-name file (projectile-project-root))) + (run-hooks 'projectile-find-file-hook)) + ;; target directory is not in a project + (projectile-find-file)))) + +(defun projectile-find-file-in-known-projects () + "Jump to a file in any of the known projects." + (interactive) + (let ((projectile-require-project-root nil) + (all-files nil)) + (-each projectile-known-projects + (lambda (project) + (when (file-exists-p project) + (let ((default-directory project)) + (setq all-files (append all-files (-map (lambda (file) + (expand-file-name file project)) + (projectile-current-project-files)))))))) + (find-file (projectile-completing-read "Find file in projects: " all-files)))) + +(defcustom projectile-switch-project-hook nil + "Hooks run when project is switched." + :group 'projectile + :type 'hook) + + +(defun projectile-cleanup-known-projects () + "Remove known projects that don't exist anymore." + (interactive) + (setq projectile-known-projects (--filter (projectile-file-exists-p it) projectile-known-projects)) + (projectile-save-known-projects)) + +(defun projectile-clear-known-projects () + "Clear both `projectile-known-projects' and `projectile-known-projects-file'." + (interactive) + (setq projectile-known-projects nil) + (projectile-save-known-projects)) + +(defun projectile-remove-known-project (&optional project) + "Remove PROJECT from the list of known projects." + (interactive (list (projectile-completing-read "Remove from known projects: " + projectile-known-projects))) + (setq projectile-known-projects + (--reject (string= project it) projectile-known-projects)) + (projectile-save-known-projects) + (message "Project %s removed from the list of known projects." project)) + +(defun projectile-remove-current-project-from-known-projects () + "Remove the current project from the list of known projects." + (interactive) + (projectile-remove-known-project (abbreviate-file-name (projectile-project-root)))) + +(defun projectile-ignored-projects () + "A list of projects that should not be save in `projectile-known-projects'." + (-map 'file-truename projectile-ignored-projects)) + +(defun projectile-add-known-project (project-root) + "Add PROJECT-ROOT to the list of known projects." + (unless (member project-root (projectile-ignored-projects)) + (setq projectile-known-projects + (-distinct + (cons (abbreviate-file-name project-root) + projectile-known-projects))))) + +(defun projectile-load-known-projects () + "Load saved projects from `projectile-known-projects-file'. +Also set `projectile-known-projects'." + (setq projectile-known-projects + (projectile-unserialize projectile-known-projects-file))) + +;; load the known projects +(projectile-load-known-projects) + +(defun projectile-save-known-projects () + "Save PROJECTILE-KNOWN-PROJECTS to PROJECTILE-KNOWN-PROJECTS-FILE." + (projectile-serialize projectile-known-projects projectile-known-projects-file)) + +(define-ibuffer-filter projectile-files + "Show Ibuffer with all buffers in the current project." + (:reader (read-directory-name "Project root: " (ignore-errors (projectile-project-root))) + :description nil) + (with-current-buffer buf + (equal (file-name-as-directory (expand-file-name qualifier)) + (ignore-errors (projectile-project-root))))) + +(defun projectile-ibuffer-by-project (project-root) + "Open an IBuffer window showing all buffers in PROJECT-ROOT." + (let ((project-name (file-name-nondirectory (directory-file-name project-root)))) + (ibuffer nil (format "*%s Buffers*" project-name) + (list (cons 'projectile-files project-root))))) + +(defun projectile-ibuffer (prefix) + "Open an IBuffer window showing all buffers in the current project. + +Let user choose another project when PREFIX is supplied." + (interactive "p") + (let ((project-root (if (= prefix 4) + (projectile-completing-read + "Project name: " + (projectile-relevant-known-projects)) + (projectile-project-root)))) + + (projectile-ibuffer-by-project project-root))) + +;;;; projectile-commander + +(defconst projectile-commander-help-buffer "*Commander Help*") + +(defvar projectile-commander-methods nil + "List of file-selection methods for the `projectile-commander' command. +Each element is a list (KEY DESCRIPTION FUNCTION). +DESCRIPTION is a one-line description of what the key selects.") + +;;;###autoload +(defun projectile-commander () + "Execute a Projectile command with a single letter. +The user is prompted for a single character indicating the action to invoke. +The `?' character describes then +available actions. + +See `def-projectile-commander-method' for defining new methods." + (interactive) + (message "Commander [%s]: " + (apply #'string (mapcar #'car projectile-commander-methods))) + (let* ((ch (save-window-excursion + (select-window (minibuffer-window)) + (read-char))) + (method (cl-find ch projectile-commander-methods :key #'car))) + (cond (method + (funcall (cl-caddr method))) + (t + (message "No method for character: ?\\%c" ch) + (ding) + (sleep-for 1) + (discard-input) + (projectile-commander))))) + +(defmacro def-projectile-commander-method (key description &rest body) + "Define a new `projectile-commander' method. + +KEY is the key the user will enter to choose this method. + +DESCRIPTION is a one-line sentence describing how the method. + +BODY is a series of forms which are evaluated when the find +is chosen." + (let ((method `(lambda () + ,@body))) + `(setq projectile-commander-methods + (cl-sort (cons (list ,key ,description ,method) + (cl-remove ,key projectile-commander-methods :key #'car)) + #'< :key #'car)))) + +(def-projectile-commander-method ?? "Commander help buffer." + (ignore-errors (kill-buffer projectile-commander-help-buffer)) + (with-current-buffer (get-buffer-create projectile-commander-help-buffer) + (insert "Projectile Commander Methods:\n\n") + (loop for (key line nil) in projectile-commander-methods + do (insert (format "%c:\t%s\n" key line))) + (goto-char (point-min)) + (help-mode) + (display-buffer (current-buffer) t)) + (projectile-commander)) + +(def-projectile-commander-method ?a + "Run ack on project." + (call-interactively 'projectile-ack)) + +(def-projectile-commander-method ?A + "Find ag on project." + (call-interactively 'projectile-ag)) + +(def-projectile-commander-method ?f + "Find file in project." + (projectile-find-file)) + +(def-projectile-commander-method ?T + "Find test file in project." + (projectile-find-test-file)) + +(def-projectile-commander-method ?b + "Switch to project buffer." + (projectile-switch-to-buffer)) + +(def-projectile-commander-method ?d + "Find directory in project." + (projectile-find-dir)) + +(def-projectile-commander-method ?D + "Open project root in dired." + (projectile-dired)) + +(def-projectile-commander-method ?v + "Open project root in vc-dir or magit." + (projectile-vc)) + +(def-projectile-commander-method ?R + "Regenerate the project's [e|g]tags." + (projectile-regenerate-tags)) + +(def-projectile-commander-method ?g + "Run grep on project." + (projectile-grep)) + +(def-projectile-commander-method ?s + "Switch project." + (projectile-switch-project)) + +(def-projectile-commander-method ?o + "Run multi-occur on project buffers." + (projectile-multi-occur)) + +(def-projectile-commander-method ?j + "Find tag in project." + (projectile-find-tag)) + +(def-projectile-commander-method ?k + "Kill all project buffers." + (projectile-kill-buffers)) + +(def-projectile-commander-method ?e + "Find recently visited file in project." + (projectile-recentf)) + +;;; Minor mode +(defvar projectile-command-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "4 b") 'projectile-switch-to-buffer-other-window) + (define-key map (kbd "4 C-o") 'projectile-display-buffer) + (define-key map (kbd "4 d") 'projectile-find-dir-other-window) + (define-key map (kbd "4 f") 'projectile-find-file-other-window) + (define-key map (kbd "4 t") 'projectile-find-implementation-or-test-other-window) + (define-key map (kbd "!") 'projectile-run-shell-command-in-root) + (define-key map (kbd "&") 'projectile-run-async-shell-command-in-root) + (define-key map (kbd "b") 'projectile-switch-to-buffer) + (define-key map (kbd "c") 'projectile-compile-project) + (define-key map (kbd "d") 'projectile-find-dir) + (define-key map (kbd "D") 'projectile-dired) + (define-key map (kbd "e") 'projectile-recentf) + (define-key map (kbd "f") 'projectile-find-file) + (define-key map (kbd "F") 'projectile-find-file-in-known-projects) + (define-key map (kbd "i") 'projectile-invalidate-cache) + (define-key map (kbd "I") 'projectile-ibuffer) + (define-key map (kbd "j") 'projectile-find-tag) + (define-key map (kbd "k") 'projectile-kill-buffers) + (define-key map (kbd "l") 'projectile-find-file-in-directory) + (define-key map (kbd "m") 'projectile-commander) + (define-key map (kbd "o") 'projectile-multi-occur) + (define-key map (kbd "p") 'projectile-switch-project) + (define-key map (kbd "P") 'projectile-test-project) + (define-key map (kbd "r") 'projectile-replace) + (define-key map (kbd "R") 'projectile-regenerate-tags) + (define-key map (kbd "s a") 'projectile-ack) + (define-key map (kbd "s g") 'projectile-grep) + (define-key map (kbd "s s") 'projectile-ag) + (define-key map (kbd "S") 'projectile-save-project-buffers) + (define-key map (kbd "t") 'projectile-toggle-between-implementation-and-test) + (define-key map (kbd "T") 'projectile-find-test-file) + (define-key map (kbd "v") 'projectile-vc) + (define-key map (kbd "z") 'projectile-cache-current-file) + (define-key map (kbd "ESC") 'projectile-project-buffers-other-buffer) + map) + "Keymap for Projectile commands after `projectile-keymap-prefix'") +(fset 'projectile-command-map projectile-command-map) + +(defvar projectile-mode-map + (let ((map (make-sparse-keymap))) + (define-key map projectile-keymap-prefix 'projectile-command-map) + map) + "Keymap for Projectile mode.") + +(easy-menu-change + '("Tools") "Projectile" + '(["Find file" projectile-find-file] + ["Find file in known projects" projectile-find-file-in-known-projects] + ["Find test file" projectile-find-test-file] + ["Find directory" projectile-find-dir] + ["Find file in directory" projectile-find-file-in-directory] + ["Switch to buffer" projectile-switch-to-buffer] + ["Jump between implementation file and test file" projectile-toggle-between-implementation-and-test] + ["Kill project buffers" projectile-kill-buffers] + ["Recent files" projectile-recentf] + "--" + ["Open project in dired" projectile-dired] + ["Switch to project" projectile-switch-project] + ["Find in project (grep)" projectile-grep] + ["Find in project (ack)" projectile-ack] + ["Replace in project" projectile-replace] + ["Multi-occur in project" projectile-multi-occur] + "--" + ["Cache current file" projectile-cache-current-file] + ["Invalidate cache" projectile-invalidate-cache] + ["Regenerate [e|g]tags" projectile-regenerate-tags] + "--" + ["Compile project" projectile-compile-project] + ["Test project" projectile-test-project] + "--" + ["About" projectile-version]) + "Search Files (Grep)...") + +(easy-menu-change '("Tools") "--" nil "Search Files (Grep)...") + +;;;###autoload +(defcustom projectile-mode-line + '(:eval (format " Projectile[%s]" (projectile-project-name))) + "Mode line ligher for Projectile. + +The value of this variable is a mode line template as in +`mode-line-format'. See Info Node `(elisp)Mode Line Format' for +details about mode line templates. + +Customize this variable to change how Projectile displays its +status in the mode line. The default value displays the project +name. Set this variable to nil to disable the mode line +entirely." + :group 'projectile + :type 'sexp + :risky t + :package-version '(projectile "0.12.0")) + +;;;###autoload +(define-minor-mode projectile-mode + "Minor mode to assist project management and navigation. + +When called interactively, toggle `projectile-mode'. With prefix +ARG, enable `projectile-mode' if ARG is positive, otherwise disable +it. + +When called from Lisp, enable `projectile-mode' if ARG is omitted, +nil or positive. If ARG is `toggle', toggle `projectile-mode'. +Otherwise behave as if called interactively. + +\\{projectile-mode-map}" + :lighter projectile-mode-line + :keymap projectile-mode-map + :group 'projectile + :require 'projectile + (cond + (projectile-mode + (add-hook 'find-file-hook 'projectile-cache-files-find-file-hook t t) + (add-hook 'find-file-hook 'projectile-cache-projects-find-file-hook t t) + (add-hook 'projectile-find-dir-hook 'projectile-cache-projects-find-file-hook) + (add-hook 'find-file-hook 'projectile-visit-project-tags-table t t) + (ad-activate 'compilation-find-file)) + (t + (remove-hook 'find-file-hook 'projectile-cache-files-find-file-hook t) + (remove-hook 'find-file-hook 'projectile-cache-projects-find-file-hook t) + (remove-hook 'find-file-hook 'projectile-visit-project-tags-table t) + (ad-deactivate 'compilation-find-file)))) + +;;;###autoload +(define-globalized-minor-mode projectile-global-mode + projectile-mode + projectile-on) + +(defun projectile-on () + "Enable Projectile minor mode." + (projectile-mode 1)) + +(defun projectile-off () + "Disable Projectile minor mode." + (projectile-mode -1)) + +(defun projectile-global-on () + "Enable Projectile global minor mode." + (projectile-global-mode +1)) + +(defun projectile-global-off () + "Disable Projectile global minor mode." + (projectile-global-mode -1)) + +(provide 'projectile) + +;; Local Variables: +;; indent-tabs-mode: nil +;; End: + +;;; projectile.el ends here diff --git a/elpa/projectile-20140808.941/projectile.elc b/elpa/projectile-20140808.941/projectile.elc new file mode 100644 index 000000000..16306da38 Binary files /dev/null and b/elpa/projectile-20140808.941/projectile.elc differ diff --git a/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-autoloads.el b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-autoloads.el new file mode 100644 index 000000000..6d37d6627 --- /dev/null +++ b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-autoloads.el @@ -0,0 +1,56 @@ +;;; rainbow-delimiters-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (global-rainbow-delimiters-mode rainbow-delimiters-mode-enable +;;;;;; rainbow-delimiters-mode) "rainbow-delimiters" "rainbow-delimiters.el" +;;;;;; (21478 18819 0 0)) +;;; Generated autoloads from rainbow-delimiters.el + +(autoload 'rainbow-delimiters-mode "rainbow-delimiters" "\ +Highlight nested parentheses, brackets, and braces according to their depth. + +\(fn &optional ARG)" t nil) + +(autoload 'rainbow-delimiters-mode-enable "rainbow-delimiters" "\ + + +\(fn)" nil nil) + +(defvar global-rainbow-delimiters-mode nil "\ +Non-nil if Global-Rainbow-Delimiters mode is enabled. +See the command `global-rainbow-delimiters-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-rainbow-delimiters-mode'.") + +(custom-autoload 'global-rainbow-delimiters-mode "rainbow-delimiters" nil) + +(autoload 'global-rainbow-delimiters-mode "rainbow-delimiters" "\ +Toggle Rainbow-Delimiters mode in all buffers. +With prefix ARG, enable Global-Rainbow-Delimiters mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Rainbow-Delimiters mode is enabled in all buffers where +`rainbow-delimiters-mode-enable' would do it. +See `rainbow-delimiters-mode' for more information on Rainbow-Delimiters mode. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("rainbow-delimiters-pkg.el") (21478 18819 +;;;;;; 281141 0)) + +;;;*** + +(provide 'rainbow-delimiters-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; rainbow-delimiters-autoloads.el ends here diff --git a/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-pkg.el b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-pkg.el new file mode 100644 index 000000000..d60bbd0cf --- /dev/null +++ b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-pkg.el @@ -0,0 +1 @@ +(define-package "rainbow-delimiters" "1.3.21" "Highlight nested parens, brackets, braces a different color at each depth." (quote nil)) diff --git a/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-pkg.elc b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-pkg.elc new file mode 100644 index 000000000..800a7427c Binary files /dev/null and b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters-pkg.elc differ diff --git a/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters.el b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters.el new file mode 100644 index 000000000..154092819 --- /dev/null +++ b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters.el @@ -0,0 +1,475 @@ +;;; rainbow-delimiters.el --- Highlight nested parens, brackets, braces a different color at each depth. + +;; Copyright (C) 2010-2011 Jeremy L. Rayman. +;; Author: Jeremy L. Rayman +;; Maintainer: Jeremy L. Rayman +;; Created: 2010-09-02 +;; Version: 1.3.21 +;; Keywords: faces, convenience, lisp, matching, tools, rainbow, rainbow parentheses, rainbow parens +;; EmacsWiki: http://www.emacswiki.org/emacs/RainbowDelimiters +;; Github: http://github.com/jlr/rainbow-delimiters +;; URL: http://www.emacswiki.org/emacs/download/rainbow-delimiters.el + +;; 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 . + + +;;; Commentary: + +;; rainbow-delimiters is a rainbow parentheses-like mode which highlights +;; parentheses, brackets, and braces according to their depth. Each +;; successive level is highlighted in a different color. This makes it easy +;; to spot matching delimiters, orient yourself in the code, and tell which +;; statements are at a given level. +;; +;; Great care has been taken to make this mode FAST. You should see no +;; discernible change in scrolling or editing speed while using it, +;; even in delimiter-rich languages like Clojure, Lisp, and Scheme. +;; +;; Default colors are subtle, with the philosophy that syntax highlighting +;; shouldn't being visually intrusive. Color schemes are always a matter +;; of taste. If you take the time to design a new color scheme, +;; please share it (even a simple list of colors works) on the EmacsWiki +;; page or via github. +;; EmacsWiki: http://www.emacswiki.org/emacs/RainbowDelimiters +;; Github: http://github.com/jlr/rainbow-delimiters + + +;;; Installation: + +;; 1. Place rainbow-delimiters.el on your emacs load-path. +;; +;; 2. Compile the file (necessary for speed): +;; M-x byte-compile-file +;; +;; 3. Add the following to your dot-emacs/init file: +;; (require 'rainbow-delimiters) +;; +;; 4. Activate the mode in your init file. +;; You can choose to enable it only in certain modes, or Emacs-wide: +;; +;; - To enable it only in specific modes, add lines like the following: +;; (add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) +;; +;; - To activate the mode globally, add to your init file: +;; (global-rainbow-delimiters-mode) +;; +;; - To temporarily activate rainbow-delimiters mode in an open buffer: +;; M-x rainbow-delimiters-mode +;; +;; - To toggle global-rainbow-delimiters-mode: +;; M-x global-rainbow-delimiters-mode + +;;; Customization: + +;; To customize various options, including the color scheme: +;; M-x customize-group rainbow-delimiters +;; +;; color-theme.el users: +;; If you use the color-theme package, you can specify custom colors +;; by adding the appropriate faces to your theme. +;; - Faces take the form of: +;; 'rainbow-delimiters-depth-#-face' with # being the depth. +;; Depth begins at 1, the outermost color. +;; Faces exist for depths 1-9. +;; - The unmatched delimiter face (normally colored red) is: +;; 'rainbow-delimiters-unmatched-face' + + +;;; Change Log: + +;; 1.0 - Initial release. +;; 1.1 - Stop tracking each delimiter's depth independently. +;; This had lead to confusing results when viewing clojure +;; code. Instead, just color based on current nesting inside +;; all delimiters combined. +;; - Added 'all-delimiters' faces to apply a color scheme to +;; all delimiters at once. Other faces inherit from this group. +;; 1.1.1 - Change color scheme to a lighter, more subtle style. +;; 1.1.2: (2011-03-25) +;; - Add an unmatched-delimiter face and correct problem with +;; coloring of text following unmatched closing delims. +;; 1.2: (2011-03-28) +;; - Unify delimiter faces: all delimiter types now use the same depth +;; faces, of form 'rainbow-delimiters-depth-#-face'. +;; 1.2.1: (2011-03-29) +;; - Conform to ELPA conventions. +;; 1.3: (2011-05-24) +;; - Add separate color schemes for light and dark background modes. +;; - Checkboxes to enable/disable highlighting for each delimiter type. +;; - Improvements to Customize interface. +;; - Infinite depth support by cycling through defined faces repeatedly. +;; - Documentation changes. +;; 1.3.1 (2011-05-25) +;; - Light color theme appears entirely grey on SRGB monitors. Revert to +;; old color theme until a nicer light background theme can be added. +;; - Correct typo in the installation step for users of dark backgrounds. +;; 1.3.2 (2011-10-14) +;; - Add 'global-rainbow-delimiters-mode'. +;; - Respect syntax of current buffer major-mode so delimiters +;; highlight correctly in non-lisp languages. + +;;; TODO: + +;; - Add support for independent depth tracking of each delimiter type +;; for users of C-like languages. +;; - Python style - increase depth with each new indentation. +;; - Add support for nested tags (XML, HTML) +;; - Set up proper example color-theme.el themes for rainbow-delimiters mode. +;; - Intelligent support for other languages: Ruby, LaTeX tags, et al. + +;;; Issues: + +;; - Rainbow-delimiters mode does not appear to change the color of +;; delimiters when Org-mode is also enabled. + + +;;; Code: + +(eval-when-compile (require 'cl)) + + +;; Note: some of the functions in this file have been inlined for speed. +;; Inlining functions can cause problems with debugging. To debug these +;; functions more easily, change defsubst -> defun. +;; http://www.gnu.org/s/emacs/manual/html_node/elisp/Compilation-Tips.html + +;;; Customize interface: + +(defgroup rainbow-delimiters nil + "Highlight nested parentheses, brackets, and braces according to their depth." + :prefix "rainbow-delimiters-" + :link '(url-link :tag "Website for rainbow-delimiters (EmacsWiki)" + "http://www.emacswiki.org/emacs/RainbowDelimiters") + :group 'applications) + +(defgroup rainbow-delimiters-faces nil + "Faces for successively nested pairs of delimiters. + +When depth exceeds innermost defined face, colors cycle back through." + :tag "Color Scheme" + :group 'rainbow-delimiters + :link '(custom-group-link "rainbow-delimiters") + :link '(custom-group-link :tag "Toggle Delimiters" "rainbow-delimiters-toggle-delimiter-highlighting") + :prefix 'rainbow-delimiters-faces-) + +;; Choose which delimiters you want to highlight in your preferred language: + +(defgroup rainbow-delimiters-toggle-delimiter-highlighting nil + "Choose which delimiters to highlight." + :tag "Toggle Delimiters" + :group 'rainbow-delimiters + :link '(custom-group-link "rainbow-delimiters") + :link '(custom-group-link :tag "Color Scheme" "rainbow-delimiters-faces")) + +(defcustom rainbow-delimiters-highlight-parens-p t + "Enable highlighting of nested parentheses -- (). + +Non-nil (default) enables highlighting of parentheses. +Nil disables parentheses highlighting." + :tag "Highlight Parentheses?" + :type 'boolean + :group 'rainbow-delimiters-toggle-delimiter-highlighting) + +(defcustom rainbow-delimiters-highlight-brackets-p t + "Enable highlighting of nested brackets -- []. + +Non-nil (default) enables highlighting of brackets. +Nil disables bracket highlighting." + :tag "Highlight Brackets?" + :type 'boolean + :group 'rainbow-delimiters-toggle-delimiter-highlighting) + +(defcustom rainbow-delimiters-highlight-braces-p t + "Enable highlighting of nested braces -- {}. + +Non-nil (default) enables highlighting of braces. +Nil disables brace highlighting." + :tag "Highlight Braces?" + :type 'boolean + :group 'rainbow-delimiters-toggle-delimiter-highlighting) + + +;;; Faces: + +;; Unmatched delimiter face: +(defface rainbow-delimiters-unmatched-face + '((((background light)) (:foreground "#88090B")) + (((background dark)) (:foreground "#88090B"))) + "Face to highlight unmatched closing delimiters in." + :group 'rainbow-delimiters-faces) + +;; Faces for highlighting delimiters by nested level: +(defface rainbow-delimiters-depth-1-face + '((((background light)) (:foreground "grey55")) + (((background dark)) (:foreground "grey55"))) + "Nested delimiters face, depth 1 - outermost set." + :tag "Rainbow Delimiters Depth 1 Face -- OUTERMOST" + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-2-face + '((((background light)) (:foreground "#93a8c6")) + (((background dark)) (:foreground "#93a8c6"))) + "Nested delimiters face, depth 2." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-3-face + '((((background light)) (:foreground "#b0b1a3")) + (((background dark)) (:foreground "#b0b1a3"))) + "Nested delimiters face, depth 3." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-4-face + '((((background light)) (:foreground "#97b098")) + (((background dark)) (:foreground "#97b098"))) + "Nested delimiters face, depth 4." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-5-face + '((((background light)) (:foreground "#aebed8")) + (((background dark)) (:foreground "#aebed8"))) + "Nested delimiters face, depth 5." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-6-face + '((((background light)) (:foreground "#b0b0b3")) + (((background dark)) (:foreground "#b0b0b3"))) + "Nested delimiters face, depth 6." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-7-face + '((((background light)) (:foreground "#90a890")) + (((background dark)) (:foreground "#90a890"))) + "Nested delimiters face, depth 7." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-8-face + '((((background light)) (:foreground "#a2b6da")) + (((background dark)) (:foreground "#a2b6da"))) + "Nested delimiters face, depth 8." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-9-face + '((((background light)) (:foreground "#9cb6ad")) + (((background dark)) (:foreground "#9cb6ad"))) + "Nested delimiters face, depth 9." + :group 'rainbow-delimiters-faces) + +;;; Faces 10+: +;; NOTE: Currently unused. Additional faces for depths 9+ can be added on request. + +(defconst rainbow-delimiters-max-face-count 9 + "Number of faces defined for highlighting delimiter levels. + +Determines depth at which to cycle through faces again.") + +;;; Face utility functions + +(defsubst rainbow-delimiters-depth-face (depth) + "Return face-name for DEPTH as a string 'rainbow-delimiters-depth-DEPTH-face'. + +For example: 'rainbow-delimiters-depth-1-face'." + (concat "rainbow-delimiters-depth-" + (number-to-string + (or + ;; Our nesting depth has a face defined for it. + (and (< depth rainbow-delimiters-max-face-count) + depth) + ;; Deeper than # of defined faces; cycle back through to beginning. + (let ((cycled-depth (mod depth rainbow-delimiters-max-face-count))) + (if (/= cycled-depth 0) + ;; Return face # that corresponds to current nesting level. + (mod depth rainbow-delimiters-max-face-count) + ;; Special case: depth divides evenly into max, correct face # is max. + rainbow-delimiters-max-face-count)))) + "-face")) + + +;;; Nesting level + +(defvar rainbow-delimiters-all-delimiters-syntax-table nil + "Syntax table (inherited from buffer major-mode) which uses all delimiters. + +When rainbow-delimiters-minor-mode is first activated, it sets this variable and +the other rainbow-delimiters specific syntax tables based on the current +major-mode. The syntax table is constructed by the function +'rainbow-delimiters-make-syntax-table-all-delimiters'.") + +;; syntax-table: used with parse-partial-sexp for determining current depth. +(defun rainbow-delimiters-make-syntax-table-all-delimiters (syntax-table) + "Inherit SYNTAX-TABLE and add delimiters intended to be highlighted by mode." + (let ((table (copy-syntax-table syntax-table))) + (modify-syntax-entry ?\( "() " table) + (modify-syntax-entry ?\) ")( " table) + (modify-syntax-entry ?\[ "(]" table) + (modify-syntax-entry ?\] ")[" table) + (modify-syntax-entry ?\{ "(}" table) + (modify-syntax-entry ?\} "){" table) + table)) + +(defun rainbow-delimiters-depth (point) + "Return # of nested levels of parens, brackets, braces POINT is inside of." + (save-excursion + (beginning-of-defun) + (let ((depth + (with-syntax-table rainbow-delimiters-all-delimiters-syntax-table + (car (parse-partial-sexp (point) point))))) + (if (>= depth 0) + depth + 0)))) ; ignore negative depths created by unmatched closing parens. + + +;;; Text properties + +(defsubst rainbow-delimiters-propertize-delimiter (loc depth) + "Highlight a single delimiter at LOC according to DEPTH. + +LOC is the location of the character to add text properties to. +DEPTH is the nested depth at LOC, which determines the face to use. + +Sets text properties: +`font-lock-face' to the appropriate delimiter face. +`rear-nonsticky' to prevent color from bleeding into subsequent characters typed by the user." + (with-silent-modifications + (let ((delim-face (if (<= depth 0) + "rainbow-delimiters-unmatched-face" + (rainbow-delimiters-depth-face depth)))) + ;; (when (eq depth -1) (message "Unmatched delimiter at char %s." loc)) + (add-text-properties loc (1+ loc) + `(font-lock-face ,delim-face + rear-nonsticky t))))) + + +(defsubst rainbow-delimiters-unpropertize-delimiter (loc) + "Remove text properties set by rainbow-delimiters mode from char at LOC." + (with-silent-modifications + (remove-text-properties loc (1+ loc) + '(font-lock-face nil + rear-nonsticky nil)))) + + +(defun rainbow-delimiters-char-ineligible-p (loc) + "Return t if char at LOC should be skipped, e.g. if inside a comment. + +Returns t if char at loc meets one of the following conditions: +- Inside a string. +- Inside a comment. +- Is an escaped char, e.g. ?\)" + (let ((parse-state (save-excursion + (beginning-of-defun) + ;; (point) is at beg-of-defun; loc is the char location + (parse-partial-sexp (point) loc)))) + (or + (nth 3 parse-state) ; inside string? + (nth 4 parse-state) ; inside comment? + (and (eq (char-before loc) ?\\) ; escaped char, e.g. ?\) - not counted + (and (not (eq (char-before (1- loc)) ?\\)) ; special-case: ignore ?\\ + (eq (char-before (1- loc)) ?\?)))))) +;; NOTE: standard char read syntax '?)' is not tested for because emacs manual +;; states punctuation such as delimiters should _always_ use escaped '?\)' form. + + +(defsubst rainbow-delimiters-apply-color (delim depth loc) + "Apply color for DEPTH to DELIM at LOC following user settings. + +DELIM is a string specifying delimiter type. +DEPTH is the delimiter depth, or corresponding face # if colors are repeating. +LOC is location of character (delimiter) to be colorized." + (and + ;; Ensure user has enabled highlighting of this delimiter type. + (symbol-value (intern-soft + (concat "rainbow-delimiters-highlight-" delim "s-p"))) + (rainbow-delimiters-propertize-delimiter loc + depth))) + + +;;; JIT-Lock functionality + +;; Used to skip delimiter-by-delimiter `rainbow-delimiters-propertize-region'. +(defvar rainbow-delimiters-delim-regex "\\(\(\\|\)\\|\\[\\|\\]\\|\{\\|\}\\)" + "Regex matching all opening and closing delimiters the mode highlights.") + +;; main function called by jit-lock: +(defun rainbow-delimiters-propertize-region (start end) + "Highlight delimiters in region between START and END. + +Used by jit-lock for dynamic highlighting." + (save-excursion + (goto-char start) + ;; START can be anywhere in buffer; determine the nesting depth at START loc + (let ((depth (rainbow-delimiters-depth start))) + (while (and (< (point) end) + (re-search-forward rainbow-delimiters-delim-regex end t)) + (backward-char) ; re-search-forward places point after delim; go back. + (unless (rainbow-delimiters-char-ineligible-p (point)) + (let ((delim (char-after (point)))) + (cond ((eq ?\( delim) ; ( + (setq depth (1+ depth)) + (rainbow-delimiters-apply-color "paren" depth (point))) + ((eq ?\) delim) ; ) + (rainbow-delimiters-apply-color "paren" depth (point)) + (setq depth (or (and (<= depth 0) 0) ; unmatched paren + (1- depth)))) + ((eq ?\[ delim) ; [ + (setq depth (1+ depth)) + (rainbow-delimiters-apply-color "bracket" depth (point))) + ((eq ?\] delim) ; ] + (rainbow-delimiters-apply-color "bracket" depth (point)) + (setq depth (or (and (<= depth 0) 0) ; unmatched bracket + (1- depth)))) + ((eq ?\{ delim) ; { + (setq depth (1+ depth)) + (rainbow-delimiters-apply-color "brace" depth (point))) + ((eq ?\} delim) ; } + (rainbow-delimiters-apply-color "brace" depth (point)) + (setq depth (or (and (<= depth 0) 0) ; unmatched brace + (1- depth))))))) + ;; move past delimiter so re-search-forward doesn't pick it up again + (forward-char))))) + +(defun rainbow-delimiters-unpropertize-region (start end) + "Remove highlighting from delimiters between START and END." + (save-excursion + (goto-char start) + (while (and (< (point) end) + (re-search-forward rainbow-delimiters-delim-regex end t)) + ;; re-search-forward places point 1 further than the delim matched: + (rainbow-delimiters-unpropertize-delimiter (1- (point)))))) + + +;;; Minor mode: + +;;;###autoload +(define-minor-mode rainbow-delimiters-mode + "Highlight nested parentheses, brackets, and braces according to their depth." + nil "" nil ; No modeline lighter - it's already obvious when the mode is on. + (if (not rainbow-delimiters-mode) + (progn + (jit-lock-unregister 'rainbow-delimiters-propertize-region) + (rainbow-delimiters-unpropertize-region (point-min) (point-max))) + (jit-lock-register 'rainbow-delimiters-propertize-region t) + ;; Create necessary syntax tables inheriting from current major-mode. + (set (make-local-variable 'rainbow-delimiters-all-delimiters-syntax-table) + (rainbow-delimiters-make-syntax-table-all-delimiters (syntax-table))))) + +;;;###autoload +(defun rainbow-delimiters-mode-enable () + (rainbow-delimiters-mode 1)) + +;;;###autoload +(define-globalized-minor-mode global-rainbow-delimiters-mode + rainbow-delimiters-mode rainbow-delimiters-mode-enable) + +(provide 'rainbow-delimiters) + +;;; rainbow-delimiters.el ends here. diff --git a/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters.elc b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters.elc new file mode 100644 index 000000000..0b73c8384 Binary files /dev/null and b/elpa/rainbow-delimiters-1.3.21/rainbow-delimiters.elc differ diff --git a/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-autoloads.el b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-autoloads.el new file mode 100644 index 000000000..4126cd786 --- /dev/null +++ b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-autoloads.el @@ -0,0 +1,61 @@ +;;; rainbow-delimiters-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (global-rainbow-delimiters-mode rainbow-delimiters-mode-disable +;;;;;; rainbow-delimiters-mode-enable rainbow-delimiters-mode) "rainbow-delimiters" +;;;;;; "rainbow-delimiters.el" (21478 16650 0 0)) +;;; Generated autoloads from rainbow-delimiters.el + +(autoload 'rainbow-delimiters-mode "rainbow-delimiters" "\ +Highlight nested parentheses, brackets, and braces according to their depth. + +\(fn &optional ARG)" t nil) + +(autoload 'rainbow-delimiters-mode-enable "rainbow-delimiters" "\ +Enable `rainbow-delimiters-mode'. + +\(fn)" nil nil) + +(autoload 'rainbow-delimiters-mode-disable "rainbow-delimiters" "\ +Disable `rainbow-delimiters-mode'. + +\(fn)" nil nil) + +(defvar global-rainbow-delimiters-mode nil "\ +Non-nil if Global-Rainbow-Delimiters mode is enabled. +See the command `global-rainbow-delimiters-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-rainbow-delimiters-mode'.") + +(custom-autoload 'global-rainbow-delimiters-mode "rainbow-delimiters" nil) + +(autoload 'global-rainbow-delimiters-mode "rainbow-delimiters" "\ +Toggle Rainbow-Delimiters mode in all buffers. +With prefix ARG, enable Global-Rainbow-Delimiters mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Rainbow-Delimiters mode is enabled in all buffers where +`rainbow-delimiters-mode-enable' would do it. +See `rainbow-delimiters-mode' for more information on Rainbow-Delimiters mode. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("rainbow-delimiters-pkg.el") (21478 16650 +;;;;;; 989712 0)) + +;;;*** + +(provide 'rainbow-delimiters-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; rainbow-delimiters-autoloads.el ends here diff --git a/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-pkg.el b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-pkg.el new file mode 100644 index 000000000..1588458e9 --- /dev/null +++ b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-pkg.el @@ -0,0 +1 @@ +(define-package "rainbow-delimiters" "20140713.1131" "Highlight nested parens, brackets, braces a different color at each depth." (quote nil)) diff --git a/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-pkg.elc b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-pkg.elc new file mode 100644 index 000000000..b47d68336 Binary files /dev/null and b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters-pkg.elc differ diff --git a/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters.el b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters.el new file mode 100644 index 000000000..a4ebea764 --- /dev/null +++ b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters.el @@ -0,0 +1,662 @@ +;;; rainbow-delimiters.el --- Highlight nested parens, brackets, braces a different color at each depth. + +;; Copyright (C) 2010-2013 Jeremy Rayman. +;; Author: Jeremy Rayman +;; Maintainer: Jeremy Rayman +;; Created: 2010-09-02 +;; Version: 20140713.1131 +;; X-Original-Version: 1.3.7 +;; Keywords: faces, convenience, lisp, matching, tools, rainbow, rainbow parentheses, rainbow parens +;; EmacsWiki: http://www.emacswiki.org/emacs/RainbowDelimiters +;; Github: http://github.com/jlr/rainbow-delimiters +;; URL: http://github.com/jlr/rainbow-delimiters/raw/master/rainbow-delimiters.el + +;; 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 . + + +;;; Commentary: +;; +;; Rainbow-delimiters is a “rainbow parentheses”-like mode which highlights +;; parentheses, brackets, and braces according to their depth. Each +;; successive level is highlighted in a different color. This makes it easy +;; to spot matching delimiters, orient yourself in the code, and tell which +;; statements are at a given level. +;; +;; Great care has been taken to make this mode FAST. You shouldn't see +;; any discernible change in scrolling or editing speed while using it, +;; even in delimiter-rich languages like Clojure, Lisp, and Scheme. +;; +;; Default colors are subtle, with the philosophy that syntax highlighting +;; shouldn't be visually intrusive. Color schemes are always a matter of +;; taste. If you take the time to design a new color scheme, please share +;; (even a simple list of colors works) on the EmacsWiki page or via github. +;; EmacsWiki: http://www.emacswiki.org/emacs/RainbowDelimiters +;; Github: http://github.com/jlr/rainbow-delimiters + + +;;; Installation: + +;; 1. Place rainbow-delimiters.el on your emacs load-path. +;; +;; 2. Compile the file (necessary for speed): +;; M-x byte-compile-file +;; +;; 3. Add the following to your dot-emacs/init file: +;; (require 'rainbow-delimiters) +;; +;; 4. Activate the mode in your init file. +;; You can choose to enable it only in certain modes, or Emacs-wide: +;; +;; - To enable it only in certain modes, add lines like the following: +;; (add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) +;; +;; - To enable it in all programming-related emacs modes (Emacs 24+): +;; (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) +;; +;; - To activate the mode globally, add to your init file: +;; (global-rainbow-delimiters-mode) +;; +;; - To temporarily activate rainbow-delimiters mode in an open buffer: +;; M-x rainbow-delimiters-mode +;; +;; - To toggle global-rainbow-delimiters-mode: +;; M-x global-rainbow-delimiters-mode + +;;; Customization: + +;; To customize various options, including the color scheme: +;; M-x customize-group rainbow-delimiters +;; +;; deftheme / color-theme.el users: +;; You can specify custom colors by adding the appropriate faces to your theme. +;; - Faces take the form of: +;; 'rainbow-delimiters-depth-#-face' with # being the depth. +;; Depth begins at 1, the outermost color. +;; Faces exist for depths 1-9. +;; - The unmatched delimiter face (normally colored red) is: +;; 'rainbow-delimiters-unmatched-face' + + +;;; Change Log: + +;; 1.0 - Initial release. +;; 1.1 - Stop tracking each delimiter's depth independently. +;; This had lead to confusing results when viewing clojure +;; code. Instead, just color based on current nesting inside +;; all delimiters combined. +;; - Added 'all-delimiters' faces to apply a color scheme to +;; all delimiters at once. Other faces inherit from this group. +;; 1.1.1 - Change color scheme to a lighter, more subtle style. +;; 1.1.2: (2011-03-25) +;; - Add an unmatched-delimiter face and correct problem with +;; coloring of text following unmatched closing delims. +;; 1.2: (2011-03-28) +;; - Unify delimiter faces: all delimiter types now use the same depth +;; faces, of form 'rainbow-delimiters-depth-#-face'. +;; 1.2.1: (2011-03-29) +;; - Conform to ELPA conventions. +;; 1.3: (2011-05-24) +;; - Add separate color schemes for light and dark background modes. +;; - Checkboxes to enable/disable highlighting for each delimiter type. +;; - Improvements to Customize interface. +;; - Infinite depth support by cycling through defined faces repeatedly. +;; - Documentation changes. +;; 1.3.1 (2011-05-25) +;; - Light color theme appears entirely grey on SRGB monitors. Revert to +;; old color theme until a nicer light background theme can be added. +;; - Correct typo in the installation step for users of dark backgrounds. +;; 1.3.2 (2011-10-14) +;; - Add 'global-rainbow-delimiters-mode'. +;; - Respect syntax of current buffer major-mode so delimiters +;; highlight correctly in non-lisp languages. +;; 1.3.3 (2011-11-25) +;; - Backwards compatibility with Emacs versions prior to 23.2. +;; Defines "with-silent-modifications" if undefined. +;; 1.3.4 (2012-04-27) +;; - Further optimize highlighting speed. Benchmarks show 2x improvement. +;; - Color scheme for light backgrounds. +;; - Eliminate bottleneck seen in certain large files. +;; A large file which revealed this bottleneck now highlights ~40x faster. +;; - Correct broken/incorrect highlighting reported in certain languages. + +;;; TODO: + +;; - Add support for independent depth tracking of each delimiter type +;; for users of C-like languages. +;; - Python style - increase depth with each new indentation. +;; - Add support for nested tags (XML, HTML) +;; - Set up proper example defthemes for rainbow-delimiters faces. +;; - Intelligent support for other languages: Ruby, LaTeX tags, et al. + +;;; Issues: + +;; - Rainbow-delimiters mode does not appear to change the color of +;; delimiters when Org-mode is also enabled. + + +;;; Code: + +;; Note: some of the functions in this file have been inlined for speed. +;; Inlining functions can cause problems with debugging. To debug these +;; functions more easily, change defsubst -> defun. +;; http://www.gnu.org/s/emacs/manual/html_node/elisp/Compilation-Tips.html + +;;; Customize interface: + +(defgroup rainbow-delimiters nil + "Highlight nested parentheses, brackets, and braces according to their depth." + :prefix "rainbow-delimiters-" + :link '(url-link :tag "Website for rainbow-delimiters (EmacsWiki)" + "http://www.emacswiki.org/emacs/RainbowDelimiters") + :group 'applications) + +(defgroup rainbow-delimiters-faces nil + "Faces for successively nested pairs of delimiters. + +When depth exceeds innermost defined face, colors cycle back through." + :tag "Color Scheme" + :group 'rainbow-delimiters + :link '(custom-group-link "rainbow-delimiters") + :link '(custom-group-link :tag "Toggle Delimiters" "rainbow-delimiters-toggle-delimiter-highlighting") + :prefix "rainbow-delimiters-") + +;; Choose which delimiters you want to highlight in your preferred language: + +(defgroup rainbow-delimiters-toggle-delimiter-highlighting nil + "Choose which delimiters to highlight." + :tag "Toggle Delimiters" + :group 'rainbow-delimiters + :link '(custom-group-link "rainbow-delimiters") + :link '(custom-group-link :tag "Color Scheme" "rainbow-delimiters-faces")) + +(defcustom rainbow-delimiters-highlight-parens-p t + "Enable highlighting of nested parentheses -- (). + +Non-nil (default) enables highlighting of parentheses. +Nil disables parentheses highlighting." + :tag "Highlight Parentheses?" + :type 'boolean + :group 'rainbow-delimiters-toggle-delimiter-highlighting) + +(defcustom rainbow-delimiters-highlight-brackets-p t + "Enable highlighting of nested brackets -- []. + +Non-nil (default) enables highlighting of brackets. +Nil disables bracket highlighting." + :tag "Highlight Brackets?" + :type 'boolean + :group 'rainbow-delimiters-toggle-delimiter-highlighting) + +(defcustom rainbow-delimiters-highlight-braces-p t + "Enable highlighting of nested braces -- {}. + +Non-nil (default) enables highlighting of braces. +Nil disables brace highlighting." + :tag "Highlight Braces?" + :type 'boolean + :group 'rainbow-delimiters-toggle-delimiter-highlighting) + + +;;; Faces: + +;; Unmatched delimiter face: +(defface rainbow-delimiters-unmatched-face + '((((background light)) (:foreground "#88090B")) + (((background dark)) (:foreground "#88090B"))) + "Face to highlight unmatched closing delimiters in." + :group 'rainbow-delimiters-faces) + +;; Mismatched delimiter face: +(defface rainbow-delimiters-mismatched-face + '((t :inherit rainbow-delimiters-unmatched-face)) + "Face to highlight mismatched closing delimiters in." + :group 'rainbow-delimiters-faces) + +;; Faces for highlighting delimiters by nested level: +(defface rainbow-delimiters-depth-1-face + '((((background light)) (:foreground "#707183")) + (((background dark)) (:foreground "grey55"))) + "Nested delimiters face, depth 1 - outermost set." + :tag "Rainbow Delimiters Depth 1 Face -- OUTERMOST" + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-2-face + '((((background light)) (:foreground "#7388d6")) + (((background dark)) (:foreground "#93a8c6"))) + "Nested delimiters face, depth 2." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-3-face + '((((background light)) (:foreground "#909183")) + (((background dark)) (:foreground "#b0b1a3"))) + "Nested delimiters face, depth 3." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-4-face + '((((background light)) (:foreground "#709870")) + (((background dark)) (:foreground "#97b098"))) + "Nested delimiters face, depth 4." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-5-face + '((((background light)) (:foreground "#907373")) + (((background dark)) (:foreground "#aebed8"))) + "Nested delimiters face, depth 5." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-6-face + '((((background light)) (:foreground "#6276ba")) + (((background dark)) (:foreground "#b0b0b3"))) + "Nested delimiters face, depth 6." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-7-face + '((((background light)) (:foreground "#858580")) + (((background dark)) (:foreground "#90a890"))) + "Nested delimiters face, depth 7." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-8-face + '((((background light)) (:foreground "#80a880")) + (((background dark)) (:foreground "#a2b6da"))) + "Nested delimiters face, depth 8." + :group 'rainbow-delimiters-faces) + +(defface rainbow-delimiters-depth-9-face + '((((background light)) (:foreground "#887070")) + (((background dark)) (:foreground "#9cb6ad"))) + "Nested delimiters face, depth 9." + :group 'rainbow-delimiters-faces) + +;;; Faces 10+: +;; NOTE: Currently unused. Additional faces for depths 9+ can be added on request. + +(defconst rainbow-delimiters-max-face-count 9 + "Number of faces defined for highlighting delimiter levels. + +Determines depth at which to cycle through faces again.") + +(defcustom rainbow-delimiters-outermost-only-face-count 0 + "Number of faces to be used only for N outermost delimiter levels. + +This should be smaller than `rainbow-delimiters-max-face-count'." + :type 'integer + :group 'rainbow-delimiters-faces) + +;;; Face utility functions + +(defsubst rainbow-delimiters-depth-face (depth) + "Return face name for DEPTH as a symbol 'rainbow-delimiters-depth-DEPTH-face'. + +For example: `rainbow-delimiters-depth-1-face'." + (intern-soft + (concat "rainbow-delimiters-depth-" + (number-to-string + (or + ;; Our nesting depth has a face defined for it. + (and (<= depth rainbow-delimiters-max-face-count) + depth) + ;; Deeper than # of defined faces; cycle back through to + ;; `rainbow-delimiters-outermost-only-face-count' + 1. + ;; Return face # that corresponds to current nesting level. + (+ 1 rainbow-delimiters-outermost-only-face-count + (mod (- depth rainbow-delimiters-max-face-count 1) + (- rainbow-delimiters-max-face-count + rainbow-delimiters-outermost-only-face-count))))) + "-face"))) + +;;; Parse partial sexp cache + +;; If the block inside the delimiters is too big (where "too big" is +;; in some way related to `jit-lock-chunk-size'), `syntax-ppss' will +;; for some reason return wrong depth. Is it because we're misusing +;; it? Is it because it's buggy? Nobody knows. But users do notice it, +;; and have reported it as a bug. Hence this workaround: don't use +;; `syntax-ppss' at all, use the low-level primitive instead. However, +;; naively replacing `syntax-ppss' with `parse-partial-sexp' slows +;; down the delimiter highlighting noticeably in big files. Therefore, +;; we build a simple cache around it. This brings the speed to around +;; what it used to be, while fixing the bug. See issue #25. + +(defvar rainbow-delimiters-parse-partial-sexp-cache nil + "Cache of the last `parse-partial-sexp' call. + +It's a list of conses, where car is the position for which `parse-partial-sexp' +was called and cdr is the result of the call. +The list is ordered descending by car.") +(make-variable-buffer-local 'rainbow-delimiters-parse-partial-sexp-cache) + +(defconst rainbow-delimiters-parse-partial-sexp-cache-max-span 20000) + +(defun rainbow-delimiters-syntax-ppss-flush-cache (beg _end) + "Flush the `parse-partial-sexp' cache starting from position BEG." + (let ((it rainbow-delimiters-parse-partial-sexp-cache)) + (while (and it (>= (caar it) beg)) + (setq it (cdr it))) + (setq rainbow-delimiters-parse-partial-sexp-cache it))) + +(defsubst rainbow-delimiters-syntax-ppss-run (from to oldstate cache-nearest-after) + "Run `parse-partial-sexp' from FROM to TO starting with state OLDSTATE. + +CACHE-NEAREST-AFTER should be a list of cache entries starting at the first +entry after TO, or nil if there's no such entry. +Intermediate `parse-partial-sexp' results are added to the cache." + (if (= from to) + (parse-partial-sexp from to nil nil oldstate) + (while (< from to) + (let ((newpos (min to (+ from rainbow-delimiters-parse-partial-sexp-cache-max-span)))) + (let ((state (parse-partial-sexp from newpos nil nil oldstate))) + (if (/= newpos to) + (if cache-nearest-after + (push (cons newpos state) (cdr cache-nearest-after)) + (push (cons newpos state) rainbow-delimiters-parse-partial-sexp-cache))) + (setq oldstate state + from newpos)))) + oldstate)) + +(defsubst rainbow-delimiters-syntax-ppss (pos) + "Parse-Partial-Sexp State at POS, defaulting to point. + +The returned value is the same as that of `parse-partial-sexp' from +`point-min' to POS, except that positions 2 and 6 cannot be relied +upon. + +This is essentialy `syntax-ppss', only specific to rainbow-delimiters +to work around a bug." + (save-excursion + (let ((it rainbow-delimiters-parse-partial-sexp-cache) + (prev nil)) + (while (and it (>= (caar it) pos)) + (setq prev it) + (setq it (cdr it))) + (let* ((nearest-after (if (consp prev) prev nil)) + (nearest-before (if (consp it) (car it) it)) + (nearest-before-pos (if nearest-before (car nearest-before) (point-min))) + (nearest-before-data (if nearest-before (cdr nearest-before) nil))) + (rainbow-delimiters-syntax-ppss-run nearest-before-pos pos nearest-before-data nearest-after))))) + +;;; Nesting level + +(defvar rainbow-delimiters-syntax-table nil + "Syntax table (inherited from `major-mode''s) which uses all delimiters. + +When `rainbow-delimiters-mode' is first activated, it sets this variable and +the other rainbow-delimiters specific syntax tables based on the current +`major-mode'. +The syntax table is constructed by the function +`rainbow-delimiters-make-syntax-table'.") + +;; syntax-table: used with syntax-ppss for determining current depth. +(defun rainbow-delimiters-make-syntax-table (syntax-table) + "Inherit SYNTAX-TABLE and add delimiters intended to be highlighted by mode." + (let ((table (copy-syntax-table syntax-table))) + (modify-syntax-entry ?\( "() " table) + (modify-syntax-entry ?\) ")( " table) + (modify-syntax-entry ?\[ "(]" table) + (modify-syntax-entry ?\] ")[" table) + (modify-syntax-entry ?\{ "(}" table) + (modify-syntax-entry ?\} "){" table) + table)) + +(defsubst rainbow-delimiters-depth (loc) + "Return # of nested levels of parens, brackets, braces LOC is inside of." + (let ((depth (car (rainbow-delimiters-syntax-ppss loc)))) + (if (>= depth 0) + depth + 0))) ; ignore negative depths created by unmatched closing parens. + + +;;; Text properties + +;; Backwards compatibility: Emacs < v23.2 lack macro 'with-silent-modifications'. +(eval-and-compile + (unless (fboundp 'with-silent-modifications) + (defmacro with-silent-modifications (&rest body) + "Defined by rainbow-delimiters.el for backwards compatibility with Emacs < 23.2. + Execute BODY, pretending it does not modify the buffer. +If BODY performs real modifications to the buffer's text, other +than cosmetic ones, undo data may become corrupted. + +This macro will run BODY normally, but doesn't count its buffer +modifications as being buffer modifications. This affects things +like buffer-modified-p, checking whether the file is locked by +someone else, running buffer modification hooks, and other things +of that nature. + +Typically used around modifications of text-properties which do +not really affect the buffer's content." + (declare (debug t) (indent 0)) + (let ((modified (make-symbol "modified"))) + `(let* ((,modified (buffer-modified-p)) + (buffer-undo-list t) + (inhibit-read-only t) + (inhibit-modification-hooks t) + deactivate-mark + ;; Avoid setting and removing file locks and checking + ;; buffer's uptodate-ness w.r.t the underlying file. + buffer-file-name + buffer-file-truename) + (unwind-protect + (progn + ,@body) + (unless ,modified + (restore-buffer-modified-p nil)))))))) + +(defsubst rainbow-delimiters-propertize-delimiter (loc depth match) + "Highlight a single delimiter at LOC according to DEPTH. + +LOC is the location of the character to add text properties to. +DEPTH is the nested depth at LOC, which determines the face to use. +MATCH is nil iff it's a mismatched closing delimiter. + +Sets text properties: +`font-lock-face' to the appropriate delimiter face. +`rear-nonsticky' to prevent color from bleeding into subsequent characters typed by the user." + (let ((delim-face (cond + ((<= depth 0) + 'rainbow-delimiters-unmatched-face) + ((not match) + 'rainbow-delimiters-mismatched-face) + (t + (rainbow-delimiters-depth-face depth))))) + ;; (when (eq depth -1) (message "Unmatched delimiter at char %s." loc)) + (add-text-properties loc (1+ loc) + `(font-lock-face ,delim-face + rear-nonsticky t)))) + + +(defsubst rainbow-delimiters-unpropertize-delimiter (loc) + "Remove text properties set by rainbow-delimiters mode from char at LOC." + (remove-text-properties loc (1+ loc) + '(font-lock-face nil + rear-nonsticky nil))) + +(defvar rainbow-delimiters-escaped-char-predicate nil) +(make-variable-buffer-local 'rainbow-delimiters-escaped-char-predicate) + +(defvar rainbow-delimiters-escaped-char-predicate-list + '((emacs-lisp-mode . rainbow-delimiters-escaped-char-predicate-emacs-lisp) + (lisp-interaction-mode . rainbow-delimiters-escaped-char-predicate-emacs-lisp) + (inferior-emacs-lisp-mode . rainbow-delimiters-escaped-char-predicate-emacs-lisp) + (lisp-mode . rainbow-delimiters-escaped-char-predicate-lisp) + (scheme-mode . rainbow-delimiters-escaped-char-predicate-lisp) + (clojure-mode . rainbow-delimiters-escaped-char-predicate-lisp) + (inferior-scheme-mode . rainbow-delimiters-escaped-char-predicate-lisp) + )) + +(defun rainbow-delimiters-escaped-char-predicate-emacs-lisp (loc) + "Non-nil iff the character at LOC is escaped as per Emacs Lisp rules." + (or (and (eq (char-before loc) ?\?) ; e.g. ?) - deprecated, but people use it + (not (and (eq (char-before (1- loc)) ?\\) ; special case: ignore ?\? + (eq (char-before (- loc 2)) ?\?)))) + (and (eq (char-before loc) ?\\) ; escaped char, e.g. ?\) - not counted + (eq (char-before (1- loc)) ?\?)))) + +(defun rainbow-delimiters-escaped-char-predicate-lisp (loc) + "Non-nil iff the character at LOC is escaped as per some generic Lisp rules." + (eq (char-before loc) ?\\)) + +(defsubst rainbow-delimiters-char-ineligible-p (loc ppss) + "Return t if char at LOC should be skipped, e.g. if inside a comment. +PPSS should be the `parse-partial-sexp' state at LOC. + +Returns t if char at loc meets one of the following conditions: +- Inside a string. +- Inside a comment. +- Is an escaped char, e.g. ?\)" + (or + (nth 3 ppss) ; inside string? + (nth 4 ppss) ; inside comment? + (and rainbow-delimiters-escaped-char-predicate + (funcall rainbow-delimiters-escaped-char-predicate loc)))) + + +(defsubst rainbow-delimiters-apply-color (delim depth loc match) + "Apply color for DEPTH to DELIM at LOC following user settings. + +DELIM is a string specifying delimiter type. +DEPTH is the delimiter depth, or corresponding face # if colors are repeating. +LOC is location of character (delimiter) to be colorized. +MATCH is nil iff it's a mismatched closing delimiter." + (and + ;; Ensure user has enabled highlighting of this delimiter type. + (symbol-value (intern-soft + (concat "rainbow-delimiters-highlight-" delim "s-p"))) + (rainbow-delimiters-propertize-delimiter loc + depth + match))) + + +;;; JIT-Lock functionality + +;; Used to skip delimiter-by-delimiter `rainbow-delimiters-propertize-region'. +(defconst rainbow-delimiters-delim-regex "\\(\(\\|\)\\|\\[\\|\\]\\|\{\\|\}\\)" + "Regex matching all opening and closing delimiters the mode highlights.") + +(defconst rainbow-delimiters-opening-delim-info + '((?\( . "paren") (?\{ . "brace") (?\[ . "bracket")) + "Open delimiter information: list of (DELIMITER . TYPE). + +DELIMITER is the opening delimiter. +TYPE is the delimiter type string for `rainbow-delimiters-apply-color'.") + +(defconst rainbow-delimiters-closing-delim-info + '((?\) ?\( . "paren") (?\} ?\{ . "brace") (?\] ?\[ . "bracket")) + "Closing delimiter information: list of (DELIMITER OPENING . TYPE). + +DELIMITER is the closing delimiter. +OPENING is the corresponding opening delimiter. +TYPE is the delimiter type string for `rainbow-delimiters-apply-color'.") + +;; main function called by jit-lock: +(defsubst rainbow-delimiters-propertize-region (start end) + "Highlight delimiters in region between START and END. + +Used by jit-lock for dynamic highlighting." + (setq rainbow-delimiters-escaped-char-predicate + (cdr (assoc major-mode rainbow-delimiters-escaped-char-predicate-list))) + (save-excursion + (with-syntax-table rainbow-delimiters-syntax-table + (with-silent-modifications + (let ((inhibit-point-motion-hooks t)) + (goto-char start) + ;; START can be anywhere in buffer; determine the nesting depth at START loc + (let ((depth (rainbow-delimiters-depth start))) + (while (and (< (point) end) + (re-search-forward rainbow-delimiters-delim-regex end t)) + (backward-char) ; re-search-forward places point after delim; go back. + (let ((ppss (rainbow-delimiters-syntax-ppss (point)))) + (unless (rainbow-delimiters-char-ineligible-p (point) ppss) + (let* ((delim (char-after (point))) + (opening-delim-info + (assq delim rainbow-delimiters-opening-delim-info))) + (if opening-delim-info + (progn + (setq depth (1+ depth)) + (rainbow-delimiters-apply-color (cdr opening-delim-info) + depth + (point) + t)) + ;; Not an opening delimiters, so it's a closing delimiter. + (let ((closing-delim-info + (assq delim rainbow-delimiters-closing-delim-info)) + (matching-opening-delim (char-after (nth 1 ppss)))) + (rainbow-delimiters-apply-color (nthcdr 2 closing-delim-info) + depth + (point) + (= (nth 1 closing-delim-info) + matching-opening-delim)) + (setq depth (or (and (<= depth 0) 0) ; unmatched delim + (1- depth)))))))) + ;; move past delimiter so re-search-forward doesn't pick it up again + (forward-char)))))))) + +(defun rainbow-delimiters-unpropertize-region (start end) + "Remove highlighting from delimiters between START and END." + (save-excursion + (with-silent-modifications + (let ((inhibit-point-motion-hooks t)) + (goto-char start) + (while (and (< (point) end) + (re-search-forward rainbow-delimiters-delim-regex end t)) + ;; re-search-forward places point 1 further than the delim matched: + (rainbow-delimiters-unpropertize-delimiter (1- (point)))))))) + + +;;; Minor mode: + +(defun rainbow-delimiters-mode-turn-on () + "Set up `rainbow-delimiters-mode'." + ;; Flush the ppss cache now in case there's something left in there. + (setq rainbow-delimiters-parse-partial-sexp-cache nil) + (add-hook 'before-change-functions 'rainbow-delimiters-syntax-ppss-flush-cache t t) + (add-hook 'change-major-mode-hook 'rainbow-delimiters-mode-turn-off nil t) + (jit-lock-register 'rainbow-delimiters-propertize-region t) + ;; Create necessary syntax tables inheriting from current major-mode. + (set (make-local-variable 'rainbow-delimiters-syntax-table) + (rainbow-delimiters-make-syntax-table (syntax-table)))) + +(defun rainbow-delimiters-mode-turn-off () + "Tear down `rainbow-delimiters-mode'." + (kill-local-variable 'rainbow-delimiters-syntax-table) + (rainbow-delimiters-unpropertize-region (point-min) (point-max)) + (jit-lock-unregister 'rainbow-delimiters-propertize-region) + (remove-hook 'change-major-mode-hook 'rainbow-delimiters-mode-turn-off t) + (remove-hook 'before-change-functions 'rainbow-delimiters-syntax-ppss-flush-cache t)) + +;;;###autoload +(define-minor-mode rainbow-delimiters-mode + "Highlight nested parentheses, brackets, and braces according to their depth." + nil "" nil ; No modeline lighter - it's already obvious when the mode is on. + (if rainbow-delimiters-mode + (rainbow-delimiters-mode-turn-on) + (rainbow-delimiters-mode-turn-off))) + +;;;###autoload +(defun rainbow-delimiters-mode-enable () + "Enable `rainbow-delimiters-mode'." + (rainbow-delimiters-mode 1)) + +;;;###autoload +(defun rainbow-delimiters-mode-disable () + "Disable `rainbow-delimiters-mode'." + (rainbow-delimiters-mode 0)) + +;;;###autoload +(define-globalized-minor-mode global-rainbow-delimiters-mode + rainbow-delimiters-mode rainbow-delimiters-mode-enable) + +(provide 'rainbow-delimiters) + +;;; rainbow-delimiters.el ends here diff --git a/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters.elc b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters.elc new file mode 100644 index 000000000..084f64442 Binary files /dev/null and b/elpa/rainbow-delimiters-20140713.1131/rainbow-delimiters.elc differ diff --git a/elpa/s-20140714.707/s-autoloads.el b/elpa/s-20140714.707/s-autoloads.el new file mode 100644 index 000000000..6dc1589a6 --- /dev/null +++ b/elpa/s-20140714.707/s-autoloads.el @@ -0,0 +1,18 @@ +;;; s-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("s-pkg.el" "s.el") (21478 16648 636949 +;;;;;; 0)) + +;;;*** + +(provide 's-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; s-autoloads.el ends here diff --git a/elpa/s-20140714.707/s-pkg.el b/elpa/s-20140714.707/s-pkg.el new file mode 100644 index 000000000..d57e7862c --- /dev/null +++ b/elpa/s-20140714.707/s-pkg.el @@ -0,0 +1 @@ +(define-package "s" "20140714.707" "The long lost Emacs string manipulation library." (quote nil)) diff --git a/elpa/s-20140714.707/s-pkg.elc b/elpa/s-20140714.707/s-pkg.elc new file mode 100644 index 000000000..f7dae5fed Binary files /dev/null and b/elpa/s-20140714.707/s-pkg.elc differ diff --git a/elpa/s-20140714.707/s.el b/elpa/s-20140714.707/s.el new file mode 100644 index 000000000..414648023 --- /dev/null +++ b/elpa/s-20140714.707/s.el @@ -0,0 +1,597 @@ +;;; s.el --- The long lost Emacs string manipulation library. + +;; Copyright (C) 2012 Magnar Sveen + +;; Author: Magnar Sveen +;; Version: 20140714.707 +;; X-Original-Version: 1.9.0 +;; Keywords: strings + +;; 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 . + +;;; Commentary: + +;; The long lost Emacs string manipulation library. +;; +;; See documentation on https://github.com/magnars/s.el#functions + +;;; Code: + +(require 'ucs-normalize) + +(defun s-trim-left (s) + "Remove whitespace at the beginning of S." + (if (string-match "\\`[ \t\n\r]+" s) + (replace-match "" t t s) + s)) + +(defun s-trim-right (s) + "Remove whitespace at the end of S." + (if (string-match "[ \t\n\r]+\\'" s) + (replace-match "" t t s) + s)) + +(defun s-trim (s) + "Remove whitespace at the beginning and end of S." + (s-trim-left (s-trim-right s))) + +(defun s-collapse-whitespace (s) + "Convert all adjacent whitespace characters to a single space." + (replace-regexp-in-string "[ \t\n\r]+" " " s)) + +(defun s-split (separator s &optional omit-nulls) + "Split S into substrings bounded by matches for regexp SEPARATOR. +If OMIT-NULLS is non-nil, zero-length substrings are omitted. + +This is a simple wrapper around the built-in `split-string'." + (split-string s separator omit-nulls)) + +(defun s-split-up-to (separator s n &optional omit-nulls) + "Split S up to N times into substrings bounded by matches for regexp SEPARATOR. + +If OMIT-NULLS is non-nil, zero-length substrings are omitted. + +See also `s-split'." + (save-match-data + (let ((op 0) + (r nil)) + (with-temp-buffer + (insert s) + (setq op (goto-char (point-min))) + (while (and (re-search-forward separator nil t) + (< 0 n)) + (let ((sub (buffer-substring-no-properties op (match-beginning 0)))) + (unless (and omit-nulls + (equal sub "")) + (push sub r))) + (setq op (goto-char (match-end 0))) + (setq n (1- n))) + (if (/= (point) (point-max)) + (push (buffer-substring-no-properties op (point-max)) r) + (unless omit-nulls + (push "" r)))) + (nreverse r)))) + +(defun s-lines (s) + "Splits S into a list of strings on newline characters." + (s-split "\\(\r\n\\|[\n\r]\\)" s)) + +(defun s-join (separator strings) + "Join all the strings in STRINGS with SEPARATOR in between." + (mapconcat 'identity strings separator)) + +(defun s-concat (&rest strings) + "Join all the string arguments into one string." + (apply 'concat strings)) + +(defun s-prepend (prefix s) + "Concatenate PREFIX and S." + (concat prefix s)) + +(defun s-append (suffix s) + "Concatenate S and SUFFIX." + (concat s suffix)) + +(defun s-repeat (num s) + "Make a string of S repeated NUM times." + (let (ss) + (while (> num 0) + (setq ss (cons s ss)) + (setq num (1- num))) + (apply 'concat ss))) + +(defun s-chop-suffix (suffix s) + "Remove SUFFIX if it is at end of S." + (let ((pos (- (length suffix)))) + (if (and (>= (length s) (length suffix)) + (string= suffix (substring s pos))) + (substring s 0 pos) + s))) + +(defun s-chop-suffixes (suffixes s) + "Remove SUFFIXES one by one in order, if they are at the end of S." + (while suffixes + (setq s (s-chop-suffix (car suffixes) s)) + (setq suffixes (cdr suffixes))) + s) + +(defun s-chop-prefix (prefix s) + "Remove PREFIX if it is at the start of S." + (let ((pos (length prefix))) + (if (and (>= (length s) (length prefix)) + (string= prefix (substring s 0 pos))) + (substring s pos) + s))) + +(defun s-chop-prefixes (prefixes s) + "Remove PREFIXES one by one in order, if they are at the start of S." + (while prefixes + (setq s (s-chop-prefix (car prefixes) s)) + (setq prefixes (cdr prefixes))) + s) + +(defun s-shared-start (s1 s2) + "Returns the longest prefix S1 and S2 have in common." + (let ((search-length (min (length s1) (length s2))) + (i 0)) + (while (and (< i search-length) + (= (aref s1 i) (aref s2 i))) + (setq i (1+ i))) + (substring s1 0 i))) + +(defun s-shared-end (s1 s2) + "Returns the longest suffix S1 and S2 have in common." + (let* ((l1 (length s1)) + (l2 (length s2)) + (search-length (min l1 l2)) + (i 0)) + (while (and (< i search-length) + (= (aref s1 (- l1 i 1)) (aref s2 (- l2 i 1)))) + (setq i (1+ i))) + ;; If I is 0, then it means that there's no common suffix between + ;; S1 and S2. + ;; + ;; However, since (substring s (- 0)) will return the whole + ;; string, `s-shared-end' should simply return the empty string + ;; when I is 0. + (if (zerop i) + "" + (substring s1 (- i))))) + +(defun s-chomp (s) + "Remove one trailing `\\n`, `\\r` or `\\r\\n` from S." + (s-chop-suffixes '("\n" "\r") s)) + +(defun s-truncate (len s) + "If S is longer than LEN, cut it down to LEN - 3 and add ... at the end." + (if (> (length s) len) + (format "%s..." (substring s 0 (- len 3))) + s)) + +(defun s-word-wrap (len s) + "If S is longer than LEN, wrap the words with newlines." + (with-temp-buffer + (insert s) + (let ((fill-column len)) + (fill-region (point-min) (point-max))) + (buffer-substring-no-properties (point-min) (point-max)))) + +(defun s-center (len s) + "If S is shorter than LEN, pad it with spaces so it is centered." + (let ((extra (max 0 (- len (length s))))) + (concat + (make-string (ceiling extra 2) ? ) + s + (make-string (floor extra 2) ? )))) + +(defun s-pad-left (len padding s) + "If S is shorter than LEN, pad it with PADDING on the left." + (let ((extra (max 0 (- len (length s))))) + (concat (make-string extra (string-to-char padding)) + s))) + +(defun s-pad-right (len padding s) + "If S is shorter than LEN, pad it with PADDING on the right." + (let ((extra (max 0 (- len (length s))))) + (concat s + (make-string extra (string-to-char padding))))) + +(defun s-left (len s) + "Returns up to the LEN first chars of S." + (if (> (length s) len) + (substring s 0 len) + s)) + +(defun s-right (len s) + "Returns up to the LEN last chars of S." + (let ((l (length s))) + (if (> l len) + (substring s (- l len) l) + s))) + +(defun s-ends-with? (suffix s &optional ignore-case) + "Does S end with SUFFIX? + +If IGNORE-CASE is non-nil, the comparison is done without paying +attention to case differences. + +Alias: `s-suffix?'" + (let ((start-pos (- (length s) (length suffix)))) + (and (>= start-pos 0) + (eq t (compare-strings suffix nil nil + s start-pos nil ignore-case))))) + +(defalias 's-ends-with-p 's-ends-with?) + +(defun s-starts-with? (prefix s &optional ignore-case) + "Does S start with PREFIX? + +If IGNORE-CASE is non-nil, the comparison is done without paying +attention to case differences. + +Alias: `s-prefix?'. This is a simple wrapper around the built-in +`string-prefix-p'." + (string-prefix-p prefix s ignore-case)) + +(defalias 's-starts-with-p 's-starts-with?) + +(defalias 's-suffix? 's-ends-with?) +(defalias 's-prefix? 's-starts-with?) +(defalias 's-suffix-p 's-ends-with?) +(defalias 's-prefix-p 's-starts-with?) + +(defun s--truthy? (val) + (not (null val))) + +(defun s-contains? (needle s &optional ignore-case) + "Does S contain NEEDLE? + +If IGNORE-CASE is non-nil, the comparison is done without paying +attention to case differences." + (let ((case-fold-search ignore-case)) + (s--truthy? (string-match-p (regexp-quote needle) s)))) + +(defalias 's-contains-p 's-contains?) + +(defun s-equals? (s1 s2) + "Is S1 equal to S2? + +This is a simple wrapper around the built-in `string-equal'." + (string-equal s1 s2)) + +(defalias 's-equals-p 's-equals?) + +(defun s-less? (s1 s2) + "Is S1 less than S2? + +This is a simple wrapper around the built-in `string-lessp'." + (string-lessp s1 s2)) + +(defalias 's-less-p 's-less?) + +(defun s-matches? (regexp s &optional start) + "Does REGEXP match S? +If START is non-nil the search starts at that index. + +This is a simple wrapper around the built-in `string-match-p'." + (s--truthy? (string-match-p regexp s start))) + +(defalias 's-matches-p 's-matches?) + +(defun s-blank? (s) + "Is S nil or the empty string?" + (or (null s) (string= "" s))) + +(defun s-present? (s) + "Is S anything but nil or the empty string?" + (not (s-blank? s))) + +(defun s-presence (s) + "Return S if it's `s-present?', otherwise return nil." + (and (s-present? s) s)) + +(defun s-lowercase? (s) + "Are all the letters in S in lower case?" + (let ((case-fold-search nil)) + (not (string-match-p "[[:upper:]]" s)))) + +(defun s-uppercase? (s) + "Are all the letters in S in upper case?" + (let ((case-fold-search nil)) + (not (string-match-p "[[:lower:]]" s)))) + +(defun s-mixedcase? (s) + "Are there both lower case and upper case letters in S?" + (let ((case-fold-search nil)) + (s--truthy? + (and (string-match-p "[[:lower:]]" s) + (string-match-p "[[:upper:]]" s))))) + +(defun s-capitalized? (s) + "In S, is the first letter upper case, and all other letters lower case?" + (let ((case-fold-search nil)) + (s--truthy? + (string-match-p "^[[:upper:]][^[:upper:]]*$" s)))) + +(defun s-numeric? (s) + "Is S a number?" + (s--truthy? + (string-match-p "^[0-9]+$" s))) + +(defun s-replace (old new s) + "Replaces OLD with NEW in S." + (replace-regexp-in-string (regexp-quote old) new s t t)) + +(defun s--aget (alist key) + (cdr (assoc key alist))) + +(defun s-replace-all (replacements s) + "REPLACEMENTS is a list of cons-cells. Each `car` is replaced with `cdr` in S." + (replace-regexp-in-string (regexp-opt (mapcar 'car replacements)) + (lambda (it) (s--aget replacements it)) + s)) + +(defun s-downcase (s) + "Convert S to lower case. + +This is a simple wrapper around the built-in `downcase'." + (downcase s)) + +(defun s-upcase (s) + "Convert S to upper case. + +This is a simple wrapper around the built-in `upcase'." + (upcase s)) + +(defun s-capitalize (s) + "Convert the first word's first character to upper case and the rest to lower case in S." + (concat (upcase (substring s 0 1)) (downcase (substring s 1)))) + +(defun s-titleize (s) + "Convert each word's first character to upper case and the rest to lower case in S. + +This is a simple wrapper around the built-in `capitalize'." + (capitalize s)) + +(defmacro s-with (s form &rest more) + "Threads S through the forms. Inserts S as the last item +in the first form, making a list of it if it is not a list +already. If there are more forms, inserts the first form as the +last item in second form, etc." + (declare (debug (form &rest [&or (function &rest form) fboundp]))) + (if (null more) + (if (listp form) + `(,(car form) ,@(cdr form) ,s) + (list form s)) + `(s-with (s-with ,s ,form) ,@more))) + +(put 's-with 'lisp-indent-function 1) + +(defun s-index-of (needle s &optional ignore-case) + "Returns first index of NEEDLE in S, or nil. + +If IGNORE-CASE is non-nil, the comparison is done without paying +attention to case differences." + (let ((case-fold-search ignore-case)) + (string-match-p (regexp-quote needle) s))) + +(defun s-reverse (s) + "Return the reverse of S." + (if (multibyte-string-p s) + (let ((input (string-to-list s)) + (output ())) + (while input + ;; Handle entire grapheme cluster as a single unit + (let ((grapheme (list (pop input)))) + (while (memql (car input) ucs-normalize-combining-chars) + (push (pop input) grapheme)) + (setq output (nconc (nreverse grapheme) output)))) + (concat output)) + (concat (nreverse (string-to-list s))))) + +(defun s-match-strings-all (regex string) + "Return a list of matches for REGEX in STRING. + +Each element itself is a list of matches, as per +`match-string'. Multiple matches at the same position will be +ignored after the first." + (let ((all-strings ()) + (i 0)) + (while (and (< i (length string)) + (string-match regex string i)) + (setq i (1+ (match-beginning 0))) + (let (strings + (num-matches (/ (length (match-data)) 2)) + (match 0)) + (while (/= match num-matches) + (push (match-string match string) strings) + (setq match (1+ match))) + (push (nreverse strings) all-strings))) + (nreverse all-strings))) + +(defun s-match (regexp s &optional start) + "When the given expression matches the string, this function returns a list +of the whole matching string and a string for each matched subexpressions. +If it did not match the returned value is an empty list (nil). + +When START is non-nil the search will start at that index." + (save-match-data + (if (string-match regexp s start) + (let ((match-data-list (match-data)) + result) + (while match-data-list + (let* ((beg (car match-data-list)) + (end (cadr match-data-list)) + (subs (if (and beg end) (substring s beg end) nil))) + (setq result (cons subs result)) + (setq match-data-list + (cddr match-data-list)))) + (nreverse result))))) + +(defun s-slice-at (regexp s) + "Slices S up at every index matching REGEXP." + (save-match-data + (let (i) + (setq i (string-match regexp s 1)) + (if i + (cons (substring s 0 i) + (s-slice-at regexp (substring s i))) + (list s))))) + +(defun s-split-words (s) + "Split S into list of words." + (s-split + "[^[:word:]0-9]+" + (let ((case-fold-search nil)) + (replace-regexp-in-string + "\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2" + (replace-regexp-in-string "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)" "\\1 \\2" s))) + t)) + +(defun s--mapcar-head (fn-head fn-rest list) + "Like MAPCAR, but applies a different function to the first element." + (if list + (cons (funcall fn-head (car list)) (mapcar fn-rest (cdr list))))) + +(defun s-lower-camel-case (s) + "Convert S to lowerCamelCase." + (s-join "" (s--mapcar-head 'downcase 'capitalize (s-split-words s)))) + +(defun s-upper-camel-case (s) + "Convert S to UpperCamelCase." + (s-join "" (mapcar 'capitalize (s-split-words s)))) + +(defun s-snake-case (s) + "Convert S to snake_case." + (s-join "_" (mapcar 'downcase (s-split-words s)))) + +(defun s-dashed-words (s) + "Convert S to dashed-words." + (s-join "-" (mapcar 'downcase (s-split-words s)))) + +(defun s-capitalized-words (s) + "Convert S to Capitalized words." + (let ((words (s-split-words s))) + (s-join " " (cons (capitalize (car words)) (mapcar 'downcase (cdr words)))))) + +(defun s-titleized-words (s) + "Convert S to Titleized Words." + (s-join " " (mapcar 's-titleize (s-split-words s)))) + +(defun s-word-initials (s) + "Convert S to its initials." + (s-join "" (mapcar (lambda (ss) (substring ss 0 1)) + (s-split-words s)))) + +;; Errors for s-format +(progn + (put 's-format-resolve + 'error-conditions + '(error s-format s-format-resolve)) + (put 's-format-resolve + 'error-message + "Cannot resolve a template to values")) + +(defun s-format (template replacer &optional extra) + "Format TEMPLATE with the function REPLACER. + +REPLACER takes an argument of the format variable and optionally +an extra argument which is the EXTRA value from the call to +`s-format'. + +Several standard `s-format' helper functions are recognized and +adapted for this: + + (s-format \"${name}\" 'gethash hash-table) + (s-format \"${name}\" 'aget alist) + (s-format \"$0\" 'elt sequence) + +The REPLACER function may be used to do any other kind of +transformation." + (let ((saved-match-data (match-data))) + (unwind-protect + (replace-regexp-in-string + "\\$\\({\\([^}]+\\)}\\|[0-9]+\\)" + (lambda (md) + (let ((var + (let ((m (match-string 2 md))) + (if m m + (string-to-number (match-string 1 md))))) + (replacer-match-data (match-data))) + (unwind-protect + (let ((v + (cond + ((eq replacer 'gethash) + (funcall replacer var extra)) + ((eq replacer 'aget) + (funcall 's--aget extra var)) + ((eq replacer 'elt) + (funcall replacer extra var)) + (t + (set-match-data saved-match-data) + (if extra + (funcall replacer var extra) + (funcall replacer var)))))) + (if v v (signal 's-format-resolve md))) + (set-match-data replacer-match-data)))) template + ;; Need literal to make sure it works + t t) + (set-match-data saved-match-data)))) + +(defvar s-lex-value-as-lisp nil + "If `t' interpolate lisp values as lisp. + +`s-lex-format' inserts values with (format \"%S\").") + +(defun s-lex-fmt|expand (fmt) + "Expand FMT into lisp." + (list 's-format fmt (quote 'aget) + (append '(list) + (mapcar + (lambda (matches) + (list + 'cons + (cadr matches) + `(format + (if s-lex-value-as-lisp "%S" "%s") + ,(intern (cadr matches))))) + (s-match-strings-all "${\\([^}]+\\)}" fmt))))) + +(defmacro s-lex-format (format-str) + "`s-format` with the current environment. + +FORMAT-STR may use the `s-format' variable reference to refer to +any variable: + + (let ((x 1)) + (s-lex-format \"x is: ${x}\")) + +The values of the variables are interpolated with \"%s\" unless +the variable `s-lex-value-as-lisp' is `t' and then they are +interpolated with \"%S\"." + (declare (debug (form))) + (s-lex-fmt|expand format-str)) + +(defun s-count-matches (regexp s &optional start end) + "Count occurrences of `regexp' in `s'. + +`start', inclusive, and `end', exclusive, delimit the part of `s' +to match. " + (with-temp-buffer + (insert s) + (goto-char (point-min)) + (count-matches regexp (or start 1) (or end (point-max))))) + +(provide 's) +;;; s.el ends here diff --git a/elpa/s-20140714.707/s.elc b/elpa/s-20140714.707/s.elc new file mode 100644 index 000000000..05f4dcced Binary files /dev/null and b/elpa/s-20140714.707/s.elc differ diff --git a/elpa/smex-20140425.1314/smex-autoloads.el b/elpa/smex-20140425.1314/smex-autoloads.el new file mode 100644 index 000000000..59dca4fc7 --- /dev/null +++ b/elpa/smex-20140425.1314/smex-autoloads.el @@ -0,0 +1,38 @@ +;;; smex-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (smex-initialize smex-major-mode-commands smex) +;;;;;; "smex" "smex.el" (21478 16647 0 0)) +;;; Generated autoloads from smex.el + +(autoload 'smex "smex" "\ + + +\(fn)" t nil) + +(autoload 'smex-major-mode-commands "smex" "\ +Like `smex', but limited to commands that are relevant to the active major mode. + +\(fn)" t nil) + +(autoload 'smex-initialize "smex" "\ + + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("smex-pkg.el") (21478 16647 270867 0)) + +;;;*** + +(provide 'smex-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; smex-autoloads.el ends here diff --git a/elpa/smex-20140425.1314/smex-pkg.el b/elpa/smex-20140425.1314/smex-pkg.el new file mode 100644 index 000000000..ecf6975dd --- /dev/null +++ b/elpa/smex-20140425.1314/smex-pkg.el @@ -0,0 +1 @@ +(define-package "smex" "20140425.1314" "M-x interface with Ido-style fuzzy matching." (quote ((emacs "24")))) diff --git a/elpa/smex-20140425.1314/smex-pkg.elc b/elpa/smex-20140425.1314/smex-pkg.elc new file mode 100644 index 000000000..b7bc2327f Binary files /dev/null and b/elpa/smex-20140425.1314/smex-pkg.elc differ diff --git a/elpa/smex-20140425.1314/smex.el b/elpa/smex-20140425.1314/smex.el new file mode 100644 index 000000000..1cbbcd58c --- /dev/null +++ b/elpa/smex-20140425.1314/smex.el @@ -0,0 +1,459 @@ +;;; smex.el --- M-x interface with Ido-style fuzzy matching. + +;; Copyright (C) 2009-2014 Cornelius Mika and contributors +;; +;; Author: Cornelius Mika and contributors +;; URL: http://github.com/nonsequitur/smex/ +;; Package-Requires: ((emacs "24")) +;; Version: 20140425.1314 +;; X-Original-Version: 3.0 +;; Keywords: convenience, usability + +;; This file is not part of GNU Emacs. + +;;; License: + +;; Licensed under the same terms as Emacs. + +;;; Commentary: + +;; Quick start: +;; run (smex-initialize) +;; +;; Bind the following commands: +;; smex, smex-major-mode-commands +;; +;; For a detailed introduction see: +;; http://github.com/nonsequitur/smex/blob/master/README.markdown + +;;; Code: + +(require 'ido) + +(defgroup smex nil + "M-x interface with Ido-style fuzzy matching and ranking heuristics." + :group 'extensions + :group 'convenience + :link '(emacs-library-link :tag "Lisp File" "smex.el")) + +(defcustom smex-auto-update t + "If non-nil, `Smex' checks for new commands each time it is run. +Turn it off for minor speed improvements on older systems." + :type 'boolean + :group 'smex) + +(defcustom smex-save-file "~/.smex-items" + "File in which the smex state is saved between Emacs sessions. +Variables stored are: `smex-data', `smex-history'. +Must be set before initializing Smex." + :type 'string + :group 'smex) + +(defcustom smex-history-length 7 + "Determines on how many recently executed commands +Smex should keep a record. +Must be set before initializing Smex." + :type 'integer + :group 'smex) + +(defcustom smex-prompt-string "M-x " + "String to display in the Smex prompt." + :type 'string + :group 'smex) + +(defcustom smex-flex-matching t + "Enables Ido flex matching. On by default. +Set this to nil to disable fuzzy matching." + :type 'boolean + :group 'smex) + +(defvar smex-initialized-p nil) +(defvar smex-cache) +(defvar smex-ido-cache) +(defvar smex-data) +(defvar smex-history) +(defvar smex-command-count 0) +(defvar smex-custom-action nil) + +;; Check if Smex is supported +(when (equal (cons 1 1) + (ignore-errors + (subr-arity (symbol-function 'execute-extended-command)))) + (error "Your Emacs has a non-elisp version of `execute-extended-command', which is incompatible with Smex")) + +;;-------------------------------------------------------------------------------- +;; Smex Interface + +;;;###autoload +(defun smex () + (interactive) + (unless smex-initialized-p + (smex-initialize)) + (if (smex-already-running) + (smex-update-and-rerun) + (and smex-auto-update + (smex-detect-new-commands) + (smex-update)) + (smex-read-and-run smex-ido-cache))) + +(defsubst smex-already-running () + (and (boundp 'ido-choice-list) + (eql ido-choice-list smex-ido-cache) + (minibuffer-window-active-p (selected-window)))) + +(defsubst smex-update-and-rerun () + (smex-do-with-selected-item + (lambda (ignore) (smex-update) (smex-read-and-run smex-ido-cache ido-text)))) + +(defun smex-read-and-run (commands &optional initial-input) + (let* ((chosen-item-name (smex-completing-read commands initial-input)) + (chosen-item (intern chosen-item-name))) + (if smex-custom-action + (let ((action smex-custom-action)) + (setq smex-custom-action nil) + (funcall action chosen-item)) + (unwind-protect + (execute-extended-command current-prefix-arg chosen-item-name) + (smex-rank chosen-item))))) + +;;;###autoload +(defun smex-major-mode-commands () + "Like `smex', but limited to commands that are relevant to the active major mode." + (interactive) + (unless smex-initialized-p + (smex-initialize)) + (let ((commands (delete-dups (append (smex-extract-commands-from-keymap (current-local-map)) + (smex-extract-commands-from-features major-mode))))) + (setq commands (smex-sort-according-to-cache commands)) + (setq commands (mapcar #'symbol-name commands)) + (smex-read-and-run commands))) + +(defun smex-completing-read (choices initial-input) + (let ((ido-completion-map ido-completion-map) + (ido-setup-hook (cons 'smex-prepare-ido-bindings ido-setup-hook)) + (ido-enable-prefix nil) + (ido-enable-flex-matching smex-flex-matching) + (ido-max-prospects 10) + (minibuffer-completion-table choices)) + (ido-completing-read (smex-prompt-with-prefix-arg) choices nil nil + initial-input 'extended-command-history (car choices)))) + +(defun smex-prompt-with-prefix-arg () + (if (not current-prefix-arg) + smex-prompt-string + (concat + (if (eq current-prefix-arg '-) + "- " + (if (integerp current-prefix-arg) + (format "%d " current-prefix-arg) + (if (= (car current-prefix-arg) 4) + "C-u " + (format "%d " (car current-prefix-arg))))) + smex-prompt-string))) + +(defun smex-prepare-ido-bindings () + (define-key ido-completion-map (kbd "TAB") 'minibuffer-complete) + (define-key ido-completion-map (kbd "C-h f") 'smex-describe-function) + (define-key ido-completion-map (kbd "C-h w") 'smex-where-is) + (define-key ido-completion-map (kbd "M-.") 'smex-find-function) + (define-key ido-completion-map (kbd "C-a") 'move-beginning-of-line)) + +;;-------------------------------------------------------------------------------- +;; Cache and Maintenance + +(defun smex-rebuild-cache () + (interactive) + (setq smex-cache nil) + + ;; Build up list 'new-commands' and later put it at the end of 'smex-cache'. + ;; This speeds up sorting. + (let (new-commands) + (mapatoms (lambda (symbol) + (when (commandp symbol) + (let ((known-command (assq symbol smex-data))) + (if known-command + (setq smex-cache (cons known-command smex-cache)) + (setq new-commands (cons (list symbol) new-commands))))))) + (if (eq (length smex-cache) 0) + (setq smex-cache new-commands) + (setcdr (last smex-cache) new-commands))) + + (setq smex-cache (sort smex-cache 'smex-sorting-rules)) + (smex-restore-history) + (setq smex-ido-cache (smex-convert-for-ido smex-cache))) + +(defun smex-convert-for-ido (command-items) + (mapcar (lambda (command-item) (symbol-name (car command-item))) command-items)) + +(defun smex-restore-history () + "Rearranges `smex-cache' according to `smex-history'" + (if (> (length smex-history) smex-history-length) + (setcdr (nthcdr (- smex-history-length 1) smex-history) nil)) + (mapc (lambda (command) + (unless (eq command (caar smex-cache)) + (let ((command-cell-position (smex-detect-position smex-cache (lambda (cell) + (eq command (caar cell)))))) + (if command-cell-position + (let ((command-cell (smex-remove-nth-cell command-cell-position smex-cache))) + (setcdr command-cell smex-cache) + (setq smex-cache command-cell)))))) + (reverse smex-history))) + +(defun smex-sort-according-to-cache (list) + "Sorts a list of commands by their order in `smex-cache'" + (let (sorted) + (dolist (command-item smex-cache) + (let ((command (car command-item))) + (when (memq command list) + (setq sorted (cons command sorted)) + (setq list (delq command list))))) + (nreverse (append list sorted)))) + +(defun smex-update () + (interactive) + (smex-save-history) + (smex-rebuild-cache)) + +(defun smex-detect-new-commands () + (let ((i 0)) + (mapatoms (lambda (symbol) (if (commandp symbol) (setq i (1+ i))))) + (unless (= i smex-command-count) + (setq smex-command-count i)))) + +(defun smex-auto-update (&optional idle-time) + "Update Smex when Emacs has been idle for IDLE-TIME." + (unless idle-time (setq idle-time 60)) + (run-with-idle-timer idle-time t + '(lambda () (if (smex-detect-new-commands) (smex-update))))) + +;;;###autoload +(defun smex-initialize () + (interactive) + (unless ido-mode (smex-initialize-ido)) + (smex-load-save-file) + (smex-detect-new-commands) + (smex-rebuild-cache) + (add-hook 'kill-emacs-hook 'smex-save-to-file) + (setq smex-initialized-p t)) + +(defun smex-initialize-ido () + "Sets up a minimal Ido environment for `ido-completing-read'." + (ido-init-completion-maps) + (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)) + +(defun smex-load-save-file () + "Loads `smex-history' and `smex-data' from `smex-save-file'" + (let ((save-file (expand-file-name smex-save-file))) + (if (file-readable-p save-file) + (with-temp-buffer + (insert-file-contents save-file) + (condition-case nil + (setq smex-history (read (current-buffer)) + smex-data (read (current-buffer))) + (error (if (smex-save-file-not-empty-p) + (error "Invalid data in smex-save-file (%s). Can't restore history." + smex-save-file) + (if (not (boundp 'smex-history)) (setq smex-history)) + (if (not (boundp 'smex-data)) (setq smex-data)))))) + (setq smex-history nil smex-data nil)))) + +(defsubst smex-save-file-not-empty-p () + (string-match-p "\[^[:space:]\]" (buffer-string))) + +(defun smex-save-history () + "Updates `smex-history'" + (setq smex-history nil) + (let ((cell smex-cache)) + (dotimes (i smex-history-length) + (setq smex-history (cons (caar cell) smex-history)) + (setq cell (cdr cell)))) + (setq smex-history (nreverse smex-history))) + +(defun smex-save-to-file () + (interactive) + (smex-save-history) + (with-temp-file (expand-file-name smex-save-file) + (ido-pp 'smex-history) + (ido-pp 'smex-data))) + +;;-------------------------------------------------------------------------------- +;; Ranking + +(defun smex-sorting-rules (command-item other-command-item) + "Returns true if COMMAND-ITEM should sort before OTHER-COMMAND-ITEM." + (let* ((count (or (cdr command-item ) 0)) + (other-count (or (cdr other-command-item) 0)) + (name (car command-item)) + (other-name (car other-command-item)) + (length (length (symbol-name name))) + (other-length (length (symbol-name other-name)))) + (or (> count other-count) ; 1. Frequency of use + (and (= count other-count) + (or (< length other-length) ; 2. Command length + (and (= length other-length) + (string< name other-name))))))) ; 3. Alphabetical order + +(defun smex-rank (command) + (let ((command-item (or (assq command smex-cache) + ;; Update caches and try again if not found. + (progn (smex-update) + (assq command smex-cache))))) + (when command-item + (smex-update-counter command-item) + + ;; Don't touch the cache order if the chosen command + ;; has just been execucted previously. + (unless (eq command-item (car smex-cache)) + (let (command-cell + (pos (smex-detect-position smex-cache (lambda (cell) + (eq command-item (car cell)))))) + ;; Remove the just executed command. + (setq command-cell (smex-remove-nth-cell pos smex-cache)) + ;; And put it on top of the cache. + (setcdr command-cell smex-cache) + (setq smex-cache command-cell) + + ;; Repeat the same for the ido cache. Should this be DRYed? + (setq command-cell (smex-remove-nth-cell pos smex-ido-cache)) + (setcdr command-cell smex-ido-cache) + (setq smex-ido-cache command-cell) + + ;; Now put the last history item back to its normal place. + (smex-sort-item-at smex-history-length)))))) + +(defun smex-update-counter (command-item) + (let ((count (cdr command-item))) + (setcdr command-item + (if count + (1+ count) + ;; Else: Command has just been executed for the first time. + ;; Add it to `smex-data'. + (if smex-data + (setcdr (last smex-data) (list command-item)) + (setq smex-data (list command-item))) + 1)))) + +(defun smex-sort-item-at (n) + "Sorts item at position N in `smex-cache'." + (let* ((command-cell (nthcdr n smex-cache)) + (command-item (car command-cell)) + (command-count (cdr command-item))) + (let ((insert-at (smex-detect-position command-cell (lambda (cell) + (smex-sorting-rules command-item (car cell)))))) + ;; TODO: Should we handle the case of 'insert-at' being nil? + ;; This will never happen in practice. + (when (> insert-at 1) + (setq command-cell (smex-remove-nth-cell n smex-cache)) + ;; smex-cache just got shorter by one element, so subtract '1' from insert-at. + (setq insert-at (+ n (- insert-at 1))) + (smex-insert-cell command-cell insert-at smex-cache) + + ;; Repeat the same for the ido cache. DRY? + (setq command-cell (smex-remove-nth-cell n smex-ido-cache)) + (smex-insert-cell command-cell insert-at smex-ido-cache))))) + +(defun smex-detect-position (cell function) + "Detects, relatively to CELL, the position of the cell +on which FUNCTION returns true. +Only checks cells after CELL, starting with the cell right after CELL. +Returns nil when reaching the end of the list." + (let ((pos 1)) + (catch 'break + (while t + (setq cell (cdr cell)) + (if (not cell) + (throw 'break nil) + (if (funcall function cell) (throw 'break pos)) + (setq pos (1+ pos))))))) + +(defun smex-remove-nth-cell (n list) + "Removes and returns the Nth cell in LIST." + (let* ((previous-cell (nthcdr (- n 1) list)) + (result (cdr previous-cell))) + (setcdr previous-cell (cdr result)) + result)) + +(defun smex-insert-cell (new-cell n list) + "Inserts cell at position N in LIST." + (let* ((cell (nthcdr (- n 1) list)) + (next-cell (cdr cell))) + (setcdr (setcdr cell new-cell) next-cell))) + +;;-------------------------------------------------------------------------------- +;; Help and Reference + +(defun smex-do-with-selected-item (fn) + (setq smex-custom-action fn) + (ido-exit-minibuffer)) + +(defun smex-describe-function () + (interactive) + (smex-do-with-selected-item (lambda (chosen) + (describe-function chosen) + (pop-to-buffer "*Help*")))) + +(defun smex-where-is () + (interactive) + (smex-do-with-selected-item 'where-is)) + +(defun smex-find-function () + (interactive) + (smex-do-with-selected-item 'find-function)) + +(defun smex-extract-commands-from-keymap (map) + (let (commands) + (smex-parse-keymap map commands) + commands)) + +(defun smex-parse-keymap (map commands) + (map-keymap (lambda (binding element) + (if (and (listp element) (eq 'keymap (car element))) + (smex-parse-keymap element commands) + ; Strings are commands, too. Reject them. + (if (and (symbolp element) (commandp element)) + (push element commands)))) + map)) + +(defun smex-extract-commands-from-features (mode) + (let ((library-path (symbol-file mode)) + (mode-name (symbol-name mode)) + commands) + + (string-match "\\(.+?\\)\\(-mode\\)?$" mode-name) + ;; 'lisp-mode' -> 'lisp' + (setq mode-name (match-string 1 mode-name)) + (if (string= mode-name "c") (setq mode-name "cc")) + (setq mode-name (regexp-quote mode-name)) + + (dolist (feature load-history) + (let ((feature-path (car feature))) + (when (and feature-path (or (equal feature-path library-path) + (string-match mode-name (file-name-nondirectory + feature-path)))) + (dolist (item (cdr feature)) + (if (and (listp item) (eq 'defun (car item))) + (let ((function (cdr item))) + (when (commandp function) + (setq commands (append commands (list function)))))))))) + commands)) + +(defun smex-show-unbound-commands () + "Shows unbound commands in a new buffer, +sorted by frequency of use." + (interactive) + (setq smex-data (sort smex-data 'smex-sorting-rules)) + (let ((unbound-commands (delq nil + (mapcar (lambda (command-item) + (unless (where-is-internal (car command-item)) + command-item)) + smex-data)))) + (view-buffer-other-window "*Smex: Unbound Commands*") + (setq buffer-read-only t) + (let ((inhibit-read-only t)) + (erase-buffer) + (ido-pp 'unbound-commands)) + (set-buffer-modified-p nil) + (goto-char (point-min)))) + +(provide 'smex) +;;; smex.el ends here diff --git a/elpa/smex-20140425.1314/smex.elc b/elpa/smex-20140425.1314/smex.elc new file mode 100644 index 000000000..e161fe604 Binary files /dev/null and b/elpa/smex-20140425.1314/smex.elc differ diff --git a/elpa/starter-kit-20130904.1547/starter-kit-autoloads.el b/elpa/starter-kit-20130904.1547/starter-kit-autoloads.el new file mode 100644 index 000000000..91e1b13eb --- /dev/null +++ b/elpa/starter-kit-20130904.1547/starter-kit-autoloads.el @@ -0,0 +1,43 @@ +;;; starter-kit-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil "starter-kit" "starter-kit.el" (21478 16645 +;;;;;; 0 0)) +;;; Generated autoloads from starter-kit.el + +(dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode)) (when (fboundp mode) (funcall mode -1))) + +(mapc 'require '(uniquify starter-kit-defuns starter-kit-misc)) + +(setq esk-system-config (concat user-emacs-directory system-name ".el") esk-user-config (concat user-emacs-directory user-login-name ".el") esk-user-dir (concat user-emacs-directory user-login-name)) + +(setq smex-save-file (concat user-emacs-directory ".smex-items")) + +(smex-initialize) + +(global-set-key (kbd "M-x") 'smex) + +(defun esk-eval-after-init (form) "\ +Add `(lambda () FORM)' to `after-init-hook'. + + If Emacs has already finished initialization, also eval FORM immediately." (let ((func (list (quote lambda) nil form))) (add-hook (quote after-init-hook) func) (when after-init-time (eval form)))) + +(esk-eval-after-init '(progn (when (file-exists-p esk-system-config) (load esk-system-config)) (when (file-exists-p esk-user-config) (load esk-user-config)) (when (file-exists-p esk-user-dir) (mapc 'load (directory-files esk-user-dir t "^[^#].*el$"))))) + +;;;*** + +;;;### (autoloads nil nil ("starter-kit-defuns.el" "starter-kit-misc.el" +;;;;;; "starter-kit-pkg.el") (21478 16645 976622 0)) + +;;;*** + +(provide 'starter-kit-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; starter-kit-autoloads.el ends here diff --git a/elpa/starter-kit-20130904.1547/starter-kit-defuns.el b/elpa/starter-kit-20130904.1547/starter-kit-defuns.el new file mode 100644 index 000000000..d460b496b --- /dev/null +++ b/elpa/starter-kit-20130904.1547/starter-kit-defuns.el @@ -0,0 +1,166 @@ +;;; starter-kit-defuns.el --- Saner defaults and goodies: function defs. +;; +;; Copyright (c) 2008-2010 Phil Hagelberg and contributors +;; +;; Author: Phil Hagelberg +;; URL: http://www.emacswiki.org/cgi-bin/wiki/StarterKit +;; Version: 2.0.2 +;; Keywords: convenience + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; "Emacs outshines all other editing software in approximately the +;; same way that the noonday sun does the stars. It is not just bigger +;; and brighter; it simply makes everything else vanish." +;; -Neal Stephenson, "In the Beginning was the Command Line" + +;; This file contains all the function definitions for the starter kit. + +;;; License: + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +;;; These belong in prog-mode-hook: + +;; We have a number of turn-on-* functions since it's advised that lambda +;; functions not go in hooks. Repeatedly evaling an add-to-list with a +;; hook value will repeatedly add it since there's no way to ensure +;; that a byte-compiled lambda doesn't already exist in the list. + +(defun esk-local-column-number-mode () + (make-local-variable 'column-number-mode) + (column-number-mode t)) + +(defun esk-local-comment-auto-fill () + (set (make-local-variable 'comment-auto-fill-only-comments) t) + (auto-fill-mode t)) + +(defun esk-turn-on-hl-line-mode () + (when (> (display-color-cells) 8) + (hl-line-mode t))) + +(defun esk-turn-on-save-place-mode () + (require 'saveplace) + (setq save-place t)) + +(defun esk-pretty-lambdas () + (font-lock-add-keywords + nil `(("(?\\(lambda\\>\\)" + (0 (progn (compose-region (match-beginning 1) (match-end 1) + ,(make-char 'greek-iso8859-7 107)) + nil)))))) + +(defun esk-add-watchwords () + (font-lock-add-keywords + nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" + 1 font-lock-warning-face t)))) + +(add-hook 'prog-mode-hook 'esk-local-column-number-mode) +(add-hook 'prog-mode-hook 'esk-local-comment-auto-fill) +(add-hook 'prog-mode-hook 'esk-turn-on-hl-line-mode) +(add-hook 'prog-mode-hook 'esk-turn-on-save-place-mode) +(add-hook 'prog-mode-hook 'esk-pretty-lambdas) +(add-hook 'prog-mode-hook 'esk-add-watchwords) +(add-hook 'prog-mode-hook 'idle-highlight-mode) + +(defun esk-prog-mode-hook () + (run-hooks 'prog-mode-hook)) + +(defun esk-turn-off-tool-bar () + (if (functionp 'tool-bar-mode) (tool-bar-mode -1))) + +(defun esk-untabify-buffer () + (interactive) + (untabify (point-min) (point-max))) + +(defun esk-indent-buffer () + (interactive) + (indent-region (point-min) (point-max))) + +(defun esk-cleanup-buffer () + "Perform a bunch of operations on the whitespace content of a buffer." + (interactive) + (esk-indent-buffer) + (esk-untabify-buffer) + (delete-trailing-whitespace)) + +;; Commands + +(defun esk-eval-and-replace () + "Replace the preceding sexp with its value." + (interactive) + (backward-kill-sexp) + (condition-case nil + (prin1 (eval (read (current-kill 0))) + (current-buffer)) + (error (message "Invalid expression") + (insert (current-kill 0))))) + +(defun esk-sudo-edit (&optional arg) + (interactive "p") + (if (or arg (not buffer-file-name)) + (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) + +(defun esk-lorem () + "Insert a lorem ipsum." + (interactive) + (insert "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do " + "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim" + "ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " + "aliquip ex ea commodo consequat. Duis aute irure dolor in " + "reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla " + "pariatur. Excepteur sint occaecat cupidatat non proident, sunt in " + "culpa qui officia deserunt mollit anim id est laborum.")) + +(defun esk-suck-it (suckee) + "Insert a comment of appropriate length about what can suck it." + (interactive "MWhat can suck it? ") + (let ((prefix (concat ";; " suckee " can s")) + (postfix "ck it!") + (col (current-column))) + (insert prefix) + (dotimes (_ (- 80 col (length prefix) (length postfix))) (insert "u")) + (insert postfix))) + +(defun esk-insert-date () + "Insert a time-stamp according to locale's date and time format." + (interactive) + (insert (format-time-string "%c" (current-time)))) + +(defun esk-pairing-bot () + "If you can't pair program with a human, use this instead." + (interactive) + (message (if (y-or-n-p "Do you have a test for that? ") "Good." "Bad!"))) + +(defun esk-paredit-nonlisp () + "Turn on paredit mode for non-lisps." + (interactive) + (set (make-local-variable 'paredit-space-for-delimiter-predicates) + '((lambda (endp delimiter) nil))) + (paredit-mode 1)) + +;; A monkeypatch to cause annotate to ignore whitespace +(defun vc-git-annotate-command (file buf &optional rev) + (let ((name (file-relative-name file))) + (vc-git-command buf 0 name "blame" "-w" rev))) + +(provide 'starter-kit-defuns) +;;; starter-kit-defuns.el ends here diff --git a/elpa/starter-kit-20130904.1547/starter-kit-defuns.elc b/elpa/starter-kit-20130904.1547/starter-kit-defuns.elc new file mode 100644 index 000000000..742b167f0 Binary files /dev/null and b/elpa/starter-kit-20130904.1547/starter-kit-defuns.elc differ diff --git a/elpa/starter-kit-20130904.1547/starter-kit-misc.el b/elpa/starter-kit-20130904.1547/starter-kit-misc.el new file mode 100644 index 000000000..a4fbc3675 --- /dev/null +++ b/elpa/starter-kit-20130904.1547/starter-kit-misc.el @@ -0,0 +1,160 @@ +;;; starter-kit-misc.el --- Saner defaults and goodies: miscellany +;; +;; Copyright (c) 2008-2010 Phil Hagelberg and contributors +;; +;; Author: Phil Hagelberg +;; URL: http://www.emacswiki.org/cgi-bin/wiki/StarterKit +;; Version: 2.0.2 +;; Keywords: convenience + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; "Emacs outshines all other editing software in approximately the +;; same way that the noonday sun does the stars. It is not just bigger +;; and brighter; it simply makes everything else vanish." +;; -Neal Stephenson, "In the Beginning was the Command Line" + +;; This file contains setqs and things that aren't bindings or defuns. + +;;; License: + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +(when window-system + (setq frame-title-format '(buffer-file-name "%f" ("%b"))) + (tooltip-mode -1) + (mouse-wheel-mode t) + (blink-cursor-mode -1)) + +;; can't do it at launch or emacsclient won't always honor it +(add-hook 'before-make-frame-hook 'esk-turn-off-tool-bar) + +(setq visible-bell t + inhibit-startup-message t + color-theme-is-global t + sentence-end-double-space nil + shift-select-mode nil + mouse-yank-at-point t + uniquify-buffer-name-style 'forward + whitespace-style '(face trailing lines-tail tabs) + whitespace-line-column 80 + ediff-window-setup-function 'ediff-setup-windows-plain + oddmuse-directory (concat user-emacs-directory "oddmuse") + save-place-file (concat user-emacs-directory "places") + backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) + diff-switches "-u") + +(add-to-list 'safe-local-variable-values '(lexical-binding . t)) +(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) + +;; Set this to whatever browser you use +;; (setq browse-url-browser-function 'browse-url-firefox) +;; (setq browse-url-browser-function 'browse-default-macosx-browser) +;; (setq browse-url-browser-function 'browse-default-windows-browser) +;; (setq browse-url-browser-function 'browse-default-kde) +;; (setq browse-url-browser-function 'browse-default-epiphany) +;; (setq browse-url-browser-function 'browse-default-w3m) +;; (setq browse-url-browser-function 'browse-url-generic +;; browse-url-generic-program "~/src/conkeror/conkeror") + +;; Highlight matching parentheses when the point is on them. +(show-paren-mode 1) + +;; ido-mode is like magic pixie dust! +(ido-mode t) +(ido-ubiquitous-mode) +(setq ido-enable-prefix nil + ido-enable-flex-matching t + ido-auto-merge-work-directories-length nil + ido-create-new-buffer 'always + ido-use-filename-at-point 'guess + ido-use-virtual-buffers t + ido-handle-duplicate-virtual-buffers 2 + ido-max-prospects 10) + +(require 'ffap) +(defvar ffap-c-commment-regexp "^/\\*+" + "Matches an opening C-style comment, like \"/***\".") + +(defadvice ffap-file-at-point (after avoid-c-comments activate) + "Don't return paths like \"/******\" unless they actually exist. + +This fixes the bug where ido would try to suggest a C-style +comment as a filename." + (ignore-errors + (when (and ad-return-value + (string-match-p ffap-c-commment-regexp + ad-return-value) + (not (ffap-file-exists-string ad-return-value))) + (setq ad-return-value nil)))) + +(set-default 'indent-tabs-mode nil) +(set-default 'indicate-empty-lines t) +(set-default 'imenu-auto-rescan t) + +(add-hook 'text-mode-hook 'turn-on-auto-fill) +;; (when (executable-find ispell-program-name) +;; (add-hook 'text-mode-hook 'turn-on-flyspell)) + +(eval-after-load "ispell" + '(when (executable-find ispell-program-name) + (add-hook 'text-mode-hook 'turn-on-flyspell))) + + + +(defalias 'yes-or-no-p 'y-or-n-p) +(defalias 'auto-tail-revert-mode 'tail-mode) + +(random t) ;; Seed the random-number generator + +;; Hippie expand: at times perhaps too hip +(eval-after-load 'hippie-exp + '(progn + (dolist (f '(try-expand-line try-expand-list try-complete-file-name-partially)) + (delete f hippie-expand-try-functions-list)) + + ;; Add this back in at the end of the list. + (add-to-list 'hippie-expand-try-functions-list 'try-complete-file-name-partially t))) + +(eval-after-load 'grep + '(when (boundp 'grep-find-ignored-files) + (add-to-list 'grep-find-ignored-files "*.class"))) + +;; Cosmetics + +(eval-after-load 'diff-mode + '(progn + (set-face-foreground 'diff-added "green4") + (set-face-foreground 'diff-removed "red3"))) + +(eval-after-load 'magit + '(progn + (set-face-foreground 'magit-diff-add "green4") + (set-face-foreground 'magit-diff-del "red3"))) + +;; Get around the emacswiki spam protection +(eval-after-load 'oddmuse + (add-hook 'oddmuse-mode-hook + (lambda () + (unless (string-match "question" oddmuse-post) + (setq oddmuse-post (concat "uihnscuskc=1;" oddmuse-post)))))) + +(provide 'starter-kit-misc) +;;; starter-kit-misc.el ends here diff --git a/elpa/starter-kit-20130904.1547/starter-kit-misc.elc b/elpa/starter-kit-20130904.1547/starter-kit-misc.elc new file mode 100644 index 000000000..52d53646d Binary files /dev/null and b/elpa/starter-kit-20130904.1547/starter-kit-misc.elc differ diff --git a/elpa/starter-kit-20130904.1547/starter-kit-pkg.el b/elpa/starter-kit-20130904.1547/starter-kit-pkg.el new file mode 100644 index 000000000..8df43bb2a --- /dev/null +++ b/elpa/starter-kit-20130904.1547/starter-kit-pkg.el @@ -0,0 +1,7 @@ +(define-package "starter-kit" "20130904.1547" "Saner defaults and goodies." + '((paredit "22") + (idle-highlight-mode "1.1.1") + (find-file-in-project "3.0") + (smex "1.1.2") + (ido-ubiquitous "0.3") + (magit "0.8.1"))) diff --git a/elpa/starter-kit-20130904.1547/starter-kit-pkg.elc b/elpa/starter-kit-20130904.1547/starter-kit-pkg.elc new file mode 100644 index 000000000..2c663cfb5 Binary files /dev/null and b/elpa/starter-kit-20130904.1547/starter-kit-pkg.elc differ diff --git a/elpa/starter-kit-20130904.1547/starter-kit.el b/elpa/starter-kit-20130904.1547/starter-kit.el new file mode 100644 index 000000000..3ac557b5d --- /dev/null +++ b/elpa/starter-kit-20130904.1547/starter-kit.el @@ -0,0 +1,75 @@ +;;; starter-kit.el --- Saner defaults and goodies. +;; +;; Copyright (c) 2008-2011 Phil Hagelberg and contributors +;; +;; Author: Phil Hagelberg +;; URL: http://www.emacswiki.org/cgi-bin/wiki/StarterKit +;; Version: 2.0.2 +;; Keywords: convenience + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; "Emacs outshines all other editing software in approximately the +;; same way that the noonday sun does the stars. It is not just bigger +;; and brighter; it simply makes everything else vanish." +;; -Neal Stephenson, "In the Beginning was the Command Line" + +;; This file just brings together other pieces of the starter kit plus +;; user- and host-specific configs. + +;;; License: + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +;;;###autoload +(progn + ;; Turn off mouse interface early in startup to avoid momentary display + (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode)) + (when (fboundp mode) (funcall mode -1))) + + (mapc 'require '(uniquify starter-kit-defuns starter-kit-misc)) + + ;; You can keep system- or user-specific customizations here + (setq esk-system-config (concat user-emacs-directory system-name ".el") + esk-user-config (concat user-emacs-directory user-login-name ".el") + esk-user-dir (concat user-emacs-directory user-login-name)) + + (setq smex-save-file (concat user-emacs-directory ".smex-items")) + (smex-initialize) + (global-set-key (kbd "M-x") 'smex) + + (defun esk-eval-after-init (form) + "Add `(lambda () FORM)' to `after-init-hook'. + + If Emacs has already finished initialization, also eval FORM immediately." + (let ((func (list 'lambda nil form))) + (add-hook 'after-init-hook func) + (when after-init-time + (eval form)))) + + (esk-eval-after-init + '(progn + (when (file-exists-p esk-system-config) (load esk-system-config)) + (when (file-exists-p esk-user-config) (load esk-user-config)) + (when (file-exists-p esk-user-dir) + (mapc 'load (directory-files esk-user-dir t "^[^#].*el$")))))) + +(provide 'starter-kit) +;;; starter-kit.el ends here diff --git a/elpa/starter-kit-20130904.1547/starter-kit.elc b/elpa/starter-kit-20130904.1547/starter-kit.elc new file mode 100644 index 000000000..f93cfabb3 Binary files /dev/null and b/elpa/starter-kit-20130904.1547/starter-kit.elc differ diff --git a/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-autoloads.el b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-autoloads.el new file mode 100644 index 000000000..7e8b5cbf4 --- /dev/null +++ b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-autoloads.el @@ -0,0 +1,84 @@ +;;; starter-kit-bindings-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil "starter-kit-bindings" "starter-kit-bindings.el" +;;;;;; (21478 16644 0 0)) +;;; Generated autoloads from starter-kit-bindings.el + +(global-set-key (kbd "C-c f") 'find-file-in-project) + +(global-set-key (kbd "C-M-h") 'backward-kill-word) + +(global-set-key (kbd "M-/") 'hippie-expand) + +(global-set-key (kbd "C-c n") 'esk-cleanup-buffer) + +(global-set-key (kbd "C-") 'menu-bar-mode) + +(define-key global-map (kbd "C-+") 'text-scale-increase) + +(define-key global-map (kbd "C--") 'text-scale-decrease) + +(global-set-key (kbd "C-s") 'isearch-forward-regexp) + +(global-set-key (kbd "") 'isearch-backward-regexp) + +(global-set-key (kbd "M-%") 'query-replace-regexp) + +(global-set-key (kbd "C-M-s") 'isearch-forward) + +(global-set-key (kbd "C-M-r") 'isearch-backward) + +(global-set-key (kbd "C-M-%") 'query-replace) + +(global-set-key (kbd "C-x C-i") 'imenu) + +(global-set-key (kbd "C-x M-f") 'ido-find-file-other-window) + +(global-set-key (kbd "C-c y") 'bury-buffer) + +(global-set-key (kbd "C-c r") 'revert-buffer) + +(windmove-default-keybindings) + +(global-set-key (kbd "C-x O") (lambda nil (interactive) (other-window -1))) + +(global-set-key (kbd "C-x C-o") (lambda nil (interactive) (other-window 2))) + +(global-set-key (kbd "C-x m") 'eshell) + +(global-set-key (kbd "C-x M") (lambda nil (interactive) (eshell t))) + +(global-set-key (kbd "C-x C-m") 'shell) + +(global-set-key (kbd "C-c x") 'execute-extended-command) + +(define-key 'help-command "a" 'apropos) + +(global-set-key (kbd "C-c e") 'esk-eval-and-replace) + +(global-set-key (kbd "C-c q") 'join-line) + +(global-set-key (kbd "C-c g") 'magit-status) + +(eval-after-load 'vc (define-key vc-prefix-map "i" '(lambda nil (interactive) (if (not (eq 'Git (vc-backend buffer-file-name))) (vc-register) (shell-command (format "git add %s" buffer-file-name)) (message "Staged changes."))))) + +(define-key isearch-mode-map (kbd "C-o") (lambda nil (interactive) (let ((case-fold-search isearch-case-fold-search)) (occur (if isearch-regexp isearch-string (regexp-quote isearch-string)))))) + +;;;*** + +;;;### (autoloads nil nil ("starter-kit-bindings-pkg.el") (21478 +;;;;;; 16644 603092 0)) + +;;;*** + +(provide 'starter-kit-bindings-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; starter-kit-bindings-autoloads.el ends here diff --git a/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-pkg.el b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-pkg.el new file mode 100644 index 000000000..859712c24 --- /dev/null +++ b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-pkg.el @@ -0,0 +1 @@ +(define-package "starter-kit-bindings" "20120101.1955" "Saner defaults and goodies: bindings" (quote ((starter-kit "2.0.2")))) diff --git a/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-pkg.elc b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-pkg.elc new file mode 100644 index 000000000..8d9207dc1 Binary files /dev/null and b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings-pkg.elc differ diff --git a/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings.el b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings.el new file mode 100644 index 000000000..ad14d1a7a --- /dev/null +++ b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings.el @@ -0,0 +1,124 @@ +;;; starter-kit-bindings.el --- Saner defaults and goodies: bindings +;; +;; Copyright (c) 2008-2010 Phil Hagelberg and contributors +;; +;; Author: Phil Hagelberg +;; URL: http://www.emacswiki.org/cgi-bin/wiki/StarterKit +;; Version: 20120101.1955 +;; X-Original-Version: 2.0.2 +;; Keywords: convenience +;; Package-Requires: ((starter-kit "2.0.2")) + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; "Emacs outshines all other editing software in approximately the +;; same way that the noonday sun does the stars. It is not just bigger +;; and brighter; it simply makes everything else vanish." +;; -Neal Stephenson, "In the Beginning was the Command Line" + +;; This file just contains key bindings. + +;;; License: + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +;;;###autoload +(progn + ;; It's all about the project. + (global-set-key (kbd "C-c f") 'find-file-in-project) + + ;; You know, like Readline. + (global-set-key (kbd "C-M-h") 'backward-kill-word) + + ;; Completion that uses many different methods to find options. + (global-set-key (kbd "M-/") 'hippie-expand) + + ;; Perform general cleanup. + (global-set-key (kbd "C-c n") 'esk-cleanup-buffer) + + ;; Turn on the menu bar for exploring new modes + (global-set-key (kbd "C-") 'menu-bar-mode) + + ;; Font size + (define-key global-map (kbd "C-+") 'text-scale-increase) + (define-key global-map (kbd "C--") 'text-scale-decrease) + + ;; Use regex searches by default. + (global-set-key (kbd "C-s") 'isearch-forward-regexp) + (global-set-key (kbd "\C-r") 'isearch-backward-regexp) + (global-set-key (kbd "M-%") 'query-replace-regexp) + (global-set-key (kbd "C-M-s") 'isearch-forward) + (global-set-key (kbd "C-M-r") 'isearch-backward) + (global-set-key (kbd "C-M-%") 'query-replace) + + ;; Jump to a definition in the current file. (Protip: this is awesome.) + (global-set-key (kbd "C-x C-i") 'imenu) + + ;; File finding + (global-set-key (kbd "C-x M-f") 'ido-find-file-other-window) + (global-set-key (kbd "C-c y") 'bury-buffer) + (global-set-key (kbd "C-c r") 'revert-buffer) + + ;; Window switching. (C-x o goes to the next window) + (windmove-default-keybindings) ;; Shift+direction + (global-set-key (kbd "C-x O") (lambda () (interactive) (other-window -1))) ;; back one + (global-set-key (kbd "C-x C-o") (lambda () (interactive) (other-window 2))) ;; forward two + + ;; Start eshell or switch to it if it's active. + (global-set-key (kbd "C-x m") 'eshell) + + ;; Start a new eshell even if one is active. + (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + + ;; Start a regular shell if you prefer that. + (global-set-key (kbd "C-x C-m") 'shell) + + ;; If you want to be able to M-x without meta (phones, etc) + (global-set-key (kbd "C-c x") 'execute-extended-command) + + ;; Help should search more than just commands + (define-key 'help-command "a" 'apropos) + + ;; Should be able to eval-and-replace anywhere. + (global-set-key (kbd "C-c e") 'esk-eval-and-replace) + + ;; M-S-6 is awkward + (global-set-key (kbd "C-c q") 'join-line) + + ;; So good! + (global-set-key (kbd "C-c g") 'magit-status) + + ;; This is a little hacky since VC doesn't support git add internally + (eval-after-load 'vc + (define-key vc-prefix-map "i" + '(lambda () (interactive) + (if (not (eq 'Git (vc-backend buffer-file-name))) + (vc-register) + (shell-command (format "git add %s" buffer-file-name)) + (message "Staged changes."))))) + + ;; Activate occur easily inside isearch + (define-key isearch-mode-map (kbd "C-o") + (lambda () (interactive) + (let ((case-fold-search isearch-case-fold-search)) + (occur (if isearch-regexp isearch-string (regexp-quote isearch-string))))))) + +(provide 'starter-kit-bindings) +;;; starter-kit-bindings.el ends here diff --git a/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings.elc b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings.elc new file mode 100644 index 000000000..1749c3a52 Binary files /dev/null and b/elpa/starter-kit-bindings-20120101.1955/starter-kit-bindings.elc differ diff --git a/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-autoloads.el b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-autoloads.el new file mode 100644 index 000000000..92ebd6846 --- /dev/null +++ b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-autoloads.el @@ -0,0 +1,54 @@ +;;; starter-kit-lisp-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil "starter-kit-lisp" "starter-kit-lisp.el" (21478 +;;;;;; 16643 0 0)) +;;; Generated autoloads from starter-kit-lisp.el + +(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) + +(add-hook 'emacs-lisp-mode-hook 'esk-remove-elc-on-save) + +(add-hook 'emacs-lisp-mode-hook 'esk-prog-mode-hook) + +(add-hook 'emacs-lisp-mode-hook 'elisp-slime-nav-mode) + +(defun esk-remove-elc-on-save nil "\ +If you're saving an elisp file, likely the .elc is no longer valid." (make-local-variable (quote after-save-hook)) (add-hook (quote after-save-hook) (lambda nil (if (file-exists-p (concat buffer-file-name "c")) (delete-file (concat buffer-file-name "c")))))) + +(define-key emacs-lisp-mode-map (kbd "C-c v") 'eval-buffer) + +(define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) + +(define-key lisp-mode-shared-map (kbd "RET") 'reindent-then-newline-and-indent) + +(defface esk-paren-face '((((class color) (background dark)) (:foreground "grey50")) (((class color) (background light)) (:foreground "grey55"))) "\ +Face used to dim parentheses." :group (quote starter-kit-faces)) + +(eval-after-load 'paredit '(progn (define-key paredit-mode-map (kbd "M-)") 'paredit-forward-slurp-sexp) (define-key paredit-mode-map (kbd "M-(") 'paredit-backward-slurp-sexp))) + +(dolist (mode '(scheme emacs-lisp lisp clojure clojurescript)) (when (> (display-color-cells) 8) (font-lock-add-keywords (intern (concat (symbol-name mode) "-mode")) '(("(\\|)" quote esk-paren-face)))) (add-hook (intern (concat (symbol-name mode) "-mode-hook")) 'paredit-mode)) + +(defun esk-pretty-fn nil (font-lock-add-keywords nil `(("(\\(\\\\)" (0 (progn (compose-region (match-beginning 1) (match-end 1) "ƒ" 'decompose-region))))))) + +(add-hook 'clojure-mode-hook 'esk-pretty-fn) + +(add-hook 'clojurescript-mode-hook 'esk-pretty-fn) + +;;;*** + +;;;### (autoloads nil nil ("starter-kit-lisp-pkg.el") (21478 16643 +;;;;;; 207711 0)) + +;;;*** + +(provide 'starter-kit-lisp-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; starter-kit-lisp-autoloads.el ends here diff --git a/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-pkg.el b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-pkg.el new file mode 100644 index 000000000..7f40fb629 --- /dev/null +++ b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-pkg.el @@ -0,0 +1 @@ +(define-package "starter-kit-lisp" "20120504.1225" "Saner defaults and goodies for lisp languages" (quote ((starter-kit "2.0.2") (elisp-slime-nav "0.1")))) diff --git a/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-pkg.elc b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-pkg.elc new file mode 100644 index 000000000..2a0c6e316 Binary files /dev/null and b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp-pkg.elc differ diff --git a/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp.el b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp.el new file mode 100644 index 000000000..e9c8821e1 --- /dev/null +++ b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp.el @@ -0,0 +1,98 @@ +;;; starter-kit-lisp.el --- Saner defaults and goodies for lisp languages +;; +;; Copyright (c) 2008-2011 Phil Hagelberg and contributors +;; +;; Author: Phil Hagelberg +;; URL: http://www.emacswiki.org/cgi-bin/wiki/StarterKit +;; Version: 20120504.1225 +;; X-Original-Version: 2.0.3 +;; Keywords: convenience +;; Package-Requires: ((starter-kit "2.0.2") (elisp-slime-nav "0.1")) + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; "Emacs outshines all other editing software in approximately the +;; same way that the noonday sun does the stars. It is not just bigger +;; and brighter; it simply makes everything else vanish." +;; -Neal Stephenson, "In the Beginning was the Command Line" + +;; This file contains tweaks specific to Lisp languages. + +;;; License: + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +;; Emacs Lisp + +;;;###autoload +(progn + (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) + (add-hook 'emacs-lisp-mode-hook 'esk-remove-elc-on-save) + (add-hook 'emacs-lisp-mode-hook 'esk-prog-mode-hook) + (add-hook 'emacs-lisp-mode-hook 'elisp-slime-nav-mode) + + (defun esk-remove-elc-on-save () + "If you're saving an elisp file, likely the .elc is no longer valid." + (make-local-variable 'after-save-hook) + (add-hook 'after-save-hook + (lambda () + (if (file-exists-p (concat buffer-file-name "c")) + (delete-file (concat buffer-file-name "c")))))) + + (define-key emacs-lisp-mode-map (kbd "C-c v") 'eval-buffer) + +;;; Enhance Lisp Modes + + (define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) + (define-key lisp-mode-shared-map (kbd "RET") 'reindent-then-newline-and-indent) + + ;; TODO: look into parenface package + (defface esk-paren-face + '((((class color) (background dark)) + (:foreground "grey50")) + (((class color) (background light)) + (:foreground "grey55"))) + "Face used to dim parentheses." + :group 'starter-kit-faces) + + (eval-after-load 'paredit + ;; need a binding that works in the terminal + '(progn + (define-key paredit-mode-map (kbd "M-)") 'paredit-forward-slurp-sexp) + (define-key paredit-mode-map (kbd "M-(") 'paredit-backward-slurp-sexp))) + + (dolist (mode '(scheme emacs-lisp lisp clojure clojurescript)) + (when (> (display-color-cells) 8) + (font-lock-add-keywords (intern (concat (symbol-name mode) "-mode")) + '(("(\\|)" . 'esk-paren-face)))) + (add-hook (intern (concat (symbol-name mode) "-mode-hook")) + 'paredit-mode)) + + (defun esk-pretty-fn () + (font-lock-add-keywords nil `(("(\\(\\\\)" + (0 (progn (compose-region (match-beginning 1) + (match-end 1) + "\u0192" + 'decompose-region))))))) + (add-hook 'clojure-mode-hook 'esk-pretty-fn) + (add-hook 'clojurescript-mode-hook 'esk-pretty-fn)) + +(provide 'starter-kit-lisp) +;;; starter-kit-lisp.el ends here diff --git a/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp.elc b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp.elc new file mode 100644 index 000000000..30bc61406 Binary files /dev/null and b/elpa/starter-kit-lisp-20120504.1225/starter-kit-lisp.elc differ diff --git a/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-autoloads.el b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-autoloads.el new file mode 100644 index 000000000..104fd7797 --- /dev/null +++ b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-autoloads.el @@ -0,0 +1,65 @@ +;;; starter-kit-ruby-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil "starter-kit-ruby" "starter-kit-ruby.el" (21478 +;;;;;; 16642 0 0)) +;;; Generated autoloads from starter-kit-ruby.el + +(eval-after-load 'ruby-mode '(progn (ignore-errors (require 'ruby-compilation)) (setq ruby-use-encoding-map nil) (add-hook 'ruby-mode-hook 'inf-ruby-keys) (define-key ruby-mode-map (kbd "RET") 'reindent-then-newline-and-indent) (define-key ruby-mode-map (kbd "C-M-h") 'backward-kill-word))) + +(define-key 'help-command (kbd "S-r") 'ri) + +(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode)) + +(add-to-list 'auto-mode-alist '("\\.thor$" . ruby-mode)) + +(add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode)) + +(add-to-list 'auto-mode-alist '("\\.ru$" . ruby-mode)) + +(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode)) + +(add-to-list 'auto-mode-alist '("Thorfile$" . ruby-mode)) + +(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode)) + +(add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode)) + +(add-to-list 'auto-mode-alist '("Vagrantfile$" . ruby-mode)) + +(add-to-list 'completion-ignored-extensions ".rbc") + +(add-to-list 'completion-ignored-extensions ".rbo") + +(defun pcomplete/rake nil "\ +Completion rules for the `ssh' command." (pcomplete-here (pcmpl-rake-tasks))) + +(defun pcmpl-rake-tasks nil "\ +Return a list of all the rake tasks defined in the current +projects. I know this is a hack to put all the logic in the +exec-to-string command, but it works and seems fast" (delq nil (mapcar (quote (lambda (line) (if (string-match "rake \\([^ ]+\\)" line) (match-string 1 line)))) (split-string (shell-command-to-string "rake -T") "[ +]")))) + +(defun rake (task) (interactive (list (completing-read "Rake (default: default): " (pcmpl-rake-tasks)))) (shell-command-to-string (concat "rake " (if (= 0 (length task)) "default" task)))) + +(eval-after-load 'ruby-compilation '(progn (defadvice ruby-do-run-w/compilation (before kill-buffer (name cmdlist)) (let ((comp-buffer-name (format "*%s*" name))) (when (get-buffer comp-buffer-name) (with-current-buffer comp-buffer-name (delete-region (point-min) (point-max)))))) (ad-activate 'ruby-do-run-w/compilation))) + +(setq rinari-major-modes (list 'mumamo-after-change-major-mode-hook 'dired-mode-hook 'ruby-mode-hook 'css-mode-hook 'yaml-mode-hook 'javascript-mode-hook)) + +;;;*** + +;;;### (autoloads nil nil ("starter-kit-ruby-pkg.el") (21478 16642 +;;;;;; 437362 0)) + +;;;*** + +(provide 'starter-kit-ruby-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; starter-kit-ruby-autoloads.el ends here diff --git a/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-pkg.el b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-pkg.el new file mode 100644 index 000000000..a065787a6 --- /dev/null +++ b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-pkg.el @@ -0,0 +1 @@ +(define-package "starter-kit-ruby" "20120202.1132" "Saner defaults and goodies for Ruby" (quote ((inf-ruby "2.2.3") (starter-kit "2.0.1")))) diff --git a/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-pkg.elc b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-pkg.elc new file mode 100644 index 000000000..d724a07c7 Binary files /dev/null and b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby-pkg.elc differ diff --git a/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby.el b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby.el new file mode 100644 index 000000000..e821966c5 --- /dev/null +++ b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby.el @@ -0,0 +1,105 @@ +;;; starter-kit-ruby.el --- Saner defaults and goodies for Ruby +;; +;; Copyright (c) 2008-2012 Phil Hagelberg and contributors +;; +;; Author: Phil Hagelberg +;; URL: http://www.emacswiki.org/cgi-bin/wiki/StarterKit +;; Version: 20120202.1132 +;; X-Original-Version: 2.0.3 +;; Keywords: convenience +;; Package-Requires: ((inf-ruby "2.2.3") (starter-kit "2.0.1")) +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; "Emacs outshines all other editing software in approximately the +;; same way that the noonday sun does the stars. It is not just bigger +;; and brighter; it simply makes everything else vanish." +;; -Neal Stephenson, "In the Beginning was the Command Line" + +;; This file contains tweaks specific to Ruby. + +;;; License: + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +;;;###autoload +(progn + (eval-after-load 'ruby-mode + '(progn + ;; work around possible elpa bug + (ignore-errors (require 'ruby-compilation)) + (setq ruby-use-encoding-map nil) + (add-hook 'ruby-mode-hook 'inf-ruby-keys) + (define-key ruby-mode-map (kbd "RET") 'reindent-then-newline-and-indent) + (define-key ruby-mode-map (kbd "C-M-h") 'backward-kill-word))) + + (define-key 'help-command (kbd "S-r") 'ri) + + ;; Rake files are ruby, too, as are gemspecs, rackup files, etc. + (add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode)) + (add-to-list 'auto-mode-alist '("\\.thor$" . ruby-mode)) + (add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode)) + (add-to-list 'auto-mode-alist '("\\.ru$" . ruby-mode)) + (add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode)) + (add-to-list 'auto-mode-alist '("Thorfile$" . ruby-mode)) + (add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode)) + (add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode)) + (add-to-list 'auto-mode-alist '("Vagrantfile$" . ruby-mode)) + + ;; We never want to edit Rubinius bytecode or MacRuby binaries + (add-to-list 'completion-ignored-extensions ".rbc") + (add-to-list 'completion-ignored-extensions ".rbo") + +;;; Rake + + (defun pcomplete/rake () + "Completion rules for the `ssh' command." + (pcomplete-here (pcmpl-rake-tasks))) + + (defun pcmpl-rake-tasks () + "Return a list of all the rake tasks defined in the current +projects. I know this is a hack to put all the logic in the +exec-to-string command, but it works and seems fast" + (delq nil (mapcar '(lambda(line) + (if (string-match "rake \\([^ ]+\\)" line) (match-string 1 line))) + (split-string (shell-command-to-string "rake -T") "[\n]")))) + + (defun rake (task) + (interactive (list (completing-read "Rake (default: default): " + (pcmpl-rake-tasks)))) + (shell-command-to-string (concat "rake " (if (= 0 (length task)) "default" task)))) + + + ;; Clear the compilation buffer between test runs. + (eval-after-load 'ruby-compilation + '(progn + (defadvice ruby-do-run-w/compilation (before kill-buffer (name cmdlist)) + (let ((comp-buffer-name (format "*%s*" name))) + (when (get-buffer comp-buffer-name) + (with-current-buffer comp-buffer-name + (delete-region (point-min) (point-max)))))) + (ad-activate 'ruby-do-run-w/compilation))) + + ;; Rinari (Minor Mode for Ruby On Rails) + (setq rinari-major-modes + (list 'mumamo-after-change-major-mode-hook 'dired-mode-hook 'ruby-mode-hook + 'css-mode-hook 'yaml-mode-hook 'javascript-mode-hook))) + +(provide 'starter-kit-ruby) +;;; starter-kit-ruby.el ends here diff --git a/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby.elc b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby.elc new file mode 100644 index 000000000..0406d3fa7 Binary files /dev/null and b/elpa/starter-kit-ruby-20120202.1132/starter-kit-ruby.elc differ