diff options
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/ada-mode.el | 16 | ||||
-rw-r--r-- | lisp/progmodes/ada-prj.el | 16 | ||||
-rw-r--r-- | lisp/progmodes/ada-xref.el | 12 | ||||
-rw-r--r-- | lisp/progmodes/cperl-mode.el | 50 | ||||
-rw-r--r-- | lisp/progmodes/idlw-shell.el | 9 | ||||
-rw-r--r-- | lisp/progmodes/idlwave.el | 57 | ||||
-rw-r--r-- | lisp/progmodes/js.el | 5 | ||||
-rw-r--r-- | lisp/progmodes/ruby-mode.el | 4 | ||||
-rw-r--r-- | lisp/progmodes/vhdl-mode.el | 15 |
9 files changed, 68 insertions, 116 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index bc470322ec6..d0c9722c764 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el @@ -2602,7 +2602,7 @@ and the offset." ((and (= (char-after) ?#) (equal ada-which-compiler 'gnat) (looking-at "#[ \t]*\\(if\\|els\\(e\\|if\\)\\|end[ \t]*if\\)")) - (list (save-excursion (beginning-of-line) (point)) 0)) + (list (point-at-bol) 0)) ;;-------------------------------- ;; starting with ')' (end of a parameter list) @@ -4049,11 +4049,7 @@ Point is moved at the beginning of the SEARCH-RE." (funcall search-func search-re limit 1)) (setq begin (match-beginning 0)) (setq end (match-end 0)) - - (setq parse-result (parse-partial-sexp - (save-excursion (beginning-of-line) (point)) - (point))) - + (setq parse-result (parse-partial-sexp (point-at-bol) (point))) (cond ;; ;; If inside a string, skip it (and the following comments) @@ -4272,16 +4268,12 @@ of the region. Otherwise, operate only on the current line." (save-excursion (beginning-of-line) (insert-char ? ada-indent)) - (if (save-excursion (= (point) (progn (beginning-of-line) (point)))) - (forward-char ada-indent))) + (if (bolp) (forward-char ada-indent))) (defun ada-untab-hard () "Indent current line to previous tab stop." (interactive) - (let ((bol (save-excursion (progn (beginning-of-line) (point)))) - (eol (save-excursion (progn (end-of-line) (point))))) - (indent-rigidly bol eol (- 0 ada-indent)))) - + (indent-rigidly (point-at-bol) (point-at-eol) (- 0 ada-indent))) ;; ------------------------------------------------------------ diff --git a/lisp/progmodes/ada-prj.el b/lisp/progmodes/ada-prj.el index 630f83e58aa..c726c06d1d3 100644 --- a/lisp/progmodes/ada-prj.el +++ b/lisp/progmodes/ada-prj.el @@ -196,21 +196,17 @@ One item per line should be found in the file." (widen) (goto-char (point-min)) (while (not (eobp)) - (set 'line (buffer-substring-no-properties - (point) (save-excursion (end-of-line) (point)))) + (set 'line (buffer-substring-no-properties (point) (point-at-eol))) (add-to-list 'list line) - (forward-line 1) - ) + (forward-line 1)) (kill-buffer nil) (set-buffer buffer) (set 'ada-prj-current-values (plist-put ada-prj-current-values symbol (append (plist-get ada-prj-current-values symbol) - (reverse list)))) - ) - (ada-prj-display-page 2) - )) + (reverse list))))) + (ada-prj-display-page 2))) (defun ada-prj-subdirs-of (dir) "Return a list of all the subdirectories of DIR, recursively." @@ -568,8 +564,7 @@ Parameters WIDGET-MODIFIED, EVENT match :notify for the widget." ;; variables (momentary-string-display (concat "*****Help*****\n" text "\n**************\n") - (save-excursion (forward-line) (beginning-of-line) (point))) - ))) + (point-at-bol 2))))) (defun ada-prj-show-value (widget widget-modified event) "Show the current field value in WIDGET. @@ -681,5 +676,4 @@ AFTER-TEXT is inserted just after the widget." (provide 'ada-prj) -;; arch-tag: 65978c77-816e-49c6-896e-6905605d1b4c ;;; ada-prj.el ends here diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index 73c31f08cd3..ceda645e682 100644 --- a/lisp/progmodes/ada-xref.el +++ b/lisp/progmodes/ada-xref.el @@ -1,7 +1,8 @@ ;; ada-xref.el --- for lookup and completion in Ada mode -;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. ;; Author: Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de> ;; Rolf Ebert <ebert@inf.enst.fr> @@ -324,7 +325,7 @@ CROSS-PREFIX is the prefix to use for the `gnatls' command." (add-to-list 'ada-xref-runtime-library-specs-path (buffer-substring-no-properties (point) - (save-excursion (end-of-line) (point))))) + (point-at-eol)))) (forward-line 1)) ;; Object path @@ -338,7 +339,7 @@ CROSS-PREFIX is the prefix to use for the `gnatls' command." (add-to-list 'ada-xref-runtime-library-ali-path (buffer-substring-no-properties (point) - (save-excursion (end-of-line) (point))))) + (point-at-eol)))) (forward-line 1)) ) (kill-buffer nil)))) @@ -1817,7 +1818,7 @@ Information is extracted from the ali file." (beginning-of-line) (if declaration-found (let ((current-line (buffer-substring - (point) (save-excursion (end-of-line) (point))))) + (point) (point-at-eol)))) (save-excursion (forward-line 1) (beginning-of-line) @@ -2379,5 +2380,4 @@ For instance, it creates the gnat-specific menus, sets some hooks for (provide 'ada-xref) -;; arch-tag: 415a39fe-577b-4676-b3b1-6ff6db7ca24e ;;; ada-xref.el ends here diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 46002929791..c47c6274cbf 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1,8 +1,8 @@ ;;; cperl-mode.el --- Perl code editing commands for Emacs -;; Copyright (C) 1985, 1986, 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, -;; 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, -;; 2010 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1987, 1991, 1992, 1993, 1994, 1995, 1996, +;; 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +;; 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: Ilya Zakharevich ;; Bob Olson @@ -2145,7 +2145,7 @@ char is \"{\", insert extra newline before only if "Insert an opening parenthesis or a matching pair of parentheses. See `cperl-electric-parens'." (interactive "P") - (let ((beg (save-excursion (beginning-of-line) (point))) + (let ((beg (point-at-bol)) (other-end (if (and cperl-electric-parens-mark (cperl-mark-active) (> (mark) (point))) @@ -2182,7 +2182,7 @@ See `cperl-electric-parens'." If not, or if we are not at the end of marking range, would self-insert. Affected by `cperl-electric-parens'." (interactive "P") - (let ((beg (save-excursion (beginning-of-line) (point))) + (let ((beg (point-at-bol)) (other-end (if (and cperl-electric-parens-mark (cperl-val 'cperl-electric-parens) (memq last-command-event @@ -2215,7 +2215,7 @@ Affected by `cperl-electric-parens'." "Insert a construction appropriate after a keyword. Help message may be switched off by setting `cperl-message-electric-keyword' to nil." - (let ((beg (save-excursion (beginning-of-line) (point))) + (let ((beg (point-at-bol)) (dollar (and (eq last-command-event ?$) (eq this-command 'self-insert-command))) (delete (and (memq last-command-event '(?\s ?\n ?\t ?\f)) @@ -2358,7 +2358,7 @@ to nil." "Insert a construction appropriate after a keyword. Help message may be switched off by setting `cperl-message-electric-keyword' to nil." - (let ((beg (save-excursion (beginning-of-line) (point)))) + (let ((beg (point-at-bol))) (and (save-excursion (backward-sexp 1) (cperl-after-expr-p nil "{;:")) @@ -2397,8 +2397,8 @@ to nil." "Go to end of line, open a new line and indent appropriately. If in POD, insert appropriate lines." (interactive) - (let ((beg (save-excursion (beginning-of-line) (point))) - (end (save-excursion (end-of-line) (point))) + (let ((beg (point-at-bol)) + (end (point-at-eol)) (pos (point)) start over cut res) (if (and ; Check if we need to split: ; i.e., on a boundary and inside "{...}" @@ -2476,12 +2476,8 @@ If in POD, insert appropriate lines." (forward-paragraph -1) (forward-word 1) (setq pos (point)) - (setq cut (buffer-substring (point) - (save-excursion - (end-of-line) - (point)))) - (delete-char (- (save-excursion (end-of-line) (point)) - (point))) + (setq cut (buffer-substring (point) (point-at-eol))) + (delete-char (- (point-at-eol) (point))) (setq res (expand-abbrev)) (save-excursion (goto-char pos) @@ -2946,8 +2942,7 @@ Will not look before LIM." (point-max)))) ; do not loop if no syntaxification ;; label: (t - (save-excursion (end-of-line) - (setq colon-line-end (point))) + (setq colon-line-end (point-at-eol)) (search-forward ":")))) ;; We are at beginning of code (NOT label or comment) ;; First, the following code counts @@ -3220,7 +3215,7 @@ the current line is to be regarded as part of a block comment." Returns true if comment is found. In POD will not move the point." ;; If the line is inside other syntax groups (qq-style strings, HERE-docs) ;; then looks for literal # or end-of-line. - (let (state stop-in cpoint (lim (progn (end-of-line) (point))) pr e) + (let (state stop-in cpoint (lim (point-at-eol)) pr e) (or cperl-font-locking (cperl-update-syntaxification lim lim)) (beginning-of-line) @@ -3814,7 +3809,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', (let ((case-fold-search t)) (looking-at "extproc[ \t]")) ; Analogue of #! (cperl-commentify min - (save-excursion (end-of-line) (point)) + (point-at-eol) nil)) (while (and (< (point) max) @@ -5002,7 +4997,7 @@ If `cperl-indent-region-fix-constructs', will improve spacing on conditional/loop constructs." (interactive) (save-excursion - (let ((tmp-end (progn (end-of-line) (point))) top done) + (let ((tmp-end (point-at-eol)) top done) (save-excursion (beginning-of-line) (while (null done) @@ -5045,13 +5040,9 @@ conditional/loop constructs." "\\<\\(else\\|elsif\|continue\\)\\>")) (progn (goto-char (match-end 0)) - (save-excursion - (end-of-line) - (setq tmp-end (point)))) + (setq tmp-end (point-at-eol))) (setq done t)))) - (save-excursion - (end-of-line) - (setq tmp-end (point)))) + (setq tmp-end (point-at-eol))) (goto-char tmp-end) (setq tmp-end (point-marker))) (if cperl-indent-region-fix-constructs @@ -5064,7 +5055,7 @@ Returns some position at the last line." (interactive) (or end (setq end (point-max))) - (let ((ee (save-excursion (end-of-line) (point))) + (let ((ee (point-at-eol)) (cperl-indent-region-fix-constructs (or cperl-indent-region-fix-constructs 1)) p pp ml have-brace ret) @@ -5217,7 +5208,7 @@ Returns some position at the last line." (if (cperl-indent-line parse-data) (setq ret (cperl-fix-line-spacing end parse-data))))))))))) (beginning-of-line) - (setq p (point) pp (save-excursion (end-of-line) (point))) ; May be different from ee. + (setq p (point) pp (point-at-eol)) ; May be different from ee. ;; Now check whether there is a hanging `}' ;; Looking at: ;; } blah @@ -7479,7 +7470,7 @@ Currently it is tuned to C and Perl syntax." ;; Get to the something meaningful (or (eobp) (eolp) (forward-char 1)) (re-search-backward "[-a-zA-Z0-9_:!&*+,-./<=>?\\\\^|~$%@]" - (save-excursion (beginning-of-line) (point)) + (point-at-bol) 'to-beg) ;; (cond ;; ((or (eobp) (looking-at "[][ \t\n{}();,]")) ; Not at a symbol @@ -8999,5 +8990,4 @@ do extra unwind via `cperl-unwind-to-safe'." (provide 'cperl-mode) -;; arch-tag: 42e5b19b-e187-4537-929f-1a7408980ce6 ;;; cperl-mode.el ends here diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index 3acd396e9cd..21566912710 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -1458,7 +1458,7 @@ Otherwise just move the line. Move down unless UP is non-nil." (arg (if up arg (- arg)))) (if (eq t idlwave-shell-arrows-do-history) (goto-char proc-pos)) (if (and idlwave-shell-arrows-do-history - (>= (1+ (save-excursion (end-of-line) (point))) proc-pos)) + (>= (1+ (point-at-eol)) proc-pos)) (comint-previous-input arg) (forward-line (- arg))))) @@ -2211,7 +2211,7 @@ args of an executive .run, .rnew or .compile." (defun idlwave-shell-filename-string () "Return t if in a string and after what could be a file name." - (let ((limit (save-excursion (beginning-of-line) (point)))) + (let ((limit (point-at-bol))) (save-excursion ;; Skip backwards over file name chars (skip-chars-backward idlwave-shell-file-name-chars limit) @@ -2220,7 +2220,7 @@ args of an executive .run, .rnew or .compile." (defun idlwave-shell-batch-command () "Return t if we're in a batch command statement like @foo" - (let ((limit (save-excursion (beginning-of-line) (point)))) + (let ((limit (point-at-bol))) (save-excursion ;; Skip backwards over filename (skip-chars-backward idlwave-shell-file-name-chars limit) @@ -2398,7 +2398,7 @@ matter what the settings of that variable." idlwave-shell-electric-stop-line-face idlwave-shell-stop-line-face)) (move-overlay idlwave-shell-stop-line-overlay - (point) (save-excursion (end-of-line) (point)) + (point) (point-at-eol) (current-buffer))) ;; use the arrow instead, but only if marking is wanted. (if idlwave-shell-mark-stop-line @@ -4693,5 +4693,4 @@ static char * file[] = { (if idlwave-shell-use-toolbar (add-hook 'idlwave-shell-mode-hook 'idlwave-toolbar-add-everywhere)) -;; arch-tag: 20c2e8ce-0709-41d8-a5b6-bb039148440a ;;; idlw-shell.el ends here diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index 1d779fef45f..40c7f2c58e7 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -2152,7 +2152,7 @@ Also checks if the correct END statement has been used." ;;(backward-char 1) (let* ((pos (point-marker)) (last-abbrev-marker (copy-marker last-abbrev-location)) - (eol-pos (save-excursion (end-of-line) (point))) + (eol-pos (point-at-eol)) begin-pos end-pos end end1 ) (if idlwave-reindent-end (idlwave-indent-line)) (setq last-abbrev-location (marker-position last-abbrev-marker)) @@ -3301,10 +3301,8 @@ ignored." (setq here (point)) (beginning-of-line) (setq bcl (point)) - (re-search-forward - (concat "^[ \t]*" comment-start "+") - (save-excursion (end-of-line) (point)) - t) + (re-search-forward (concat "^[ \t]*" comment-start "+") + (point-at-eol) t) ;; Get the comment leader on the line and its length (setq pre (current-column)) ;; the comment leader is the indentation plus exactly the @@ -3369,9 +3367,7 @@ ignored." (setq indent hang) (beginning-of-line) (while (> (point) start) - (re-search-forward comment-start-skip - (save-excursion (end-of-line) (point)) - t) + (re-search-forward comment-start-skip (point-at-eol) t) (if (> (setq diff (- indent (current-column))) 0) (progn (if (>= here (point)) @@ -3393,13 +3389,9 @@ ignored." (setq indent (min indent (progn - (re-search-forward - comment-start-skip - (save-excursion (end-of-line) (point)) - t) + (re-search-forward comment-start-skip (point-at-eol) t) (current-column)))) - (forward-line -1)) - ) + (forward-line -1))) (setq fill-prefix (concat fill-prefix (make-string (- indent pre) ?\ ))) @@ -3407,10 +3399,7 @@ ignored." (setq first-indent (max (progn - (re-search-forward - comment-start-skip - (save-excursion (end-of-line) (point)) - t) + (re-search-forward comment-start-skip (point-at-eol) t) (current-column)) indent)) @@ -3448,17 +3437,11 @@ If not found returns nil." (if idlwave-use-last-hang-indent (save-excursion (end-of-line) - (if (re-search-backward - idlwave-hang-indent-regexp - (save-excursion (beginning-of-line) (point)) - t) + (if (re-search-backward idlwave-hang-indent-regexp (point-at-bol) t) (+ (current-column) (length idlwave-hang-indent-regexp)))) (save-excursion (beginning-of-line) - (if (re-search-forward - idlwave-hang-indent-regexp - (save-excursion (end-of-line) (point)) - t) + (if (re-search-forward idlwave-hang-indent-regexp (point-at-eol) t) (current-column))))) (defun idlwave-auto-fill () @@ -3502,18 +3485,14 @@ if `idlwave-auto-fill-split-string' is non-nil." (save-excursion (forward-line -1) (idlwave-calc-hanging-indent)))) - (if indent - (progn - ;; Remove whitespace between comment delimiter and - ;; text, insert spaces for appropriate indentation. - (beginning-of-line) - (re-search-forward - comment-start-skip - (save-excursion (end-of-line) (point)) t) - (delete-horizontal-space) - (idlwave-indent-to indent) - (goto-char (- (point-max) here))) - ))) + (when indent + ;; Remove whitespace between comment delimiter and + ;; text, insert spaces for appropriate indentation. + (beginning-of-line) + (re-search-forward comment-start-skip (point-at-eol) t) + (delete-horizontal-space) + (idlwave-indent-to indent) + (goto-char (- (point-max) here))))) ;; Split code or comment? (if (save-excursion (end-of-line 0) @@ -3767,7 +3746,7 @@ unless the optional second argument NOINDENT is non-nil." (setq s1 (downcase s1) s2 (downcase s2))) (idlwave-abbrev-change-case (setq s1 (upcase s1) s2 (upcase s2)))) - (let ((beg (save-excursion (beginning-of-line) (point))) + (let ((beg (point-at-bol)) end) (if (not (looking-at "\\s-*\n")) (open-line 1)) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index aeb2e91b6af..6114a0e15b2 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -703,7 +703,7 @@ point at BOB." (setq str-terminator ?/)) (re-search-forward (concat "\\([^\\]\\|^\\)" (string str-terminator)) - (save-excursion (end-of-line) (point)) t)) + (point-at-eol) t)) ((nth 7 parse) (forward-line)) ((or (nth 4 parse) @@ -759,7 +759,7 @@ macro as normal text." (setq str-terminator ?/)) (re-search-backward (concat "\\([^\\]\\|^\\)" (string str-terminator)) - (save-excursion (beginning-of-line) (point)) t)) + (point-at-bol) t)) ((nth 7 parse) (goto-char (nth 8 parse))) ((or (nth 4 parse) @@ -3377,5 +3377,4 @@ Key bindings: (provide 'js) -;; arch-tag: 1a0d0409-e87f-4fc7-a58c-3731c66ddaac ;; js.el ends here diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index fcd0242a10d..b6158a0e581 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -616,7 +616,7 @@ and `\\' when preceded by `?'." (setq re (regexp-quote (or (match-string 4) (match-string 2)))) (if (match-beginning 1) (setq re (concat "\\s *" re))) (let* ((id-end (goto-char (match-end 0))) - (line-end-position (save-excursion (end-of-line) (point))) + (line-end-position (point-at-eol)) (state (list in-string nest depth pcol indent))) ;; parse the rest of the line (while (and (> line-end-position (point)) @@ -1256,7 +1256,7 @@ buffer position `limit' or the end of the buffer." (save-excursion (beginning-of-line) (catch 'done - (let ((eol (save-excursion (end-of-line) (point))) + (let ((eol (point-at-eol)) (case-fold-search nil) ;; Fake match data such that (match-end 0) is at eol (end-match-data (progn (looking-at ".*$") (match-data))) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 24768d93e6a..3847e3c56e4 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -7269,7 +7269,7 @@ indentation is done before aligning." (save-excursion (goto-char begin) (let (element - (eol (save-excursion (progn (end-of-line) (point))))) + (eol (point-at-eol))) (setq element (nth 0 copy)) (when (and (or (and (listp (car element)) (memq major-mode (car element))) @@ -7295,7 +7295,7 @@ the token in MATCH." ;; Determine the greatest whitespace distance to the alignment ;; character (goto-char begin) - (setq eol (progn (end-of-line) (point)) + (setq eol (point-at-eol) bol (setq begin (progn (beginning-of-line) (point)))) (while (< bol end) (save-excursion @@ -7306,13 +7306,13 @@ the token in MATCH." (setq max distance)))) (forward-line) (setq bol (point) - eol (save-excursion (end-of-line) (point))) + eol (point-at-eol)) (setq lines (1+ lines))) ;; Now insert enough maxs to push each assignment operator to ;; the same column. We need to use 'lines' as a counter, since ;; the location of the mark may change (goto-char (setq bol begin)) - (setq eol (save-excursion (end-of-line) (point))) + (setq eol (point-at-eol)) (while (> lines 0) (when (and (re-search-forward match eol t) (not (vhdl-in-literal))) @@ -7324,7 +7324,7 @@ the token in MATCH." (beginning-of-line) (forward-line) (setq bol (point) - eol (save-excursion (end-of-line) (point))) + eol (point-at-eol)) (setq lines (1- lines)))))) (defun vhdl-align-region-groups (beg end &optional spacing @@ -7988,7 +7988,7 @@ buffer." (forward-char) (vhdl-forward-syntactic-ws)) (goto-char end) - (when (> pos (save-excursion (end-of-line) (point))) + (when (> pos (point-at-eol)) (error "ERROR: Not within a generic/port clause")) ;; delete closing parenthesis on separate line (not supported style) (when (save-excursion (beginning-of-line) (looking-at "^\\s-*);")) @@ -15916,7 +15916,7 @@ current project/directory." &optional insert-conf) "Generate block configuration for architecture." (let ((margin (current-indentation)) - (beg (save-excursion (beginning-of-line) (point))) + (beg (point-at-bol)) ent-entry inst-entry inst-path inst-prev-path cons-key tmp-alist) ;; insert block configuration (for architecture) (vhdl-insert-keyword "FOR ") (insert arch-name "\n") @@ -16977,5 +16977,4 @@ to visually support naming conventions.") (provide 'vhdl-mode) -;; arch-tag: 780d7073-9b5d-4c6c-b0d8-26b28783aba3 ;;; vhdl-mode.el ends here |