-
Notifications
You must be signed in to change notification settings - Fork 3
/
eev-pdflike.el
1250 lines (1079 loc) · 46.2 KB
/
eev-pdflike.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; eev-pdflike.el -- hyperlinks to documents made of pages. -*- lexical-binding: nil; -*-
;; Copyright (C) 2012-2023 Free Software Foundation, Inc.
;;
;; This file is part of GNU eev.
;;
;; GNU eev 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.
;;
;; GNU eev 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. If not, see <http://www.gnu.org/licenses/>.
;;
;; Author: Eduardo Ochs <[email protected]>
;; Maintainer: Eduardo Ochs <[email protected]>
;; Version: 20240125
;; Keywords: e-scripts
;;
;; Latest version: <http://anggtwu.net/eev-current/eev-pdflike.el>
;; htmlized: <http://anggtwu.net/eev-current/eev-pdflike.el.html>
;; See also: <http://anggtwu.net/eev-current/eev-beginner.el.html>
;; <http://anggtwu.net/eev-intros/find-eev-intro.html>
;; <http://anggtwu.net/eev-intros/find-pdf-like-intro.html>
;; (find-eev-intro)
;; (find-pdf-like-intro)
;;; Commentary:
;; The main ideas in this file are explained here:
;;
;; (find-pdf-like-intro)
;;
;;
;;
;; 1. DEFINING VIEWERS
;; ===================
;; Let's suppose that I have just installed a new PDF viewer, called
;; FOOPDF, on my machine. My old method for implementing support for
;; it on eev would be to define a function `find-FOOPDF-page' "by
;; hand", like this:
;;
;; (defun find-FOOPDF-page (fname &optional page &rest rest)
;; (find-bgprocess (list "/usr/bin/FOOPDF" fname "--page" page)))
;;
;; After a while I realized that it would be better to have several
;; functions associated to FOOPDF, all of them calling indirectly a
;; function called `ee-find-FOOPDF-page'; this `ee-find-FOOPDF-page'
;; would receive a file name and a page number and just return a list
;; with the name of the FOOPDF program followed by the arguments to be
;; given to it. I would define it as:
;;
;; (defun ee-find-FOOPDF-page (fname page)
;; (list "/usr/bin/FOOPDF" fname "--page" page))
;;
;; All the other `*FOOPDF*' functions would be "mass produced", as in
;; `code-c-d',
;;
;; (find-eev-quick-intro "9.1. `code-c-d'")
;; (find-eev-quick-intro "9.1. `code-c-d'" "find-code-c-d")
;;
;; but by a function called `code-pdfbackend'. To inspect the code
;; that a `code-pdfbackend' would execute, add a "find-" to it, like
;; this:
;;
;; (find-code-pdfbackend "FOOPDF-page")
;;
;; Note that the `*FOOPDF*' functions are related like this:
;;
;; find-FOOPDF-page --> ee-find-FOOPDF-page
;; ^
;; :
;; code-FOOPDF-page --> ee-code-FOOPDF-page
;; ^
;; |
;; find-code-FOOPDF-page
;;
;; Here each arrow `-->' means "calls" and the vertical dotted arrow
;; means "produces elisp code mentioning".
;;
;; The function `code-pdftextbackend' is similar to `code-pdfbackend',
;; but for functions like `find-pdf-text'. Try:
;;
;; (find-code-pdftextbackend "SHOWTEXT-text")
;;
;; Note: `code-pdfbackend' and `code-pdftextbackend' are replacements
;; for these old functions, that were very badly documented and had
;; cryptic names:
;;
;; (find-code-xxxpdf-family "FOOPDF-page")
;; (find-code-xxxpdftext-family "SHOWTEXT-page")
;;
;;
;;
;; 2. ALIASES
;; ==========
;; The main functions for opening PDFs with different viewers are
;; these ones:
;;
;; find-xpdf-page
;; find-pdftotext-text
;;
;; and these "generic" functions are aliased to them:
;;
;; find-pdf-page
;; find-pdf-text
;;
;; These aliases are also mass-produced. Try:
;;
;; (find-code-pdfbackendalias "PDF-PAGE" "XPDF-PAGE")
;;
;; `code-pdfbackendalias' is a replacement for `code-xxxpdf-alias':
;;
;; (find-code-xxxpdf-alias "PDF-TEXT" "PDFTOTEXT-TEXT")
;;
;;
;;
;; 3. OTHER VIEWERS
;; ================
;; This file also implement these other "viewers":
;;
;; find-djview-page
;; find-djvutxt-text
;; find-evince-page
;; find-gv-page
;; find-pdftools-page
;; find-texworkspdf-page
;; find-xdvi-page
;;
;; Some of them work on other "PDF-like" formats, like DVI, PS, and
;; DJVU. My definition of "PDF-like" is explained here:
;;
;; (find-pdf-like-intro "1. PDF-like documents")
;;
;;
;;
;; 4. A CONVENTION ON HYPHENS
;; ==========================
;; Note that if we run
;;
;; (find-code-pdf-page "livesofanimals" "/tmp/Coetzee99.pdf")
;; (find-code-pdf-text "livesofanimals" "/tmp/Coetzee99.pdf")
;; (code-pdf-page "livesofanimals" "/tmp/Coetzee99.pdf")
;; (code-pdf-text "livesofanimals" "/tmp/Coetzee99.pdf")
;;
;; this defines the functions `find-livesofanimalspage' and
;; `find-livesofanimalstext'. I am trying to follow a convention in
;; which function with two hyphens in their names, like
;; `find-xpdf-page', are basic hyperlink functions like the ones
;; defined in this file, and functions with only one hyphen in their
;; names, like `find-livesofanimalspage', are short hyperlinks, as in:
;;
;; (find-eev-quick-intro "9.4. Shorter hyperlinks to PDF files")
;; (find-pdf-like-intro "7. Shorter hyperlinks to PDF files")
;; «.find-sh-page» (to "find-sh-page")
;; «.ee-goto-position-page» (to "ee-goto-position-page")
;;
;; «.code-pdfbackend» (to "code-pdfbackend")
;; «.code-pdftextbackend» (to "code-pdftextbackend")
;; «.code-pdfbackendalias» (to "code-pdfbackendalias")
;;
;; Obsolete functions, replaced by the `*backend*'s:
;; «.code-xxxpdf-family» (to "code-xxxpdf-family")
;; «.code-xxxpdftext-family» (to "code-xxxpdftext-family")
;; «.code-xxxpdf-alias» (to "code-xxxpdf-alias")
;;
;; «.find-pdf-page» (to "find-pdf-page")
;; «.change-default-viewer» (to "change-default-viewer")
;; «.find-pdf-page-windows» (to "find-pdf-page-windows")
;; «.find-pdf-text» (to "find-pdf-text")
;;
;; «.find-xpdf-page» (to "find-xpdf-page")
;; «.find-pdftotext-text» (to "find-pdftotext-text")
;; «.find-pdftotext8-text» (to "find-pdftotext8-text")
;; «.find-texworkspdf-page» (to "find-texworkspdf-page")
;; «.find-pdftools-page» (to "find-pdftools-page")
;; «.find-pdftoolsr-page» (to "find-pdftoolsr-page")
;; «.find-xdvi-page» (to "find-xdvi-page")
;; «.find-djview-page» (to "find-djview-page")
;; «.find-evince-page» (to "find-evince-page")
;; «.find-mupdfpage» (to "find-mupdfpage")
;; «.find-okularpage» (to "find-okularpage")
;; «.find-gv-page» (to "find-gv-page")
;; «.find-djvutxt-text» (to "find-djvutxt-text")
;; «.find-firefox-page» (to "find-firefox-page")
;; «.find-googlechrome-page» (to "find-googlechrome-page")
;; «.ee-fname-page-to-url» (to "ee-fname-page-to-url")
;;
;; «.aliases» (to "aliases")
;; «.code-brxxxs» (to "code-brxxxs")
(require 'eev-plinks) ; (find-eev "eev-plinks.el")
(require 'eev-brxxx) ; (find-eev "eev-brxxx.el")
;; Autoloads for external functions.
;; See: (find-elnode "Autoload")
;; See also my temporary hack in:
;; (find-eev "eev-pdflike.el" "find-pdftools-page")
;; (find-eev "eev-pdflike.el" "find-pdftools-page" "require")
;;(autoload 'pdf-loader-install "pdf-tools")
;;; _ _ _
;;; __ ____ _ _ __(_) __ _| |__ | | ___ ___
;;; \ \ / / _` | '__| |/ _` | '_ \| |/ _ \/ __|
;;; \ V / (_| | | | | (_| | |_) | | __/\__ \
;;; \_/ \__,_|_| |_|\__,_|_.__/|_|\___||___/
;;
;; Global variables used by `M-h M-p'. See:
;; (find-pdf-like-intro "11. How `M-h M-p' guesses everything")
;; (find-efunction 'find-pdflike-page-links)
;;
(defvar ee-page-c "{?}" "Internal, used by `find-pdflike-page-links'.")
(defvar ee-page-fname "{?}" "Internal, used by `find-pdflike-page-links'.")
(defvar ee-page-offset 0 "Internal, used by `find-pdflike-page-links'.")
;;; __ _ _ _
;;; / _(_)_ __ __| | ___| |__ _ __ __ _ __ _ ___
;;; | |_| | '_ \ / _` |_____/ __| '_ \ _____| '_ \ / _` |/ _` |/ _ \
;;; | _| | | | | (_| |_____\__ \ | | |_____| |_) | (_| | (_| | __/
;;; |_| |_|_| |_|\__,_| |___/_| |_| | .__/ \__,_|\__, |\___|
;;; |_| |___/
;;
;; «find-sh-page» (to ".find-sh-page")
(defun find-sh-page (program-and-args &rest pos-spec-list)
"Like `find-sh', but interpreting the car of POS-SPEC-LIST as a page number."
(interactive "sShell command: ")
(find-eoutput-reuse
(ee-unsplit program-and-args)
`(insert (ee-pdftotext-replace-bad-ffs
(find-callprocess00 ,'program-and-args))))
(apply 'ee-goto-position-page pos-spec-list))
;; «ee-goto-position-page» (to ".ee-goto-position-page")
;; See: (find-refining-intro "1. Pos-spec-lists")
;;
(defun ee-goto-position-page (&optional pos-spec &rest rest)
"Like `ee-goto-position', but interpreting a number as a page number.
\(Note that POS-SPEC is only interpreted as a page if it is a number.)"
(when pos-spec
(cond ((numberp pos-spec)
(goto-char (point-min))
(re-search-forward "[\f]" nil nil (1- pos-spec)))
((stringp pos-spec)
(goto-char (save-excursion ; This used to be just:
(goto-char (point-min)) ; (goto-char (point-min))
(search-forward pos-spec) ; (search-forward pos-spec)
(point)))) ;
(t (error "This is not a valid pos-spec: %S" pos-spec)))
(if rest (ee-goto-rest rest))))
(defun ee-pdftotext-replace-bad-ffs (bigstr)
"Convert formfeeds that are preceded by non-newline chars into something else.
Sometimes pdftotext return \"spurious formfeeds\" that correspond
not to page breaks but to special printable characters, and these
spurious formfeeds confuse `ee-goto-position-page'. This function
finds sequence of spurious formfeeds using a heuristic that works
in most cases - formfeeds following something that is not a
newline are spurious - and replaces them by \"(ff)\"."
(replace-regexp-in-string
"\\([^\n\f]\\)\\(\f+\\)" "\\1(ff)" bigstr t))
;;; _ _ _ _
;;; ___ ___ __| | ___ __/\_| |__ __ _ ___| | _____ _ __ __| |_/\__
;;; / __/ _ \ / _` |/ _ \_____\ / '_ \ / _` |/ __| |/ / _ \ '_ \ / _` \ /
;;; | (_| (_) | (_| | __/_____/_ _\ |_) | (_| | (__| < __/ | | | (_| /_ _\
;;; \___\___/ \__,_|\___| \/ |_.__/ \__,_|\___|_|\_\___|_| |_|\__,_| \/
;;;
;; «code-pdfbackend» (to ".code-pdfbackend")
;; See: (find-eevfile "eev-pdflike.el" "1. DEFINING VIEWERS")
;; Test: (find-code-pdfbackend "FOOVIEW")
;;
(defun code-pdfbackend (pdfbackend)
(eval (ee-read (ee-code-pdfbackend pdfbackend))))
(defun find-code-pdfbackend (pdfbackend)
(find-estring-elisp (ee-code-pdfbackend pdfbackend)))
(defun ee-code-pdfbackend (pdfbackend)
(ee-template0 "\
;; (find-code-pdfbackend \"{pdfbackend}\")
;; (code-pdfbackend \"{pdfbackend}\")
;; (find-efunction 'find-code-pdfbackend)
;;
;; This is similar to a `code-c-d' - see:
;; (find-eev-quick-intro \"9.1. `code-c-d'\")
;; (find-eev-quick-intro \"9.1. `code-c-d'\" \"find-code-c-d\")
;; but it defines the four functions in the left in the diagram below:
;;
;; The code here defines this structure:
;;
;; find-{pdfbackend} --> ee-find-{pdfbackend}
;; ^
;; :
;; code-{pdfbackend} --> ee-code-{pdfbackend}
;; ^
;; |
;; find-code-{pdfbackend}
;;
;; The function `find-{pdfbackend}' calls `ee-find-{pdfbackend}',
;; that needs to be defined externally.
;;
;; See:
;; (find-eev \"eev-pdflike.el\" \"code-pdfbackend\")
;; (find-eevfile \"eev-pdflike.el\" \"\\\"{pdfbackend}\\\"\")
;; (find-eevgrep \"grep --color=auto -nH -e '\\\"{pdfbackend}\\\"' eev-pdflike.el\")
;;
\(defun find-{pdfbackend} (fname &optional page &rest rest)
(interactive \"fPDF file: \")
(find-bgprocess (ee-find-{pdfbackend} fname page)))
;; (find-code-{pdfbackend} \"C\" \"FNAME\")
;; (code-{pdfbackend} \"C\" \"FNAME\")
;;
\(defun code-{pdfbackend} (c fname &rest rest)
(eval (ee-read (apply 'ee-code-{pdfbackend} c fname rest))))
\(defun find-code-{pdfbackend} (c fname &rest rest)
(find-estring-elisp (apply 'ee-code-{pdfbackend} c fname rest)))
\(defun ee-code-{pdfbackend} (c fname &rest rest)
(ee-template0 \"\\
;; (find-code-{pdfbackend} \\\"{<}c{>}\\\" \\\"{<}fname{>}\\\")
;; (code-{pdfbackend} \\\"{<}c{>}\\\" \\\"{<}fname{>}\\\")
;;
;; See: (find-pdf-like-intro \\\"7. Shorter hyperlinks to PDF files\\\")
;;
(setq ee-{<}c{>}pdf {<}(ee-S fname){>})
(setq ee-pdflike-last 'find-{<}c{>}page)
(defun find-{<}c{>}page (&optional page &rest rest)
(interactive)
(setq ee-pdflike-last 'find-{<}c{>}page)
(find-{pdfbackend} {<}(ee-S fname){>} page))
\"))
"))
;; «code-pdftextbackend» (to ".code-pdftextbackend")
;; See: (find-eevfile "eev-pdflike.el" "1. DEFINING VIEWERS")
;; Test: (find-code-pdftextbackend "SHOWTEXT")
;;
(defun code-pdftextbackend (pdftextbackend)
(eval (ee-read (ee-code-pdftextbackend pdftextbackend))))
(defun find-code-pdftextbackend (pdftextbackend)
(find-estring-elisp (ee-code-pdftextbackend pdftextbackend)))
(defun ee-code-pdftextbackend (pdftextbackend)
(ee-template0 "\
;; (find-code-pdftextbackend \"{pdftextbackend}\")
;; (code-pdftextbackend \"{pdftextbackend}\")
;; (find-eev \"eev-pdflike.el\" \"code-pdftextbackend\")
;; (find-eevfile \"eev-pdflike.el\" \"\\\"{pdftextbackend}\\\"\")
;; (find-eevgrep \"grep --color=auto -nH -e '\\\"{pdftextbackend}\\\"' eev-pdflike.el\")
;;
;; The code here defines this structure:
;;
;; find-{pdftextbackend} --> ee-find-{pdftextbackend}
;; ^
;; :
;; code-{pdftextbackend} --> ee-code-{pdftextbackend}
;; ^
;; |
;; find-code-{pdftextbackend}
;;
;; where `ee-find-{pdftextbackend}'
;; is an external function.
;;
\(defun find-{pdftextbackend} (fname &optional page &rest rest)
(apply 'find-sh-page (ee-find-{pdftextbackend} fname) page rest))
;; (find-code-{pdftextbackend} \"C\" \"FNAME\")
;; (code-{pdftextbackend} \"C\" \"FNAME\")
;;
\(defun code-{pdftextbackend} (c fname &rest rest)
(eval (ee-read (apply 'ee-code-{pdftextbackend} c fname rest))))
\(defun find-code-{pdftextbackend} (c fname &rest rest)
(find-estring-elisp (apply 'ee-code-{pdftextbackend} c fname rest)))
\(defun ee-code-{pdftextbackend} (c fname &optional offset)
(setq offset (or offset 0))
(ee-template0 \"\\
;; (find-code-{pdftextbackend} \\\"{<}c{>}\\\" \\\"{<}fname{>}\\\")
;; (code-{pdftextbackend} \\\"{<}c{>}\\\" \\\"{<}fname{>}\\\")
;;
;; See: (find-pdf-like-intro \\\"7. Shorter hyperlinks to PDF files\\\")
;;
(setq ee-page-c {<}(ee-pp0 c){>})
(setq ee-page-fname {<}(ee-pp0 fname){>})
(setq ee-page-offset {<}(ee-pp0 offset){>})
(setq ee-{<}c{>}pdf {<}(ee-S fname){>})
(defun find-{<}c{>}text (&optional page &rest rest)
(interactive)
(setq ee-page-c {<}(ee-pp0 c){>})
(setq ee-page-fname {<}(ee-pp0 fname){>})
(setq ee-page-offset {<}(ee-pp0 offset){>})
(apply 'find-{pdftextbackend} {<}(ee-pp0 fname){>} page rest))
\"))
"))
;; «code-pdfbackendalias» (to ".code-pdfbackendalias")
;; See: (find-eevfile "eev-pdflike.el" "2. ALIASES")
;; Test: (find-code-pdfbackendalias "NEWPDFPROG-PAGE" "OLDPDFPROG-PAGE")
;;
(defun code-pdfbackendalias (newbackend oldbackend)
(eval (ee-read (ee-code-pdfbackendalias newbackend oldbackend))))
(defun find-code-pdfbackendalias (newbackend oldbackend)
(find-estring-elisp (ee-code-pdfbackendalias newbackend oldbackend)))
(defun ee-code-pdfbackendalias (newbackend oldbackend)
(ee-template0 "\
;; (find-code-pdfbackendalias \"{newbackend}\" \"{oldbackend}\")
;; (code-pdfbackendalias \"{newbackend}\" \"{oldbackend}\")
;; (find-eev \"eev-pdflike.el\" \"code-pdfbackendalias\")
;; (find-eevfile \"eev-pdflike.el\" \"\\\"{newbackend}\\\"\")
;; (find-eevgrep \"grep --color=auto -nH -e '\\\"{newbackend}\\\"' eev-pdflike.el\")
;;
\(defalias 'ee-find-{newbackend} 'ee-find-{oldbackend})
\(defalias 'find-{newbackend} 'find-{oldbackend})
\(defalias 'ee-code-{newbackend} 'ee-code-{oldbackend})
\(defalias 'code-{newbackend} 'code-{oldbackend})
\(defalias 'find-code-{newbackend} 'find-code-{oldbackend})
"))
;; ;;; ___ _ _ _
;; ;;; / _ \| |__ ___ ___ | | ___| |_ ___
;; ;;; | | | | '_ \/ __|/ _ \| |/ _ \ __/ _ \
;; ;;; | |_| | |_) \__ \ (_) | | __/ || __/
;; ;;; \___/|_.__/|___/\___/|_|\___|\__\___|
;; ;;;
;; ;; «code-xxxpdf-family» (to ".code-xxxpdf-family")
;; ;; See: (find-eevfile "eev-pdflike.el" "1. DEFINING VIEWERS")
;; ;; Test: (find-code-xxxpdf-family "XPDFPAGE")
;;
;; (defun code-xxxpdf-family (xxxpdf)
;; (eval (ee-read (ee-code-xxxpdf-family xxxpdf))))
;; (defun find-code-xxxpdf-family (xxxpdf)
;; (find-estring-elisp (ee-code-xxxpdf-family xxxpdf)))
;; (defun ee-code-xxxpdf-family (xxxpdf)
;; (ee-template0 "\
;; ;; (find-code-xxxpdf-family {(ee-pp0 xxxpdf)})
;; ;; (code-xxxpdf-family {(ee-pp0 xxxpdf)})
;; ;;
;; ;; To understand the code that a call to
;; ;; (code-{xxxpdf} \"C\" \"FNAME\")
;; ;; would execute, run:
;; ;; (find-code-{xxxpdf} \"C\" \"FNAME\")
;;
;; \(defun find-{xxxpdf} (fname &optional page &rest rest)
;; (find-bgprocess (ee-find-{xxxpdf} fname page)))
;;
;; \(defun code-{xxxpdf} (c fname &rest rest)
;; (eval (ee-read (apply 'ee-code-{xxxpdf} c fname rest))))
;; \(defun find-code-{xxxpdf} (c fname &rest rest)
;; (find-estring-elisp (apply 'ee-code-{xxxpdf} c fname rest)))
;; \(defun ee-code-{xxxpdf} (c fname &rest rest)
;; (ee-template0 \"\\
;; \(setq ee-pdflike-last 'find-{<}c{>}page)
;; \(defun find-{<}c{>}page (&optional page &rest rest)
;; (setq ee-pdflike-last 'find-{<}c{>}page)
;; (find-{xxxpdf} {<}(ee-pp0 fname){>} page))
;; \"))
;; "))
;;
;; ;; «code-xxxpdftext-family» (to ".code-xxxpdftext-family")
;; ;; See: (find-eevfile "eev-pdflike.el" "1. DEFINING VIEWERS")
;; ;; Test: (find-code-xxxpdftext-family "PDFTOTEXT")
;; ;;
;; (defun code-xxxpdftext-family (xxxpdf)
;; (eval (ee-read (ee-code-xxxpdftext-family xxxpdf))))
;; (defun find-code-xxxpdftext-family (xxxpdf)
;; (find-estring-elisp (ee-code-xxxpdftext-family xxxpdf)))
;; (defun ee-code-xxxpdftext-family (xxxpdf)
;; (ee-template0 "\
;; ;; (find-code-xxxpdftext-family {(ee-pp0 xxxpdf)})
;; ;; (code-xxxpdftext-family {(ee-pp0 xxxpdf)})
;; ;;
;; ;; To understand the code that a call to
;; ;; (code-{xxxpdf} \"C\" \"FNAME\")
;; ;; would execute, run:
;; ;; (find-code-{xxxpdf} \"C\" \"FNAME\")
;;
;; \(defun find-{xxxpdf} (fname &optional page &rest rest)
;; (apply 'find-sh-page (ee-find-{xxxpdf} fname) page rest))
;;
;; \(defun code-{xxxpdf} (c fname &rest rest)
;; (eval (ee-read (apply 'ee-code-{xxxpdf} c fname rest))))
;; \(defun find-code-{xxxpdf} (c fname &rest rest)
;; (find-estring-elisp (apply 'ee-code-{xxxpdf} c fname rest)))
;; \(defun ee-code-{xxxpdf} (c fname &optional offset)
;; (setq offset (or offset 0))
;; (ee-template0 \"\\
;; \(setq ee-page-c {<}(ee-pp0 c){>})
;; \(setq ee-page-fname {<}(ee-pp0 fname){>})
;; \(setq ee-page-offset {<}(ee-pp0 offset){>})
;; \(defun find-{<}c{>}text (&optional page &rest rest)
;; (setq ee-page-c {<}(ee-pp0 c){>})
;; (setq ee-page-fname {<}(ee-pp0 fname){>})
;; (setq ee-page-offset {<}(ee-pp0 offset){>})
;; (apply 'find-{xxxpdf} {<}(ee-pp0 fname){>} page rest))
;; \"))
;; "))
;;
;; ;; «code-xxxpdf-alias» (to ".code-xxxpdf-alias")
;; ;; See: (find-eevfile "eev-pdflike.el" "2. ALIASES")
;; ;; Test: (find-code-xxxpdf-alias "PDF-PAGE" "XPDF-PAGE")
;; ;;
;; (defun code-xxxpdf-alias (xxxpdfnew xxxpdfold)
;; (eval (ee-read (ee-code-xxxpdf-alias xxxpdfnew xxxpdfold))))
;; (defun find-code-xxxpdf-alias (xxxpdfnew xxxpdfold)
;; (find-estring-elisp (ee-code-xxxpdf-alias xxxpdfnew xxxpdfold)))
;; (defun ee-code-xxxpdf-alias (xxxpdfnew xxxpdfold)
;; (ee-template0 "\
;; ;; (find-code-xxxpdf-alias \"{xxxpdfnew}\" \"{xxxpdfold}\")
;; ;; (find-code-xxxpdf-alias \"xxxpdfnew\" \"xxxpdfold\")
;; ;; (find-code-xxxpdf-alias \"pdf-page\" \"xpdf-page\")
;; ;; (find-code-xxxpdf-alias \"pdfpage\" \"xpdf-page\")
;; ;;
;; \(defalias 'ee-find-{xxxpdfnew} 'ee-find-{xxxpdfold})
;; \(defalias 'find-{xxxpdfnew} 'find-{xxxpdfold})
;; \(defalias 'ee-code-{xxxpdfnew} 'ee-code-{xxxpdfold})
;; \(defalias 'code-{xxxpdfnew} 'code-{xxxpdfold})
;; \(defalias 'find-code-{xxxpdfnew} 'find-code-{xxxpdfold})
;; "))
;;; __ _ _ _ __
;;; / _(_)_ __ __| | _ __ __| |/ _| _ __ __ _ __ _ ___
;;; | |_| | '_ \ / _` |_____| '_ \ / _` | |_ _____| '_ \ / _` |/ _` |/ _ \
;;; | _| | | | | (_| |_____| |_) | (_| | _|_____| |_) | (_| | (_| | __/
;;; |_| |_|_| |_|\__,_| | .__/ \__,_|_| | .__/ \__,_|\__, |\___|
;;; |_| |_| |___/
;;
;; «find-pdf-page» (to ".find-pdf-page")
;; (find-code-pdfbackend "pdf-page")
(code-pdfbackend "pdf-page")
;; The defalias below makes all functions in the `find-pdf-page'
;; family use `find-xpdf-page' by default. Running this defalias will
;; OVERRIDE the `find-pdf-page' defined by the `code-pdfbackend'
;; above.
;;
(defalias 'find-pdf-page 'find-xpdf-page)
;;; ____ __ _ _ _
;;; | _ \ ___ / _| __ _ _ _| | |_ __ _(_) _____ _____ _ __
;;; | | | |/ _ \ |_ / _` | | | | | __| \ \ / / |/ _ \ \ /\ / / _ \ '__|
;;; | |_| | __/ _| (_| | |_| | | |_ \ V /| | __/\ V V / __/ |
;;; |____/ \___|_| \__,_|\__,_|_|\__| \_/ |_|\___| \_/\_/ \___|_|
;;;
;; «change-default-viewer» (to ".change-default-viewer")
;; To make `find-pdf-page' use another default viewer
;; you just have to use a `defalias', like this:
;;
;; (defalias 'find-pdf-page 'find-xpdf-page)
;; (defalias 'find-pdf-page 'find-evince-page)
;; (defalias 'find-pdf-page 'find-pdftools-page)
;; (defalias 'find-pdf-page 'find-texworkspdf-page)
;; (defalias 'find-pdf-page 'find-googlechrome-page)
;;
;; You can inspect the current definition of `find-pdf-page' by
;; looking at its "function cell". Function cells are explained here:
;;
;; (find-elisp-intro "6. Defining functions")
;; (find-elisp-intro "11. Byte-compiled functions")
;;
;; When a function is defined with `defalias' its function cell
;; contains a symbol - the "name" of the function that it points to.
;; Try:
;;
;; (find-efunctionpp 'find-pdf-page)
;; (symbol-function 'find-pdf-page)
;; (find-efunctionpp (symbol-function 'find-pdf-page))
;; (find-efunctionpp 'find-xpdf-page)
;; (find-efunctionpp 'find-evince-page)
;; (find-efunctionpp 'find-pdftools-page)
;; (find-efunctionpp 'find-texworkspdf-page)
;; (find-efunctionpp 'find-googlechrome-page)
;;
;; A VERY TECHNICAL DETAIL: apparently it would be cleaner to do
;; something like this,
;;
;; (defalias 'ee-find-pdf-page 'ee-find-xpdf-page)
;;
;; instead of:
;;
;; (defalias 'find-pdf-page 'find-xpdf-page)
;;
;; but this wouldn't work for some atypical backends, like
;; `find-pdftools-page'... (TODO: explain this!)
;;; ____ __ _ _ __ ___
;;; | _ \ ___ / _| __ _ _ _| | |_ ___ _ __ \ \ / / |
;;; | | | |/ _ \ |_ / _` | | | | | __| / _ \| '_ \ \ \ /\ / / __)
;;; | |_| | __/ _| (_| | |_| | | |_ | (_) | | | | \ V V /\__ \
;;; |____/ \___|_| \__,_|\__,_|_|\__| \___/|_| |_| \_/\_/ ( /
;;; |_|
;; «find-pdf-page-windows» (to ".find-pdf-page-windows")
;; (find-elnode "System Environment" "windows-nt")
;; (find-evardescr 'system-type)
;; (to "change-default-viewer")
;; (to "find-firefox-page")
;;
(if (eq system-type 'windows-nt)
(defalias 'find-pdf-page 'find-firefox-page)
)
;;; __ _ _ _ __ _ _
;;; / _(_)_ __ __| | _ __ __| |/ _| | |_ _____ _| |_
;;; | |_| | '_ \ / _` |_____| '_ \ / _` | |_ _____| __/ _ \ \/ / __|
;;; | _| | | | | (_| |_____| |_) | (_| | _|_____| || __/> <| |_
;;; |_| |_|_| |_|\__,_| | .__/ \__,_|_| \__\___/_/\_\\__|
;;; |_|
;;
;; «find-pdf-text» (to ".find-pdf-text")
;; (find-code-pdfbackendalias "pdf-text" "pdftotext-text")
(code-pdfbackendalias "pdf-text" "pdftotext-text")
(defalias 'find-pdf-text 'find-pdftotext-text)
;;; __ __ _ __
;;; \ \/ /_ __ __| |/ _|
;;; \ /| '_ \ / _` | |_
;;; / \| |_) | (_| | _|
;;; /_/\_\ .__/ \__,_|_|
;;; |_|
;;
;; «find-xpdf-page» (to ".find-xpdf-page")
;; Xpdf is our default PDF viewer (except on W$). See:
;;
;; (find-pdf-like-intro "3. Hyperlinks to PDF files" "xpdf")
;; https://en.wikipedia.org/wiki/Xpdf
;; https://askubuntu.com/questions/1245518/how-to-install-xpdf-on-ubuntu-20-04
(defvar ee-find-xpdf-colon "")
(defun ee-find-xpdf-colon ()
"Return \":\" or \"\" according to the version of xpdf.
Some versions of xpdf need a \":\" before the page number -
they need be called as \"xpdf foo.pdf :42\" instead of as
\"xpdf foo.pdf 42\". In the future this function will try
to guess correctly if the \":\" is needed or not, but this
version just returns the value of the variable
`ee-find-xpdf-colon'."
ee-find-xpdf-colon)
(defvar ee-find-xpdf-page-options '("-fullscreen"))
(defun ee-find-xpdf-page (fname &optional page &rest rest)
`("xpdf"
,@ee-find-xpdf-page-options
,fname
,@(if page `(,(format "%s%d" (ee-find-xpdf-colon) page)))
))
(defun find-xpdf-page (fname &optional page &rest rest)
"This defun will be overridden by the `code-pdfbackend' below.
We define it just to make this work: (find-efunction 'find-xpdf-page)"
(interactive "fPDF file: ")
(find-bgprocess (ee-find-xpdf-page fname page)))
;; (find-code-pdfbackend "xpdf-page")
(code-pdfbackend "xpdf-page")
;;; _ __ _ _ _
;;; _ __ __| |/ _| |_ ___ | |_ _____ _| |_
;;; | '_ \ / _` | |_| __/ _ \| __/ _ \ \/ / __|
;;; | |_) | (_| | _| || (_) | || __/> <| |_
;;; | .__/ \__,_|_| \__\___/ \__\___/_/\_\\__|
;;; |_|
;;
;; «find-pdftotext-text» (to ".find-pdftotext-text")
;; Pdftotext is our default way of converting PDFs to text. See:
;;
;; (find-pdf-like-intro "3. Hyperlinks to PDF files" "pdftotext")
;; https://en.wikipedia.org/wiki/Pdftotext
(defvar ee-pdftotext-program "pdftotext")
(defun ee-find-pdftotext-text (fname &rest rest)
`(,ee-pdftotext-program "-layout" "-enc" "Latin1" ,(ee-expand fname) "-"))
(defun find-pdftotext-page (fname &optional page &rest rest)
"This defun will be overridden by the `code-pdftextbackend' below.
We define it just to make this work: (find-efunction 'find-pdftotext-page)"
(apply 'find-sh-page (ee-find-pdftotext-text fname) page rest))
;; (find-man "1 pdftotext")
;; (find-man "1 pdftotext" "-enc encoding-name")
;;
;; The option "-enc Latin1" above make pdftotext convert its output to
;; Latin1. If you prefer UTF-8, override the previous definition with
;; the one below, that it is commented out with a "'":
' (defun ee-find-pdftotext-text (fname &rest rest)
`(,ee-pdftotext-program "-layout" ,(ee-expand fname) "-"))
;; (find-code-pdftextbackend "pdftotext-text")
(code-pdftextbackend "pdftotext-text")
;;; _ __ _ _ _ ___
;;; _ __ __| |/ _| |_ ___ | |_ _____ _| |_( _ )
;;; | '_ \ / _` | |_| __/ _ \| __/ _ \ \/ / __/ _ \
;;; | |_) | (_| | _| || (_) | || __/> <| || (_) |
;;; | .__/ \__,_|_| \__\___/ \__\___/_/\_\\__\___/
;;; |_|
;;
;; Some PDFs are encoded in a way that confuses pdftotext, and none of
;; these ways of calling pdftotext work very well:
;;
;; pdftotext -layout -enc Latin1 foo.pdf -
;; pdftotext -layout foo.pdf -
;;
;; Then we can use a block like this,
;;
;; http://angg.twu.net/acker/acker__ga_livro1_2019.pdf
;; (code-pdf-page "ackerGA1" "$S/http/angg.twu.net/acker/acker__ga_livro1_2019.pdf")
;; (code-pdf-text "ackerGA1" "$S/http/angg.twu.net/acker/acker__ga_livro1_2019.pdf" 16)
;; (code-pdf-text8 "ackerGA1" "$S/http/angg.twu.net/acker/acker__ga_livro1_2019.pdf" 16)
;; (find-ackerGA1page)
;; (find-ackerGA1page 3 "Sumário")
;; (find-ackerGA1text 3 "Sumário")
;;
;; that lets us switch between `code-pdf-text', that uses "pdftotext
;; -layout -enc Latin1", and `code-pdf-text8', that uses "pdftotext
;; -layout".
;;
;; «find-pdftotext8-text» (to ".find-pdftotext8-text")
(defun ee-find-pdftotext8-text (fname &rest rest)
`(,ee-pdftotext-program "-layout" ,(ee-expand fname) "-"))
(defun ee-find-pdf-text8 (fname &rest rest)
`(,ee-pdftotext-program "-layout" ,(ee-expand fname) "-"))
(defun find-pdftotext8-text (fname &optional page &rest rest)
"This defun will be overridden by the `code-pdftextbackend' below.
We define it just to make this work: (find-efunction 'find-pdftotext-page)"
(apply 'find-sh-page (ee-find-pdftotext8-text fname) page rest))
(defun find-pdf-text8 (fname &optional page &rest rest)
"This defun will be overridden by the `code-pdftextbackend' below.
We define it just to make this work: (find-efunction 'find-pdftotext-page)"
(apply 'find-sh-page (ee-find-pdf-text8 fname) page rest))
;; (find-code-pdftextbackend "pdftotext8-text")
(code-pdftextbackend "pdftotext8-text")
;; (find-code-pdftextbackend "pdf-text8")
(code-pdftextbackend "pdf-text8")
;;; _____ __ __ _
;;; |_ _|__\ \/ /_ _____ _ __| | _____
;;; | |/ _ \\ /\ \ /\ / / _ \| '__| |/ / __|
;;; | | __// \ \ V V / (_) | | | <\__ \
;;; |_|\___/_/\_\ \_/\_/ \___/|_| |_|\_\___/
;;;
;; «find-texworkspdf-page» (to ".find-texworkspdf-page")
;; At one point TeXworks was my default PDF viewer on W$s. See:
;;
;; https://www.tug.org/texworks/
;; https://tug.org/pipermail/tex-live/2019-March/043227.html
;; https://tug.org/pipermail/tex-live/2019-March/043229.html
;; http://anggtwu.net/find-pdf-page.html
(defvar ee-texworks-program "texworks")
(defun ee-find-texworkspdf-page (fname &optional page)
`(,ee-texworks-program
,@(if page `(,(format "--position=%d" page)))
,fname
))
;; (find-code-pdfbackend "texworkspdf-page")
(code-pdfbackend "texworkspdf-page")
;;; _ __ _ _
;;; _ __ __| |/ _| | |_ ___ ___ | |___
;;; | '_ \ / _` | |_ _____| __/ _ \ / _ \| / __|
;;; | |_) | (_| | _|_____| || (_) | (_) | \__ \
;;; | .__/ \__,_|_| \__\___/ \___/|_|___/
;;; |_|
;;
;; «find-pdftools-page» (to ".find-pdftools-page")
;; This backend uses the Emacs package `pdf-tools' - that is "a better
;; DocView" - to display a PDF in an Emacs buffer. See:
;;
;; https://github.com/vedang/pdf-tools/
;; (find-epackage-links 'pdf-tools)
;; (find-epackage 'pdf-tools)
;; (find-enode "Document View")
;;
;; Note that `*-pdftools-page' is an atypical backend. In all the
;; "normal" backends the function `ee-find-FOO-page' returns the name
;; of an external program and its command-line arguments, and
;; `find-FOO-page' uses `find-bgprocess' to call that external
;; program...
;;
;; In the `*-pdftools-page' family of functions the function
;; `ee-find-pdftools-page' does not exist, and the
;; `(defun find-pdftools-page ...)' below OVERRIDES the
;; `(defun find-pdftools-page ...)' executed by the
;; `(code-pdfbackend "pdftools-page")'.
;;
;; (find-code-pdfbackend "pdftools-page")
(code-pdfbackend "pdftools-page")
(defun find-pdftools-page (pdffile &optional page &rest rest)
"Open PDFFILE in the current window using pdf-tools.
If PAGE is given, go to that page; if PAGE is nil, stay in the
current page."
(interactive "fPDF file: ")
;;
;; `pdf-loader-install' makes sure that pdf-tools is loaded and
;; that it has set up `auto-mode-alist' and `magic-mode-alist' to
;; make PDF files be opened in `pdf-view-mode' instead of in
;; `doc-view-mode'. See:
;; (find-evardescr 'auto-mode-alist "pdf")
;; (find-evardescr 'auto-mode-alist "pdf-view-mode")
;; (find-evardescr 'auto-mode-alist "doc-view-mode")
;; (find-efunction 'pdf-loader-install)
;; (find-efunction 'pdf-tools-install)
;;
;; Old way: (pdf-tools-install)
(require 'pdf-tools)
(require 'pdf-loader)
(pdf-loader-install)
;;
;; Open PDFFILE. You will get weird results if it is not a PDF.
;; Use two tricks with "revert" to reload the PDF if it has changed.
(let ((revert-without-query '(".*")))
(find-fline pdffile))
(revert-buffer nil 'noconfirm)
;;
;; If PAGE is given, go to that page.
(if page (pdf-view-goto-page page)))
;; «find-pdftoolsr-page» (to ".find-pdftoolsr-page")
;; Test:
;; (defalias 'find-pdf-page 'find-xpdf-page)
;; (defalias 'find-pdf-page 'find-pdftoolsr-page)
;; (find-pdf-page "~/Coetzee99.pdf" 1)
;; (find-pdf-page "~/Coetzee99.pdf" 3)
(defun find-pdftoolsr-page (fname &optional page &rest rest)
"Like `find-pdftools-page', but opens the PDF in the right window."
(interactive "fPDF file: ")
(find-2a nil '(find-pdftools-page fname page)))
;; The function `ee-pdftools-revert-all' below - from 2019 - was a
;; trick that I used to redisplay PDFs when I recompiled their LaTeX
;; source. In jan/2022 I added a `(revert-buffer ...)' to
;; `find-pdftools-page', and I _think_ that this will let me rewrite
;; my hacks that use `ee-pdftools-revert-all' in a much better way.
;;
;; My old notes are here: (find-es "emacs" "ee-pdftools-revert-all")
;; This function will probably be declared obsolete soon.
;;
(defun ee-pdftools-revert-all ()
"Run `revert-buffer' in all windows in which pdf-tools is showing PDFs.
This makes pdf-tools show the new version of these PDFs without
changing the page, the image size, the hscroll, and the vscroll
in each window."
(interactive)
(dolist (window (window-list-1))
(with-selected-window window
(if (eq major-mode 'pdf-view-mode)
(revert-buffer)))))
;;; _ _
;;; __ ____| |_ _(_)
;;; \ \/ / _` \ \ / / |
;;; > < (_| |\ V /| |
;;; /_/\_\__,_| \_/ |_|
;;;
;; «find-xdvi-page» (to ".find-xdvi-page")
;; Xdvi is my favorite viewer for DVI files - note: it doesn't support
;; PDF files! See:
;;
;; https://en.wikipedia.org/wiki/Xdvi
(defvar ee-find-xdvi-page-options '())
(defun ee-find-xdvi-page (fname &optional page)
`("xdvi"
,@ee-find-xdvi-page-options
,@(if page `(,(format "+%d" page)))
,fname))
;; (find-code-pdfbackend "xdvi-page")
(code-pdfbackend "xdvi-page")
;;; _ _ _
;;; __| |(_)_ _(_) _____ __
;;; / _` || \ \ / / |/ _ \ \ /\ / /
;;; | (_| || |\ V /| | __/\ V V /
;;; \__,_|/ | \_/ |_|\___| \_/\_/
;;; |__/
;;
;; «find-djview-page» (to ".find-djview-page")
;; DjView is a viewer for DJVU files.
;; The page argument does not work well with djview - see the cleanup
;; function below. I hate djview.
;;
;; http://djvu.sourceforge.net/djview4.html
;; https://packages.debian.org/sid/djview4
(defun find-djview-page (fname &optional page &rest rest)
(ee-find-djview-cleanup fname)
(find-bgprocess (ee-find-djview-page fname page)))
(defvar ee-find-djview-page-options '())
(defun ee-find-djview-page (fname &optional page)
`("djview"
,@ee-find-djview-page-options
,@(if page `(,(format "--page=%d" page)))
,fname))
(defun ee-find-djview-cleanup (&optional fname)
"A hack: clean up djview's 'recentFiles=' line in the config file if needed.
When we visit a file \"/path/foo.djvu\" with djview, go to the
page 234 and close djview, djview stores the filename
\"/path/foo.djvu\" and the page number 234 in the file
\"~/.config/DjVuLibre/DjView.conf\", in a line starting with
\"recentFiles=\" - and the next time we ask djview to open that
file it will go to the page 234 OVERRIDING THE ARGUMENT
\"--page=%d\"! This function is currently just a stub, but you
may want to put here code that cleans up that page information.")
;; (find-code-pdfbackend "djview-page")
(code-pdfbackend "djview-page")
;;; _____ _
;;; | ____|_ _(_)_ __ ___ ___
;;; | _| \ \ / / | '_ \ / __/ _ \
;;; | |___ \ V /| | | | | (_| __/
;;; |_____| \_/ |_|_| |_|\___\___|
;;;
;; «find-evince-page» (to ".find-evince-page")
;; Evince is a document viewer that supports several file formats. The
;; last time I tried it confused page labels and page indices and it
;; was slow. I haven't used it much. See:
;;
;; https://en.wikipedia.org/wiki/Evince
(defun find-evince-page (fname &optional page &rest rest)
(find-bgprocess (ee-find-evince-page fname page)))
(defvar ee-find-evince-page-options '())
(defun ee-find-evince-page (fname &optional page)
`("evince"