comparison lisp/prim/indent.el @ 159:3bb7ccffb0c0 r20-3b6

Import from CVS: tag r20-3b6
author cvs
date Mon, 13 Aug 2007 09:41:43 +0200
parents b9518feda344
children
comparison
equal deleted inserted replaced
158:558dfa75ffb3 159:3bb7ccffb0c0
1 ;;; indent.el --- indentation commands for XEmacs 1 ;;; indent.el --- indentation commands for XEmacs
2 2
3 ;; Copyright (C) 1985, 1992, 1993, 1995 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985, 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 ;; Keywords: lisp languages tools 6 ;; Keywords: lisp languages tools
7 7
8 ;; This file is part of XEmacs. 8 ;; This file is part of XEmacs.
26 26
27 ;;; Commentary: 27 ;;; Commentary:
28 28
29 ;; Commands for making and changing indentation in text. These are 29 ;; Commands for making and changing indentation in text. These are
30 ;; described in the XEmacs Reference Manual. 30 ;; described in the XEmacs Reference Manual.
31
32 ;; 06/11/1997 - Convert (preceding|following)-char to char-(before|after) -slb
31 33
32 ;;; Code: 34 ;;; Code:
33 35
34 (defvar standard-indent 4 "\ 36 (defvar standard-indent 4 "\
35 Default number of columns for margin-changing functions to indent.") 37 Default number of columns for margin-changing functions to indent.")
431 (defun tab-to-tab-stop () 433 (defun tab-to-tab-stop ()
432 "Insert spaces or tabs to next defined tab-stop column. 434 "Insert spaces or tabs to next defined tab-stop column.
433 The variable `tab-stop-list' is a list of columns at which there are tab stops. 435 The variable `tab-stop-list' is a list of columns at which there are tab stops.
434 Use \\[edit-tab-stops] to edit them interactively." 436 Use \\[edit-tab-stops] to edit them interactively."
435 (interactive) 437 (interactive)
436 (and abbrev-mode (= (char-syntax (preceding-char)) ?w) 438 (and abbrev-mode (eq (char-syntax (char-before (point))) ?w)
437 (expand-abbrev)) 439 (expand-abbrev))
438 (let ((tabs tab-stop-list)) 440 (let ((tabs tab-stop-list))
439 (while (and tabs (>= (current-column) (car tabs))) 441 (while (and tabs (>= (current-column) (car tabs)))
440 (setq tabs (cdr tabs))) 442 (setq tabs (cdr tabs)))
441 (if tabs 443 (if tabs
458 (move-to-column (car tabs) t) 460 (move-to-column (car tabs) t)
459 (save-excursion 461 (save-excursion
460 (goto-char before) 462 (goto-char before)
461 ;; If we just added a tab, or moved over one, 463 ;; If we just added a tab, or moved over one,
462 ;; delete any superfluous spaces before the old point. 464 ;; delete any superfluous spaces before the old point.
463 (if (and (eq (preceding-char) ?\ ) 465 (if (and (eq (char-before (point)) ?\ )
464 (eq (following-char) ?\t)) 466 (eq (char-after (point)) ?\t))
465 (let ((tabend (* (/ (current-column) tab-width) tab-width))) 467 (let ((tabend (* (/ (current-column) tab-width) tab-width)))
466 (while (and (> (current-column) tabend) 468 (while (and (> (current-column) tabend)
467 (eq (preceding-char) ?\ )) 469 (eq (char-before (point)) ?\ ))
468 (forward-char -1)) 470 (forward-char -1))
469 (delete-region (point) before)))))))) 471 (delete-region (point) before))))))))
470 472
471 ;(define-key global-map "\t" 'indent-for-tab-command) 473 ;(define-key global-map "\t" 'indent-for-tab-command)
472 ;(define-key esc-map "\034" 'indent-region) 474 ;(define-key esc-map "\034" 'indent-region)