mirror of https://github.com/Chizi123/.emacs.d.git

Chizi123
2018-11-18 76bbd07de7add0f9d13c6914f158d19630fe2f62
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
;ELC
;;; Compiled
;;; in Emacs version 26.1
;;; with all optimizations.
 
;;; This file contains utf-8 non-ASCII characters,
;;; and so cannot be loaded into Emacs 22 or earlier.
(and (boundp 'emacs-version)
     (< (aref emacs-version (1- (length emacs-version))) ?A)
     (string-lessp emacs-version "23")
     (error "`%s' was compiled for Emacs 23 or later" #$))
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
(byte-code "\300\301!\210\300\302!\210\303\304\305\306\307\310%\210\311\312\313\314\315DD\316\307\304\317\320&\210\311\321\313\314\322DD\323\307\304\317\324&\210\311\325\313\314\326DD\327\307\304\317\330&\210\311\331\313\314\332DD\333\317\324%\207" [require cl-lib doc-view custom-declare-group x86-lookup nil "Options for x86 instruction set lookup." :group extensions custom-declare-variable x86-lookup-pdf funcall function #[0 "\300\207" [nil] 1] "Path to Intel's manual containing the instruction set reference." :type (choice (const nil) (file :must-match t)) x86-lookup-pdftotext-program #[0 "\300\207" [#1="pdftotext"] 1 #1#] "Path to pdftotext, part of Popper." string x86-lookup-browse-pdf-function #[0 "\300\207" [x86-lookup-browse-pdf-any] 1] "A function that launches a PDF viewer at a specific page.\nThis function accepts two arguments: filename and page number." (choice (function-item :tag "First suitable PDF reader" :value x86-lookup-browse-pdf-any) (function-item :tag "Evince" :value x86-lookup-browse-pdf-evince) (function-item :tag "Xpdf" :value x86-lookup-browse-pdf-xpdf) (function-item :tag "Okular" :value x86-lookup-browse-pdf-okular) (function-item :tag "gv" :value x86-lookup-browse-pdf-gv) (function-item :tag "zathura" :value x86-lookup-browse-pdf-zathura) (function-item :tag "MuPDF" :value x86-lookup-browse-pdf-mupdf) (function-item :tag "Sumatra PDF" :value x86-lookup-browse-pdf-sumatrapdf) (function-item :tag "browse-url" :value x86-lookup-browse-pdf-browser) (function :tag "Your own function")) x86-lookup-cache-directory #[0 "\300\301!\206 \300\302!\206 \303\304\305\"\207" [getenv "XDG_CACHE_HOME" "LocalAppData" "~/.cache" expand-file-name "x86-lookup"] 4] "Directory where the PDF mnemonic index with be cached."] 8)
#@45 Alist mapping instructions to page numbers.
(defvar x86-lookup-index nil (#$ . 2175))
#@50 How to expand mnemonics into multiple mnemonics.
(defvar x86-lookup--expansions '(("^PREFETCH\\(h\\)$" #1="" "nta" "t0" "t1" "t2") ("^J\\(cc\\)$" "a" "ae" "b" "be" "c" "cxz" "e" "ecxz" "g" "ge" "l" "le" "na" "nae" "nb" "nbe" "nc" "ne" "ng" "nge" "nl" "nle" "no" "np" "ns" "nz" "o" "p" "pe" "po" "rcxz" "s" "z") ("^SET\\(cc\\)$" "a" "ae" "b" "be" "c" "e" "g" "ge" "l" "le" "na" "nae" "nb" "nbe" "nc" "ne" "ng" "nge" "nl" "nle" "no" "np" "ns" "nz" "o" "p" "pe" "po" "s" "z") ("^CMOV\\(cc\\)$" "a" "ae" "b" "be" "c" "e" "g" "ge" "l" "le" "na" "nae" "nb" "nbe" "nc" "ne" "ng" "nge" "nl" "nle" "no" "np" "ns" "nz" "o" "p" "pe" "po" "s" "z") ("^FCMOV\\(cc\\)$" "b" "e" "be" "u" "nb" "ne" "nbe" "nu") ("^LOOP\\(cc\\)$" "e" "ne") ("^VBROADCAST\\(\\)$" #1# "ss" "sd" "f128") ("^VMASKMOV\\(\\)$" #1# "ps" "pd") ("^VPBROADCAST\\(\\)$" #1# "b" "w" "d" "q" "I128") ("^VPMASKMOV\\(\\)$" #1# "d" "q") ("\\(\\)" #1#)) (#$ . 2267))
#@87 Expand string of PDF-sourced mnemonics into user-friendly mnemonics.
 
(fn NAMES PAGE)
(defalias 'x86-lookup--expand #[514 "\302\303\304 \305\306\307\310\311!\312\"\313$\216\314\315\"\302\211\211\211\211:\203t@\262\316\317\320#\262\321    \322 $\262\211A\262\242\262\302\211\211:\203d@\262\323\302\211 \324%\262\227BB\262A\262\202A\211\237\266\204\237\244\262A\262\202\211\237\266\206)\262)\207" [case-fold-search x86-lookup--expansions nil #[514 "\300\"\207" [string-match] 5 "\n\n(fn S RE)"] match-data make-byte-code 0 "\301\300\302\"\207" vconcat vector [set-match-data evaporate] 3 split-string " */ *" replace-regexp-in-string " .+$" "" cl-assoc :test replace-match 1] 21 (#$ . 3188)])
#@163 Create an index alist from PDF mapping mnemonics to page numbers.
This function requires the pdftotext command line program.
 
(fn &optional (PDF x86-lookup-pdf))
(defalias 'x86-lookup-create-index #[128 "\211\203 \211A\262\242\202\203\305\306\307GTD\"\210\310\311\211\312\313\314!r\211q\210\315\316\317\320\321!\322\"\323$\216\324\f\325\312\325\326!\327&\210eb\210\3302}\331\325`dW\203k\332!\203a\211\333\334\331!\"\244\262\335 \210T\262\202K\336\330\337\340\341\342\343\344\312&\"\210\325\266\2020*\262+\262\207" [x86-lookup-pdf case-fold-search coding-system-for-write coding-system-for-read x86-lookup-pdftotext-program signal wrong-number-of-arguments x86-lookup-create-index "\\(?:.*\n\n?\\)?\\([[:alnum:]/[:blank:]]+\\)[[:blank:]]*\\(?:--\\|—\\)\\(?:.*\n\n?\\)\\{1,3\\}[[:blank:]]*Opcode" utf-8 t generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205    \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 call-process nil file-truename "-" --cl-block-nil-- 1 looking-at x86-lookup--expand match-string forward-page throw cl-remove-duplicates :key car :test string= :from-end] 16 (#$ . 3925)])
#@52 Return index filename from PDF filename.
 
(fn PDF)
(defalias 'x86-lookup--index-file #[257 "\300!\301P\207" [sha1 "_v3"] 3 (#$ . 5075)])
#@69 Save INDEX for PDF in `x86-lookup-cache-directory'.
 
(fn PDF INDEX)
(defalias 'x86-lookup--save-index #[514 "\301!\302\"\303\304\"\210\211\305\306\307!!\310\311\312\313\314!\315\"\316$\216r\211q\210\317p\"\210)r\211q\210\320\321\211\321\311%\210*\266\207" [x86-lookup-cache-directory x86-lookup--index-file expand-file-name mkdir t get-buffer-create generate-new-buffer-name " *temp file*" make-byte-code 0 "\301\300!\205    \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 prin1 write-region nil] 12 (#$ . 5219)])
#@63 Return index PDF from `x86-lookup-cache-directory'.
 
(fn PDF)
(defalias 'x86-lookup--load-index #[257 "\301!\302\"\303!\2057\304\305!r\211q\210\306\307\310\311\312!\313\"\314$\216\315!\210eb\210\31612\317p!0\2024\210\320*\262\207" [x86-lookup-cache-directory x86-lookup--index-file expand-file-name file-exists-p generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205    \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 insert-file-contents (error) read nil] 10 (#$ . 5756)])
#@61 Ensure the PDF index has been created, returning the index.
(defalias 'x86-lookup-ensure-index #[0 "\2045    \204\302\303!\210\2025\304    !\204\302\305!\210\2025\306    !\211\203)\210\2025\307\310!\210\311 \312    \"\210\207" [x86-lookup-index x86-lookup-pdf error "No PDF available. Set `x86-lookup-pdf'." file-exists-p "PDF not found. Check `x86-lookup-pdf'." x86-lookup--load-index message "Generating mnemonic index ..." x86-lookup-create-index x86-lookup--save-index] 3 (#$ . 6262)])
#@195 Ensure the PDF index has been created and (unconditionally) updated.
Useful for forcibly syncing the index with the current PDF without resorting
to manual deletion of index file on filesystem.
(defalias 'x86-lookup-ensure-and-update-index #[0 "\204\302\303!\207\304!\204\302\305!\207\306\307!\205#\310 \311    \"\210\306\312!\207" [x86-lookup-pdf x86-lookup-index error "No PDF available. Set `x86-lookup-pdf'." file-exists-p "PDF not found. Check `x86-lookup-pdf'." message "Generating mnemonic index ..." x86-lookup-create-index x86-lookup--save-index "Finished generating mnemonic index."] 3 (#$ . 6762) nil])
#@76 Launch a PDF viewer using `x86-lookup-browse-pdf-function'.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf #[514 "\"\207" [x86-lookup-browse-pdf-function] 5 (#$ . 7388)])
#@98 Jump to the PDF documentation for MNEMONIC.
Defaults to the mnemonic under point.
 
(fn MNEMONIC)
(defalias 'x86-lookup #[257 "\302\"A\303\304    !\"\207" [x86-lookup-index x86-lookup-pdf assoc x86-lookup-browse-pdf file-truename] 5 (#$ . 7569) (byte-code "\301 \210\302\303\"\304\305!\211\235\205\211\211\203\306\307\"\202\310\311\312\313\312\211&C\207" [x86-lookup-index x86-lookup-ensure-index mapcar car thing-at-point word format "Mnemonic (default %s): " "Mnemonic: " completing-read nil t] 12)])
#@84 View PDF at PAGE using Emacs' `pdf-view-mode' and `display-buffer'.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-pdf-tools #[514 "\300\301!\210\302\303\304\305\306\"!!r\307\310\311\312\313!\314\"\315$\216\316@\317\"\210\320!\210*\210\207" [require pdf-tools t internal--before-with-selected-window display-buffer find-file-noselect :nowarn make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-with-selected-window] 2 select-window norecord pdf-view-goto-page] 10 (#$ . 8091)])
#@84 View PDF at PAGE using Emacs' `doc-view-mode' and `display-buffer'.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-doc-view #[514 "\300\301\302!\204 \303\304!\210\305\306\307\310\"!!r\311\312\313\314\315!\316\"\317$\216\320@\321\"\210\322!\210*\210\207" [t doc-view-mode-p pdf error "doc-view not available for PDF" internal--before-with-selected-window display-buffer find-file-noselect :nowarn make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-with-selected-window] 2 select-window norecord doc-view-goto-page] 10 (#$ . 8593)])
#@45 View PDF at PAGE using xpdf.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-xpdf #[514 "\300\301\302\301\303\304\305\"&\207" [start-process "xpdf" nil "--" format "%d"] 11 (#$ . 9150)])
#@47 View PDF at PAGE using Evince.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-evince #[514 "\300\301\302\301\303\304\305\"\306&\207" [start-process "evince" nil "-p" format "%d" "--"] 10 (#$ . 9348)])
#@52 View PDF at PAGE file using Okular.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-okular #[514 "\300\301\302\301\303\304\305\"\306&\207" [start-process "okular" nil "-p" format "%d" "--"] 10 (#$ . 9561)])
#@43 View PDF at PAGE using gv.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-gv #[514 "\300\301\302\301\303\304\305\"\306&\207" [start-process "gv" nil "-nocenter" format "-page=%d" "--"] 10 (#$ . 9779)])
#@48 View PDF at PAGE using zathura.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-zathura #[514 "\300\301\302\301\303\304\305\"\306&\207" [start-process "zathura" nil "-P" format "%d" "--"] 10 (#$ . 9993)])
#@52 View PDF at PAGE using Sumatra PDF.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-sumatrapdf #[514 "\300\301\302\301\303\304\305\"&\207" [start-process "sumatrapdf" nil "-page" format "%d"] 10 (#$ . 10209)])
#@46 View PDF at PAGE using MuPDF.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-mupdf #[514 "\300\301!\206\302\303\302\304\305\306\307    \"&\207" [executable-find "mupdf-x11" "mupdf" start-process nil "--" format "%d"] 12 (#$ . 10430)])
#@75 Visit PDF using `browse-url' with a fragment for the PAGE.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-browser #[514 "\300\301\302#!\207" [browse-url format "file://%s#%d"] 7 (#$ . 10676)])
#@63 Try visiting PDF using the first viewer found.
 
(fn PDF PAGE)
(defalias 'x86-lookup-browse-pdf-any #[514 "\3001\f\301\"0\202\210\202\206\301\3021\303\"0\202#\210\202&\206\301\30412\305\"0\2026\210\2029\206\301\3061E\307\"0\202I\210\202L\206\301\3101X\311\"0\202\\\210\202_\206\301\3121k\313\"0\202o\210\202r\206\301\3141~\315\"0\202\202\210\202\205\206\301\3161\221\317\"0\202\225\210\202\230\206\301\3201\244\321\"0\202\250\210\202\253\206\301\3221\267\323\"0\202\273\210\202\276\206\301\324\325!\207" [(error) x86-lookup-browse-pdf-pdf-tools (error) x86-lookup-browse-pdf-doc-view (error) x86-lookup-browse-pdf-evince (error) x86-lookup-browse-pdf-xpdf (error) x86-lookup-browse-pdf-okular (error) x86-lookup-browse-pdf-gv (error) x86-lookup-browse-pdf-zathura (error) x86-lookup-browse-pdf-mupdf (error) x86-lookup-browse-pdf-sumatrapdf (error) x86-lookup-browse-pdf-browser error "Could not find a PDF viewer."] 5 (#$ . 10878)])
(provide 'x86-lookup)