~bzg/worg

ref: 559025d3195c39306b5a5546c06a4e375fe4ff7f worg/org-devel.org -rw-r--r-- 10.8 KiB
559025d3Bastien org-contribute.org: Add a note to maintainers 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#+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
#+STARTUP:    align fold nodlcheck hidestars oddeven lognotestate
#+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
#+TAGS:       Write(w) Update(u) Fix(f) Check(c) 
#+TITLE:      Ongoing Development of Org Additions?
#+AUTHOR:     Worg people
#+LANGUAGE:   en
#+PRIORITIES: A C B
#+CATEGORY:   worg
#+HTML_LINK_UP:    index.html
#+HTML_LINK_HOME:  https://orgmode.org/worg/

# This file is released by its authors and contributors under the GNU
# Free Documentation license v1.3 or later, code examples are released
# under the GNU General Public License v3 or later.


# This file is the default header for new Org files in Worg.  Feel free
# to tailor it to your needs.

Some org-mode related project currently being developed in worg.

* Org Collector

#+index: Collector

Located in the =contrib/lisp/= directory of org-mode.

A utility for collecting properties from the headers in an org file,
running the properties through arbitrary elisp functions, and
presenting the results in a table.

The functionality of this tool is similar to the functionality of
[[info:org:Capturing column view][info:org:Capturing column view]], but this has support for processing
prior to the generation of the table.

Here is a simple example application of this utility.

#+begin_comment ems better example
it might be better to put an exercise example here if someone has one.
#+end_comment

#+BEGIN: propview :id "data" :cols (ITEM f d list (apply '* list) (+ f d))

#+END:

*** Example Data
      :PROPERTIES:
      :ID:       data
      :END:

****** run1
      :PROPERTIES:
      :d: 33
      :f: 2
      :list: '(9 2 3 4 5 6 7)
      :END:


****** run2
      :PROPERTIES:
      :d: 34
      :f: 4
      :END:


****** run3
      :PROPERTIES:
      :d: 35
      :f: 4
      :END:


****** run4
      :PROPERTIES:
      :d: 36
      :f: 2
      :END:


* MEMO org-mail-htmlize: Create MIME messages based on Org

** Representing a MIME internet message

   A MIME internet message consists of one or more MIME entities. Each
   MIME entity is of a distinct type and subtype, has a body and
   optional MIME headers related to its content.

   A MIME entity is represented as a list:

   (TYPE SUBTYPE BODY CONT-HEAD)

   - TYPE :: Symbol of MIME media type (e.g. text, video, audio).

   - SUBTYPE :: Symbol of MIME media subtype (e.g. plain, html).

   - BODY :: String with entity body -or- list of other MIME entities.

   - CONT-HEAD :: List of cons with content related MIME header
                  fields.  The name of the header field without the
                  prefix "Content-" is car, the value cdr.

   Example:

   #+begin_src emacs-lisp
   '(text html "<h1>Headline</h1>" ((disposition . inline)))
   #+end_src

   For messages of type multipart the body consists of a list of one
   or more MIME entities.

   #+begin_src emacs-lisp
     '(multipart alternative
                 '((text plain "* Headline")
                   (text html "<h1>headline</h1>")))
   #+end_src

** MIME delimiters of SEMI and mml

   The MIME delimiters are defined in an association list with a
   symbol of the library's name as key and delimiter format strings as
   values.  For each library there are three formatstrings.

   (SYMBOL DELIM-SINGLE DELIM-SINGLE-CONT DELIM-MULTI)

   - DELIM-SINGLE :: Denoting a single MIME entity.

		     Strings are passed in this order:

		     1. type

		     2. subtype

		     3. content header

		     4. body

   - DELIM-SINGLE-CONT :: Format of content header strings.

	Strings are passed in this order:

	1. header field name

	2. header field value

   - DELIM-MULTI :: Enclosing parts of a multipart entity.

		    Strings are passed in this order:

		    1. subtype

		    2. body

		    3. subtype

   #+begin_src emacs-lisp
     (setq org-mail-htmlize-mime-delimiter-alist
           '((semi "\n--[[%s/%s%s]]\n%s" "\ncontent-%s: %s" "\n--<<%s>>-{\n%s\n--}-<<%s>>")
             (mml "\n<#part type=\"%s/%s\"%s>\n%s" " %s=\"%s\"" "\n<#multipart type=\"%s\">\n%s\n<#/multipart>")))
   #+end_src

** Generic function

   This generic function returns a string representation with MIME
   delimiters depending on the variable =org-mail-htmlize-mime-lib=.

   #+begin_src emacs-lisp
     (setq org-mail-htmlize-mime-lib 'semi)
   #+end_src

   #+begin_src emacs-lisp
     (defun org-mail-htmlize-mime-entity (type subtype body
                                               &optional cont-head)
       "Return string representation of MIME entity.
     
     TYPE is the type of entity body.
     SUBTYPE is the subtype of body.
     BODY is the body of the entity.  Either a string with the body
     content or a list with one ore more MIME entities.
     Optional argument CONT-HEAD is a list of cons with content
     specific headers, name in car and value in cdr."
       (let ((delimlst (assoc org-mail-htmlize-mime-lib
                              org-mail-htmlize-mime-delimiter-alist)))
         (if (eq type 'multipart)
             (format (nth 3 delimlst) subtype
                     (mapconcat (lambda (b)
                                   (apply 'org-mail-htmlize-mime-entity
                                          (car b) (cadr b) (cddr b)))
                                body "")
                     subtype)
           (format (nth 1 delimlst)
                   type subtype
                   (mapconcat (lambda (h)
                                 (format (nth 2 delimlst) (car h) (cdr h)))
                              cont-head "")
                   body))))
   #+end_src

** Open questions

*** How to handle charset information?

*** How to attach files?

    The generic function expects BODY either be a string or a list.
    Attaching binary file (image, etc.) requires to encode it so the
    message will pass the message system.  So we /might/ use kind of a
    encoder (e.g. base64) on our own.

    Or, what seems a cleaner solution: Use attachment function of the
    respective MIME mode.  To achive this: Introduce third possibility
    for BODY: A cons with the filename in car and symbol of the
    function in cdr.

    (FILENAME . FUNCTION)

    #+begin_src emacs-lisp
      '(image jpeg ("/path/to/image" . org-mail-htmlize-add-attachment))
    #+end_src

    The function =org-mail-htmlize-add-attachment= is called with file
    name as argument and calls the appropriate function depending on
    =org-mail-htmlize-mime-lib= and returns a string

       - with the encoded body

	 -or-

       - the complete MIME entity

    Side effect: The user might be prompted for attachment settings
    (e.g. encoding).  But, on the other hand: We delegate the job of
    creating the attachment to the library that is responsible for
    mime.

** Quotes from the specs

*** MIME multipart: Notion of structured, related body parts
  :PROPERTIES:
  :Created: [2010-03-25 Do]
  :END:

  - [[http://tools.ietf.org/html/rfc2046.html#section-5.1.1][RFC2046, 5.1.1]]

    #+BEGIN_QUOTE
       NOTE:  Conspicuously missing from the "multipart" type is a notion of
       structured, related body parts. It is recommended that those wishing
       to provide more structured or integrated multipart messaging
       facilities should define subtypes of multipart that are syntactically
       identical but define relationships between the various parts. For
       example, subtypes of multipart could be defined that include a
       distinguished part which in turn is used to specify the relationships
       between the other parts, probably referring to them by their
       Content-ID field.  Old implementations will not recognize the new
       subtype if this approach is used, but will treat it as
       multipart/mixed and will thus be able to show the user the parts that
       are recognized.
    #+END_QUOTE
*** MIME multipart: order of entities inside a multipart
  :PROPERTIES:
  :Created: [2010-03-25 Do]
  :END:

  - [[http://tools.ietf.org/html/rfc2046.html#section-5.1.3][RFC2046, 5.1.3]]

    #+BEGIN_QUOTE
    5.1.3.  Mixed Subtype

       The "mixed" subtype of "multipart" is intended for use when the body
       parts are independent and need to be bundled in a particular order.
       Any "multipart" subtypes that an implementation does not recognize
       must be treated as being of subtype "mixed".

    #+END_QUOTE

  - [[http://tools.ietf.org/html/rfc2046.html#section-5.1.4][RFC2046, 5.1.4]]

    #+BEGIN_QUOTE
    5.1.4.  Alternative Subtype

       The "multipart/alternative" type is syntactically identical to
       "multipart/mixed", but the semantics are different.  In particular,
       each of the body parts is an "alternative" version of the same
       information.

       Systems should recognize that the content of the various parts are
       interchangeable.  Systems should choose the "best" type based on the
       local environment and references, in some cases even through user
       interaction.  As with "multipart/mixed", the order of body parts is
       significant.  In this case, the alternatives appear in an order of
       increasing faithfulness to the original content.  In general, the
       best choice is the LAST part of a type supported by the recipient
       system's local environment.
    #+END_QUOTE

    #+BEGIN_QUOTE
       In general, user agents that compose "multipart/alternative" entities
       must place the body parts in increasing order of preference, that is,
       with the preferred format last.  For fancy text, the sending user
       agent should put the plainest format first and the richest format
       last.  Receiving user agents should pick and display the last format
       they are capable of displaying.  In the case where one of the
       alternatives is itself of type "multipart" and contains unrecognized
       sub-parts, the user agent may choose either to show that alternative,
       an earlier alternative, or both.
    #+END_QUOTE
* Org mode issue tracking library

A collection of helper functions to maintain the [[file:org-issues.org][Issue file]] from within
Wanderlust and (partly) Gnus.

You can download a current version of this file [[file:code/elisp/org-issue.el][here]].

Currently following commands are provided:

  - 'org-issue-new' :: File a new issue for current message

       Creates a new TODO in 'org-issue-issue-file' below the headline
       "New Issues" with keyword NEW.  If customization variable
       'org-issue-message-flag' is non-nil and flagging messages is
       supported, the message of this issue is flagged.

  - 'org-issue-close' :: Close issue of current message.

  - 'org-issue-tag'  :: Tag issue of current message.

  - 'org-issue-update-message-flag' :: Update message flag according
       to issue file.

       If the issue for current message is closed, the message flag is
       removed.

  - 'org-issue-link-gmane' :: An Org mode web link pointing to current
       message on gmane is pushed to killring and clipboard.