annotate lisp/prim/misc.el @ 208:f427b8ec4379

Added tag r20-4b2 for changeset e45d5e7c476e
author cvs
date Mon, 13 Aug 2007 10:03:54 +0200
parents 3bb7ccffb0c0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; misc.el --- miscellaneous functions for XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
159
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 2
diff changeset
3 ;; Copyright (C) 1989, 1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
21 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
22 ;; 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
24 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
159
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 2
diff changeset
26 ;; 06/11/1997 - Use char-(after|before) instead of
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 2
diff changeset
27 ;; (following|preceding)-char. -slb
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 2
diff changeset
28
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (defun copy-from-above-command (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 "Copy characters from previous nonblank line, starting just above point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 Copy ARG characters, but not past the end of that line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 If no argument given, copy the entire rest of the line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 The characters copied are inserted in the buffer before point."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (let ((cc (current-column))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (string ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (backward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (skip-chars-backward "\ \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (move-to-column cc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; Default is enough to copy the whole rest of the line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (setq n (if arg (prefix-numeric-value arg) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; If current column winds up in middle of a tab,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; copy appropriate number of "virtual" space chars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (if (< cc (current-column))
159
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 2
diff changeset
50 (if (eq (char-before (point)) ?\t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (setq string (make-string (min n (- (current-column) cc)) ?\ ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (setq n (- n (min n (- (current-column) cc)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; In middle of ctl char => copy that whole char.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (backward-char 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (setq string (concat string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (min (save-excursion (end-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (+ n (point)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (insert string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;; misc.el ends here