Mercurial > emacs
comparison lisp/org/org-mhe.el @ 100458:ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
* Fix typos in comments and docstrings throughout Org-mode.
* org.el (org-get-outline-path): Fix bug if level is not given.
* org-agenda.el (org-finalize-agenda): Fix typo with variable
name.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Wed, 17 Dec 2008 12:34:50 +0000 |
parents | cea079b68b76 |
children | 0d3c634e0bd9 |
comparison
equal
deleted
inserted
replaced
100457:022a6a6d35ab | 100458:ba23e35d3eaf |
---|---|
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de> | 5 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de> |
6 ;; Keywords: outlines, hypermedia, calendar, wp | 6 ;; Keywords: outlines, hypermedia, calendar, wp |
7 ;; Homepage: http://orgmode.org | 7 ;; Homepage: http://orgmode.org |
8 ;; Version: 6.15a | 8 ;; Version: 6.15d |
9 ;; | 9 ;; |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 ;; | 11 ;; |
12 ;; GNU Emacs is free software: you can redistribute it and/or modify | 12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
108 (defun org-mhe-get-message-real-folder () | 108 (defun org-mhe-get-message-real-folder () |
109 "Return the name of the real folder for the current message. | 109 "Return the name of the real folder for the current message. |
110 So if you use sequences, it will now work." | 110 So if you use sequences, it will now work." |
111 (save-excursion | 111 (save-excursion |
112 (let* ((folder | 112 (let* ((folder |
113 (if (equal major-mode 'mh-folder-mode) | 113 (if (equal major-mode 'mh-folder-mode) |
114 mh-current-folder | 114 mh-current-folder |
115 ;; Refer to the show buffer | 115 ;; Refer to the show buffer |
116 mh-show-folder-buffer)) | 116 mh-show-folder-buffer)) |
117 (end-index | 117 (end-index |
118 (if (boundp 'mh-index-folder) | 118 (if (boundp 'mh-index-folder) |
119 (min (length mh-index-folder) (length folder)))) | 119 (min (length mh-index-folder) (length folder)))) |
120 ) | 120 ) |
121 ;; a simple test on mh-index-data does not work, because | 121 ;; a simple test on mh-index-data does not work, because |
122 ;; mh-index-data is always nil in a show buffer. | 122 ;; mh-index-data is always nil in a show buffer. |
123 (if (and (boundp 'mh-index-folder) | 123 (if (and (boundp 'mh-index-folder) |
124 (string= mh-index-folder (substring folder 0 end-index))) | 124 (string= mh-index-folder (substring folder 0 end-index))) |
125 (if (equal major-mode 'mh-show-mode) | 125 (if (equal major-mode 'mh-show-mode) |
126 (save-window-excursion | 126 (save-window-excursion |
127 (let (pop-up-frames) | 127 (let (pop-up-frames) |
128 (when (buffer-live-p (get-buffer folder)) | 128 (when (buffer-live-p (get-buffer folder)) |
129 (progn | 129 (progn |
130 (pop-to-buffer folder) | 130 (pop-to-buffer folder) |
131 (org-mhe-get-message-folder-from-index) | 131 (org-mhe-get-message-folder-from-index) |
132 ) | 132 ) |
133 ))) | 133 ))) |
134 (org-mhe-get-message-folder-from-index) | 134 (org-mhe-get-message-folder-from-index) |
135 ) | 135 ) |
136 folder | 136 folder |
137 ) | 137 ) |
138 ))) | 138 ))) |
139 | 139 |
140 (defun org-mhe-get-message-folder-from-index () | 140 (defun org-mhe-get-message-folder-from-index () |
141 "Return the name of the message folder in an index folder buffer." | 141 "Return the name of the message folder in an index folder buffer." |
142 (save-excursion | 142 (save-excursion |
147 (defun org-mhe-get-message-folder () | 147 (defun org-mhe-get-message-folder () |
148 "Return the name of the current message folder. | 148 "Return the name of the current message folder. |
149 Be careful if you use sequences." | 149 Be careful if you use sequences." |
150 (save-excursion | 150 (save-excursion |
151 (if (equal major-mode 'mh-folder-mode) | 151 (if (equal major-mode 'mh-folder-mode) |
152 mh-current-folder | 152 mh-current-folder |
153 ;; Refer to the show buffer | 153 ;; Refer to the show buffer |
154 mh-show-folder-buffer))) | 154 mh-show-folder-buffer))) |
155 | 155 |
156 (defun org-mhe-get-message-num () | 156 (defun org-mhe-get-message-num () |
157 "Return the number of the current message. | 157 "Return the number of the current message. |
158 Be careful if you use sequences." | 158 Be careful if you use sequences." |
159 (save-excursion | 159 (save-excursion |
160 (if (equal major-mode 'mh-folder-mode) | 160 (if (equal major-mode 'mh-folder-mode) |
161 (mh-get-msg-num nil) | 161 (mh-get-msg-num nil) |
162 ;; Refer to the show buffer | 162 ;; Refer to the show buffer |
163 (mh-show-buffer-message-number)))) | 163 (mh-show-buffer-message-number)))) |
164 | 164 |
165 (defun org-mhe-get-header (header) | 165 (defun org-mhe-get-header (header) |
166 "Return the field for HEADER of the message in folder mode. | 166 "Return the field for HEADER of the message in folder mode. |
167 This will create a show buffer for the corresponding message. If | 167 This will create a show buffer for the corresponding message. If |
168 you have a better idea of how to do this then please let us know." | 168 you have a better idea of how to do this then please let us know." |
169 (let* ((folder (org-mhe-get-message-folder)) | 169 (let* ((folder (org-mhe-get-message-folder)) |
170 (num (org-mhe-get-message-num)) | 170 (num (org-mhe-get-message-num)) |
171 (buffer (get-buffer-create (concat "show-" folder))) | 171 (buffer (get-buffer-create (concat "show-" folder))) |
172 (header-field)) | 172 (header-field)) |
173 (with-current-buffer buffer | 173 (with-current-buffer buffer |
174 (mh-display-msg num folder) | 174 (mh-display-msg num folder) |
175 (if (equal major-mode 'mh-folder-mode) | 175 (if (equal major-mode 'mh-folder-mode) |
176 (mh-header-display) | 176 (mh-header-display) |
177 (mh-show-header-display)) | 177 (mh-show-header-display)) |
178 (set-buffer buffer) | 178 (set-buffer buffer) |
179 (setq header-field (mh-get-header-field header)) | 179 (setq header-field (mh-get-header-field header)) |
180 (if (equal major-mode 'mh-folder-mode) | 180 (if (equal major-mode 'mh-folder-mode) |
181 (mh-show) | 181 (mh-show) |
182 (mh-show-show)) | 182 (mh-show-show)) |
183 header-field))) | 183 header-field))) |
184 | 184 |
185 (defun org-mhe-follow-link (folder article) | 185 (defun org-mhe-follow-link (folder article) |
186 "Follow an MH-E link to FOLDER and ARTICLE. | 186 "Follow an MH-E link to FOLDER and ARTICLE. |
195 (mh-find-path) | 195 (mh-find-path) |
196 (if (not article) | 196 (if (not article) |
197 (mh-visit-folder (mh-normalize-folder-name folder)) | 197 (mh-visit-folder (mh-normalize-folder-name folder)) |
198 (mh-search-choose) | 198 (mh-search-choose) |
199 (if (equal mh-searcher 'pick) | 199 (if (equal mh-searcher 'pick) |
200 (progn | 200 (progn |
201 (setq article (org-add-angle-brackets article)) | 201 (setq article (org-add-angle-brackets article)) |
202 (mh-search folder (list "--message-id" article)) | 202 (mh-search folder (list "--message-id" article)) |
203 (when (and org-mhe-search-all-folders | 203 (when (and org-mhe-search-all-folders |
204 (not (org-mhe-get-message-real-folder))) | 204 (not (org-mhe-get-message-real-folder))) |
205 (kill-this-buffer) | 205 (kill-this-buffer) |
206 (mh-search "+" (list "--message-id" article)))) | 206 (mh-search "+" (list "--message-id" article)))) |
207 (if mh-search-regexp-builder | 207 (if mh-search-regexp-builder |
208 (mh-search "+" (funcall mh-search-regexp-builder | 208 (mh-search "+" (funcall mh-search-regexp-builder |
209 (list (cons 'message-id article)))) | 209 (list (cons 'message-id article)))) |
210 (mh-search "+" article))) | 210 (mh-search "+" article))) |
211 (if (org-mhe-get-message-real-folder) | 211 (if (org-mhe-get-message-real-folder) |
212 (mh-show-msg 1) | 212 (mh-show-msg 1) |
213 (kill-this-buffer) | 213 (kill-this-buffer) |
214 (error "Message not found")))) | 214 (error "Message not found")))) |
215 | 215 |
216 (provide 'org-mhe) | 216 (provide 'org-mhe) |
217 | 217 |