comparison lisp/term.el @ 111429:249a1455856a

Use line-end-position rather than end-of-line, etc. * textmodes/texnfo-upd.el (texinfo-start-menu-description) (texinfo-update-menu-region-beginning, texinfo-menu-first-node) (texinfo-delete-existing-pointers, texinfo-find-pointer) (texinfo-clean-up-node-line, texinfo-insert-node-lines) (texinfo-multiple-files-update): * textmodes/table.el (table--probe-cell-left-up) (table--probe-cell-right-bottom): * textmodes/picture.el (picture-tab-search): * textmodes/page-ext.el (pages-copy-header-and-position) (pages-directory-for-addresses): * progmodes/vera-mode.el (vera-get-offset): * progmodes/simula.el (simula-calculate-indent): * progmodes/python.el (python-pdbtrack-overlay-arrow): * progmodes/prolog.el (end-of-prolog-clause): * progmodes/perl-mode.el (perl-calculate-indent, perl-indent-exp): * progmodes/icon.el (indent-icon-exp): * progmodes/etags.el (tag-re-match-p): * progmodes/ebrowse.el (ebrowse-show-file-name-at-point): * progmodes/ebnf2ps.el (ebnf-begin-file): * progmodes/dcl-mode.el (dcl-back-to-indentation-1) (dcl-save-local-variable): * play/life.el (life-setup): * play/gametree.el (gametree-looking-at-ply): * nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set): * mail/sendmail.el (mail-mode-auto-fill): * emacs-lisp/lisp-mode.el (calculate-lisp-indent): * emacs-lisp/edebug.el (edebug-overlay-arrow): * emacs-lisp/checkdoc.el (checkdoc-this-string-valid): * woman.el (woman-parse-numeric-value, woman2-TH, woman2-SH) (woman-tab-to-tab-stop, WoMan-warn-ignored): * type-break.el (type-break-file-keystroke-count): * term.el (term-replace-by-expanded-history-before-point) (term-skip-prompt, term-extract-string): * speedbar.el (speedbar-edit-line, speedbar-expand-line) (speedbar-contract-line, speedbar-toggle-line-expansion) (speedbar-parse-c-or-c++tag, speedbar-parse-tex-string) (speedbar-buffer-revert-buffer, speedbar-highlight-one-tag-line): * sort.el (sort-skip-fields): * skeleton.el (skeleton-internal-list): * simple.el (line-move-finish, line-move-to-column): * shell.el (shell-forward-command): * misc.el (copy-from-above-command): * makesum.el (double-column): * ebuff-menu.el (electric-buffer-update-highlight): * dired.el (dired-move-to-end-of-filename): * dframe.el (dframe-popup-kludge): * bookmark.el (bookmark-kill-line, bookmark-bmenu-show-filenames): * arc-mode.el (archive-get-lineno): Use line-end-position and line-beginning-position. * net/ange-ftp.el, progmodes/hideif.el, reposition.el: Same, but only in comments.
author Glenn Morris <rgm@gnu.org>
date Sat, 06 Nov 2010 13:23:42 -0700
parents bcc7c00e9ef4
children 56b71cddc9c5
comparison
equal deleted inserted replaced
111428:043aac1cda3c 111429:249a1455856a
1 ;;; term.el --- general command interpreter in a window stuff 1 ;;; term.el --- general command interpreter in a window stuff
2 2
3 ;; Copyright (C) 1988, 1990, 1992, 1994, 1995, 2001, 2002, 2003, 3 ;; Copyright (C) 1988, 1990, 1992, 1994, 1995, 2001, 2002, 2003, 2004,
4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 ;; 2005, 2006, 2007, 2008, 2009, 2010
5 ;; Free Software Foundation, Inc.
5 6
6 ;; Author: Per Bothner <per@bothner.com> 7 ;; Author: Per Bothner <per@bothner.com>
7 ;; Maintainer: Dan Nicolaescu <dann@ics.uci.edu>, Per Bothner <per@bothner.com> 8 ;; Maintainer: Dan Nicolaescu <dann@ics.uci.edu>, Per Bothner <per@bothner.com>
8 ;; Based on comint mode written by: Olin Shivers <shivers@cs.cmu.edu> 9 ;; Based on comint mode written by: Olin Shivers <shivers@cs.cmu.edu>
9 ;; Keywords: processes 10 ;; Keywords: processes
1796 1797
1797 (defun term-replace-by-expanded-history-before-point (silent) 1798 (defun term-replace-by-expanded-history-before-point (silent)
1798 "Expand directory stack reference before point. 1799 "Expand directory stack reference before point.
1799 See `term-replace-by-expanded-history'. Returns t if successful." 1800 See `term-replace-by-expanded-history'. Returns t if successful."
1800 (save-excursion 1801 (save-excursion
1801 (let ((toend (- (save-excursion (end-of-line nil) (point)) (point))) 1802 (let ((toend (- (line-end-position) (point)))
1802 (start (progn (term-bol nil) (point)))) 1803 (start (progn (term-bol nil) (point))))
1803 (while (progn 1804 (while (progn
1804 (skip-chars-forward "^!^" 1805 (skip-chars-forward "^!^" (- (line-end-position) toend))
1805 (save-excursion 1806 (< (point) (- (line-end-position) toend)))
1806 (end-of-line nil) (- (point) toend)))
1807 (< (point)
1808 (save-excursion
1809 (end-of-line nil) (- (point) toend))))
1810 ;; This seems a bit complex. We look for references such as !!, !-num, 1807 ;; This seems a bit complex. We look for references such as !!, !-num,
1811 ;; !foo, !?foo, !{bar}, !?{bar}, ^oh, ^my^, ^god^it, ^never^ends^. 1808 ;; !foo, !?foo, !{bar}, !?{bar}, ^oh, ^my^, ^god^it, ^never^ends^.
1812 ;; If that wasn't enough, the plings can be suffixed with argument 1809 ;; If that wasn't enough, the plings can be suffixed with argument
1813 ;; range specifiers. 1810 ;; range specifiers.
1814 ;; Argument ranges are complex too, so we hive off the input line, 1811 ;; Argument ranges are complex too, so we hive off the input line,
2110 (insert input)))) 2107 (insert input))))
2111 2108
2112 (defun term-skip-prompt () 2109 (defun term-skip-prompt ()
2113 "Skip past the text matching regexp `term-prompt-regexp'. 2110 "Skip past the text matching regexp `term-prompt-regexp'.
2114 If this takes us past the end of the current line, don't skip at all." 2111 If this takes us past the end of the current line, don't skip at all."
2115 (let ((eol (save-excursion (end-of-line) (point)))) 2112 (let ((eol (line-end-position)))
2116 (when (and (looking-at term-prompt-regexp) 2113 (when (and (looking-at term-prompt-regexp)
2117 (<= (match-end 0) eol)) 2114 (<= (match-end 0) eol))
2118 (goto-char (match-end 0))))) 2115 (goto-char (match-end 0)))))
2119 2116
2120 2117
2469 ;; if there's a quote on both sides of point on the current line. 2466 ;; if there's a quote on both sides of point on the current line.
2470 (defun term-extract-string () 2467 (defun term-extract-string ()
2471 "Return string around `point' that starts the current line or nil." 2468 "Return string around `point' that starts the current line or nil."
2472 (save-excursion 2469 (save-excursion
2473 (let* ((point (point)) 2470 (let* ((point (point))
2474 (bol (progn (beginning-of-line) (point))) 2471 (bol (line-beginning-position))
2475 (eol (progn (end-of-line) (point))) 2472 (eol (line-end-position))
2476 (start (progn (goto-char point) 2473 (start (and (search-backward "\"" bol t)
2477 (and (search-backward "\"" bol t) 2474 (1+ (point))))
2478 (1+ (point)))))
2479 (end (progn (goto-char point) 2475 (end (progn (goto-char point)
2480 (and (search-forward "\"" eol t) 2476 (and (search-forward "\"" eol t)
2481 (1- (point)))))) 2477 (1- (point))))))
2482 (and start end 2478 (and start end
2483 (buffer-substring start end))))) 2479 (buffer-substring start end)))))
4532 ;; You could use completion-in-region to do the bulk of the 4528 ;; You could use completion-in-region to do the bulk of the
4533 ;; completion job. 4529 ;; completion job.
4534 4530
4535 (provide 'term) 4531 (provide 'term)
4536 4532
4537 ;; arch-tag: eee16bc8-2cd7-4147-9534-a5694752f716
4538 ;;; term.el ends here 4533 ;;; term.el ends here