This file is indexed.

/usr/share/emacs/site-lisp/lookup-el/lookup-kanji.el is in lookup-el 1.4.1-13.

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
;;; lookup-kanji.el --- Lookup Kanji-Kana Converter  -*-coding: euc-japan;-*-
;; Copyright (C) 1999 Lookup Development Team <lookup@ring.gr.jp>

;; Author: TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp>
;; Version: $Id: lookup-kanji.el,v 1.1.1.1 2001/11/28 18:32:41 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

;;; Code:

(require 'evi)
(require 'lookup-utils)
(require 'lookup-vars)

(defcustom lookup-kanji-command "kakasi"
  "*´Á»ú¤Ò¤é¤¬¤ÊÊÑ´¹¥×¥í¥°¥é¥à(KAKASI)¤Î̾Á°"
  :type 'string
  :group 'lookup-kanji)

(defcustom lookup-kanji-option '("-JH" "-p")
  "*´Á»ú¤Ò¤é¤¬¤ÊÊÑ´¹¥×¥í¥°¥é¥à(KAKASI)¤Î¥ª¥×¥·¥ç¥ó"
  :type 'list
  :group 'lookup-kanji)

(defcustom lookup-kanji-coding-system lookup-kakasi-coding-system
  "*´Á»ú¤Ò¤é¤¬¤ÊÊÑ´¹¥×¥í¥°¥é¥à(KAKASI)¤Î¸Æ¤Ó½Ð¤·¤ËÍѤ¤¤ëʸ»ú¥³¡¼¥É"
  :type 'symbol
  :group 'lookup-kanji)

(defvar lookup-kanji-process nil
  "´Á»ú¤Ò¤é¤¬¤ÊÊÑ´¹¥×¥í¥°¥é¥à¤Î¥×¥í¥»¥¹(ÆâÉôÊÑ¿ô)")

(defvar lookup-kanji-buffer nil
  "´Á»ú¤Ò¤é¤¬¤ÊÊÑ´¹¥×¥í¥°¥é¥à¤Î¥×¥í¥»¥¹¤ò´ØÏ¢¤Å¤±¤é¤ì¤¿¥Ð¥Ã¥Õ¥¡(ÆâÉôÊÑ¿ô)")

(defun lookup-kanji-generate-buffer ()
  "ºî¶ÈÍѥХåե¡¤òÀ¸À®¤¹¤ë´Ø¿ô"
  (unless (and (bufferp lookup-kanji-buffer)
	       (buffer-name lookup-kanji-buffer))
    (setq lookup-kanji-buffer (generate-new-buffer " *lookup-kanji*")
	  lookup-buffer-list (cons lookup-kanji-buffer lookup-buffer-list))
    (buffer-disable-undo lookup-kanji-buffer))
  lookup-kanji-buffer)

(defun lookup-kanji-start-process ()
  "´Á»ú¤Ò¤é¤¬¤ÊÊÑ´¹¥×¥í¥°¥é¥à¤òµ¯Æ°¤¹¤ë´Ø¿ô"
  (unless (and (processp lookup-kanji-process)
	       (eq (process-status lookup-kanji-process) 'run))
    (lookup-with-coding-system lookup-kanji-coding-system
      (setq lookup-kanji-process
	    (apply 'start-process
		   "lookup-kanji"
		   (lookup-kanji-generate-buffer)
		   lookup-kanji-command
		   lookup-kanji-option)))
    (sit-for 0.1)
    (process-kill-without-query lookup-kanji-process))
  lookup-kanji-process)

(defun lookup-kanji-send-string (str)
  "STR ¤ò¥×¥í¥»¥¹¤Îɸ½àÆþÎϤËÅϤ·¤Æ¡¢¤½¤Î·ë²Ì¤òÊÖ¤¹´Ø¿ô"
  (lookup-process-require (lookup-kanji-start-process) (concat str "\n") "\n")
  (save-excursion
    (set-buffer lookup-kanji-buffer)
    (goto-char (point-min))
    (forward-line 1)
    (prog1 (buffer-substring (point) (progn (end-of-line) (point)))
      (delete-region (point-min) (point-max)))))

(defun lookup-kanji-analysis-output (str)
  "KAKASI ¤Î½ÐÎϤ˴ޤޤì¤Æ¤¤¤ë³ç¸Ì¤ò²òÀϤ·¤Æ¥ê¥¹¥È¤ËŸ³«¤¹¤ë"
  (if (string-match "{\\([^}]+\\)}" str)
      (let ((x (substring str 0 (match-beginning 0)))
	    (y (substring str (match-end 0))))
	(apply 'nconc 
	       (mapcar 'lookup-kanji-analysis-output
		       (mapcar (lambda (s) (concat x s y))
			       (lookup-split-string (substring str (match-beginning 1) (match-end 1)) "|")))))
    (list str)))

(defun lookup-kanji-get-readings (str)
  "STR ¤ò´Á»ú¤Ò¤é¤¬¤ÊÊÑ´¹¤·¤ÆÆÀ¤é¤ì¤¿·ë²Ì¤Î¥ê¥¹¥È¤òÊÖ¤¹´Ø¿ô"
  (lookup-kanji-analysis-output (lookup-kanji-send-string str)))

(defun lookup-kanji-filter (str entries)
  "STR ¤¬¸«½Ð¤·¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¥¨¥ó¥È¥ê¤Î¤ß¤ò¼è¤ê½Ð¤¹¥Õ¥£¥ë¥¿´Ø¿ô"
  (let ((regex (mapconcat 'char-to-string (string-to-char-list string) ".?.?.?")))
    (delq nil (mapcar (lambda (entry)
			(if (string-match regex (lookup-entry-heading entry)) entry))
		      entries))))

(provide 'lookup-kanji)
;;; lookup-kanji.el ends here