* [RFC] bytecomp: simple source-level optimization @ 2014-06-23 6:43 Dmitry Antipov 2014-06-23 8:29 ` Leo Liu ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Dmitry Antipov @ 2014-06-23 6:43 UTC (permalink / raw) To: Emacs development discussions [-- Attachment #1: Type: text/plain, Size: 604 bytes --] Source forms like: (if (= (point) (point-min)) ...) or: (if (eq (point-max) (point)) ...) are widely used, but compiled as is, which is suboptimal. The first one can be optimized to (if (bobp) ...) and the second to (if (eobp) ...), respectively. Example: (defun foo (x y) (if (= (point) (point-min)) x y)) Suboptimal: 0 point 1 point-min 2 eqlsign 3 goto-if-nil 1 6 varref x 7 return 8:1 varref y 9 return Better: 0 bobp 1 goto-if-nil 1 4 varref x 5 return 6:1 varref y 7 return Thoughts? Dmitry [-- Attachment #2: byte_optimize_point_location.patch --] [-- Type: text/x-patch, Size: 1340 bytes --] === modified file 'lisp/emacs-lisp/byte-opt.el' --- lisp/emacs-lisp/byte-opt.el 2014-06-02 00:18:22 +0000 +++ lisp/emacs-lisp/byte-opt.el 2014-06-23 06:30:10 +0000 @@ -1057,11 +1057,27 @@ (if (nth 1 form) form)) +(defun byte-optimize-point-location (form) + ;; For OP in '=', 'eq' and 'equal': + ;; (OP (point) (point-min)) and (OP (point-min) (point)) => (bobp) + ;; (OP (point) (point-max)) and (OP (point-max) (point)) => (eobp) + (let ((op0 (nth 1 form)) (op1 (nth 2 form))) + (cond ((or (and (equal op0 '(point)) (equal op1 '(point-min))) + (and (equal op0 '(point-min)) (equal op1 '(point)))) + '(bobp)) + ((or (and (equal op0 '(point)) (equal op1 '(point-max))) + (and (equal op0 '(point-max)) (equal op1 '(point)))) + '(eobp)) + (t form)))) + (put 'and 'byte-optimizer 'byte-optimize-and) (put 'or 'byte-optimizer 'byte-optimize-or) (put 'cond 'byte-optimizer 'byte-optimize-cond) (put 'if 'byte-optimizer 'byte-optimize-if) (put 'while 'byte-optimizer 'byte-optimize-while) +(put '= 'byte-optimizer 'byte-optimize-point-location) +(put 'eq 'byte-optimizer 'byte-optimize-point-location) +(put 'equal 'byte-optimizer 'byte-optimize-point-location) ;; byte-compile-negation-optimizer lives in bytecomp.el (put '/= 'byte-optimizer 'byte-compile-negation-optimizer) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 6:43 [RFC] bytecomp: simple source-level optimization Dmitry Antipov @ 2014-06-23 8:29 ` Leo Liu 2014-06-23 11:05 ` Dmitry Antipov 2014-06-23 9:09 ` Andreas Röhler 2014-06-23 9:56 ` David Kastrup 2 siblings, 1 reply; 12+ messages in thread From: Leo Liu @ 2014-06-23 8:29 UTC (permalink / raw) To: emacs-devel On 2014-06-23 10:43 +0400, Dmitry Antipov wrote: > Source forms like: > > (if (= (point) (point-min)) ...) > > or: > > (if (eq (point-max) (point)) ...) > > are widely used, but compiled as is, which is suboptimal. > The first one can be optimized to (if (bobp) ...) and the > second to (if (eobp) ...), respectively. Optimise for unidiomatic code in non-performace-critical cases? Not sure ;) Leo ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 8:29 ` Leo Liu @ 2014-06-23 11:05 ` Dmitry Antipov 2014-06-23 12:26 ` Leo Liu 0 siblings, 1 reply; 12+ messages in thread From: Dmitry Antipov @ 2014-06-23 11:05 UTC (permalink / raw) To: Leo Liu; +Cc: emacs-devel On 06/23/2014 12:29 PM, Leo Liu wrote: > Optimise for unidiomatic code in non-performace-critical cases? Not sure ;) Shaving off two machine instructions at the cost of almost nothing is a win for any C/C++ compiler developer. Since our bytecode is much faster than native code, we don't want to waste our time - it's always better to develop a new major mode to edit text from Phaistos Disc instead. Dmitry ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 11:05 ` Dmitry Antipov @ 2014-06-23 12:26 ` Leo Liu 0 siblings, 0 replies; 12+ messages in thread From: Leo Liu @ 2014-06-23 12:26 UTC (permalink / raw) To: Dmitry Antipov; +Cc: emacs-devel On 2014-06-23 15:05 +0400, Dmitry Antipov wrote: > Shaving off two machine instructions at the cost of almost nothing is > a win for any C/C++ compiler developer. I am not against it. Just saying if the two saved instructions were on code people regularly write the gain would be greater. Leo ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 6:43 [RFC] bytecomp: simple source-level optimization Dmitry Antipov 2014-06-23 8:29 ` Leo Liu @ 2014-06-23 9:09 ` Andreas Röhler 2014-06-23 12:44 ` Nicolas Richard 2014-06-23 14:19 ` Stefan Monnier 2014-06-23 9:56 ` David Kastrup 2 siblings, 2 replies; 12+ messages in thread From: Andreas Röhler @ 2014-06-23 9:09 UTC (permalink / raw) To: emacs-devel; +Cc: Dmitry Antipov On 23.06.2014 08:43, Dmitry Antipov wrote: > Source forms like: > > (if (= (point) (point-min)) ...) > > or: > > (if (eq (point-max) (point)) ...) > > are widely used, Hi Dimitry, IMHO a very useful move. However, as this is suboptimal style, probably fixing the source --and spread the message-- is better than fixing it afterwards. Fixing the sources will prevent beginners from learning suboptimal habits. Thanks all, Andreas ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 9:09 ` Andreas Röhler @ 2014-06-23 12:44 ` Nicolas Richard 2014-06-23 14:01 ` Andreas Röhler 2014-06-23 14:19 ` Stefan Monnier 1 sibling, 1 reply; 12+ messages in thread From: Nicolas Richard @ 2014-06-23 12:44 UTC (permalink / raw) To: Andreas Röhler; +Cc: Dmitry Antipov, emacs-devel Andreas Röhler <andreas.roehler@online.de> writes: > Fixing the sources will prevent beginners from learning suboptimal > habits. I grepped through the source tree to see the occurrences. Here's a patch fixing those I found. I assumed (>= (point) (point-max)) meant (eobp). (I did this in emacs-24 branch, I dunno if it applies cleanly to trunk). iff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el index 66ec0c3..db56d4f 100644 --- a/lisp/allout-widgets.el +++ b/lisp/allout-widgets.el @@ -802,7 +802,7 @@ Optional RECURSING is for internal use, to limit recursion." (let ((this-widget (or (widget-at (point)) ;; XXX we really should be checking across ;; edited span, not just point and point+1 - (and (not (eq (point) (point-max))) + (and (not (eobp)) (widget-at (1+ (point)))))) inserted-at) (save-excursion diff --git a/lisp/bookmark.el b/lisp/bookmark.el index eab2ea7..c271588 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -884,7 +884,7 @@ Lines beginning with `#' are ignored." (if (not (derived-mode-p 'bookmark-edit-annotation-mode)) (error "Not in bookmark-edit-annotation-mode")) (goto-char (point-min)) - (while (< (point) (point-max)) + (while (not (eobp)) (if (looking-at "^#") (bookmark-kill-line t) (forward-line 1))) @@ -1668,7 +1668,7 @@ mainly for debugging, and should not be necessary in normal use." (forward-line bookmark-bmenu-inline-header-height)) (setq bookmark-bmenu-hidden-bookmarks ()) (let ((inhibit-read-only t)) - (while (< (point) (point-max)) + (while (not (eobp)) (let ((bmrk (bookmark-bmenu-bookmark))) (push bmrk bookmark-bmenu-hidden-bookmarks) (let ((start (line-end-position))) @@ -1765,7 +1765,7 @@ if an annotation exists." (progn (save-excursion (insert ann) (unless (bolp) (insert "\n"))) - (while (< (point) (point-max)) + (while (not (eobp)) (beginning-of-line) ; paranoia (insert " ") (forward-line) diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index 30a06a2..5779e3c 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -746,7 +746,7 @@ (delete-char 1)) (goto-char calc-edit-top) (while (and (re-search-forward "^$" nil t) - (not (= (point) (point-max)))) + (not (eobp))) (delete-char 1))) (defun calc-edit-macro-command () diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index ab2ab3e..f32a671 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -3705,7 +3705,7 @@ which is the value of the user option (todo-categories-category-number 0) ;; Find start of Category button if we just entered Todo Categories ;; mode. - (pt (if (eq (point) (point-max)) + (pt (if (eobp) (save-excursion (forward-line -2) (goto-char (next-single-char-property-change diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el index 43482ce..a11a689 100644 --- a/lisp/cedet/ede/project-am.el +++ b/lisp/cedet/ede/project-am.el @@ -237,7 +237,7 @@ OT is the object target. DIR is the directory to start in." (find-file (concat (oref obj path) "Makefile.am")) (goto-char (point-min)) (makefile-move-to-macro (project-am-macro obj)) - (if (= (point-min) (point)) + (if (bobp) (re-search-forward (ede-target-name obj)))) (defmethod project-new-target ((proj project-am-makefile) @@ -267,7 +267,7 @@ buffer being in order to provide a smart default target type." (ede-with-projectfile ot (goto-char (point-min)) (makefile-next-dependency) - (if (= (point) (point-min)) + (if (bobp) (goto-char (point-max)) (beginning-of-line) (insert "\n") @@ -278,7 +278,7 @@ buffer being in order to provide a smart default target type." ;; Add to the list of objects. (goto-char (point-min)) (makefile-move-to-macro (car (cdr (cdr ntype)))) - (if (= (point) (point-min)) + (if (bobp) (progn (if (re-search-forward makefile-macroassign-regex nil t) (progn (forward-line -1) diff --git a/lisp/cedet/ede/shell.el b/lisp/cedet/ede/shell.el index 3d6eb19..8f5c457 100644 --- a/lisp/cedet/ede/shell.el +++ b/lisp/cedet/ede/shell.el @@ -44,7 +44,7 @@ COMMAND is a text string representing the thing to be run." (switch-to-buffer-other-window buff t)) ;; Force a shell into the buffer. (shell buff) - (while (eq (point-min) (point)) + (while (bobp) (accept-process-output)) ;; Change the default directory (if (not (string= (file-name-as-directory (expand-file-name default-directory)) diff --git a/lisp/completion.el b/lisp/completion.el index 7e5c214..9eb7a5a 100644 --- a/lisp/completion.el +++ b/lisp/completion.el @@ -2107,7 +2107,7 @@ If file is not specified, then use `save-completions-file-name'." (search-failed (message "End of file while reading completions.")) (end-of-file - (if (= (point) (point-max)) + (if (eobp) (if (not no-message-p) (message "Loading completions from file %s . . . Done." filename)) diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el index 2c691cf..8e9f81d 100644 --- a/lisp/dirtrack.el +++ b/lisp/dirtrack.el @@ -231,7 +231,7 @@ the prompt specified by `dirtrack-list', and calls `shell-process-cd' if the directory seems to have changed away from `default-directory'." (when (and dirtrack-mode - (not (eq (point) (point-min)))) ; there must be output + (not (bobp))) ; there must be output (save-excursion ; What's this for? -- cyd (if (not (string-match (nth 0 dirtrack-list) input)) ;; No match diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index 42b8a91..c2302cd 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -503,7 +503,8 @@ happened." (funcall electric-pair-open-newline-between-pairs) electric-pair-open-newline-between-pairs) (eq last-command-event ?\n) - (< (1+ (point-min)) (point) (point-max)) + (not (eobp)) + (< (1+ (point-min)) (point)) (eq (save-excursion (skip-chars-backward "\t\s") (char-before (1- (point)))) diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el index d516bd4..0051a35 100644 --- a/lisp/emulation/cua-rect.el +++ b/lisp/emulation/cua-rect.el @@ -578,7 +578,7 @@ If command is repeated at same position, delete the rectangle." (setq start (line-beginning-position)) (narrow-to-region start end) (goto-char (point-min)) - (while (< (point) (point-max)) + (while (not (eobp)) (move-to-column r pad) (and (not pad) (not visible) (> (current-column) r) (backward-char 1)) @@ -1239,7 +1239,7 @@ The numbers are formatted according to the FORMAT string." (defun cua--left-fill-rectangle (_start _end) (beginning-of-line) - (while (< (point) (point-max)) + (while (not (eobp)) (delete-horizontal-space nil) (forward-line 1)) (fill-region-as-paragraph (point-min) (point-max) 'left nil) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index d93e9e0..fbdab79 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3941,8 +3941,8 @@ This places `point' just after the prompt, or at the beginning of the line." "Kill current input line using `erc-bol' followed by `kill-line'." (interactive) (when (and (erc-bol) - (/= (point) (point-max))) ;; Prevent a (ding) and an error when - ;; there's nothing to kill + (not (eobp))) ;; Prevent a (ding) and an error when + ;; there's nothing to kill (if (boundp 'erc-input-ring-index) (setq erc-input-ring-index nil)) (kill-line))) diff --git a/lisp/ffap.el b/lisp/ffap.el index 119e0ad..0e121e6 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1763,7 +1763,7 @@ Only intended for interactive use." (pop-to-buffer gnus-article-buffer) (widen) ;; Skip headers for ffap-gnus-next (which will wrap around) - (if (eq (point) (point-min)) (search-forward "\n\n" nil t)) + (if (bobp) (search-forward "\n\n" nil t)) (unwind-protect (eval form) (pop-to-buffer sb)))) diff --git a/lisp/forms.el b/lisp/forms.el index b1eb388..9abbd23 100644 --- a/lisp/forms.el +++ b/lisp/forms.el @@ -1867,7 +1867,7 @@ after the current record." (beginning-of-line) (setq here (point)) (if (or (re-search-backward regexp nil t) - (and (< (point) (point-max)) + (and (not (eobp)) (progn (goto-char (point-max)) (re-search-backward regexp here t)))) diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 67525ee..e428d8c 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -1710,7 +1710,7 @@ and that there are no duplicates." (widen) (goto-char (point-min)) - (while (< (point) (point-max)) + (while (not (eobp)) (let ((p (point)) (cur (condition-case nil (read (current-buffer)) @@ -3913,7 +3913,7 @@ If REREAD is not nil, downloaded articles are marked as unread." (while load (setq load nil) (goto-char (point-min)) - (while (< (point) (point-max)) + (while (not (eobp)) (cond ((and (looking-at "[0-9]+\t") (<= (- (match-end 0) (match-beginning 0)) 9)) (push (read (current-buffer)) nov-arts) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 29d70aa..376ff74 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -6366,7 +6366,7 @@ Argument LINES specifies lines to be scrolled up." (save-excursion (end-of-line) (and (pos-visible-in-window-p) ;Not continuation line. - (>= (point) (point-max))))) + (eobp)))) ;; Nothing in this page. (if (or (not gnus-page-broken) (save-excursion diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el index 91d5c76..1459b21 100644 --- a/lisp/gnus/gnus-bookmark.el +++ b/lisp/gnus/gnus-bookmark.el @@ -529,7 +529,7 @@ Optional argument SHOW means show them unconditionally." (forward-line 2) (setq gnus-bookmark-bmenu-hidden-bookmarks ()) (let ((inhibit-read-only t)) - (while (< (point) (point-max)) + (while (not (eobp)) (let ((bmrk (gnus-bookmark-bmenu-bookmark))) (setq gnus-bookmark-bmenu-hidden-bookmarks (cons bmrk gnus-bookmark-bmenu-hidden-bookmarks)) diff --git a/lisp/help-at-pt.el b/lisp/help-at-pt.el index 7f424f7..1f59165 100644 --- a/lisp/help-at-pt.el +++ b/lisp/help-at-pt.el @@ -269,7 +269,7 @@ do not run HOOK. If there are not enough regions to move over, an error results and the number of available regions is mentioned in the error message. Point is not moved and HOOK is not run." (cond ((> arg 0) - (if (= (point) (point-max)) + (if (eobp) (error "No further `%s' regions" prop)) (let ((pos (point))) (dotimes (x arg) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 5b0739e..bc6ffc2 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -947,10 +947,10 @@ BUFFER should be a buffer or a buffer name." (setq elt (match-string 0 elt)) (if (>= (length elt) 17) (setq elt (concat (substring elt 0 14) "..."))) - (if (< (point) (point-max)) + (if (not (eobp)) (move-to-column (* 20 (/ n lines)) t)) (insert (+ i ?\s) ?: elt) - (if (< (point) (point-max)) + (if (not (eobp)) (forward-line 1) (insert "\n")) (setq n (1+ n)) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index a3c5b06..ae5df6c 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -312,7 +312,7 @@ the mode if ARG is omitted or nil." (point) 'ibuffer-filter-group-name nil (point-min))) (ibuffer-backward-filter-group (1- count))) - (when (= (point) (point-min)) + (when (bobp) (goto-char (point-max)) (ibuffer-backward-filter-group 1)) (ibuffer-forward-line 0)) diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index b994949..8e30669 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -128,7 +128,7 @@ This requires either the OS X \"open\" command, or the freedesktop (match-string-no-properties 1)))) (body (progn (forward-line 2) - (if (> (point-max) (point)) + (if (not (eobp)) (buffer-substring-no-properties (point) (point-max)))))) (if (and to subject body) (if (report-emacs-bug-can-use-osx-open) diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 7f27599..b310f10 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -3135,7 +3135,7 @@ been weeded out." (setq this-line (match-beginning 0)) (forward-line 1) ;; get any continuation lines - (while (and (looking-at "^[ \t]+") (< (point) (point-max))) + (while (and (looking-at "^[ \t]+") (not (eobp))) (forward-line 1)) (setq this-line-end (point-marker)) ;; only keep if we don't have it already diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 52f4845..772bb7f 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -2989,7 +2989,7 @@ using the coding system CODING." (coding-system-base coding))) ;; Rewrite the coding-system header. (goto-char x-coding-header) - (if (> (point) (point-min)) + (if (not (bobp)) (delete-region (line-beginning-position) (point)) (forward-line) (insert "\n") diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 2c625f6..8fc8393 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -871,7 +871,7 @@ The other arguments are the same as `rmail-mime-multipart-handler'." (and (not last) (save-excursion (skip-chars-forward "\n") - (> (point-max) (point))) + (not (eobp))) (setq truncated t end (point-max)))) ;; If this is the last boundary according to RFC 2046, hide the ;; epilogue, else hide the boundary only. Use a marker for diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 76764ce..f62eb15 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -941,7 +941,7 @@ the user from the mailer." (unless (memq mail-send-nonascii '(t mime)) (goto-char (point-min)) (skip-chars-forward "\0-\177") - (or (= (point) (point-max)) + (or (eobp) (if (eq mail-send-nonascii 'query) (or (y-or-n-p "Message contains non-ASCII characters; send anyway? ") (error "Aborted")) @@ -1210,7 +1210,7 @@ external program defined by `sendmail-program'." (and (eq mail-send-nonascii 'mime) (not (re-search-forward "^MIME-version:" delimline t)) (progn (skip-chars-forward "\0-\177") - (/= (point) (point-max))) + (not (eobp))) selected-coding (setq charset (coding-system-get selected-coding :mime-charset)) diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 54f4664..9f1bd59 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -304,7 +304,7 @@ The list is in preference order.") (and (eq mail-send-nonascii 'mime) (not (re-search-forward "^MIME-version:" delimline t)) (progn (skip-chars-forward "\0-\177") - (/= (point) (point-max))) + (not (eobp))) smtpmail-code-conv-from (setq charset (coding-system-get smtpmail-code-conv-from diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el index a34a840..288c322 100644 --- a/lisp/mh-e/mh-alias.el +++ b/lisp/mh-e/mh-alias.el @@ -143,7 +143,7 @@ Exclude all aliases already in `mh-alias-alist' from \"ali\"" (insert mh-alias-local-users "\n") (shell-command-on-region (point-min) (point-max) mh-alias-local-users t t) (goto-char (point-min)))) - (while (< (point) (point-max)) + (while (not (eobp)) (cond ((looking-at "\\([^:]*\\):[^:]*:\\([^:]*\\):[^:]*:\\([^:]*\\):") (when (> (string-to-number (match-string 2)) 200) @@ -185,7 +185,7 @@ been loaded." (mh-exec-cmd-quiet t "ali" "-nolist" "-nouser") (setq mh-alias-alist nil) (setq mh-alias-blind-alist nil) - (while (< (point) (point-max)) + (while (not (eobp)) (cond ((looking-at "^[ \t]")) ;Continuation line ((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index ef8fa7e..5451e79 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -976,7 +976,7 @@ Otherwise, simply insert MH-INS-STRING before each line." (run-hooks 'mh-yank-hooks)) (t (or (bolp) (forward-line 1)) - (while (< (point) (point-max)) + (while (not (eobp)) (insert mh-ins-string) (forward-line 1)) (goto-char (point-min))))) ;leave point like sc-cite-original diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index afe2863..07bd8d9 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -292,7 +292,7 @@ ignored if VISIBLE-HEADERS is non-nil." (narrow-to-region start (point)) (goto-char (point-min)) (if visible-headers - (while (< (point) (point-max)) + (while (not (eobp)) (cond ((looking-at visible-headers) (forward-line 1) (while (looking-at "[ \t]") (forward-line 1))) diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index f67bacc..c65085f 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -1799,7 +1799,7 @@ Renders the HTML code in the region POS1 to POS2 using htmlr." (when (fboundp 'htmlr-reset) (htmlr-reset)) ;; something omitted here... (when (fboundp 'htmlr-step) - (while (< (point) (point-max)) + (while (not (eobp)) (htmlr-step))) ;; end original htmlr-render (newsticker--remove-whitespace (buffer-string)))))) diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el index a05a2f6..4f63999 100644 --- a/lisp/net/newst-plainview.el +++ b/lisp/net/newst-plainview.el @@ -5,7 +5,7 @@ ;; Author: Ulf Jasper <ulf.jasper@web.de> ;; Filename: newst-plainview.el ;; URL: http://www.nongnu.org/newsticker -;; Time-stamp: "Mon 11-Feb-2013 20:27:11 gm on skiddaw" +;; Time-stamp: "2014-06-23 12:20:22 youngfrog" ;; Package: newsticker ;; ====================================================================== @@ -1087,7 +1087,7 @@ If VALUE is nil, auto-narrowing is turned off, otherwise it is turned on." "Return t if position is before last feed, nil otherwise." (save-excursion (catch 'result - (while (< (point) (point-max)) + (while (not (eobp)) (unless (newsticker--buffer-goto '(item)) (throw 'result nil)) (unless (newsticker--lists-intersect-p @@ -1099,7 +1099,7 @@ If VALUE is nil, auto-narrowing is turned off, otherwise it is turned on." "Return t if position is behind first item, nil otherwise." (save-excursion (catch 'result - (while (> (point) (point-min)) + (while (not (bobp)) (unless (newsticker--buffer-goto '(item) nil t) (throw 'result nil)) (unless (newsticker--lists-intersect-p diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 2591fc8..a1a68ab 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1197,7 +1197,7 @@ Create the buffer if it doesn't exist." ;; copy the line down to the input area (progn (forward-line 0) - (let ((start (if (eq (point) (point-min)) + (let ((start (if (bobp) (point) (if (get-text-property (1- (point)) 'hard) (point) diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index b3ce7aa..ef463d7 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -1832,7 +1832,7 @@ single name. A character reference contains a character number." (nxml-backward-up-element (- arg)) (condition-case err (while (and (> arg 0) - (< (point) (point-max))) + (not (eobp))) (let ((token-end (nxml-token-after))) (goto-char (cond ((or (memq xmltok-type '(end-tag partial-end-tag)) @@ -1860,7 +1860,7 @@ single name. A character reference contains a character number." (nxml-up-element (- arg)) (condition-case err (while (and (> arg 0) - (< (point-min) (point))) + (not (bobp))) (let ((token-end (nxml-token-before))) (goto-char (cond ((or (memq xmltok-type '(start-tag partial-start-tag)) @@ -1938,7 +1938,7 @@ Negative ARG means move backward." (nxml-backward-element (- arg)) (condition-case err (while (and (> arg 0) - (< (point) (point-max))) + (not (eobp))) (goto-char (or (nxml-scan-element-forward (nxml-token-before)) (error "No more elements"))) @@ -1957,7 +1957,7 @@ Negative ARG means move forward." (nxml-forward-element (- arg)) (condition-case err (while (and (> arg 0) - (< (point-min) (point))) + (not (bobp))) (goto-char (or (and (nxml-scan-element-backward (progn (nxml-token-after) @@ -2014,7 +2014,7 @@ Return nil at end of buffer, t otherwise." (offset (- (point) xmltok-start)) pos had-data) (goto-char token-end) - (while (and (< (point) (point-max)) + (while (and (not (eobp)) (not (setq pos (nxml-paragraph-end-pos had-data offset)))) (when (nxml-token-contains-data-p offset) @@ -2034,7 +2034,7 @@ Return nil at start of buffer, t otherwise." (unless (setq pos (nxml-paragraph-start-pos nil offset)) (setq had-data (nxml-token-contains-data-p nil offset)) (goto-char xmltok-start) - (while (and (not pos) (< (point-min) (point))) + (while (and (not pos) (not (bobp))) (cond ((search-backward "<" nxml-prolog-end t) (nxml-move-outside-backwards) (save-excursion diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el index e4b8fc7..06bf3fa 100644 --- a/lisp/nxml/nxml-outln.el +++ b/lisp/nxml/nxml-outln.el @@ -302,7 +302,7 @@ customize which elements are recognized as sections and headings." (nxml-outline-adjust-point)) (defun nxml-outline-pre-adjust-point () - (cond ((and (< (point-min) (point)) + (cond ((and (not (bobp)) (get-char-property (1- (point)) 'invisible) (not (get-char-property (point) 'invisible)) (let ((str (or (get-char-property (point) 'before-string) @@ -318,12 +318,12 @@ customize which elements are recognized as sections and headings." ;; region. (goto-char (previous-single-char-property-change (1- (point)) 'invisible))) - ((and (< (point) (point-max)) + ((and (not (eobp)) (get-char-property (point) 'display) (get-char-property (1+ (point)) 'invisible)) (goto-char (next-single-char-property-change (1+ (point)) 'invisible))) - ((and (< (point) (point-max)) + ((and (not (eobp)) (get-char-property (point) 'invisible)) (goto-char (next-single-char-property-change (point) 'invisible))))) @@ -331,7 +331,7 @@ customize which elements are recognized as sections and headings." (defun nxml-outline-adjust-point () "Adjust point after showing or hiding elements." (when (and (get-char-property (point) 'invisible) - (< (point-min) (point)) + (not (bobp)) (get-char-property (1- (point)) 'invisible)) (goto-char (previous-single-char-property-change (point) 'invisible diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el index 7d360cb..95bb4b2 100644 --- a/lisp/nxml/nxml-rap.el +++ b/lisp/nxml/nxml-rap.el @@ -213,7 +213,7 @@ type `prolog'." (defun nxml-token-before () "Return the position after the token containing the char before point. Sets variables like `nxml-token-after'." - (if (/= (point-min) (point)) + (if (not (bobp)) (save-excursion (goto-char (1- (point))) (nxml-token-after)) diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el index 0dfdb42..30d06e2 100644 --- a/lisp/nxml/rng-cmpct.el +++ b/lisp/nxml/rng-cmpct.el @@ -131,7 +131,7 @@ Return a pattern." (setq rng-c-current-token (match-string 0)) (goto-char (match-end 0)) (forward-comment (point-max))) - ((= (point) (point-max)) + ((eobp) (setq rng-c-current-token "")) (t (rng-c-error "Invalid token")))) diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index baf63e9..e8944e8 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el @@ -581,7 +581,7 @@ Return t if there is work to do, nil otherwise." ;; if we have just blank chars skip to the end (when have-remaining-chars (skip-chars-forward " \t\r\n") - (when (= (point) (point-max)) + (when (eobp) (rng-clear-overlays pos (point)) (rng-clear-cached-state pos (point)) (setq have-remaining-chars nil) diff --git a/lisp/obsolete/terminal.el b/lisp/obsolete/terminal.el index 420ac78..d0d8f1f 100644 --- a/lisp/obsolete/terminal.el +++ b/lisp/obsolete/terminal.el @@ -750,7 +750,7 @@ move to start of new line, clear to end of line." (n (min (- (te-get-char) ?\s) line)) (i 0)) (delete-region (- (point-max) (* n (1+ te-width))) (point-max)) - (if (eq (point) (point-max)) (insert ?\n)) + (if (eobp) (insert ?\n)) (while (< i n) (setq i (1+ i)) (insert-char ?\s te-width) diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el index 152af86..9a6f23f 100644 --- a/lisp/org/ob-ref.el +++ b/lisp/org/ob-ref.el @@ -189,7 +189,7 @@ the variable." (t (while (not (setq type (org-babel-ref-at-ref-p))) (forward-line 1) (beginning-of-line) - (if (or (= (point) (point-min)) (= (point) (point-max))) + (if (or (bobp) (eobp)) (error "Reference not found"))))) (let ((params (append args '((:results . "silent"))))) (setq result diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index b6557108..f8f16e9 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el @@ -638,7 +638,7 @@ Return the number of saved entries." (with-current-buffer buffer (save-excursion (goto-char (point-max)) - (while (not (= (point) (point-min))) + (while (not (bobp)) (backward-char 1) (org-bibtex-read) (bibtex-beginning-of-entry)))) diff --git a/lisp/org/org.el b/lisp/org/org.el index 2a451ed..a506e63 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -17318,7 +17318,7 @@ With prefix ARG, change that many days." (ans (or (looking-at tsr) (save-excursion (skip-chars-backward "^[<\n\r\t") - (if (> (point) (point-min)) (backward-char 1)) + (if (not (bobp)) (backward-char 1)) (and (looking-at tsr) (> (- (match-end 0) pos) -1)))))) (and ans @@ -20132,7 +20132,7 @@ Optional argument N tells to change by that many units." (save-restriction (narrow-to-region beg end) (setq s (goto-char (point-min))) - (while (not (= (point) (point-max))) + (while (not (eobp)) (goto-char (org-find-invisible)) (push (buffer-substring s (point)) snippets) (setq s (goto-char (org-find-visible)))))) diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el index 6208cdb..3fed265 100644 --- a/lisp/org/ox-ascii.el +++ b/lisp/org/ox-ascii.el @@ -445,7 +445,7 @@ HOW determines the type of justification: it can be `left', ;; Disable `adaptive-fill-mode' so it doesn't prevent ;; filling lines matching `adaptive-fill-regexp'. (adaptive-fill-mode nil)) - (while (< (point) (point-max)) + (while (not (eobp)) (justify-current-line how) (forward-line))) (buffer-string))) diff --git a/lisp/play/dissociate.el b/lisp/play/dissociate.el index 0d980d6..812380e 100644 --- a/lisp/play/dissociate.el +++ b/lisp/play/dissociate.el @@ -52,7 +52,7 @@ Default is 2." (save-excursion (goto-char last-query-point) (vertical-motion (- (window-height) 4)) - (or (= (point) (point-max)) + (or (eobp) (and (progn (goto-char (point-max)) (y-or-n-p "Continue dissociation? ")) (progn diff --git a/lisp/play/zone.el b/lisp/play/zone.el index 17b6993..d8a3604 100644 --- a/lisp/play/zone.el +++ b/lisp/play/zone.el @@ -577,7 +577,7 @@ If the element is a function or a list of a function and a number, (goto-char (point-min)) (let ((ok t) lines) - (while (and ok (< (point) (point-max))) + (while (and ok (not (eobp))) (let ((p (point))) (setq ok (zerop (forward-line 1)) lines (cons (buffer-substring p (point)) lines)))) diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index 68b6c87..c0ad1bc 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el @@ -1597,7 +1597,7 @@ If FORCE-IDENTIFIER is non-nil then also adjust keyword as identifier." ) (if (save-excursion (forward-word -1) - (or (= (point) (point-min)) + (or (bobp) (backward-char 1)) (= (following-char) ?')) (funcall ada-case-attribute -1) diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index 7cad848..fec37c8 100644 --- a/lisp/progmodes/ada-xref.el +++ b/lisp/progmodes/ada-xref.el @@ -1656,7 +1656,7 @@ The returned list represents the entity, and can be manipulated through the macros `ada-name-of', `ada-line-of', `ada-column-of', `ada-file-of',..." ;; If at end of buffer (e.g the buffer is empty), error - (if (>= (point) (point-max)) + (if (eobp) (error "No identifier on point")) ;; goto first character of the identifier/operator (skip backward < and > diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el index 44d69d7..b435e4c 100644 --- a/lisp/progmodes/cc-awk.el +++ b/lisp/progmodes/cc-awk.el @@ -661,7 +661,7 @@ ;; This function might do hidden buffer changes. (if pos (goto-char pos)) (forward-line 0) - (while (and (> (point) (point-min)) + (while (and (not (bobp)) (eq (char-before (1- (point))) ?\\)) (forward-line -1)) (point)) @@ -679,10 +679,10 @@ (save-excursion (if pos (goto-char pos)) (end-of-line) - (while (and (< (point) (point-max)) + (while (and (not (eobp)) (eq (char-before) ?\\)) (end-of-line 2)) - (if (< (point) (point-max)) + (if (not (eobp)) (1+ (point)) (point)))) @@ -1039,7 +1039,7 @@ comment at the start of cc-engine.el for more info." (let ((found t)) ; Has the most recent regexp search found b-of-defun? (if (>= arg 0) ;; Go back one defun each time round the following loop. (For +ve arg) - (while (and found (> arg 0) (not (eq (point) (point-min)))) + (while (and found (> arg 0) (not (bobp))) ;; Go back one "candidate" each time round the next loop until one ;; is genuinely a beginning-of-defun. (while (and (setq found (search-backward-regexp @@ -1047,8 +1047,8 @@ comment at the start of cc-engine.el for more info." (not (memq (c-awk-get-NL-prop-prev-line) '(?\$ ?\} ?\#))))) (setq arg (1- arg))) ;; The same for a -ve arg. - (if (not (eq (point) (point-max))) (forward-char 1)) - (while (and found (< arg 0) (not (eq (point) (point-max)))) ; The same for -ve arg. + (if (not (eobp)) (forward-char 1)) + (while (and found (< arg 0) (not (eobp))) ; The same for -ve arg. (while (and (setq found (search-forward-regexp "^[^#} \t\n\r]" (point-max) 'stop-at-limit)) (not (memq (c-awk-get-NL-prop-prev-line) '(?\$ ?\} ?\#))))) diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 4f205d6..f2a7a2c 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -2186,7 +2186,7 @@ function does not require the declaration to contain a brace block." ;; Take special action if we're up against the end of a comment (of ;; either sort): Leave point just after the last non-ws text. - (if (eq (point) (point-max)) + (if (eobp) (while (or (/= (skip-chars-backward " \t\n") 0) (and (re-search-backward prefix-at-bol-here nil t) (/= (match-beginning 1) (match-end 1)))))))) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 1ce0767..bdb40ab 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1016,7 +1016,7 @@ Note that the style variables are always made local to the buffer." ;; Find a limit for the search for a `c-type' property (while (and (/= (skip-chars-backward "^;{}") 0) - (> (point) (point-min)) + (not (bobp)) (memq (c-get-char-property (1- (point)) 'face) '(font-lock-comment-face font-lock-string-face)))) (setq lim (max (point-min) (1- (point)))) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index c4f2b9f..1ad3744 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -5401,7 +5401,7 @@ indentation and initial hashes. Behaves usually outside of comment." ;; Remove existing hashes (goto-char (point-min)) (save-excursion - (while (progn (forward-line 1) (< (point) (point-max))) + (while (progn (forward-line 1) (not (eobp))) (skip-chars-forward " \t") (if (looking-at "#+") (progn diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index cf324b4..4a11bef 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -1675,7 +1675,7 @@ Return point or nil." (setq first-statement (fortran-previous-statement)) (if first-statement (setq icol fortran-minimum-statement-indent) - (if (= (point) (point-min)) + (if (bobp) (setq icol fortran-minimum-statement-indent) (setq icol (fortran-current-line-indentation))) (skip-chars-forward " \t0-9") diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index a8f0d55..872ca1a 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -735,7 +735,7 @@ macro as normal text." (point))))) (while (> count 0) (re-search-backward regexp bound) - (when (and (> (point) (point-min)) + (when (and (not (bobp)) (save-excursion (backward-char) (looking-at "/[/*]"))) (forward-char)) (setq parse (syntax-ppss)) @@ -1708,7 +1708,7 @@ This performs fontification according to `js--class-styles'." (progn (skip-chars-backward " \t") (or (bobp) (backward-char)) - (and (> (point) (point-min)) + (and (not (bobp)) (save-excursion (backward-char) (not (looking-at "[/*]/"))) (js--looking-at-operator-p) (and (progn (backward-char) diff --git a/lisp/progmodes/mantemp.el b/lisp/progmodes/mantemp.el index 01396c3..2622d10 100644 --- a/lisp/progmodes/mantemp.el +++ b/lisp/progmodes/mantemp.el @@ -138,7 +138,7 @@ the lines." (while (re-search-forward ".+$" nil t) (progn (insert ";") - (if (not (equal (point) (point-max))) + (if (not (eobp)) (forward-char)))) ;; We first insert 'template class' at each nonempty line and ;; subsequently remove 'class' for functions so we don't need to diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index ef372a3..22a5ece 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -1084,7 +1084,7 @@ With argument, repeat that many times; negative args move backward." (interactive "p") (or arg (setq arg 1)) (let ((first t)) - (while (and (> arg 0) (< (point) (point-max))) + (while (and (> arg 0) (not (eobp))) (let ((pos (point))) (while (progn (if (and first diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index bcac59a..7b0eb60 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -2135,7 +2135,7 @@ between them)." (progn (goto-char here) (when (looking-at "/\\*") (forward-char 2)) - (when (and (looking-at "\\*") (> (point) (point-min)) + (when (and (looking-at "\\*") (not (bobp)) (forward-char -1) (looking-at "/")) (forward-char 1)) (when (save-excursion (search-backward "/*" nil t)) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 4db4625..d4b19de 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -3576,7 +3576,7 @@ This command can often take a long time to run." (format "Initial value of sh-basic-offset: %s" sh-basic-offset))) - (while (< (point) (point-max)) + (while (not (eobp)) (setq linenum (1+ linenum)) ;; (if (zerop (% linenum 10)) (message "line %d" linenum) diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index c98c204..b56b0f4 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el @@ -1461,7 +1461,7 @@ styles." (goto-char (point-min)) (let (state result) - (while (< (point) (point-max)) + (while (not (eobp)) (setq result (tcl-hairy-scan-for-comment state (point-max) t)) (if (car result) (beginning-of-line 2) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index b422cf6..83b0239 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -5579,12 +5579,12 @@ the offset is simply returned." (defun vhdl-in-quote-p () "Check if point is in a quote ('x')." - (or (and (> (point) (point-min)) + (or (and (not (bobp)) (< (1+ (point)) (point-max)) (= (char-before (point)) ?\') (= (char-after (1+ (point))) ?\')) (and (> (1- (point)) (point-min)) - (< (point) (point-max)) + (not (eobp)) (= (char-before (1- (point))) ?\') (= (char-after (point)) ?\')))) @@ -12795,11 +12795,11 @@ it works within comments too." ;; count empty lines (goto-char (point-min)) (while (and (re-search-forward "^\\s-*$" nil t) - (not (eq (point) (point-max)))) + (not (eobp))) (if (match-string 1) (goto-char (match-end 1)) (setq no-empty-lines (1+ no-empty-lines)) - (unless (eq (point) (point-max)) + (unless (eobp) (forward-char)))) ;; count comment-only lines (goto-char (point-min)) diff --git a/lisp/term.el b/lisp/term.el index ce6125e..2f2f01c 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -3678,7 +3678,7 @@ all pending output has been dealt with.")) (setq down (term-handle-scroll down))) (unless (and (= term-current-row 0) (< down 0)) (term-adjust-current-row-cache down) - (when (or (/= (point) (point-max)) (< down 0)) + (when (or (not (eobp)) (< down 0)) (setq down (- down (term-vertical-motion down))))) (cond ((>= down 0) ;; Extend buffer with extra blank lines if needed. diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index 36d056a..ccb8505 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el @@ -3723,7 +3723,7 @@ original contents of that area in the buffer." (goto-char (point-max)) (beginning-of-line) (let ((last-line (artist-current-line))) - (if (= (point) (point-max)) + (if (eobp) ;; Last line is empty, don't paint on it, report previous line ;; as last line diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el index 3e77d37..c86478d 100644 --- a/lisp/textmodes/paragraphs.el +++ b/lisp/textmodes/paragraphs.el @@ -347,7 +347,7 @@ Returns the count of paragraphs left to move." (and use-hard-newlines (not (get-text-property (1- start) 'hard))))) (forward-char 1)) - (if (< (point) (point-max)) + (if (not (eobp)) (goto-char start)))) (constrain-to-field nil opoint t) ;; Return the number of steps that could not be done. @@ -445,7 +445,7 @@ the current paragraph with the one containing the mark." (if (<= (point) opoint) (progn (forward-char 1) - (if (< (point) (point-max)) + (if (not (eobp)) (end-of-paragraph-text)))))) (defun forward-sentence (&optional arg) diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 59f9de8..449bcbc 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -978,7 +978,7 @@ label prefix determines the wording of a reference." (t (message "%s" reftex-no-follow-message) nil)))) (when match (goto-char (match-beginning 0)) - (if (not (= (point) (point-max))) (recenter 1)) + (if (not (eobp)) (recenter 1)) (reftex-highlight 0 (match-beginning 0) (match-end 0) (current-buffer))) match)) diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index b05a5e5..0525186 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -2479,7 +2479,7 @@ file-write hook to always make it up-to-date automatically." ;; Look for the first line that starts at the first column. (forward-line 1) (while (and - (< (point) (point-max)) + (not (eobp)) (or (if (looking-at (rst-re 'hws-sta "\\S ")) ; indented content. (setq last-real (point))) @@ -3796,7 +3796,7 @@ next non-empty line if this is indented more than the current one." (let ((cur-ind (current-indentation))) (if (eq ind-pnt 'next) (when (and (zerop (forward-line 1)) - (< (point) (point-max))) + (not (eobp))) ;; Not at EOF. (setq rst-font-lock-find-unindented-line-begin (point)) @@ -3807,9 +3807,9 @@ next non-empty line if this is indented more than the current one." (match-end 0))) ;; Skip until non-empty line or EOF. (while (and (zerop (forward-line 1)) - (< (point) (point-max)) + (not (eobp)) (looking-at (rst-re 'lin-end)))) - (when (< (point) (point-max)) + (when (not (eobp)) ;; Not at EOF. (setq rst-font-lock-find-unindented-line-begin (point)) diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index 60aabc3..7660a35 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -2632,7 +2632,7 @@ DIRECTION is one of symbols; right, left, above or below." (goto-char beg) (table--insert-rectangle rectangle)) (delete-region beg end) - (insert (if (and (> (point) (point-min)) + (insert (if (and (not (bobp)) (save-excursion (forward-char -1) (looking-at (regexp-opt-charset diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el index 218b6db..5af5a81 100644 --- a/lisp/textmodes/texinfmt.el +++ b/lisp/textmodes/texinfmt.el @@ -635,7 +635,7 @@ Do not append @refill to paragraphs containing @w{TEXT} or @*." ;; the other processing removes information that tells Texinfo ;; whether the text should or should not be filled. - (while (< (point) (point-max)) + (while (not (eobp)) (let ((refill-blank-lines "^[ \t\n]*$") (case-fold-search nil)) ; Don't confuse @TeX and @tex.... (beginning-of-line) @@ -652,7 +652,7 @@ Do not append @refill to paragraphs containing @w{TEXT} or @*." "\\|" texinfo-part-of-para-regexp "\\)"))) - (< (point) (point-max))) + (not (eobp))) (forward-line 1)) ;; 2. Skip over @example and similar no-refill environments. (if (looking-at texinfo-no-refill-regexp) @@ -662,7 +662,7 @@ Do not append @refill to paragraphs containing @w{TEXT} or @*." ;; Else ;; 3. Do not refill a paragraph containing @w or @*, or ending ;; with @<newline> followed by a newline. - (if (or (>= (point) (point-max)) + (if (or (eobp) (re-search-forward "@w{\\|@\\*\\|@\n\n" (save-excursion (forward-paragraph) diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index d21b4cc..ad3200f 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el @@ -1197,7 +1197,7 @@ delimiter regions")) (unwind-protect (progn (set-buffer buffer) - (or (= (point) (point-max)) + (or (eobp) (setq opoint (point))) (goto-char (point-max)) (insert-before-markers string)) diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el index 020a1c3..15435f5 100644 --- a/lisp/vc/ediff-help.el +++ b/lisp/vc/ediff-help.el @@ -259,7 +259,7 @@ the value of this variable and the variables `ediff-help-message-*' in (str (make-string shift ?\ ))) (save-excursion (goto-char (point-min)) - (while (< (point) (point-max)) + (while (not (eobp)) (insert str) (beginning-of-line) (forward-line 1))))) diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index e6bd897..99260f4 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -590,7 +590,7 @@ Also saves its contents in the comment history and hides (save-excursion (let ((common (point-max))) (rfc822-goto-eoh) - (while (< (point) (point-max)) + (while (not (eobp)) (if (not (looking-at "^[ \t]*$")) (setq common (min common (current-indentation)))) (forward-line 1)) diff --git a/lisp/vc/pcvs-parse.el b/lisp/vc/pcvs-parse.el index 366e90d..9ea4066 100644 --- a/lisp/vc/pcvs-parse.el +++ b/lisp/vc/pcvs-parse.el @@ -125,7 +125,7 @@ Match RE and if successful, execute MATCHES." (when (looking-at re) (goto-char (match-end 0)) ;; Skip the newline (unless we already are at the end of the buffer). - (when (and (eolp) (< (point) (point-max))) (forward-char)) + (when (and (eolp) (not (eobp))) (forward-char)) ;; assign the matches (dolist (match matches t) (let ((val (cdr match))) diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index a0efe02..a965583 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -369,7 +369,7 @@ Display the buffer in some window, but don't select it." (with-current-buffer buffer (setq default-directory root) (goto-char (point-max)) - (unless (eq (point) (point-min)) + (unless (bobp) (insert "\f\n")) (setq new-window-start (point)) (insert "Running \"" command) diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index f580e94..8cf9104 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el @@ -2726,9 +2726,9 @@ def foo(a, b, c): # bad indented comment # more comments" (make-string 9999 ?\n)) (python-util-forward-comment 1) - (should (= (point) (point-max))) + (should (eobp)) (python-util-forward-comment -1) - (should (= (point) (point-min))))) + (should (bobp)))) (ert-deftest python-triple-quote-pairing () (require 'electric) -- Nico. ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 12:44 ` Nicolas Richard @ 2014-06-23 14:01 ` Andreas Röhler 0 siblings, 0 replies; 12+ messages in thread From: Andreas Röhler @ 2014-06-23 14:01 UTC (permalink / raw) To: Nicolas Richard; +Cc: Dmitry Antipov, emacs-devel On 23.06.2014 14:44, Nicolas Richard wrote: > Andreas Röhler <andreas.roehler@online.de> writes: >> Fixing the sources will prevent beginners from learning suboptimal >> habits. > > I grepped through the source tree to see the occurrences. Here's a patch > fixing those I found. I assumed (>= (point) (point-max)) meant (eobp). > > (I did this in emacs-24 branch, I dunno if it applies cleanly to trunk). > > iff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el > index 66ec0c3..db56d4f 100644 > --- a/lisp/allout-widgets.el > +++ b/lisp/allout-widgets.el > @@ -802,7 +802,7 @@ Optional RECURSING is for internal use, to limit recursion." > (let ((this-widget (or (widget-at (point)) > ;; XXX we really should be checking across > ;; edited span, not just point and point+1 > - (and (not (eq (point) (point-max))) > + (and (not (eobp)) > (widget-at (1+ (point)))))) > inserted-at) > (save-excursion > diff --git a/lisp/bookmark.el b/lisp/bookmark.el > index eab2ea7..c271588 100644 > --- a/lisp/bookmark.el > +++ b/lisp/bookmark.el > @@ -884,7 +884,7 @@ Lines beginning with `#' are ignored." > (if (not (derived-mode-p 'bookmark-edit-annotation-mode)) > (error "Not in bookmark-edit-annotation-mode")) > (goto-char (point-min)) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (if (looking-at "^#") > (bookmark-kill-line t) > (forward-line 1))) > @@ -1668,7 +1668,7 @@ mainly for debugging, and should not be necessary in normal use." > (forward-line bookmark-bmenu-inline-header-height)) > (setq bookmark-bmenu-hidden-bookmarks ()) > (let ((inhibit-read-only t)) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (let ((bmrk (bookmark-bmenu-bookmark))) > (push bmrk bookmark-bmenu-hidden-bookmarks) > (let ((start (line-end-position))) > @@ -1765,7 +1765,7 @@ if an annotation exists." > (progn > (save-excursion (insert ann) (unless (bolp) > (insert "\n"))) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (beginning-of-line) ; paranoia > (insert " ") > (forward-line) > diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el > index 30a06a2..5779e3c 100644 > --- a/lisp/calc/calc-prog.el > +++ b/lisp/calc/calc-prog.el > @@ -746,7 +746,7 @@ > (delete-char 1)) > (goto-char calc-edit-top) > (while (and (re-search-forward "^$" nil t) > - (not (= (point) (point-max)))) > + (not (eobp))) > (delete-char 1))) > > (defun calc-edit-macro-command () > diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el > index ab2ab3e..f32a671 100644 > --- a/lisp/calendar/todo-mode.el > +++ b/lisp/calendar/todo-mode.el > @@ -3705,7 +3705,7 @@ which is the value of the user option > (todo-categories-category-number 0) > ;; Find start of Category button if we just entered Todo Categories > ;; mode. > - (pt (if (eq (point) (point-max)) > + (pt (if (eobp) > (save-excursion > (forward-line -2) > (goto-char (next-single-char-property-change > diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el > index 43482ce..a11a689 100644 > --- a/lisp/cedet/ede/project-am.el > +++ b/lisp/cedet/ede/project-am.el > @@ -237,7 +237,7 @@ OT is the object target. DIR is the directory to start in." > (find-file (concat (oref obj path) "Makefile.am")) > (goto-char (point-min)) > (makefile-move-to-macro (project-am-macro obj)) > - (if (= (point-min) (point)) > + (if (bobp) > (re-search-forward (ede-target-name obj)))) > > (defmethod project-new-target ((proj project-am-makefile) > @@ -267,7 +267,7 @@ buffer being in order to provide a smart default target type." > (ede-with-projectfile ot > (goto-char (point-min)) > (makefile-next-dependency) > - (if (= (point) (point-min)) > + (if (bobp) > (goto-char (point-max)) > (beginning-of-line) > (insert "\n") > @@ -278,7 +278,7 @@ buffer being in order to provide a smart default target type." > ;; Add to the list of objects. > (goto-char (point-min)) > (makefile-move-to-macro (car (cdr (cdr ntype)))) > - (if (= (point) (point-min)) > + (if (bobp) > (progn > (if (re-search-forward makefile-macroassign-regex nil t) > (progn (forward-line -1) > diff --git a/lisp/cedet/ede/shell.el b/lisp/cedet/ede/shell.el > index 3d6eb19..8f5c457 100644 > --- a/lisp/cedet/ede/shell.el > +++ b/lisp/cedet/ede/shell.el > @@ -44,7 +44,7 @@ COMMAND is a text string representing the thing to be run." > (switch-to-buffer-other-window buff t)) > ;; Force a shell into the buffer. > (shell buff) > - (while (eq (point-min) (point)) > + (while (bobp) > (accept-process-output)) > ;; Change the default directory > (if (not (string= (file-name-as-directory (expand-file-name default-directory)) > diff --git a/lisp/completion.el b/lisp/completion.el > index 7e5c214..9eb7a5a 100644 > --- a/lisp/completion.el > +++ b/lisp/completion.el > @@ -2107,7 +2107,7 @@ If file is not specified, then use `save-completions-file-name'." > (search-failed > (message "End of file while reading completions.")) > (end-of-file > - (if (= (point) (point-max)) > + (if (eobp) > (if (not no-message-p) > (message "Loading completions from file %s . . . Done." > filename)) > diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el > index 2c691cf..8e9f81d 100644 > --- a/lisp/dirtrack.el > +++ b/lisp/dirtrack.el > @@ -231,7 +231,7 @@ the prompt specified by `dirtrack-list', and calls > `shell-process-cd' if the directory seems to have changed away > from `default-directory'." > (when (and dirtrack-mode > - (not (eq (point) (point-min)))) ; there must be output > + (not (bobp))) ; there must be output > (save-excursion ; What's this for? -- cyd > (if (not (string-match (nth 0 dirtrack-list) input)) > ;; No match > diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el > index 42b8a91..c2302cd 100644 > --- a/lisp/elec-pair.el > +++ b/lisp/elec-pair.el > @@ -503,7 +503,8 @@ happened." > (funcall electric-pair-open-newline-between-pairs) > electric-pair-open-newline-between-pairs) > (eq last-command-event ?\n) > - (< (1+ (point-min)) (point) (point-max)) > + (not (eobp)) > + (< (1+ (point-min)) (point)) > (eq (save-excursion > (skip-chars-backward "\t\s") > (char-before (1- (point)))) > diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el > index d516bd4..0051a35 100644 > --- a/lisp/emulation/cua-rect.el > +++ b/lisp/emulation/cua-rect.el > @@ -578,7 +578,7 @@ If command is repeated at same position, delete the rectangle." > (setq start (line-beginning-position)) > (narrow-to-region start end) > (goto-char (point-min)) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (move-to-column r pad) > (and (not pad) (not visible) (> (current-column) r) > (backward-char 1)) > @@ -1239,7 +1239,7 @@ The numbers are formatted according to the FORMAT string." > > (defun cua--left-fill-rectangle (_start _end) > (beginning-of-line) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (delete-horizontal-space nil) > (forward-line 1)) > (fill-region-as-paragraph (point-min) (point-max) 'left nil) > diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el > index d93e9e0..fbdab79 100644 > --- a/lisp/erc/erc.el > +++ b/lisp/erc/erc.el > @@ -3941,8 +3941,8 @@ This places `point' just after the prompt, or at the beginning of the line." > "Kill current input line using `erc-bol' followed by `kill-line'." > (interactive) > (when (and (erc-bol) > - (/= (point) (point-max))) ;; Prevent a (ding) and an error when > - ;; there's nothing to kill > + (not (eobp))) ;; Prevent a (ding) and an error when > + ;; there's nothing to kill > (if (boundp 'erc-input-ring-index) > (setq erc-input-ring-index nil)) > (kill-line))) > diff --git a/lisp/ffap.el b/lisp/ffap.el > index 119e0ad..0e121e6 100644 > --- a/lisp/ffap.el > +++ b/lisp/ffap.el > @@ -1763,7 +1763,7 @@ Only intended for interactive use." > (pop-to-buffer gnus-article-buffer) > (widen) > ;; Skip headers for ffap-gnus-next (which will wrap around) > - (if (eq (point) (point-min)) (search-forward "\n\n" nil t)) > + (if (bobp) (search-forward "\n\n" nil t)) > (unwind-protect > (eval form) > (pop-to-buffer sb)))) > diff --git a/lisp/forms.el b/lisp/forms.el > index b1eb388..9abbd23 100644 > --- a/lisp/forms.el > +++ b/lisp/forms.el > @@ -1867,7 +1867,7 @@ after the current record." > (beginning-of-line) > (setq here (point)) > (if (or (re-search-backward regexp nil t) > - (and (< (point) (point-max)) > + (and (not (eobp)) > (progn > (goto-char (point-max)) > (re-search-backward regexp here t)))) > diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el > index 67525ee..e428d8c 100644 > --- a/lisp/gnus/gnus-agent.el > +++ b/lisp/gnus/gnus-agent.el > @@ -1710,7 +1710,7 @@ and that there are no duplicates." > (widen) > (goto-char (point-min)) > > - (while (< (point) (point-max)) > + (while (not (eobp)) > (let ((p (point)) > (cur (condition-case nil > (read (current-buffer)) > @@ -3913,7 +3913,7 @@ If REREAD is not nil, downloaded articles are marked as unread." > (while load > (setq load nil) > (goto-char (point-min)) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (cond ((and (looking-at "[0-9]+\t") > (<= (- (match-end 0) (match-beginning 0)) 9)) > (push (read (current-buffer)) nov-arts) > diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el > index 29d70aa..376ff74 100644 > --- a/lisp/gnus/gnus-art.el > +++ b/lisp/gnus/gnus-art.el > @@ -6366,7 +6366,7 @@ Argument LINES specifies lines to be scrolled up." > (save-excursion > (end-of-line) > (and (pos-visible-in-window-p) ;Not continuation line. > - (>= (point) (point-max))))) > + (eobp)))) > ;; Nothing in this page. > (if (or (not gnus-page-broken) > (save-excursion > diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el > index 91d5c76..1459b21 100644 > --- a/lisp/gnus/gnus-bookmark.el > +++ b/lisp/gnus/gnus-bookmark.el > @@ -529,7 +529,7 @@ Optional argument SHOW means show them unconditionally." > (forward-line 2) > (setq gnus-bookmark-bmenu-hidden-bookmarks ()) > (let ((inhibit-read-only t)) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (let ((bmrk (gnus-bookmark-bmenu-bookmark))) > (setq gnus-bookmark-bmenu-hidden-bookmarks > (cons bmrk gnus-bookmark-bmenu-hidden-bookmarks)) > diff --git a/lisp/help-at-pt.el b/lisp/help-at-pt.el > index 7f424f7..1f59165 100644 > --- a/lisp/help-at-pt.el > +++ b/lisp/help-at-pt.el > @@ -269,7 +269,7 @@ do not run HOOK. If there are not enough regions to move over, > an error results and the number of available regions is mentioned > in the error message. Point is not moved and HOOK is not run." > (cond ((> arg 0) > - (if (= (point) (point-max)) > + (if (eobp) > (error "No further `%s' regions" prop)) > (let ((pos (point))) > (dotimes (x arg) > diff --git a/lisp/help-fns.el b/lisp/help-fns.el > index 5b0739e..bc6ffc2 100644 > --- a/lisp/help-fns.el > +++ b/lisp/help-fns.el > @@ -947,10 +947,10 @@ BUFFER should be a buffer or a buffer name." > (setq elt (match-string 0 elt)) > (if (>= (length elt) 17) > (setq elt (concat (substring elt 0 14) "..."))) > - (if (< (point) (point-max)) > + (if (not (eobp)) > (move-to-column (* 20 (/ n lines)) t)) > (insert (+ i ?\s) ?: elt) > - (if (< (point) (point-max)) > + (if (not (eobp)) > (forward-line 1) > (insert "\n")) > (setq n (1+ n)) > diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el > index a3c5b06..ae5df6c 100644 > --- a/lisp/ibuf-ext.el > +++ b/lisp/ibuf-ext.el > @@ -312,7 +312,7 @@ the mode if ARG is omitted or nil." > (point) 'ibuffer-filter-group-name > nil (point-min))) > (ibuffer-backward-filter-group (1- count))) > - (when (= (point) (point-min)) > + (when (bobp) > (goto-char (point-max)) > (ibuffer-backward-filter-group 1)) > (ibuffer-forward-line 0)) > diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el > index b994949..8e30669 100644 > --- a/lisp/mail/emacsbug.el > +++ b/lisp/mail/emacsbug.el > @@ -128,7 +128,7 @@ This requires either the OS X \"open\" command, or the freedesktop > (match-string-no-properties 1)))) > (body (progn > (forward-line 2) > - (if (> (point-max) (point)) > + (if (not (eobp)) > (buffer-substring-no-properties (point) (point-max)))))) > (if (and to subject body) > (if (report-emacs-bug-can-use-osx-open) > diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el > index 7f27599..b310f10 100644 > --- a/lisp/mail/feedmail.el > +++ b/lisp/mail/feedmail.el > @@ -3135,7 +3135,7 @@ been weeded out." > (setq this-line (match-beginning 0)) > (forward-line 1) > ;; get any continuation lines > - (while (and (looking-at "^[ \t]+") (< (point) (point-max))) > + (while (and (looking-at "^[ \t]+") (not (eobp))) > (forward-line 1)) > (setq this-line-end (point-marker)) > ;; only keep if we don't have it already > diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el > index 52f4845..772bb7f 100644 > --- a/lisp/mail/rmail.el > +++ b/lisp/mail/rmail.el > @@ -2989,7 +2989,7 @@ using the coding system CODING." > (coding-system-base coding))) > ;; Rewrite the coding-system header. > (goto-char x-coding-header) > - (if (> (point) (point-min)) > + (if (not (bobp)) > (delete-region (line-beginning-position) (point)) > (forward-line) > (insert "\n") > diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el > index 2c625f6..8fc8393 100644 > --- a/lisp/mail/rmailmm.el > +++ b/lisp/mail/rmailmm.el > @@ -871,7 +871,7 @@ The other arguments are the same as `rmail-mime-multipart-handler'." > (and (not last) > (save-excursion > (skip-chars-forward "\n") > - (> (point-max) (point))) > + (not (eobp))) > (setq truncated t end (point-max)))) > ;; If this is the last boundary according to RFC 2046, hide the > ;; epilogue, else hide the boundary only. Use a marker for > diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el > index 76764ce..f62eb15 100644 > --- a/lisp/mail/sendmail.el > +++ b/lisp/mail/sendmail.el > @@ -941,7 +941,7 @@ the user from the mailer." > (unless (memq mail-send-nonascii '(t mime)) > (goto-char (point-min)) > (skip-chars-forward "\0-\177") > - (or (= (point) (point-max)) > + (or (eobp) > (if (eq mail-send-nonascii 'query) > (or (y-or-n-p "Message contains non-ASCII characters; send anyway? ") > (error "Aborted")) > @@ -1210,7 +1210,7 @@ external program defined by `sendmail-program'." > (and (eq mail-send-nonascii 'mime) > (not (re-search-forward "^MIME-version:" delimline t)) > (progn (skip-chars-forward "\0-\177") > - (/= (point) (point-max))) > + (not (eobp))) > selected-coding > (setq charset > (coding-system-get selected-coding :mime-charset)) > diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el > index 54f4664..9f1bd59 100644 > --- a/lisp/mail/smtpmail.el > +++ b/lisp/mail/smtpmail.el > @@ -304,7 +304,7 @@ The list is in preference order.") > (and (eq mail-send-nonascii 'mime) > (not (re-search-forward "^MIME-version:" delimline t)) > (progn (skip-chars-forward "\0-\177") > - (/= (point) (point-max))) > + (not (eobp))) > smtpmail-code-conv-from > (setq charset > (coding-system-get smtpmail-code-conv-from > diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el > index a34a840..288c322 100644 > --- a/lisp/mh-e/mh-alias.el > +++ b/lisp/mh-e/mh-alias.el > @@ -143,7 +143,7 @@ Exclude all aliases already in `mh-alias-alist' from \"ali\"" > (insert mh-alias-local-users "\n") > (shell-command-on-region (point-min) (point-max) mh-alias-local-users t t) > (goto-char (point-min)))) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (cond > ((looking-at "\\([^:]*\\):[^:]*:\\([^:]*\\):[^:]*:\\([^:]*\\):") > (when (> (string-to-number (match-string 2)) 200) > @@ -185,7 +185,7 @@ been loaded." > (mh-exec-cmd-quiet t "ali" "-nolist" "-nouser") > (setq mh-alias-alist nil) > (setq mh-alias-blind-alist nil) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (cond > ((looking-at "^[ \t]")) ;Continuation line > ((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias > diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el > index ef8fa7e..5451e79 100644 > --- a/lisp/mh-e/mh-letter.el > +++ b/lisp/mh-e/mh-letter.el > @@ -976,7 +976,7 @@ Otherwise, simply insert MH-INS-STRING before each line." > (run-hooks 'mh-yank-hooks)) > (t > (or (bolp) (forward-line 1)) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (insert mh-ins-string) > (forward-line 1)) > (goto-char (point-min))))) ;leave point like sc-cite-original > diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el > index afe2863..07bd8d9 100644 > --- a/lisp/mh-e/mh-show.el > +++ b/lisp/mh-e/mh-show.el > @@ -292,7 +292,7 @@ ignored if VISIBLE-HEADERS is non-nil." > (narrow-to-region start (point)) > (goto-char (point-min)) > (if visible-headers > - (while (< (point) (point-max)) > + (while (not (eobp)) > (cond ((looking-at visible-headers) > (forward-line 1) > (while (looking-at "[ \t]") (forward-line 1))) > diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el > index f67bacc..c65085f 100644 > --- a/lisp/net/newst-backend.el > +++ b/lisp/net/newst-backend.el > @@ -1799,7 +1799,7 @@ Renders the HTML code in the region POS1 to POS2 using htmlr." > (when (fboundp 'htmlr-reset) (htmlr-reset)) > ;; something omitted here... > (when (fboundp 'htmlr-step) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (htmlr-step))) > ;; end original htmlr-render > (newsticker--remove-whitespace (buffer-string)))))) > diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el > index a05a2f6..4f63999 100644 > --- a/lisp/net/newst-plainview.el > +++ b/lisp/net/newst-plainview.el > @@ -5,7 +5,7 @@ > ;; Author: Ulf Jasper <ulf.jasper@web.de> > ;; Filename: newst-plainview.el > ;; URL: http://www.nongnu.org/newsticker > -;; Time-stamp: "Mon 11-Feb-2013 20:27:11 gm on skiddaw" > +;; Time-stamp: "2014-06-23 12:20:22 youngfrog" > ;; Package: newsticker > > ;; ====================================================================== > @@ -1087,7 +1087,7 @@ If VALUE is nil, auto-narrowing is turned off, otherwise it is turned on." > "Return t if position is before last feed, nil otherwise." > (save-excursion > (catch 'result > - (while (< (point) (point-max)) > + (while (not (eobp)) > (unless (newsticker--buffer-goto '(item)) > (throw 'result nil)) > (unless (newsticker--lists-intersect-p > @@ -1099,7 +1099,7 @@ If VALUE is nil, auto-narrowing is turned off, otherwise it is turned on." > "Return t if position is behind first item, nil otherwise." > (save-excursion > (catch 'result > - (while (> (point) (point-min)) > + (while (not (bobp)) > (unless (newsticker--buffer-goto '(item) nil t) > (throw 'result nil)) > (unless (newsticker--lists-intersect-p > diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el > index 2591fc8..a1a68ab 100644 > --- a/lisp/net/rcirc.el > +++ b/lisp/net/rcirc.el > @@ -1197,7 +1197,7 @@ Create the buffer if it doesn't exist." > ;; copy the line down to the input area > (progn > (forward-line 0) > - (let ((start (if (eq (point) (point-min)) > + (let ((start (if (bobp) > (point) > (if (get-text-property (1- (point)) 'hard) > (point) > diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el > index b3ce7aa..ef463d7 100644 > --- a/lisp/nxml/nxml-mode.el > +++ b/lisp/nxml/nxml-mode.el > @@ -1832,7 +1832,7 @@ single name. A character reference contains a character number." > (nxml-backward-up-element (- arg)) > (condition-case err > (while (and (> arg 0) > - (< (point) (point-max))) > + (not (eobp))) > (let ((token-end (nxml-token-after))) > (goto-char (cond ((or (memq xmltok-type '(end-tag > partial-end-tag)) > @@ -1860,7 +1860,7 @@ single name. A character reference contains a character number." > (nxml-up-element (- arg)) > (condition-case err > (while (and (> arg 0) > - (< (point-min) (point))) > + (not (bobp))) > (let ((token-end (nxml-token-before))) > (goto-char (cond ((or (memq xmltok-type '(start-tag > partial-start-tag)) > @@ -1938,7 +1938,7 @@ Negative ARG means move backward." > (nxml-backward-element (- arg)) > (condition-case err > (while (and (> arg 0) > - (< (point) (point-max))) > + (not (eobp))) > (goto-char > (or (nxml-scan-element-forward (nxml-token-before)) > (error "No more elements"))) > @@ -1957,7 +1957,7 @@ Negative ARG means move forward." > (nxml-forward-element (- arg)) > (condition-case err > (while (and (> arg 0) > - (< (point-min) (point))) > + (not (bobp))) > (goto-char > (or (and (nxml-scan-element-backward (progn > (nxml-token-after) > @@ -2014,7 +2014,7 @@ Return nil at end of buffer, t otherwise." > (offset (- (point) xmltok-start)) > pos had-data) > (goto-char token-end) > - (while (and (< (point) (point-max)) > + (while (and (not (eobp)) > (not (setq pos > (nxml-paragraph-end-pos had-data offset)))) > (when (nxml-token-contains-data-p offset) > @@ -2034,7 +2034,7 @@ Return nil at start of buffer, t otherwise." > (unless (setq pos (nxml-paragraph-start-pos nil offset)) > (setq had-data (nxml-token-contains-data-p nil offset)) > (goto-char xmltok-start) > - (while (and (not pos) (< (point-min) (point))) > + (while (and (not pos) (not (bobp))) > (cond ((search-backward "<" nxml-prolog-end t) > (nxml-move-outside-backwards) > (save-excursion > diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el > index e4b8fc7..06bf3fa 100644 > --- a/lisp/nxml/nxml-outln.el > +++ b/lisp/nxml/nxml-outln.el > @@ -302,7 +302,7 @@ customize which elements are recognized as sections and headings." > (nxml-outline-adjust-point)) > > (defun nxml-outline-pre-adjust-point () > - (cond ((and (< (point-min) (point)) > + (cond ((and (not (bobp)) > (get-char-property (1- (point)) 'invisible) > (not (get-char-property (point) 'invisible)) > (let ((str (or (get-char-property (point) 'before-string) > @@ -318,12 +318,12 @@ customize which elements are recognized as sections and headings." > ;; region. > (goto-char (previous-single-char-property-change (1- (point)) > 'invisible))) > - ((and (< (point) (point-max)) > + ((and (not (eobp)) > (get-char-property (point) 'display) > (get-char-property (1+ (point)) 'invisible)) > (goto-char (next-single-char-property-change (1+ (point)) > 'invisible))) > - ((and (< (point) (point-max)) > + ((and (not (eobp)) > (get-char-property (point) 'invisible)) > (goto-char (next-single-char-property-change (point) > 'invisible))))) > @@ -331,7 +331,7 @@ customize which elements are recognized as sections and headings." > (defun nxml-outline-adjust-point () > "Adjust point after showing or hiding elements." > (when (and (get-char-property (point) 'invisible) > - (< (point-min) (point)) > + (not (bobp)) > (get-char-property (1- (point)) 'invisible)) > (goto-char (previous-single-char-property-change (point) > 'invisible > diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el > index 7d360cb..95bb4b2 100644 > --- a/lisp/nxml/nxml-rap.el > +++ b/lisp/nxml/nxml-rap.el > @@ -213,7 +213,7 @@ type `prolog'." > (defun nxml-token-before () > "Return the position after the token containing the char before point. > Sets variables like `nxml-token-after'." > - (if (/= (point-min) (point)) > + (if (not (bobp)) > (save-excursion > (goto-char (1- (point))) > (nxml-token-after)) > diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el > index 0dfdb42..30d06e2 100644 > --- a/lisp/nxml/rng-cmpct.el > +++ b/lisp/nxml/rng-cmpct.el > @@ -131,7 +131,7 @@ Return a pattern." > (setq rng-c-current-token (match-string 0)) > (goto-char (match-end 0)) > (forward-comment (point-max))) > - ((= (point) (point-max)) > + ((eobp) > (setq rng-c-current-token "")) > (t (rng-c-error "Invalid token")))) > > diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el > index baf63e9..e8944e8 100644 > --- a/lisp/nxml/rng-valid.el > +++ b/lisp/nxml/rng-valid.el > @@ -581,7 +581,7 @@ Return t if there is work to do, nil otherwise." > ;; if we have just blank chars skip to the end > (when have-remaining-chars > (skip-chars-forward " \t\r\n") > - (when (= (point) (point-max)) > + (when (eobp) > (rng-clear-overlays pos (point)) > (rng-clear-cached-state pos (point)) > (setq have-remaining-chars nil) > diff --git a/lisp/obsolete/terminal.el b/lisp/obsolete/terminal.el > index 420ac78..d0d8f1f 100644 > --- a/lisp/obsolete/terminal.el > +++ b/lisp/obsolete/terminal.el > @@ -750,7 +750,7 @@ move to start of new line, clear to end of line." > (n (min (- (te-get-char) ?\s) line)) > (i 0)) > (delete-region (- (point-max) (* n (1+ te-width))) (point-max)) > - (if (eq (point) (point-max)) (insert ?\n)) > + (if (eobp) (insert ?\n)) > (while (< i n) > (setq i (1+ i)) > (insert-char ?\s te-width) > diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el > index 152af86..9a6f23f 100644 > --- a/lisp/org/ob-ref.el > +++ b/lisp/org/ob-ref.el > @@ -189,7 +189,7 @@ the variable." > (t (while (not (setq type (org-babel-ref-at-ref-p))) > (forward-line 1) > (beginning-of-line) > - (if (or (= (point) (point-min)) (= (point) (point-max))) > + (if (or (bobp) (eobp)) > (error "Reference not found"))))) > (let ((params (append args '((:results . "silent"))))) > (setq result > diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el > index b6557108..f8f16e9 100644 > --- a/lisp/org/org-bibtex.el > +++ b/lisp/org/org-bibtex.el > @@ -638,7 +638,7 @@ Return the number of saved entries." > (with-current-buffer buffer > (save-excursion > (goto-char (point-max)) > - (while (not (= (point) (point-min))) > + (while (not (bobp)) > (backward-char 1) > (org-bibtex-read) > (bibtex-beginning-of-entry)))) > diff --git a/lisp/org/org.el b/lisp/org/org.el > index 2a451ed..a506e63 100644 > --- a/lisp/org/org.el > +++ b/lisp/org/org.el > @@ -17318,7 +17318,7 @@ With prefix ARG, change that many days." > (ans (or (looking-at tsr) > (save-excursion > (skip-chars-backward "^[<\n\r\t") > - (if (> (point) (point-min)) (backward-char 1)) > + (if (not (bobp)) (backward-char 1)) > (and (looking-at tsr) > (> (- (match-end 0) pos) -1)))))) > (and ans > @@ -20132,7 +20132,7 @@ Optional argument N tells to change by that many units." > (save-restriction > (narrow-to-region beg end) > (setq s (goto-char (point-min))) > - (while (not (= (point) (point-max))) > + (while (not (eobp)) > (goto-char (org-find-invisible)) > (push (buffer-substring s (point)) snippets) > (setq s (goto-char (org-find-visible)))))) > diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el > index 6208cdb..3fed265 100644 > --- a/lisp/org/ox-ascii.el > +++ b/lisp/org/ox-ascii.el > @@ -445,7 +445,7 @@ HOW determines the type of justification: it can be `left', > ;; Disable `adaptive-fill-mode' so it doesn't prevent > ;; filling lines matching `adaptive-fill-regexp'. > (adaptive-fill-mode nil)) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (justify-current-line how) > (forward-line))) > (buffer-string))) > diff --git a/lisp/play/dissociate.el b/lisp/play/dissociate.el > index 0d980d6..812380e 100644 > --- a/lisp/play/dissociate.el > +++ b/lisp/play/dissociate.el > @@ -52,7 +52,7 @@ Default is 2." > (save-excursion > (goto-char last-query-point) > (vertical-motion (- (window-height) 4)) > - (or (= (point) (point-max)) > + (or (eobp) > (and (progn (goto-char (point-max)) > (y-or-n-p "Continue dissociation? ")) > (progn > diff --git a/lisp/play/zone.el b/lisp/play/zone.el > index 17b6993..d8a3604 100644 > --- a/lisp/play/zone.el > +++ b/lisp/play/zone.el > @@ -577,7 +577,7 @@ If the element is a function or a list of a function and a number, > (goto-char (point-min)) > (let ((ok t) > lines) > - (while (and ok (< (point) (point-max))) > + (while (and ok (not (eobp))) > (let ((p (point))) > (setq ok (zerop (forward-line 1)) > lines (cons (buffer-substring p (point)) lines)))) > diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el > index 68b6c87..c0ad1bc 100644 > --- a/lisp/progmodes/ada-mode.el > +++ b/lisp/progmodes/ada-mode.el > @@ -1597,7 +1597,7 @@ If FORCE-IDENTIFIER is non-nil then also adjust keyword as identifier." > ) > (if (save-excursion > (forward-word -1) > - (or (= (point) (point-min)) > + (or (bobp) > (backward-char 1)) > (= (following-char) ?')) > (funcall ada-case-attribute -1) > diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el > index 7cad848..fec37c8 100644 > --- a/lisp/progmodes/ada-xref.el > +++ b/lisp/progmodes/ada-xref.el > @@ -1656,7 +1656,7 @@ The returned list represents the entity, and can be manipulated through the > macros `ada-name-of', `ada-line-of', `ada-column-of', `ada-file-of',..." > > ;; If at end of buffer (e.g the buffer is empty), error > - (if (>= (point) (point-max)) > + (if (eobp) > (error "No identifier on point")) > > ;; goto first character of the identifier/operator (skip backward < and > > diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el > index 44d69d7..b435e4c 100644 > --- a/lisp/progmodes/cc-awk.el > +++ b/lisp/progmodes/cc-awk.el > @@ -661,7 +661,7 @@ > ;; This function might do hidden buffer changes. > (if pos (goto-char pos)) > (forward-line 0) > - (while (and (> (point) (point-min)) > + (while (and (not (bobp)) > (eq (char-before (1- (point))) ?\\)) > (forward-line -1)) > (point)) > @@ -679,10 +679,10 @@ > (save-excursion > (if pos (goto-char pos)) > (end-of-line) > - (while (and (< (point) (point-max)) > + (while (and (not (eobp)) > (eq (char-before) ?\\)) > (end-of-line 2)) > - (if (< (point) (point-max)) > + (if (not (eobp)) > (1+ (point)) > (point)))) > > @@ -1039,7 +1039,7 @@ comment at the start of cc-engine.el for more info." > (let ((found t)) ; Has the most recent regexp search found b-of-defun? > (if (>= arg 0) > ;; Go back one defun each time round the following loop. (For +ve arg) > - (while (and found (> arg 0) (not (eq (point) (point-min)))) > + (while (and found (> arg 0) (not (bobp))) > ;; Go back one "candidate" each time round the next loop until one > ;; is genuinely a beginning-of-defun. > (while (and (setq found (search-backward-regexp > @@ -1047,8 +1047,8 @@ comment at the start of cc-engine.el for more info." > (not (memq (c-awk-get-NL-prop-prev-line) '(?\$ ?\} ?\#))))) > (setq arg (1- arg))) > ;; The same for a -ve arg. > - (if (not (eq (point) (point-max))) (forward-char 1)) > - (while (and found (< arg 0) (not (eq (point) (point-max)))) ; The same for -ve arg. > + (if (not (eobp)) (forward-char 1)) > + (while (and found (< arg 0) (not (eobp))) ; The same for -ve arg. > (while (and (setq found (search-forward-regexp > "^[^#} \t\n\r]" (point-max) 'stop-at-limit)) > (not (memq (c-awk-get-NL-prop-prev-line) '(?\$ ?\} ?\#))))) > diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el > index 4f205d6..f2a7a2c 100644 > --- a/lisp/progmodes/cc-cmds.el > +++ b/lisp/progmodes/cc-cmds.el > @@ -2186,7 +2186,7 @@ function does not require the declaration to contain a brace block." > > ;; Take special action if we're up against the end of a comment (of > ;; either sort): Leave point just after the last non-ws text. > - (if (eq (point) (point-max)) > + (if (eobp) > (while (or (/= (skip-chars-backward " \t\n") 0) > (and (re-search-backward prefix-at-bol-here nil t) > (/= (match-beginning 1) (match-end 1)))))))) > diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el > index 1ce0767..bdb40ab 100644 > --- a/lisp/progmodes/cc-mode.el > +++ b/lisp/progmodes/cc-mode.el > @@ -1016,7 +1016,7 @@ Note that the style variables are always made local to the buffer." > ;; Find a limit for the search for a `c-type' property > (while > (and (/= (skip-chars-backward "^;{}") 0) > - (> (point) (point-min)) > + (not (bobp)) > (memq (c-get-char-property (1- (point)) 'face) > '(font-lock-comment-face font-lock-string-face)))) > (setq lim (max (point-min) (1- (point)))) > diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el > index c4f2b9f..1ad3744 100644 > --- a/lisp/progmodes/cperl-mode.el > +++ b/lisp/progmodes/cperl-mode.el > @@ -5401,7 +5401,7 @@ indentation and initial hashes. Behaves usually outside of comment." > ;; Remove existing hashes > (goto-char (point-min)) > (save-excursion > - (while (progn (forward-line 1) (< (point) (point-max))) > + (while (progn (forward-line 1) (not (eobp))) > (skip-chars-forward " \t") > (if (looking-at "#+") > (progn > diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el > index cf324b4..4a11bef 100644 > --- a/lisp/progmodes/fortran.el > +++ b/lisp/progmodes/fortran.el > @@ -1675,7 +1675,7 @@ Return point or nil." > (setq first-statement (fortran-previous-statement)) > (if first-statement > (setq icol fortran-minimum-statement-indent) > - (if (= (point) (point-min)) > + (if (bobp) > (setq icol fortran-minimum-statement-indent) > (setq icol (fortran-current-line-indentation))) > (skip-chars-forward " \t0-9") > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > index a8f0d55..872ca1a 100644 > --- a/lisp/progmodes/js.el > +++ b/lisp/progmodes/js.el > @@ -735,7 +735,7 @@ macro as normal text." > (point))))) > (while (> count 0) > (re-search-backward regexp bound) > - (when (and (> (point) (point-min)) > + (when (and (not (bobp)) > (save-excursion (backward-char) (looking-at "/[/*]"))) > (forward-char)) > (setq parse (syntax-ppss)) > @@ -1708,7 +1708,7 @@ This performs fontification according to `js--class-styles'." > (progn > (skip-chars-backward " \t") > (or (bobp) (backward-char)) > - (and (> (point) (point-min)) > + (and (not (bobp)) > (save-excursion (backward-char) (not (looking-at "[/*]/"))) > (js--looking-at-operator-p) > (and (progn (backward-char) > diff --git a/lisp/progmodes/mantemp.el b/lisp/progmodes/mantemp.el > index 01396c3..2622d10 100644 > --- a/lisp/progmodes/mantemp.el > +++ b/lisp/progmodes/mantemp.el > @@ -138,7 +138,7 @@ the lines." > (while (re-search-forward ".+$" nil t) > (progn > (insert ";") > - (if (not (equal (point) (point-max))) > + (if (not (eobp)) > (forward-char)))) > ;; We first insert 'template class' at each nonempty line and > ;; subsequently remove 'class' for functions so we don't need to > diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el > index ef372a3..22a5ece 100644 > --- a/lisp/progmodes/perl-mode.el > +++ b/lisp/progmodes/perl-mode.el > @@ -1084,7 +1084,7 @@ With argument, repeat that many times; negative args move backward." > (interactive "p") > (or arg (setq arg 1)) > (let ((first t)) > - (while (and (> arg 0) (< (point) (point-max))) > + (while (and (> arg 0) (not (eobp))) > (let ((pos (point))) > (while (progn > (if (and first > diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el > index bcac59a..7b0eb60 100644 > --- a/lisp/progmodes/prolog.el > +++ b/lisp/progmodes/prolog.el > @@ -2135,7 +2135,7 @@ between them)." > (progn > (goto-char here) > (when (looking-at "/\\*") (forward-char 2)) > - (when (and (looking-at "\\*") (> (point) (point-min)) > + (when (and (looking-at "\\*") (not (bobp)) > (forward-char -1) (looking-at "/")) > (forward-char 1)) > (when (save-excursion (search-backward "/*" nil t)) > diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el > index 4db4625..d4b19de 100644 > --- a/lisp/progmodes/sh-script.el > +++ b/lisp/progmodes/sh-script.el > @@ -3576,7 +3576,7 @@ This command can often take a long time to run." > (format "Initial value of sh-basic-offset: %s" > sh-basic-offset))) > > - (while (< (point) (point-max)) > + (while (not (eobp)) > (setq linenum (1+ linenum)) > ;; (if (zerop (% linenum 10)) > (message "line %d" linenum) > diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el > index c98c204..b56b0f4 100644 > --- a/lisp/progmodes/tcl.el > +++ b/lisp/progmodes/tcl.el > @@ -1461,7 +1461,7 @@ styles." > (goto-char (point-min)) > (let (state > result) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (setq result (tcl-hairy-scan-for-comment state (point-max) t)) > (if (car result) > (beginning-of-line 2) > diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el > index b422cf6..83b0239 100644 > --- a/lisp/progmodes/vhdl-mode.el > +++ b/lisp/progmodes/vhdl-mode.el > @@ -5579,12 +5579,12 @@ the offset is simply returned." > > (defun vhdl-in-quote-p () > "Check if point is in a quote ('x')." > - (or (and (> (point) (point-min)) > + (or (and (not (bobp)) > (< (1+ (point)) (point-max)) > (= (char-before (point)) ?\') > (= (char-after (1+ (point))) ?\')) > (and (> (1- (point)) (point-min)) > - (< (point) (point-max)) > + (not (eobp)) > (= (char-before (1- (point))) ?\') > (= (char-after (point)) ?\')))) > > @@ -12795,11 +12795,11 @@ it works within comments too." > ;; count empty lines > (goto-char (point-min)) > (while (and (re-search-forward "^\\s-*$" nil t) > - (not (eq (point) (point-max)))) > + (not (eobp))) > (if (match-string 1) > (goto-char (match-end 1)) > (setq no-empty-lines (1+ no-empty-lines)) > - (unless (eq (point) (point-max)) > + (unless (eobp) > (forward-char)))) > ;; count comment-only lines > (goto-char (point-min)) > diff --git a/lisp/term.el b/lisp/term.el > index ce6125e..2f2f01c 100644 > --- a/lisp/term.el > +++ b/lisp/term.el > @@ -3678,7 +3678,7 @@ all pending output has been dealt with.")) > (setq down (term-handle-scroll down))) > (unless (and (= term-current-row 0) (< down 0)) > (term-adjust-current-row-cache down) > - (when (or (/= (point) (point-max)) (< down 0)) > + (when (or (not (eobp)) (< down 0)) > (setq down (- down (term-vertical-motion down))))) > (cond ((>= down 0) > ;; Extend buffer with extra blank lines if needed. > diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el > index 36d056a..ccb8505 100644 > --- a/lisp/textmodes/artist.el > +++ b/lisp/textmodes/artist.el > @@ -3723,7 +3723,7 @@ original contents of that area in the buffer." > (goto-char (point-max)) > (beginning-of-line) > (let ((last-line (artist-current-line))) > - (if (= (point) (point-max)) > + (if (eobp) > > ;; Last line is empty, don't paint on it, report previous line > ;; as last line > diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el > index 3e77d37..c86478d 100644 > --- a/lisp/textmodes/paragraphs.el > +++ b/lisp/textmodes/paragraphs.el > @@ -347,7 +347,7 @@ Returns the count of paragraphs left to move." > (and use-hard-newlines > (not (get-text-property (1- start) 'hard))))) > (forward-char 1)) > - (if (< (point) (point-max)) > + (if (not (eobp)) > (goto-char start)))) > (constrain-to-field nil opoint t) > ;; Return the number of steps that could not be done. > @@ -445,7 +445,7 @@ the current paragraph with the one containing the mark." > (if (<= (point) opoint) > (progn > (forward-char 1) > - (if (< (point) (point-max)) > + (if (not (eobp)) > (end-of-paragraph-text)))))) > > (defun forward-sentence (&optional arg) > diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el > index 59f9de8..449bcbc 100644 > --- a/lisp/textmodes/reftex-toc.el > +++ b/lisp/textmodes/reftex-toc.el > @@ -978,7 +978,7 @@ label prefix determines the wording of a reference." > (t (message "%s" reftex-no-follow-message) nil)))) > (when match > (goto-char (match-beginning 0)) > - (if (not (= (point) (point-max))) (recenter 1)) > + (if (not (eobp)) (recenter 1)) > (reftex-highlight 0 (match-beginning 0) (match-end 0) (current-buffer))) > match)) > > diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el > index b05a5e5..0525186 100644 > --- a/lisp/textmodes/rst.el > +++ b/lisp/textmodes/rst.el > @@ -2479,7 +2479,7 @@ file-write hook to always make it up-to-date automatically." > ;; Look for the first line that starts at the first column. > (forward-line 1) > (while (and > - (< (point) (point-max)) > + (not (eobp)) > (or (if (looking-at > (rst-re 'hws-sta "\\S ")) ; indented content. > (setq last-real (point))) > @@ -3796,7 +3796,7 @@ next non-empty line if this is indented more than the current one." > (let ((cur-ind (current-indentation))) > (if (eq ind-pnt 'next) > (when (and (zerop (forward-line 1)) > - (< (point) (point-max))) > + (not (eobp))) > ;; Not at EOF. > (setq rst-font-lock-find-unindented-line-begin > (point)) > @@ -3807,9 +3807,9 @@ next non-empty line if this is indented more than the current one." > (match-end 0))) > ;; Skip until non-empty line or EOF. > (while (and (zerop (forward-line 1)) > - (< (point) (point-max)) > + (not (eobp)) > (looking-at (rst-re 'lin-end)))) > - (when (< (point) (point-max)) > + (when (not (eobp)) > ;; Not at EOF. > (setq rst-font-lock-find-unindented-line-begin > (point)) > diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el > index 60aabc3..7660a35 100644 > --- a/lisp/textmodes/table.el > +++ b/lisp/textmodes/table.el > @@ -2632,7 +2632,7 @@ DIRECTION is one of symbols; right, left, above or below." > (goto-char beg) > (table--insert-rectangle rectangle)) > (delete-region beg end) > - (insert (if (and (> (point) (point-min)) > + (insert (if (and (not (bobp)) > (save-excursion > (forward-char -1) > (looking-at (regexp-opt-charset > diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el > index 218b6db..5af5a81 100644 > --- a/lisp/textmodes/texinfmt.el > +++ b/lisp/textmodes/texinfmt.el > @@ -635,7 +635,7 @@ Do not append @refill to paragraphs containing @w{TEXT} or @*." > ;; the other processing removes information that tells Texinfo > ;; whether the text should or should not be filled. > > - (while (< (point) (point-max)) > + (while (not (eobp)) > (let ((refill-blank-lines "^[ \t\n]*$") > (case-fold-search nil)) ; Don't confuse @TeX and @tex.... > (beginning-of-line) > @@ -652,7 +652,7 @@ Do not append @refill to paragraphs containing @w{TEXT} or @*." > "\\|" > texinfo-part-of-para-regexp > "\\)"))) > - (< (point) (point-max))) > + (not (eobp))) > (forward-line 1)) > ;; 2. Skip over @example and similar no-refill environments. > (if (looking-at texinfo-no-refill-regexp) > @@ -662,7 +662,7 @@ Do not append @refill to paragraphs containing @w{TEXT} or @*." > ;; Else > ;; 3. Do not refill a paragraph containing @w or @*, or ending > ;; with @<newline> followed by a newline. > - (if (or (>= (point) (point-max)) > + (if (or (eobp) > (re-search-forward > "@w{\\|@\\*\\|@\n\n" > (save-excursion (forward-paragraph) > diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el > index d21b4cc..ad3200f 100644 > --- a/lisp/vc/ediff-diff.el > +++ b/lisp/vc/ediff-diff.el > @@ -1197,7 +1197,7 @@ delimiter regions")) > (unwind-protect > (progn > (set-buffer buffer) > - (or (= (point) (point-max)) > + (or (eobp) > (setq opoint (point))) > (goto-char (point-max)) > (insert-before-markers string)) > diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el > index 020a1c3..15435f5 100644 > --- a/lisp/vc/ediff-help.el > +++ b/lisp/vc/ediff-help.el > @@ -259,7 +259,7 @@ the value of this variable and the variables `ediff-help-message-*' in > (str (make-string shift ?\ ))) > (save-excursion > (goto-char (point-min)) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (insert str) > (beginning-of-line) > (forward-line 1))))) > diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el > index e6bd897..99260f4 100644 > --- a/lisp/vc/log-edit.el > +++ b/lisp/vc/log-edit.el > @@ -590,7 +590,7 @@ Also saves its contents in the comment history and hides > (save-excursion > (let ((common (point-max))) > (rfc822-goto-eoh) > - (while (< (point) (point-max)) > + (while (not (eobp)) > (if (not (looking-at "^[ \t]*$")) > (setq common (min common (current-indentation)))) > (forward-line 1)) > diff --git a/lisp/vc/pcvs-parse.el b/lisp/vc/pcvs-parse.el > index 366e90d..9ea4066 100644 > --- a/lisp/vc/pcvs-parse.el > +++ b/lisp/vc/pcvs-parse.el > @@ -125,7 +125,7 @@ Match RE and if successful, execute MATCHES." > (when (looking-at re) > (goto-char (match-end 0)) > ;; Skip the newline (unless we already are at the end of the buffer). > - (when (and (eolp) (< (point) (point-max))) (forward-char)) > + (when (and (eolp) (not (eobp))) (forward-char)) > ;; assign the matches > (dolist (match matches t) > (let ((val (cdr match))) > diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el > index a0efe02..a965583 100644 > --- a/lisp/vc/vc-dispatcher.el > +++ b/lisp/vc/vc-dispatcher.el > @@ -369,7 +369,7 @@ Display the buffer in some window, but don't select it." > (with-current-buffer buffer > (setq default-directory root) > (goto-char (point-max)) > - (unless (eq (point) (point-min)) > + (unless (bobp) > (insert "\f\n")) > (setq new-window-start (point)) > (insert "Running \"" command) > diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el > index f580e94..8cf9104 100644 > --- a/test/automated/python-tests.el > +++ b/test/automated/python-tests.el > @@ -2726,9 +2726,9 @@ def foo(a, b, c): > # bad indented comment > # more comments" (make-string 9999 ?\n)) > (python-util-forward-comment 1) > - (should (= (point) (point-max))) > + (should (eobp)) > (python-util-forward-comment -1) > - (should (= (point) (point-min))))) > + (should (bobp)))) > > (ert-deftest python-triple-quote-pairing () > (require 'electric) > Interesting, thanks! Andreas ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 9:09 ` Andreas Röhler 2014-06-23 12:44 ` Nicolas Richard @ 2014-06-23 14:19 ` Stefan Monnier 1 sibling, 0 replies; 12+ messages in thread From: Stefan Monnier @ 2014-06-23 14:19 UTC (permalink / raw) To: Andreas Röhler; +Cc: Dmitry Antipov, emacs-devel >> Source forms like: >> (if (= (point) (point-min)) ...) >> or: >> (if (eq (point-max) (point)) ...) >> are widely used, > IMHO a very useful move. However, as this is suboptimal style, > probably fixing the source --and spread the message-- is better than > fixing it afterwards. Indeed, it's very common for compilers to perform optimization of "silly" expressions like (+ 4 5) or things like that. The purpose is not to compensate for the stupidity of the programmer but to eliminate stupidity introduced by earlier code transformations (e.g. macro-expansion, inlinling or other optimizations). If we thing it's undesirable source code, we should add warnings in the byte-compiler. If OTOH we think it's perfectly fine source code (saving the programmer the trouble of remembering the existence and meaning of bobp/eobp), then it might be worthwhile to add the optimization in the byte-compiler indeed. Stefan ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 6:43 [RFC] bytecomp: simple source-level optimization Dmitry Antipov 2014-06-23 8:29 ` Leo Liu 2014-06-23 9:09 ` Andreas Röhler @ 2014-06-23 9:56 ` David Kastrup 2014-06-23 11:40 ` Dmitry Antipov 2014-06-25 1:08 ` Stephen J. Turnbull 2 siblings, 2 replies; 12+ messages in thread From: David Kastrup @ 2014-06-23 9:56 UTC (permalink / raw) To: emacs-devel Dmitry Antipov <dmantipov@yandex.ru> writes: > Source forms like: > > (if (= (point) (point-min)) ...) > > or: > > (if (eq (point-max) (point)) ...) > > are widely used, The latter is a bad idea. You cannot reliably compare integers with eq in Common Lisp, cf <URL:http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node74.html>: However, numbers with the same value need not be eq [...] The current Elisp implementation in Emacs (though possibly not in XEmacs, and definitely not in GUILE) _does_ implement all integers as immediate values, but that may well change in future: guile GNU Guile 2.0.9 Copyright (C) 1995-2013 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (eq? 5 5) $1 = #t scheme@(guile-user)> (eq? 1234567890123 1234567890123) $2 = #f scheme@(guile-user)> (let ((x 1234567890123)) (eq? x x)) $3 = #t scheme@(guile-user)> Even the Elisp manual states that using '=' is "better programming practice". When one wants to avoid the error cases of '=', eql might be the better choice. 3.4 Comparison of Numbers ========================= To test numbers for numerical equality, you should normally use ‘=’, not ‘eq’. There can be many distinct floating-point objects with the same numeric value. If you use ‘eq’ to compare them, then you test whether two values are the same _object_. By contrast, ‘=’ compares only the numeric values of the objects. In Emacs Lisp, each integer is a unique Lisp object. Therefore, ‘eq’ is equivalent to ‘=’ where integers are concerned. It is sometimes convenient to use ‘eq’ for comparing an unknown value with an integer, because ‘eq’ does not report an error if the unknown value is not a number—it accepts arguments of any type. By contrast, ‘=’ signals an error if the arguments are not numbers or markers. However, it is better programming practice to use ‘=’ if you can, even for comparing integers. -- David Kastrup ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 9:56 ` David Kastrup @ 2014-06-23 11:40 ` Dmitry Antipov 2014-06-23 11:44 ` Dmitry Antipov 2014-06-25 1:08 ` Stephen J. Turnbull 1 sibling, 1 reply; 12+ messages in thread From: Dmitry Antipov @ 2014-06-23 11:40 UTC (permalink / raw) To: David Kastrup; +Cc: emacs-devel On 06/23/2014 01:56 PM, David Kastrup wrote: > The latter is a bad idea. You cannot reliably compare integers with > eq in Common Lisp, cf > <URL:http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node74.html>: I know. > The current Elisp implementation in Emacs (though possibly not in > XEmacs, and definitely not in GUILE) _does_ implement all integers as > immediate values, but that may well change in future: Since such a change will break a lot of things under lisp/ directory, I don't see practical considerations to make this move in foreseeable future. Nevertheless, it may be worth trying to enhance bytecomp to emit warning if at least one operand of 'eq' is a compile-time numeric constant. Dmitry ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 11:40 ` Dmitry Antipov @ 2014-06-23 11:44 ` Dmitry Antipov 0 siblings, 0 replies; 12+ messages in thread From: Dmitry Antipov @ 2014-06-23 11:44 UTC (permalink / raw) To: David Kastrup; +Cc: emacs-devel On 06/23/2014 03:40 PM, Dmitry Antipov wrote: > emit warning if at least one operand of 'eq' is a compile-time numeric > constant. ...or a builtin function which always returns an integer, of course. Dmitry ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFC] bytecomp: simple source-level optimization 2014-06-23 9:56 ` David Kastrup 2014-06-23 11:40 ` Dmitry Antipov @ 2014-06-25 1:08 ` Stephen J. Turnbull 1 sibling, 0 replies; 12+ messages in thread From: Stephen J. Turnbull @ 2014-06-25 1:08 UTC (permalink / raw) To: David Kastrup; +Cc: emacs-devel David Kastrup writes: > You cannot reliably compare integers with eq in Common Lisp, cf > <URL:http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node74.html>: > > However, numbers with the same value need not be eq [...] > > The current Elisp implementation in Emacs (though possibly not in > XEmacs, If bignums are enabled, "large" integers do not have an immediate representation in XEmacs and SXEmacs (where bignums may be enabled by default by now). And of course floats and markers do not have an immediate representation, but they can be = to integers in numerical comparisons. Finally, in XEmacs (and SXEmacs) characters and (small) integers both have immediate representation and can compare equal numerically, but their representations are different (they're different types), so a character can never be eq to any integer. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-06-25 1:08 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-06-23 6:43 [RFC] bytecomp: simple source-level optimization Dmitry Antipov 2014-06-23 8:29 ` Leo Liu 2014-06-23 11:05 ` Dmitry Antipov 2014-06-23 12:26 ` Leo Liu 2014-06-23 9:09 ` Andreas Röhler 2014-06-23 12:44 ` Nicolas Richard 2014-06-23 14:01 ` Andreas Röhler 2014-06-23 14:19 ` Stefan Monnier 2014-06-23 9:56 ` David Kastrup 2014-06-23 11:40 ` Dmitry Antipov 2014-06-23 11:44 ` Dmitry Antipov 2014-06-25 1:08 ` Stephen J. Turnbull
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).