Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
6edcb099
Commit
6edcb099
authored
Oct 04, 1999
by
Dave Love
Browse files
#
parent
d56a5054
Changes
50
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
23169 additions
and
10041 deletions
+23169
-10041
lisp/ChangeLog
lisp/ChangeLog
+26
-0
lisp/ChangeLog.7
lisp/ChangeLog.7
+23143
-0
lisp/bdf.el
lisp/bdf.el
+0
-403
lisp/docref.el
lisp/docref.el
+0
-296
lisp/dos-win32.el
lisp/dos-win32.el
+0
-170
lisp/gnus-cache.el
lisp/gnus-cache.el
+0
-623
lisp/gnus-cite.el
lisp/gnus-cite.el
+0
-732
lisp/gnus-cus.el
lisp/gnus-cus.el
+0
-683
lisp/gnus-demon.el
lisp/gnus-demon.el
+0
-222
lisp/gnus-edit.el
lisp/gnus-edit.el
+0
-630
lisp/gnus-ems.el
lisp/gnus-ems.el
+0
-242
lisp/gnus-gl.el
lisp/gnus-gl.el
+0
-872
lisp/gnus-kill.el
lisp/gnus-kill.el
+0
-655
lisp/gnus-mh.el
lisp/gnus-mh.el
+0
-105
lisp/gnus-msg.el
lisp/gnus-msg.el
+0
-929
lisp/gnus-nocem.el
lisp/gnus-nocem.el
+0
-247
lisp/gnus-salt.el
lisp/gnus-salt.el
+0
-654
lisp/gnus-scomo.el
lisp/gnus-scomo.el
+0
-110
lisp/gnus-score.el
lisp/gnus-score.el
+0
-2258
lisp/gnus-setup.el
lisp/gnus-setup.el
+0
-210
No files found.
lisp/ChangeLog
View file @
6edcb099
1999-10-04 Dave Love <fx@gnu.org>
* cus-start.el: Add x-stretch-cursor, indicate-empty-lines,
scroll-up-aggressively, scroll-down-aggressively.
* widget.el (define-widget-keywords): Make dummy definition and
comment-out its use.
* time.el (display-time-mode): Add autoload cookie.
* term.el: Avoid ange-ftp related compilation warnings.
* sun-curs.el: Require sun-fns.
* msb.el: (msb--choose-file-menu): Use `completion-ignore-case' in
name comparisons.
* rect.el: Add/fix various doc strings. Add `*' to all the
interactive specs.
(delete-extract-rectangle): Doc fix from verna.
* tooltip.el (tooltip-mode): Customize this, per convention.
(tooltip-active): Option deleted.
* help-macro.el (three-step-help): Customize.
1999-10-03 Dave Love <fx@gnu.org>
* image.el (defimage): Remove redundant code. Substitute file in
...
...
lisp/ChangeLog.7
0 → 100644
View file @
6edcb099
This diff is collapsed.
Click to expand it.
lisp/bdf.el
deleted
100644 → 0
View file @
d56a5054
;;; bdf.el --- BDF font file handler for ps-print.
;; Copyright (C) 1998 Electrotechnical Laboratory, JAPAN.
;; Licensed to the Free Software Foundation.
;; Keywords: BDF, font, PostScript
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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:
;; Functions for getting bitmap information from X's BDF font file are
;; provided.
;;; Code:
(
eval-when-compile
(
require
'ps-print
))
(
defvar
bdf-directory-list
nil
"*List of directories to search for `BDF' font files."
)
(
defun
bdf-expand-file-name
(
bdfname
)
"Return an abosolute path name of a `BDF' font file BDFNAME.
It searches directories listed in the variable `bdf-directory-list'
for BDFNAME."
(
if
(
file-name-absolute-p
bdfname
)
(
if
(
file-readable-p
bdfname
)
bdfname
)
(
let
((
l
bdf-directory-list
))
(
catch
'tag
(
while
l
(
if
(
file-readable-p
(
expand-file-name
bdfname
(
car
l
)))
(
throw
'tag
(
expand-file-name
bdfname
(
car
l
))))
(
setq
l
(
cdr
l
)))))))
(
defsubst
bdf-file-mod-time
(
filename
)
"Return modification time of FILENAME.
The value is a list of two integers, the first integer has high-order
16 bits, the second has low 16 bits."
(
nth
5
(
file-attributes
filename
)))
(
defun
bdf-file-newer-than-time
(
filename
mod-time
)
"Return non-nil if and only if FILENAME is newer than MOD-TIME.
MOD-TIME is a modification time as a list of two integers, the first
integer has high-order 16 bits, the second has low 16 bits."
(
let
((
new-mod-time
(
bdf-file-mod-time
(
bdf-expand-file-name
filename
))))
(
or
(
>
(
car
new-mod-time
)
(
car
mod-time
))
(
and
(
=
(
car
new-mod-time
)
(
car
mod-time
))
(
>
(
nth
1
new-mod-time
)
(
nth
1
mod-time
))))))
(
defun
bdf-find-file
(
bdfname
)
"Return a buffer visiting a bdf file BDFNAME.
If BDFNAME is not an absolute path, directories listed in
`bdf-directory-list' is searched.
If BDFNAME doesn't exist, return nil."
(
let
((
buf
(
generate-new-buffer
" *bdf-work*"
))
(
coding-system-for-read
'no-conversion
))
(
save-excursion
(
set-buffer
buf
)
(
insert-file-contents
(
bdf-expand-file-name
bdfname
))
buf
)))
(
defvar
bdf-cache-file
"~/.bdfcache.el"
"Name of cache file which contains information of `BDF' font files."
)
(
defvar
bdf-cache
nil
"Cached information of `BDF' font files. It is a list of FONT-INFO.
FONT-INFO is a list of the following format:
(BDFFILE ABSOLUTE-PATH MOD-TIME SIZE FONT-BOUNDING-BOX
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
See the documentation of the function `bdf-read-font-info' for more detail."
)
(
defun
bdf-read-cache
()
"Return a cached information about `BDF' font files from a cache file.
The variable `bdf-cache-file' holds the cache file name.
If the cache file is not readable, this return nil."
(
setq
bdf-cache
nil
)
(
condition-case
nil
(
if
(
file-readable-p
bdf-cache-file
)
(
load-file
bdf-cache-file
))
(
error
nil
))
(
if
(
not
(
listp
bdf-cache
))
(
setq
bdf-cache
nil
)))
(
defun
bdf-write-cache
()
"Write out cached information of `BDF' font file to a file.
The variable `bdf-cache-file' holds the cache file name.
The file is written if and only if the file alreay exists and writable."
(
if
(
and
bdf-cache
(
file-exists-p
bdf-cache-file
)
(
file-writable-p
bdf-cache-file
))
(
write-region
(
format
"(setq bdf-cache '%S)\n"
bdf-cache
)
nil
bdf-cache-file
)))
(
defun
bdf-set-cache
(
font-info
)
"Cache FONT-INFO as information about one `BDF' font file.
FONT-INFO is a list of the following format:
(BDFFILE ABSOLUTE-PATH MOD-TIME SIZE FONT-BOUNDING-BOX
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
See the documentation of the function `bdf-read-font-info' for more detail."
(
let
((
slot
(
assoc
(
car
font-info
)
bdf-cache
)))
(
if
slot
(
setcdr
slot
(
cdr
font-info
))
(
setq
bdf-cache
(
cons
font-info
bdf-cache
)))))
(
defun
bdf-initialize
()
"Initialize `bdf' library."
(
if
(
bdf-read-cache
)
(
add-hook
'kill-emacs-hook
'bdf-write-cache
)))
(
defun
bdf-compact-code
(
code
code-range
)
(
if
(
or
(
<
code
(
aref
code-range
4
))
(
>
code
(
aref
code-range
5
)))
(
setq
code
(
aref
code-range
6
)))
(
+
(
*
(
-
(
lsh
code
-8
)
(
aref
code-range
0
))
(
1+
(
-
(
aref
code-range
3
)
(
aref
code-range
2
))))
(
-
(
logand
code
255
)
(
aref
code-range
2
))))
(
defun
bdf-expand-code
(
code
code-range
)
(
let
((
code0-range
(
1+
(
-
(
aref
code-range
3
)
(
aref
code-range
2
)))))
(
+
(
*
(
+
(
/
code
code0-range
)
(
aref
code-range
0
))
256
)
(
+
(
%
code
code0-range
)
(
aref
code-range
2
)))))
(
defun
bdf-read-font-info
(
bdfname
)
"Read `BDF' font file BDFNAME and return information (FONT-INFO) of the file.
FONT-INFO is a list of the following format:
(BDFFILE ABSOLUTE-PATH MOD-TIME FONT-BOUNDING-BOX
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
BDFFILE is a name of a font file (excluding directory part).
ABSOLUTE-PATH is an absolute path of the font file.
MOD-TIME is last modification time as a list of two integers, the
first integer has high-order 16 bits, the second has low 16 bits.
SIZE is a size of the font. This value is got from SIZE record of the
font.
FONT-BOUNDING-BOX is the font bounding box as a list of four integers,
BBX-WIDTH, BBX-HEIGHT, BBX-XOFF, and BBX-YOFF.
RELATIVE-COMPOSE is an integer value of the font's property
`_MULE_RELATIVE_COMPOSE'. If the font doesn't have this property, the
value is 0.
BASELINE-OFFSET is an integer value of the font's property
`_MULE_BASELINE_OFFSET'. If the font doesn't have this property, the
value is 0.
CODE-RANGE is a vector of minimum 1st byte, maximum 1st byte, minimum
2nd byte, maximum 2nd byte, minimum code, maximum code, and default
code. For 1-byte fonts, the first two elements are 0.
MAXLEN is a maximum bytes of one glyph informaion in the font file.
OFFSET-VECTOR is a vector of a file position which starts bitmap data
of the glyph in the font file.
Nth element of OFFSET-VECTOR is a file position for the glyph of code
CODE, where N and CODE are in the following relation:
(bdf-compact-code CODE) => N, (bdf-expand-code N) => CODE"
(
let
((
absolute-path
(
bdf-expand-file-name
bdfname
))
(
maxlen
0
)
size
font-bounding-box
(
relative-compose
'false
)
(
baseline-offset
0
)
default-char
code-range
offset-vector
buf
)
(
if
absolute-path
(
message
"Reading %s..."
bdfname
)
(
error
"BDF file %s doesn't exist"
bdfname
))
(
setq
buf
(
bdf-find-file
absolute-path
))
(
unwind-protect
(
save-excursion
(
set-buffer
buf
)
(
goto-char
(
point-min
))
(
search-forward
"\nFONTBOUNDINGBOX"
)
(
setq
font-bounding-box
(
vector
(
read
(
current-buffer
))
(
read
(
current-buffer
))
(
read
(
current-buffer
))
(
read
(
current-buffer
))))
;; The following kludgy code is to avoid bugs of fonts
;; jiskan16.bdf and jiskan24.bdf distributed with X.
;; They contain wrong FONTBOUNDINGBOX.
(
if
(
and
(
>
(
aref
font-bounding-box
3
)
0
)
(
string-match
"jiskan\\(16\\|24\\)"
bdfname
))
(
aset
font-bounding-box
3
(
-
(
aref
font-bounding-box
3
))))
(
goto-char
(
point-min
))
(
search-forward
"\nSIZE "
)
(
setq
size
(
read
(
current-buffer
)))
;; The following kludgy code is t avoid bugs of several
;; fonts which have wrong SIZE record.
(
if
(
<=
size
(
/
(
aref
font-bounding-box
1
)
2
))
(
setq
size
(
aref
font-bounding-box
1
)))
(
goto-char
(
point-min
))
(
if
(
search-forward
"\nDEFAULT_CHAR"
nil
t
)
(
setq
default-char
(
read
(
current-buffer
))))
(
search-forward
"\nSTARTCHAR"
)
(
forward-line
-1
)
(
let
((
limit
(
point
)))
(
goto-char
(
point-min
))
(
if
(
search-forward
"\n_MULE_RELATIVE_COMPOSE"
limit
t
)
(
progn
(
goto-char
(
match-end
0
))
(
setq
relative-compose
(
read
(
current-buffer
)))))
(
goto-char
(
point-min
))
(
if
(
search-forward
"\n_MULE_BASELINE_OFFSET"
limit
t
)
(
progn
(
goto-char
(
match-end
0
))
(
setq
baseline-offset
(
read
(
current-buffer
))))))
(
let
((
min-code0
256
)
(
min-code1
256
)
(
max-code0
0
)
(
max-code1
0
)
(
min-code
65536
)
(
max-code
0
)
(
glyph-list
nil
)
code
bbx
offset
)
(
while
(
search-forward
"\nSTARTCHAR"
nil
t
)
(
setq
offset
(
line-beginning-position
))
(
search-forward
"\nENCODING"
)
(
setq
code
(
read
(
current-buffer
)))
(
let
((
code0
(
lsh
code
-8
))
(
code1
(
logand
code
255
)))
(
if
(
<
code0
min-code0
)
(
setq
min-code0
code0
)
(
if
(
>
code0
max-code0
)
(
setq
max-code0
code0
)))
(
if
(
<
code1
min-code1
)
(
setq
min-code1
code1
)
(
if
(
>
code1
max-code1
)
(
setq
max-code1
code1
))))
(
if
(
<
code
min-code
)
(
setq
min-code
code
)
(
if
(
>
code
max-code
)
(
setq
max-code
code
)))
(
search-forward
"ENDCHAR"
)
(
if
(
<
maxlen
(
-
(
point
)
offset
))
(
setq
maxlen
(
-
(
point
)
offset
)))
(
setq
glyph-list
(
cons
(
cons
code
offset
)
glyph-list
)))
(
setq
code-range
(
vector
min-code0
max-code0
min-code1
max-code1
min-code
max-code
(
or
default-char
min-code
)))
(
setq
offset-vector
(
make-vector
(
1+
(
bdf-compact-code
max-code
code-range
))
nil
))
(
while
glyph-list
(
let
((
glyph
(
car
glyph-list
)))
(
aset
offset-vector
(
bdf-compact-code
(
car
glyph
)
code-range
)
(
cdr
glyph
)))
(
setq
glyph-list
(
cdr
glyph-list
)))))
(
kill-buffer
buf
))
(
message
"Reading %s...done"
bdfname
)
(
list
bdfname
absolute-path
(
bdf-file-mod-time
absolute-path
)
size
font-bounding-box
relative-compose
baseline-offset
code-range
maxlen
offset-vector
)))
(
defsubst
bdf-info-absolute-path
(
font-info
)
(
nth
1
font-info
))
(
defsubst
bdf-info-mod-time
(
font-info
)
(
nth
2
font-info
))
(
defsubst
bdf-info-size
(
font-info
)
(
nth
3
font-info
))
(
defsubst
bdf-info-font-bounding-box
(
font-info
)
(
nth
4
font-info
))
(
defsubst
bdf-info-relative-compose
(
font-info
)
(
nth
5
font-info
))
(
defsubst
bdf-info-baseline-offset
(
font-info
)
(
nth
6
font-info
))
(
defsubst
bdf-info-code-range
(
font-info
)
(
nth
7
font-info
))
(
defsubst
bdf-info-maxlen
(
font-info
)
(
nth
8
font-info
))
(
defsubst
bdf-info-offset-vector
(
font-info
)
(
nth
9
font-info
))
(
defun
bdf-get-font-info
(
bdfname
)
"Return information about `BDF' font file BDFNAME.
The value FONT-INFO is a list of the following format:
(BDFFILE ABSOLUTE-PATH MOD-TIME SIZE FONT-BOUNDING-BOX
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
See the documentation of the function `bdf-read-font-info' for more detail."
(
or
bdf-cache
(
bdf-read-cache
))
(
let
((
font-info
(
assoc
bdfname
bdf-cache
)))
(
if
(
or
(
not
font-info
)
(
not
(
file-readable-p
(
bdf-info-absolute-path
font-info
)))
(
bdf-file-newer-than-time
bdfname
(
bdf-info-mod-time
font-info
)))
(
progn
(
setq
font-info
(
bdf-read-font-info
bdfname
))
(
bdf-set-cache
font-info
)))
font-info
))
(
defun
bdf-read-bitmap
(
bdfname
offset
maxlen
)
"Read `BDF' font file BDFNAME to get bitmap data at file poistion OFFSET.
BDFNAME is an abosolute path name of the font file.
MAXLEN specifies how many bytes we should read at least.
The value is a list of DWIDTH, BBX, and BITMAP-STRING.
DWIDTH is a pixel width of a glyph.
BBX is a bounding box of the glyph.
BITMAP-STRING is a string representing bits by hexadecimal digits."
(
let
((
coding-system-for-read
'no-conversion
)
dwidth
bbx
height
yoff
bitmap-string
)
(
condition-case
nil
(
with-temp-buffer
(
insert-file-contents
bdfname
nil
offset
(
+
offset
maxlen
))
(
goto-char
(
point-min
))
(
search-forward
"\nDWIDTH"
)
(
setq
dwidth
(
read
(
current-buffer
)))
(
goto-char
(
point-min
))
(
search-forward
"\nBBX"
)
(
setq
bbx
(
vector
(
read
(
current-buffer
))
(
read
(
current-buffer
))
(
read
(
current-buffer
))
(
read
(
current-buffer
))))
(
setq
height
(
aref
bbx
1
)
yoff
(
aref
bbx
3
))
(
search-forward
"\nBITMAP"
)
(
forward-line
1
)
(
delete-region
(
point-min
)
(
point
))
(
if
(
looking-at
"\\(0+\n\\)+"
)
(
progn
(
setq
height
(
-
height
(
count-lines
(
point
)
(
match-end
0
))))
(
delete-region
(
point
)
(
match-end
0
))))
(
or
(
looking-at
"ENDCHAR"
)
(
progn
(
search-forward
"ENDCHAR"
nil
'move
)
(
forward-line
-1
)
(
while
(
looking-at
"0+$"
)
(
setq
yoff
(
1+
yoff
)
height
(
1-
height
))
(
forward-line
-1
))
(
forward-line
1
)))
(
aset
bbx
1
height
)
(
aset
bbx
3
yoff
)
(
delete-region
(
point
)
(
point-max
))
(
goto-char
(
point-min
))
(
while
(
not
(
eobp
))
(
end-of-line
)
(
delete-char
1
))
(
setq
bitmap-string
(
buffer-string
)))
(
error
nil
))
(
list
dwidth
bbx
bitmap-string
)))
(
defun
bdf-get-bitmaps
(
bdfname
codes
)
"Return bitmap information of glyphs of CODES in `BDF' font file BDFNAME.
CODES is a list of encoding number of glyphs in the file.
The value is a list of CODE, DWIDTH, BBX, and BITMAP-STRING.
DWIDTH is a pixel width of a glyph.
BBX is a bounding box of the glyph.
BITMAP-STRING is a string representing bits by hexadecimal digits."
(
let*
((
font-info
(
bdf-get-font-info
bdfname
))
(
absolute-path
(
bdf-info-absolute-path
font-info
))
(
font-bounding-box
(
bdf-info-font-bounding-box
font-info
))
(
maxlen
(
bdf-info-maxlen
font-info
))
(
code-range
(
bdf-info-code-range
font-info
))
(
offset-vector
(
bdf-info-offset-vector
font-info
)))
(
mapcar
(
function
(
lambda
(
x
)
(
cons
x
(
bdf-read-bitmap
absolute-path
(
aref
offset-vector
(
bdf-compact-code
x
code-range
))
maxlen
))))
codes
)))
;;; Interface to ps-print.el
;; Called from ps-mule-init-external-library.
(
defun
bdf-generate-prologue
()
(
or
bdf-cache
(
bdf-initialize
))
(
ps-mule-generate-bitmap-prologue
))
;; Called from ps-mule-generate-font.
(
defun
bdf-generate-font
(
charset
font-spec
)
(
let*
((
font-name
(
ps-mule-font-spec-name
font-spec
))
(
font-info
(
bdf-get-font-info
font-name
)))
(
ps-mule-generate-bitmap-font
font-name
(
ps-mule-font-spec-bytes
font-spec
)
(
charset-width
charset
)
(
bdf-info-size
font-info
)
(
bdf-info-relative-compose
font-info
)
(
bdf-info-baseline-offset
font-info
)
(
bdf-info-font-bounding-box
font-info
))))
;; Called from ps-mule-generate-glyphs.
(
defun
bdf-generate-glyphs
(
font-spec
code-list
bytes
)
(
let
((
font-name
(
ps-mule-font-spec-name
font-spec
)))
(
mapcar
(
function
(
lambda
(
x
)
(
apply
'ps-mule-generate-bitmap-glyph
font-name
x
)))
(
bdf-get-bitmaps
font-name
code-list
))))
(
provide
'bdf
)
;;; bdf.el ends here
lisp/docref.el
deleted
100644 → 0
View file @
d56a5054
;;; docref.el --- Simple cross references for Elisp documentation strings
;; Copyright (C) 1994 Free Software Foundation, Inc.
;; Author: Vadim Geshel <vadik@unas.cs.kiev.ua>
;; Created: 12 Jul 1994
;; Keywords: docs, help, lisp
;; original name was cross-ref.el.
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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:
;; This package allows you to use a simple form of cross references in
;; your Emacs Lisp documentation strings. Cross-references look like
;; \\(type@[label@]data), where type defines a method for retrieving
;; reference information, data is used by a method routine as an argument,
;; and label "represents" the reference in text. If label is absent, data
;; is used instead.
;;
;; Special reference labeled `back', when present, can be used to return
;; to the previous contents of help buffer.
;;
;; Cross-referencing currently is intended for use in doc strings only
;; and works only in temporary buffers (created by `with-output-to-temp-buffer').
;; List of temp buffers in which cross-referencing is to be active is specified
;; by variable DOCREF-BUFFERS-LIST, which contains only "*Help*" by default.
;;
;; Documentation strings for this package's functions and variables can serve
;; as examples of usage.
;;
;;; Customization:
;;
;; See source. The main customization variable is `docref-methods-alist'.
;; It consists of (type . function) pairs, where type is a string which
;; corresponds to type in cross-references and function is called with
;; one argument - reference `data' - when a reference is activated.
;;
;;; Installation:
;;
;; Place this file somewhere in your load-path, byte-compiled it, and add
;; (require 'cross-ref)
;; to your .emacs.
;;; Code:
;; User customizable variables
(
defgroup
docref
nil
"Simple cross references for Elisp documentation strings."
:prefix
"docref-"
:group
'help
:group
'lisp
:group
'docs
)
(
defcustom
docref-highlight-p
t
"*If non-nil, \\(f@docref-subst) highlights cross-references.
Under window system it highlights them with face defined by
\\(v@docref-highlight-face), on character terminal highlighted references
look like cross-references in info mode."
:type
'boolean
:group
'docref
)
(
defcustom
docref-highlight-face
'highlight
"*Face used to highlight cross-references (used by \\(f@docref-subst))"
:type
'face
:group
'docref
)
(
defcustom
docref-methods-alist
'
((
"f"
.
docref-describe-function
)
; reference to a function documentation
(
"v"
.
docref-describe-variable
)
; reference to a variable documentation
(
"F"
.
docref-read-file
)
; reference to a file contents
(
"s"
.
docref-use-string
)
; reference to a string
(
"V"
.
docref-use-variable-value
)
; reference to variable value
(
"0"
.
beep
))
; just highlighted text
"Alist which maps cross-reference ``types'' to retrieval functions.
The car of each element is a string that serves as `type' in cross-references.
\(See \\(f@docref-subst)). The cdr is a function of one argument,
to be called to find this reference."
:type
'
(
repeat
(
cons
string
function
))
:group
'docref
)
(
defcustom
docref-back-label
"\nback"
"Label to use by \\(f@docref-subst) for the go-back reference."
:type
'string
:group
'docref
)
(
defvar
docref-back-reference
nil
"If non-nil, this is a go-back reference to add to the current buffer.
The value specifies how to go back. It should be suitable for use
as the second argument to \\(f@docref-insert-label).
\\(f@docref-subst) uses this to set up the go-back reference."
)
(
defvar
docref-last-active-buffer
)
;;;###autoload
(
defun
docref-setup
()
"Process docref cross-references in the current buffer.
See also \\(f@docref-subst)."
(
interactive
)
(
docref-subst
(
current-buffer
))
(
docref-mode
))
(
defvar
docref-mode-map
nil
)
(
or
docref-mode-map
(
let
((
map
(
make-sparse-keymap
)))
(
define-key
map
[mouse-2]
'docref-follow-mouse
)
(
define-key
map
"\C-c\C-b"
'docref-go-back
)
(
define-key
map
"\C-c\C-c"
'docref-follow
)
(
setq
docref-mode-map
map
)))
(
defun
docref-mode
()
"Major mode for help buffers that contain cross references.
To follow a reference, move to it and type \\[docref-follow], or use
\\[docref-follow-mouse]. The command \\[docref-go-back] can used to go
back to where you came from."
(
interactive
)
(
kill-all-local-variables
)
(
setq
major-mode
'docref-mode
)
(
setq
mode-name
"Docref"
)
(
use-local-map
docref-mode-map
)
(
run-hooks
'docref-mode
))
(
defun
docref-subst
(
buf
)
"Parse documentation cross-references in buffer BUF.
Find cross-reference information in a buffer and
highlight them with face defined by \\(v@docref-highlight-face).
Cross-reference has the following format: \\ (TYPE[@LABEL]@DATA), where
TYPE defines method used to retrieve xref data (like reading from file or
calling \\(f@describe-function)), DATA is an argument to this method
\(like file name or function name), and LABEL is displayed in text using
\\(v@docref-highlight-face).
The special reference `back' can be used to return back.
The variable \\(v@docref-back-label) specifies the label to use for that.
See \\(v@docref-methods-alist) for currently defined methods."
(
interactive
"b"
)
(
save-excursion
(
set-buffer
buf
)
(
goto-char
(
point-min
))
;; The docref-seen property indicates that we have processed this
;; buffer's contents already, so don't do it again.
(
if
(
not
(
get-text-property
(
point-min
)
'docref-seen
))
(
let
((
old-modified
(
buffer-modified-p
)))
(
while
(
re-search-forward
"[\\](\\([^\)\@]+\\)\\(@[^\)\@]+\\)?@\\([^\)]*\\))"
nil
t
)
(
let*
((
start
(
match-beginning
0
))
(
type
(
buffer-substring
(
match-beginning
1
)
(
match-end
1
)))
(
data
(
buffer-substring
(
match-beginning
3
)
(
match-end
3
)))
(
label
(
if
(
match-beginning
2
)
(
buffer-substring
(
+
(
match-beginning
2
)
1
)
(
match-end
2
))
data
)))
(
replace-match
""
t
)
(
docref-insert-label
label
(
cons
type
data
))))
;; Make a back-reference in this buffer, if desired.
;; (This is true if called from docref-follow.)
(
if
docref-back-reference
(
progn
(
goto-char
(
point-max
))
(
put-text-property
(
point-min
)
(
1+
(
point-min
))
'docref-back-position
(
point
))
(
docref-insert-label
docref-back-label
docref-back-reference
)))
(
put-text-property
(
point-min
)
(
1+
(
point-min
))
'docref-seen
t
)
(
set-buffer-modified-p
old-modified
)))))
(
defun
docref-insert-label
(
string
ref
)
(
let
((
label
(
concat
string
))
(
pos
(
point
)))