comparison lisp/packages/info.el @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents e121b013d1f0
children 489f57a838ef
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
830 (len (length (buffer-string nil nil other)))) 830 (len (length (buffer-string nil nil other))))
831 (insert (buffer-string nil nil other)) 831 (insert (buffer-string nil nil other))
832 (goto-char (+ pt len)) 832 (goto-char (+ pt len))
833 (save-excursion 833 (save-excursion
834 (goto-char pt) 834 (goto-char pt)
835 (if (search-forward "* menu:" (+ pt len) t) 835 (if (search-forward "* Menu:" (+ pt len) t)
836 (progn 836 (progn
837 (forward-line 1) 837 (forward-line 1)
838 (delete-region pt (point))))))) 838 (delete-region pt (point)))))))
839 ;; In each, find all the menus. 839 ;; In each, find all the menus.
840 (save-excursion 840 (save-excursion
853 (setq end (point)) 853 (setq end (point))
854 (setq nodes (cons (list nodename other beg end) nodes)))))) 854 (setq nodes (cons (list nodename other beg end) nodes))))))
855 (setq others (cdr others)))) 855 (setq others (cdr others))))
856 856
857 ;; Add to the main menu a menu item for each other node. 857 ;; Add to the main menu a menu item for each other node.
858 (re-search-forward "^\\* Menu:") 858 (re-search-forward "^\\* Menu:" nil t)
859 (forward-line 1) 859 (forward-line 1)
860 (let ((menu-items '("top")) 860 (let ((menu-items '("top"))
861 (nodes nodes) 861 (nodes nodes)
862 (case-fold-search t) 862 (case-fold-search t)
863 (end (save-excursion (search-forward "\^_" nil t) (point)))) 863 (end (save-excursion (search-forward "\^_" nil t) (point))))
2237 (let* ((data (Info-find-nearest-node event)) 2237 (let* ((data (Info-find-nearest-node event))
2238 (name (nth 1 (nth 1 data)))) 2238 (name (nth 1 (nth 1 data))))
2239 (and name (nth 1 data)))) 2239 (and name (nth 1 data))))
2240 (error nil))) 2240 (error nil)))
2241 2241
2242 (defun Info-mouse-track-double-click-hook (event click-count)
2243 "Handle double-clicks by turning pages, like the `gv' ghostscript viewer"
2244 (if (/= click-count 2)
2245 ;; Return nil so any other hooks are performed.
2246 nil
2247 (let* ((x (event-x-pixel event))
2248 (y (event-y-pixel event))
2249 (w (window-pixel-width (event-window event)))
2250 (h (window-pixel-height (event-window event)))
2251 (w/3 (/ w 3))
2252 (w/2 (/ w 2))
2253 (h/4 (/ h 4)))
2254 (cond
2255 ;; In the top 1/4 and inside the middle 1/3
2256 ((and (<= y h/4)
2257 (and (>= x w/3) (<= x (+ w/3 w/3))))
2258 (Info-up)
2259 t)
2260 ;; In the lower 3/4 and the right 1/2
2261 ;; OR in the upper 1/4 and the right 1/3
2262 ((or (and (>= y h/4) (>= x w/2))
2263 (and (< y h/4) (>= x (+ w/3 w/3))))
2264 (Info-next)
2265 t)
2266 ;; In the lower 3/4 and the left 1/2
2267 ;; OR in the upper 1/4 and the left 1/3
2268 ((or (and (>= y h/4) (< x w/2))
2269 (and (< y h/4) (<= x w/3)))
2270 (Info-prev)
2271 t)
2272 ;; This shouldn't happen.
2273 (t
2274 (error "event out of bounds: %s %s" x y))))))
2275
2242 (defvar Info-mode-map nil 2276 (defvar Info-mode-map nil
2243 "Keymap containing Info commands.") 2277 "Keymap containing Info commands.")
2244 (if Info-mode-map 2278 (if Info-mode-map
2245 nil 2279 nil
2246 (setq Info-mode-map (make-keymap)) 2280 (setq Info-mode-map (make-keymap))
2383 (copy-face 'bold 'info-node))) 2417 (copy-face 'bold 'info-node)))
2384 (or (face-differs-from-default-p 'info-xref) 2418 (or (face-differs-from-default-p 'info-xref)
2385 (copy-face 'bold 'info-xref)))) 2419 (copy-face 'bold 'info-xref))))
2386 (make-local-variable 'mouse-track-click-hook) 2420 (make-local-variable 'mouse-track-click-hook)
2387 (add-hook 'mouse-track-click-hook 'Info-maybe-follow-clicked-node) 2421 (add-hook 'mouse-track-click-hook 'Info-maybe-follow-clicked-node)
2422 (add-hook 'mouse-track-click-hook 'Info-mouse-track-double-click-hook)
2388 ;; #### The console-on-window-system-p check is to allow this to 2423 ;; #### The console-on-window-system-p check is to allow this to
2389 ;; work on tty's. The real problem here is that featurep really 2424 ;; work on tty's. The real problem here is that featurep really
2390 ;; needs to have some device/console domain knowledge added to it. 2425 ;; needs to have some device/console domain knowledge added to it.
2391 (if (and (featurep 'toolbar) 2426 (if (and (featurep 'toolbar)
2392 (console-on-window-system-p) 2427 (console-on-window-system-p)