/usr/share/emacs/site-lisp/rail/rail-common.el is in rail 1.2.11-3.
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 117 118 119 120 121 122 123 124 125 126 127 128 | ;;; rail-common.el --- Replace Agent-string Internal Library -*- coding: iso-2022-7bit-ss2; -*-
;; Copyright (C) 1999 by Free Software Foundation, Inc.
;; Author: SHIMADA Mitsunobu <simm-emacs@fan.gr.jp>
;; Keywords: i18n, internal, rail
;; This file 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, or (at your option)
;; any later version.
;; This file 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 GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;
;;; Code:
(require 'rail-vars)
(defun rail-replace-character (string src dst)
"Replace character src -> dst"
(let ((len (length string))
(i 0))
(while (< i len)
(if (eq src (aref string i))
(aset string i dst))
(setq i (1+ i)))
string))
(defun rail-replace-into-iso8859-4 (string)
"Replace ISO-8859-1 string into ISO-8859-4."
(if rail-user-agent-replace-into-iso8859-4
(progn
(rail-replace-character string ?~ ?.DN~)
(rail-replace-character string ?.AN^ ?.DN^)
(rail-replace-character string ?.ANo ?.DNo)
(rail-replace-character string ?.ANO ?.DNO)
(rail-replace-character string ?.ANr ?.DNr)
(rail-replace-character string ?.ANR ?.DNR))))
(defmacro rail-assoc (string alist direction)
"Do assoc or rassoc, according to direction.
If direction is non-nil, returns (cdr (assoc string alist)).
If direction is nil, returns (car (rassoc string alist))."
(if (symbol-value direction)
(list 'cdr (list 'assoc string alist))
(list 'car (list 'rassoc string alist))))
(defun rail-replace-codename-primitive (form &rest alist)
"Replace codename according to pattern."
(save-excursion
(if (looking-at form)
(let* ((beg (match-beginning 2))
(end (match-end 2))
(code (buffer-substring beg end))
(ccode (rail-assoc code (apply 'append alist) rail-convert-direction)))
(goto-char beg)
(delete-region beg end)
(insert (or ccode code))))))
(defun rail-replace-codename-meadow (&optional char rchar)
"Replace Meadow codename according to pattern."
(save-excursion
(let* ((delimiter (cond ((stringp char)
(string-to-char char))
((integerp char)
char)
(t ?:)))
(new-delimiter (cond ((stringp rchar)
(string-to-char rchar))
((integerp rchar)
rchar)
(t delimiter))))
(if (looking-at (format rail-meadow-beta-version-header-format delimiter))
(let* ((b1 (match-beginning 2))
(e1 (match-end 2))
(b2 (match-beginning 3))
(e2 (match-end 3))
(num (buffer-substring b2 e2))
(flag (string-match "$BCJ(B" num))
(code (buffer-substring b1 e1))
(ccode (rail-assoc code
(append rail-additional-meadow-codename-alist
rail-meadow-codename-alist)
rail-convert-direction)))
(goto-char b1)
(delete-region b1 e2)
(insert (or ccode code) new-delimiter num)
(if flag
(or rail-convert-direction (delete-backward-char 1))
(and rail-convert-direction (insert "$BCJ(B"))))
(rail-replace-codename-primitive
rail-mule-version-header-format
rail-additional-meadow-codename-alist rail-meadow-codename-alist)))))
(defun rail-replace-codename (string flag &rest alist)
"Replace mule-version, (Meadow-version), and utf-2000-version string."
(let (buf result)
(save-excursion
(setq buf (get-buffer-create rail-temporary-buffer-name))
(if (set-buffer buf)
(progn
(erase-buffer)
(insert string)
(goto-char (point-min))
(if (not flag)
(apply 'rail-replace-codename-primitive rail-mule-version-header-format alist)
(search-forward "Meadow-" nil t)
(rail-replace-codename-meadow))
(setq result (buffer-substring (point-min) (point-max))))
(kill-buffer buf)))
(or result string)))
(provide 'rail-common)
;;; rail-common.el ends here
|