view doc/misc/emacs-mime.texi @ 104164:ac1a55cc2c38

2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-create-formula-image): Remove the -E option for dvipng. * org-exp.el (org-default-export-plist): Respect #+BIND. (org-export-confirm-letbind): New function. * org.el (org-paste-subtree): Test the kill ring entry if it is going to be used. (org-copy-subtree): Use `org-forward-same-level'. (org-forward-same-level): Respect the `invisibe-ok' arg for back-to-heading. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-table-map-tables): Make sure cursor is back at table beginning after funcall. * org-agenda.el (org-agenda-bulk-action): Make sure parents are handled before children, and do not error if an entry is not found, probably because it hase been remove when the parent was archived or refiled. * org.el (org-ido-completing-read): Accept straight lists for completion as well as alists. * org-timer.el (org-timer-cancel-timers): Renamed from `org-timer-cancel-timers'. * org.el (org-cycle-internal-local): Fix problem with finding next invisible line. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-list-send-list): Call `org-list-goto-true-beginning' instead of `org-list-find-true-beginning', which does not exist. * org-timer.el (org-timer-reset-timers): Use `mapc'. (org-timer-set-timer): Do not assign to heading. * org-id.el (org-id-open): Quote function name. * org-macs.el (org-unmodified): Turn off recording undo information while running inside the macro. * org-table.el (org-table-export): Also work in file-less buffers. * org.el (org-startup-indented): New option. (org-startup-options): Add new options indent and noindent. (org-unfontify-region): Remove line-prefix and wrap-prefix properties. (org-after-demote-entry-hook, org-after-promote-entry-hook): New hooks. (org-promote, org-demote): Run the new hooks. * org-table.el (org-table-align): Replace leading \n as well. * org-exp.el (org-export-push-to-kill-ring): Remove `line-prefix' and `line-wrap' text properties. * org-compat.el (org-kill-new): New function. * org-agenda.el (org-format-agenda-item): Remove `line-prefix' and `line-wrap' text properties. * org-indent.el: New file. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-provide-todo-statistics): Tweak docstring. * org-id.el (org-id-open): Honor `org-link-frame-setup'. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-as-org): Insert the "-source" string before the extension. * org.el (org-read-date): Make sure the calendar is in the current frame. (org-set-emph-re): Remove the ? from the post-match. (org-emphasis-regexp-components): Add backslash to the postmatch class. (org-set-font-lock-defaults): Write \n instead of \xa, and make it optional so that also lines at the end of the buffers will still be matched as headlines. * org-table.el (org-table-error-on-row-ref-crossing-hline): Variable made obsolete. (org-table-relative-ref-may-cross-hline): New option. (org-table-find-row-type): Honow the new option `org-table-relative-ref-may-cross-hline'. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-cut-region, org-table-copy-region): Work on single field if no active region. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Only insert title if one is defined. * org.el (org-make-options-regexp): Allow empty values. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-cycle-internal-local): Improved version of finding next visible line. (org-cycle-hide-drawers): Only hide drawers if this is really necessary. (outline-end-of-subtree): Make `outline-end-of-subtree' use the org-version of this function in Org-mode. We use advice to implement this change, so that future changes to this function in outline.el wil be handled properly. (org-forward-same-level, org-backward-same-level): New commands. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-remove-empty-overlays-at) (org-clean-visibility-after-subtree-move): New functons. (org-move-subtree-down): Simplify cleanup of display. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-mac-message.el (org-mac-message-get-links): Improve docstring. Make argument SELECT-OR-FLAGGED optional, default to "s". Fix the return value. (org-mac-message-insert-flagged): Simplify. * org.el (org-refile-get-location): Tamper with refile history o that history contains compete matches instead of the entered string. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-store-link): Never store a link to an inline task. * org-footnote.el (org-footnote-goto-local-insertion-point): Skip inline tasks when positioning footnotes. * org.el (org-refile): Remove the END line when archiving an inline task that does have an END line. * org-archive.el (org-archive-subtree): Remove the END line when archiving an inline task that does have an END line. * org-macs.el (org-with-limited-levels): New macro. (org-get-limited-outline-regexp): New function. * org-exp.el (org-export-format-source-code-or-example): Fix bug that did not enumerate first line. (org-export-mark-radio-links): Skip matches in links. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-activate-plain-links): Make single-match. (org-adapt-indentation): Fix docstring. * org-macs.el (org-unmodified): Turn of modification hooks while running this macro. 2009-08-06 Bastien Guerry <bzg@altern.org> * org.el (org-adapt-indentation): Slightly improve the docstring. (org-occur): Sends an error when the user inputs an empty string. (org-priority): Bugfix: the tag alignement should happen within save-excursion. 2009-08-06 Bastien Guerry <bzg@altern.org> * org.el (org-make-link-regexps): Don't exclude parentheses from `org-plain-link-re' (org-cycle-internal-local): When locally cycling, switch directly from CHILDREN to FOLDED if there is no subtree (org-cycle): Update the docstring to document the new behavior of `org-cycle-internal-local'. 2009-08-06 Nicolas Goaziou <n.goaziou@neuf.fr> (tiny change) * org-clock.el (org-clock-in): Bugfix: recognize timestamps with an abbreviated format for days. 2009-08-06 Bastien Guerry <bzg@altern.org> * org-protocol.el (org-protocol-default-template-key): New option. * org.el (org-refile): Bugfix: save-excursion before reading the refile target, otherwise cursor moves might confuse `org-refile'. * org.el (org-toggle-heading): Bugfix: correctly convert list items before the first headline. * org.el (org-provide-todo-statistics): Allow a list of TODO keywords to compute statistics against headlines containing a keyword from this list. (org-update-parent-todo-statistics): Possibly use the new allowed value of `org-provide-todo-statistics'. 2009-08-06 Bastien Guerry <bzg@altern.org> * org-timer.el: Add autoload cookie. * org.el (org-occur-link-in-agenda-files): New function. * org-timer.el (org-timer-last-timer): New variable. * org-agenda.el (org-agenda-mode-map): New key for org-timer-set-timer called from the agenda. * org.el (org-mode-map): New key for org-timer-set-timer. * org-timer.el (org-timer-reset-timers) (org-timer-show-remaining-time, org-timer-set-timer): New functions. * org-clock.el (org-show-notification): Update the docstring. * org.el (org-provide-todo-statistics): Allow new value 'all-headlines for this option, which includes entries with no TODO keywords in the todo statistics. (org-update-parent-todo-statistics): Possibly use the new 'all-headline value from `org-provide-todo-statistics'. 2009-08-06 Bastien Guerry <bzg@altern.org> * org-clock.el (org-dblock-write:clocktable): Add a new option :timestamp which allows display of timestamps in clock reports. * org.el (org-mode-map): Define new key `C-c C-*': convert a plain list to a subtree, preserving the structure of the list. (org-set-emph-re): Make the last element optional in the regexp. This regexp now matches an emphasized string at the end of a line. * org-list.el (org-list-goto-true-beginning) (org-list-make-subtree, org-list-make-subtrees): New functions. * org.el (org-eval-in-calendar): Select the right frame. (org-save-frame-excursion): Remove this macro. 2009-08-06 Bastien Guerry <bzg@altern.org> * org-list.el (org-list-beginning-re): Bugfix: don't use * when trying to find the beginning of a list. * org-exp.el (org-get-file-contents): Use a new argument: markup. When present, tell org-get-file-contents not to protect org-like lines. * org-id.el (org-id-uuid-program): New option to set the name of the uuidgen program. (org-id-method): Use `org-id-uuid-program'. (org-id-new): Use `org-id-uuid-program'. 2009-08-06 Bastien Guerry <bzg@altern.org> * org-exp.el (org-export-number-lines): Allow whitespace in code references. Allow the -r switch to remove the references in the source code even when the lines are not numbered: the labels can be explicit enough. * org.el (org-fontify-whole-heading-line): New option. (org-set-font-lock-defaults): Use the new option. * org-clock.el (org-show-notification-handler): New option. (org-show-notification): Use the new option. 2009-08-06 Bastien Guerry <bzg@altern.org> * org.el (org-eval-in-calendar): Fix a bug about calendar navigation when `calendar-setup' value is 'calendar-only. 2009-08-06 Bastien Guerry <bzg@altern.org> * org.el (orgstruct++-mode): Fix typo in docstring. (org-insert-link): Clean up: (or (...)) => (...) (org-insert-link): Use TAB for stored links completion. 2009-08-06 Bastien Guerry <bzg@altern.org> * org.el (org-get-refile-targets): Fix bug: don't ignore case when building the list of targets. * org-remember.el (org-remember-delete-empty-lines-at-end): New option. (org-remember-handler): Use the new option. 2009-08-06 James TD Smith <ahktenzero@mohorovi.cc> * org.el (org-tags-sort-function): New option for sorting tags. (org-set-tags): Use the new option to sort tags. * org-plot.el (org-plot/gnuplot): Run with an idle timer to avoid premature deletion of the data when using org-plot in a script. 2009-08-06 Bastien Guerry <bzg@altern.org> * org-clock.el (org-clock-in-prepare-hook): New hook. (org-clock-in): Use this new hook. 2009-08-06 Bastien Guerry <bzg@altern.org> * org.el (org-special-ctrl-a/e): Explicitely bind the value 'reversed for this option to the "true line boundary first" behavior. (org-tags-match-list-sublevels): Document the 'indented value for this variable. * org-latex.el (org-export-latex-first-lines): Fix problem with publishing the region. * org-exp.el (org-export-format-source-code-or-example): Fix bad line numbering when exporting examples in HTML. 2009-08-06 James TD Smith <ahktenzero@mohorovi.cc> * org-colview.el (org-format-time-period): Formats a time in fractional days as days, hours, mins, seconds. (org-columns-display-here): Add special handling for SINCE and SINCE_IA to format for display. * org.el (org-time-since): Add a function to get the time since an org timestamp. (org-entry-properties): Add two new special properties: SINCE and SINCE_IA. These give the time since any active or inactive timestamp in an entry. (org-special-properties): Add SINCE, SINCE_IA. (org-tags-sort-function): Add custom declaration for tags sorting function. (org-set-tags): Sort tags if org-tags-sort-function is set 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-goto): Find hidden headlines as well. * org.el (org-narrow-to-subtree): Find hidden headlines as well. * org-plot.el (org-plot/add-options-to-plist): Add timeind option. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-remove-all-timestamps): New function. (org-publish-all): Remove all timestamp files if `org-publish-all' is called with a prefix argument. * org-list.el (org-indent-item): Fix typo. (org-item-indent-positions): Normalize ordered bullet. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-macs.el (org-set-local): Make a local variable, do not make the variable buffer-local! * org-latex.el (org-export-as-latex): Call `org-install-letbind'. * org-exp.el (org-infile-export-plist): Read BIND lines. (org-install-letbind): New function. (org-export-as-org, org-export-preprocess-string): Call `org-install-letbind'. * org-list.el (org-list-demote-modify-bullet): New option. (org-first-list-item-p): Save point. (org-fix-bullet-type): New optional argument FORCE-BULLET. (org-indent-item): Honor `org-list-demote-modify-bullet'. (org-item-indent-positions): Return bullet types along with indentation. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-show-entry): Hide drawers. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-footnote.el (org-footnote-auto-adjust): New option. (org-footnote-auto-adjust-maybe): New function. (org-footnote-new, org-footnote-delete): Call `org-footnote-auto-adjust-maybe'. * org.el (org-startup-options): Add new footnote-related keywords. * org-publish.el (org-publish-timestamp-filename): Additional arguments PUB-DIR and PUB-FUNC, which are included in the hash. (org-publish-needed-p): Additional arguments PUB-DIR PUB-FUNC TRUE-PUB-DIR. Pass them through to `org-publish-timestamp-filename'. (org-publish-update-timestamp): Additional arguments PUB-DIR and PUB-FUNC, which are included in the hash. (org-publish-file): Delay timestamp test until the publishing function is known. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-bulk-action): Add scheduling and setting the deadline. * org.el (org-read-date-final-answer): New variable. (org-read-date): Store the final answer string, including the date from the calendar, for reuse by agenda bulk commands. * org-publish.el (org-publish-attachment): Fix publishing of attachments. * org-latex.el (org-export-latex-quotation-marks): Fix export of quotation makrs in parenthesis. (org-remove-initial-hash): New function. (org-export-latex-preprocess): Fix bug with infinite loop if environment is not properly closed. * org-table.el (org-table-get-remote-range): Find #+TBLNAME also when indented. * org.el (org-fontify-meta-lines-and-blocks): Make #+TBLNAME highlight also when indented. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-footnote.el (org-footnote-renumber-fn:N): New command. (org-footnote-action): Offer renumbering. * org.el (org-cycle): Honor the `integrate' value of org-cycle-include-plain-lists'. * org-list.el (org-cycle-include-plain-lists): New allowed value `internal'. Improve the docstring. * org.el (org-set-autofill-regexps): Improve the paragraph-start regexp to work better with LaTeX commands. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-inline-image-extensions): Add ps and eps extensions. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-write-agenda): Make sure org-icalendar is loaded. * org.el (org-map-entries): No longer force `org-tags-match-list-sublevels' to t during a todo-only tags search. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-low-levels): Allow user-defined environment. (org-export-latex-subcontent): Handle user-defined environment. * org-agenda.el (org-agenda-view-mode-dispatch): Add more keys to the View dispatcher. * org.el (org-hide-block-toggle): Use `org-make-overlay' instead of `make-overlay'. * org-latex.el (org-export-as-pdf): Protect match data during call to shell-quote-argument. * org-agenda.el (org-agenda-mode-map): Modify bulk action keys. (org-agenda-view-mode-dispatch): New function. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-mode): Reset list of marks. (org-agenda-mode-map): Define new keys for refile and bulk action. (org-agenda-menu): Add menu itesm for refile and bulk action. (org-agenda-refile): New function. (org-agenda-set-tags): Optional arguments TAG and ONOFF. (org-agenda-marked-entries): New variable. (org-agenda-bulk-select, org-agenda-remove-bulk-action-overlays) (org-agenda-remove-all-bulk-action-marks) (org-agenda-bulk-action): New functions/commands. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-get-file-contents): Protect org-like lines in included files. (org-export-format-source-code-or-example): Remove newlines. * org-latex.el (org-export-latex-links): Check for no-description marking. * org-exp.el (org-export-preprocess-apply-macros): Switch macro argument separator back to comma. (org-export-normalize-links): Mark links without description. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-infile-export-plist): Fix bug in macro processing. * org-agenda.el (org-agenda-clock-out): Update line after clocking out. (org-agenda-highlight-todo): Fix bug with highlighting. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-set-font-lock-defaults): Adapt formatting to capture new alignment strings. * org-table.el (orgtbl-self-insert-command): Add yas/expand to command list. (org-table-align): Check for forced align type. * org.el (org-self-insert-command): Add yas/expand to command list. * org-clock.el (org-clock-in-hook): New hook. (org-clock-in): Run `org-clock-in-hook. (org-clock-out-hook): New hook. (org-clock-out): Run `org-clock-out-hook. (org-clock-cancel-hook): New hook. (org-clock-cancel): Run `org-clock-cancel-hook. (org-clock-goto-hook): New hook. (org-clock-goto): Run `org-clock-goto-hook. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-store-link): Better default description for link to Org-mode headline. * org-exp.el (org-export-generic): Autoload the generic exporter function. (org-export): Implement the `g' key for the generic exporter. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (orgtbl-setup): Add a binding for `S-iso-lefttab', and for zbacktab'. * org-exp.el (org-infile-export-plist): Get macros also from #+SETUPFILE. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-colview.el (org-columns-capture-view): Protect vertical bars in column values. (org-columns-capture-view): Exclude comment and archived trees. * org-colview-xemacs.el (org-columns-capture-view): Protect vertical bars in column values. (org-columns-capture-view): Exclude comment and archived trees. * org.el (org-quote-vert): New function. * org-latex.el (org-export-latex-verbatim-wrap): New option. * org-exp.el (org-export-format-source-code-or-example): Use `org-export-latex-verbatim-wrap'. * org.el (org-clone-subtree-with-time-shift): Also shift inactive time stamps. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp-blocks.el: New file. * org-remember.el (org-remember-templates): Allow the headline element to be a function. (org-remember-apply-template): If the headline is a function, call it to get the true function. * org-clock.el (org-clock-menu): New function. (org-clock-update-mode-line): Update help string. (org-clock-modify-effort-estimate): New function. (org-clock-mark-default-task): New function. * org.el (org-hh:mm-string-to-minutes): Also take just a number of minutes as input. (org-org-menu): Add new clocking stuff. (org-clock-is-active): New function. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-non-existing-files): Improve docstring. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-icalendar.el (org-icalendar-include-bbdb-anniversaries): New option. (org-export-icalendar): Call `org-bbdb-anniv-export-ical'. * org-bbdb.el (org-bbdb-anniv-export-ical): New function. * org-list.el (org-get-checkbox-statistics-face): Use the new faces. * org-faces.el (org-checkbox-statistics-todo) (org-checkbox-statistics-done): New faces. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-use-verb): New variable. (org-export-latex-emph-format): Prefer \texttt over \verb when org-export-latex-use-verb is set. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-handler): Abort remember if the buffer is empty. * org-exp.el (org-export-format-source-code-or-example): Run `org-src-mode-hook'. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-indent-line-function): Fix indentation of +#end lines. 2009-08-06 Tassilo Horn <tassilo@member.fsf.org> * org-gnus.el (org-gnus-store-link): Require message.el in org-gnus-store-link. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-src.el: New file, split out of org.el * org-macs.el (org-replace-match-keep-properties): New function. * org-exp.el (org-export-mark-blockquote-verse-center): Better preprocessing of center and quote and verse blocks. * org-list.el (org-list-end): Respect the stored "original" indentation when determining the end of the list. * org-exp.el (org-export-replace-src-segments-and-examples): Remember indentation correctly. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-update-mode-line): Apply face org-mode-line-clock. * org-faces.el (org-mode-line-clock): New face. 2009-08-06 Tassilo Horn <tassilo@member.fsf.org> * org-gnus.el (org-gnus-store-link): Fix bug where `org-gnus-store-link' used wrong subject when called in an article buffer. Patch provided by fengli AT gmail DOT com. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-format-source-code-or-example): Remember the original indentation of source code snippets and examples. * org-latex.el (org-export-as-latex): Relocate the table of contents. * org.el (org-ctrl-c-ctrl-c): Update clock lines. * org-agenda.el (org-run-agenda-series): Scope global options also when creating the agenda buffer. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-adapt-indentation): Improve documentation. (org-insert-property-drawer): Respect org-adapt-indentation when inserting the drawer. (org-remove-flyspell-overlays-in): New function. (org-do-emphasis-faces, org-activate-plain-links) (org-activate-code, org-fontify-meta-lines-and-blocks) (org-activate-angle-links, org-activate-footnote-links) (org-activate-bracket-links, org-activate-dates) (org-activate-target-links, org-activate-tags): Remove flyspell overlays. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-edit-src-save): New function. * org-clock.el (org-clock-out-switch-to-state): New option. (org-clock-out): Honor `org-clock-out-switch-to-state'. * org-compat.el (org-compatible-face): Improve macro. * org.el (org-global-properties-fixed): Add default for CLOCK_MODELINE_TOTAL. * org-clock.el (org-clock-sum): Accept lists and strigs as tstart andd tend. (org-clock-sum-current-item): Optional argument TSTART, pass it to org-clock-sum. (org-clock-get-sum-start): New function. * org.el (org-startup-options): New keywords blockhide and blockshow. (org-mode): Add new invisibility spec. (org-set-startup-visibility): Hide block on startup if so desired. (org-hide-block-startup): New option. (org-block-regexp): New constant. (org-hide-block-overlays): New variable. (org-block-map, org-hide-block-toggle-all, org-hide-block-all) (org-show-block-all, org-hide-block-toggle-maybe) (org-hide-block-toggle): New functions. (org-edit-src-exit): Do not quote lines starting with # and no + behind it. (org-auto-repeat-maybe): Add LAST_REPEAT properter for a repeating entry. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-buffer-property-keys): Add Effort property for completion. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-sum-current-item): Fix positioning bug when retrieving total clocked time in the subtree. * org.el (org-quoting-blocks): New variable. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-store-formulas) (org-table-get-stored-formulas, org-table-fix-formulas) (org-table-edit-formulas, orgtbl-ctrl-c-ctrl-c) (orgtbl-gather-send-defs): Allow indented #+TBLFM line. * org.el (org-fontify-meta-lines, org-ctrl-c-ctrl-c): Allow indented #+TBLFM line. * org-footnote.el (org-footnote-goto-local-insertion-point): Allow indented #+TBLFM line. * org-colview.el (org-dblock-write:columnview): Allow indented #+TBLFM line. * org-colview-xemacs.el (org-dblock-write:columnview): Allow indented #+TBLFM line. * org-clock.el (org-dblock-write:clocktable): Allow indented #+TBLFM line. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-format-source-code-or-example): Make editing indented blocks work correctly. * org.el (org-edit-src-nindent): New variable. (org-edit-src-code, org-edit-fixed-width-region) (org-edit-src-find-region-and-lang, org-edit-src-exit): Make editing indented blocks work correctly. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-replace-src-segments-and-examples): FInd indented blocks. (org-export-format-source-code-or-example): Fix indentation of blocks. (org-export-remove-indentation): New function. (org-export-select-backend-specific-text): Allow backend-specific code to be indented. (org-export-mark-blockquote-verse-center): Allow markers to be indented. * org.el (org-fontify-meta-lines): New function. (org-set-font-lock-defaults): Call the new fontification function. * org-faces.el (org-meta-line): New face (org-block): New face. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-treat-insert-todo-heading-as-state-change) (org-treat-S-cursor-todo-selection-as-state-change): New variables. (org-insert-todo-heading): Honor `org-treat-insert-todo-heading-as-state-change'. (org-shiftright, org-shiftleft): Honor `org-treat-S-cursor-todo-selection-as-state-change'. (org-inhibit-logging): New variable. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-remove-subtree-entries-from-agenda): Reduce range for marker position checking. * org-latex.el (org-export-latex-first-lines): Fix bug when exporting a region. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-push-to-kill-ring): Protect using x-set-selection, because that does not always work. * org-agenda.el (org-agenda-list): Apply the new face `org-agenda-date-today'. * org-faces.el (org-agenda-date-today): New face. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-to-appt): Turn off restriction when creating appointments. * org-latex.el (org-export-latex-low-levels): Fix customization type. * org.el (org-priority, org-shiftup, org-shiftdown): Disable priority commands. * org-agenda.el (org-agenda-priority): Disable priority commands. * org.el (org-enable-priority-commands): New option. * org-colview-xemacs.el (org-columns-compute) (org-columns-number-to-string): Fix problems with empty fields. * org-colview.el (org-columns-compute) (org-columns-number-to-string): Fix problems with empty fields. * org-exp.el (org-export-push-to-kill-ring): New function. (org-export-copy-to-kill-ring): New option. * org-latex.el (org-export-as-latex): Call `org-export-push-to-kill-ring'. * org-exp.el (org-export-show-temporary-export-buffer): New option. * org-latex.el (org-export-as-latex): Use `org-export-show-temporary-export-buffer'. * org-exp.el (org-export-show-temporary-export-buffer): New option. (org-export-push-to-kill-ring): New function. * org-colview.el (org-columns-compile-map): New variable. (org-columns-new, org-columns-compute) (org-columns-number-to-string, org-columns-uncompile-format) (org-columns-compile-format): Implement new operators. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-plist-vars): Add :xml-declaration. * org-list.el (org-update-checkbox-count): Make property dependent. * org.el (org-hierarchical-todo-statistics): New option. (org-update-parent-todo-statistics): Modified to handle recursive statistics. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish): Make this function behave correctly in interactive use when called with a prefix argument. * org.el (org-todo-statistics-hook): New hook. (org-update-parent-todo-statistics): Use new hook. (org-log-into-drawer): New function. (org-add-log-setup): Use the new `org-log-into-drawer' function to determine if we should be logging into a drawer. (org-log-into-drawer): Update docstring. (org-default-properties): Add LOG_INTO_DRAWER as a property. * org-list.el (org-checkbox-statistics-hook): New hook. (org-update-checkbox-count-maybe): Use new hook. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-edit-src-code, org-edit-fixed-width-region): Use a better bufer-generating mechanism. (org-edit-src-find-buffer): New function. * org-icalendar.el (org-print-icalendar-entries): Don't check for archive tag, this is already done by `org-agenda-skip'. data while constructing lost of tags. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-preprocess-apply-macros): Use semicolon as argument separator in macros. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-after-sorting-entries-or-items-hook): New hook. (org-sort-entries-or-items): Run the new hook. (org-after-refile-insert-hook): New hook. (org-refile): Run `org-after-refile-insert-hook'. * org-agenda.el (org-agenda-get-progress): Never take time of day from headline when displaying progress. * org-latex.el (org-export-latex-complex-heading-re): New variable. (org-export-as-latex): Force the correct regexp in the preprocessor buffer. (org-export-latex-set-initial-vars): Set `org-export-latex-complex-heading-re'. * org-agenda.el (org-agenda-start-with-log-mode): New option. (org-agenda-mode): Use `org-agenda-start-with-log-mode'. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-tables-centered): New option. (org-export-latex-tables): Use `org-export-latex-tables-centered'. * org-exp.el (org-export-as-org): New command. (org-export-as-org): New command. * org-publish.el (org-publish-org-to-org): New function. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-yank): Just call `org-yank-generic'. (org-yank-generic): New function, containing the formaer functionality of `org-yank'. * org-latex.el (org-export-latex-not-done-keywords) (org-export-latex-done-keywords): New variables. (org-export-latex-todo-keyword-markup): New option. (org-export-latex-set-initial-vars): Remember the TODO keywords. (org-export-latex-keywords-maybe): Apply the TODO markup. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-infile-export-plist): Add more default macros. (org-export-preprocess-apply-macros): Process macro arguments. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-icalendar.el (org-icalendar-include-todo): New allowedvalue `unblocked'. (org-print-icalendar-entries): Respect the new value of `org-icalendar-include-todo'. * org.el (org-link-try-special-completion) (org-file-complete-link): New functions. (org-insert-link): Add special completion support for some link types. * org-bbdb.el (org-bbdb-complete-link): New function. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-update-checkbox-count): Allow recursive statistics. (org-hierarchical-checkbox-statistics): New option. * org.el (org-cycle): Remove erraneous space character. * org-icalendar.el (org-icalendar-timezone): Initialize from environment. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-autoload): Fix autoloading of ascii export functions. (org-modules): Add org-special-blocks. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-icalendar.el (org-start-icalendar-file): Use the new option. (org-ical-timezone): New option. * org-exp.el (org-export-get-coderef-format): Use the description is present. * org.el (org-sort-entries-or-items): Improve docstring, and make better implementation for time sorting. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-edit-src-persistent-message): New option. (org-edit-src-code, org-edit-fixed-width-region): Use the new option. * org-clock.el (org-clock-insert-selection-line): Fix prefious patch. * org.el (org-edit-src-code, org-edit-fixed-width-region): Use separate buffer instead of indirect buffer to edit source code. (org-edit-src-exit): Make this function work with the new setup. * org-clock.el (org-clock-insert-selection-line): Make sure tasks are properly fontified before shown in the selection menu. * org.el (org-fontify-like-in-org-mode): New function. * org-latex.el (org-export-latex-links): Use the property list to retrieve the default image attributes. * org-exp.el (org-export-plist-vars): Add a new option. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export, org-export-visible): Support ASCII export to buffer (org-export-normalize-links): Do not protect the description if it is explicitly given. * org-list.el (org-reset-checkbox-state-subtree): Moved here from org-checklist.el. (org-reset-checkbox-state-subtree): Call `org-reset-checkbox-state-subtree'. * org-remember.el (org-select-remember-template): For the selection of a valid template. * org-latex.el (org-export-region-as-latex): Supply the force-no-subtree argument. (org-export-as-latex): Provide better limits when exporting the first line. When exporting to string, we still want the first lines. (org-export-latex-first-lines): New argument END, to force the end of the region. (org-export-region-as-latex): Use the property list. (org-export-as-latex): * org-colview-xemacs.el (org-columns-remove-overlays) (org-columns): Fix call to `local-variable-p'. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-after-blockquotes-hook): New hook. (org-export-latex-preprocess): Run the new hook. * org-exp.el (org-export-preprocess-after-blockquote-hook): New hook. (org-export-preprocess-string): Run the new hook. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-macs.el (org-check-external-command): New defsubst. * org.el (org-mode-map): New key for reload. (org-format-latex): Better error message when external programs are not available. * org-agenda.el (org-agenda-mode-map): Bind `org-reload'. * org.el (org-sort-entries-or-items): Explicit sorting function for priorities, needed for XEmacs compatibility. * org-remember.el (org-remember-apply-template): Improve auto-save behavior. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Also protect environments ending in a star. * org-list.el (org-at-item-p): Fix regular expression. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-end-of-subtree): Improve speed. * org-agenda.el (org-agenda-get-timestamps) (org-agenda-get-progress, org-agenda-get-deadlines) (org-agenda-get-scheduled, org-agenda-get-blocks): Optimizations, in particular, wait as long as possible to collect the tags. (org-stuck-projects): Improve docstring. * org.el (org-store-link): No errors when getting custom id before first headline. (org-get-tags-at): Use `org-up-heading-safe' when getting tags. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-prepare-agenda-buffers): Catch a throw to nextfile. * org-protocol.el: Remove dependency on url.el. (org-protocol-unhex-compound, org-protocol-open-source): Remove dependency on url.el. * org-latex.el (org-export-as-pdf): Use `org-latex-to-pdf-process'. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-latex-to-pdf-process): New option. * org-agenda.el (org-agenda-skip-additional-timestamps-same-entry): New option. (org-agenda-get-timestamps): Honor `org-agenda-skip-additional-timestamps-same-entry'. * org-clock.el (org-clock-goto-may-find-recent-task): New option. (org-clock-goto): Find recent task only if `org-clock-goto-may-find-recent-task' allows it. * org-exp.el (org-export-remove-or-extract-drawers): Handle empty drawers, and drawers that are missing the :END: line. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-goto): Go to recently clocked task if no clock is running. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-update-parent-todo-statistics): Check for STATISTICS_FROM property. * org-list.el (org-update-checkbox-count): Check for STATISTICS_FROM property. * org.el (org-tab-first-hook) (org-tab-after-check-for-table-hook) (org-tab-after-check-for-cycling-hook): New hooks. (org-cycle-internal-global, org-cycle-internal-local): New functions, split out from `org-cycle'. (org-cycle): Call the new hooks. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-preprocess-string): Reset the list of preferred targets for each run of the preprocessor. * org.el (org-refile-target-verify-function): Improve documentation. (org-get-refile-targets): Respect point being moved by the verification function. * org-latex.el (org-export-latex-timestamp-keyword-markup): New option. (org-export-latex-keywords): Use new option. * org.el (org-rear-nonsticky-at): New defsubst. (org-activate-plain-links, org-activate-angle-links) (org-activate-footnote-links, org-activate-bracket-links) (org-activate-dates, org-activate-target-links) (org-activate-tags): Place the rear-nonsticky properties at the correct location. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-protocol.el (server-edit): Declare `server-edit'. (org-protocol-unhex-string, org-protocol-unhex-compound): New functions. (org-protocol-check-filename-for-protocol): Call `server-edit'. * org.el (org-default-properties): New default properteis for completion. * org-exp.el (org-export-add-subtree-options): Add new properties for subtree export. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-id.el (org-id-get-with-outline-path-completion): Turn off org-refile-target-verify-function for the duration of the command. * org.el (org-link-to-org-use-id): New possible value `create-if-interactive-and-no-custom-id'. (org-store-link): Use custom IDs. (org-link-search): Find custom ID properties from #link. (org-default-properties): Add CUSTOM_ID for property completion. (org-refile-target-verify-function): New option. (org-goto): Turn off org-refile-target-verify-function for the duration of the command. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-preferred-target-alist): New variable. (org-export-define-heading-targets): Find the new CUSTOM_ID property. (org-export-target-internal-links): Target the custom ids when possible. * org-latex.el (org-export-latex-preprocess): Better regexp for matching latex macros with arguments. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-handler): Allow filing to non-org files. 2009-08-06 Magnus Henoch <magnus.henoch@gmail.com> * org-table.el (org-table-fix-formulas): Do not change references to remote tables. (org-table-get-remote-range): Convert standard coordinates to RC format. * org-latex.el (org-export-latex-keywords): Fix regexp bug. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-compat.el (org-sha1-string): Function removed. * org.el (org-refile-allow-creating-parent-nodes): New option. (org-refile-get-location): New argument NEW-NODES. (org-refile): Call `org-refile-get-location' with the new argument. (org-refile-get-location): Arrange for adding a new child. (org-refile-new-child): New function. * org-clock.el: Fix a number of docstrings. (org-clock-find-position): New argument FIND-UNCLOSED to make the function find an unclosed clock in the entry. (org-clock-in): Call `org-clock-find-position' with the new argument if we might be resuming a clock. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-display-custom-times): New variable. (org-export-latex-timestamp-markup): New option. (org-export-latex-set-initial-vars): Remember the local value of `org-display-custom-times'. (org-export-latex-content): Process time stamps. (org-export-latex-time-stamps): New function. * org-macs.el (org-maybe-intangible): Add intangible property again to invisible text. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-default-export-plist): Handle undefined variables. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-sort-entries-or-items): Match TODO keywrds case-sensitively, when sorting. (org-priority): Do not match TODO keywords with wrong case. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-todo): Honor the NOBLOCKING property. * org-agenda.el (org-agenda-dim-blocked-tasks): Honor the NOBLOCKING property. * org.el (org-scan-tags): Fix bug in tag scanner 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-modules): Mark obsolete packages. * org-html.el: New file, split out from org-exp.el. * org-icalendar.el: New file, split out from org-exp.el. * org-xoxo.el: New file, split out from org-exp.el. * org-ascii.el: New file, split out from org-exp.el. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-compat.el (org-find-library-name): New function. * org.el (org-pre-cycle-hook): New hook. (org-cycle): Call the new hook in appropriate places. (org-reload): Only reload files that have been loaded before. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-set-font-lock-defaults): Enforxe space or line end after todo keyword. (org-todo): When changing TODO state, do matching case-sensitively. (org-map-continue-from): New variable. (org-scan-tags): Respect values in `org-map-continue-from'. (org-reload): Make XEmacs compatible. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-protocol.el (org-protocol-flatten-greedy): New function. (org-protocol-flatten): New function. * org.el (org-open-link-from-string): Pass reference buffer to `org-open-at-point'. (org-open-at-point): New optional argument `reference-buffer'. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-scan-tags): Make tag scan find headline in first line, 2nd attempt. (org-get-refile-targets): Add the naked file name. (org-refile): Store as top-level entry when only file name was given. * org-agenda.el (org-agenda-get-progress): Fix regexp bug. * org.el (org-block-todo-from-children-or-siblings-or-parent): Renamed from org-block-todo-from-children-or-siblings, and enhanced to look for the parent's status as well. * org-agenda.el (org-agenda-log-mode-add-notes): New option. (org-agenda-get-progress): Add first notes line to log entry if so desired. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-cleanup-fancy-diary-hook): New hook. (org-agenda-cleanup-fancy-diary): Call the new hook. * org-remember.el (org-remember-apply-template): Take the default for the annotation from the :annotation property. * org-mac-message.el (org-mac-message-get-link): Remove the quotes. (org-mac-message-get-link): Return the result. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-refile-get-location): Add file name only if not already included in outline path. * org-faces.el (org-n-level-faces): Fix customization type from number to integer. * org-exp.el (org-export-headline-levels): Fix customization type from number to integer. * org-agenda.el (org-agenda-confirm-kill) (org-agenda-custom-commands-local-options) (org-timeline-show-empty-dates, org-agenda-ndays) (org-agenda-start-on-weekday, org-scheduled-past-days): Fix customization type from number to integer. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-protocol.el: Declare some functions. * org-agenda.el (org-agenda-compare-effort): Honor `org-sort-agenda-noeffort-is-high'. (org-agenda-filter-by-tag, org-agenda-filter-make-matcher) (org-agenda-compare-effort): Implement the "?" operator for finding entries without effort setting. * org.el (org-extract-attributes-from-string): New function. * org-exp.el (org-export-splice-attributes): New function. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-mouse.el: XEmacs compatibility fixes * org.el (org-modules): Add org-inlinetasks.el (org-cycle): Implement limiting level on cycling. (org-move-subtree-down): Fix bug with swapping subtrees at end of buffer. * org-inlinetask.el: New file. * org-protocol.el: New file. * org.el (org-emphasis-regexp-components): Allow braces in emphasis pre and post match. * org-footnote.el (org-footnote-normalize): When only dorting, do not insert inline notes at the end. * org.el (org-require-autoloaded-modules): Add org-docbook.el. * org-docbook.el: New file. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-reftex-citation): New command. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-cmp-user-defined): New option. (org-sorting-choice, org-agenda-sorting-strategy): Add the new sorting options. (org-entries-lessp): Apply the new sorting option. * org.el (org-block-todo-from-children-or-siblings): Fix bug in blocker code, when an older sibling has children. * org-mac-message.el (org-mac-message-get-link): Improve getting links from multiple selected messages. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-finalize): Do not set buffer file name to nil. (org-remember-handler): Mark buffer as unmodified. (org-remember-handler): Delete backup file and show message about remaining backup files. (org-remember-auto-remove-backup-files): New option. * org.el (org-store-link): Use buffer name as link description in w3-mode buffers. (org-ido-switchb): Fix argument bug for completion. * org-remember.el (org-remember-apply-template): Set local variable `auto-save-visited-file-name' instead of global one. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-get-todos): Fix bug with match-data. (org-agenda-get-todos): Mark file tags as inherited. (org-agenda-list): Always search diary lines for a time. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-feed.el: New file. * org-exp.el (org-export-as-html): Close local lists depending on indentation, also when starting a table. * org-remember.el (org-remember-backup-directory) (org-remember-backup-name): New internal variable. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-out-if-current): Make buffer detection work in indirect buffers as well. * org.el (org-emphasis-regexp-components): Add the exxclamation mark to the post-emphasis characters. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-read-date-minibiffer-septup-hook): New hook. (org-read-date): Run the new hook. * org-mac-message.el (org-mac-flagged-mail): New group. (org-mac-mail-account): New variable. (org-mac-create-flagged-mail, org-mac-insert-flagged-mail): New commands. * org-remember.el (org-remember-backup-directory): New variable. (org-remember-apply-template): Write file to backup directory. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-mouse.el (org-mouse-todo-menu): New function. (org-mouse-todo-keywords): Function removed. (org-mouse-context-menu): Use `org-mouse-todo-menu'. * org-table.el (org-table-beginning-of-field) (org-table-end-of-field): New commands (org-table-previous-field, org-table-beginning-of-field): Better error messages. (orgtbl-setup): Include `M-a' and `M-e'. * org.el (org-backward-sentence, org-forward-sentence): New commands. * org-colview.el (org-colview-initial-truncate-line-value): New variable. (org-columns-remove-overlays): Restore the value of `truncate-lines'. (org-columns): Remember the value of `truncate-lines'. * org-colview-xemacs.el (org-colview-initial-truncate-line-value): New variable. (org-columns-remove-overlays): Restore the value of `truncate-lines'. (org-columns): Remember the value of `truncate-lines'. * org.el (org-columns-skip-arrchived-trees): New option. * org-agenda.el (org-agenda-export-html-style): Define color for org-agenda-done face. (org-search-view, org-agenda-get-todos, org-agenda-get-progress) (org-agenda-get-deadlines, org-agenda-get-scheduled): Use new face. * org.el (org-scan-tags): Use the new face. * org-faces.el (org-agenda-done): New face. * org.el (org-scan-tags): Test the value org `org-tags-match-list-sublevels'. (org-tags-match-list-sublevels): New allowed value: indented. * org-latex.el (org-export-latex-make-header): Apply macros in header. * org-exp.el (org-export-apply-macros-in-string): New function. * org-latex.el (org-export-latex-list-parameters): Fix bug with the definition of a checked box. * org-clock.el (org-clock-find-position): Fix drawer indentations. * org-latex.el (org-export-latex-low-levels): More options for how to process lower levels in LaTeX. (org-export-latex-subcontent): Better treatment for lists as a means of publishing lower levels. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-set-font-lock-defaults): Use new checkbox face. * org-faces.el (org-checkbox): New face. * org-exp.el (org-export-html-preprocess): Only create LaTeX fragement images if there is an export file. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-stuck-projects): Document that the subtree of projects that are not stuck will now be searched for stuck sub-projects. (org-agenda-skip-entry-when-regexp-matches) (org-agenda-skip-entry-when-regexp-matches-in-subtree): New functions. (org-agenda-list-stuck-projects): Use `org-agenda-skip-entry-when-regexp-matches-in-subtree'. * org-latex.el (org-export-latex-preprocess): Improve export of verses. * org-exp.el (org-export-as-html): Implement centering as a div rather than a paragraph. Do a better job with line-end in verse environments. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-at-point): Fix tags searches by mouse click. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Implement the centering markup. * org-exp.el (org-export-mark-blockquote-verse-center): Renamed from `org-export-mark-blockquote-and-verse'. (org-export-as-html): Implement the centering markup. * org-latex.el (org-export-latex-tables): Fix vertical lines in tables. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-read-date-history): New variable. (org-read-date): Use new history variable. (org-toggle-heading): Fix bug when used before first headline. (org-store-log-note): Remove drawer if empty while note is aborted. (org-remove-empty-drawer-at): New function. (org-check-after-date): New command. (org-sparse-tree): New sparse tree command "a". * org-exp.el (org-export-as-ascii): Improve export of plain lists. 2009-08-06 Bastien Guerry <bzg@altern.org> * org.el (org-toggle-fixed-width-section): Bug fix: insert a column and a space, not only a column. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-emphasis-alist): Better defaults for verbose emphasis. (org-export-latex-emph-format): New function. (org-export-latex-fontify): Call `org-export-latex-emph-format'. * org-agenda.el (org-agenda-menu): Add new commands to menu. (org-agenda-do-date-later, org-agenda-do-date-earlier) (org-agenda-date-later-minutes, org-agenda-date-earlier-minutes) (org-agenda-date-later-hours, org-agenda-date-earlier-hours): New commands. * org.el (org-timestamp-change): Move end-time along with start time. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-target-internal-links) (org-export-as-html): Protect links specified as #name. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-clone-subtree-with-time-shift): New command. * org-latex.el (org-export-latex-special-chars) (org-export-latex-treat-sub-super-char): Fix subscript export. * org-exp.el (org-create-multibrace-regexp): Do not add backslashes to the class. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-colview.el (org-columns-map): Better functions for moving up and down a row, even if `truncate-line' is nil. * org.el (org-insert-todo-heading): Make sure the keyword is inserted at the correct position. * org-publish.el (org-publish-project-alist) (org-publish-projects, org-publish-org-index): Change default anme for the index of file names to "sitemap.org". * org-latex.el (org-export-latex-tables): Use `org-split-string', for Emacs 21 compatibility. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-log-mode-items): Improve docstring. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-page-description) (org-export-page-keywords): New variables. (org-export-plist-vars): Add entries for :keywords and :description. (org-infile-export-plist): Parse for new keywords. (org-get-current-options): Add new keywords (org-export-as-html): Publish description and keywords. * org-agenda.el (org-agenda-add-entry-text-descriptive-links): New option. (org-agenda-add-entry-text): Honor `org-agenda-add-entry-text-descriptive-links'. * org-latex.el (org-export-latex-preprocess): Make all external preprocess functions use a PARAMETER arg. * org-exp.el (org-export-preprocess-string) (org-export-select-backend-specific-text) (org-export-format-source-code-or-example) (org-format-org-table-html): Support docbook export. (org-export-preprocess-string): Make all external preprocess functions use a PARAMETER arg. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-html-style-include-scripts): New option. (org-export-plist-vars): Add new option `org-export-html-style-include-scripts'. (org-export-as-html): Honor new option `org-export-html-style-include-scripts'. (org-export-html-scripts, org-export-html-style-default): Fix xml issues with the Safari browser. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-attachment): Only copy file when the directories differ. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clocktable-steps): Use inactive time stamps for clocktable steps. * org.el (org-additional-option-like-keywords): Add two more keywords. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-format-source-code-or-example): Mark temporary buffer unmodified, so that it will be killed even if mode like message mode has decided to assign a file name. * org.el (org-scan-tags): Improve tag inheritance. (org-scan-tags, org-make-tags-matcher): Make tag comparison case-sensitive. (org-scan-tags): Use the internal tags list instead of creating it from scratch. (org-trust-scanner-tags, org-scanner-tags): New variables. (org-scan-tags): Set `org-scanner-tags'. (org-get-tags-at): Take advantage of `org-trust-scanner-tags'. (org-map-entries): Document the possible speedup using scanner tags. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-add-planning-info): Fix bug with looking for keyword only at column 0. * org-agenda.el (org-agenda-custom-commands-local-options): Add option for tags filter preset. (org-prepare-agenda): Store filter preset as a property on the filter variable. (org-finalize-agenda): Call the filter, if there is a preset. (org-agenda-filter-by-tag): Filter again after clearing the filter, when there still is a preset. (org-agenda-filter-make-matcher, org-agenda-set-mode-name): Include the preset filter. (org-agenda-redo): Apply the filter again, also the preset filter. * org-exp.el (org-export-as-html): Use IDs in the correct way. * org.el (org-uuidgen-p): New funtion. * org-agenda.el (org-agenda-fontify-priorities): New default value `cookies'. (org-agenda-fontify-priorities): Renamed from org-fontify-priorities. * org.el (org-set-font-lock-defaults): Call `org-font-lock-add-priority-faces'. (org-font-lock-add-priority-faces): New function. * org-faces.el: (org-set-tag-faces): New option. (org-priority-faces): New variable. * org-exp.el (org-export-as-html): Add a "content" div around the entire content of the body tag. (org-export-html-get-bibliography): New function. (org-export-html-validation-link): New variable. (org-export-as-html): Add validation link to exported page. * org.el (org-match-sparse-tree): Renamed from `org-tags-sparse-tree'. (org-tags-sparse-tree): New alias. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-get-valid-level): Catch the case where the level change is nil. * org-clock.el (org-clock-find-position): Better indentation of new clock drawers. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-quit): Delete window only when the frame-setup was not `current-window'. * org.el (org-tag-persistent-alist): New option. (org-startup-options): Add keyword `noptag'. (org-fast-todo-selection): Handle :newline correctly. (org-set-tags): Handle :newline correctly. (org-fast-tag-selection): Handle :newline correctly. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-as-ascii): Reverse link buffer before outputting it. (org-export-ascii-push-links): Fix bug with pussing links into the export buffer. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-archive.el (org-archive-subtree): Do not add 1 to level if pasting at top level. * org-bbdb.el: Improve documentation. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-insert-item): Only consider insert empty lines is `org-empty-line-terminates-plain-lists' is not nil. * org.el (org-blank-before-new-entry): Mention the dependence on `org-empty-line-terminates-plain-lists' in the docstring. * org-publish.el (org-publish-get-project-from-filename): New optional argument UP. Only find the top project if UP is set. (org-publish-current-project): Find the top encloding project. * org-agenda.el (org-agenda-before-write-hook) (org-agenda-add-entry-text-maxlines): New options. (org-write-agenda): Run the new hook in the temporary buffer. (org-agenda-add-entry-text): New function. (org-write-agenda): Implement PDF export, using ps2pdf. * org.el (org-global-properties-fixed, org-global-properties): Improve documentation string. * org-exp.el (org-export-ascii-links-to-notes): New option. (org-export-as-ascii): Handle links better. (org-export-ascii-wrap, org-export-ascii-push-links): New functions. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda): Make prefix arg optional. (org-agenda-search-headline-for-time): New option. (org-format-agenda-item): Honor `org-agenda-search-headline-for-time'. * org-table.el (orgtbl-self-insert-command): Cluster undo for 20 characters. * org.el (org-self-insert-cluster-for-undo): New option. (org-self-insert-command): Cluster undo for 20 characters. (org-self-insert-command-undo-counter): New variable. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-as-html): Fix problem with closing colone example. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-as-latex) (org-export-latex-first-lines): Avoid modification flag when adding or removing text properties. (org-export-latex-fontify): Catch error when org-emph-alist has entries that are not defined for LaTeX export. * org-export-latex.el: renamed to org-latex.el * org-latex.el: renamed from org-export-latex.el * org.el (orgstruct++-mode): New function. (turn-on-orgstruct++): Call `orgstruct++-mode'. (org-context-p): Allow detecting item context after the first line of an item. (orgstruct-make-binding): Detect if item-body context should be seen. (orgstruct-is-++): New variable. (org-add-planning-info): Catch the case when there is no planning info yet and the call does not want to add anything, only maybe tries to remove something. (org-special-ctrl-a/e): All value to be a cons cell with separate settings for `C-a. and `C-e'. (org-beginning-of-line, org-end-of-line): Honor separate values for `C-a' and `C-e'. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-reload): New command. 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com> * org.texi (Publishing action): Improve documentation of file names when publishing to the source directory. (Clean view): Document `org-indent-mode'. (Clocking work time): Add documentation for the new :timetamp option when creating a clock report. (Paragraphs): Fix many typos. (Plain lists): Remove duplicate explanation about the `C-c *' command. (Literal examples): Update to reflect the new behavior of the -n -r -k switches when exporting source code examples. (Structure editing): Add information about `C-c *', converting a plain list into a list of Org items. (Remember): Small rephrasing of the paragraph describing remember.el. Also mentioned that remember.el is part of Emacs 23, not Emacs 22. (Clocking work time): Add documentation about displaying the current clocking time against the effort estimate. Also add a footnote about using `org-clock-in-prepare-hook' to add an effort estimate on the fly, just before clocking it. (Footnotes): Document automatic renumbering and sorting. (Agenda commands): Document new bulk commands. (Plain lists): Document new behavior of `org-cycle-include-plain-lists'. Hyphenation only in TeX. (Clocking work time): Document the key to update effort estimates. (Clocking work time): Document the clock time display. (Structure editing, TODO basics): Document new variables. (Column attributes): Document new colciew operators. (Publishing options): Document :xml-declaration. (Tracking TODO state changes): Document the LOG_INTO_DRAWER property. (Literal examples): Document the new implementation for editing source code. (Publishing action): Mention the new publishing function, to publish an Org source file. (Publishing links): Mention how to link to an Org source file. (Macro replacement): Document new macros. (Handling links): Document type-specific completion when inserting links. (Structure editing, Plain lists): Improve documentation on sorting. (Internal links): Document custom ids for links. (Handling links): Document custom ids for links. (CSS support): Document new class. (Refiling notes): Document the possibility to create new nodes during refiling. (Agenda commands): Document the "?" operator to find tasks without effort setting. (Exporting agenda information): Section moved. (RSS Feeds): New section. (Built-in table editor): Document M-e and M-a navigate inside table field. (Stuck projects): Docment that projects identified as un-stuck will still be searchd for stuck sub-projects. (Paragraphs): Document centering. (Creating timestamps, Agenda commands): Document new behavior when changing time stamps. (Structure editing): Document the new command `org-clone-subtree-with-time-shift'. (Publishing): Refresh this chapter. (Export options, Export options, In-buffer settings): Document the new keywords. (Matching tags and properties): Collect all documentation about tags/property matches here. (Setting tags): Document `org-tag-persistent-alist'. (Weekly/daily agenda): New section. (Orgstruct mode): Describe `orgstruct++-mode'. (Drawers): Mention the LOGBOOK drawer. (Export options, Sectioning structure): Document the #+LEATEX_HEADER in-buffer setting. (Bugs): Section removed. (Hooks): New section. (Add-on packages): Moved here from old location. (Context-sensitive commands): New section. (Setting tags): Document newline option. (Global TODO list, Matching tags and properties): Mention more variables. (Checkboxes): Update to changed command behavior.
author Carsten Dominik <dominik@science.uva.nl>
date Thu, 06 Aug 2009 09:14:10 +0000
parents 9bcea07061a8
children b99b3dda298b
line wrap: on
line source

\input texinfo

@setfilename ../../info/emacs-mime
@settitle Emacs MIME Manual
@synindex fn cp
@synindex vr cp
@synindex pg cp

@copying
This file documents the Emacs MIME interface functionality.

Copyright @copyright{} 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.

@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
and with the Back-Cover Texts as in (a) below.  A copy of the license
is included in the section entitled ``GNU Free Documentation License''.

(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
modify this GNU manual.  Buying copies from the FSF supports it in
developing GNU and promoting software freedom.''
@end quotation
@end copying

@c Node ``Interface Functions'' uses Latin-1 characters
@documentencoding ISO-8859-1

@dircategory Emacs
@direntry
* Emacs MIME: (emacs-mime).   Emacs MIME de/composition library.
@end direntry
@iftex
@finalout
@end iftex
@setchapternewpage odd

@titlepage
@title Emacs MIME Manual

@author by Lars Magne Ingebrigtsen
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage

@contents

@node Top
@top Emacs MIME

This manual documents the libraries used to compose and display
@acronym{MIME} messages.

This manual is directed at users who want to modify the behavior of
the @acronym{MIME} encoding/decoding process or want a more detailed
picture of how the Emacs @acronym{MIME} library works, and people who want
to write functions and commands that manipulate @acronym{MIME} elements.

@acronym{MIME} is short for @dfn{Multipurpose Internet Mail Extensions}.
This standard is documented in a number of RFCs; mainly RFC2045 (Format
of Internet Message Bodies), RFC2046 (Media Types), RFC2047 (Message
Header Extensions for Non-@acronym{ASCII} Text), RFC2048 (Registration
Procedures), RFC2049 (Conformance Criteria and Examples).  It is highly
recommended that anyone who intends writing @acronym{MIME}-compliant software
read at least RFC2045 and RFC2047.

@ifnottex
@insertcopying
@end ifnottex

@menu
* Decoding and Viewing::  A framework for decoding and viewing.
* Composing::             @acronym{MML}; a language for describing @acronym{MIME} parts.
* Interface Functions::   An abstraction over the basic functions.
* Basic Functions::       Utility and basic parsing functions.
* Standards::             A summary of RFCs and working documents used.
* GNU Free Documentation License:: The license for this documentation.
* Index::                 Function and variable index.
@end menu


@node Decoding and Viewing
@chapter Decoding and Viewing

This chapter deals with decoding and viewing @acronym{MIME} messages on a
higher level.

The main idea is to first analyze a @acronym{MIME} article, and then allow
other programs to do things based on the list of @dfn{handles} that are
returned as a result of this analysis.

@menu
* Dissection::             Analyzing a @acronym{MIME} message.
* Non-MIME::               Analyzing a non-@acronym{MIME} message.
* Handles::                Handle manipulations.
* Display::                Displaying handles.
* Display Customization::  Variables that affect display.
* Files and Directories::  Saving and naming attachments.
* New Viewers::            How to write your own viewers.
@end menu


@node Dissection
@section Dissection

The @code{mm-dissect-buffer} is the function responsible for dissecting
a @acronym{MIME} article.  If given a multipart message, it will recursively
descend the message, following the structure, and return a tree of
@acronym{MIME} handles that describes the structure of the message.

@node Non-MIME
@section Non-MIME
@vindex mm-uu-configure-list

Gnus also understands some non-@acronym{MIME} attachments, such as
postscript, uuencode, binhex, yenc, shar, forward, gnatsweb, pgp,
diff.  Each of these features can be disabled by add an item into
@code{mm-uu-configure-list}.  For example,

@lisp
(require 'mm-uu)
(add-to-list 'mm-uu-configure-list '(pgp-signed . disabled))
@end lisp

@table @code
@item postscript
@findex postscript
PostScript file.

@item uu
@findex uu
Uuencoded file.

@item binhex
@findex binhex
Binhex encoded file.

@item yenc
@findex yenc
Yenc encoded file.

@item shar
@findex shar
Shar archive file.

@item forward
@findex forward
Non-@acronym{MIME} forwarded message.

@item gnatsweb
@findex gnatsweb
Gnatsweb attachment.

@item pgp-signed
@findex pgp-signed
@acronym{PGP} signed clear text.

@item pgp-encrypted
@findex pgp-encrypted
@acronym{PGP} encrypted clear text.

@item pgp-key
@findex pgp-key
@acronym{PGP} public keys.

@item emacs-sources
@findex emacs-sources
@vindex mm-uu-emacs-sources-regexp
Emacs source code.  This item works only in the groups matching
@code{mm-uu-emacs-sources-regexp}.

@item diff
@vindex diff
@vindex mm-uu-diff-groups-regexp
Patches.  This is intended for groups where diffs of committed files
are automatically sent to.  It only works in groups matching
@code{mm-uu-diff-groups-regexp}.

@item verbatim-marks
@cindex verbatim-marks
Slrn-style verbatim marks.

@item LaTeX
@cindex LaTeX
LaTeX documents.  It only works in groups matching
@code{mm-uu-tex-groups-regexp}.

@end table

@cindex text/x-verbatim
@c Is @vindex suitable for a face?
@vindex mm-uu-extract
Some inlined non-@acronym{MIME} attachments are displayed using the face
@code{mm-uu-extract}.  By default, no @acronym{MIME} button for these
parts is displayed.  You can force displaying a button using @kbd{K b}
(@code{gnus-summary-display-buttonized}) or add @code{text/x-verbatim}
to @code{gnus-buttonized-mime-types}, @xref{MIME Commands, ,MIME
Commands, gnus, Gnus Manual}.

@node Handles
@section Handles

A @acronym{MIME} handle is a list that fully describes a @acronym{MIME}
component.

The following macros can be used to access elements in a handle:

@table @code
@item mm-handle-buffer
@findex mm-handle-buffer
Return the buffer that holds the contents of the undecoded @acronym{MIME}
part.

@item mm-handle-type
@findex mm-handle-type
Return the parsed @code{Content-Type} of the part.

@item mm-handle-encoding
@findex mm-handle-encoding
Return the @code{Content-Transfer-Encoding} of the part.

@item mm-handle-undisplayer
@findex mm-handle-undisplayer
Return the object that can be used to remove the displayed part (if it
has been displayed).

@item mm-handle-set-undisplayer
@findex mm-handle-set-undisplayer
Set the undisplayer object.

@item mm-handle-disposition
@findex mm-handle-disposition
Return the parsed @code{Content-Disposition} of the part.

@item mm-get-content-id
Returns the handle(s) referred to by @code{Content-ID}.

@end table


@node Display
@section Display

Functions for displaying, removing and saving.

@table @code
@item mm-display-part
@findex mm-display-part
Display the part.

@item mm-remove-part
@findex mm-remove-part
Remove the part (if it has been displayed).

@item mm-inlinable-p
@findex mm-inlinable-p
Say whether a @acronym{MIME} type can be displayed inline.

@item mm-automatic-display-p
@findex mm-automatic-display-p
Say whether a @acronym{MIME} type should be displayed automatically.

@item mm-destroy-part
@findex mm-destroy-part
Free all resources occupied by a part.

@item mm-save-part
@findex mm-save-part
Offer to save the part in a file.

@item mm-pipe-part
@findex mm-pipe-part
Offer to pipe the part to some process.

@item mm-interactively-view-part
@findex mm-interactively-view-part
Prompt for a mailcap method to use to view the part.

@end table


@node Display Customization
@section Display Customization

@table @code

@item mm-inline-media-tests
@vindex mm-inline-media-tests
This is an alist where the key is a @acronym{MIME} type, the second element
is a function to display the part @dfn{inline} (i.e., inside Emacs), and
the third element is a form to be @code{eval}ed to say whether the part
can be displayed inline.

This variable specifies whether a part @emph{can} be displayed inline,
and, if so, how to do it.  It does not say whether parts are
@emph{actually} displayed inline.

@item mm-inlined-types
@vindex mm-inlined-types
This, on the other hand, says what types are to be displayed inline, if
they satisfy the conditions set by the variable above.  It's a list of
@acronym{MIME} media types.

@item mm-automatic-display
@vindex mm-automatic-display
This is a list of types that are to be displayed ``automatically'', but
only if the above variable allows it.  That is, only inlinable parts can
be displayed automatically.

@item mm-automatic-external-display
@vindex mm-automatic-external-display
This is a list of types that will be displayed automatically in an
external viewer.

@item mm-keep-viewer-alive-types
@vindex mm-keep-viewer-alive-types
This is a list of media types for which the external viewer will not
be killed when selecting a different article.

@item mm-attachment-override-types
@vindex mm-attachment-override-types
Some @acronym{MIME} agents create parts that have a content-disposition of
@samp{attachment}.  This variable allows overriding that disposition and
displaying the part inline.  (Note that the disposition is only
overridden if we are able to, and want to, display the part inline.)

@item mm-discouraged-alternatives
@vindex mm-discouraged-alternatives
List of @acronym{MIME} types that are discouraged when viewing
@samp{multipart/alternative}.  Viewing agents are supposed to view the
last possible part of a message, as that is supposed to be the richest.
However, users may prefer other types instead, and this list says what
types are most unwanted.  If, for instance, @samp{text/html} parts are
very unwanted, and @samp{text/richtext} parts are somewhat unwanted,
you could say something like:

@lisp
(setq mm-discouraged-alternatives
      '("text/html" "text/richtext")
      mm-automatic-display
      (remove "text/html" mm-automatic-display))
@end lisp

Adding @code{"image/.*"} might also be useful.  Spammers use images as
the preferred part of @samp{multipart/alternative} messages, so you might
not notice there are other parts.  See also
@code{gnus-buttonized-mime-types}, @ref{MIME Commands, ,MIME Commands,
gnus, Gnus Manual}.  After adding @code{"multipart/alternative"} to
@code{gnus-buttonized-mime-types} you can choose manually which
alternative you'd like to view.  For example, you can set those
variables like:

@lisp
(setq gnus-buttonized-mime-types
      '("multipart/alternative" "multipart/signed")
      mm-discouraged-alternatives
      '("text/html" "image/.*"))
@end lisp

In this case, Gnus will display radio buttons for such a kind of spam
message as follows:

@example
1.  (*) multipart/alternative  ( ) image/gif

2.  (*) text/plain          ( ) text/html
@end example

@item mm-inline-large-images
@vindex mm-inline-large-images
When displaying inline images that are larger than the window, Emacs
does not enable scrolling, which means that you cannot see the whole
image.  To prevent this, the library tries to determine the image size
before displaying it inline, and if it doesn't fit the window, the
library will display it externally (e.g. with @samp{ImageMagick} or
@samp{xv}).  Setting this variable to @code{t} disables this check and
makes the library display all inline images as inline, regardless of
their size.

@item mm-inline-override-types
@vindex mm-inline-override-types
@code{mm-inlined-types} may include regular expressions, for example to
specify that all @samp{text/.*} parts be displayed inline.  If a user
prefers to have a type that matches such a regular expression be treated
as an attachment, that can be accomplished by setting this variable to a
list containing that type.  For example assuming @code{mm-inlined-types}
includes @samp{text/.*}, then including @samp{text/html} in this
variable will cause @samp{text/html} parts to be treated as attachments.

@item mm-text-html-renderer
@vindex mm-text-html-renderer
This selects the function used to render @acronym{HTML}.  The predefined
renderers are selected by the symbols @code{w3},
@code{w3m}@footnote{See @uref{http://emacs-w3m.namazu.org/} for more
information about emacs-w3m}, @code{links}, @code{lynx},
@code{w3m-standalone} or @code{html2text}.  If @code{nil} use an
external viewer.  You can also specify a function, which will be
called with a @acronym{MIME} handle as the argument.

@item mm-inline-text-html-with-images
@vindex mm-inline-text-html-with-images
Some @acronym{HTML} mails might have the trick of spammers using
@samp{<img>} tags.  It is likely to be intended to verify whether you
have read the mail.  You can prevent your personal informations from
leaking by setting this option to @code{nil} (which is the default).
It is currently ignored by Emacs/w3.  For emacs-w3m, you may use the
command @kbd{t} on the image anchor to show an image even if it is
@code{nil}.@footnote{The command @kbd{T} will load all images.  If you
have set the option @code{w3m-key-binding} to @code{info}, use @kbd{i}
or @kbd{I} instead.}

@item mm-w3m-safe-url-regexp
@vindex mm-w3m-safe-url-regexp
A regular expression that matches safe URL names, i.e. URLs that are
unlikely to leak personal information when rendering @acronym{HTML}
email (the default value is @samp{\\`cid:}).  If @code{nil} consider
all URLs safe.

@item mm-inline-text-html-with-w3m-keymap
@vindex mm-inline-text-html-with-w3m-keymap
You can use emacs-w3m command keys in the inlined text/html part by
setting this option to non-@code{nil}.  The default value is @code{t}.

@item mm-external-terminal-program
@vindex mm-external-terminal-program
The program used to start an external terminal.

@item mm-enable-external
@vindex mm-enable-external
Indicate whether external @acronym{MIME} handlers should be used.

If @code{t}, all defined external @acronym{MIME} handlers are used.  If
@code{nil}, files are saved to disk (@code{mailcap-save-binary-file}).
If it is the symbol @code{ask}, you are prompted before the external
@acronym{MIME} handler is invoked.

When you launch an attachment through mailcap (@pxref{mailcap}) an
attempt is made to use a safe viewer with the safest options---this isn't
the case if you save it to disk and launch it in a different way
(command line or double-clicking).  Anyhow, if you want to be sure not
to launch any external programs, set this variable to @code{nil} or
@code{ask}.

@end table

@node Files and Directories
@section Files and Directories

@table @code

@item mm-default-directory
@vindex mm-default-directory
The default directory for saving attachments.  If @code{nil} use
@code{default-directory}.

@item mm-tmp-directory
@vindex mm-tmp-directory
Directory for storing temporary files.

@item mm-file-name-rewrite-functions
@vindex mm-file-name-rewrite-functions
A list of functions used for rewriting file names of @acronym{MIME}
parts.  Each function is applied successively to the file name.
Ready-made functions include

@table @code
@item mm-file-name-delete-control
@findex mm-file-name-delete-control
Delete all control characters.

@item mm-file-name-delete-gotchas
@findex mm-file-name-delete-gotchas
Delete characters that could have unintended consequences when used
with flawed shell scripts, i.e. @samp{|}, @samp{>} and @samp{<}; and
@samp{-}, @samp{.} as the first character.

@item mm-file-name-delete-whitespace
@findex mm-file-name-delete-whitespace
Remove all whitespace.

@item mm-file-name-trim-whitespace
@findex mm-file-name-trim-whitespace
Remove leading and trailing whitespace.

@item mm-file-name-collapse-whitespace
@findex mm-file-name-collapse-whitespace
Collapse multiple whitespace characters.

@item mm-file-name-replace-whitespace
@findex mm-file-name-replace-whitespace
@vindex mm-file-name-replace-whitespace
Replace whitespace with underscores.  Set the variable
@code{mm-file-name-replace-whitespace} to any other string if you do
not like underscores.
@end table

The standard Emacs functions @code{capitalize}, @code{downcase},
@code{upcase} and @code{upcase-initials} might also prove useful.

@item mm-path-name-rewrite-functions
@vindex mm-path-name-rewrite-functions
List of functions used for rewriting the full file names of @acronym{MIME}
parts.  This is used when viewing parts externally, and is meant for
transforming the absolute name so that non-compliant programs can find
the file where it's saved.

@end table

@node New Viewers
@section New Viewers

Here's an example viewer for displaying @code{text/enriched} inline:

@lisp
(defun mm-display-enriched-inline (handle)
  (let (text)
    (with-temp-buffer
      (mm-insert-part handle)
      (save-window-excursion
        (enriched-decode (point-min) (point-max))
        (setq text (buffer-string))))
    (mm-insert-inline handle text)))
@end lisp

We see that the function takes a @acronym{MIME} handle as its parameter.  It
then goes to a temporary buffer, inserts the text of the part, does some
work on the text, stores the result, goes back to the buffer it was
called from and inserts the result.

The two important helper functions here are @code{mm-insert-part} and
@code{mm-insert-inline}.  The first function inserts the text of the
handle in the current buffer.  It handles charset and/or content
transfer decoding.  The second function just inserts whatever text you
tell it to insert, but it also sets things up so that the text can be
``undisplayed'' in a convenient manner.


@node Composing
@chapter Composing
@cindex Composing
@cindex MIME Composing
@cindex MML
@cindex MIME Meta Language

Creating a @acronym{MIME} message is boring and non-trivial.  Therefore,
a library called @code{mml} has been defined that parses a language
called @acronym{MML} (@acronym{MIME} Meta Language) and generates
@acronym{MIME} messages.

@findex mml-generate-mime
The main interface function is @code{mml-generate-mime}.  It will
examine the contents of the current (narrowed-to) buffer and return a
string containing the @acronym{MIME} message.

@menu
* Simple MML Example::             An example @acronym{MML} document.
* MML Definition::                 All valid @acronym{MML} elements.
* Advanced MML Example::           Another example @acronym{MML} document.
* Encoding Customization::         Variables that affect encoding.
* Charset Translation::            How charsets are mapped from @sc{mule} to @acronym{MIME}.
* Conversion::                     Going from @acronym{MIME} to @acronym{MML} and vice versa.
* Flowed text::                    Soft and hard newlines.
@end menu


@node Simple MML Example
@section Simple MML Example

Here's a simple @samp{multipart/alternative}:

@example
<#multipart type=alternative>
This is a plain text part.
<#part type=text/enriched>
<center>This is a centered enriched part</center>
<#/multipart>
@end example

After running this through @code{mml-generate-mime}, we get this:

@example
Content-Type: multipart/alternative; boundary="=-=-="


--=-=-=


This is a plain text part.

--=-=-=
Content-Type: text/enriched


<center>This is a centered enriched part</center>

--=-=-=--
@end example


@node MML Definition
@section MML Definition

The @acronym{MML} language is very simple.  It looks a bit like an SGML
application, but it's not.

The main concept of @acronym{MML} is the @dfn{part}.  Each part can be of a
different type or use a different charset.  The way to delineate a part
is with a @samp{<#part ...>} tag.  Multipart parts can be introduced
with the @samp{<#multipart ...>} tag.  Parts are ended by the
@samp{<#/part>} or @samp{<#/multipart>} tags.  Parts started with the
@samp{<#part ...>} tags are also closed by the next open tag.

There's also the @samp{<#external ...>} tag.  These introduce
@samp{external/message-body} parts.

Each tag can contain zero or more parameters on the form
@samp{parameter=value}.  The values may be enclosed in quotation marks,
but that's not necessary unless the value contains white space.  So
@samp{filename=/home/user/#hello$^yes} is perfectly valid.

The following parameters have meaning in @acronym{MML}; parameters that have no
meaning are ignored.  The @acronym{MML} parameter names are the same as the
@acronym{MIME} parameter names; the things in the parentheses say which
header it will be used in.

@table @samp
@item type
The @acronym{MIME} type of the part (@code{Content-Type}).

@item filename
Use the contents of the file in the body of the part
(@code{Content-Disposition}).

@item charset
The contents of the body of the part are to be encoded in the character
set specified (@code{Content-Type}). @xref{Charset Translation}.

@item name
Might be used to suggest a file name if the part is to be saved
to a file (@code{Content-Type}).

@item disposition
Valid values are @samp{inline} and @samp{attachment}
(@code{Content-Disposition}).

@item encoding
Valid values are @samp{7bit}, @samp{8bit}, @samp{quoted-printable} and
@samp{base64} (@code{Content-Transfer-Encoding}). @xref{Charset
Translation}.

@item description
A description of the part (@code{Content-Description}).

@item creation-date
RFC822 date when the part was created (@code{Content-Disposition}).

@item modification-date
RFC822 date when the part was modified (@code{Content-Disposition}).

@item read-date
RFC822 date when the part was read (@code{Content-Disposition}).

@item recipients
Who to encrypt/sign the part to.  This field is used to override any
auto-detection based on the To/CC headers.

@item sender
Identity used to sign the part.  This field is used to override the
default key used.

@item size
The size (in octets) of the part (@code{Content-Disposition}).

@item sign
What technology to sign this @acronym{MML} part with (@code{smime}, @code{pgp}
or @code{pgpmime})

@item encrypt
What technology to encrypt this @acronym{MML} part with (@code{smime},
@code{pgp} or @code{pgpmime})

@end table

Parameters for @samp{text/plain}:

@table @samp
@item format
Formatting parameter for the text, valid values include @samp{fixed}
(the default) and @samp{flowed}.  Normally you do not specify this
manually, since it requires the textual body to be formatted in a
special way described in RFC 2646.  @xref{Flowed text}.
@end table

Parameters for @samp{application/octet-stream}:

@table @samp
@item type
Type of the part; informal---meant for human readers
(@code{Content-Type}).
@end table

Parameters for @samp{message/external-body}:

@table @samp
@item access-type
A word indicating the supported access mechanism by which the file may
be obtained.  Values include @samp{ftp}, @samp{anon-ftp}, @samp{tftp},
@samp{localfile}, and @samp{mailserver}.  (@code{Content-Type}.)

@item expiration
The RFC822 date after which the file may no longer be fetched.
(@code{Content-Type}.)

@item size
The size (in octets) of the file.  (@code{Content-Type}.)

@item permission
Valid values are @samp{read} and @samp{read-write}
(@code{Content-Type}).

@end table

Parameters for @samp{sign=smime}:

@table @samp

@item keyfile
File containing key and certificate for signer.

@end table

Parameters for @samp{encrypt=smime}:

@table @samp

@item certfile
File containing certificate for recipient.

@end table


@node Advanced MML Example
@section Advanced MML Example

Here's a complex multipart message.  It's a @samp{multipart/mixed} that
contains many parts, one of which is a @samp{multipart/alternative}.

@example
<#multipart type=mixed>
<#part type=image/jpeg filename=~/rms.jpg disposition=inline>
<#multipart type=alternative>
This is a plain text part.
<#part type=text/enriched name=enriched.txt>
<center>This is a centered enriched part</center>
<#/multipart>
This is a new plain text part.
<#part disposition=attachment>
This plain text part is an attachment.
<#/multipart>
@end example

And this is the resulting @acronym{MIME} message:

@example
Content-Type: multipart/mixed; boundary="=-=-="


--=-=-=



--=-=-=
Content-Type: image/jpeg;
 filename="~/rms.jpg"
Content-Disposition: inline;
 filename="~/rms.jpg"
Content-Transfer-Encoding: base64

/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/wAALCAAwADABAREA/8QAHwAA
AQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQR
BRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RF
RkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ip
qrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9oACAEB
AAA/AO/rifFHjldNuGsrDa0qcSSHkA+gHrXKw+LtWLrMb+RgTyhbr+HSug07xNqV9fQtZrNI
AyiaE/NuBPOOOP0rvRNE880KOC8TbXXGCv1FPqjrF4LDR7u5L7SkTFT/ALWOP1xXgTuXfc7E
sx6nua6rwp4IvvEM8chCxWxOdzn7wz6V9AaB4S07w9p5itow0rDLSY5Pt9K43xO66P4xs71m
2QXiGCbA4yOVJ9+1aYORkdK434lyNH4ahCnG66VT9Nj15JFbPdX0MS43M4VQf5/yr2vSpLnw
5ZW8dlCZ8KFXjOPX0/mK6rSPEGt3Angu44fNEReHYNvIH3TzXDeKNO8RX+kSX2ouZkicTIOc
L+g7E810ulFjpVtv3bwgB3HJyK5L4quY/C9sVxk3ij/xx6850u7t1mtp/wDlpEw3An3Jr3Dw
34gsbWza4nBlhC5LDsaW6+IFgupQyCF3iHH7gA7c9R9ay7zx6t7aX9jHC4smhfBkGCvHGfrm
tLQ7hbnRrV1GPkAP1x1/Hr+Ncr8Vzjwrbf8AX6v/AKA9eQRyYlQk8Yx9K6XTNbkgia2ciSIn
7p5Ga9Atte0LTLKO6it4i7dVRFJDcZ4PvXN+JvEMF9bILVGXJLSZ4zkjivRPDaeX4b08HOTC
pOffmua+KkbS+GLVUGT9tT/0B68eeIpIFYjB70+OOVXyoOM9+M1eaWeCLzHPyHGO/NVWvJJm
jQ8KGH1NfQWhXSXmh2c8eArRLwO3HSv/2Q==

--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="


--==-=-=


This is a plain text part.

--==-=-=
Content-Type: text/enriched;
 name="enriched.txt"


<center>This is a centered enriched part</center>

--==-=-=--

--=-=-=

This is a new plain text part.

--=-=-=
Content-Disposition: attachment


This plain text part is an attachment.

--=-=-=--
@end example

@node Encoding Customization
@section Encoding Customization

@table @code

@item mm-body-charset-encoding-alist
@vindex mm-body-charset-encoding-alist
Mapping from @acronym{MIME} charset to encoding to use.  This variable is
usually used except, e.g., when other requirements force a specific
encoding (digitally signed messages require 7bit encodings).  The
default is

@lisp
((iso-2022-jp . 7bit)
 (iso-2022-jp-2 . 7bit)
 (utf-16 . base64)
 (utf-16be . base64)
 (utf-16le . base64))
@end lisp

As an example, if you do not want to have ISO-8859-1 characters
quoted-printable encoded, you may add @code{(iso-8859-1 . 8bit)} to
this variable.  You can override this setting on a per-message basis
by using the @code{encoding} @acronym{MML} tag (@pxref{MML Definition}).

@item mm-coding-system-priorities
@vindex mm-coding-system-priorities
Prioritize coding systems to use for outgoing messages.  The default
is @code{nil}, which means to use the defaults in Emacs, but is
@code{(iso-8859-1 iso-2022-jp iso-2022-jp-2 shift_jis utf-8)} when
running Emacs in the Japanese language environment.  It is a list of
coding system symbols (aliases of coding systems are also allowed, use
@kbd{M-x describe-coding-system} to make sure you are specifying correct
coding system names).  For example, if you have configured Emacs
to prefer UTF-8, but wish that outgoing messages should be sent in
ISO-8859-1 if possible, you can set this variable to
@code{(iso-8859-1)}.  You can override this setting on a per-message
basis by using the @code{charset} @acronym{MML} tag (@pxref{MML Definition}).

As different hierarchies prefer different charsets, you may want to set
@code{mm-coding-system-priorities} according to the hierarchy in Gnus.
Here's an example:

@c Corrections about preferred charsets are welcome.  de, fr and fj
@c should be correct, I don't know about the rest (so these are only
@c examples):
@lisp
(add-to-list 'gnus-newsgroup-variables 'mm-coding-system-priorities)
(setq gnus-parameters
      (nconc
       ;; Some charsets are just examples!
       '(("^cn\\." ;; Chinese
          (mm-coding-system-priorities
           '(iso-8859-1 cn-big5 chinese-iso-7bit utf-8)))
         ("^cz\\.\\|^pl\\." ;; Central and Eastern European
          (mm-coding-system-priorities '(iso-8859-2 utf-8)))
         ("^de\\." ;; German language
          (mm-coding-system-priorities '(iso-8859-1 iso-8859-15 utf-8)))
         ("^fr\\." ;; French
          (mm-coding-system-priorities '(iso-8859-15 iso-8859-1 utf-8)))
         ("^fj\\." ;; Japanese
          (mm-coding-system-priorities
           '(iso-8859-1 iso-2022-jp iso-2022-jp-2 shift_jis utf-8)))
         ("^ru\\." ;; Cyrillic
          (mm-coding-system-priorities
           '(koi8-r iso-8859-5 iso-8859-1 utf-8))))
       gnus-parameters))
@end lisp

@item mm-content-transfer-encoding-defaults
@vindex mm-content-transfer-encoding-defaults
Mapping from @acronym{MIME} types to encoding to use.  This variable is usually
used except, e.g., when other requirements force a safer encoding
(digitally signed messages require 7bit encoding).  Besides the normal
@acronym{MIME} encodings, @code{qp-or-base64} may be used to indicate that for
each case the most efficient of quoted-printable and base64 should be
used.

@code{qp-or-base64} has another effect.  It will fold long lines so that
MIME parts may not be broken by MTA.  So do @code{quoted-printable} and
@code{base64}.

Note that it affects body encoding only when a part is a raw forwarded
message (which will be made by @code{gnus-summary-mail-forward} with the
arg 2 for example) or is neither the @samp{text/*} type nor the
@samp{message/*} type.  Even though in those cases, you can override
this setting on a per-message basis by using the @code{encoding}
@acronym{MML} tag (@pxref{MML Definition}).

@item mm-use-ultra-safe-encoding
@vindex mm-use-ultra-safe-encoding
When this is non-@code{nil}, it means that textual parts are encoded as
quoted-printable if they contain lines longer than 76 characters or
starting with "From " in the body.  Non-7bit encodings (8bit, binary)
are generally disallowed.  This reduce the probability that a non-8bit
clean MTA or MDA changes the message.  This should never be set
directly, but bound by other functions when necessary (e.g., when
encoding messages that are to be digitally signed).

@end table

@node Charset Translation
@section Charset Translation
@cindex charsets

During translation from @acronym{MML} to @acronym{MIME}, for each
@acronym{MIME} part which has been composed inside Emacs, an appropriate
charset has to be chosen.

@vindex mail-parse-charset
If you are running a non-@sc{mule} Emacs, this process is simple: If the
part contains any non-@acronym{ASCII} (8-bit) characters, the @acronym{MIME} charset
given by @code{mail-parse-charset} (a symbol) is used.  (Never set this
variable directly, though.  If you want to change the default charset,
please consult the documentation of the package which you use to process
@acronym{MIME} messages.
@xref{Various Message Variables, , Various Message Variables, message,
      Message Manual}, for example.)
If there are only @acronym{ASCII} characters, the @acronym{MIME} charset US-ASCII is
used, of course.

@cindex MULE
@cindex UTF-8
@cindex Unicode
@vindex mm-mime-mule-charset-alist
Things are slightly more complicated when running Emacs with @sc{mule}
support.  In this case, a list of the @sc{mule} charsets used in the
part is obtained, and the @sc{mule} charsets are translated to
@acronym{MIME} charsets by consulting the table provided by Emacs itself
or the variable @code{mm-mime-mule-charset-alist} for XEmacs.
If this results in a single @acronym{MIME} charset, this is used to encode
the part.  But if the resulting list of @acronym{MIME} charsets contains more
than one element, two things can happen: If it is possible to encode the
part via UTF-8, this charset is used.  (For this, Emacs must support
the @code{utf-8} coding system, and the part must consist entirely of
characters which have Unicode counterparts.)  If UTF-8 is not available
for some reason, the part is split into several ones, so that each one
can be encoded with a single @acronym{MIME} charset.  The part can only be
split at line boundaries, though---if more than one @acronym{MIME} charset is
required to encode a single line, it is not possible to encode the part.

When running Emacs with @sc{mule} support, the preferences for which
coding system to use is inherited from Emacs itself.  This means that
if Emacs is set up to prefer UTF-8, it will be used when encoding
messages.  You can modify this by altering the
@code{mm-coding-system-priorities} variable though (@pxref{Encoding
Customization}).

The charset to be used can be overridden by setting the @code{charset}
@acronym{MML} tag (@pxref{MML Definition}) when composing the message.

The encoding of characters (quoted-printable, 8bit etc) is orthogonal
to the discussion here, and is controlled by the variables
@code{mm-body-charset-encoding-alist} and
@code{mm-content-transfer-encoding-defaults} (@pxref{Encoding
Customization}).

@node Conversion
@section Conversion

@findex mime-to-mml
A (multipart) @acronym{MIME} message can be converted to @acronym{MML}
with the @code{mime-to-mml} function.  It works on the message in the
current buffer, and substitutes @acronym{MML} markup for @acronym{MIME}
boundaries.  Non-textual parts do not have their contents in the buffer,
but instead have the contents in separate buffers that are referred to
from the @acronym{MML} tags.

@findex mml-to-mime
An @acronym{MML} message can be converted back to @acronym{MIME} by the
@code{mml-to-mime} function.

These functions are in certain senses ``lossy''---you will not get back
an identical message if you run @code{mime-to-mml} and then
@code{mml-to-mime}.  Not only will trivial things like the order of the
headers differ, but the contents of the headers may also be different.
For instance, the original message may use base64 encoding on text,
while @code{mml-to-mime} may decide to use quoted-printable encoding, and
so on.

In essence, however, these two functions should be the inverse of each
other.  The resulting contents of the message should remain equivalent,
if not identical.


@node Flowed text
@section Flowed text
@cindex format=flowed

The Emacs @acronym{MIME} library will respect the @code{use-hard-newlines}
variable (@pxref{Hard and Soft Newlines, ,Hard and Soft Newlines,
emacs, Emacs Manual}) when encoding a message, and the
``format=flowed'' Content-Type parameter when decoding a message.

On encoding text, regardless of @code{use-hard-newlines}, lines
terminated by soft newline characters are filled together and wrapped
after the column decided by @code{fill-flowed-encode-column}.
Quotation marks (matching @samp{^>* ?}) are respected.  The variable
controls how the text will look in a client that does not support
flowed text, the default is to wrap after 66 characters.  If hard
newline characters are not present in the buffer, no flow encoding
occurs.

On decoding flowed text, lines with soft newline characters are filled
together and wrapped after the column decided by
@code{fill-flowed-display-column}.  The default is to wrap after
@code{fill-column}.

@table @code
@item mm-fill-flowed
@vindex mm-fill-flowed
If non-@code{nil} a format=flowed article will be displayed flowed.
@end table


@node Interface Functions
@chapter Interface Functions
@cindex interface functions
@cindex mail-parse

The @code{mail-parse} library is an abstraction over the actual
low-level libraries that are described in the next chapter.

Standards change, and so programs have to change to fit in the new
mold.  For instance, RFC2045 describes a syntax for the
@code{Content-Type} header that only allows @acronym{ASCII} characters in the
parameter list.  RFC2231 expands on RFC2045 syntax to provide a scheme
for continuation headers and non-@acronym{ASCII} characters.

The traditional way to deal with this is just to update the library
functions to parse the new syntax.  However, this is sometimes the wrong
thing to do.  In some instances it may be vital to be able to understand
both the old syntax as well as the new syntax, and if there is only one
library, one must choose between the old version of the library and the
new version of the library.

The Emacs @acronym{MIME} library takes a different tack.  It defines a
series of low-level libraries (@file{rfc2047.el}, @file{rfc2231.el}
and so on) that parses strictly according to the corresponding
standard.  However, normal programs would not use the functions
provided by these libraries directly, but instead use the functions
provided by the @code{mail-parse} library.  The functions in this
library are just aliases to the corresponding functions in the latest
low-level libraries.  Using this scheme, programs get a consistent
interface they can use, and library developers are free to create
write code that handles new standards.

The following functions are defined by this library:

@table @code
@item mail-header-parse-content-type
@findex mail-header-parse-content-type
Parse a @code{Content-Type} header and return a list on the following
format:

@lisp
("type/subtype"
 (attribute1 . value1)
 (attribute2 . value2)
 ...)
@end lisp

Here's an example:

@example
(mail-header-parse-content-type
 "image/gif; name=\"b980912.gif\"")
@result{} ("image/gif" (name . "b980912.gif"))
@end example

@item mail-header-parse-content-disposition
@findex mail-header-parse-content-disposition
Parse a @code{Content-Disposition} header and return a list on the same
format as the function above.

@item mail-content-type-get
@findex mail-content-type-get
Takes two parameters---a list on the format above, and an attribute.
Returns the value of the attribute.

@example
(mail-content-type-get
 '("image/gif" (name . "b980912.gif")) 'name)
@result{} "b980912.gif"
@end example

@item mail-header-encode-parameter
@findex mail-header-encode-parameter
Takes a parameter string and returns an encoded version of the string.
This is used for parameters in headers like @code{Content-Type} and
@code{Content-Disposition}.

@item mail-header-remove-comments
@findex mail-header-remove-comments
Return a comment-free version of a header.

@example
(mail-header-remove-comments
 "Gnus/5.070027 (Pterodactyl Gnus v0.27) (Finnish Landrace)")
@result{} "Gnus/5.070027  "
@end example

@item mail-header-remove-whitespace
@findex mail-header-remove-whitespace
Remove linear white space from a header.  Space inside quoted strings
and comments is preserved.

@example
(mail-header-remove-whitespace
 "image/gif; name=\"Name with spaces\"")
@result{} "image/gif;name=\"Name with spaces\""
@end example

@item mail-header-get-comment
@findex mail-header-get-comment
Return the last comment in a header.

@example
(mail-header-get-comment
 "Gnus/5.070027 (Pterodactyl Gnus v0.27) (Finnish Landrace)")
@result{} "Finnish Landrace"
@end example

@item mail-header-parse-address
@findex mail-header-parse-address
Parse an address and return a list containing the mailbox and the
plaintext name.

@example
(mail-header-parse-address
 "Hrvoje Niksic <hniksic@@srce.hr>")
@result{} ("hniksic@@srce.hr" . "Hrvoje Niksic")
@end example

@item mail-header-parse-addresses
@findex mail-header-parse-addresses
Parse a string with list of addresses and return a list of elements like
the one described above.

@example
(mail-header-parse-addresses
 "Hrvoje Niksic <hniksic@@srce.hr>, Steinar Bang <sb@@metis.no>")
@result{} (("hniksic@@srce.hr" . "Hrvoje Niksic")
     ("sb@@metis.no" . "Steinar Bang"))
@end example

@item mail-header-parse-date
@findex mail-header-parse-date
Parse a date string and return an Emacs time structure.

@item mail-narrow-to-head
@findex mail-narrow-to-head
Narrow the buffer to the header section of the buffer.  Point is placed
at the beginning of the narrowed buffer.

@item mail-header-narrow-to-field
@findex mail-header-narrow-to-field
Narrow the buffer to the header under point.  Understands continuation
headers.

@item mail-header-fold-field
@findex mail-header-fold-field
Fold the header under point.

@item mail-header-unfold-field
@findex mail-header-unfold-field
Unfold the header under point.

@item mail-header-field-value
@findex mail-header-field-value
Return the value of the field under point.

@item mail-encode-encoded-word-region
@findex mail-encode-encoded-word-region
Encode the non-@acronym{ASCII} words in the region.  For instance,
@samp{Na@"{@dotless{i}}ve} is encoded as @samp{=?iso-8859-1?q?Na=EFve?=}.

@item mail-encode-encoded-word-buffer
@findex mail-encode-encoded-word-buffer
Encode the non-@acronym{ASCII} words in the current buffer.  This function is
meant to be called narrowed to the headers of a message.

@item mail-encode-encoded-word-string
@findex mail-encode-encoded-word-string
Encode the words that need encoding in a string, and return the result.

@example
(mail-encode-encoded-word-string
 "This is na@"{@dotless{i}}ve, baby")
@result{} "This is =?iso-8859-1?q?na=EFve,?= baby"
@end example

@item mail-decode-encoded-word-region
@findex mail-decode-encoded-word-region
Decode the encoded words in the region.

@item mail-decode-encoded-word-string
@findex mail-decode-encoded-word-string
Decode the encoded words in the string and return the result.

@example
(mail-decode-encoded-word-string
 "This is =?iso-8859-1?q?na=EFve,?= baby")
@result{} "This is na@"{@dotless{i}}ve, baby"
@end example

@end table

Currently, @code{mail-parse} is an abstraction over @code{ietf-drums},
@code{rfc2047}, @code{rfc2045} and @code{rfc2231}.  These are documented
in the subsequent sections.



@node Basic Functions
@chapter Basic Functions

This chapter describes the basic, ground-level functions for parsing and
handling.  Covered here is parsing @code{From} lines, removing comments
from header lines, decoding encoded words, parsing date headers and so
on.  High-level functionality is dealt with in the first chapter
(@pxref{Decoding and Viewing}).

@menu
* rfc2045::      Encoding @code{Content-Type} headers.
* rfc2231::      Parsing @code{Content-Type} headers.
* ietf-drums::   Handling mail headers defined by RFC822bis.
* rfc2047::      En/decoding encoded words in headers.
* time-date::    Functions for parsing dates and manipulating time.
* qp::           Quoted-Printable en/decoding.
* base64::       Base64 en/decoding.
* binhex::       Binhex decoding.
* uudecode::     Uuencode decoding.
* yenc::         Yenc decoding.
* rfc1843::      Decoding HZ-encoded text.
* mailcap::      How parts are displayed is specified by the @file{.mailcap} file
@end menu


@node rfc2045
@section rfc2045

RFC2045 is the ``main'' @acronym{MIME} document, and as such, one would
imagine that there would be a lot to implement.  But there isn't, since
most of the implementation details are delegated to the subsequent
RFCs.

So @file{rfc2045.el} has only a single function:

@table @code
@item rfc2045-encode-string
@findex rfc2045-encode-string
Takes a parameter and a value and returns a @samp{PARAM=VALUE} string.
@var{value} will be quoted if there are non-safe characters in it.
@end table


@node rfc2231
@section rfc2231

RFC2231 defines a syntax for the @code{Content-Type} and
@code{Content-Disposition} headers.  Its snappy name is @dfn{MIME
Parameter Value and Encoded Word Extensions: Character Sets, Languages,
and Continuations}.

In short, these headers look something like this:

@example
Content-Type: application/x-stuff;
 title*0*=us-ascii'en'This%20is%20even%20more%20;
 title*1*=%2A%2A%2Afun%2A%2A%2A%20;
 title*2="isn't it!"
@end example

They usually aren't this bad, though.

The following functions are defined by this library:

@table @code
@item rfc2231-parse-string
@findex rfc2231-parse-string
Parse a @code{Content-Type} header and return a list describing its
elements.

@example
(rfc2231-parse-string
 "application/x-stuff;
 title*0*=us-ascii'en'This%20is%20even%20more%20;
 title*1*=%2A%2A%2Afun%2A%2A%2A%20;
 title*2=\"isn't it!\"")
@result{} ("application/x-stuff"
    (title . "This is even more ***fun*** isn't it!"))
@end example

@item rfc2231-get-value
@findex rfc2231-get-value
Takes one of the lists on the format above and returns
the value of the specified attribute.

@item rfc2231-encode-string
@findex rfc2231-encode-string
Encode a parameter in headers likes @code{Content-Type} and
@code{Content-Disposition}.

@end table


@node ietf-drums
@section ietf-drums

@dfn{drums} is an IETF working group that is working on the replacement
for RFC822.

The functions provided by this library include:

@table @code
@item ietf-drums-remove-comments
@findex ietf-drums-remove-comments
Remove the comments from the argument and return the results.

@item ietf-drums-remove-whitespace
@findex ietf-drums-remove-whitespace
Remove linear white space from the string and return the results.
Spaces inside quoted strings and comments are left untouched.

@item ietf-drums-get-comment
@findex ietf-drums-get-comment
Return the last most comment from the string.

@item ietf-drums-parse-address
@findex ietf-drums-parse-address
Parse an address string and return a list that contains the mailbox and
the plain text name.

@item ietf-drums-parse-addresses
@findex ietf-drums-parse-addresses
Parse a string that contains any number of comma-separated addresses and
return a list that contains mailbox/plain text pairs.

@item ietf-drums-parse-date
@findex ietf-drums-parse-date
Parse a date string and return an Emacs time structure.

@item ietf-drums-narrow-to-header
@findex ietf-drums-narrow-to-header
Narrow the buffer to the header section of the current buffer.

@end table


@node rfc2047
@section rfc2047

RFC2047 (Message Header Extensions for Non-@acronym{ASCII} Text) specifies how
non-@acronym{ASCII} text in headers are to be encoded.  This is actually rather
complicated, so a number of variables are necessary to tweak what this
library does.

The following variables are tweakable:

@table @code
@item rfc2047-header-encoding-alist
@vindex rfc2047-header-encoding-alist
This is an alist of header / encoding-type pairs.  Its main purpose is
to prevent encoding of certain headers.

The keys can either be header regexps, or @code{t}.

The values can be @code{nil}, in which case the header(s) in question
won't be encoded, @code{mime}, which means that they will be encoded, or
@code{address-mime}, which means the header(s) will be encoded carefully
assuming they contain addresses.

@item rfc2047-charset-encoding-alist
@vindex rfc2047-charset-encoding-alist
RFC2047 specifies two forms of encoding---@code{Q} (a
Quoted-Printable-like encoding) and @code{B} (base64).  This alist
specifies which charset should use which encoding.

@item rfc2047-encode-function-alist
@vindex rfc2047-encode-function-alist
This is an alist of encoding / function pairs.  The encodings are
@code{Q}, @code{B} and @code{nil}.

@item rfc2047-encoded-word-regexp
@vindex rfc2047-encoded-word-regexp
When decoding words, this library looks for matches to this regexp.

@item rfc2047-encoded-word-regexp-loose
@vindex rfc2047-encoded-word-regexp-loose
This is a version from which the regexp for the Q encoding pattern of
@code{rfc2047-encoded-word-regexp} is made loose.

@item rfc2047-encode-encoded-words
@vindex rfc2047-encode-encoded-words
The boolean variable specifies whether encoded words
(e.g. @samp{=?us-ascii?q?hello?=}) should be encoded again.
@code{rfc2047-encoded-word-regexp} is used to look for such words.

@item rfc2047-allow-irregular-q-encoded-words
@vindex rfc2047-allow-irregular-q-encoded-words
The boolean variable specifies whether irregular Q encoded words
(e.g. @samp{=?us-ascii?q?hello??=}) should be decoded.  If it is
non-@code{nil}, @code{rfc2047-encoded-word-regexp-loose} is used instead
of @code{rfc2047-encoded-word-regexp} to look for encoded words.

@end table

Those were the variables, and these are this functions:

@table @code
@item rfc2047-narrow-to-field
@findex rfc2047-narrow-to-field
Narrow the buffer to the header on the current line.

@item rfc2047-encode-message-header
@findex rfc2047-encode-message-header
Should be called narrowed to the header of a message.  Encodes according
to @code{rfc2047-header-encoding-alist}.

@item rfc2047-encode-region
@findex rfc2047-encode-region
Encodes all encodable words in the region specified.

@item rfc2047-encode-string
@findex rfc2047-encode-string
Encode a string and return the results.

@item rfc2047-decode-region
@findex rfc2047-decode-region
Decode the encoded words in the region.

@item rfc2047-decode-string
@findex rfc2047-decode-string
Decode a string and return the results.

@item rfc2047-encode-parameter
@findex rfc2047-encode-parameter
Encode a parameter in the RFC2047-like style.  This is a replacement for
the @code{rfc2231-encode-string} function.  @xref{rfc2231}.

When attaching files as @acronym{MIME} parts, we should use the RFC2231
encoding to specify the file names containing non-@acronym{ASCII}
characters.  However, many mail softwares don't support it in practice
and recipients won't be able to extract files with correct names.
Instead, the RFC2047-like encoding is acceptable generally.  This
function provides the very RFC2047-like encoding, resigning to such a
regrettable trend.  To use it, put the following line in your
@file{~/.gnus.el} file:

@lisp
(defalias 'mail-header-encode-parameter 'rfc2047-encode-parameter)
@end lisp

@end table


@node time-date
@section time-date

While not really a part of the @acronym{MIME} library, it is convenient to
document this library here.  It deals with parsing @code{Date} headers
and manipulating time.  (Not by using tesseracts, though, I'm sorry to
say.)

These functions convert between five formats: A date string, an Emacs
time structure, a decoded time list, a second number, and a day number.

Here's a bunch of time/date/second/day examples:

@example
(parse-time-string "Sat Sep 12 12:21:54 1998 +0200")
@result{} (54 21 12 12 9 1998 6 nil 7200)

(date-to-time "Sat Sep 12 12:21:54 1998 +0200")
@result{} (13818 19266)

(time-to-seconds '(13818 19266))
@result{} 905595714.0

(seconds-to-time 905595714.0)
@result{} (13818 19266 0)

(time-to-days '(13818 19266))
@result{} 729644

(days-to-time 729644)
@result{} (961933 65536)

(time-since '(13818 19266))
@result{} (0 430)

(time-less-p '(13818 19266) '(13818 19145))
@result{} nil

(subtract-time '(13818 19266) '(13818 19145))
@result{} (0 121)

(days-between "Sat Sep 12 12:21:54 1998 +0200"
              "Sat Sep 07 12:21:54 1998 +0200")
@result{} 5

(date-leap-year-p 2000)
@result{} t

(time-to-day-in-year '(13818 19266))
@result{} 255

(time-to-number-of-days
 (time-since
  (date-to-time "Mon, 01 Jan 2001 02:22:26 GMT")))
@result{} 4.146122685185185
@end example

And finally, we have @code{safe-date-to-time}, which does the same as
@code{date-to-time}, but returns a zero time if the date is
syntactically malformed.

The five data representations used are the following:

@table @var
@item date
An RFC822 (or similar) date string.  For instance: @code{"Sat Sep 12
12:21:54 1998 +0200"}.

@item time
An internal Emacs time.  For instance: @code{(13818 26466)}.

@item seconds
A floating point representation of the internal Emacs time.  For
instance: @code{905595714.0}.

@item days
An integer number representing the number of days since 00000101.  For
instance: @code{729644}.

@item decoded time
A list of decoded time.  For instance: @code{(54 21 12 12 9 1998 6 t
7200)}.
@end table

All the examples above represent the same moment.

These are the functions available:

@table @code
@item date-to-time
Take a date and return a time.

@item time-to-seconds
Take a time and return seconds.

@item seconds-to-time
Take seconds and return a time.

@item time-to-days
Take a time and return days.

@item days-to-time
Take days and return a time.

@item date-to-day
Take a date and return days.

@item time-to-number-of-days
Take a time and return the number of days that represents.

@item safe-date-to-time
Take a date and return a time.  If the date is not syntactically valid,
return a ``zero'' time.

@item time-less-p
Take two times and say whether the first time is less (i. e., earlier)
than the second time.

@item time-since
Take a time and return a time saying how long it was since that time.

@item subtract-time
Take two times and subtract the second from the first.  I. e., return
the time between the two times.

@item days-between
Take two days and return the number of days between those two days.

@item date-leap-year-p
Take a year number and say whether it's a leap year.

@item time-to-day-in-year
Take a time and return the day number within the year that the time is
in.

@end table


@node qp
@section qp

This library deals with decoding and encoding Quoted-Printable text.

Very briefly explained, qp encoding means translating all 8-bit
characters (and lots of control characters) into things that look like
@samp{=EF}; that is, an equal sign followed by the byte encoded as a hex
string.

The following functions are defined by the library:

@table @code
@item quoted-printable-decode-region
@findex quoted-printable-decode-region
QP-decode all the encoded text in the specified region.

@item quoted-printable-decode-string
@findex quoted-printable-decode-string
Decode the QP-encoded text in a string and return the results.

@item quoted-printable-encode-region
@findex quoted-printable-encode-region
QP-encode all the encodable characters in the specified region.  The third
optional parameter @var{fold} specifies whether to fold long lines.
(Long here means 72.)

@item quoted-printable-encode-string
@findex quoted-printable-encode-string
QP-encode all the encodable characters in a string and return the
results.

@end table


@node base64
@section base64
@cindex base64

Base64 is an encoding that encodes three bytes into four characters,
thereby increasing the size by about 33%.  The alphabet used for
encoding is very resistant to mangling during transit.

The following functions are defined by this library:

@table @code
@item base64-encode-region
@findex base64-encode-region
base64 encode the selected region.  Return the length of the encoded
text.  Optional third argument @var{no-line-break} means do not break
long lines into shorter lines.

@item base64-encode-string
@findex base64-encode-string
base64 encode a string and return the result.

@item base64-decode-region
@findex base64-decode-region
base64 decode the selected region.  Return the length of the decoded
text.  If the region can't be decoded, return @code{nil} and don't
modify the buffer.

@item base64-decode-string
@findex base64-decode-string
base64 decode a string and return the result.  If the string can't be
decoded, @code{nil} is returned.

@end table


@node binhex
@section binhex
@cindex binhex
@cindex Apple
@cindex Macintosh

@code{binhex} is an encoding that originated in Macintosh environments.
The following function is supplied to deal with these:

@table @code
@item binhex-decode-region
@findex binhex-decode-region
Decode the encoded text in the region.  If given a third parameter, only
decode the @code{binhex} header and return the filename.

@end table

@node uudecode
@section uudecode
@cindex uuencode
@cindex uudecode

@code{uuencode} is probably still the most popular encoding of binaries
used on Usenet, although @code{base64} rules the mail world.

The following function is supplied by this package:

@table @code
@item uudecode-decode-region
@findex uudecode-decode-region
Decode the text in the region.
@end table


@node yenc
@section yenc
@cindex yenc

@code{yenc} is used for encoding binaries on Usenet.  The following
function is supplied by this package:

@table @code
@item yenc-decode-region
@findex yenc-decode-region
Decode the encoded text in the region.

@end table


@node rfc1843
@section rfc1843
@cindex rfc1843
@cindex HZ
@cindex Chinese

RFC1843 deals with mixing Chinese and @acronym{ASCII} characters in messages.  In
essence, RFC1843 switches between @acronym{ASCII} and Chinese by doing this:

@example
This sentence is in @acronym{ASCII}.
The next sentence is in GB.~@{<:Ky2;S@{#,NpJ)l6HK!#~@}Bye.
@end example

Simple enough, and widely used in China.

The following functions are available to handle this encoding:

@table @code
@item rfc1843-decode-region
Decode HZ-encoded text in the region.

@item rfc1843-decode-string
Decode a HZ-encoded string and return the result.

@end table


@node mailcap
@section mailcap

The @file{~/.mailcap} file is parsed by most @acronym{MIME}-aware message
handlers and describes how elements are supposed to be displayed.
Here's an example file:

@example
image/*; gimp -8 %s
audio/wav; wavplayer %s
application/msword; catdoc %s ; copiousoutput ; nametemplate=%s.doc
@end example

This says that all image files should be displayed with @code{gimp},
that WAVE audio files should be played by @code{wavplayer}, and that
MS-WORD files should be inlined by @code{catdoc}.

The @code{mailcap} library parses this file, and provides functions for
matching types.

@table @code
@item mailcap-mime-data
@vindex mailcap-mime-data
This variable is an alist of alists containing backup viewing rules.

@end table

Interface functions:

@table @code
@item mailcap-parse-mailcaps
@findex mailcap-parse-mailcaps
Parse the @file{~/.mailcap} file.

@item mailcap-mime-info
Takes a @acronym{MIME} type as its argument and returns the matching viewer.

@end table




@node Standards
@chapter Standards

The Emacs @acronym{MIME} library implements handling of various elements
according to a (somewhat) large number of RFCs, drafts and standards
documents.  This chapter lists the relevant ones.  They can all be
fetched from @uref{http://quimby.gnus.org/notes/}.

@table @dfn
@item RFC822
@itemx STD11
Standard for the Format of ARPA Internet Text Messages.

@item RFC1036
Standard for Interchange of USENET Messages

@item RFC2045
Format of Internet Message Bodies

@item RFC2046
Media Types

@item RFC2047
Message Header Extensions for Non-@acronym{ASCII} Text

@item RFC2048
Registration Procedures

@item RFC2049
Conformance Criteria and Examples

@item RFC2231
@acronym{MIME} Parameter Value and Encoded Word Extensions: Character Sets,
Languages, and Continuations

@item RFC1843
HZ - A Data Format for Exchanging Files of Arbitrarily Mixed Chinese and
@acronym{ASCII} characters

@item draft-ietf-drums-msg-fmt-05.txt
Draft for the successor of RFC822

@item RFC2112
The @acronym{MIME} Multipart/Related Content-type

@item RFC1892
The Multipart/Report Content Type for the Reporting of Mail System
Administrative Messages

@item RFC2183
Communicating Presentation Information in Internet Messages: The
Content-Disposition Header Field

@item RFC2646
Documentation of the text/plain format parameter for flowed text.

@end table

@node GNU Free Documentation License
@chapter GNU Free Documentation License
@include doclicense.texi

@node Index
@chapter Index
@printindex cp

@bye


@c Local Variables:
@c mode: texinfo
@c coding: iso-8859-1
@c End:

@ignore
   arch-tag: c7ef2fd0-a91c-4e10-aa52-c1a2b11b1a8d
@end ignore