1072 |
(if (numberp nodepos) |
(if (numberp nodepos) |
1073 |
(+ (- nodepos lastfilepos) (point))))) |
(+ (- nodepos lastfilepos) (point))))) |
1074 |
|
|
1075 |
|
(defun Info-unescape-quotes (value) |
1076 |
|
"Unescape double quotes and backslashes in VALUE" |
1077 |
|
(let ((start 0) |
1078 |
|
(unquote value)) |
1079 |
|
(while (string-match "[^\\\"]*\\(\\\\\\)[\\\\\"]" unquote start) |
1080 |
|
(setq unquote (replace-match "" t t unquote 1)) |
1081 |
|
(setq start (- (match-end 0) 1))) |
1082 |
|
unquote)) |
1083 |
|
|
1084 |
|
;; As of Texinfo 4.6, makeinfo writes constructs like |
1085 |
|
;; \0\h[image param=value ...\h\0] |
1086 |
|
;; into the Info file for handling images. |
1087 |
|
(defun Info-split-parameter-string (parameter-string) |
1088 |
|
"Return alist of (\"KEY\" . \"VALUE\") from PARAMETER-STRING; a |
1089 |
|
whitespace separated list of KEY=VALUE pairs. If VALUE |
1090 |
|
contains whitespace or double quotes, it must be quoted in |
1091 |
|
double quotes and any double quotes or backslashes must be |
1092 |
|
escaped (\\\",\\\\)." |
1093 |
|
(let ((start 0) |
1094 |
|
(parameter-alist)) |
1095 |
|
(while (string-match |
1096 |
|
"\\s *\\([^=]+\\)=\\(?:\\([^\\s \"]+\\)\\|\\(?:\"\\(\\(?:[^\\\"]\\|\\\\[\\\\\"]\\)*\\)\"\\)\\)" |
1097 |
|
parameter-string start) |
1098 |
|
(setq start (match-end 0)) |
1099 |
|
(push (cons (match-string 1 parameter-string) |
1100 |
|
(or (match-string 2 parameter-string) |
1101 |
|
(Info-unescape-quotes |
1102 |
|
(match-string 3 parameter-string)))) |
1103 |
|
parameter-alist)) |
1104 |
|
parameter-alist)) |
1105 |
|
|
1106 |
|
(defun Info-display-images-node () |
1107 |
|
"Display images in current node." |
1108 |
|
(save-excursion |
1109 |
|
(let ((inhibit-read-only t) |
1110 |
|
(case-fold-search t) |
1111 |
|
paragraph-markers) |
1112 |
|
(goto-char (point-min)) |
1113 |
|
(while (re-search-forward |
1114 |
|
"\\(\0\b[[]image\\(\\(?:[^\b]\\|[^\0]+\b\\)*\\)\0\b[]]\\)" |
1115 |
|
nil t) |
1116 |
|
(let* ((start (match-beginning 1)) |
1117 |
|
(parameter-alist (Info-split-parameter-string (match-string 2))) |
1118 |
|
(src (cdr (assoc-string "src" parameter-alist))) |
1119 |
|
(image-file (if src (if (file-name-absolute-p src) src |
1120 |
|
(concat default-directory src)) |
1121 |
|
"")) |
1122 |
|
(image (if (file-exists-p image-file) |
1123 |
|
(create-image image-file) |
1124 |
|
"[broken image]"))) |
1125 |
|
(message "Found image: %S" image-file) |
1126 |
|
(if (not (get-text-property start 'display)) |
1127 |
|
(add-text-properties |
1128 |
|
start (point) `(display ,image rear-nonsticky (display))))))) |
1129 |
|
(set-buffer-modified-p nil))) |
1130 |
|
|
1131 |
(defvar Info-header-line nil |
(defvar Info-header-line nil |
1132 |
"If the info node header is hidden, the text of the header.") |
"If the info node header is hidden, the text of the header.") |
1133 |
(put 'Info-header-line 'risky-local-variable t) |
(put 'Info-header-line 'risky-local-variable t) |
1168 |
(if Info-enable-active-nodes (eval active-expression)) |
(if Info-enable-active-nodes (eval active-expression)) |
1169 |
(Info-fontify-node) |
(Info-fontify-node) |
1170 |
(setq Info-header-line (get-text-property (point-min) 'header-line)) |
(setq Info-header-line (get-text-property (point-min) 'header-line)) |
1171 |
|
(Info-display-images-node) |
1172 |
(run-hooks 'Info-selection-hook))))) |
(run-hooks 'Info-selection-hook))))) |
1173 |
|
|
1174 |
(defun Info-set-mode-line () |
(defun Info-set-mode-line () |