branch: master commit de19c24465f304c440157971fcf34c8072b057ce Merge: 99e418d facd92f Author: Stephen Leake <stephen_le...@stephe-leake.org> Commit: Stephen Leake <stephen_le...@stephe-leake.org>
Merge commit 'facd92f4c026525706a48b96b4e0b24543ce1d94' --- .gitignore | 8 + GNUmakefile | 8 +- README | 2 +- admin/archive-contents.el | 22 ++- externals-list | 4 + packages/counsel-ebdb/counsel-ebdb.el | 66 ------- packages/el-search/NEWS | 5 + packages/el-search/el-search-x.el | 2 +- packages/el-search/el-search.el | 335 +++++++++++++++++++++++++++++----- packages/helm-ebdb/helm-ebdb.el | 83 --------- packages/iterators/iterators.el | 2 +- packages/on-screen/on-screen.el | 2 +- packages/smart-yank/smart-yank.el | 2 +- packages/stream/stream-x.el | 2 +- 14 files changed, 332 insertions(+), 211 deletions(-) diff --git a/.gitignore b/.gitignore index 363f7e4..7fcb315 100644 --- a/.gitignore +++ b/.gitignore @@ -14,27 +14,35 @@ packages/auctex/ packages/bbdb/ packages/chess/ packages/cl-print/ +packages/clipboard-collector/ packages/dash/ packages/dismal/ packages/ebdb/ packages/eglot/ packages/ergoemacs-mode/ packages/exwm/ +packages/flymake/ packages/fountain-mode/ +packages/gpastel/ packages/hyperbole/ +packages/ivy-explorer/ packages/jsonrpc/ packages/let-alist/ +packages/map/ packages/mmm-mode/ packages/ntlm/ +packages/objed/ packages/omn-mode/ packages/orgalist/ packages/pabbrev/ +packages/posframe/ packages/psgml/ packages/python/ packages/rudel/ packages/soap-client/ packages/sql-indent/ packages/ssh-deploy/ +packages/system-packages/ packages/w3/ packages/xelb/ packages/zones/ diff --git a/GNUmakefile b/GNUmakefile index 79e252f..8bfd49b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -171,9 +171,11 @@ elcs := $(call SET-diff, $(naive_elcs), $(patsubst %.el, %.elc, $(nbc_els))) # '(dolist (al (quote ($(patsubst %, "%", $(autoloads))))) (load (expand-file-name al) nil t))' %.elc: %.el @echo 'Byte compiling $<' - @$(EMACS) \ - --eval "(setq package-directory-list nil package-user-dir \"$(abspath packages)\")" \ - -f package-initialize \ + @$(EMACS) \ + --eval "(setq package-directory-list nil \ + load-prefer-newer t \ + package-user-dir \"$(abspath packages)\")" \ + -f package-initialize \ -L $(dir $@) -f batch-byte-compile $< .PHONY: elcs diff --git a/README b/README index b827780..e0c9faf 100644 --- a/README +++ b/README @@ -229,7 +229,7 @@ In the `external' case, the copy of the code is not kept in `master` but in the To add a new externals package, first add this `elpa.git' repository as a new remote in your existing repository. Then push a local branch to a -new remote branch in `elpa.git', named externals/<pkgname>. For example: +new remote branch in `elpa.git', named `externals/<pkgname>`. For example: git push elpa <mybranch>:externals/<pkgname> diff --git a/admin/archive-contents.el b/admin/archive-contents.el index 17909b9..32f5285 100644 --- a/admin/archive-contents.el +++ b/admin/archive-contents.el @@ -1,6 +1,6 @@ ;;; archive-contents.el --- Auto-generate an Emacs Lisp package archive. -*- lexical-binding:t -*- -;; Copyright (C) 2011-2018 Free Software Foundation, Inc +;; Copyright (C) 2011-2019 Free Software Foundation, Inc ;; Author: Stefan Monnier <monn...@iro.umontreal.ca> @@ -626,14 +626,20 @@ Rename DIR/ to PKG-VERS/, and return the descriptor." (message "Running git pull in %S" default-directory) (archive-call t "git" "pull")) ((file-exists-p ".git") - (message "Updating worktree in %S" default-directory) - (archive-call t "git" "merge")) + (unless (with-temp-buffer + (archive-call t "git" "status" "--branch" "--porcelain=2") + (goto-char (point-min)) + ;; Nothing to pull (nor push, actually). + (search-forward "\n# branch.ab +0 -0" nil t)) + (message "Updating worktree in %S" default-directory) + (archive-call t "git" "merge"))) (t (error "No .git in %S" default-directory))) - (message "Updated %s:%s%s" dirname - (if (and (eobp) (bolp) - (eq (line-beginning-position 0) (point-min))) - " " "\n") - (buffer-string))))) + (unless (and (eobp) (bobp)) + (message "Updated %s:%s%s" dirname + (if (and (eobp) (bolp) + (eq (line-beginning-position 0) (point-min))) + " " "\n") + (buffer-string)))))) ;;; Maintain external packages. diff --git a/externals-list b/externals-list index 411c431..2098587 100644 --- a/externals-list +++ b/externals-list @@ -55,6 +55,7 @@ ("chess" :external nil) ;; Was https://github.com/jwiegley/emacs-chess.git ;; ("cobol-mode" :subtree "https://gist.github.com/Edward-H/6768e7dc53ea3dd2adca") ("cl-print" :core "lisp/emacs-lisp/cl-print.el") + ("clipboard-collector" :external "https://github.com/clemera/clipboard-collector") ("coffee-mode" :subtree "https://github.com/defunkt/coffee-mode") ("compact-docstrings" :subtree "https://github.com/cpitclaudel/compact-docstrings") ("company" :subtree "https://github.com/company-mode/company-mode.git") @@ -85,13 +86,16 @@ ("highlight-escape-sequences" :subtree "https://github.com/dgutov/highlight-escape-sequences/") ("hyperbole" :external "http://git.savannah.gnu.org/r/hyperbole.git") ("ioccur" :subtree "https://github.com/thierryvolpiatto/ioccur.git") + ("ivy-explorer" :external "https://github.com/clemera/ivy-explorer") ("js2-mode" :subtree "https://github.com/mooz/js2-mode.git") ("jsonrpc" :core "lisp/jsonrpc.el") ("let-alist" :core "lisp/emacs-lisp/let-alist.el") + ("map" :core "lisp/emacs-lisp/map.el") ("math-symbol-lists" :subtree "https://github.com/vspinu/math-symbol-lists.git") ("mmm-mode" :external "https://github.com/purcell/mmm-mode.git") ("nameless" :subtree "https://github.com/Malabarba/Nameless") ("names" :subtree "http://github.com/Malabarba/names") + ("objed" :external "https://github.com/clemera/objed") ("omn-mode" :external nil) ("orgalist" :external nil) ("ntlm" :core "lisp/net/ntlm.el") diff --git a/packages/counsel-ebdb/counsel-ebdb.el b/packages/counsel-ebdb/counsel-ebdb.el deleted file mode 100644 index a27229a..0000000 --- a/packages/counsel-ebdb/counsel-ebdb.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; counsel-ebdb.el --- Counsel integration for EBDB -*- lexical-binding: t; -*- - -;; Copyright (C) 2017 Free Software Foundation, Inc. - -;; Author: Eric Abrahamsen <e...@ericabrahamsen.net> -;; Maintainer: Eric Abrahamsen <e...@ericabrahamsen.net> -;; Version: 1 -;; Package-Requires: ((ivy "0.8.0") (ebdb "0.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 <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; Counsel/ivy integration for EBDB. - -;;; Code: - -(require 'ebdb) -(when t (require 'ivy)) - -;;;###autoload -(defun counsel-ebdb () - "Select EBDB contacts using the ivy/counsel interface." - (interactive) - (ivy-read - "Records: " - (mapcar - ;; This same lambda is used in helm-ebdb, refactor or maybe even - ;; make customizable. Presumably we could use the :matcher - ;; argument to provide a function that matched the name and mail - ;; strings, but then you wouldn't actually see the mail strings in - ;; the completion window, would you? - (lambda (rec) - (let* ((rec-string (ebdb-string rec)) - (mails (ebdb-record-mail-canon rec)) - (mail-list (when mails - (mapconcat #'identity - mails - " ")))) - (cons (if mail-list - (concat rec-string - " => " - mail-list) - rec-string) - rec))) - (ebdb-records)) - :action - '(1 - ("o" (lambda (r) - (ebdb-display-records (list (cdr r)) nil t)) "display") - ("m" (lambda (r) (ebdb-mail (cdr r))) "send mail") - ("i" (lambda (r) (ebdb-cite-records-mail (cdr r))) "insert")))) - -(provide 'counsel-ebdb) -;;; counsel-ebdb.el ends here diff --git a/packages/el-search/NEWS b/packages/el-search/NEWS index 138d2b5..e158df9 100644 --- a/packages/el-search/NEWS +++ b/packages/el-search/NEWS @@ -1,6 +1,11 @@ Some of the user visible news were: +Version: 1.9.0 + + This version adds some help commands available through the C-h help + prefix. + Version: 1.8.4 Quitting (C-g) while el-searching now brings you back to the diff --git a/packages/el-search/el-search-x.el b/packages/el-search/el-search-x.el index 58b5251..06ebd78 100644 --- a/packages/el-search/el-search-x.el +++ b/packages/el-search/el-search-x.el @@ -1,6 +1,6 @@ ;;; el-search-x.el --- Additional pattern definitions for el-search -*- lexical-binding: t -*- -;; Copyright (C) 2016-2018 Free Software Foundation, Inc +;; Copyright (C) 2016-2019 Free Software Foundation, Inc ;; Author: Michael Heerdegen <michael_heerde...@web.de> ;; Maintainer: Michael Heerdegen <michael_heerde...@web.de> diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el index 8652b15..c85197c 100644 --- a/packages/el-search/el-search.el +++ b/packages/el-search/el-search.el @@ -1,13 +1,13 @@ ;;; el-search.el --- Expression based interactive search for Emacs Lisp -*- lexical-binding: t -*- -;; Copyright (C) 2015-2018 Free Software Foundation, Inc +;; Copyright (C) 2015-2019 Free Software Foundation, Inc ;; Author: Michael Heerdegen <michael_heerde...@web.de> ;; Maintainer: Michael Heerdegen <michael_heerde...@web.de> ;; Created: 29 Jul 2015 ;; Keywords: lisp ;; Compatibility: GNU Emacs 25 -;; Version: 1.8.8 +;; Version: 1.9.4 ;; Package-Requires: ((emacs "25") (stream "2.2.4") (cl-print "1.0")) @@ -63,17 +63,24 @@ ;; "repeatable" where it makes sense so that you can for example hit ;; M-s e j s s s a % to reactive the last search, go to the next match ;; three times, then go back to the first match in the current buffer, -;; and finally invoke query-replace. +;; and finally invoke `el-search-query-replace'. ;; -;; Here is a complete list of key bindings installed when +;; It follows a complete list of key bindings installed when ;; you call +;; ;; (el-search-install-shift-bindings) +;; ;; or +;; ;; (el-search-install-bindings-under-prefix [(meta ?s) ?e]) ;; -;; respectively: +;; respectively. If you don't want to install any key bindings, you +;; at least want to remember the command name "el-search-pattern" or +;; its alias "el-search" to get a start, and that C-h will give you +;; access to some help commands; among other things C-h b listing the +;; relevant key bindings for controlling a search. ;; -;; C-S, M-s e s (el-search-pattern) +;; C-S, M-s e s (`el-search-pattern') ;; Start a search in the current buffer/go to the next match. ;; ;; While searching, the searched buffer is current (not the @@ -83,10 +90,16 @@ ;; hit RET to exit or C-g to abort and jump back to where you ;; started. ;; -;; C-R, M-s e r (el-search-pattern-backward) +;; C-h (aka the `help-char') +;; +;; C-h offers access to some help commands special to el-search +;; when a search is active. Among other things C-h b (or ?) gives +;; you a list of bindings to control the search. +;; +;; C-R, M-s e r (`el-search-pattern-backward') ;; Search backward. ;; -;; C-%, M-s e % (el-search-query-replace) +;; C-%, M-s e % (`el-search-query-replace') ;; Do a query-replace. ;; ;; M-x el-search-directory @@ -94,26 +107,26 @@ ;; Emacs-Lisp files in that directory. With prefix arg, ;; recursively search files in subdirectories. ;; -;; C-S, M-s e s in Dired (el-search-dired-marked-files) +;; C-S, M-s e s in Dired (`el-search-dired-marked-files') ;; Like above but uses the marked files and directories. ;; -;; C-S, M-s e s in Ibuffer (el-search-ibuffer-marked-buffers) +;; C-S, M-s e s in Ibuffer (`el-search-ibuffer-marked-buffers') ;; Search marked buffers in *Ibuffer*. ;; -;; C-O, M-s e o (el-search-occur) +;; C-O, M-s e o (`el-search-occur') ;; Pop up an occur buffer for the current search. ;; ;; C-O or M-RET (from a search pattern prompt) ;; Execute this search command as occur. ;; -;; C-N, M-s e n (el-search-continue-in-next-buffer) +;; C-N, M-s e n (`el-search-continue-in-next-buffer') ;; Skip over current buffer or file. ;; -;; C-D, M-s e d (el-search-skip-directory) +;; C-D, M-s e d (`el-search-skip-directory') ;; Prompt for a directory name and skip all subsequent files ;; located under this directory. ;; -;; C-A, M-s e a, M-s e < (el-search-from-beginning) +;; C-A, M-s e a, M-s e < (`el-search-from-beginning') ;; Go back to the first match in this buffer or (with positive ;; prefix arg) completely restart the current search from the ;; first file or buffer. @@ -121,7 +134,7 @@ ;; With negative prefix arg, or with >, go to the last match in ;; the current buffer. ;; -;; C-J, M-s e j (el-search-jump-to-search-head) +;; C-J, M-s e j (`el-search-jump-to-search-head') ;; Resume the last search from the position of the last visited ;; match. ;; With prefix arg 0, resume from the position of the match @@ -132,13 +145,13 @@ ;; With a plain C-u prefix arg, prompt for a former search to ;; resume. ;; -;; C-S-next, v when search is active (el-search-scroll-down) -;; C-S-prior, V when search is active (el-search-scroll-up) +;; C-S-next, v when search is active (`el-search-scroll-down') +;; C-S-prior, V when search is active (`el-search-scroll-up') ;; Scrolling by matches: Select the first match after ;; `window-end', or select the first match before `window-start', ;; respectively. ;; -;; C-H, M-s e h (el-search-this-sexp) +;; C-H, M-s e h (`el-search-this-sexp') ;; Grab the symbol or sexp under point and initiate an el-search ;; for other occurrences. ;; @@ -410,8 +423,6 @@ ;; ;; TODO: ;; -;; - Add a help command that can be called while searching. -;; ;; - Make searching work in comments, too? (-> ;; `parse-sexp-ignore-comments'). Related: should the pattern ;; `symbol' also match strings that contain matches for a symbol so @@ -437,6 +448,7 @@ ;;;; Requirements (eval-when-compile (require 'subr-x)) +(eval-when-compile (require 'help-macro)) ;make-help-screen (unless (require 'rmc nil t) ;read-multiple-choice (require 'subr-x)) @@ -453,6 +465,7 @@ (require 'ring) ;el-search-history (require 'hideshow) ;folding in *El Occur* (require 'outline) ;folding in *El Occur* +(eval-when-compile (require 'easymenu)) ;;;; Configuration stuff @@ -559,7 +572,7 @@ following cases from the prompt." (const :tag "On" t) (const :tag "Ask" ask))) -(defvar el-search-use-transient-map nil +(defvar el-search-use-transient-map t "Whether el-search should make commands repeatable." ;; I originally wanted to make commands repeatable by looking at the ;; command keys. But that got overly complicated: It interfered with @@ -577,6 +590,9 @@ following cases from the prompt." ;; explicitly install the transient map themselves. '(el-search-pattern el-search-pattern-backward + el-search-help-list-bindings + el-search-help-for-help + describe-key el-search-from-beginning el-search-last-buffer-match el-search-continue-in-next-buffer @@ -1193,6 +1209,16 @@ after/before the origin of the search." (el-search-heuristic-matcher pattern) count)) +(defvar el-search-quick-help-buffer-name "*El-Search Quick Help*") +(defvar-local el-search-help-window nil) + +(defun el-search-close-quick-help-maybe () + (when-let* ((help-buffer (get-buffer el-search-quick-help-buffer-name)) + (help-win (buffer-local-value 'el-search-help-window help-buffer)) + ((window-live-p help-win))) + (delete-window help-win) + t)) + ;; FIXME: make this also a declaration spec? (defun el-search-defpattern--check-args (type args predicate &optional message) @@ -1487,8 +1513,8 @@ PATTERN and combining the heuristic matchers of the subpatterns." (walker tree) elements))) -(defun el-search-heuristic-buffer-matcher (pattern) - (let ((heuristic-matcher (el-search-heuristic-matcher pattern))) +(defun el-search-heuristic-buffer-matcher (pattern &optional hm) + (let ((heuristic-matcher (or hm (el-search-heuristic-matcher pattern)))) (lambda (file-name-or-buffer) (el-search--message-no-log "%s" (if (stringp file-name-or-buffer) @@ -1684,10 +1710,10 @@ position of the beginning of the match." (defun el-search--set-head-pattern (head pattern) (setf (el-search-head-matcher head) (el-search-make-matcher pattern)) - (setf (el-search-head-heuristic-matcher head) - (el-search-heuristic-matcher pattern)) - (setf (el-search-head-heuristic-buffer-matcher head) - (el-search-heuristic-buffer-matcher pattern)) + (let ((hm (el-search-heuristic-matcher pattern))) + (setf (el-search-head-heuristic-matcher head) hm) + (setf (el-search-head-heuristic-buffer-matcher head) + (el-search-heuristic-buffer-matcher pattern hm))) head) (defun el-search-compile-pattern-in-search (search) @@ -1789,12 +1815,18 @@ Go back to the place where the search had been started." (goto-char (car el-search--search-origin)) (unless dont-quit (signal 'quit nil))) +(defvar el-search-help-map (make-sparse-keymap)) + (defvar el-search-basic-transient-map - (let ((transient-map (make-sparse-keymap))) - (define-key transient-map [return] #'el-search-pause-search) - (define-key transient-map (kbd "RET") #'el-search-pause-search) - (define-key transient-map [(control ?g)] #'el-search-keyboard-quit) - transient-map)) + (let ((map (make-sparse-keymap))) + (define-key map [return] #'el-search-pause-search) + (define-key map (kbd "RET") #'el-search-pause-search) + (define-key map [(control ?g)] #'el-search-keyboard-quit) + (define-key map [??] #'el-search-help-list-bindings) + (define-key map `[,help-char] el-search-help-map) + (define-key map [help] el-search-help-map) + (define-key map [f1] el-search-help-map) + map)) (defvar el-search-prefix-key-transient-map (let ((transient-map (make-sparse-keymap))) @@ -1847,6 +1879,7 @@ active search it is recommended to advice this function." ;;;###autoload (defun el-search-install-shift-bindings () (interactive) + (setq el-search-use-transient-map nil) (el-search-loop-over-bindings #'el-search-shift-bindings-bind-function) (define-key el-search-basic-transient-map [C-S-next] #'el-search-scroll-down) (define-key el-search-basic-transient-map [C-S-prior] #'el-search-scroll-up)) @@ -1910,6 +1943,148 @@ that contain a file named \".nosearch\" are excluded as well." t #'el-search--elisp-file-p)) +;;;; Help stuff + +(make-help-screen el-search-help-for-help-internal + "Type a help option: [bmikp] or ?" + "You have typed %THIS-KEY%, the help character. Type a Help option: +\(Type \\<help-map>\\[help-quit] to exit or \ +\\<help-map>\\[help-quit] \\[el-search-jump-to-search-head] to \ +continue searching.) + +b Display el-search key bindings. +m Display key bindings with some documentation. +i Read the introduction. +k KEYS Display full documentation of key sequence. +p List defined patterns. + +You can't type here other help keys available in the global help +map until you finished el-searching." + el-search-help-map) + +(defun el-search-help-for-help () + (interactive) + (let ((display-buffer-overriding-action '(nil (inhibit-same-window . t)))) + (el-search-help-for-help-internal))) + +(defun el-search-help-list-bindings--1 (&optional verbose) + (cl-flet* ((keys-string + (lambda (cmd-name) + (let* ((get-keys + (lambda (&optional map) + (seq-filter + (lambda (binding) + (pcase binding + ((seq 'menu-bar) nil) + (_ t))) + (where-is-internal cmd-name (and map (list map)))))) + (tmap (if el-search-use-transient-map + el-search-prefix-key-transient-map + el-search-basic-transient-map)) + (keys (nreverse (or (funcall get-keys tmap) + (funcall get-keys))))) + (if keys (mapconcat #'key-description keys ", ") + "no key")))) + (cmd-help + (lambda (cmd-name) + (let* ((maxl 34) + (add-padding + (lambda (s) + (let ((sl (length s))) + (concat (if (<= maxl sl) s + (concat s " " (make-string (- maxl sl 1) ?.))) + " "))))) + (princ (if verbose + (concat + "`" (symbol-name cmd-name) "'" + " (" (keys-string cmd-name) ")\n" + (when-let ((docstring (documentation cmd-name))) + (string-match "\\(\\`.*$\\)" docstring) + (concat (match-string 1 docstring) "\n")) + "\n") + (concat " " + (funcall add-padding (symbol-name cmd-name)) + (keys-string cmd-name) + "\n"))))))) + (princ "Bindings for controlling el-searches:\n\n") + (cmd-help 'el-search-pattern) + (cmd-help 'el-search-pattern-backward) + (cmd-help 'el-search-help-list-bindings) + (cmd-help 'el-search-help-list-bindings-verbose) + (cmd-help 'el-search-pause-search) + (cmd-help 'el-search-keyboard-quit) + (cmd-help 'el-search-occur) + (cmd-help 'el-search-jump-to-search-head) + (cmd-help 'el-search-from-beginning) + (cmd-help 'el-search-last-buffer-match) + (cmd-help 'el-search-scroll-down) + (cmd-help 'el-search-scroll-up) + (cmd-help 'el-search-continue-in-next-buffer) + (cmd-help 'el-search-skip-directory) + (cmd-help 'el-search-to-register) + (cmd-help 'el-search-query-replace) + (unless verbose (princ (substitute-command-keys " +Toggle visibility of this window with \ +`\\<el-search-basic-transient-map>\\[el-search-help-list-bindings]'")))) + standard-output) + +(defun el-search-help-list-bindings () + "Toggle quick help window." + (interactive) + (setq this-command 'el-search-pattern) + (unless (el-search-close-quick-help-maybe) + (let ((help-buffer (get-buffer-create el-search-quick-help-buffer-name))) + (with-current-buffer help-buffer + (let ((inhibit-read-only t)) + (erase-buffer))) + (let ((standard-output help-buffer)) + (el-search-help-list-bindings--1)) + (let ((help-window (display-buffer-pop-up-window help-buffer '()))) + (fit-window-to-buffer help-window) + (with-current-buffer help-buffer + (setq-local el-search-help-window help-window)))))) + +(defun el-search-help-list-bindings-verbose () + "List bindings and first lines of documentation." + (interactive) + (with-help-window (help-buffer) + (el-search-help-list-bindings--1 'verbose))) + +(defun el-search-help-list-patterns () + (interactive) + (describe-function 'el-search-defined-patterns)) + +(defun el-search-help-read-intro () + (interactive) + (with-output-to-temp-buffer "*Help*" + (princ "\ +Introduction to El-Search +=========================\n\n\n") + (princ (string-trim + (replace-regexp-in-string + "^;+ ?" "" + (with-temp-buffer + (insert-file-contents (locate-library "el-search.el")) + (save-excursion + (search-forward ";;; Commentary:") + (buffer-substring-no-properties + (point) + (progn (search-forward ";; Acknowledgments") + (forward-line -1) + (point)))))))))) + +(define-key el-search-help-map `[,help-char] #'el-search-help-for-help) +(define-key el-search-help-map [help] #'el-search-help-for-help) +(define-key el-search-help-map [f1] #'el-search-help-for-help) +(define-key el-search-help-map [??] #'el-search-help-for-help) +(define-key el-search-help-map [?b] #'el-search-help-list-bindings) +(define-key el-search-help-map [?m] #'el-search-help-list-bindings-verbose) +(define-key el-search-help-map [?p] #'el-search-help-list-patterns) +(define-key el-search-help-map [?i] #'el-search-help-read-intro) +(define-key el-search-help-map [?k] #'describe-key) +(define-key el-search-help-map [?q] #'help-quit) + + ;;;; Additional pattern type definitions (defun el-search-regexp-like-p (thing) @@ -2402,7 +2577,8 @@ local binding of `window-scroll-functions'." (el-search-hl-remove) (remove-hook 'post-command-hook 'el-search-hl-post-command-fun t) (setq el-search--temp-buffer-flag nil) - (el-search-kill-left-over-search-buffers))))) + (el-search-kill-left-over-search-buffers) + (el-search-close-quick-help-maybe))))) (defun el-search--pending-search-p () (memq #'el-search-hl-post-command-fun post-command-hook)) @@ -2429,12 +2605,11 @@ local binding of `window-scroll-functions'." (el-search--skip-to-next-buffer)) (defun el-search-jump-to-search-head (&optional arg) - "Switch to current search buffer and go to the last visited match. -This resumes the last active search. With plain C-u prefix -argument, prompt for a former search to resume, and make that the -current search. - -Any other numeric prefix arg has the following meaning: + "Resume a search or jump to the specified match. +Resume the last active search and select the last match found. +With plain C-u prefix argument, prompt for a former search to +resume, and make that the current search. Any other numeric +prefix arg has the following meaning: 0: go to the match following point N: go to the Nth match after `window-start' @@ -2559,8 +2734,8 @@ continued." (interactive "P") (setq this-command 'el-search-pattern) (unless (eq last-command this-command) - (el-search--set-search-origin-maybe)) - (el-search-compile-pattern-in-search el-search--current-search) + (el-search--set-search-origin-maybe) + (el-search-compile-pattern-in-search el-search--current-search)) (el-search-protect-search-head (unwind-protect (let* ((old-current-buffer (current-buffer)) @@ -2706,6 +2881,9 @@ See `el-search-defined-patterns' for a list of defined patterns." (lambda (search) (setf (alist-get 'is-single-buffer (el-search-object-properties search)) t)) 'from-here)))) +;;;###autoload +(defalias 'el-search #'el-search-pattern) + (defmacro el-search--unless-no-buffer-match (&rest body) "Execute BODY unless no match for current search in current buffer. In this case, ignore BODY and emit a message saying \"No matches\". @@ -2971,9 +3149,12 @@ Use the normal search commands to seize the search." (defvar-local el-search-occur-search-object nil) +(defvar el-search-occur--outline-visible t) (defun el-search-occur-revert-function (&rest _) - (el-search--occur el-search-occur-search-object t)) + (el-search--occur el-search-occur-search-object t) + (unless el-search-occur--outline-visible + (outline-hide-leaves))) (defun el-search-edit-occur-pattern (new-pattern) "Change the search pattern associated with this *El Occur* buffer. @@ -3113,8 +3294,6 @@ Prompt for a new pattern and revert." (el-search-occur--next-match 'backward)) -(defvar el-search-occur--outline-visible t) - (defun el-search-occur-cycle () "Cycle between showing an outline and everything." (interactive) @@ -3187,7 +3366,16 @@ Prompt for a new pattern and revert." (el-search--end-of-sexp match-beg))))) (defun el-search-occur-get-defun-context (match-beg) - (el-search--bounds-of-defun match-beg)) + (let ((bounds (el-search--bounds-of-defun match-beg))) + (save-excursion + (goto-char (car bounds)) + (let ((done nil)) + (while (not (or done (bobp))) + (forward-line -1) + (if (looking-at-p "[[:space:]]*;") + (setf (car bounds) (point)) + (setq done t))))) + bounds)) (defun el-search-occur-get-null-context (match-beg) (cons match-beg (el-search--end-of-sexp match-beg))) @@ -4331,5 +4519,62 @@ Reuse already given input." (call-interactively #'el-search-search-from-isearch)) +;;;; Menus + +;;;###autoload +(progn + (require 'easymenu) + + (easy-menu-add-item + nil '("Tools") + `("El-Search" + ["Search Directory" el-search-directory] + ["Search Directory Recursively" + ,(lambda () (interactive) + (let ((current-prefix-arg '(4))) + (call-interactively #'el-search-directory)))] + ["Search 'load-path'" el-search-load-path] + ["Search Emacs Elisp Sources" el-search-emacs-elisp-sources] + ["Search Elisp Buffers" el-search-buffers])) + + (easy-menu-add-item + (lookup-key emacs-lisp-mode-map [menu-bar]) '("Emacs-Lisp") + `("El-Search" + ["Forward" el-search-pattern] + ["Backward" el-search-pattern-backward] + ["Sexp at Point" el-search-this-sexp] + ["Resume Last Search" el-search-jump-to-search-head :enable el-search--current-search] + ["Resume Former Search" ,(lambda () (interactive) (el-search-jump-to-search-head '(4))) + :enable (cdr (ring-elements el-search-history))] + ["Query-Replace" el-search-query-replace :enable (not buffer-read-only)] + ["Occur" ,(lambda () (interactive) + (defvar el-search-occur-flag) + (let ((el-search-occur-flag t)) (call-interactively #'el-search-pattern)))]))) + +(easy-menu-define nil el-search-occur-mode-map "El Occur Menu" + `("El-Occur" + ["Next Match" el-search-occur-next-match + :help "Go to the next match"] + ["Previous Match" el-search-occur-previous-match + :help "Go to the previous match"] + ["Jump to Source" el-search-occur-jump-to-match + :help "Jump to corresponding position in source"] + ["Adjust Pattern" el-search-edit-occur-pattern + :help "Edit search pattern and revert"] + ("Context" + ["No context" el-search-occur-no-context + :style radio + :selected (eq el-search-get-occur-context-function 'el-search-occur-get-null-context)] + ["Some context" el-search-occur-some-context + :style radio + :selected (eq el-search-get-occur-context-function 'el-search-occur-get-some-context)] + ["Top-Level" el-search-occur-defun-context + :style radio + :selected (eq el-search-get-occur-context-function 'el-search-occur-get-defun-context)]) + ("Outline" + ["Hide all" el-search-occur-cycle :style radio :selected (not el-search-occur--outline-visible)] + ["Show All" el-search-occur-cycle :style radio :selected el-search-occur--outline-visible]))) + + (provide 'el-search) ;;; el-search.el ends here diff --git a/packages/helm-ebdb/helm-ebdb.el b/packages/helm-ebdb/helm-ebdb.el deleted file mode 100644 index fc8af46..0000000 --- a/packages/helm-ebdb/helm-ebdb.el +++ /dev/null @@ -1,83 +0,0 @@ -;;; helm-ebdb.el --- Helm integration for EBDB -*- lexical-binding: t; -*- - -;; Copyright (C) 2017 Free Software Foundation, Inc. - -;; Author: Eric Abrahamsen <e...@ericabrahamsen.net> -;; Maintainer: Eric Abrahamsen <e...@ericabrahamsen.net> -;; Keywords: mail, convenience -;; Version: 1 -;; Package-Requires: ((helm "1.0") (ebdb "0.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 <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; Helm integration for EBDB. Provides the command `helm-ebdb'. - -;;; Code: - -(require 'ebdb) -(when t (require 'helm)) - -(declare-function ebdb-display-records "ext:ebdb-com" - (records &optional fmt append select pop buf)) - -(defun helm-ebdb-candidates () - "Return a list of all records in the database." - (mapcar (lambda (rec) - (let* ((rec-string (ebdb-string rec)) - (mails (ebdb-record-mail-canon rec)) - (mail-list (when mails - (mapconcat #'identity - mails - " ")))) - (cons (if mail-list - (concat rec-string - " => " - mail-list) - rec-string) - rec))) - (ebdb-records))) - -(defun helm-ebdb-display-records (candidate) - "Display CANDIDATE or marked candidates." - (let ((recs (or (helm-marked-candidates) (list candidate)))) - (ebdb-display-records recs nil nil t nil - (format "*%s*" ebdb-buffer-name)))) - -(defun helm-ebdb-compose-mail (candidate) - "Compose mail to CANDIDATE or marked candidates." - (let ((recs (or (helm-marked-candidates) (list candidate)))) - (ebdb-mail recs nil t))) - -(defun helm-ebdb-cite-records (candidate) - "Insert Name <email> string for CANDIDATE or marked candidate." - (let ((recs (or (helm-marked-candidates) (list candidate)))) - (ebdb-cite-records recs))) - -(defvar helm-source-ebdb - '((name . "EBDB") - (candidates . helm-ebdb-candidates) - (action . (("Display" . helm-ebdb-display-records) - ("Send mail" . helm-ebdb-compose-mail) - ("Insert name and address" . helm-ebdb-cite-records))))) - -;;;###autoload -(defun helm-ebdb () - "Preconfigured `helm' for EBDB." - (interactive) - (helm-other-buffer 'helm-source-ebdb "*helm ebdb*")) - -(provide 'helm-ebdb) -;;; helm-ebdb.el ends here diff --git a/packages/iterators/iterators.el b/packages/iterators/iterators.el index b333ff8..f75dc90 100644 --- a/packages/iterators/iterators.el +++ b/packages/iterators/iterators.el @@ -1,6 +1,6 @@ ;;; iterators.el --- Functions for working with iterators -*- lexical-binding: t -*- -;; Copyright (C) 2015-2018 Free Software Foundation, Inc +;; Copyright (C) 2015-2019 Free Software Foundation, Inc ;; Author: Michael Heerdegen <michael_heerde...@web.de> ;; Maintainer: Michael Heerdegen <michael_heerde...@web.de> diff --git a/packages/on-screen/on-screen.el b/packages/on-screen/on-screen.el index 6e9df0b..954591a 100644 --- a/packages/on-screen/on-screen.el +++ b/packages/on-screen/on-screen.el @@ -1,6 +1,6 @@ ;;; on-screen.el --- guide your eyes while scrolling -*- lexical-binding: t -*- -;; Copyright (C) 2013-2018 Free Software Foundation, Inc +;; Copyright (C) 2013-2019 Free Software Foundation, Inc ;; Author: Michael Heerdegen <michael_heerde...@web.de> ;; Maintainer: Michael Heerdegen <michael_heerde...@web.de> diff --git a/packages/smart-yank/smart-yank.el b/packages/smart-yank/smart-yank.el index 0c64c08..ceb7428 100644 --- a/packages/smart-yank/smart-yank.el +++ b/packages/smart-yank/smart-yank.el @@ -1,6 +1,6 @@ ;;; smart-yank.el --- A different approach of yank pointer handling -*- lexical-binding: t -*- -;; Copyright (C) 2016-2018 Free Software Foundation, Inc +;; Copyright (C) 2016-2019 Free Software Foundation, Inc ;; Author: Michael Heerdegen <michael_heerde...@web.de> ;; Maintainer: Michael Heerdegen <michael_heerde...@web.de> diff --git a/packages/stream/stream-x.el b/packages/stream/stream-x.el index f916caf..9a4ede1 100644 --- a/packages/stream/stream-x.el +++ b/packages/stream/stream-x.el @@ -1,6 +1,6 @@ ;;; stream-x.el --- Additional functions for working with streams -*- lexical-binding: t -*- -;; Copyright (C) 2017 - 2018 Free Software Foundation, Inc +;; Copyright (C) 2017 - 2019 Free Software Foundation, Inc ;; Author: Michael Heerdegen <michael_heerde...@web.de> ;; Maintainer: Michael Heerdegen <michael_heerde...@web.de>