File: emacsen-startup

package info (click to toggle)
lookup-el 1.4.1-8
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,664 kB
  • sloc: lisp: 6,600; sh: 475; makefile: 120
file content (153 lines) | stat: -rw-r--r-- 5,125 bytes parent folder | download | duplicates (2)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
;;; 50lookup-el.el --- Debian lookup-el startup file  -*-mode: emacs-lisp;-*-

;;; Code:

(let ((lispdir (concat "/usr/share/"
		       (symbol-name flavor) "/site-lisp/lookup-el")))
  (when (and (featurep 'mule) (file-readable-p (concat lispdir "/lookup.elc")))
    (if (fboundp 'debian-pkg-add-load-path-item)
	(debian-pkg-add-load-path-item lispdir)
      (setq load-path (cons lispdir load-path)))
    (autoload 'lookup "lookup" nil t)
    (autoload 'lookup-region "lookup" nil t)
    (autoload 'lookup-pattern "lookup" nil t)
    (add-hook 'lookup-load-hook 'lookup-set-debian-default)
    ;;
(defconst lookup-select-mode-help-en
  "Lookup Select mode:

`n'(ext)      - Next dictionary
`p'(revios)   - Previous dictionary

`m'(ark)      - Mark dictionary
`u'(nmark)    - Unmark dictionary
`a'(ll)       - Mark all dictionary
`RET'         - Mark this dictionary
`d'(isable)   - Disable dictionary (`D' mark)
(e)`x'(ecute) - Execute `D' mark

`f'(ind)    - Input text and search
`/'           - Text search this dictionary
`M'(enu)    - Display dictionary menu
`C'(opyright) - Display dictionary copyright
`o'(pen)    - Maximize window

`q'    - Quit buffer
`g'    - Initialize module
`Q'    - Quit Lookup
`R'    - Restart Lookup")

(defconst lookup-entry-mode-help-en
  "Lookup Entry mode:

`n'(ext)     - Next entry
`M-n' - Next history
`p'(revious) - Previous entry
`M-p' - Previous history

`v'(iew)   - Overview mode
`o'(pen)  - Maximize window
`s'(earch) - isearch-forward  	
`i'(nfo)  - Display entry info
`t'(oggle) - Toggle text processing
`w'(rite) - Write content to kill ring
`f'(ind)   - Input text to search

`M'(enu)   - Display dictionary menu
`C'(opyright) - Display dictionary copyright
`L'(inks)  - Display links
`S'(elect) - Select mode

`r'   - Go to buffer
`h'   - Go to Content buffer
`q'   - Quit buffer
`g'   - Search again
`Q'   - Quit Lookup
`R'   - Restart Lookup")

(defconst lookup-content-mode-help-en
  "Lookup Content mode:

`SPC' - Next page               `<'   - First buffer
`DEL' - Previous page           `>'   - Last buffer

`TAB' - Next link               `RET' - Follow link

`t'   - Toggle text processing  `w'   - Write region to kill ring
`h'   - Go to Entry buffer      `g'   - Update buffer
`q'   - Quit buffer             `?'   - Help")

(defun lookup-search-agents-debian-default ()
  (let (agents)
    (if (and (eq (call-process "egrep" "/etc/inetd.conf" nil nil "^ndtp[ \t]")
		 0)
	     (file-exists-p "/usr/sbin/ndtpd"))
	;; ndtp
	(add-to-list 'agents '(ndtp "localhost") 'append)
      ;; ndeb
      (when (file-executable-p "/usr/bin/eblook")
	(let ((dirs 
	       (append
		(and (file-directory-p "/usr/local/share/dict/epwing")
		     (directory-files "/usr/local/share/dict/epwing"
				      'full "[^.]"))
		(and (file-directory-p "/usr/share/dict/epwing")
		     (directory-files "/usr/share/dict/epwing"
				      'full "[^.]"))))
	      d d-a)
	  (while dirs
	    (setq d (car dirs))
	    (when (or (file-readable-p (concat d "/catalogs"))
		      (file-readable-p (concat d "/catalog")))
	      (if (and (string-match "/epwing/" d)
		       (setq d-a (replace-match "/epwing-appendix/" nil t d))
		       (or (file-readable-p (concat d-a "/catalogs"))
			   (file-readable-p (concat d-a "/catalog"))))
		  (add-to-list 'agents `(ndeb ,d :appendix ,d-a) 'append)
		(add-to-list 'agents `(ndeb ,d) 'append)))
	    (setq dirs (cdr dirs))))))
    (if (or (and (file-exists-p "/var/run/dictd.pid")
		 (file-exists-p "/usr/sbin/dictd"))
	    (and (file-exists-p "/var/run/dicod/dicod.pid")
		 (file-exists-p "/usr/bin/dicod")))
	;; ndict
	(if (or (and (fboundp 'find-coding-system)
		     (find-coding-system 'utf-8-dos))
		(and (fboundp 'coding-system-p)
		     (coding-system-p 'utf-8-dos)))
	    (add-to-list 'agents
			 '(ndict "localhost" :coding utf-8-dos) 'append)
	  (add-to-list 'agents '(ndict "localhost") 'append))
      ;; ndic
      (if (file-directory-p "/usr/local/share/dictd")
	  (add-to-list 'agents '(ndic "/usr/local/share/dictd") 'append))
      (if (file-directory-p "/usr/share/dictd")
	  (add-to-list 'agents '(ndic "/usr/share/dictd") 'append)))
    ;; ndspell
    (cond
     ((file-executable-p "/usr/bin/ispell")
      (setq ndspell-ispell-program "ispell")
      (add-to-list 'agents '(ndspell) 'append))
     ((file-executable-p "/usr/bin/hunspell")
      (setq ndspell-ispell-program "hunspell")
      (add-to-list 'agents '(ndspell) 'append)))
    ;; ndkks
    (if (file-executable-p "/usr/bin/kakasi")
	(add-to-list 'agents '(ndkks) 'append))
    agents))

(defun lookup-set-debian-default ()
  (if (null lookup-search-agents)
      (setq lookup-search-agents (lookup-search-agents-debian-default)))
  (if (string= current-language-environment "Japanese")
      ()
    (eval-after-load "lookup-select"
      '(defconst lookup-select-mode-help lookup-select-mode-help-en))
    (eval-after-load "lookup-entry"
      '(defconst lookup-entry-mode-help lookup-entry-mode-help-en))
    (eval-after-load "lookup-content"
      '(defconst lookup-content-mode-help lookup-content-mode-help-en))))
    ;;
    ))

;;; 50lookup-el.el ends here