;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; http://user.it.uu.se/~embe8573/emacs-init/man-my.el ;;; https://dataswamp.org/~incal/emacs-init/man-my.el (require 'buc) (require 'close) (require 'man) (require 'scroll) (require 'super) (setq Man-notify-method 'pushy) ;; how were this ... (defun man-openbsd (page) (interactive "spage: ") (man (concat "-m openbsd " page) )) (defalias 'mano #'man-openbsd) ;; ... and this installed? (defun man-sunos (page) (interactive "spage: ") (man (concat "-m sunos " page) )) (defalias 'mans #'man-sunos) (defun man-suggest () (interactive) (navigate-buffer-category "*Man " #'switch-to-type "Man " 'man) ) (defun man-find-source () (interactive) (let*((Man-argument-list (split-string Man-arguments)) (section-or-name (car Man-argument-list)) (section (if (numberp section-or-name) section-or-name 1)) (name (car (last Man-argument-list))) (filename (substring (shell-command-to-string (format "whereis -m %s.%s | cut -d' ' -f 2" name section) ) 0 -1) )) (find-file filename) )) (let ((the-map Man-mode-map)) (disable-super-global-keys the-map) (set-bury-keys the-map) (set-scroll-keys the-map t) (define-key the-map "r" #'Man-update-manpage) (define-key the-map ";" #'man-find-source) (define-key the-map "P" #'scroll-up-pane) (define-key the-map "N" #'scroll-down-pane) ;; because M-p is the global binding for ;; `delete-other-windows'. so let's disable M-n ;; because if you use it you'll just start using ;; M-p as well, only this time incorrectly so - use ;; C-M-m and C-M-p and only them (define-key the-map "\M-n" #'nil) (define-key the-map "\C-\M-n" #'Man-next-manpage) (define-key the-map "\C-\M-p" #'Man-previous-manpage) (define-key the-map "b" #'Man-previous-manpage) )