;; -*- mode: emacs-lisp; coding: hebrew-iso-8bit-unix; -*- ;; ektabs.el --- EK enhancement for tabs operations ;; Copyright (C) 1992-2003 Ehud karni ;; This file is NOT part of GNU Emacs, distribution conditions below. ;; ;; EHUD KARNI ינרק דוהא ;; Ben Gurion st' 14 ןוירוג ןב 'חר ;; Kfar - Sava 44 257 אבס - רפכ ;; =================================== ;; 972-(0)9-7659599 ;; =================================== ;; RCS: $Id: ektabs.el,v 1.103 2000/03/05 13:32:46 ehud Exp $ ;; ;; $Log: ektabs.el,v $ ;; Revision 1.103 2000/03/05 13:32:46 ehud ;; Comment headers changes (NOT GNU) ==ONLY== ;; ;; Revision 1.102 1998/03/15 17:39:40 ehud ;; Last revision for 19.34 ;; ;; Revision 1.101 1996/02/19 10:51:44 ehud ;; Emacs 19.30 version ;; ;; Revision 1.100 1995/01/19 17:23:03 ehud ;; SW initial version control for all el's ;; This program 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 of the License, or ;; (at your option) any later version. ;; ;; This program 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 this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (defun set-left-col (&optional arg) "Set left column in window to ARG def = 0 (full line)" (interactive "P") (scroll-right 999) (if arg (scroll-left arg) (scroll-left (string-to-int (read-string "No. of 1st column to show (on left side, 0-nnn): 0" ""))))) (defun scroll-left-20 (&optional arg) "Move right - Scroll to the left ARG columns (def=20)" (interactive "p") (if (if arg (/= 1 arg)) (scroll-left arg) (scroll-left 20))) (defun goto-col (arg &optional nospc) "goto ARG (column number) on current line, add spaces if needed optional NOSPC means dont add spaces at end of line" (interactive "NGoto Column: ") (end-of-line) (let ((col-goto (- arg (column-no)))) (if nospc () (while (> col-goto 0) (insert-char ?\040 1) (setq col-goto (- col-goto 1)))) (if (< col-goto 0) (goto-char (+ (point) col-goto))))) (defun backward-to-tab-stop () "Go backward to previous defined tab-stop column (assume col 0 is tab stop!) The variable tab-stop-list is a list of columns at which there are tab stops. Use \\[edit-tab-stops] to edit them interactively." (interactive) ;;(if abbrev-mode (expand-abbrev)) (let ((tabs tab-stop-list) (tabs-p 0)) (while (and tabs (> (column-no) (car tabs))) (setq tabs-p (car tabs)) (setq tabs (cdr tabs))) (goto-col tabs-p))) (defun forward-to-tab-stop () "Go forward to next defined tab-stop column. The variable tab-stop-list is a list of columns at which there are tab stops. Use \\[edit-tab-stops] to edit them interactively." (interactive) ;;(if abbrev-mode (expand-abbrev)) (let ((tabs tab-stop-list)) (while (and tabs (>= (column-no) (car tabs))) (setq tabs (cdr tabs))) (if tabs (goto-col (car tabs))))) (defun break-line-all (arg) "Break all lines into lines of COLUMN length or less." (interactive "NLength of lines to break (no. of columns, 1-nnn): ") (if arg (let ((sv-pos (point-marker))) (goto-char (point-min)) (while (not (eobp)) (break-line (+ arg 1)) (forward-line 1)) (goto-char sv-pos)))) (defun break-line (arg) "Break one long line into lines of COLUMN length." (interactive "NLength of lines to break (no. of columns, 1-nnn): ") (if arg (break-line-one (+ arg 1)))) (defun break-line-one (arg) "Internal function: Break one line into lines of COLUMN length." (beginning-of-line) (let ((sbol (point))) (goto-col arg t) (while (not (eolp)) (if (re-search-backward "[ \t\n][^ \t\n]" sbol t) (forward-char 1)) (insert ?\n) (setq sbol (point)) (goto-col arg t)))) ;; ================================= end of ektab.el ===================