File: dot.lookup.el

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 (79 lines) | stat: -rw-r--r-- 2,513 bytes parent folder | download | duplicates (7)
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
;;; .lookup.el --- sample of ~/.lookup.el  -*-mode: emacs-lisp;-*-

;; Author: Tatsuya Kinoshita <tats@vega.ocn.ne.jp>

;; Unlimited permission is granted to use, copy, distribute and/or modify
;; this file.  There is NO WARRANTY.

;;; Commentary:

;; The following is a sample of ~/.emacs.
;;
;; (autoload 'my-lookup-word "lookup" nil t)
;; (global-set-key "\C-cl" 'my-lookup-word)
;; (global-set-key "\C-cL" 'lookup)
;; (setq lookup-enable-splash nil)

;;; Code:

(defun my-lookup-word (&optional arg)
  "Read a word from the minibuffer for Lookup.
The current word is used by default.
With \\[universal-argument], the current region is used."
  (interactive "P")
  (if arg
      (my-lookup-region)
    (my-lookup-read-from-minibuffer (lookup-current-word))))

(defun my-lookup-region ()
  "Read a word from the minibuffer for Lookup.
The current region is used by default."
  (interactive)
  (my-lookup-read-from-minibuffer
   (buffer-substring-no-properties (or (mark) (point)) (point))))

(defun my-lookup-read-from-minibuffer (&optional string)
  (if (null string) (setq string ""))
  (while (string-match "[\n\t]+" string)
    (setq string (replace-match " " nil t string)))
  (while (string-match "  +" string)
    (setq string (replace-match " " nil t string)))
  (while (string-match "\\(^ \\| $\\)" string)
    (setq string (replace-match "" nil t string)))
  (lookup-pattern (lookup-read-string "Look up" string 'lookup-input-history)))

(setq lookup-default-method 'prefix) ;; Default value is 'exact
(setq lookup-default-dictionary-options '((:stemmer . stem-english)))

;;;(setq lookup-search-agents
;;;      '(
;;;	(ndeb "/usr/local/share/dict/epwing/XXX" ;; Copy from EPWING CD-ROM
;;;	      ;; To create an appendix data, use eb-utils' ebappendix command.
;;;	      ;; See also http://www.sra.co.jp/people/m-kasahr/eb/appendix.html
;;;	      :appendix "/usr/local/share/dict/epwing-appendix/XXX"
;;;	      :alias "XXX")
;;;	(ndeb "/usr/share/dict/epwing/edict" ;; edict-fpw
;;;	      :alias "edict")
;;;	(ndict "localhost" :coding utf-8-dos) ;; dictd and dictd-dictionary
;;;	(ndic "/usr/share/dictd") ;; without dictd, slow, UTF-8 is unsupported
;;;	(ndtp "localhost") ;; ndtpd
;;;	(ndkks) ;; kakasi
;;;	(ndspell) ;; ispell
;;;	;;
;;;	))

;;;(setq lookup-search-modules
;;;      '(
;;;	("default"
;;;	 "ndeb+XXX:YYY"
;;;	 "ndeb+edict:"
;;;	 "ndict+localhost:jargon"
;;;	 "ndict+localhost:foldoc"
;;;	 "ndict+localhost:vera"
;;;	 ;;
;;;	 )
;;;	("all" "")
;;;	;;
;;;	))

;;; .lookup.el ends here