branch: externals/eev commit 3c15e4bf58014a8bf5edffefde2e1858793d30f6 Merge: bd72cc1 e9996db Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Merge remote-tracking branch 'eev/UTF-8' into externals/eev --- ChangeLog | 17 +++++++++++ VERSION | 4 +-- eev-elinks.el | 63 ++++++++++++++++++++++++++++++++++++--- eev-intro.el | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- eev-mode.el | 4 +-- eev.el | 2 +- 6 files changed, 170 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4302a9..21581bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2019-06-10 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-elinks.el (find-code-pdf-links): new function. + (find-pdf-links): new function. + (ee-pdflike-page-links): use `code-pdf-page' instead of + `code-pdf'. + + * eev-mode.el (eev-mode-map-set): now `M-h M-p' is bound to + `find-pdf-links'. + + * .dir-locals.el: new file. + +2019-05-24 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-elinks.el (find-efunction-links): added an `eek' link. + (find-evariable-links): added an ``eek' link. + 2019-05-17 Eduardo Ochs <eduardoo...@gmail.com> * eev-elinks.el (find-here-links-3): new function. diff --git a/VERSION b/VERSION index 1ea0fe5..d4bd991 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -Fri May 17 07:17:49 GMT 2019 -Fri May 17 04:17:49 -03 2019 +Mon Jun 10 05:57:06 GMT 2019 +Mon Jun 10 02:57:06 -03 2019 diff --git a/eev-elinks.el b/eev-elinks.el index e330221..0c399be 100644 --- a/eev-elinks.el +++ b/eev-elinks.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019may17 +;; Version: 2019jun10 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-elinks.el> @@ -76,6 +76,9 @@ ;; «.find-here-links» (to "find-here-links") +;; «.find-code-c-d-links» (to "find-code-c-d-links") +;; «.find-code-pdf-links» (to "find-code-pdf-links") +;; «.find-pdf-links» (to "find-pdf-links") @@ -229,6 +232,7 @@ The buffer is put in Emacs Lisp mode." (interactive (find-function-read)) (apply 'find-elinks `((find-efunction-links ',f ,@pos-spec-list) + (eek ,(format "M-h M-f %s" f)) ,@(ee-find-efunction-links f) ) pos-spec-list)) @@ -267,7 +271,7 @@ This is an internal function used by `find-efunction-links' and ;; «find-evariable-links» (to ".find-evariable-links") ;; (find-find-links-links "\\M-v" "evariable" "var") ;; A test: (find-evariable-links 'line-move-visual) -;; (eek "M-h M-v line-move-visual") +;; (eek "M-h M-v line-move-visual") ;; Moved to eev-mode.el: ;; (define-key eev-mode-map "\M-h\M-v" 'find-evariable-links) @@ -278,6 +282,7 @@ This is an internal function used by `find-efunction-links' and (interactive (find-function-read 'variable)) (apply 'find-elinks `((find-evariable-links ',var ,@pos-spec-list) + (eek ,(format "M-h M-v %s" var)) ;; Convention: the first sexp always regenerates the buffer. ,var (describe-variable ',var) @@ -919,7 +924,7 @@ when this is true remove the prefix D from FNAME, and put the sexp (,find-cpage (+ ,offset ,page-) ,kill) (,find-ctext (+ ,offset ,page-) ,kill) "" - (code-pdf ,c ,fname) + (code-pdf-page ,c ,fname) (code-pdf-text ,c ,fname ,offset) ,(ee-HS bufname) ))) @@ -954,7 +959,7 @@ See: (find-pdf-like-intro) (,find-cpage (+ ,offset ,page-) ,kill) (,find-ctext (+ ,offset ,page-) ,kill) "" - (code-pdf ,c ,fname) + (code-pdf-page ,c ,fname) (code-pdf-text ,c ,fname ,offset) ,(ee-HS bufname) ) rest) @@ -962,6 +967,8 @@ See: (find-pdf-like-intro) (apply 'find-elinks `( (find-pdflike-page-links ,page ,bufname ,offset ,@rest) (find-efunction 'find-pdflike-page-links) + (find-eev-quick-intro "10.4. Generating short hyperlinks to PDFs") + (find-eev-quick-intro "11.1. `find-pdf-links'") "" ,@(ee-pdflike-page-links page bufname offset) ) rest) @@ -1291,6 +1298,54 @@ This needs a temporary directory; see: (find-prepared-intro)" +;;; __ _ _ _ _ _ _ +;;; / _(_)_ __ __| | ___ ___ __| | _____/\__ | (_)_ __ | | _____ +;;; | |_| | '_ \ / _` |_____ / __/ _ \ / _` |/ _ \ /_____| | | '_ \| |/ / __| +;;; | _| | | | | (_| |_____| (_| (_) | (_| | __/_ _\_____| | | | | | <\__ \ +;;; |_| |_|_| |_|\__,_| \___\___/ \__,_|\___| \/ |_|_|_| |_|_|\_\___/ +;;; +;; «find-code-c-d-links» (to ".find-code-c-d-links") + +;; «find-code-pdf-links» (to ".find-code-pdf-links") +;; Tests: +;; (find-fline "/usr/local/texlive/2018/texmf-dist/doc/latex/base/") +;; (find-code-pdf-links "/usr/local/texlive/2018/texmf-dist/doc/latex/base/source2e.pdf") +;; (find-code-pdf-links "/usr/local/texlive/2018/texmf-dist/doc/latex/base/source2e.pdf" "foo") + +(defun find-code-pdf-links (&optional fname c &rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks and `code-pdf-*'s to a PDF file." + (interactive (list (and (eq major-mode 'dired-mode) (ee-dired-to-fname)))) + (setq fname (or fname "{fname}")) + (setq c (or c "{c}")) + (let ((dir (file-name-directory fname))) + (apply 'find-elinks-elisp + `((find-code-pdf-links ,fname ,c ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + ;; (find-efunction 'find-code-pdf-links) + ,(ee-template0 "\ +;; See: (find-eev-quick-intro \"9.3. Hyperlinks to PDF files\") +;; (find-eev-quick-intro \"9.4. Shorter hyperlinks to PDF files\") + +;; (find-fline {(ee-S (file-name-directory fname))}) +;; (find-pdf-page \"{fname}\") +;; (find-pdf-text \"{fname}\") +\(code-pdf-page \"{c}\" \"{fname}\") +\(code-pdf-text \"{c}\" \"{fname}\") +;; \(find-{c}page) +;; \(find-{c}text) +") + ) + pos-spec-list))) + +;; «find-pdf-links» (to ".find-pdf-links") +;; +(defun find-pdf-links () +"Run either `find-code-pdf-links' or `find-pdflike-page-links'." + (interactive) + (if (eq major-mode 'dired-mode) + (find-code-pdf-links (ee-dired-to-fname)) + (find-pdflike-page-links))) + diff --git a/eev-intro.el b/eev-intro.el index 34ffd52..6ed227e 100644 --- a/eev-intro.el +++ b/eev-intro.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019may17 +;; Version: 2019jun10 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-intro.el> @@ -1456,7 +1456,7 @@ what is important in that page); the second sexp goes to the page 3 of the PDF converted to text, searches for the string \"LECTURE I.\" and places the cursor right after the end of it. -In section 10.3 we will see how to generate with just a few +In section 10.4 we will see how to generate with just a few keystrokes a short hyperlink to a page of a PDF and a short hyperlink to a string in a page of a PDF. @@ -1572,11 +1572,10 @@ trick uses the second link. Run this, mark a piece of text in it - for example, the \"no punishment\" in the end of the first paragraph - and copy it to the kill ring -with `M-w'. Then type `M-h M-p' (`find-pdflike-page-links'); note -that `M-h M-h' won't work here because `find-here-links' is not -smart enough to detect that we are on a PDF converted to text. -You will get an \"*Elisp hyperlinks*\" buffer that contains these -links: +with `M-w'. Then type `M-h M-p' (`find-pdf-links'); note that +`M-h M-h' won't work here because `find-here-links' is not smart +enough to detect that we are on a PDF converted to text. You will +get an \"*Elisp hyperlinks*\" buffer that contains these links: # (find-livesofanimalspage 24) # (find-livesofanimalstext 24) @@ -1596,6 +1595,8 @@ Remember that we called `code-pdf-page' and `code-pdf-text' as: The extra argument \"-110\" to `code-pdf-text' tells `M-h M-p' to used \"-110\" as the offset. +See the section 11.1 for more on `M-h M-p'. + @@ -1606,6 +1607,77 @@ used \"-110\" as the offset. + +11. Generating `code-c-d's and friends +====================================== +There are two main ways to generate lines like these + + (code-c-d \"asy\" \"/usr/local/texlive/2019/texmf-dist/doc/asymptote/\") + (code-pdf-page \"asy\" \"/usr/local/texlive/2019/texmf-dist/doc/asymptote/asymptote.pdf\") + (code-pdf-text \"asy\" \"/usr/local/texlive/2019/texmf-dist/doc/asymptote/asymptote.pdf\") + +without having to type much. One way, that is somewhat confusing, +is with `M-C' (`eewrap-code-c-d') and `M-P' (`eewrap-pdflike'); +you can test it by running the `eek' sexps below: + + (eek \"<down> M-C\") + asy /usr/local/texlive/2019/texmf-dist/doc/asymptote/ + + (eek \"<down> M-P\") + asy /usr/local/texlive/2019/texmf-dist/doc/asymptote/asymptote.pdf + +We will only discuss here the other way. + + + +11.1. `find-pdf-links' +---------------------- +Let's call a pair of lines like this, + + (code-pdf-page \"asy\" \"/usr/local/texlive/2019/texmf-dist/doc/asymptote/asymptote.pdf\") + (code-pdf-text \"asy\" \"/usr/local/texlive/2019/texmf-dist/doc/asymptote/asymptote.pdf\") + +in which we have a call to `code-pdf-page' and a call to +`code-pdf-text', both pointing to the same PDF file, a \"code-pdf +pair\". One quick way to generate a code-pdf pair is to visit the +directory where your PDF file is, put the point on the line of +the PDF, and type `M-h M-p' (`find-pdf-links'). Try it here: + + (find-fline \"$S/https/tannerlectures.utah.edu/_documents/a-to-z/c/\") + +The exact action of `M-h M-p' depends on the major mode. If +you're in dired mode then it supposes that you want links to the +PDF on the current line, including a code-pdf pair, and it runs +`find-code-pdf-links'. The first line of the buffer will be +something like: + + ;; (find-code-pdf-links \"$S/https/tannerlectures.utah.edu/_documents/a-to-z/c/Coetzee99.pdf\" \"{c}\") + +where the \"{c}\" is something that you have to adjust by hand +and then execute the first line again to regenerate the buffer - +like in `find-latex-links', that was described in section 7.5. + +If you're not it dired mode then `find-pdf-links' supposes that +you're in a buffer generated by a short hyperlink to the text of +a PDF file, and it runs the function `find-pdflike-page-links'. +Try `M-h M-p' in the buffer generated by the sexp below: + + (find-livesofanimalstext (+ -110 134)) + +`find-pdflike-page-links' is not very smart. It has to guess the +stem (\"livesofanimals\"), the offset (-110), the current page, +and the string that you want to use in the pos-spec. It takes the +stem and the offset from the global variables `ee-page-c' and +`ee-page-offset', that probably were set by the last call to a +function of the form `find-___text', and it guesses the current +page by counting formfeeds, and guesses that the pos-spec string +is in the top of the kill ring. + + + + + + \(To be continued...) " pos-spec-list))) @@ -3092,6 +3164,16 @@ documentation and examples in the comments of the source files.) +10.4. Quote and backquote +------------------------- +Eev uses backquote a lot and avoids macros. + + (find-elnode \"Backquote\") + (find-elnode \"Macros\") + + + + 11. What else? diff --git a/eev-mode.el b/eev-mode.el index a7dc1a5..62cbb4f 100644 --- a/eev-mode.el +++ b/eev-mode.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019apr24 +;; Version: 2019jun10 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-mode.el> @@ -123,7 +123,7 @@ and: (find-eval-intro \"`M-k'\")" (define-key eev-mode-map "\M-h\M-i" 'find-eintro-or-einfo-links) (define-key eev-mode-map "\M-h\M-k" 'find-ekey-links) (define-key eev-mode-map "\M-h\M-n" 'find-eunicodeucs) - (define-key eev-mode-map "\M-h\M-p" 'find-pdflike-page-links) + (define-key eev-mode-map "\M-h\M-p" 'find-pdf-links) (define-key eev-mode-map "\M-h\M-v" 'find-evariable-links) (define-key eev-mode-map "\M-hf" 'find-file-links) (define-key eev-mode-map "\M-hM" 'find-ekbmacro-links) diff --git a/eev.el b/eev.el index 73a24dd..d169412 100644 --- a/eev.el +++ b/eev.el @@ -6,7 +6,7 @@ ;; Package-Requires: ((emacs "24.1")) ;; Keywords: lisp e-scripts ;; URL: http://angg.twu.net/#eev -;; Version: 20190425 +;; Version: 20190517 ;; 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