diff options
| author | Richard M. Stallman | 2011-07-07 06:35:43 -0400 |
|---|---|---|
| committer | Richard M. Stallman | 2011-07-07 06:35:43 -0400 |
| commit | c2f9aec8b46cfa648c9768a0e6574d43d604eb2c (patch) | |
| tree | 8ff4f1b9eb8d2d655468938af43114a473641a33 | |
| parent | fd44db7f9a7b7243281ce6e8a86d28b60448de67 (diff) | |
| download | emacs-c2f9aec8b46cfa648c9768a0e6574d43d604eb2c.tar.gz emacs-c2f9aec8b46cfa648c9768a0e6574d43d604eb2c.zip | |
Fix bugs finding grep hits in Rmail buffers.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/mail/rmail.el | 42 |
2 files changed, 41 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 42c1686e9d5..99db8f7962c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2011-07-07 Richard Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * mail/rmail.el (rmail-next-error-move): Use `compilation-message' | ||
| 4 | property, and handle its changed format. | ||
| 5 | Look for the correct line number. | ||
| 6 | Use file's line contents (but not past first =) to find | ||
| 7 | correct line in message. | ||
| 8 | |||
| 1 | 2011-07-07 Kenichi Handa <handa@m17n.org> | 9 | 2011-07-07 Kenichi Handa <handa@m17n.org> |
| 2 | 10 | ||
| 3 | * international/characters.el (build-unicode-category-table): | 11 | * international/characters.el (build-unicode-category-table): |
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 900eedfef84..c43ec9e5611 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -3025,9 +3025,13 @@ or forward if N is negative." | |||
| 3025 | MSG-POS is a marker pointing at the error message in the grep buffer. | 3025 | MSG-POS is a marker pointing at the error message in the grep buffer. |
| 3026 | BAD-MARKER is a marker that ought to point at where to move to, | 3026 | BAD-MARKER is a marker that ought to point at where to move to, |
| 3027 | but probably is garbage." | 3027 | but probably is garbage." |
| 3028 | (let* ((message (car (get-text-property msg-pos 'message (marker-buffer msg-pos)))) | 3028 | |
| 3029 | (column (car message)) | 3029 | (let* ((message-loc (compilation--message->loc |
| 3030 | (linenum (cadr message)) | 3030 | (get-text-property msg-pos 'compilation-message |
| 3031 | (marker-buffer msg-pos)))) | ||
| 3032 | (column (car message-loc)) | ||
| 3033 | (linenum (cadr message-loc)) | ||
| 3034 | line-text | ||
| 3031 | pos | 3035 | pos |
| 3032 | msgnum msgbeg msgend | 3036 | msgnum msgbeg msgend |
| 3033 | header-field | 3037 | header-field |
| @@ -3041,10 +3045,18 @@ but probably is garbage." | |||
| 3041 | (save-excursion | 3045 | (save-excursion |
| 3042 | ;; Find the line that the error message points at. | 3046 | ;; Find the line that the error message points at. |
| 3043 | (goto-char (point-min)) | 3047 | (goto-char (point-min)) |
| 3044 | (forward-line linenum) | 3048 | (forward-line (1- linenum)) |
| 3045 | (setq pos (point)) | 3049 | (setq pos (point)) |
| 3046 | 3050 | ||
| 3047 | ;; Find which message that's in, | 3051 | ;; Find the text at the start of the line, |
| 3052 | ;; before the first = sign. | ||
| 3053 | ;; This text has a good chance of being also in the | ||
| 3054 | ;; decoded message. | ||
| 3055 | (save-excursion | ||
| 3056 | (skip-chars-forward "^=\n") | ||
| 3057 | (setq line-text (buffer-substring pos (point)))) | ||
| 3058 | |||
| 3059 | ;; Find which message this position is in, | ||
| 3048 | ;; and the limits of that message. | 3060 | ;; and the limits of that message. |
| 3049 | (setq msgnum (rmail-what-message pos)) | 3061 | (setq msgnum (rmail-what-message pos)) |
| 3050 | (setq msgbeg (rmail-msgbeg msgnum)) | 3062 | (setq msgbeg (rmail-msgbeg msgnum)) |
| @@ -3071,11 +3083,23 @@ but probably is garbage." | |||
| 3071 | (rmail-show-message msgnum) | 3083 | (rmail-show-message msgnum) |
| 3072 | 3084 | ||
| 3073 | ;; Move to the right position within the displayed message. | 3085 | ;; Move to the right position within the displayed message. |
| 3086 | ;; Or at least try. The decoded message's lines may not | ||
| 3087 | ;; correspond to the lines in the inbox file. | ||
| 3088 | (goto-char (point-min)) | ||
| 3074 | (if header-field | 3089 | (if header-field |
| 3075 | (re-search-forward (concat "^" (regexp-quote header-field)) nil t) | 3090 | (progn |
| 3076 | (search-forward "\n\n" nil t)) | 3091 | (re-search-forward (concat "^" (regexp-quote header-field)) nil t) |
| 3077 | (forward-line line-number-within) | 3092 | (forward-line line-number-within)) |
| 3078 | (forward-char column))) | 3093 | (search-forward "\n\n" nil t) |
| 3094 | (if (re-search-forward (concat "^" (regexp-quote line-text)) nil t) | ||
| 3095 | (goto-char (match-beginning 0)))) | ||
| 3096 | (if (eobp) | ||
| 3097 | ;; If the decoded message doesn't have enough lines, | ||
| 3098 | ;; go to the beginning rather than the end. | ||
| 3099 | (goto-char (point-min)) | ||
| 3100 | ;; Otherwise, go to the right column. | ||
| 3101 | (if column | ||
| 3102 | (forward-char column))))) | ||
| 3079 | 3103 | ||
| 3080 | (defun rmail-what-message (&optional pos) | 3104 | (defun rmail-what-message (&optional pos) |
| 3081 | "Return message number POS (or point) is in." | 3105 | "Return message number POS (or point) is in." |