/usr/share/emacs/site-lisp/lookup-el/ndsrd.el is in lookup-el 1.4.1-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ;;; ndsrd.el --- search agent for $B>.3X4[!X%i%s%@%`%O%&%91Q8l<-E5!Y(B
;; Copyright (C) 1999 Lookup Development Team <lookup@ring.gr.jp>
;; Author: Keisuke Nishida <kei@psn.net>
;; Version: $Id: ndsrd.el,v 1.1.1.1 2001/11/28 18:32:46 kazuhiko Exp $
;; This file is part of Lookup.
;; Lookup is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version.
;; Lookup is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with Lookup; if not, write to the Free Software Foundation,
;; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
;;; Commentary:
;; $BMxMQ$9$k$K$O!"(B~/.emacs $B$G<!$N$h$&$K@_Dj$7$F2<$5$$!#(B
;;
;; (setq lookup-search-agents
;; '((ndsrd "/usr/local/dict/srd"
;; :fmt "/usr/local/dict/srd/csrd.fmt"
;; :gai "/usr/local/dict/srd/csrd.gai")))
;;; Code:
(require 'lookup)
(defconst ndsrd-version "0.3")
;;;
;:: Customizable variables
;;;
(defgroup ndsrd nil
"Lookup csrd interface."
:group 'lookup-agents)
(defcustom ndsrd-program-name "csrd"
"*csrd $B$N%3%^%s%IL>!#(B"
:type 'string
:group 'ndsrd)
(defcustom ndsrd-process-coding-system lookup-process-coding-system
"*Coding system for csrd process."
:type 'symbol
:group 'ndsrd)
;;;
;:: types
;;;
(put 'ndsrd ':methods '(exact prefix suffix substring))
(put 'ndsrd ':arranges
'(lookup-arrange-default-headings
lookup-arrange-fill-lines))
(put 'ndsrd ':adjusts
'(lookup-adjust-goto-min))
;;;
;:: Interface functions
;;;
(put 'ndsrd 'setup 'ndsrd-setup)
(defun ndsrd-setup (agent)
(let* ((directory (lookup-agent-location agent))
(format (lookup-agent-option agent ':fmt))
(gaiji (lookup-agent-option agent ':gai))
opts dictionary)
(if gaiji (setq opts (cons (concat "-g" gaiji) opts)))
(if format (setq opts (cons (concat "-f" format) opts)))
(setq opts (cons (concat "-d" directory) opts))
(list (lookup-new-dictionary agent opts "srd" "$B%i%s%@%`%O%&%91Q8l<-E5(B"))))
(put 'ndsrd 'clear 'ndsrd-clear)
(defun ndsrd-clear (agent) nil)
(put 'ndsrd 'search 'ndsrd-dictionary-search)
(defun ndsrd-dictionary-search (dictionary query)
(with-temp-buffer
(lookup-with-coding-system ndsrd-process-coding-system
(apply 'call-process ndsrd-program-name nil t nil
(append (lookup-dictionary-code dictionary)
(list (lookup-query-string query)))))
(goto-char (point-min))
(let (start content heading entries)
(while (re-search-forward "^$B""(B \\([^ \n]*\\)" nil 0)
(when start
(setq content (buffer-substring start (match-beginning 0)))
(setq entries (cons (lookup-make-entry dictionary content heading)
entries)))
(setq start (match-beginning 0) heading (match-string 1)))
(when start
(setq content (buffer-substring start (point)))
(setq entries (cons (lookup-make-entry dictionary content heading)
entries)))
(nreverse entries))))
(put 'ndsrd 'content 'ndsrd-dictionary-content)
(defun ndsrd-dictionary-content (dictionary entry)
(lookup-entry-code entry))
(provide 'ndsrd)
;;; ndsrd.el ends here
|