[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eev 95397ce 02/64: Added `ee-copy-after-and' and `find-
From: |
Stefan Monnier |
Subject: |
[elpa] externals/eev 95397ce 02/64: Added `ee-copy-after-and' and `find-eejumps' |
Date: |
Sun, 7 Apr 2019 16:59:01 -0400 (EDT) |
branch: externals/eev
commit 95397ce57655376b97b55116a10523618530d0f7
Author: Eduardo Ochs <address@hidden>
Commit: Eduardo Ochs <address@hidden>
Added `ee-copy-after-and' and `find-eejumps'
---
eejump.el | 5 +-
eev-blinks.el | 33 ++++++++++-
eev-intro.el | 79 ++++++++++++++++++++++++--
eev-mode.el | 2 +-
eev-tlinks.el | 178 +++++++++++++++++++++++++++++-----------------------------
5 files changed, 199 insertions(+), 98 deletions(-)
diff --git a/eejump.el b/eejump.el
index c1367ff..38d660e 100644
--- a/eejump.el
+++ b/eejump.el
@@ -93,10 +93,11 @@ See: (find-eejump-intro \"\\neejump\\n\")"
-(provide 'eejump)
-
+(provide 'eejump)
+;; To see all current targets, run:
+;; (find-eejumps)
diff --git a/eev-blinks.el b/eev-blinks.el
index 790eb2a..d5a7d40 100644
--- a/eev-blinks.el
+++ b/eev-blinks.el
@@ -3,7 +3,7 @@
;;; and that are not created by `code-c-d' and friends.
;; Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,
-;; 2009,2010,2011,2012 Free Software Foundation, Inc.
+;; 2009,2010,2011,2012,2013 Free Software Foundation, Inc.
;;
;; This file is (not yet) part of GNU eev.
;;
@@ -22,7 +22,7 @@
;;
;; Author: Eduardo Ochs <address@hidden>
;; Maintainer: Eduardo Ochs <address@hidden>
-;; Version: 2012nov08
+;; Version: 2013aug28
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-blinks.el>
@@ -732,6 +732,35 @@ Examples: (find-echarsetchars 'mule-unicode-0100-24ff
\"733x\")
+;;; __ _ _ _
+;;; / _(_)_ __ __| | ___ ___ (_)_ _ _ __ ___ _ __ ___
+;;; | |_| | '_ \ / _` |_____ / _ \/ _ \| | | | | '_ ` _ \| '_ \/ __|
+;;; | _| | | | | (_| |_____| __/ __/| | |_| | | | | | | |_) \__ \
+;;; |_| |_|_| |_|\__,_| \___|\___|/ |\__,_|_| |_| |_| .__/|___/
+;;; |__/ |_|
+;;
+;; A hack to diplay all the current eejump targets.
+;; Should this be here? See: (find-eev "eejump.el")
+;; Try: (find-eejumps)
+
+(defun ee-defun-sexp-for (symbol)
+ `(defun ,symbol ,@(cdr (symbol-function symbol))))
+
+(defun ee-defun-str-for (symbol)
+ (replace-regexp-in-string
+ "^(defun \\([^ ]+\\) nil " "(defun \\1 () "
+ (ee-S (ee-defun-sexp-for symbol))))
+
+(defun eejump-symbols ()
+ (apropos-internal "^eejump-[0-9]*\\*?$"))
+
+(defun find-eejumps (&rest pos-spec-list) (interactive)
+ (apply 'find-estring-elisp
+ (mapconcat 'eejump-defun-str-for (eejump-symbols) "\n")
+ pos-spec-list))
+
+
+
(provide 'eev-blinks)
diff --git a/eev-intro.el b/eev-intro.el
index 1c0a599..1528187 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -19,7 +19,7 @@
;;
;; Author: Eduardo Ochs <address@hidden>
;; Maintainer: Eduardo Ochs <address@hidden>
-;; Version: 2013aug18
+;; Version: 2013aug26
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-intro.el>
@@ -1331,6 +1331,9 @@ Try this, with `M-2 M-e' on each line:
The first line regenerates the buffer
=====================================
+\[To do: explain this convention with examples; explain the
+conventions for the \"variants of the first line\"\]
+
(find-find-links-links)
(find-find-links-links \"\\\\M-u\")
(find-find-links-links \"\\\\M-u\" \"USERTEST\")
@@ -1342,8 +1345,26 @@ The first line regenerates the buffer
Pointing to where we are now
============================
+Several of the `M-h' commands are mainly meant to help us
+generate hyperlinks to \"where we are now\": to the current file,
+to the current Info page, to the current `find-*-intro', to an
+Emacs function or variable we are inspecting, to the current
+buffer, and so on. They don't try to be very smart -
+
+\[To do: write this\]
+
+ (find-efunctiondescr 'eev-mode)
+ (find-efunctiondescr 'eev-mode \"M-h f\")
+
+ (eek \"M-h M-i\")
- - for example, `M-h M-i' generates links to
+ (find-enode \"Lisp Eval\")
+ (progn (find-enode \"Lisp Eval\") (eek \"M-h M-i\"))
+
+ (eek \"M-h f ;; find-file-links\")
+ (eek \"M-h M-b ;; find-ebuffer-links\")
+
+ for example, `M-h M-i' generates links to
the current \"intro\" buffer - like this one - _and_ to the
current Info page (the \"i\" in `M-h M-i' has two meanings).
Try:
@@ -1365,10 +1386,58 @@ Pointing to where we are now
+The rest of the buffer
+======================
- (find-enode \"Easy Customization\")
-
-
+Several elisp hyperlinks buffers are composed of two parts: a
+series of links at the top, and then a template-generated text
+that is mean to be copied to somewhere else. The canonical
+example is
+
+ (find-eev-update-links)
+
+which ends with stuff that you can copy to your .emacs file to
+make Emacs load eev by default. The end of the buffer generated
+by `find-eev-update-links' looks more or less like this:
+
+ ____________________________________________________________
+ |# (ee-copy-rest 0 '(find-fline \"~/.emacs\")) |
+ | |
+ |;; Load eev2. |
+ |;; See: (find-file \"~/eev/\") |
+ |;; (find-file \"~/eev/eev-readme.el\") |
+ |;; Generated by: (find-eev-update-links \"~/eev/\") |
+ |;; |
+ |(add-to-list 'load-path \"~/eev/\") |
+ |(require 'eev2-all) ; (find-eev \"eev2-all.el\") |
+ |(eev-mode 1) ; (find-eev \"eev-mode.el\") |
+ | |
+ | |
+ |--:**- *Elisp hyperlinks* Bot L56 (Fundamental eev)---|
+ |____________________________________________________________|
+
+The line with `ee-copy-rest' is a hack. Its first argument is a
+number, that we will call the \"skip\", and the second is
+a (quoted) sexp hyperlink, that we will call the \"code\". The
+rule that defines what is the \"rest of the buffer\" is this:
+
+ Move to the beginning of the next line, then skip (i.e., move
+ down) more SKIP lines. The rest of the buffer is everything
+ from that point on.
+
+A sexp like `(ee-copy-rest ...)' does several things:
+
+ 1) it highlights the rest of the buffer temporarily (like as
+ with `M-0 M-e'),
+
+ 2) it copies the rest of the buffer to the kill ring (like as
+ with `M-w'),
+
+ 3) it runs CODE to open its target in a window at the right
+ side (like as with `M-3 M-e')
+
+\[To do: add examples - including examples that let us create Lua
+scripts etc\]
" rest)))
diff --git a/eev-mode.el b/eev-mode.el
index 783a057..2730359 100644
--- a/eev-mode.el
+++ b/eev-mode.el
@@ -169,7 +169,7 @@ Commands to generate pages with lists of hyperlinks:
\\[find-file-links] -- hyperlinks to the current file
\\[find-grep-links] -- hyperlinks to `find-xxxgrep' sexps
\\[find-efunction-links] -- hyperlinks to an Emacs function
- \\[find-einfo-links] -- hyperlinks to the current Info node
+ \\[find-einfo-links] -- hyperlinks to the current Info node (or intro)
\\[find-ekey-links] -- hyperlinks to a key sequence and to the function
associated to it
\\[find-evariable-links] -- hyperlinks to an Emacs variable
diff --git a/eev-tlinks.el b/eev-tlinks.el
index b193bc8..57f8a11 100644
--- a/eev-tlinks.el
+++ b/eev-tlinks.el
@@ -19,7 +19,7 @@
;;
;; Author: Eduardo Ochs <address@hidden>
;; Maintainer: Eduardo Ochs <address@hidden>
-;; Version: 2013aug23
+;; Version: 2013aug26
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-tlinks.el>
@@ -66,22 +66,43 @@
;; A hack for template-based find-*-links functions in which the
;; second half of the buffer in meant to be copied to somewhere else.
;;
+(defvar eeflash-copy '(highlight 0.5))
+
(defun ee-count-lines (str)
"Count the number of lines in STR (which should be newline-terminated)."
(length (replace-regexp-in-string "[^\n]" "" str)))
-(defun ee-copy-after-and (nlines code)
- "Copy into the kill ring everything from NLINES down on, and run CODE."
- (move-beginning-of-line (- nlines 1))
- (kill-new (buffer-substring (point) (point-max)))
- (eval code)
- (let ((n (ee-count-lines (ee-last-kill))))
- `(Copied ,n lines to the kill ring - use C-y to paste)))
-
-(defun ee-copy-after-and-2b (nlines code)
- "Copy into the kill ring everything from NLINES down on, and run CODE.
-The target of the hyperlink in CODE is opened in the right-side window."
- (ee-copy-after-and nlines `(find-2b nil ',code)))
+(defun ee-copy-rest (skip code)
+ (ee-copy-rest0 skip `(find-2b nil ',code)))
+
+(defun ee-copy-rest0 (skip code)
+ "Copy the rest of this buffer to the kill ring and execute CODE.
+The rest of this buffer is everything from the beginning of the next line -
+optionally moving down SKIP lines - to the end of the buffer."
+ ;; (setq nlines (+ 1 (or nlines 0)))
+ (setq skip (or skip 0))
+ (let* ((start (save-excursion (move-beginning-of-line (+ 2 skip)) (point)))
+ (end (point-max))
+ (str (buffer-substring start end))
+ (len (ee-count-lines str))
+ (msg `(Copied ,len lines to the kill ring - use C-y to paste)))
+ (eeflash+ start end eeflash-copy)
+ (kill-new str)
+ (eval code)
+ msg))
+
+;; (defun ee-copy-after-and (nlines code)
+;; "Copy into the kill ring everything from NLINES down on, and run CODE."
+;; (move-beginning-of-line (- nlines 1))
+;; (kill-new (buffer-substring (point) (point-max)))
+;; (eval code)
+;; (let ((n (ee-count-lines (ee-last-kill))))
+;; `(Copied ,n lines to the kill ring - use C-y to paste)))
+;;
+;; (defun ee-copy-after-and-2b (nlines code)
+;; "Copy into the kill ring everything from NLINES down on, and run CODE.
+;; The target of the hyperlink in CODE is opened in the right-side window."
+;; (ee-copy-after-and nlines `(find-2b nil ',code)))
@@ -510,10 +531,10 @@ sudo dpkg -i *.deb
(interactive)
(setq dir (or dir ee-eevdir))
(apply 'find-elinks
- `((find-eev-update-links ,dir ,@pos-spec-list)
- (find-eev-update-links "/tmp/eev/" ,@pos-spec-list)
- (find-eev-update-links "~/eev/" ,@pos-spec-list)
- (find-eev-update-links "{dir}" ,@pos-spec-list)
+ `((find-eev-update-links ,dir)
+ (find-eev-update-links "/tmp/eev/")
+ (find-eev-update-links "~/eev/")
+ (find-eev-update-links "{dir}")
,(ee-template0 "\
#
# In most \"*Elisp hyperlinks\" buffers the top sexp can be used
@@ -554,9 +575,9 @@ emacs -fg bisque -bg black eev-readme.el
# Emacs executes the file ~/.emacs when it starts up - see:
# (find-enode \"Init File\")
# The easiest way to make Emacs load eev2 by default is to
-# open your ~/.emacs in another window with:
-# (find-wset \"1so_o\" '(find-fline \"~/.emacs\"))
-# and then copy the elisp code below to it.
+# open your ~/.emacs in another window with the sexp below,
+# and then copy the block below to it with `C-y'.
+# (ee-copy-rest 0 '(find-fline \"~/.emacs\"))
;; Load eev2.
;; See: (find-file \"{dir}\")
@@ -1223,60 +1244,12 @@ echo '{url}' >> ~/.psne.log
;; �find-git-links� (to ".find-git-links")
;; (find-find-links-links "g" "git" "usrc/ git/ gitname")
+;; (find-find-links-links "g" "git" "url c")
(define-key eev-mode-map "\M-hg" 'find-git-links-1)
+(define-key eev-mode-map "\M-hg" 'find-git-links)
-(defun find-git-links (&optional usrc/ git/ gitname c &rest pos-spec-list)
-"Visit a temporary buffer containing scripts for acting on a Git URL.
-This is normally invoked interactively via `find-git-links-1' (`M-h g').
-I have VERY LITTLE experience with Git, so these scripts are kind of silly.
-Please send suggestions!"
- ;; (interactive)
- (setq usrc/ (or usrc/ "{usrc/}"))
- (setq git/ (or git/ "{git/}"))
- (setq gitname (or gitname "{gitname}"))
- (setq c (or c "{c}"))
- (apply 'find-elinks
- `((find-git-links ,usrc/ ,git/ ,gitname ,c ,@pos-spec-list)
- (find-git-links "/tmp/" ,git/ ,gitname ,c ,@pos-spec-list)
- (find-git-links "~/usrc/" ,git/ ,gitname ,c ,@pos-spec-list)
- ;; Convention: the first sexp always regenerates the buffer.
- ;; (find-efunction 'find-git-links)
- ;; ""
- ,(ee-template0 "\
-{ee-H}(find-efunction 'find-git-links-1)
-{ee-H}(find-efunction 'find-git-links)
-{ee-H}{git/}{gitname}
-
- (eepitch-shell)
- (eepitch-kill)
- (eepitch-shell)
-rm -Rfv {usrc/}{gitname}/
-mkdir {usrc/}{gitname}/
-cd {usrc/}
-git clone {git/}{gitname}
-cd {usrc/}{gitname}/
-# (find-fline \"{usrc/}{gitname}/\")
-
-# (code-c-d \"{c}\" \"{usrc/}{gitname}\")
-# (find-{c}file \"\")
-# (find-{c}sh0 \"gitk\")
-
- (eepitch-shell)
- (eepitch-kill)
- (eepitch-shell)
-cd {usrc/}{gitname}
-find {usrc/}{gitname} -maxdepth 1 -mindepth 1 | sort | grep -v '/\.git$'
-rm -Rv $(
-find {usrc/}{gitname} -maxdepth 1 -mindepth 1 | sort | grep -v '/\.git$'
-)
-git pull
-git reset --hard
-
-# (code-c-d \"{c}\" \"{usrc/}{gitname}/\")
-# (find-{c}file \"\")
-")
- )
- pos-spec-list))
+(defun ee-git-url-stem (url)
+ (replace-regexp-in-string "^\\(.*/\\)\\([^/]+?\\)\\(\\.git\\)?$" "\\2" url))
(defun ee-git-url-at-point ()
(require 'thingatpt)
@@ -1285,22 +1258,51 @@ git reset --hard
thing-at-point-url-path-regexp)))
(thing-at-point 'url)))
-(defun find-git-links-1 ()
- "Visit a temporary buffer containing scripts for acting on a Git URL.
-This is the high-level version, that runs `ee-git-url-at-point',
-splits the Git URL at point, and calls `find-git-links' with
-reasonable default arguments.
+(setq ee-git-dir "~/usrc/") ;; Used by find-git-links
-To test this, type `M-h g' on a Git URL - for example, on:
- https://github.com/kikito/inspect.lua"
+(defun find-git-links (&optional url c &rest pos-spec-list)
+"Visit a temporary buffer containing hyperlinks for foo."
(interactive)
- (let* ((url/ (ee-git-url-at-point))
- (url (replace-regexp-in-string "/*\\'" "" url/))
- (git/ (file-name-directory url))
- (gitname (file-name-nondirectory url))
- (c (replace-regexp-in-string "[-.]" "" gitname)))
- (if (equal gitname "") (error "Maybe your git url ended with `/'?..."))
- (find-git-links "/tmp/" git/ gitname c)))
+ (let (gitstem dir)
+ (setq url (or url (ee-git-url-at-point) "{url}"))
+ (setq gitstem (or gitstem (ee-git-url-stem url)))
+ (setq c (or c (replace-regexp-in-string "\\." "" gitstem)))
+ (setq dir (format "%s%s/" ee-git-dir gitstem))
+ (apply 'find-elinks
+ `((find-git-links ,url ,c)
+ ;; Convention: the first sexp always regenerates the buffer.
+ (find-efunction 'find-git-links)
+ ""
+ (setq ee-git-dir ,ee-git-dir)
+ (setq ee-git-dir "~/usrc/")
+ (setq ee-git-dir "/tmp/")
+ ""
+ (find-fline ,ee-git-dir)
+ (find-fline ,dir)
+ ""
+ ,(ee-template0 "\
+ (eepitch-shell)
+ (eepitch-kill)
+ (eepitch-shell)
+# rm -Rfv {dir}
+cd {ee-git-dir}
+git clone --depth 1 {url}
+cd {dir}
+# git pull
+# (find-fline \"{ee-git-dir}\")
+# (find-fline \"{dir}\")
+
+# (code-c-d \"{c}\" \"{dir}\")
+# (find-{c}file \"\")
+# (find-gitk \"{dir}\")
+
+git clean -dfx
+git reset --hard
+
+git pull
+")
+ )
+ pos-spec-list)))
;; Test by typing `M-h g' on this git url:
;; https://github.com/kikito/inspect.lua
@@ -1333,8 +1335,8 @@ To test this, type `M-h g' on a Git URL - for example, on:
(find-efunction 'find-netcat-test-links)
""
,(ee-template0 "\
- (find-wset \"13o2!o!o\" '(eepitch-{eesrc}) '(eepitch-{eetgt}))
- (find-wset \"13o2=o=o\" '(eepitch-{eesrc}) '(eepitch-{eetgt}))
+ (find-3EE '(eepitch-{eesrc}) '(eepitch-{eetgt}))
+ (find-3ee '(eepitch-{eesrc}) '(eepitch-{eetgt}))
(eepitch-{eetgt})
# listen on port {tgtport}
netcat -l -p {tgtport}
- [elpa] branch externals/eev created (now fb9f4c6), Stefan Monnier, 2019/04/07
- [elpa] externals/eev 99d0c67 03/64: Changes in `find-videos-intro'; `ee-copy-after-and' -> `ee-copy-rest', Stefan Monnier, 2019/04/07
- [elpa] externals/eev 5320469 04/64: `eepitch-do' and `find-wget', Stefan Monnier, 2019/04/07
- [elpa] externals/eev 834e074 10/64: `find-customizegroup', Stefan Monnier, 2019/04/07
- [elpa] externals/eev 301db1e 13/64: Make some arguments optional, Stefan Monnier, 2019/04/07
- [elpa] externals/eev 95397ce 02/64: Added `ee-copy-after-and' and `find-eejumps',
Stefan Monnier <=
- [elpa] externals/eev b30a527 15/64: Corrected typos in `find-eev-quick-intro'., Stefan Monnier, 2019/04/07
- [elpa] externals/eev 19623c4 05/64: Rewrote eev-rcirc.el., Stefan Monnier, 2019/04/07
- [elpa] externals/eev 70964f1 20/64: Add `find-eev-install-intro' and `find-eev-install-links', Stefan Monnier, 2019/04/07
- [elpa] externals/eev 23f0366 22/64: Added instructions for using the git repository., Stefan Monnier, 2019/04/07
- [elpa] externals/eev 4b2e5aa 18/64: Added eev-codings.el, started to convert files to UTF-8, Stefan Monnier, 2019/04/07
- [elpa] externals/eev 2009036 21/64: Added text to `find-escripts-intro', Stefan Monnier, 2019/04/07
- [elpa] externals/eev e4964a3 06/64: Rewrote `find-brxxx-intro'., Stefan Monnier, 2019/04/07
- [elpa] externals/eev 4a7bfcf 11/64: High-level words for `find-wset' (code and docs), Stefan Monnier, 2019/04/07
- [elpa] externals/eev a334821 08/64: `ee-mplayer-{audio, video}-options', `find-here-links', Stefan Monnier, 2019/04/07
- [elpa] externals/eev d77a040 24/64: Added `find-sh-at-dir'; added new sections to `find-eev-quick-intro', Stefan Monnier, 2019/04/07