/usr/share/jed/lib/rcs.sl is in jed-common 1:0.99.19-7.
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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | % File: rcs.sl -*- SLang -*-
%
% Author: Guido Gonzato, <ggonza@tin.it>. Contributions by JED.
%
% Version: 1.0.1. This file provides an interface to RCS a la
% Emacs (sort of).
%
% Installation: unless rcs.sl is already loaded from site.sl (check),
% insert this line in your .jedrc:
%
% () = evalfile ("rcs.sl");
%
% or, better, insert autoload lines in your defaults.sl
% like this:
%
% autoload ("rcs_open_file", "rcs.sl");
% autoload ("rcs_check_in_and_out", "rcs.sl");
% autoload ("rcs_read_log", "rcs.sl");
%
% Usage: rcs_open_file () -- open an RCS file
% rcs_check_in_and_out () -- check in/out an RCS file
% rcs_read_log () -- read the change history
%
% you might want to set these key bindings in your .jedrc:
%
% setkey_reserved ("rcs_open_file", "vf");
% setkey_reserved ("rcs_check_in_and_out", "vv");
% setkey_reserved ("rcs_read_log", "vl");
%
%
% Last updated: 23 February 2001
%_debug_info = 1;
private variable Last_Comment = "";
% Build a file name like "/home/guido/RCS/file.txt,v"
private define build_rcs_filename (file)
{
variable dir;
(dir, file) = parse_filename (file);
return dircat (dircat (dir, "RCS"), strcat (file, ",v"));
}
private define checkout (file)
{
variable cmd, dir, name;
flush (sprintf ("Checking out %s...", file));
(dir, name) = parse_filename (file);
cmd = sprintf ("cd %s; co -l %s > /dev/null 2>&1", dir, name);
if (0 != system (cmd))
verror ("Error checking out %s!", file);
flush (sprintf ("Checking out %s...done.", file));
}
private define checkin (file, msg)
{
variable dir, name, cmd;
() = write_buffer (file);
(dir, name) = parse_filename (file);
Last_Comment = read_mini (msg, "", Last_Comment);
cmd = sprintf ("cd %s; echo \"%s\" | ci %s > /dev/null 2>&1",
dir, Last_Comment, name);
if (0 != system (cmd))
verror ("Error checking in %s!", file);
set_readonly (1);
setbuf_info (getbuf_info () | 0x8);
flush ("Note: file is write protected.");
}
define rcs_open_file () % Emacs uses ^X-v-f
{
variable rcs_file, dir, file;
file = read_file_from_mini ("RCS open file:");
file = file [[:-3]]; % remove ",v"
(dir, file) = parse_filename (file);
file = dircat (dir [[:-5]], file); % remove "RCS/"
checkout (file);
() = find_file (file);
}
define rcs_check_in_and_out () % Emacs uses ^X-v-v
{
variable file, dir, flags;
% check if the current buffer is attached to an RCS file.
(file, dir,, flags) = getbuf_info();
file = dircat (dir, file);
% if it doesn't exist, then create the RCS dir, check in, and exit
if (0 == file_status (build_rcs_filename (file))) {
dir = dircat (dir, "RCS");
if (0 == file_status (dir)) {
if (0 != mkdir (dir, 0777))
verror ("Error creating RCS directory %s!", dir);
}
checkin (file, "RCS file description:");
return;
}
% the RCS file exists; if the buffer is read only, then check it out
if (flags & (1 shl 3)) { % readonly
checkout (file);
delbuf (whatbuf());
() = find_file (file);
return;
}
% Otherwise, check it in
checkin (file, "Enter a change comment:");
}
private variable rlog_buf = "*rlog*";
define close_rlog_buffer ()
{
variable cbuf = whatbuf ();
setbuf (rlog_buf);
set_buffer_modified_flag (0);
setbuf (cbuf);
delbuf (rlog_buf);
}
define rcs_read_log ()
{
variable rcs_file, dir, file, cmd, tmp_file;
variable rlog_map= "rlog_map";
file = read_file_from_mini ("rlog of RCS file:");
file = file [[:-3]]; % remove ",v"
(dir, file) = parse_filename (file);
file = dircat (dir [[:-5]], file); % remove "RCS/"
tmp_file = make_tmp_file ("/tmp/jedrlog");
cmd = sprintf ("rlog %s > %s", file, tmp_file); % exec rlog
if (0 != system (cmd))
verror ("Error rlogging %s!", file);
sw2buf (rlog_buf);
insert_file (tmp_file);
delete_file (tmp_file);
most_mode ();
!if (keymap_p (rlog_map)) {
make_keymap (rlog_map);
definekey ("close_rlog_buffer", "q", rlog_map);
}
use_keymap (rlog_map);
set_readonly (1);
}
provide ("rcs");
% --- End of file rcs.sl ---
|