eev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: suffix for pdfs


From: Eduardo Ochs
Subject: Re: suffix for pdfs
Date: Mon, 7 Jun 2021 18:00:01 -0300

Hi Erich,

here are two solutions. This one is the obvious one:


--snip--snip-- code of the first solution: --snip--snip--

;;  Skel: (find-code-xxx-links "tla-pdf" "tla fnamepdf" "")
;;
(defun      code-tla-pdf (tla fnamepdf)
  (eval (ee-read      (ee-code-tla-pdf tla fnamepdf))))
(defun find-code-tla-pdf (tla fnamepdf)
  (find-estring-elisp (ee-code-tla-pdf tla fnamepdf)))
(defun   ee-code-tla-pdf (tla fnamepdf)
  (ee-template0 "\
;; (find-code-tla-pdf \"{tla}\" \"{fnamepdf}\")
;;      (code-tla-pdf \"{tla}\" \"{fnamepdf}\")

(defun {tla}p (&optional page &rest rest)
  (interactive)
  (find-pdf-page \"{fnamepdf}\" page))
(defun {tla}t (&optional page &rest rest)
  (interactive)
  (apply 'find-pdf-text \"{fnamepdf}\" page rest))
"))

;; Compare:
;; (find-code-tla     'coe "~/Coetzee99.tex")
;; (find-code-tla-pdf 'coe "~/Coetzee99.pdf")

;; Try:
;; (code-tla-pdf 'coe "~/Coetzee99.pdf")
;; (coep 1)
;; (coet)
;; (coet "LECTURE I")

--snip--snip-- end of the first solution --snip--snip--



Do you know how to use this? I use it all the time...

  (find-pdf-like-intro "10. Generating a pair with the page number")

The first solution doesn't support that. Here is a solution that SORT
OF supports it:



--snip--snip-- code of the second solution: --snip--snip--

;;  Skel: (find-code-xxx-links "tla-pdf" "tla fnamepdf offset" "")
;;
(defun      code-tla-pdf (tla fnamepdf &optional offset)
  (eval (ee-read      (ee-code-tla-pdf tla fnamepdf offset))))
(defun find-code-tla-pdf (tla fnamepdf &optional offset)
  (find-estring-elisp (ee-code-tla-pdf tla fnamepdf offset)))
(defun   ee-code-tla-pdf (tla fnamepdf offset)
  (let ((offsetstr (if offset (format " %d" offset) "")))
    (ee-template0 "\
;; (find-code-tla-pdf \"{tla}\" \"{fnamepdf}\"{offsetstr})
;;      (code-tla-pdf \"{tla}\" \"{fnamepdf}\"{offsetstr})

(code-pdf-page \"{tla}\" \"{fnamepdf}\")
(code-pdf-text \"{tla}\" \"{fnamepdf}\"{offsetstr})

(defalias '{tla}p 'find-{tla}page)
(defalias '{tla}t 'find-{tla}text)
")))


;; Try:
;;   (find-code-tla-pdf 'coe "~/Coetzee99.pdf")
;;   (find-code-tla-pdf 'coe "~/Coetzee99.pdf" -110)
;;        (code-tla-pdf 'coe "~/Coetzee99.pdf" -110)
;;
;; Then links like these should work,
;;   (coep)
;;   (coep 3)
;;   (coet 3 "LECTURE I")
;;
;; and this too... run the two sexps below and then type `M-h M-p'
;; in the buffer with the PDF converted to text:
;;
;;    (kill-new "wrong thoughts")
;;    (coet (+ -110 127) "wrong thoughts")
;;
;; you should get a temporary buffer containing four links like these
;; ones (and other stuff):
;;
;;    (find-coepage 17 "wrong thoughts")
;;    (find-coetext 17 "wrong thoughts")
;;    (find-coepage (+ -110 127) "wrong thoughts")
;;    (find-coetext (+ -110 127) "wrong thoughts")
;;
;; in more realistic examples you would mark a region of the PDF
;; converted to text, and type `M-w M-h M-p'...

--snip--snip-- end of the second solution --snip--snip--


  Can you try it and tell me if it makes sense?
    [[]] =),
      Eduardo

On Mon, 7 Jun 2021 at 15:00, Erich Ruff <erich_ruff@t-online.de> wrote:
>
>
> Hi Eduardo, hi list,
>
> the new approach to select the pdf-viewer with
>  (defalias 'find-pdf-page 'find-xpdf-page)
>  (defalias 'find-pdf-page 'find-pdftools-page)
>  (defalias 'find-pdf-page 'find-evince-page)
> works great.
>
> irritating (and tedious) is, that I have to rename in the tla all pdfs
> to *.tex to point to the pdf.
>
> (code-tla 'spe "/mnt/phil/speiser/speiser-xxx-yyyy.tex")
>
> calling --> spei  does nothing
>
> calling --> speip  opens in the preselected pdf viewer
>
>
> defining a tla for the pdf:
>
> (code-tla 'spex "/mnt/phil/speiser/speiser-xxx-yyyy.pdf")
>
> --> see the x in spe
> opens the pdf in emacs pdf-view and not in the previous selected viewer.
>
> Is it possible to leave the suffix and open then pdf in presel. viewer?
>
>
> Erich
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]