comparison lisp/progmodes/idlwave.el @ 111433:05dc9dca8729

Replace end-of-line, save-excursion etc with point-at-eol, point-at-bol. * lisp/mh-e/mh-seq.el (mh-read-msg-list): Use point-at-eol. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-show-infos) (gnus-bookmark-kill-line): Use point-at-eol. * lisp/cedet/ede/proj-elisp.el (ede-proj-flush-autoconf): Use point-at-bol. * lisp/emacs-lisp/chart.el (chart-zap-chars): * lisp/play/decipher.el (decipher-set-map): * lisp/progmodes/ada-mode.el (ada-get-current-indent) (ada-search-ignore-string-comment, ada-tab-hard, ada-untab-hard): * lisp/progmodes/ada-prj.el (ada-prj-load-from-file, ada-prj-display-help): * lisp/progmodes/ada-xref.el (ada-initialize-runtime-library) (ada-get-all-references): * lisp/progmodes/cperl-mode.el (cperl-electric-paren) (cperl-electric-rparen, cperl-electric-keyword, cperl-electric-else) (cperl-linefeed, cperl-sniff-for-indent, cperl-to-comment-or-eol) (cperl-find-pods-heres, cperl-indent-exp, cperl-fix-line-spacing) (cperl-word-at-point-hard): * lisp/progmodes/idlw-shell.el (idlwave-shell-move-or-history) (idlwave-shell-filename-string, idlwave-shell-batch-command) (idlwave-shell-display-line): * lisp/progmodes/idlwave.el (idlwave-show-begin, idlwave-fill-paragraph) (idlwave-calc-hanging-indent, idlwave-auto-fill, idlwave-template): * lisp/progmodes/js.el (js--re-search-forward-inner) (js--re-search-backward-inner): * lisp/progmodes/vhdl-mode.el (vhdl-align-region-1, vhdl-align-region-2) (vhdl-fix-clause, vhdl-compose-configuration-architecture): * lisp/progmodes/ruby-mode.el (ruby-parse-partial, eval-when-compile): * lisp/textmodes/flyspell.el (flyspell-process-localwords): * lisp/textmodes/ispell.el (ispell-buffer-local-parsing) (ispell-buffer-local-dict, ispell-buffer-local-words): Use point-at-bol and point-at-eol.
author Glenn Morris <rgm@gnu.org>
date Sat, 06 Nov 2010 18:36:33 -0700
parents 043aac1cda3c
children 56b71cddc9c5
comparison
equal deleted inserted replaced
111432:8de1e4554e5e 111433:05dc9dca8729
2150 ;; Re-indent end line 2150 ;; Re-indent end line
2151 ;;(insert-char ?\ 1) ;; So indent, etc. work well 2151 ;;(insert-char ?\ 1) ;; So indent, etc. work well
2152 ;;(backward-char 1) 2152 ;;(backward-char 1)
2153 (let* ((pos (point-marker)) 2153 (let* ((pos (point-marker))
2154 (last-abbrev-marker (copy-marker last-abbrev-location)) 2154 (last-abbrev-marker (copy-marker last-abbrev-location))
2155 (eol-pos (save-excursion (end-of-line) (point))) 2155 (eol-pos (point-at-eol))
2156 begin-pos end-pos end end1 ) 2156 begin-pos end-pos end end1 )
2157 (if idlwave-reindent-end (idlwave-indent-line)) 2157 (if idlwave-reindent-end (idlwave-indent-line))
2158 (setq last-abbrev-location (marker-position last-abbrev-marker)) 2158 (setq last-abbrev-location (marker-position last-abbrev-marker))
2159 (when (and (idlwave-check-abbrev 0 t) 2159 (when (and (idlwave-check-abbrev 0 t)
2160 idlwave-show-block) 2160 idlwave-show-block)
3299 (untabify start end) 3299 (untabify start end)
3300 ;; 3300 ;;
3301 (setq here (point)) 3301 (setq here (point))
3302 (beginning-of-line) 3302 (beginning-of-line)
3303 (setq bcl (point)) 3303 (setq bcl (point))
3304 (re-search-forward 3304 (re-search-forward (concat "^[ \t]*" comment-start "+")
3305 (concat "^[ \t]*" comment-start "+") 3305 (point-at-eol) t)
3306 (save-excursion (end-of-line) (point))
3307 t)
3308 ;; Get the comment leader on the line and its length 3306 ;; Get the comment leader on the line and its length
3309 (setq pre (current-column)) 3307 (setq pre (current-column))
3310 ;; the comment leader is the indentation plus exactly the 3308 ;; the comment leader is the indentation plus exactly the
3311 ;; number of consecutive ";". 3309 ;; number of consecutive ";".
3312 (setq fill-prefix-reg 3310 (setq fill-prefix-reg
3367 ;; a fill-prefix. 3365 ;; a fill-prefix.
3368 (progn 3366 (progn
3369 (setq indent hang) 3367 (setq indent hang)
3370 (beginning-of-line) 3368 (beginning-of-line)
3371 (while (> (point) start) 3369 (while (> (point) start)
3372 (re-search-forward comment-start-skip 3370 (re-search-forward comment-start-skip (point-at-eol) t)
3373 (save-excursion (end-of-line) (point))
3374 t)
3375 (if (> (setq diff (- indent (current-column))) 0) 3371 (if (> (setq diff (- indent (current-column))) 0)
3376 (progn 3372 (progn
3377 (if (>= here (point)) 3373 (if (>= here (point))
3378 ;; adjust the original location for the 3374 ;; adjust the original location for the
3379 ;; inserted text. 3375 ;; inserted text.
3391 (while (> (point) start) 3387 (while (> (point) start)
3392 (beginning-of-line) 3388 (beginning-of-line)
3393 (setq indent 3389 (setq indent
3394 (min indent 3390 (min indent
3395 (progn 3391 (progn
3396 (re-search-forward 3392 (re-search-forward comment-start-skip (point-at-eol) t)
3397 comment-start-skip
3398 (save-excursion (end-of-line) (point))
3399 t)
3400 (current-column)))) 3393 (current-column))))
3401 (forward-line -1)) 3394 (forward-line -1)))
3402 )
3403 (setq fill-prefix (concat fill-prefix 3395 (setq fill-prefix (concat fill-prefix
3404 (make-string (- indent pre) 3396 (make-string (- indent pre)
3405 ?\ ))) 3397 ?\ )))
3406 ;; first-line indent 3398 ;; first-line indent
3407 (setq first-indent 3399 (setq first-indent
3408 (max 3400 (max
3409 (progn 3401 (progn
3410 (re-search-forward 3402 (re-search-forward comment-start-skip (point-at-eol) t)
3411 comment-start-skip
3412 (save-excursion (end-of-line) (point))
3413 t)
3414 (current-column)) 3403 (current-column))
3415 indent)) 3404 indent))
3416 3405
3417 ;; try to keep point at its original place 3406 ;; try to keep point at its original place
3418 (goto-char here) 3407 (goto-char here)
3446 on the line. 3435 on the line.
3447 If not found returns nil." 3436 If not found returns nil."
3448 (if idlwave-use-last-hang-indent 3437 (if idlwave-use-last-hang-indent
3449 (save-excursion 3438 (save-excursion
3450 (end-of-line) 3439 (end-of-line)
3451 (if (re-search-backward 3440 (if (re-search-backward idlwave-hang-indent-regexp (point-at-bol) t)
3452 idlwave-hang-indent-regexp
3453 (save-excursion (beginning-of-line) (point))
3454 t)
3455 (+ (current-column) (length idlwave-hang-indent-regexp)))) 3441 (+ (current-column) (length idlwave-hang-indent-regexp))))
3456 (save-excursion 3442 (save-excursion
3457 (beginning-of-line) 3443 (beginning-of-line)
3458 (if (re-search-forward 3444 (if (re-search-forward idlwave-hang-indent-regexp (point-at-eol) t)
3459 idlwave-hang-indent-regexp
3460 (save-excursion (end-of-line) (point))
3461 t)
3462 (current-column))))) 3445 (current-column)))))
3463 3446
3464 (defun idlwave-auto-fill () 3447 (defun idlwave-auto-fill ()
3465 "Called to break lines in auto fill mode. 3448 "Called to break lines in auto fill mode.
3466 Only fills non-comment lines if `idlwave-fill-comment-line-only' is 3449 Only fills non-comment lines if `idlwave-fill-comment-line-only' is
3500 (let ((here (- (point-max) (point))) 3483 (let ((here (- (point-max) (point)))
3501 (indent 3484 (indent
3502 (save-excursion 3485 (save-excursion
3503 (forward-line -1) 3486 (forward-line -1)
3504 (idlwave-calc-hanging-indent)))) 3487 (idlwave-calc-hanging-indent))))
3505 (if indent 3488 (when indent
3506 (progn 3489 ;; Remove whitespace between comment delimiter and
3507 ;; Remove whitespace between comment delimiter and 3490 ;; text, insert spaces for appropriate indentation.
3508 ;; text, insert spaces for appropriate indentation. 3491 (beginning-of-line)
3509 (beginning-of-line) 3492 (re-search-forward comment-start-skip (point-at-eol) t)
3510 (re-search-forward 3493 (delete-horizontal-space)
3511 comment-start-skip 3494 (idlwave-indent-to indent)
3512 (save-excursion (end-of-line) (point)) t) 3495 (goto-char (- (point-max) here)))))
3513 (delete-horizontal-space)
3514 (idlwave-indent-to indent)
3515 (goto-char (- (point-max) here)))
3516 )))
3517 ;; Split code or comment? 3496 ;; Split code or comment?
3518 (if (save-excursion 3497 (if (save-excursion
3519 (end-of-line 0) 3498 (end-of-line 0)
3520 (idlwave-in-comment)) 3499 (idlwave-in-comment))
3521 ;; Splitting a non-full-line comment. 3500 ;; Splitting a non-full-line comment.
3765 (error "No templates in idlwave-shell")) 3744 (error "No templates in idlwave-shell"))
3766 (cond ((eq idlwave-abbrev-change-case 'down) 3745 (cond ((eq idlwave-abbrev-change-case 'down)
3767 (setq s1 (downcase s1) s2 (downcase s2))) 3746 (setq s1 (downcase s1) s2 (downcase s2)))
3768 (idlwave-abbrev-change-case 3747 (idlwave-abbrev-change-case
3769 (setq s1 (upcase s1) s2 (upcase s2)))) 3748 (setq s1 (upcase s1) s2 (upcase s2))))
3770 (let ((beg (save-excursion (beginning-of-line) (point))) 3749 (let ((beg (point-at-bol))
3771 end) 3750 end)
3772 (if (not (looking-at "\\s-*\n")) 3751 (if (not (looking-at "\\s-*\n"))
3773 (open-line 1)) 3752 (open-line 1))
3774 (insert s1) 3753 (insert s1)
3775 (save-excursion 3754 (save-excursion