1 #+OPTIONS: H:3 num:nil toc:t \n:nil ::t |:t ^:nil -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc ':t
2 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
3 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TAGS: Write(w) Update(u) Fix(f) Check(c)
5 #+TITLE: Ongoing Development of Org Additions?
7 #+EMAIL: mdl AT imapmail DOT org
11 #+HTML_LINK_UP: index.html
12 #+HTML_LINK_HOME: https://orgmode.org/worg/
14 # This file is released by its authors and contributors under the GNU
15 # Free Documentation license v1.3 or later, code examples are released
16 # under the GNU General Public License v3 or later.
19 # This file is the default header for new Org files in Worg. Feel free
20 # to tailor it to your needs.
22 Some org-mode related project currently being developed in worg.
28 Located in the =contrib/lisp/= directory of org-mode.
30 A utility for collecting properties from the headers in an org file,
31 running the properties through arbitrary elisp functions, and
32 presenting the results in a table.
34 The functionality of this tool is similar to the functionality of
35 [[info:org:Capturing column view][info:org:Capturing column view]], but this has support for processing
36 prior to the generation of the table.
38 Here is a simple example application of this utility.
40 #+begin_comment ems better example
41 it might be better to put an exercise example here if someone has one.
44 #+BEGIN: propview :id "data" :cols (ITEM f d list (apply '* list) (+ f d))
57 :list: '(9 2 3 4 5 6 7)
82 * Fireforg, a Firefox extension for org interaction (EXPERIMENTAL)
86 /Note: The development of org-fireforg has ceased back in 2009/
88 Fireforg is a Firefox extension, that interacts with Emacs Org-mode.
90 For the displayed URL it shows the associated tags in the status bar
91 and allows to show a list of annotations that can be instantly visited
94 Additionally, in every website it marks all links that occur in the agenda files.
96 For every link in the agenda files the previous heading and its tags
97 are associated with it.
99 For *scientific use*, it is possible to *send BibTeX entries* for
100 sites supported by the Zotero plugin to Emacs. [[*Import BibTeX using Zotero][Additional steps]] are
101 necessary for this to work.
105 :ID: 13179b21-d70a-4255-a8f1-9f4e4e729074
107 The following notes should be taken into consideration before using Fireforg:
108 - On the Emacs side a registry of all links in the agenda files will
109 be generated and saved in plain text onto the harddrive.
110 - The generation can take very a long time depending on the size of
111 the agenda files and the number of links in them.
112 - The generated file can become quite large.
113 - When files are *encrypted* having some information from them in
114 plain text on the harddrive might not be what you want.
115 - Firefox will read and look through the registry file for the
116 currently viewed site. Depending on the size of the registry file
117 and on the options [[id:e77f15a8-c358-44fd-a207-8c422fee2d1e][Lookup links on page load]] and [[id:d73476f3-6c09-479c-abea-f33d3e0e074a][Prefetch links to extract DOI]]
118 this might slow down the browsing experience.
122 - Install org-protocol according to its [[file:org-contrib/org-protocol.org][manual]] and *please verify
123 that it's working* using either the bookmarks or by invoking it directly in the shell:
124 : emacsclient 'org-protocol://remember://w/http%3A%2F%2Forgmode.org%2F/Org-Mode%3A%20Your%20Life%20in%20Plain%20Text%20-%20Mozilla%20Firefox/'
125 - Get =fireforgrepofile:lisp/org-fireforg.el= and put the following into your
126 =.emacs= *after* the section that initializes org-protocol:
127 : (add-to-list 'load-path "~/path/to/org/fireforg/")
128 : (require 'org-fireforg)
129 : (org-fireforg-registry-insinuate)
131 and as the last line of the file:
132 : (org-fireforg-registry-initialize t)
134 Note that creating the registry can take a long time depending on
135 the size of the agenda files and the number of links in them.
137 - Visit =fireforgrepofile:build/fireforg.xpi= with Firefox, confirm installation of the extension and restart.
139 (Windows users will have to adjust: org-fireforg-registry-file-xml in Emacs
140 and "registry-file" in Fireforgs preferences to be the same file.)
142 *** Installation from a git clone
144 /note: development seems to have ceased back in 2009. Use with caution./
146 It is also possible to clone the git repository first, using:
147 : git clone https://repo.or.cz/w/org-fireforg.git
148 , install lisp/org-fireforg.el according to the instructions above
149 and add a file named =fireforg@burtzlaff.de= containing the path
150 to the "fireforg" subdirectory into =~/.mozilla/firefox/<your
151 profile>/extensions/=.
153 In my setup for example there is a file
154 =~/.mozilla/firefox/4xyx9l73.default/extensions/fireforg@burtzlaff.de=
156 : /home/andy/projects/org-fireforg/fireforg
158 A restart of Firefox is required for this to work.
161 *** The status bar entry
163 If the currently viewed url is found in your agenda files, the number
164 of occurrences together with all associated tags will be shown in the
165 status bar. A left click on the status bar entry will show a list of
166 all headings associated with the currently viewed url. Selecting one
167 of them lets Emacs visit that heading.
169 For example, this heading in one of your agenda files:
170 : * Greatest tool in the world [[https://orgmode.org/][Org mode]] :Org:
171 will yield the following when visiting https://orgmode.org/ and left clicking:
173 [[file:images/screenshots/org-fireforg-screenshot.png]]
175 *** Triggering store-link and remember
176 Right clicking on the status bar entry shows a menu that let's you
177 trigger org-protocol's "store-link" and "remember".
179 There is an entry for every remember template listed in the [[*List of characters specifying available remember templates][preferences]].
181 The entries in the submenu "All tabs" will call remember for every tab
182 in the current window. This option only makes sense if a remember
183 template is used, that stores the note automatically ("%!" in the template string), e.g.:
184 : * %:description \n %:link %!
186 *** Mark links that occur in the agenda files in websites
188 Whenever a site is loaded, Fireforg will alter the style of all links
189 in it, that occur in the agenda files. The tooltip of those links is
190 set to contain the annotations.
192 This feature can be turned off using an [[*Lookup links on page load][option]] in the [[*Preferences][preferences
193 dialog]]. [[*CSS style string for links with annotations][The CSS-style]] used for marking the link and [[*Overwrite tooltip for links with annotations][whether or
194 not the tooltip is set]] is also customizable.
196 *** Context menu for links
198 The context menu (accessible by right clicking on a link) has a
199 submenu "Fireforg", where all annotations for that link are listed:
201 [[file:images/screenshots/org-fireforg-screenshot-context-menu.png]]
203 ** Import BibTeX using Zotero
205 :ID: e6fc94c6-7fef-4348-b998-f6a6f58eded8
207 Fireforg is able to retrieve BibTex entries for the all sites
208 supported by [[http://www.zotero.org/][Zotero]]. To achieve this the following additional steps
210 - Install Zotero 1.0.10 from the [[http://www.zotero.org/][Zotero Website]]
211 - Set "Inject Zotero" in Fireforg's preference dialog
212 [fn:ffprefdiag: Fireforg's preference dialogue is accessible in
213 Firefox's menu under Tools->Add-ons->Fireforg->Preferences].
215 *Warning: On restart a small function is injected into Zotero to
216 catch imported entries. The change to the code is minimal and
217 non-permanent. In a worst case scenario Zotero's database might
218 get corrupted, though that hasn't happened yet.*
222 Whenever a single entry (*not* a collection) is imported into Zotero -
223 e.g. by clicking the white "document" symbol that appears to the right
224 in the url bar if Zotero supports importing the current site - it is
225 automatically exported to BibTeX and sent to org mode using
226 org-protocol. In Emacs it is put into the kill ring in a format
227 depending on the variable =org-fireforg-received-bibtex-format=:
229 - =nil=: The BibTeX entry is passed directly into the kill ring.
230 - =heading= (Default): A heading is generated with the BibTeX
231 fields as properties with prefix "BIB_":
232 : * [[<link to site>][<Title>]]
234 : :CUSTOM_ID: <BibTeX key>
235 : :BIB_entryType: <article, ...>
240 - =headingWithPropsAndBibTeXContent=: a heading with properties as
241 described above is generated and the entry in BibTeX format is
243 - =headingWithBibTeXContent=: same as the previous one but without the properties
245 If the 'url' field is a *static URL*, the link to it will be highlighted
246 in search results in every search engine. Otherwise the option
247 [[id:3ab02821-03c4-4fa7-9a3a-e9701245c5d8][Match sites by comparing their DOI with saved bibliography entries]] might help.
249 To export BibTeX information from all headings in the current buffer
250 with at least the "BIB_entryType" property call:
251 - =org-fireforg-export-bibtex-to-file= to export to a file
252 - =org-fireforg-export-bibtex-to-new-buffer= to export into a new buffer
254 *** Digital Object Identifiers (DOI)
256 :ID: fbd09ba5-6632-40df-bcc0-8e5a7b9eb7a7
258 If a BibTeX entry contains a field 'doi', a URL will be generated by
259 prepending "http://dx.doi.org/" to the corresponding property
260 'BIB_doi'. It will be handled as any other URL. There is a
261 [[id:3ab02821-03c4-4fa7-9a3a-e9701245c5d8][corresponding functionality in the plugin]] that allows to associated
262 pages despite non-static URLs.
264 Fireforg's preference dialogue is accessible in Firefox's menu
265 under Tools->Add-ons->Fireforg->Preferences
267 The file containing an xml tree with all link-headline associations
268 generated from the agenda files. You should not need to change
269 this. It has to be same as the customizable variable
270 =org-fireforg-registry-file-xml= in Emacs.
271 ***** Lookup links on page load
273 :ID: e77f15a8-c358-44fd-a207-8c422fee2d1e
275 When enabled, all links in a web page that have headlines
276 associated with them are marked. This is achieve by adding the
277 following CSS style string to the element:
278 Depending on the size of the registry this *might slow Firefox down*.
279 ***** CSS style string for links with annotations
280 The string that is appended to the CSS =style= string of a link
281 element, if annotations for it exist.
282 ***** Overwrite tooltip for links with annotations
283 If enabled, sets the tooltip for the links, for which
284 annotations exist to contain those annotations.
286 After restarting Firefox, a function in the Zotero code gets altered
287 so that all BibtTeX entries (*not* collections) that are imported are
288 sent using org-protocol and are handled in Emacs according to the
289 variable =org-fireforg-received-bibtex-format= as described [[* Import BibTeX using Zotero][here]]. Due
290 to [[* Technical note][design choices in Zotero]] this is a bit fragile and can yield errors
291 and *might possibly even break Zotero's database*. It is not advisable
292 to use Zotero for production when enabling this option in Fireforg.
293 ***** Match sites by comparing their DOI with saved bibliography entries
295 :ID: 3ab02821-03c4-4fa7-9a3a-e9701245c5d8
297 Extract the Digital Object Identifier (DOI) from a page, prepend
298 "http://dx.doi.org/" to it and look up the resulting URL.
300 If using a bibliography format [[id:e6fc94c6-7fef-4348-b998-f6a6f58eded8][with properties]], a [[id:fbd09ba5-6632-40df-bcc0-8e5a7b9eb7a7][URL is
301 generated in the same way from the value of the field "BIB_doi"
302 if it exists]]. Thus documents can be matched regardless of the
303 possibly non-static URL.
304 ***** Prefetch links to extract DOI
306 :ID: d73476f3-6c09-479c-abea-f33d3e0e074a
308 *Prefetch all links in a page* after it is loaded, extract the
309 DOIs - if any - and [[id:fbd09ba5-6632-40df-bcc0-8e5a7b9eb7a7][use it to find annotations]]. This requires
310 the option [[id:3ab02821-03c4-4fa7-9a3a-e9701245c5d8][Match sites by comparing their DOI with saved
311 bibliography entries]] to be set.
313 A site is only prefetched once in every Firefox session, because the
314 associated URL mapping is saved until Firefox is restarted.
316 *All links starting with "http" will be prefetched (except for
317 files with extensions: PDF, GIF, PNG or SWF).* This option can
318 also be toggled in the status bar menu.
320 *This option will generate additional network traffic and might
321 slow the browsing experience*
322 ***** List of characters specifying available remember templates
323 For every character in this list an entry in the [[*Triggering store-link and remember][popup menu]] will
324 be generated, that triggers remember with the template
325 associated with the character.
326 ***** Enable workaround for Mac
327 see [[* Workaround for the inability to register a protocol in Firefox on the Mac][here]]
328 ***** Temporary file for Mac workaround
329 see [[* Workaround for the inability to register a protocol in Firefox on the Mac][here]]
331 ** Workaround for the inability to register a protocol in Firefox on the Mac
333 A long known bug in Firefox on the Mac is reported to stop protocol
334 registration from working. To work around this Fireforg is able to
335 write the org-protocol urls to a temporary file, that is read every
336 second and, if non empty, passed to emacsclient and emptied.
339 - check "Enable workaround for Mac" in Fireforg's preference dialogue
340 - get pull.sh from https://repo.or.cz/w/org-fireforg.git and run it.
344 To avoid confusion, always update both org-fireforg.el and the plugin.
346 The plugin has to be uninstalled and then reinstalled as described
347 above. Automatic updating will be used when the testing phase is over.
349 ** Bugreporting and discussion
351 - Discussions go to the org-mode list.
352 - Bugreports are better not sent to the list, but rather directly to
353 the [[mailto:andreas AT burtzlaff DOT de][author]] (Please add "[Fireforg]" to the subject.).
355 *** A checklist for bug tracing
357 To create a test case put:
358 : * Greatest tool in the world [[https://orgmode.org/][Org mode]] :Org:
359 into one of your agenda files and save it.
361 If problems arise please go through this checklist to locate the problem:
363 - Does the file "~/.org-fireforg-registry.xml" exist and does it contain "orgmode.org"?
364 - *No on either*: Send me the last content of the Messages buffer in Emacs
365 - *Yes*: In the Firefox menu: "Tools"->"Error console" look for
366 errors containing: "chrome://fireforg/" and send them to me.
370 Different instances of Zotero's Translator object seem to share state
371 in a non-obvious way. This makes coding very fragile and even lets
372 some imports fail (silently) after Fireforg has injected its code. The
373 failure when importing collections is somehow related to this. While
374 I find it a strange design choice, it is not in my power to change it.
375 * MEMO org-mail-htmlize: Create MIME messages based on Org
377 ** Representing a MIME internet message
379 A MIME internet message consists of one or more MIME entities. Each
380 MIME entity is of a distinct type and subtype, has a body and
381 optional MIME headers related to its content.
383 A MIME entity is represented as a list:
385 (TYPE SUBTYPE BODY CONT-HEAD)
387 - TYPE :: Symbol of MIME media type (e.g. text, video, audio).
389 - SUBTYPE :: Symbol of MIME media subtype (e.g. plain, html).
391 - BODY :: String with entity body -or- list of other MIME entities.
393 - CONT-HEAD :: List of cons with content related MIME header
394 fields. The name of the header field without the
395 prefix "Content-" is car, the value cdr.
399 #+begin_src emacs-lisp
400 '(text html "<h1>Headline</h1>" ((disposition . inline)))
403 For messages of type multipart the body consists of a list of one
404 or more MIME entities.
406 #+begin_src emacs-lisp
407 '(multipart alternative
408 '((text plain "* Headline")
409 (text html "<h1>headline</h1>")))
412 ** MIME delimiters of SEMI and mml
414 The MIME delimiters are defined in an association list with a
415 symbol of the library's name as key and delimiter format strings as
416 values. For each library there are three formatstrings.
418 (SYMBOL DELIM-SINGLE DELIM-SINGLE-CONT DELIM-MULTI)
420 - DELIM-SINGLE :: Denoting a single MIME entity.
422 Strings are passed in this order:
432 - DELIM-SINGLE-CONT :: Format of content header strings.
434 Strings are passed in this order:
438 2. header field value
440 - DELIM-MULTI :: Enclosing parts of a multipart entity.
442 Strings are passed in this order:
450 #+begin_src emacs-lisp
451 (setq org-mail-htmlize-mime-delimiter-alist
452 '((semi "\n--[[%s/%s%s]]\n%s" "\ncontent-%s: %s" "\n--<<%s>>-{\n%s\n--}-<<%s>>")
453 (mml "\n<#part type=\"%s/%s\"%s>\n%s" " %s=\"%s\"" "\n<#multipart type=\"%s\">\n%s\n<#/multipart>")))
458 This generic function returns a string representation with MIME
459 delimiters depending on the variable =org-mail-htmlize-mime-lib=.
461 #+begin_src emacs-lisp
462 (setq org-mail-htmlize-mime-lib 'semi)
465 #+begin_src emacs-lisp
466 (defun org-mail-htmlize-mime-entity (type subtype body
468 "Return string representation of MIME entity.
470 TYPE is the type of entity body.
471 SUBTYPE is the subtype of body.
472 BODY is the body of the entity. Either a string with the body
473 content or a list with one ore more MIME entities.
474 Optional argument CONT-HEAD is a list of cons with content
475 specific headers, name in car and value in cdr."
476 (let ((delimlst (assoc org-mail-htmlize-mime-lib
477 org-mail-htmlize-mime-delimiter-alist)))
478 (if (eq type 'multipart)
479 (format (nth 3 delimlst) subtype
480 (mapconcat (lambda (b)
481 (apply 'org-mail-htmlize-mime-entity
482 (car b) (cadr b) (cddr b)))
485 (format (nth 1 delimlst)
487 (mapconcat (lambda (h)
488 (format (nth 2 delimlst) (car h) (cdr h)))
495 *** How to handle charset information?
497 *** How to attach files?
499 The generic function expects BODY either be a string or a list.
500 Attaching binary file (image, etc.) requires to encode it so the
501 message will pass the message system. So we /might/ use kind of a
502 encoder (e.g. base64) on our own.
504 Or, what seems a cleaner solution: Use attachment function of the
505 respective MIME mode. To achive this: Introduce third possibility
506 for BODY: A cons with the filename in car and symbol of the
509 (FILENAME . FUNCTION)
511 #+begin_src emacs-lisp
512 '(image jpeg ("/path/to/image" . org-mail-htmlize-add-attachment))
515 The function =org-mail-htmlize-add-attachment= is called with file
516 name as argument and calls the appropriate function depending on
517 =org-mail-htmlize-mime-lib= and returns a string
519 - with the encoded body
523 - the complete MIME entity
525 Side effect: The user might be prompted for attachment settings
526 (e.g. encoding). But, on the other hand: We delegate the job of
527 creating the attachment to the library that is responsible for
530 ** Quotes from the specs
532 *** MIME multipart: Notion of structured, related body parts
534 :Created: [2010-03-25 Do]
537 - [[http://tools.ietf.org/html/rfc2046.html#section-5.1.1][RFC2046, 5.1.1]]
540 NOTE: Conspicuously missing from the "multipart" type is a notion of
541 structured, related body parts. It is recommended that those wishing
542 to provide more structured or integrated multipart messaging
543 facilities should define subtypes of multipart that are syntactically
544 identical but define relationships between the various parts. For
545 example, subtypes of multipart could be defined that include a
546 distinguished part which in turn is used to specify the relationships
547 between the other parts, probably referring to them by their
548 Content-ID field. Old implementations will not recognize the new
549 subtype if this approach is used, but will treat it as
550 multipart/mixed and will thus be able to show the user the parts that
553 *** MIME multipart: order of entities inside a multipart
555 :Created: [2010-03-25 Do]
558 - [[http://tools.ietf.org/html/rfc2046.html#section-5.1.3][RFC2046, 5.1.3]]
563 The "mixed" subtype of "multipart" is intended for use when the body
564 parts are independent and need to be bundled in a particular order.
565 Any "multipart" subtypes that an implementation does not recognize
566 must be treated as being of subtype "mixed".
570 - [[http://tools.ietf.org/html/rfc2046.html#section-5.1.4][RFC2046, 5.1.4]]
573 5.1.4. Alternative Subtype
575 The "multipart/alternative" type is syntactically identical to
576 "multipart/mixed", but the semantics are different. In particular,
577 each of the body parts is an "alternative" version of the same
580 Systems should recognize that the content of the various parts are
581 interchangeable. Systems should choose the "best" type based on the
582 local environment and references, in some cases even through user
583 interaction. As with "multipart/mixed", the order of body parts is
584 significant. In this case, the alternatives appear in an order of
585 increasing faithfulness to the original content. In general, the
586 best choice is the LAST part of a type supported by the recipient
587 system's local environment.
591 In general, user agents that compose "multipart/alternative" entities
592 must place the body parts in increasing order of preference, that is,
593 with the preferred format last. For fancy text, the sending user
594 agent should put the plainest format first and the richest format
595 last. Receiving user agents should pick and display the last format
596 they are capable of displaying. In the case where one of the
597 alternatives is itself of type "multipart" and contains unrecognized
598 sub-parts, the user agent may choose either to show that alternative,
599 an earlier alternative, or both.
601 * Org mode issue tracking library
603 A collection of helper functions to maintain the [[file:org-issues.org][Issue file]] from within
604 Wanderlust and (partly) Gnus.
606 You can download a current version of this file [[file:code/elisp/org-issue.el][here]].
608 Currently following commands are provided:
610 - 'org-issue-new' :: File a new issue for current message
612 Creates a new TODO in 'org-issue-issue-file' below the headline
613 "New Issues" with keyword NEW. If customization variable
614 'org-issue-message-flag' is non-nil and flagging messages is
615 supported, the message of this issue is flagged.
617 - 'org-issue-close' :: Close issue of current message.
619 - 'org-issue-tag' :: Tag issue of current message.
621 - 'org-issue-update-message-flag' :: Update message flag according
624 If the issue for current message is closed, the message flag is
627 - 'org-issue-link-gmane' :: An Org mode web link pointing to current
628 message on gmane is pushed to killring and clipboard.