rfc.el 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. (setq ffap-rfc-directories (list (expand-file-name "~/src/rfc")))
  2. (setq irfc-directory (expand-file-name "~/src/rfc"))
  3. (defcustom irfc-file-regexp
  4. (rx "rfc" (one-or-more numeric) ".txt")
  5. "Regexp matching RFC file."
  6. :group 'irfc
  7. :type 'regexp)
  8. (add-to-list 'auto-mode-alist `(,irfc-file-regexp . irfc-mode))
  9. (defvar irfc-mode-map
  10. (let ((map (make-sparse-keymap)))
  11. (define-key map (kbd "h") 'backward-char)
  12. (define-key map (kbd "l") 'forward-char)
  13. (define-key map (kbd "e") 'scroll-down)
  14. (define-key map (kbd "SPC") 'scroll-up)
  15. (define-key map (kbd "J") 'irfc-scroll-up-one-line)
  16. (define-key map (kbd "K") 'irfc-scroll-down-one-line)
  17. (define-key map (kbd ",") 'end-of-buffer)
  18. (define-key map (kbd ".") 'beginning-of-buffer)
  19. (define-key map (kbd "T") 'irfc-render-toggle)
  20. (define-key map (kbd "q") 'irfc-quit)
  21. (define-key map (kbd "o") 'irfc-follow)
  22. (define-key map (kbd "v") 'irfc-visit)
  23. (define-key map (kbd "r") 'irfc-reference-goto)
  24. (define-key map (kbd "g") 'irfc-head-goto)
  25. (define-key map (kbd "F") 'irfc-head-number-goto)
  26. (define-key map (kbd "G") 'irfc-page-goto)
  27. (define-key map (kbd "N") 'irfc-page-next)
  28. (define-key map (kbd "P") 'irfc-page-prev)
  29. (define-key map (kbd ">") 'irfc-page-last)
  30. (define-key map (kbd "<") 'irfc-page-first)
  31. (define-key map (kbd "b") 'irfc-page-table)
  32. (define-key map (kbd "n") '(lambda ()
  33. (interactive)
  34. (irfc-head-next)
  35. (recenter-top-bottom 0)))
  36. (define-key map (kbd "p") '(lambda ()
  37. (interactive)
  38. (irfc-head-prev)
  39. (recenter-top-bottom 0)))
  40. (define-key map (kbd "G") 'irfc-table-jump)
  41. (define-key map (kbd "<tab>") 'irfc-rfc-link-next)
  42. (define-key map (kbd "<backtab>") 'irfc-rfc-link-prev)
  43. (define-key map (kbd "<f7>")
  44. (lambda ()
  45. (interactive)
  46. (call-interactively 'next-line)
  47. (call-interactively 'other-window)
  48. (call-interactively '(lambda nil
  49. (interactive)
  50. (irfc-head-next)
  51. (recenter-top-bottom 0)))
  52. (call-interactively 'other-window)))
  53. (define-key map (kbd "<f8>")
  54. (lambda ()
  55. (interactive)
  56. (call-interactively 'previous-line)
  57. (call-interactively 'other-window)
  58. (call-interactively '(lambda nil
  59. (interactive)
  60. (irfc-head-prev)
  61. (recenter-top-bottom 0)))
  62. (call-interactively 'other-window)))
  63. ;; (define-key map (kbd "<f8>") 'show-translation)
  64. map)
  65. "Keymap used by `irfc-mode'.")