Re: [O] Re: List-table feature (or a potential quick and easy mullti-lines table in org?)
I wish org-mode can do like this... - Row 1 :exports tabel - 1.1 - 1.2 - 1.3 - Row 2 - 2.1 - 2.2 - 2.3 On Fri, Mar 18, 2011 at 6:18 AM, Ben b...@maleloria.org wrote: Out of boredom, I've written a draft for it. Woohoo! congrats for the way you're getting bored! Hey thank you Nicolas! #+begin_src emacs-lisp So here I'm guessing the whole code fits into Babel, right? All of this will convert (...) | Row 1 | 1.1 | 1.2 | 1.3 | | Row 2 | 2.1 | 2.2 | 2.3 | Oh actually you went the 'line' way -- and not the column. Considering, I actually think you're right. I got used to the ReST way (1 item + sub-items = 1 column) but I think your way seems more natural. Cool, thank you again! and the other way. I'm afraid I don't get the 'and the other way', does it means your code can go the column way as well?! Splendid thanks again Nicolas! -- Ben
Re: [O] Basic vcard-to-org-contacts converter
Titus von der Malsburg malsb...@posteo.de writes: Hi list! I decided to give org-contacts a try. Since there doesn't seem to be a facility for importing contacts in vcard format, I wrote a little Python script for that. Perhaps someone on this list finds it useful. https://gist.github.com/tmalsburg/9747104 The script uses the Python package vobject for parsing vcard files. On Debian-like systems this package is available as python-vobject. I tested the script with contacts exported from Apple's iCloud service and that worked well. However, the vcard format is somewhat messy and I don't know what happens with vcard files generated in other contact managers. Use at your own risk. Import from csv is a solution too, I use the below hack functions to import a csv file... #+begin_src (defun eh-org-contacts-parse-csv-line (line) Build a org contact from a csv line (let ((list (split-string line ,))) (concat * (nth 0 list) \n :PROPERTIES:\n :PHONE: (nth 1 list) \n :EMAIL: (let ((string (nth 2 list))) (if (string-match-p @ string) string (if ( (length string) 0) (concat string @qq.com \n :NOTE: (mapconcat 'identity (nthcdr 3 list) ; ) \n :END:\n))) (defun eh-org-contacts-csv-import (optional filename) Convert a csv file to org contacts format and insert current point (interactive) (let ((file (if filename filename (read-file-name CSV file:))) (buffer (current-buffer)) (point (point)) contacts-string) (with-temp-buffer (insert-file-contents file) (goto-char (point-min)) (while ( (point) (point-max)) (setq contacts-string (concat contacts-string (eh-org-contacts-parse-csv-line (buffer-substring (point) (progn (end-of-line) (point \n)) (forward-line 1) (beginning-of-line 1))) (switch-to-buffer buffer) (goto-char point) (insert contacts-string))) #+end_src If there's interest, I might migrate the script to a proper Github repository and develop it further, i.e., merge your pull-requests ;-) Titus --
Re: [O] Better way to specify the latex documentclass of an exported file without changing my configuration?
Alan Schmitt alan.schm...@polytechnique.org writes: Hello, I'm collaborating on a paper with some colleagues, and I convinced them to use org-mode. I'm trying to make sure the paper is as self-contained as possible (I don't want them to have to change their emacs configuration file).To change the documentclass name of the exported Maybe you can write a Makefile to change their emacs configure... article, I added the following block in a section that is not exported: --8---cut here---start-8--- #+begin_src emacs-lisp :results silent :exports results (add-to-list 'org-latex-classes '(llncs \\documentclass{llncs} (\\section{%s} . \\section*{%s}) (\\subsection{%s} . \\subsection*{%s}) (\\subsubsection{%s} . \\subsubsection*{%s}))) #+end_src --8---cut here---end---8--- My questions are: - is there a way to do this without an emacs-lisp block? - is there a nicer way to make sure that an emacs-lisp block is evaluated upon export than :exports results :results silent? (If I don't put it there, the block is not evaluated.) - is there a way to just say the name of the documentclass without all the boilerplate code below? In other words, can I say this is a llncs documentclass with the same sectioning as an article? You should defun a classe for llncs.sty before use it. maybe you can rename llncs.sty to article.sty, and put it to directory which contain your org file. Thanks, Alan --
[O] How to write a org babel hook, which can manupulate result
Hi: I want to write a hook to menupulate org babel output, The problem is: How can I get two points info: [pointA] and [pointB] in my hook function? #+begin_src R :results output raw drawer tbl - data.frame(a=c(1,2,3),b=c(3,2,1)) print(ascii(tbl),type=org) #+END_SRC #+RESULTS: :RESULTS: [pointA] | |a |b | |---+--+--| | 1 | 1.00 | 3.00 | | 2 | 2.00 | 2.00 | | 3 | 3.00 | 1.00 | [pointB] :END: --
Re: [O] How to write a org babel hook, which can manupulate result
Daimrod daim...@gmail.com writes: Feng Shu tuma...@gmail.com writes: Hi: Hi Feng, Look at the :post header argument. (info (org) post) Thanks ... I want to write a hook to menupulate org babel output, The problem is: How can I get two points info: [pointA] and [pointB] in my hook function? #+begin_src R :results output raw drawer tbl - data.frame(a=c(1,2,3),b=c(3,2,1)) print(ascii(tbl),type=org) #+END_SRC #+RESULTS: :RESULTS: [pointA] | |a |b | |---+--+--| | 1 | 1.00 | 3.00 | | 2 | 2.00 | 2.00 | | 3 | 3.00 | 1.00 | [pointB] :END: --
Re: [O] How to write a org babel hook, which can manupulate result
Daimrod daim...@gmail.com writes: Feng Shu tuma...@gmail.com writes: Hi: Hi Feng, Look at the :post header argument. (info (org) post) How to use elisp in :post directly, for example: #+begin_src R :results output raw drawer :post (align-multi-table) content #+end_src #+begin_comment (defun align-multi-table (optional content) (interactive) (let ((content (or content *this*))) (with-temp-buffer (insert content) (goto-char (point-min)) (while (not (eobp)) (when (org-at-table-p) (org-table-align)) (forward-line)) (buffer-string #+end_comment I want to write a hook to menupulate org babel output, The problem is: How can I get two points info: [pointA] and [pointB] in my hook function? #+begin_src R :results output raw drawer tbl - data.frame(a=c(1,2,3),b=c(3,2,1)) print(ascii(tbl),type=org) #+END_SRC #+RESULTS: :RESULTS: [pointA] | |a |b | |---+--+--| | 1 | 1.00 | 3.00 | | 2 | 2.00 | 2.00 | | 3 | 3.00 | 1.00 | [pointB] :END: --
Re: [O] org-babel R output table with plot
John Hendy jw.he...@gmail.com writes: On Mon, Mar 24, 2014 at 7:00 PM, Feng Shu tuma...@gmail.com wrote: John Hendy jw.he...@gmail.com writes: On Mon, Mar 24, 2014 at 10:22 AM, Feng Shu tuma...@gmail.com wrote: Hi everyone I want to R output table with plot, I use a solution below, Who can tell me other solutions? I sort of follow the below, but I think it would be more helpful to describe what you *don't* like about the output below. In other words, what are you trying to achieve that is not working below? It just suit my need, but I want to know more simper solution, which let me type less code. Hmmm. Not seeing a ton of ways to optimize, but it might depend on your total usage scenario. How many of these types of table/plot combinations are you creating? Just a couple sets, or a lot? The plot command is the only one that looks inefficient since a babel block with :file header would automate opening/closing a device... If you defined your data.frame in another babel block and used the :session argument, you could do something like this: #+name: plot #+header: :file /path/to/file.png :width 1600 :height 900 :res 200 #+begin_src R :session r :exports results :results output graphics plot(data) #+end_src After that executes, you'll end up with a named results block which you can manually add the #+caption to? I typically use something like the above. Your solution is nice as one could add things like #+attr_latex or #+begin/end_center code via the paste() function in R... while mine saves having to manually do pnt(); plot(); dev.off(). Another option might be to generate all your plots in a loop, perhaps, and then stick to just programmatically including them with Org syntax? I essentially did that here: - http://lists.gnu.org/archive/html/emacs-orgmode/2012-08/msg01167.html Not really much different than what your'e doing, though, I suppose. It would just scale nicely if you have various data sets and always generate a table and plot from them all. Then you could create your data.frames in a list and then lapply() through them with each of your functions, printing the proper Org syntax as the result (with :results drawer, as you're already using). I use loop to generate multi tables. There is a problem: only the first table generated from current R src. can be aligned correctly, which sometime is very annoy. The below hook can align all the tables generate from R code: #+begin_src elisp (add-hook 'org-babel-after-execute-hook 'eh-org-babel-align-tables) (defun eh-org-babel-align-tables (optional info) Align all tables in the result of the current source (interactive) (let ((location (org-babel-where-is-src-block-result nil info))) (when location (save-excursion (goto-char location) (when (looking-at (concat org-babel-result-regexp .*$)) (while ( (point) (progn (forward-line 1) (org-babel-result-end))) (when (org-at-table-p) (toggle-truncate-lines 1) (org-table-align) (goto-char (org-table-end))) (forward-line))) #+end_src This thread also came to mind, as I was reusing lines like you are, and keeping them in separate babel blocks. I got the suggestion to call a named block, which might be of interest if you've not done that before? - General use: https://www.mail-archive.com/emacs-orgmode@gnu.org/msg56684.html- Using a #+call line: https://www.mail-archive.com/emacs-orgmode@gnu.org/msg56688.html Sorry I can't be of more help! John --
Re: [O] How to write a org babel hook, which can manupulate result
Daimrod daim...@gmail.com writes: Feng Shu tuma...@gmail.com writes: Daimrod daim...@gmail.com writes: Feng Shu tuma...@gmail.com writes: Hi: Hi Feng, Look at the :post header argument. (info (org) post) How to use elisp in :post directly, I don't think you can. You have to use it this way (not tested): #+NAME: align-multi-table #+BEGIN_SRC emacs-lisp :var content=nil :results raw (align-multi-table content) #+END_SRC #+begin_src R :results output raw drawer :post align-multi-table(content=*this*) content #+end_src I prefer using a hook function to do this job, The below is my hook: #+begin_src elisp (add-hook 'org-babel-after-execute-hook 'eh-org-babel-align-tables) (defun eh-org-babel-align-tables (optional info) Align all tables in the result of the current source (interactive) (let ((location (org-babel-where-is-src-block-result nil info))) (when location (save-excursion (goto-char location) (when (looking-at (concat org-babel-result-regexp .*$)) (while ( (point) (progn (forward-line 1) (org-babel-result-end))) (when (org-at-table-p) (toggle-truncate-lines 1) (org-table-align) (goto-char (org-table-end))) (forward-line))) #+end_src for example: #+begin_src R :results output raw drawer :post (align-multi-table) content #+end_src #+begin_comment (defun align-multi-table (optional content) (interactive) (let ((content (or content *this*))) (with-temp-buffer (insert content) (goto-char (point-min)) (while (not (eobp)) (when (org-at-table-p) (org-table-align)) (forward-line)) (buffer-string #+end_comment I want to write a hook to menupulate org babel output, The problem is: How can I get two points info: [pointA] and [pointB] in my hook function? #+begin_src R :results output raw drawer tbl - data.frame(a=c(1,2,3),b=c(3,2,1)) print(ascii(tbl),type=org) #+END_SRC #+RESULTS: :RESULTS: [pointA] | |a |b | |---+--+--| | 1 | 1.00 | 3.00 | | 2 | 2.00 | 2.00 | | 3 | 3.00 | 1.00 | [pointB] :END: --
Re: [O] Images in tables?
Peter Davis p...@pfdstudio.com writes: I'm finishing a PDF document that will contain a number of screen shots. I'd like to put them in a table to avoid just having them arranged vertically on the page. Is there a way to do that? #+MACRO: p \includegraphics[scale=1]{$1} | {{{p(a.png)}}} | {{{p(b.png)}}} | | {{{p(c.png)}}} | {{{p(d.png)}}} | Specifically, I'm using #+ATTR_LATEX: :height 6cm to set the heights of the images. Can that work with a table somehow? Thanks! -pd --
Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export
Leu Zhe lzhe...@gmail.com writes: I am using org-mode to write some article now. Org-mode is really a great tool to outline a article with great table and image support. Org-mode can display inline .png image but not .pdf file. Because now org-mode can not control the width or height of shown inline image, so i use matplotlib to produce low dpi .png image in PNG folder for inline display and higher dpi pdf image in PDF folder for finally article export. In .org file, the image link is like [[file:PNG\*.png]] and \includegraphics{PNG\*.png}in the produced .tex file. Then emacs will use org-latex-pdf-process to render it to pdf file. What I want is that before or in org-latex-pdf-process, a regexp replace function is added to replace the \includegraphics{PDF\*.pdf}, and then produce the final pdf file. Can anyone give a hand? I use R, Maybe this can help you ... #+begin_src R :exports results :results output drawer :var backend=(symbol-name org-export-current-backend) require(ascii) plot.org - function (x, caption) { pngfile - paste(caption, .png, sep=) pdffile - paste(caption, .pdf, sep=) print(paragraph(paste(#+CAPTION: , caption, sep=)),type=org) if (backend != latex){ png(pngfile) plot(x) dev.off() print(paragraph(paste([[./, pngfile, ]], sep=),new=FALSE),type=org) }else{ pdf(pdffile) plot(x) dev.off() print(paragraph(paste([[./, pdffile, ]], sep=),new=FALSE),type=org) } } plot.org(rnorm(100),test) #+end_src --
Re: [O] org-contacts to vCard
Alexis flexibe...@gmail.com writes: I like this tree contact style! A second value `ORG_CONTACTS_STYLE` can have is 'tree': ,* People ,** Alexis ,:PROPERTIES: ,:KIND: individual ,:FIELDTYPE: name ,:END: ,*** Landline ,:PROPERTIES: ,:FIELDTYPE: landline ,:END: , 00 ,*** Mobile ,:PROPERTIES: ,:FIELDTYPE: mobile ,:END: , 999 999 ,*** Email 1 ,:PROPERTIES: ,:PREFERRED: ,:FIELDTYPE: email ,:END: , addres...@example.com ,*** Email 2 ,:PROPERTIES: ,:FIELDTYPE: email ,:END: , addres...@example.com
Re: [O] ANN: org-vcard. Export/import vCards. Backwards-compatible with org-contacts.el.
Alexis flexibe...@gmail.com writes: * New contacts style: 'tree'. org-vcard introduces a new style for Org contacts, called 'tree'. I like store the contacts like tree, may be let org-contacts recognizes this tree is a important thing, are there any plans?
Re: [O] ANN: org-vcard. Export/import vCards. Backwards-compatible with org-contacts.el.
Alexis flexibe...@gmail.com writes: Hi all, i'm pleased to announce the initial release of org-vcard, a package for Org-based export and import of vCards: * Backwards-compatible with org-contacts.el. org-vcard comes with a built-in contacts style called 'flat', which adheres to org-contacts' method of structuring contacts and contact information. It not only supports the properties specified in org-contacts.el, but many other properties as well. * Basic support for vCard 4.0, 3.0 and 2.1. org-vcard is working towards full compliance with the vCard 4.0 (RFC 6350), 3.0 (RFC 2426 and RFC 4770) and 2.1 specifications. * New contacts style: 'tree'. Is it possible support this style? #+begin_comment * People ** Joan Smith :PROPERTIES: :KIND: individual :FIELDTYPE: name :END: *** Cell :PROPERTIES: :FIELDTYPE: cell-folder :END: 999 991 999 992 999 993 999 994 999 995 *** Email :PROPERTIES: :FIELDTYPE: emails-folder :END: address1@hidden address2@hidden address3@hidden address4@hidden address5@hidden #+end_comment
Re: [O] ANN: org-vcard. Export/import vCards. Backwards-compatible with org-contacts.el.
Alexis flexibe...@gmail.com writes: * New contacts style: 'tree'. Is this tree style possible? #+begin-comment * People ** Joan Smith :PROPERTIES: :KIND: individual :FIELDTYPE: name :END: *** Cell :PROPERTIES: :FIELDTYPE: cells-folder :END: 999 991 999 992 999 993 999 994 999 995 *** Email :PROPERTIES: :FIELDTYPE: emails-folder :END: address1@hidden address2@hidden address3@hidden address4@hidden address5@hidden #+end-comment
[O] #+begin_src R :results output drawer doesn't work.
#+begin_src R :results output drawer 1 2 #+end_src #+RESULTS: : 2 --
[O] ob-R, about :results value verbatim drawer
When I run follow code, it just work: #+begin_comment #+BEGIN_SRC R :results value verbatim drawer data - list(a=[[./test1.org]],b=[[./test2.org]],c=[[./test3.org]]) c(data$a,data$b,data$c) #+END_SRC #+RESULTS: :RESULTS: [[./test1.org]] [[./test2.org]] [[./test3.org]] :END: but when I add a #+PROPERTY, it show error like below, how to deal with it ? thanks ... #+PROPERTY: header-args:R :colnames yes :rownames no :exports both #+BEGIN_SRC R :results value verbatim drawer data - list(a=[[./test1.org]],b=[[./test2.org]],c=[[./test3.org]]) c(data$a,data$b,data$c) #+END_SRC executing R code block... Wrote /tmp/babel-1984743i/ob-input-198472lB org-babel-R-evaluate-external-process: Wrong type argument: listp, x [[./test1.org]] [[./test2.org]] [[./test3.org]]
Re: [O] #+call split into multiple lines?
Stefan Vollmar voll...@nf.mpg.de writes: Dear Thomas, dear Sebation, dear Achim, dear Nicolas, maybe a misunderstanding: the original idea is to produce a personal homepage for members of our institute, with one file per person - here is a better example http://www.nf.mpg.de/cv-howto/ex3-en.org and here some background information http://www.nf.mpg.de/cv-howto/cv-en.html. As you can see, we used MACROs for our hcard-HTML templates - this currently does not work unless all arguments are written in one line. We need 10+ arguments and using named arguments is a much better strategy anyway. The problem is quite general, I think, and a common solution I quite like is a key-value structure (preferably with optional comments), one key-value pair per line. Using a table for a key-value assignment is, of course, possible. Here again your example: #+name: card-table | cname | gname | photo | etc.| | Dr. Stefan Vollmar | Stefan | stefan-vollmar.jpg| ... | Editing a table with many columns is awkward (not everybody uses Emacs for our templates). Much easier (to edit) is the transposed version: Is it possible to use the below format? #+name: lists-table #+BEGIN_SRC org - 1 - cname: Dr. Stefan Vollmar - gname: Stefan - photo: stefan - 2 - cname: ... - gname: ... - photo: ... #+END_SRC #+name: card-table | cname | Dr. Stefan Vollmar | | gname | Stefan | | photo | stefan-vollmar.jpg | ... This might work reasonably well - if (1) I could prevent the table from being exported to HTML, (2) (probably more difficult) if this kind of thing would work: #+call: hcard(v=card-table) :results html with ... h1$v[cname]/h1 pbGiven Name:/b $v[gname]/p ... inside the hcard-babel-block (org) to reference the named values. My feeling is (please correct me if I am wrong) that maybe we would want two Babel blocks: one for setting a set of variables/an array (elisp?) and one for filling the template? Could I fill a suitable structure/array/set of variables within an elisp block and then reference it/them in the org template that only requires replacing placeholders? Many thanks in advance! Warm regards, Stefan On 28.03.2013, at 22:51, Thomas S. Dye wrote: Aloha Seb, Sebastien Vauban wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes: Hi Thomas, Thomas S. Dye wrote: In this situation I often put the arguments in a named Org table and then write the Babel source code block to take a single argument--the table name--and parse the information passed in that way. #+name: card-table | cname | gname | photo | etc.| | Dr. Stefan Vollmar | Stefan | stefan-vollmar.jpg| ... | | Dr. Stefan Vollmar, Jr. | Stefan Jr. | stefan-vollmar-jr.jpg | ... | #+call: mhead-hcard(card=card-table[0,]) for Stefan #+call: mhead-hcard(card=card-table[1,]) for Stefan Jr. If you don't mind writing some extra code for the Babel function, then #+call: mhead-hcard(card=card-table,gname=Stefan) etc. And do you eventually have a way to write a for-loop for all the lines of the tables, not being forced to write as many calls as the number of lines you do have? I don't see (immediately) how to do such, but that would really allow to promote such a use case! Not sure I understand your question. Perhaps I misunderstood Stefan's use case? There are several languages supported by Babel that have loop constructs. I was assuming that Stefan would use one of these when I suggested the possibility of writing some extra code. All the best, Tom -- Thomas S. Dye http://www.tsdye.com --
[O] [patch] add 'tel' and 'note' property
From 94cb96299561618ec237e8cb17cc27bdb38218ac Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Fri, 5 Apr 2013 09:47:04 +0800 Subject: [PATCH 1/3] Let org-contacts.el has the ability which can export email-address list * org-contacts.el (org-contacts-vcard-format): let the function work with email-address list. The org-contact file is : * Name :PROPERTIES: :EMAIL: na...@test.org; na...@test.org, na...@test.org na...@test.org :END: The export result is like: BEGIN:VCARD VERSION:3.0 N:Name;;; FN:Name EMAIL:na...@test.org EMAIL:na...@test.org EMAIL:na...@test.org EMAIL:na...@test.org END:VCARD --- contrib/lisp/org-contacts.el | 10 -- 1 个文件被修改,插入 8 行(+),删除 2 行(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index e78b9da..b85ae2d 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -819,13 +819,19 @@ to do our best. (let* ((properties (caddr contact)) (name (org-contacts-vcard-escape (car contact))) (n (org-contacts-vcard-encode-name name)) - (email (org-contacts-vcard-escape (cdr (assoc-string org-contacts-email-property properties + (email (cdr (assoc-string org-contacts-email-property properties))) (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties (addr (cdr (assoc-string org-contacts-address-property properties))) (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties (head (format BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n n name))) (concat head - (when email (format EMAIL:%s\n email)) + (when email (progn + (setq emails-list (split-string email [,;: ]+)) + (setq result ) + (while emails-list + (setq result (concat result EMAIL: (car emails-list) \n)) + (setq emails-list (cdr emails-list))) + result)) (when addr (format ADR:;;%s\n (replace-regexp-in-string \\, ? ; addr))) (when bday -- 1.7.10.4 From fee9e6afbf38db8dcf94763d1e07ca2b35342dea Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Fri, 5 Apr 2013 09:54:06 +0800 Subject: [PATCH 2/3] org-contacts.el, add note property * org-contacts.el (org-contacts-note-property): New varible which add note property (org-contacts-vcard-format): Add the ability exporting note property --- contrib/lisp/org-contacts.el |6 ++ 1 个文件被修改,插入 6 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index b85ae2d..5f16d41 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -71,6 +71,11 @@ When set to nil, all your Org files will be used. :type 'string :group 'org-contacts) +(defcustom org-contacts-note-property NOTE + Name of the property for contact note. + :type 'string + :group 'org-contacts) + (defcustom org-contacts-birthday-format Birthday: %l (%Y) Format of the anniversary agenda entry. The following replacements are available: @@ -841,6 +846,7 @@ to do our best. (calendar-extract-month cal-bday) (calendar-extract-day cal-bday (when nick (format NICKNAME:%s\n nick)) + (when note (format NOTE:%s\n note)) END:VCARD\n\n))) (defun org-contacts-export-as-vcard (optional name file to-buffer) -- 1.7.10.4 From 38ef150badd21eb0c5d9159e6444cdeeb1252380 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Fri, 5 Apr 2013 09:59:55 +0800 Subject: [PATCH 3/3] org-contacts.el, add tel property * org-contacts.el (org-contacts-tel-property): New variable, add tel property (org-contacts-vcard-format): Add the ability exporting tel property --- contrib/lisp/org-contacts.el | 12 1 个文件被修改,插入 12 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 5f16d41..8172c80 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -61,6 +61,11 @@ When set to nil, all your Org files will be used. :type 'string :group 'org-contacts) +(defcustom org-contacts-tel-property PHONE + Name of the property for contact phone number. + :type 'string + :group 'org-contacts) + (defcustom org-contacts-address-property ADDRESS Name of the property for contact address. :type 'string @@ -839,6 +844,13 @@ to do our best. result)) (when addr (format ADR:;;%s\n (replace-regexp-in-string \\, ? ; addr))) + (when tel (progn + (setq phones-list (split-string tel [,;: ]+)) + (setq result ) + (while phones-list + (setq result (concat result TEL: (car phones-list) \n)) + (setq phones-list (cdr phones-list))) + result)) (when bday (let ((cal-bday (calendar-gregorian-from-absolute (org-time-string-to-absolute bday (format BDAY:%04d-%02d-%02d\n -- 1.7.10.4 --
[O] Fix bugs introduced by [patch] add 'tel' and 'note' property'
From 4eb305cdf2f7c59b8e014514c0409d4da2eb9eab Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Sun, 7 Apr 2013 11:12:09 +0800 Subject: [PATCH] [PATCH] org-contacts.el , fix bugs about 'tel and 'note properties * contrib/lisp/org-contacts.el (org-contacts-vcard-format): fix bug prvious intruduced ,add 'tel and 'note --- contrib/lisp/org-contacts.el |2 ++ 1 个文件被修改,插入 2 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index f529014..65eeea8 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -834,6 +834,8 @@ to do our best. (name (org-contacts-vcard-escape (car contact))) (n (org-contacts-vcard-encode-name name)) (email (cdr (assoc-string org-contacts-email-property properties))) + (tel (cdr (assoc-string org-contacts-tel-property properties))) + (note (cdr (assoc-string org-contacts-note-property properties))) (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties (addr (cdr (assoc-string org-contacts-address-property properties))) (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties -- 1.7.10.4 --
Re: [O] phone links...
Michael Strey mst...@strey.biz writes: Robert, On Do, Apr 04, 2013 at 09:38:48 -0500, Robert P. Goldman wrote: [...] I will be happy to include this into contrib (and do the relevant assignment) at any time when people think that it is sufficiently ready to go. I have been testing it in contrib/ in a testing branch in my git repo. Moreover the definition of the phone link would allow to extend the current functionality of MobileOrg by a phone call function. It will be a great feature and mobileorg is a good way of managing phone numbers Regards --
[O] need a org-contacts feature
org-contacts is very useful, but it can't be work well with CJK users for CJK input method, I need a feature like this: 1. If I search string 你好 ,the result will be: 你好 2. if I have a dict function in which there is '(nihao 你好) or '(nh 你好) 3. the feature I expect is like: when I search nihao or nh ,the result will be 你好 Thanks --
[O] [PATCH] org-contacts.el, add alias properties
From 27f65b3939ca60ec7abf7d066b3aadfff44396a8 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Wed, 10 Apr 2013 21:05:15 +0800 Subject: [PATCH] org-contacts.el, add name alias property. * contrib/lisp/org-contacts.el (org-contacts-alias-property): add new varible (org-contacts-matcher): add org-contacts-alias-property to this list Name alias is a very useful feature, especially for CJK users. --- contrib/lisp/org-contacts.el |7 +++ 1 个文件被修改,插入 7 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 65eeea8..a3c4aed 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -81,6 +81,12 @@ When set to nil, all your Org files will be used. :type 'string :group 'org-contacts) +(defcustom org-contacts-alias-property ALIAS + Name of the property for contact name alias. + :type 'string + :group 'org-contacts) + + (defcustom org-contacts-birthday-format Birthday: %l (%Y) Format of the anniversary agenda entry. The following replacements are available: @@ -129,6 +135,7 @@ The following replacements are available: (defcustom org-contacts-matcher (mapconcat 'identity (list org-contacts-email-property + org-contacts-alias-property org-contacts-tel-property org-contacts-address-property org-contacts-birthday-property) -- 1.7.10.4 --
Re: [O] need a org-contacts feature
Torsten Wagner torsten.wag...@gmail.com writes: Hi, do I understand correct, that you want to enter the pinyin transcription to search for the desired hànzì? It's right, but want I want to know is: how to hook this kind of function into org-contacts.el. But I find a simple way: add alias properties to org-contacts.el #+begin_example * 你好 :PROPERTIES: :ALIAS: nh :EMAIL: 601651...@qq.com :PHONE: 15133912738 #+end_example When I search 'nh' ,I can get 你好 contact Not sure whether this is possible. I guess you are aware of the emacs input methods?! I have found a function that can transcript hanzi to pinyin A dictionary method like you describe might be doable with yasnippet. http://capitaomorte.github.io/yasnippet/ However, it would only be practical for the most common words. Hope that helps a bit Greetings Torsten On 9 April 2013 12:10, Feng Shu tuma...@gmail.com wrote: org-contacts is very useful, but it can't be work well with CJK users for CJK input method, I need a feature like this: 1. If I search string 你好 ,the result will be: 你好 2. if I have a dict function in which there is '(nihao 你好) or '(nh 你好) 3. the feature I expect is like: when I search nihao or nh , the result will be 你好 Thanks -- --
[O] [Help] Which function can get a head's context
#+begin_example * head1 :tag1: #+end_example How can I get 'head1' Feng Shu --
Re: [O] [Help] Which function can get a head's context
Thanks Bastien --
[O] org.texi:8719 Error
org-version: 8.0-pre (release_8.0-pre-416-gbf338e) makeinfo --no-split org.texi -o org org.texi:8719: No closing brace for footnote `'. org.texi:8719: Unmatched }. makeinfo: Removing output file `org' due to errors; use --force to preserve. make[1]: *** [org] Error 1 make[1]: Leaving directory `/home/feng/project/org-mode/doc' make: *** [info] Error 2 --
[O] [Help] How to apply a function to all head of buffer
I need a function apply all the head of a org buffer,I know it will use loop ,but I don't know the details --
Re: [O] [Help] How to apply a function to all head of buffer
Thanks Eric ! --
Re: [O] phone links...
Michael Strey mst...@strey.biz writes: Robert, On Mo, Apr 08, 2013 at 09:44:12 -0500, Robert Goldman wrote: Michael Strey wrote: Currently org-phone.el as well as my org-dial.el are incompatible with org-contacts. The only idea behind my proposal was to make the contributors of both packages aware of each other. Can you explain what makes org-phone incompatible with org-contacts? Maybe my naming of some function? The problem is on the side of org-contacts. Org-contacts does not support links in its properties. Thus, currently the only solution to use the advantages of org-contacts and org-phone is to give the information twice, like in the following example. #+BEGIN_SRC org * Strey, Michael :PROPERTIES: :EMAIL:mst...@strey.biz f...@bar.com :PHONE:+493514129535 +491263213 :END: [[mailto:mst...@strey.biz]] [[mailto:f...@bar.com]] [[phone:+49 (0)351 41295-35]] [[phone:+49 126 3213]] #+END_SRC I use a export function which can export all contacts to the format: #+begin_example * NAME ** EMAIL: [[mailto:n...@n.com]] ** EMAIL: [[mailto:n...@n.com]] ** PHONE: [[tel:123456789]] ** PHONE: [[tel:123456789]] #+end_example It it only a temporary solution, may be someone will need it ,but adding it to the master may be not a good idea. From 2c73cdfdf54fe4c882a3bc0d3ce3cd268555100e Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Sat, 13 Apr 2013 22:00:03 +0800 Subject: [PATCH] org-contacts.el, export contacts to outline-format * contrib/lisp/org-contacts.el (org-contacts-outline-file): new variable (org-contacts-outline-format): new function which formats a contact to outline-format (org-contacts-export-as-outline-format): new function, formats all contacts to outline-format * NAME :PROPERTIES: :EMAIL: n...@n.com n...@n.com :PHONE: 123456789 :END: export as: * NAME ** EMAIL: [[mailto:n...@n.com]] ** EMAIL: [[mailto:n...@n.com]] ** PHONE: [[tel:123456789]] ** PHONE: [[tel:123456789]] --- contrib/lisp/org-contacts.el | 69 ++ 1 个文件被修改,插入 69 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index a3c4aed..dd89251 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -156,6 +156,12 @@ This overrides `org-email-link-description-format' if set. :group 'org-contacts :type 'file) +(defcustom org-contacts-outline-file contacts-outline.org + Default file for outline-format export. + :group 'org-contacts + :type 'file) + + (defcustom org-contacts-enable-completion t Enable or not the completion in `message-mode' with `org-contacts'. :group 'org-contacts @@ -896,6 +902,69 @@ is created and the VCard is written into that buffer. (current-buffer) (progn (save-buffer) (kill-buffer) +(defun org-contacts-outline-format (contact) + Formats CONTACT in outline format. + (let* ((properties (caddr contact)) + (name (org-contacts-vcard-escape (car contact))) + (n (org-contacts-vcard-encode-name name)) + (email (cdr (assoc-string org-contacts-email-property properties))) + (tel (cdr (assoc-string org-contacts-tel-property properties))) + (note (cdr (assoc-string org-contacts-note-property properties))) + (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties + (addr (cdr (assoc-string org-contacts-address-property properties))) + (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties + (head (format * %s\n name))) +(concat head + (when email (progn + (setq emails-list (split-string email [,;: ]+)) + (setq result ) + (while emails-list + (setq result (concat result ** EMAIL: (concat [[mailto: (car emails-list) ]]) \n)) + (setq emails-list (cdr emails-list))) + result)) + (when addr + (format ** ADRESS: (replace-regexp-in-string \\, ? ; addr))) + (when tel (progn + (setq phones-list (split-string tel [,;: ]+)) + (setq result ) + (while phones-list + (setq result (concat result ** TEL: (concat [[tel: (car phones-list) ]] ) \n)) + (setq phones-list (cdr phones-list))) + result)) + (when bday + (let ((cal-bday (calendar-gregorian-from-absolute (org-time-string-to-absolute bday + (format ** BDAY:%04d-%02d-%02d\n + (calendar-extract-year cal-bday) + (calendar-extract-month cal-bday) + (calendar-extract-day cal-bday + (when nick (format ** NICKNAME: %s\n nick)) + (when note (format ** NOTE: %s\n note) + + + +(defun org-contacts-export-as-outline-format (optional name file to-buffer) + Export all contacts matching NAME as outline format +If TO-BUFFER is nil, the content is written to FILE or +`org-contacts-outline-file'. If TO-BUFFER is non-nil, the buffer +is created and the outlines is written into that buffer. + (interactive) ; TODO ask for name? + (let* ((filename (or file org-contacts-outline-file)) + (buffer
Re: [O] phone links...
[update diff] make output format more beautiful From 500694de70f14095acc765875182d65feab7ef85 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Sat, 13 Apr 2013 22:00:03 +0800 Subject: [PATCH] org-contacts.el, export contacts to outline-format * contrib/lisp/org-contacts.el (org-contacts-outline-file): new variable (org-contacts-outline-format): new function which formats a contact to outline-format (org-contacts-export-as-outline-format): new function, formats all contacts to outline-format * NAME :PROPERTIES: :EMAIL: n...@n.com n...@n.com :PHONE: 123456789 :END: export as: * NAME ** EMAIL: [[mailto:n...@n.com]] ** EMAIL: [[mailto:n...@n.com]] ** PHONE: [[tel:123456789]] ** PHONE: [[tel:123456789]] --- contrib/lisp/org-contacts.el | 72 ++ 1 个文件被修改,插入 72 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index a3c4aed..c65ebf0 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -156,6 +156,12 @@ This overrides `org-email-link-description-format' if set. :group 'org-contacts :type 'file) +(defcustom org-contacts-outline-file contacts-outline.org + Default file for outline-format export. + :group 'org-contacts + :type 'file) + + (defcustom org-contacts-enable-completion t Enable or not the completion in `message-mode' with `org-contacts'. :group 'org-contacts @@ -896,6 +902,72 @@ is created and the VCard is written into that buffer. (current-buffer) (progn (save-buffer) (kill-buffer) +(defun org-contacts-outline-format (contact) + Formats CONTACT in outline format. + (let* ((properties (caddr contact)) + (name (org-contacts-vcard-escape (car contact))) + (n (org-contacts-vcard-encode-name name)) + (email (cdr (assoc-string org-contacts-email-property properties))) + (alias (cdr (assoc-string org-contacts-alias-property properties))) + (tel (cdr (assoc-string org-contacts-tel-property properties))) + (note (cdr (assoc-string org-contacts-note-property properties))) + (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties + (addr (cdr (assoc-string org-contacts-address-property properties))) + (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties + (head (format * %s\n name))) +(concat head + (when alias + (format ** ALIAS: %s\n alias)) + (when email (progn + (setq emails-list (split-string email [,;: ]+)) + (setq result ) + (while emails-list + (setq result (concat result ** EMAIL:(concat [[mailto: (car emails-list) ]]) \n)) + (setq emails-list (cdr emails-list))) + result)) + (when addr + (format ** ADRESS: (replace-regexp-in-string \\, ? ; addr))) + (when tel (progn + (setq phones-list (split-string tel [,;: ]+)) + (setq result ) + (while phones-list + (setq result (concat result ** TEL: (concat [[tel: (car phones-list) ]] ) \n)) + (setq phones-list (cdr phones-list))) + result)) + (when bday + (let ((cal-bday (calendar-gregorian-from-absolute (org-time-string-to-absolute bday + (format ** BDAY:%04d-%02d-%02d\n + (calendar-extract-year cal-bday) + (calendar-extract-month cal-bday) + (calendar-extract-day cal-bday + (when nick (format ** NICKNAME: %s\n nick)) + (when note (format ** NOTE:%s\n note) + + + +(defun org-contacts-export-as-outline-format (optional name file to-buffer) + Export all contacts matching NAME as outline format +If TO-BUFFER is nil, the content is written to FILE or +`org-contacts-outline-file'. If TO-BUFFER is non-nil, the buffer +is created and the outlines is written into that buffer. + (interactive) ; TODO ask for name? + (let* ((filename (or file org-contacts-outline-file)) + (buffer (if to-buffer + (get-buffer-create to-buffer) + (find-file-noselect filename +(message Exporting...) +(set-buffer buffer) +(let ((inhibit-read-only t)) (erase-buffer)) +(fundamental-mode) +(when (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) +(loop for contact in (org-contacts-filter name) + do (insert (org-contacts-outline-format contact))) +(if to-buffer + (current-buffer) + (progn (save-buffer) (kill-buffer) + + (defun org-contacts-show-map (optional name) Show contacts on a map. Requires google-maps-el. -- 1.7.10.4 --
Re: [O] phone links...
Bastien b...@gnu.org writes: Hi Feng, Feng Shu tuma...@gmail.com writes: [update diff] make output format more beautiful thanks for the patch -- at first sight, the formatting should be fixed, let's try to avoid lines longer than 80 characters. But in general, I'd be more comfortable with someone taking org-contacts.el in charge: I copy Grégoire as he proposed to do this. Thanks, Hi Bastien, I don't think this patch should be include into master, I don't want people run between two different format. Now org-mobile can't show propertiy quickly ,may be it's only a tmp solution of the problem. I want org-contact.el can manage this kind of format directly instead of exporting, but it's beyond my ability for I'm not a programmer Feng Shu --
Re: [O] phone links...
Bastien b...@gnu.org writes: Hi Feng, thanks for your reply. I'll let Grégoire decide on what to apply to org-contacts.el. Best, It's a good decision --
Re: [O] phone links...
Daimrod daim...@gmail.com writes: I agree with you, it would be much better if org-contacts managed links within properties. I think the two format have less difference org-android and org-android-NG can't show properties like outline, I expect to see the implement of this feature I'll look at Michael's patch which implements this. Regards, --
Re: [O] problems with org-protocol + capture templates
Fabrice Popineau fabrice.popin...@supelec.fr writes: I use org-protocol with Chrome and Windows 8, emacs 24.3+ and some recent Org mode. I definitely can select the capture template. I use emacsclientw.exe rather than emacs.exe to store the link. It also means that emacs is already started and org-mode already loaded. emacsclient don't creat a new frame by default, If you have no emacs frame, org-protocol for firefox is nearly useless. I use a bash wrap file org-capture.sh to launch emacs frame: #+begin_src #!/bin/bash set -efu TEST=$(ps ax | grep org-capture-for-firefox | grep -v grep | wc -l) if [ $TEST = 1 ] ; then exec emacsclient $*; exit 0; else exec emacsclient -c -a '' -F '((name . org-capture-for-firefox))' $* exit 0; fi #+end_src Fabrice 2013/4/16 Bastien b...@gnu.org Hi Sébastien, Sebastien Vauban wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes: Alvar Maciel wrote: Hi to all, I'm using org-mode as personal day planner with almost all the configuration of http://doc.norang.ca/org-mode.html I try to use org-protocol to send links to emacs using the config of worg. But when emacs open i can not select the template of the capture mode (it's weird months ago was working) and i don't know were is my mistake. this is my keybindidng var orgProtoString = 'org-protocol://capture://'+ encodeURIComponent(gBrowser.currentURI.spec) + '/' + encodeURIComponent(gBrowser.contentWindow.document.title) + '/' + encodeURIComponent(content.window.getSelection()); gBrowser.loadURI(orgProtoString); my capture template (setq org-capture-templates (quote ((t todo entry (file ~/en uso/2013/org/refile.org) * TODO %?\n%U\n%a\n :clock-in t :clock-resume t) (r respond entry (file ~/en uso/2013/org/refile.org) * NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n :clock-in t :clock-resume t :immediate-finish t) (n note entry (file ~/en uso/2013/org/refile.org) * %? :NOTE:\n%U\n%a\n :clock-in t :clock-resume t) (j Journal entry (file+datetree ~/Dropbox/en uso/2013/org/diary.org) * %?\n%U\n :clock-in t :clock-resume t) (w org-protocol entry (file ~/en uso/2013/org/refile.org) * TODO Review %c\n%U\n :immediate-finish t) (p Phone call entry (file ~/en uso/2013/org/refile.org) * PHONE %? :PHONE:\n%U :clock-in t :clock-resume t) (h Habit entry (file ~/en uso/2013/org/refile.org) * NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \%Y-%m-%d %a .+1d/3d\)\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n AFAIK, no, you can't dynamically select your template. I'm not using org-protocol anymore but I certainly *do* remember that you can dynamically select a capture template. So maybe Alvar's issue needs some investigation. -- Bastien --
Re: [O] [solution] Chinese characters in Beamer export
James Harkins jamshar...@gmail.com writes: Maybe my org config can give you some informations: https://github.com/tumashu/emacs-helper/blob/master/eh-org.el FWIW, this is what it took for me to get Chinese characters to export in beamer. (Adding a TODO to write this up for worg.) 1. Use texlive 2012. (The Ubuntu packages for 12.04 date back to 2009. I couldn't get them to work for this.) 2. In the preamble of your org document: #+LaTeX_HEADER: \usepackage{CJKutf8} #+BEGIN_LaTeX \AtBeginDocument{% \begin{CJK}{UTF8}{gbsn}} \AtEndDocument{% \end{CJK}} #+END_LaTeX These LaTeX snippets come from the documentation of the CJK package. gbsn is for simplified Chinese characters (used on the mainland). Other options for Chinese may be found at: http://en.wikibooks.org/wiki/LaTeX/Internationalization#Chinese That pretty much did it (although it took quite a bit of sleuthing to find this, thanks to a fair amount of out of date information that will never, ever die in the big search engines). Except for one problem. LaTeX inputenc will complain about the Chinese characters being not set up for use with LaTeX, but the document does render. I'll have to leave that question aside for the moment, but this isn't the last time I'll need Chinese characters in a presentation so I'll come back to that before posting anything on worg. (Or, maybe a sophisticated LaTeX user knows what is wrong?) hjh --
Re: [O] Mobileorg- Automatic pushing and pulling
Marvin Doyley marvin...@gmail.com writes: Hi there, Does anybody knows how to configure emacs to push and pull notes automatically. Please read org-mobile FAQ! Thanks M --
[O] require a feature: merge many contacts which have the same name.
I think org-contacts.el shoule have the feature which can merge many contacts which have the same name into one, for example: #+begin_example * name :PROPERTIES: :EMAIL: [[mailto:a...@a.com]] [[mailto:b...@b.com]] :PHONE: [[tel:123456789]] :ALIAS:a :END: * name :PROPERTIES: :EMAIL: [[mailto:c...@a.com]] [[mailto:d...@b.com]] :PHONE: [[tel:987654321]] :ALIAS:b :END: * name :PROPERTIES: :EMAIL: [[mailto:e...@a.com]] [[mailto:f...@b.com]] :PHONE: [[tel:111]] :ALIAS:c :END: #+end_example how can I get the result: #+begin_example * name :PROPERTIES: :EMAIL: [[mailto:a...@a.com]] [[mailto:b...@b.com]] [[mailto:c...@a.com]] [[mailto:d...@b.com]] [[mailto:e...@a.com]] [[mailto:f...@b.com]] :PHONE: [[tel:123456789]] [[tel:987654321]] [[tel:]] :ALIAS:a b c :END: #+end_example Feng Shu --
Re: [O] org-mime
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes: I thank you Eric and Uwe for your help. Many thanks also to all the developers of emacs and org-mode. In fact I just spent two days in configuring my emacs24 and gnus. (Eric, I did not understand how worked your emacs24-starter-kit , which is a nice tool indeed). The last problem that I meet on my laptop is an error message : smtp-server not defined , and , until now, I do not find how to fix it :( (if someone has a suggestion, thanks in advance). My goal is to succeed to stay in emacs, for LaTeX as well as for emails, but I have to work again. Every help on LaTeX and emails via org-mode will be welcome. Your setting may be same as my emacs configure ,I use 1. gnus + offlineimap + dovecot + gmail + org-contacts.el 2. org-mode + xelatex May be my configure can help you #+begin_src emacs-lisp ;;; eh-org.el --- Tumashu's org-mode configuation ;; Copyright (c) 2012, Feng Shu ;; Author: Feng Shu tuma...@gmail.com ;; URL: https://github.com/tumashu/tumashu.github.com ;; Version: 0.0.2 ;; Package-Requires: ((org 7.8.00)) ;; This file is not part of GNU Emacs. ;;; Commentary: ;; 这个文件是tumashu个人专用的emacs配置文件,emacs中文用户可以参考。 ;;; License: ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation; either version 3 ;; of the License, or (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Code: (require 'org) (require 'ox-ascii) (require 'ox-latex) (require 'ox-beamer) (require 'ox-html) (require 'ox-deck) (require 'ox-s5) (require 'ox-rss) (require 'ox-md) (require 'ox-odt) (require 'org-contacts) (require 'org-mime) (require 'org-bookmark) (require 'org-protocol) (require 'ob-R) (setq org-export-backends '(ascii beamer html latex md odt deck rss s5)) (add-to-list 'auto-mode-alist '(\.\(org\|org_archive\)$ . org-mode)) (setq org-log-done t) (setq org-startup-indented nil) (setq org-confirm-babel-evaluate nil) ;; org-bable设置 ; font-lock in src code blocks (setq org-src-fontify-natively t) (org-babel-do-load-languages 'org-babel-load-languages '((R . t) (ditaa . t) (dot . t) (emacs-lisp . t) (gnuplot . t) (haskell . nil) (mscgen . t) (latex . t) (ocaml . nil) (perl . t) (python . t) (ruby . nil) (screen . nil) (sh . t) (sql . nil) (sqlite . nil))) ;; org-babel hook (add-hook 'org-babel-after-execute-hook 'org-display-inline-images) ;; use Cairo graphics device by default,which can get better graphics quality. ;; you shoule add require(Cairo) to you ~/.Rprofile (setq org-babel-R-graphics-devices '((:bmp bmp filename) (:jpg jpeg filename) (:jpeg jpeg filename) (:tikz tikz file) (:tiff tiff filename) (:png CairoPNG filename) (:svg CairoSVG file) (:pdf CairoPDF file) (:ps CairoPS file) (:postscript postscript file))) ;;export (setq org-default-language zh-CN) ;; html (setq org-html-coding-system 'utf-8) (setq org-html-head-include-default-style nil) (setq org-html-head-include-scripts nil) ;; latex (setq org-latex-coding-system 'utf-8) (setq org-latex-date-format %Y-%m-%d) (setq org-export-with-LaTeX-fragments 'imagemagick) (setq org-latex-create-formula-image-program 'imagemagick) (setq org-latex-pdf-process '(xelatex -interaction nonstopmode -output-directory %o %f xelatex -interaction nonstopmode -output-directory %o %f xelatex -interaction nonstopmode -output-directory %o %f)) (add-to-list 'org-latex-classes '(ctexart \\documentclass{ctexart} (\\section{%s} . \\section*{%s}) (\\subsection{%s} . \\subsection*{%s}) (\\subsubsection{%s} . \\subsubsection*{%s}) (\\paragraph{%s} . \\paragraph*{%s}) (\\subparagraph{%s} . \\subparagraph*{%s}))) (add-to-list 'org-latex-classes '(ctexrep \\documentclass{ctexrep} (\\part{%s} . \\part*{%s}) (\\chapter{%s} . \\chapter*{%s}) (\\section{%s} . \\section*{%s}) (\\subsection{%s} . \\subsection*{%s}) (\\subsubsection{%s} . \\subsubsection*{%s}))) (add-to-list 'org-latex-classes '(ctexbook \\documentclass{ctexbook} (\\part{%s} . \\part*{%s}) (\\chapter{%s} . \\chapter*{%s
Re: [O] org-mime
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes: 2013/5/16 Feng Shu tuma...@gmail.com Your setting may be same as my emacs configure ,I use 1. gnus + offlineimap + dovecot + gmail + org-contacts.el 2. org-mode + xelatex May be my configure can help you Of course it could be helpful and I thank you warmly for your email. At the moment I'm using neither offlineimap neither xelatex, but why not. My worry of the day is to understand why, on my laptop only, I meet this error message of smtp-server not defined; I do not understand, and I see via Google that I am not alone... some guess: 1. you can try the newest devel version from gnus.git 2. install gnutls, openssl, and so on 3. Is your authinfo correct? 4. reinstall emacs We stay in touch, no doubt that you can help me to succeed in improving my use of emacs and LaTeX. Thanks again ! Jo. --
[O] Can't preview latex fragment
The error is like this: Creating image...1 let: Symbol's value as variable is void: org-export--default-title --
Re: [O] Can't preview latex fragment
Nicolas Goaziou n.goaz...@gmail.com writes: Hello, Feng Shu tuma...@gmail.com writes: The error is like this: Creating image...1 let: Symbol's value as variable is void: org-export--default-title Thank you for the report. The problem should be fixed. Could you confirm it? It's work, thanks! Regards, --
Re: [O] RFQ - new contribution - org-screenshot.el
Haider Rizvi hari...@gmail.com writes: Max Mikhanosha m...@openchat.com writes: Hi All, I've been writing some documentation in OrgMode with screenshots, and as with any screenshot taking, it takes a while to get one just right. A few tiny helper utilities, quickly snowballed into this :-) It may need some cleanup, but IMHO its too awesome not to share it with the list. To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Cool. Can you make this a bit portable. On Mac OSX, the utility is called screencapture, and can be run with the same flags. Here is a piece of code that was published earlier with a sample use. It's a good idea, import has nearly same feature as scrot and should work with org-screenshot ,it is included imagemagick https://wiki.archlinux.org/index.php/Taking_a_Screenshot http://thread.gmane.org/gmane.emacs.orgmode/69221/focus=69272 , | #+BEGIN_SRC emacs-lisp | (defun paste-clipboard-to-file (optional filename temp-dir) | Take a screenshot using the crosshairs and saveit to FILENAME, | if it is given or to a temp file in the TEMP-DIR | directory. Then add an orgmode style link at point. | (interactive) | (let* ((temporary-file-directory (or temp-dir images)) |(fname (or filename (make-temp-file img nil .jpg | (call-process-shell-command (concat | /usr/sbin/screencapture -s fname)) | (insert \n[[file: fname ]]) | (org-display-inline-images))) | ;; | (global-set-key (kbd C-c p) 'paste-clipboard-to-file) | | #+END_SRC ` Regards, --
Re: [O] Expanded property drawers as per file option
Thorsten Jolitz tjol...@gmail.com writes: Thorsten Jolitz tjol...@gmail.com writes: Karl Voit devn...@karl-voit.at writes: Hi! I could not find anything yet which says that it's possible (or not) to define a file variable which enables PROPERTY drawers to be expanded (only in this current file). My use case: I usually never store major meta-data in drawers. So I like the default behavior with closed property drawers. Except in my contacts.org where I store basic data of persons I want to see. Therefore, I would like to have these drawers expanded whenever I expand the heading of a person. In other words: heading content expanded - property drawer expanded. All other Org-mode files should keep their behavior that I manually have to expand drawers when I want to see their content. Is there a method to get this kind of behavior? sorry, that was a bit too hurried, I think this one is what you might need: ,- | (defun find-org-contracts () | (interactive) | (find-file /path/to/contracts.org) | (show-all)) | | M-x find-org-contracts `- I use: #+STARTUP: showeverything --
[O] [PATCH] org-contacts.el: add expire feature
From e974db131d88acf06bb6b250eac2fae8c7d0a96e Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Wed, 29 May 2013 20:30:43 +0800 Subject: [PATCH] * contrib/lisp/org-contacts.el: Add a feature which can expire emails and phones * test :PROPERTIES: :EMAIL: te...@gmail.com te...@gmail.com te...@gmail.com :PHONE: 123456 123457 123458 :EXPIRE: te...@gmail.com 123457 :END: when completing or exporting to vcard, the emails and phones in the expire property (te...@gmail.com and 123457) will be ignore --- contrib/lisp/org-contacts.el | 32 +++- 1 个文件被修改,插入 27 行(+),删除 5 行(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 7b0b603..ae6c6f1 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -86,6 +86,11 @@ When set to nil, all your Org files will be used. :type 'string :group 'org-contacts) +(defcustom org-contacts-expire-property EXPIRE + Name of the property for emails or phones which will be expired + :type 'string + :group 'org-contacts) + (defcustom org-contacts-birthday-format Birthday: %l (%Y) Format of the anniversary agenda entry. @@ -476,6 +481,14 @@ A group FOO is composed of contacts with the tag FOO. (completion-table-case-fold completion-list (not org-contacts-completion-ignore-case + +(defun org-contacts-remove-expired-property (expire-list list) + Remove emails or phones in list-expired from list +(while expire-list + (setq list (remove (car expire-list) list)) + (setq expire-list (cdr expire-list))) +list) + (defun org-contacts-complete-name (start end string) Complete text at START with a user name and email. (let* ((completion-ignore-case org-contacts-completion-ignore-case) @@ -484,10 +497,17 @@ A group FOO is composed of contacts with the tag FOO. ;; The contact name is always the car of the assoc-list ;; returned by `org-contacts-filter'. for contact-name = (car contact) + + ;; Build the list of the email addresses which has + ;; been expired + for expire-list = (org-contacts-split-property (or +(cdr (assoc-string org-contacts-expire-property + (caddr contact))) )) ;; Build the list of the user email addresses. - for email-list = (org-contacts-split-property (or - (cdr (assoc-string org-contacts-email-property - (caddr contact))) )) + for email-list = (org-contacts-remove-expired-property expire-list + (org-contacts-split-property (or + (cdr (assoc-string org-contacts-email-property + (caddr contact))) ))) ;; If the user has email addresses… if email-list ;; … append a list of USER EMAIL. @@ -869,15 +889,17 @@ to do our best. (n (org-contacts-vcard-encode-name name)) (email (cdr (assoc-string org-contacts-email-property properties))) (tel (cdr (assoc-string org-contacts-tel-property properties))) + (expire (cdr (assoc-string org-contacts-expire-property properties))) (note (cdr (assoc-string org-contacts-note-property properties))) (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties (addr (cdr (assoc-string org-contacts-address-property properties))) (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties (head (format BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n n name)) + (expire-list (when expire (setq expire-list (org-contacts-split-property expire emails-list result phones-list) (concat head (when email (progn - (setq emails-list (org-contacts-split-property email)) + (setq emails-list (org-contacts-remove-expired-property expire-list (org-contacts-split-property email))) ; (setq result ) (while emails-list (setq result (concat result EMAIL: (org-contacts-strip-link (car emails-list)) \n)) @@ -886,7 +908,7 @@ to do our best. (when addr (format ADR:;;%s\n (replace-regexp-in-string \\, ? ; addr))) (when tel (progn - (setq phones-list (org-contacts-split-property tel)) + (setq phones-list (org-contacts-remove-expired-property expire-list (org-contacts-split-property tel))) (setq result ) (while phones-list (setq result (concat result TEL: (org-contacts-strip-link (car phones-list)) \n)) -- 1.7.10.4 --
Re: [O] [PATCH] org-contacts.el: add expire feature
Daimrod daim...@gmail.com writes: Feng Shu tuma...@gmail.com writes: (defun org-contacts-complete-name (start end string) Complete text at START with a user name and email. (let* ((completion-ignore-case org-contacts-completion-ignore-case) @@ -484,10 +497,17 @@ A group FOO is composed of contacts with the tag FOO. ;; The contact name is always the car of the assoc-list ;; returned by `org-contacts-filter'. for contact-name = (car contact) + +;; Build the list of the email addresses which has +;; been expired +for expire-list = (org-contacts-split-property (or +(cdr (assoc-string org-contacts-expire-property + (caddr contact))) )) ;; Build the list of the user email addresses. -for email-list = (org-contacts-split-property (or -(cdr (assoc-string org-contacts-email-property - (caddr contact))) )) +for email-list = (org-contacts-remove-expired-property expire-list + (org-contacts-split-property (or + (cdr (assoc-string org-contacts-email-property + (caddr contact))) ))) I forgot to ask, why do you also modify org-contacts-complete-name? This function isn't used to export to VCARD, but to complete the email in Gnus. I want to ignore the emails which have been expired when I complete in the gnus --
Re: [O] [PATCH] org-contacts.el: add expire feature
Daimrod daim...@gmail.com writes: updated patch; From b0851e4c48e4c2e67fd8aafdf04951e764e07ccf Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Wed, 29 May 2013 20:30:43 +0800 Subject: [PATCH] Add a feature, which can ignore emails or phones with property * contrib/lisp/org-contacts.el (org-contacts-ignore-property): New variable. (org-contacts-remove-ignored-property-values): New function, which remove all ignore-list's elements from list. (org-contacts-complete-name): When completing, ignore the values which has been included into the ignore property. (org-contacts-vcard-format): Don't export the values which has been included into the ignore property. If emails or phones is included into the ignore property, they will not show in complete buffer. When the contact is exported to vcard, they will be ignored too. --- contrib/lisp/org-contacts.el | 31 ++- 1 个文件被修改,插入 26 行(+),删除 5 行(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 7b0b603..1be0ac9 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -86,6 +86,11 @@ When set to nil, all your Org files will be used. :type 'string :group 'org-contacts) +(defcustom org-contacts-ignore-property IGNORE + Name of the property, which values will be ignored when complete or export to vcard. + :type 'string + :group 'org-contacts) + (defcustom org-contacts-birthday-format Birthday: %l (%Y) Format of the anniversary agenda entry. @@ -476,6 +481,13 @@ A group FOO is composed of contacts with the tag FOO. (completion-table-case-fold completion-list (not org-contacts-completion-ignore-case + +(defun org-contacts-remove-ignored-property-values (ignore-list list) + Remove all ignore-list's elements from list. + (remove-if (lambda (el) + (member el ignore-list)) + list)) + (defun org-contacts-complete-name (start end string) Complete text at START with a user name and email. (let* ((completion-ignore-case org-contacts-completion-ignore-case) @@ -484,10 +496,17 @@ A group FOO is composed of contacts with the tag FOO. ;; The contact name is always the car of the assoc-list ;; returned by `org-contacts-filter'. for contact-name = (car contact) + + ;; Build the list of the email addresses which has + ;; been expired + for ignore-list = (org-contacts-split-property (or +(cdr (assoc-string org-contacts-ignore-property + (caddr contact))) )) ;; Build the list of the user email addresses. - for email-list = (org-contacts-split-property (or - (cdr (assoc-string org-contacts-email-property - (caddr contact))) )) + for email-list = (org-contacts-remove-ignored-property-values ignore-list + (org-contacts-split-property (or + (cdr (assoc-string org-contacts-email-property + (caddr contact))) ))) ;; If the user has email addresses… if email-list ;; … append a list of USER EMAIL. @@ -869,15 +888,17 @@ to do our best. (n (org-contacts-vcard-encode-name name)) (email (cdr (assoc-string org-contacts-email-property properties))) (tel (cdr (assoc-string org-contacts-tel-property properties))) + (ignore (cdr (assoc-string org-contacts-ignore-property properties))) (note (cdr (assoc-string org-contacts-note-property properties))) (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties (addr (cdr (assoc-string org-contacts-address-property properties))) (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties (head (format BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n n name)) + (ignore-list (when ignore (setq ignore-list (org-contacts-split-property ignore emails-list result phones-list) (concat head (when email (progn - (setq emails-list (org-contacts-split-property email)) + (setq emails-list (org-contacts-remove-ignored-property-values ignore-list (org-contacts-split-property email))) (setq result ) (while emails-list (setq result (concat result EMAIL: (org-contacts-strip-link (car emails-list)) \n)) @@ -886,7 +907,7 @@ to do our best. (when addr (format ADR:;;%s\n (replace-regexp-in-string \\, ? ; addr))) (when tel (progn - (setq phones-list (org-contacts-split-property tel)) + (setq phones-list (org-contacts-remove-ignored-property-values ignore-list (org-contacts-split-property tel))) (setq result ) (while phones-list (setq result (concat result TEL: (org-contacts-strip-link (car phones-list)) \n)) -- 1.7.10.4
Re: [O] [PATCH] org-contacts.el: add expire feature
Daimrod daim...@gmail.com writes: This is not very idiomatic elisp, I would write something more like: #+BEGIN_SRC emacs-lisp (remove-if (lambda (el) (member el expire-list)) list) #+END_SRC Thanks! Is this possible? test1@g = te...@gmail.com
Re: [O] [PATCH] org-contacts.el: ignore emails or phones with ignore property
updated patch From b0851e4c48e4c2e67fd8aafdf04951e764e07ccf Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Wed, 29 May 2013 20:30:43 +0800 Subject: [PATCH] Add a feature, which can ignore emails or phones with property * contrib/lisp/org-contacts.el (org-contacts-ignore-property): New variable. (org-contacts-remove-ignored-property-values): New function, which remove all ignore-list's elements from list. (org-contacts-complete-name): When completing, ignore the values which has been included into the ignore property. (org-contacts-vcard-format): Don't export the values which has been included into the ignore property. If emails or phones is included into the ignore property, they will not show in complete buffer. When the contact is exported to vcard, they will be ignored too. --- contrib/lisp/org-contacts.el | 31 ++- 1 个文件被修改,插入 26 行(+),删除 5 行(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 7b0b603..1be0ac9 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -86,6 +86,11 @@ When set to nil, all your Org files will be used. :type 'string :group 'org-contacts) +(defcustom org-contacts-ignore-property IGNORE + Name of the property, which values will be ignored when complete or export to vcard. + :type 'string + :group 'org-contacts) + (defcustom org-contacts-birthday-format Birthday: %l (%Y) Format of the anniversary agenda entry. @@ -476,6 +481,13 @@ A group FOO is composed of contacts with the tag FOO. (completion-table-case-fold completion-list (not org-contacts-completion-ignore-case + +(defun org-contacts-remove-ignored-property-values (ignore-list list) + Remove all ignore-list's elements from list. + (remove-if (lambda (el) + (member el ignore-list)) + list)) + (defun org-contacts-complete-name (start end string) Complete text at START with a user name and email. (let* ((completion-ignore-case org-contacts-completion-ignore-case) @@ -484,10 +496,17 @@ A group FOO is composed of contacts with the tag FOO. ;; The contact name is always the car of the assoc-list ;; returned by `org-contacts-filter'. for contact-name = (car contact) + + ;; Build the list of the email addresses which has + ;; been expired + for ignore-list = (org-contacts-split-property (or +(cdr (assoc-string org-contacts-ignore-property + (caddr contact))) )) ;; Build the list of the user email addresses. - for email-list = (org-contacts-split-property (or - (cdr (assoc-string org-contacts-email-property - (caddr contact))) )) + for email-list = (org-contacts-remove-ignored-property-values ignore-list + (org-contacts-split-property (or + (cdr (assoc-string org-contacts-email-property + (caddr contact))) ))) ;; If the user has email addresses… if email-list ;; … append a list of USER EMAIL. @@ -869,15 +888,17 @@ to do our best. (n (org-contacts-vcard-encode-name name)) (email (cdr (assoc-string org-contacts-email-property properties))) (tel (cdr (assoc-string org-contacts-tel-property properties))) + (ignore (cdr (assoc-string org-contacts-ignore-property properties))) (note (cdr (assoc-string org-contacts-note-property properties))) (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties (addr (cdr (assoc-string org-contacts-address-property properties))) (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties (head (format BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n n name)) + (ignore-list (when ignore (setq ignore-list (org-contacts-split-property ignore emails-list result phones-list) (concat head (when email (progn - (setq emails-list (org-contacts-split-property email)) + (setq emails-list (org-contacts-remove-ignored-property-values ignore-list (org-contacts-split-property email))) (setq result ) (while emails-list (setq result (concat result EMAIL: (org-contacts-strip-link (car emails-list)) \n)) @@ -886,7 +907,7 @@ to do our best. (when addr (format ADR:;;%s\n (replace-regexp-in-string \\, ? ; addr))) (when tel (progn - (setq phones-list (org-contacts-split-property tel)) + (setq phones-list (org-contacts-remove-ignored-property-values ignore-list (org-contacts-split-property tel))) (setq result ) (while phones-list (setq result (concat result TEL: (org-contacts-strip-link (car phones-list)) \n)) -- 1.7.10.4 --
[O] [Need a feature] complete email with alias in gnus
Hi: I want to complete email with alias instead of name, when I write a mail in gnus. I'm using a tmp solution now, however it is nearly imposssible to be included into master, so I have to rebase this patch every pull, I want to find a better solution, Coule someone can help me ? #+begin_example ,[ 0001-org-contacts.el-stupid-solutions-which-can-complete-.patch ] | From 27b896a813203bad7c55dece6bc37cd2eeff0f40 Mon Sep 17 00:00:00 2001 | From: Feng Shu tuma...@gmail.com | Date: Thu, 11 Apr 2013 21:12:38 +0800 | Subject: [PATCH] org-contacts.el, stupid solutions which can complete email | address using alias in message-mode | | * contrib/lisp/org-contacts.el (org-contacts-complete-name): Add alias varible | --- | contrib/lisp/org-contacts.el |4 +++- | 1 个文件被修改,插入 3 行(+),删除 1 行(-) | | diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el | index 7b0b603..999bd5d 100644 | --- a/contrib/lisp/org-contacts.el | +++ b/contrib/lisp/org-contacts.el | @@ -488,11 +488,13 @@ A group FOO is composed of contacts with the tag FOO. | for email-list = (org-contacts-split-property (or | (cdr (assoc-string org-contacts-email-property | (caddr contact))) )) | + for alias = (cdr (assoc-string org-contacts-alias-property (caddr contact))) | ;; If the user has email addresses… | if email-list | ;; … append a list of USER EMAIL. | nconc (loop for email in email-list | - collect (org-contacts-format-email contact-name (org-contacts-strip-link email) | + collect (org-contacts-format-email (if alias | +(concat contact-name ( alias )) contact-name) (org-contacts-strip-link email) |(completion-list (org-contacts-all-completions-prefix | string | (org-uniquify completion-list | -- | 1.7.10.4 | ` #+end_example --
Re: [O] [PATCH] org-contacts.el: add expire feature
Daimrod daim...@gmail.com writes: Feng Shu tuma...@gmail.com writes: Daimrod daim...@gmail.com writes: This is not very idiomatic elisp, I would write something more like: #+BEGIN_SRC emacs-lisp (remove-if (lambda (el) (member el expire-list)) list) #+END_SRC Thanks! Is this possible? test1@g = te...@gmail.com Yes, you could do it like this: #+BEGIN_SRC emacs-lisp (remove-if (lambda (el) (find-if (lambda (x) (string-match-p x el)) expire-list)) list) #+END_SRC This way you can use regular expressions in the ignore list. It's very power,I will copy it! Thanks! --
Re: [O] [PATCH] org-contacts.el: add expire feature
Daimrod daim...@gmail.com writes: Feng Shu tuma...@gmail.com writes: Daimrod daim...@gmail.com writes: This is not very idiomatic elisp, I would write something more like: #+BEGIN_SRC emacs-lisp (remove-if (lambda (el) (member el expire-list)) list) #+END_SRC Thanks! Is this possible? test1@g = te...@gmail.com Yes, you could do it like this: #+BEGIN_SRC emacs-lisp (remove-if (lambda (el) (find-if (lambda (x) (string-match-p x el)) expire-list)) list) #+END_SRC This way you can use regular expressions in the ignore list. Hi Daimrod! This is the 3 updated patch, if possible, please include it to master. Thanks for your help! From 362bf0657a0a270416d5e9b51aaba868ad963439 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Wed, 29 May 2013 20:30:43 +0800 Subject: [PATCH] Add a feature, which can ignore emails or phones with property * contrib/lisp/org-contacts.el (org-contacts-ignore-property): New variable. (org-contacts-remove-ignored-property-values): New function, which remove all ignore-list's elements from list. (org-contacts-complete-name): When completing, ignore the values which has been included into the ignore property. (org-contacts-vcard-format): Don't export the values which has been included into the ignore property. If emails or phones is included into the ignore property, they will not show in complete buffer. When the contact is exported to vcard, they will be ignored too. --- contrib/lisp/org-contacts.el | 34 +- 1 个文件被修改,插入 29 行(+),删除 5 行(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 7b0b603..2aee0f6 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -86,6 +86,11 @@ When set to nil, all your Org files will be used. :type 'string :group 'org-contacts) +(defcustom org-contacts-ignore-property IGNORE + Name of the property, which values will be ignored when complete or export to vcard. + :type 'string + :group 'org-contacts) + (defcustom org-contacts-birthday-format Birthday: %l (%Y) Format of the anniversary agenda entry. @@ -476,6 +481,16 @@ A group FOO is composed of contacts with the tag FOO. (completion-table-case-fold completion-list (not org-contacts-completion-ignore-case + +(defun org-contacts-remove-ignored-property-values (ignore-list list) + Remove all ignore-list's elements from list and you can use + regular expressions in the ignore list. +(remove-if (lambda (el) + (find-if (lambda (x) + (string-match-p x el)) +ignore-list)) + list)) + (defun org-contacts-complete-name (start end string) Complete text at START with a user name and email. (let* ((completion-ignore-case org-contacts-completion-ignore-case) @@ -484,10 +499,17 @@ A group FOO is composed of contacts with the tag FOO. ;; The contact name is always the car of the assoc-list ;; returned by `org-contacts-filter'. for contact-name = (car contact) + + ;; Build the list of the email addresses which has + ;; been expired + for ignore-list = (org-contacts-split-property (or +(cdr (assoc-string org-contacts-ignore-property + (caddr contact))) )) ;; Build the list of the user email addresses. - for email-list = (org-contacts-split-property (or - (cdr (assoc-string org-contacts-email-property - (caddr contact))) )) + for email-list = (org-contacts-remove-ignored-property-values ignore-list + (org-contacts-split-property (or + (cdr (assoc-string org-contacts-email-property + (caddr contact))) ))) ;; If the user has email addresses… if email-list ;; … append a list of USER EMAIL. @@ -869,15 +891,17 @@ to do our best. (n (org-contacts-vcard-encode-name name)) (email (cdr (assoc-string org-contacts-email-property properties))) (tel (cdr (assoc-string org-contacts-tel-property properties))) + (ignore (cdr (assoc-string org-contacts-ignore-property properties))) (note (cdr (assoc-string org-contacts-note-property properties))) (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties (addr (cdr (assoc-string org-contacts-address-property properties))) (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties (head (format BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n n name)) + (ignore-list (when ignore (setq ignore-list (org-contacts-split-property ignore emails-list result phones-list) (concat head (when email (progn - (setq emails-list (org-contacts-split-property email)) + (setq emails-list (org-contacts-remove-ignored-property-values ignore-list (org-contacts-split-property email))) (setq result
Re: [O] Exporting output and graphics from R
rai...@krugs.de (Rainer M. Krug) writes: Sebastien Vauban sva-n...@mygooglest.com writes: Hi SabreWolfy, SabreWolfy wrote: When the following code is evaluated or exported, only the link to testout.png appears in the RESULTS section. #+BEGIN_SRC R :results output graphics :file testout.png :exports both plot(1:10, 1:10) x - 1:10 library(ascii) options(asciiType = org) ascii(x) #+END_SRC Removing `output' here should solve the above point. When this code is evaluated, the value of x appears in the RESULTS: #+BEGIN_SRC R :results output :exports both x - 1:10 library(ascii) options(asciiType = org) ascii(x) #+END_SRC How can I get the first example to output both graphics and ascii output? AFAICT, you can't have both at the same time. Do you have a real use case for this? Not directly, But I used the following approach to include pdf as well as jpeg ion a document. You simply have to create your graph in R and then include a link in org manually: , | #+BEGIN_SRC R :results output :exports both | png(testout.png) | plot(1:10, 1:10) | dev.off() | x - 1:10 | library(ascii) | options(asciiType = org) | ascii(x) | #+END_SRC | | | [[./testout.png]] ` #+BEGIN_SRC R :results output :exports both pngname - testout.png png(pngname) plot(1:10, 1:10) dev.off() x - 1:10 paste([[./, pngname, ]],sep=) #+END_SRC you will get the code, result (output) and the graph (tested on export to pdf). Cheers, Rainer If really needed, you can define your code once, wrap it with some value for the :results header, and copy it somewhere else via Noweb's facility, where it can be evaluated under other values for the :results header. I'm using Org 7.9.2. Try upgrading now to Org 8 so that you fiddle only once with the export variables -- which changed, even if similar, between Org 7.9 and Org 8. Best regards, Seb #secure method=pgpmime mode=sign --
Re: [O] [PATCH] org-contacts.el: add expire feature
Karl Voit devn...@karl-voit.at writes: * Daimrod daim...@gmail.com wrote: Feng Shu tuma...@gmail.com writes: * test :PROPERTIES: :EMAIL: te...@gmail.com te...@gmail.com te...@gmail.com :PHONE: 123456 123457 123458 :EXPIRE: te...@gmail.com 123457 :END: when completing or exporting to vcard, the emails and phones in the expire property (te...@gmail.com and 123457) will be ignore This is a very good patch, fixing an issue I also do have currently. Since the purpose of this property is to ignore some values when exporting to vcard, don't you think it would be better to name it IGNORE or VCARD_IGNORE? (and of course to rename all functions accordingly) I totally agree. I have changed it to IGNORE At first, I could not follow Feng Shu's explanation because I thought that some (meta-) data gets expired after a certain period of time. But then I realized that he meant that these things expired in the past. From the user point of view, I also do think that renaming the property from :EXPIRE: to :IGNORE: would be better in terms of understanding its purpose and how it works. (If you do tend to keep the wording, I would at least rename it to :EXPIRED: which emphasizes the fact that these things expired in the past.) --
Re: [O] [PATCH] org-contacts.el: add expire feature
Daimrod daim...@gmail.com writes: Feng Shu tuma...@gmail.com writes: Hi Daimrod! This is the 3 updated patch, if possible, please include it to master. It's merged and pushed. I've also pushed another commit to fix the formatting in some parts of the code and I've found a bug in `org-contacts-split-property', but it should be fixed now. Thanks! Now I want to code a function: (defun org-contacts-add-value-to-ignore-property (value) Create agenda view for contacts matching NAME. (interactive (list (read-string Ignored email or phone: ))) ... ) 1. find a contact which email or phone property include the value ,If the result is two or more different contacts, message: Two or more contacts, abort!. 2. add the value to the ignore property of the result contact Any suggestion? Thanks! Thanks for your help! --
Re: [O] Handling outdated contact information
Daimrod daim...@gmail.com writes: Karl Voit devn...@karl-voit.at writes: * Daimrod daim...@gmail.com wrote: Hi Karl, Hi Daimrod! This is a very good patch, fixing an issue I also do have currently. I am curious, what was the issue? Sure: I do use contacts.org by myself and I tend to collect data about people and never delete any. For example, previously used phone numbers are quite handy in order to get a connection between old text messages or phone call logs and a person. However, I do not want to mess up current phone numbers with old ones. With this ignore feature, I am able to address this issue (in the future). For now, I do not export contact information from Org-mode to somewhere else (except: lbdb - mutt). In the future, I plan to add a workflow that gets contact information form Org-mode (my central point of information) to my phone and so forth. I use SSHdroid in my android phone, and use keybinding F12 to pull vcf file to my phone. In my phone, I use VcardIO update my contacts #+begin_src emacs-lisp (global-set-key (kbd f12) '(lambda () (interactive) (progn (org-mobile-push) (org-contacts-export-as-vcard) (shell-command scp ~/Documents/org-mobile/* root@192.168.1.234:/sdcard/org-mobile/) #+end_src emacs-lisp I see, thanks for the explanation. --
Re: [O] Handling outdated contact information
Karl Voit devn...@karl-voit.at writes: * Daimrod daim...@gmail.com wrote: Hi Karl, Hi Daimrod! This is a very good patch, fixing an issue I also do have currently. I am curious, what was the issue? Sure: I do use contacts.org by myself and I tend to collect data about people and never delete any. For example, previously used phone numbers are quite handy in order to get a connection between old text messages or phone call logs and a person. However, I do not want to mess up current phone numbers with old ones. With this ignore feature, I am able to address this issue (in the future). For now, I do not export contact information from Org-mode to somewhere else (except: lbdb - mutt). In the future, I plan to add a workflow that gets contact information form Org-mode (my central point of information) to my phone and so forth. If you use android phone, you can write a function org-contacts-export-to-sqlite3 which can export org-contacts to android contacts.db --
Re: [O] Org-mode contacts to Android
Feng Shu tuma...@gmail.com writes: Karl Voit devn...@karl-voit.at writes: * Feng Shu tuma...@gmail.com wrote: Karl Voit devn...@karl-voit.at writes: In the future, I plan to add a workflow that gets contact information form Org-mode (my central point of information) to my phone and so forth. If you use android phone, you can write a function org-contacts-export-to-sqlite3 which can export org-contacts to android contacts.db Yes, I am using Android on my phone. No, I am not able to write a sqlite3 export in ELISP because I don't know ELISP (yet) :-( However, why should I? You mentioned your VCard export method in another email here. This sounds reasonable to me. I guess, I have to test this method on my Android as well some time. The reason: 1. speed: very slow when import vcf to android(100 contacts) 2. automatic: If we export to db directly, we only need update db to android phone,and don't need to run Vcardio in the phone Maybe we can do like this: org-contacts - vcf file ---vcf to sqlite3 command-- db -- push to android! I'm very interested in integrating org and android phone effectively, so I want to share the solutions with others who are using android phone and org-mode! I changed my setting again for unstable WIFI connection! Integrating android phone with org has many details to resolve: 1. speed(import vcf, import org file to org-mobile and so on) 2. WIFI problem! 3. Battery (I think this should be pay more attention when we use WIFI, I use android app: Better Wifi on/off) 4. maximum possible automation. This is my new solution: 1. I use botsync, pull all my agenda.org to my phone by sshd in computer 2. Change the keybinding g in the agenda buffer, #+begin_src emacs-lisp (org-defkey org-agenda-mode-map g (lambda () (interactive) (org-agenda-redo t) (org-contacts-export-as-vcard) (org-mobile-push))) #+end_src --
[O] [PATCH] Add a complex org-contacts template to the file header
From ed34362a763447eba684eb46032a3273ce7338ac Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Mon, 3 Jun 2013 07:35:09 +0800 Subject: [PATCH] Add a complex org-contacts template to the file header contrib/lisp/org-contacts.el: Add a complex org-contacts template. Add a complex org-contacts template to the file header, which can help user know all the org-contacts properties quickly. --- contrib/lisp/org-contacts.el | 18 +- 1 个文件被修改,插入 17 行(+),删除 1 行(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index ffd17a1..ee2e657 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -25,7 +25,7 @@ ;; This file contains the code for managing your contacts into Org-mode. -;; To enter new contacts, you can use `org-capture' and a template just like +;; To enter new contacts, you can use `org-capture' and a mini template just like ;; this: ;; (c Contacts entry (file ~/Org/contacts.org) @@ -34,6 +34,22 @@ ;; :EMAIL: %(org-contacts-template-email) ;; :END:))) ;; +;; You can also use a complex templete, for example: +;; +;; (c Contacts entry (file ~/Org/contacts.org) +;; * %(org-contacts-template-name) +;; :PROPERTIES: +;; :EMAIL: %(org-contacts-template-email) +;; :PHONE: +;; :ALIAS: +;; :NICKNAME: +;; :IGNORE: +;; :ICON: +;; :NOTE: +;; :ADDRESS: +;; :BIRTHDAY: +;; :END:))) +;; ;;; Code: (eval-when-compile -- 1.7.10.4 --
[O] [patch] Add a complex org-contacts template to the file header
From ed34362a763447eba684eb46032a3273ce7338ac Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Mon, 3 Jun 2013 07:35:09 +0800 Subject: [PATCH] Add a complex org-contacts template to the file header contrib/lisp/org-contacts.el: Add a complex org-contacts template. Add a complex org-contacts template to the file header, which can help user know all the org-contacts properties quickly. --- contrib/lisp/org-contacts.el | 18 +- 1 个文件被修改,插入 17 行(+),删除 1 行(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index ffd17a1..ee2e657 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -25,7 +25,7 @@ ;; This file contains the code for managing your contacts into Org-mode. -;; To enter new contacts, you can use `org-capture' and a template just like +;; To enter new contacts, you can use `org-capture' and a mini template just like ;; this: ;; (c Contacts entry (file ~/Org/contacts.org) @@ -34,6 +34,22 @@ ;; :EMAIL: %(org-contacts-template-email) ;; :END:))) ;; +;; You can also use a complex templete, for example: +;; +;; (c Contacts entry (file ~/Org/contacts.org) +;; * %(org-contacts-template-name) +;; :PROPERTIES: +;; :EMAIL: %(org-contacts-template-email) +;; :PHONE: +;; :ALIAS: +;; :NICKNAME: +;; :IGNORE: +;; :ICON: +;; :NOTE: +;; :ADDRESS: +;; :BIRTHDAY: +;; :END:))) +;; ;;; Code: (eval-when-compile -- 1.7.10.4 --
[O] [patch] Add functions, which can quickly insert org-contacts template(s) in current buffer
From 6080af9fa0183bde6946cd7036d4b30937a10a39 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Mon, 3 Jun 2013 23:17:57 +0800 Subject: [PATCH] Quickly insert (a) template(s) in current buffer * contrib/lisp/org-contacts.el (org-contacts-build-template-with-exist-contact):Build a contact template with exist contact, It is useful when you want to update exist contact(s). (org-contacts-build-template-with-string): Build contact template with a string, It is useful when you want to add a new contact. (org-contacts-insert-template): Insert contact template(s) at point, the template(s) will be built with the input string and exist contacts informations. Add a new function, which can quickly insert (a) contact templete(s), the templete(s) are built using user's input and the exist contacts information. --- contrib/lisp/org-contacts.el | 49 ++ 1 个文件被修改,插入 49 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index ffd17a1..84c4473 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -951,6 +951,55 @@ is created and the VCard is written into that buffer. (current-buffer) (progn (save-buffer) (kill-buffer) +(defun org-contacts-build-template-with-exist-contact (contact) + Build a contact template with exist contact, It is useful +when you want to update exist contact(s). + (let* ((properties (caddr contact)) + (name (org-contacts-vcard-escape (car contact))) + (n (org-contacts-vcard-encode-name name)) + (alias (cdr (assoc-string org-contacts-alias-property properties +(concat ** name \n + :PROPERTIES:\n + : org-contacts-alias-property : alias \n + : org-contacts-note-property :\n + : org-contacts-email-property :\n + : org-contacts-tel-property :\n + : org-contacts-ignore-property :\n + :END:\n\n))) + +(defun org-contacts-build-template-with-string (string) + Build contact template with a string, It is useful +when you want to add a new contact. + (concat ** string \n + :PROPERTIES:\n + : org-contacts-alias-property : string \n + : org-contacts-note-property :\n + : org-contacts-email-property :\n + : org-contacts-tel-property :\n + : org-contacts-ignore-property :\n + :END:\n\n)) + +(defun org-contacts-insert-template (string) + Insert contact template(s) at point, the template(s) will be built +with the input string and exist contacts informations. + (interactive (list (read-string Name or Alias: ))) + (let ((point (point)) +(contact-list + (delete-dups (nconc + (org-contacts-filter + nil nil + (cons org-contacts-alias-property string)) + (org-contacts-filter string) +(current-buffer) +(let ((inhibit-read-only t))) +(fundamental-mode) +(when (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) +(loop for contact in contact-list + do (insert (org-contacts-build-template-with-exist-contact contact))) +(if contact-list nil (insert (org-contacts-build-template-with-string string))) +(goto-char point))) + (defun org-contacts-show-map (optional name) Show contacts on a map. Requires google-maps-el. -- 1.7.10.4 --
[O] [patch] [2update] Add functions, which can quickly insert org-contacts template(s) in current buffer
From 938c2d0e3eb04faf2fd9708a382da9bac43d0bf9 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Mon, 3 Jun 2013 23:17:57 +0800 Subject: [PATCH] Quickly insert (a) template(s) in current buffer * contrib/lisp/org-contacts.el (org-contacts-build-template-with-exist-contact):Build a contact template with exist contact, It is useful when you want to update exist contact(s). (org-contacts-build-template-with-string): Build contact template with a string, It is useful when you want to add a new contact. (org-contacts-insert-template): Insert contact template(s) at point, the template(s) will be built with the input string and exist contacts informations. Add a new function, which can quickly insert (a) contact templete(s), the templete(s) are built using user's input and the exist contacts information. --- contrib/lisp/org-contacts.el | 48 ++ 1 个文件被修改,插入 48 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index ffd17a1..78e7fef 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -951,6 +951,54 @@ is created and the VCard is written into that buffer. (current-buffer) (progn (save-buffer) (kill-buffer) +(defun org-contacts-build-template-with-exist-contact (contact) + Build a contact template with exist contact, It is useful +when you want to update exist contact(s). + (let* ((properties (caddr contact)) + (name (org-contacts-vcard-escape (car contact))) + (n (org-contacts-vcard-encode-name name)) + (alias (cdr (assoc-string org-contacts-alias-property properties +(concat ** name \n + :PROPERTIES:\n + : org-contacts-alias-property : alias \n + : org-contacts-note-property :\n + : org-contacts-email-property :\n + : org-contacts-tel-property :\n + : org-contacts-ignore-property :\n + :END:\n\n))) + +(defun org-contacts-build-template-with-string (string) + Build contact template with a string, It is useful +when you want to add a new contact. + (concat ** string \n + :PROPERTIES:\n + : org-contacts-alias-property : string \n + : org-contacts-note-property :\n + : org-contacts-email-property :\n + : org-contacts-tel-property :\n + : org-contacts-ignore-property :\n + :END:\n\n)) + +(defun org-contacts-insert-template (string) + Insert contact template(s) at point, the template(s) will be built +with the input string and exist contacts informations. + (interactive (list (read-string Name or Alias: ))) + (let ((point (point)) +(contact-list + (delete-dups (nconc + (org-contacts-filter + nil nil + (cons org-contacts-alias-property string)) + (org-contacts-filter string) +(current-buffer) +(let ((inhibit-read-only t))) +(when (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) +(loop for contact in contact-list + do (insert (org-contacts-build-template-with-exist-contact contact))) +(if contact-list nil (insert (org-contacts-build-template-with-string string))) +(goto-char point))) + (defun org-contacts-show-map (optional name) Show contacts on a map. Requires google-maps-el. -- 1.7.10.4 --
Re: [O] [patch] [2update] Add functions, which can quickly insert org-contacts template(s) in current buffer
Feng Shu tuma...@gmail.com writes: I will change this patch again, hard coding a templates in functions is not a good way , maybe it is a complex method to solve a simpe things. From 938c2d0e3eb04faf2fd9708a382da9bac43d0bf9 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Mon, 3 Jun 2013 23:17:57 +0800 Subject: [PATCH] Quickly insert (a) template(s) in current buffer * contrib/lisp/org-contacts.el (org-contacts-build-template-with-exist-contact):Build a contact template with exist contact, It is useful when you want to update exist contact(s). (org-contacts-build-template-with-string): Build contact template with a string, It is useful when you want to add a new contact. (org-contacts-insert-template): Insert contact template(s) at point, the template(s) will be built with the input string and exist contacts informations. Add a new function, which can quickly insert (a) contact templete(s), the templete(s) are built using user's input and the exist contacts information. --- contrib/lisp/org-contacts.el | 48 ++ 1 个文件被修改,插入 48 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index ffd17a1..78e7fef 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -951,6 +951,54 @@ is created and the VCard is written into that buffer. (current-buffer) (progn (save-buffer) (kill-buffer) +(defun org-contacts-build-template-with-exist-contact (contact) + Build a contact template with exist contact, It is useful +when you want to update exist contact(s). + (let* ((properties (caddr contact)) + (name (org-contacts-vcard-escape (car contact))) + (n (org-contacts-vcard-encode-name name)) + (alias (cdr (assoc-string org-contacts-alias-property properties +(concat ** name \n + :PROPERTIES:\n + : org-contacts-alias-property : alias \n + : org-contacts-note-property :\n + : org-contacts-email-property :\n + : org-contacts-tel-property :\n + : org-contacts-ignore-property :\n + :END:\n\n))) + +(defun org-contacts-build-template-with-string (string) + Build contact template with a string, It is useful +when you want to add a new contact. + (concat ** string \n + :PROPERTIES:\n + : org-contacts-alias-property : string \n + : org-contacts-note-property :\n + : org-contacts-email-property :\n + : org-contacts-tel-property :\n + : org-contacts-ignore-property :\n + :END:\n\n)) + +(defun org-contacts-insert-template (string) + Insert contact template(s) at point, the template(s) will be built +with the input string and exist contacts informations. + (interactive (list (read-string Name or Alias: ))) + (let ((point (point)) +(contact-list + (delete-dups (nconc +(org-contacts-filter + nil nil + (cons org-contacts-alias-property string)) +(org-contacts-filter string) +(current-buffer) +(let ((inhibit-read-only t))) +(when (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) +(loop for contact in contact-list + do (insert (org-contacts-build-template-with-exist-contact contact))) +(if contact-list nil (insert (org-contacts-build-template-with-string string))) +(goto-char point))) + (defun org-contacts-show-map (optional name) Show contacts on a map. Requires google-maps-el. -- 1.7.10.4 --
[O] [Help] Look for a exist function to car a contact, Urgent!!!
How to get the information test from: ((#(test 0 2 (fontified nil org-category i-contacts)) Thanks! --
Re: [O] [Help] Look for a exist function to car a contact, Urgent!!!
Nick Dokos ndo...@gmail.com writes: Feng Shu tuma...@gmail.com writes: How to get the information test from: ((#(test 0 2 (fontified nil org-category i-contacts)) Thanks! It's missing a couple of closing parens, but assuming that the opening parens describe the situation correctly, the following should work: --8---cut here---start-8--- (setq s '((#(test 0 2 (fontified nil org-category i-contacts) (substring-no-properties (caar s)) --8---cut here---end---8--- Thanks! The caar gets to the string-with-properties and the substring-no-properties gets the string, discarding the properties. --
Re: [O] [patch] [3update] Add functions, Insert a exist contact name at point
Feng Shu tuma...@gmail.com writes: Feng Shu tuma...@gmail.com writes: I will change this patch again, hard coding a templates in functions is not a good way , maybe it is a complex method to solve a simpe things. This is the 3rd patch, which has been changed significantly, The function will be useful when used in org-capture, I want it can be included into master when it mature! But there are some problems, I think it's org-capture's bug or limit: 1. works: #+begin_example (c Contacts entry (file ~/org/i-contacts.org) * %(org-contacts-get-exist-contact-name-string fengshu)) #+end_example 2. doesn't work #+begin_example (c Contacts entry (file ~/org/i-contacts.org) * %(org-contacts-get-exist-contact-name-string %^{prompt)) #+end_example From 06055532dbadbfbcb620378eeec0c5e3c8ee8c0d Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Mon, 3 Jun 2013 23:17:57 +0800 Subject: [PATCH] Insert (a) exist contact name(s) at point * org-contacts.el (org-contacts-get-exist-contact-name-list): New function, which can get exist contact name(s) matched 'string, return a list. (org-contacts-get-exist-contact-name-string): New macro, get exist contact name(s) matched 'string, return names string. (org-contacts-insert-contact-name): New function, which can insert (a) exist contact name(s) matched user's input at point. Add new functions, which can insert (a) exist contact name(s) at point, which is matched user's input. --- contrib/lisp/org-contacts.el | 36 1 个文件被修改,插入 36 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 5d63fcc..e3f0729 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -967,6 +967,42 @@ is created and the VCard is written into that buffer. (current-buffer) (progn (save-buffer) (kill-buffer) +(defun org-contacts-get-exist-contact-name-list (string) + Get exist contact name(s) matched 'string, return a list. + (let ((contact-list (nconc + (org-contacts-filter + nil nil + (cons org-contacts-alias-property string)) + (org-contacts-filter string +(setq result-name-list + (delete-dups + (loop for contact in contact-list + collect + (substring-no-properties + ((lambda (contact) + (let* ((name + (org-contacts-vcard-escape (car contact name)) + contact)) + (if result-name-list result-name-list (list string))) + +(defmacro org-contacts-get-exist-contact-name-string (string) + Get exist contact name(s) matched 'string, return names string. + (if (stringp string) + `(mapconcat 'identity (org-contacts-get-exist-contact-name-list ,string) ) + `(mapconcat 'identity (org-contacts-get-exist-contact-name-list ,(format %s string)) ))) + +(defun org-contacts-insert-contact-name (string) + At point insert (a) exist contact name(s) matched 'input. + (interactive (list (read-string Contact Alias or Name: ))) + (current-buffer) + (let ((inhibit-read-only t))) + (when (fboundp 'set-buffer-file-coding-system) +(set-buffer-file-coding-system coding-system-for-write)) + (let ((name-list (org-contacts-get-exist-contact-name-list string))) +(while name-list + (insert (concat (car name-list) )) +(setq name-list (cdr name-list) + (defun org-contacts-show-map (optional name) Show contacts on a map. Requires google-maps-el. -- 1.7.10.4 --
Re: [O] [patch] [3update] Add functions, Insert a exist contact name at point
This is 4 update: From 326642e8cdcfcb507d82a2508e1cde91e9236540 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Mon, 3 Jun 2013 23:17:57 +0800 Subject: [PATCH] Insert (a) exist contact name(s) at point * org-contacts.el (org-contacts-get-exist-contact-name-list): New function, which can get exist contact name(s) matched 'string, return a list. (org-contacts-get-exist-contact-name-string): New macro, get exist contact name(s) matched 'string, return names string. (org-contacts-insert-contact-name): New function, which can insert (a) exist contact name(s) matched user's input at point. Add new functions, which can insert (a) exist contact name(s) at point, which is matched user's input. --- contrib/lisp/org-contacts.el | 36 1 个文件被修改,插入 36 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 5d63fcc..70a78e1 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -967,6 +967,42 @@ is created and the VCard is written into that buffer. (current-buffer) (progn (save-buffer) (kill-buffer) +(defun org-contacts-get-exist-contact-name-list (string) + Get exist contact name(s) matched 'string, return a list. + (let ((contact-list (nconc + (org-contacts-filter + nil nil + (cons org-contacts-alias-property string)) + (org-contacts-filter string +(setq result-name-list + (delete-dups + (loop for contact in contact-list + collect + (substring-no-properties + ((lambda (contact) + (let* ((name + (org-contacts-vcard-escape (car contact name)) + contact)) + (if result-name-list result-name-list (list string))) + +(defmacro org-contacts-get-exist-contact-name-string (string) + Get exist contact name(s) matched 'string, return names string. + (if (stringp string) + `(mapconcat 'identity (org-contacts-get-exist-contact-name-list ,string) ) + `(mapconcat 'identity (org-contacts-get-exist-contact-name-list (symbol-name (quote ,string))) ))) + +(defun org-contacts-insert-contact-name (string) + At point insert (a) exist contact name(s) matched 'input. + (interactive (list (read-string Contact Alias or Name: ))) + (current-buffer) + (let ((inhibit-read-only t))) + (when (fboundp 'set-buffer-file-coding-system) +(set-buffer-file-coding-system coding-system-for-write)) + (let ((name-list (org-contacts-get-exist-contact-name-list string))) +(while name-list + (insert (concat (car name-list) )) +(setq name-list (cdr name-list) + (defun org-contacts-show-map (optional name) Show contacts on a map. Requires google-maps-el. -- 1.7.10.4
Re: [O] [patch] [2update] Add functions, which can quickly insert org-contacts template(s) in current buffer
Bastien b...@gnu.org writes: Hi Feng, Feng Shu tuma...@gmail.com writes: * contrib/lisp/org-contacts.el (org-contacts-build-template-with-exist-contact):Build a contact template with exist contact, It is useful when you want to update exist contact(s). (org-contacts-build-template-with-string): Build contact template with a string, It is useful when you want to add a new contact. (org-contacts-insert-template): Insert contact template(s) at point, the template(s) will be built with the input string and exist contacts informations. Here is a reformatted ChangeLog for your patch: * contrib/lisp/org-contacts.el (org-contacts-build-template-with-exist-contact) (org-contacts-build-template-with-string): New methods for building a contact template. (org-contacts-insert-template): Insert a contact template at point. The template will be built with the input string and existing contact informations. The point is: try to be a bit more terse in your explanations, and to pay attention to the punctuation. Sorry to nitpick about this -- even if the change is for contrib/, it's good to know about the rules early on, and to lower the work of maintainers because all the change logs need to be reviewed at some point. Thanks for you information, I think this patch use a complex way to solve a simple problem, so I have writen a different patch to replace this patch! But the problem is that the new macro in the new patch can't work with org-capture and I can't figure out why I am afraid to write commit message, for I don't know many words. I have to write the commit message in chinese and google translate it .. So you can see many Chinese style English in my commit. :-( Thanks for your efforts and your work on org-contacts.el! --
[O] [PATCH] Expand current word or string in region with matched contact names. (was: [3update] Add functions, Insert a exist contact name at point)
Hi: the function 'org-contacts-get-exist-contact-name-string will be used in org-capthure template, for example: #+begin_example (c Contacts: 手动输入 entry (file ~/org/i-contacts.org) * %(org-contacts-get-exist-contact-name-string %^{prompt}) #+end_example Note: This function can't work as expect and I fail to find the solution at this moment. If someone have good ideas, please mail me. Thanks! From 9db95556f60e83165edcec18c18e3d5aa65890af Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Mon, 3 Jun 2013 23:17:57 +0800 Subject: [PATCH] Expand current word or string in region with matched contact names * org-contacts.el (org-contacts-get-exist-contact-name-list): New function, return a list, which elements are matched contact names. (org-contacts-get-exist-contact-name-string): New macro, return a string concated with all matched contact names. (org-contacts-expand-with-contact-names): New function, expand current word or string in region with matched contact names. Add new functions, which can expand current word or string in region with matched contact names. By default, match contact name and alias. --- contrib/lisp/org-contacts.el | 40 1 个文件被修改,插入 40 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 5d63fcc..b0eb838 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -967,6 +967,46 @@ is created and the VCard is written into that buffer. (current-buffer) (progn (save-buffer) (kill-buffer) +(defun org-contacts-get-exist-contact-name-list (string) + Return a list, which elements are matched contact names. + (let ((contact-list (nconc + (org-contacts-filter + nil nil + (cons org-contacts-alias-property string)) + (org-contacts-filter string +(setq result-name-list + (delete-dups + (loop for contact in contact-list + collect + (substring-no-properties + ((lambda (contact) + (let* ((name + (org-contacts-vcard-escape (car contact name)) + contact) +(if result-name-list result-name-list (list string + +(defmacro org-contacts-get-exist-contact-name-string (string) + Return a string, which are concated with all matched contact names. + (if (stringp string) + `(mapconcat 'identity (org-contacts-get-exist-contact-name-list ,string) ) + `(mapconcat 'identity (org-contacts-get-exist-contact-name-list (symbol-name (quote ,string))) ))) + +(defun org-contacts-expand-with-contact-names () + Expand current word or string in region with matched contact names. + (interactive) + (let ((str (if mark-active + (buffer-substring-no-properties (region-beginning) (region-end)) + (current-word nil t +(current-buffer) +(let ((inhibit-read-only t))) +(when (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) +(backward-delete-char (length str)) +(insert (mapconcat + 'identity + (org-contacts-get-exist-contact-name-list str) + + (defun org-contacts-show-map (optional name) Show contacts on a map. Requires google-maps-el. -- 1.7.10.4 feng --
[O] unexpected \usetheme{default}
Hi: when I export to a org file to article pdf with latex , I find that \usetheme{default} is inserted into the tex file. How to avoid this? thanks --
Re: [O] unexpected \usetheme{default}
Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org writes: Feng Shu wrote: when I export to a org file to article pdf with latex , I find that \usetheme{default} is inserted into the tex file. How to avoid this? It seems you're exporting to Beamer (C-c C-e l P/O)? You are right, thanks! Best regards, Seb --
Re: [O] Org-mode latex pdf export issue: Underlined lines not breaking properly
Nicolas Goaziou n.goaz...@gmail.com writes: Hello, Nathaniel Cunningham nathaniel.cunning...@gmail.com writes: Suvayu Ali fatkasuvayu+linux at gmail.com writes: Org mode translates _underlined text_ to \underline{underlined text}, however if you read the TeX.sx question referenced below you will see that it doesn't support line breaks and the TeX community recommends \uline{..} from the ulem package. http://TeX.stackexchange.com/a/13382/4416 The \ul{..} command from the soul package also supports underlining across line breaks. *And soul is included by default in org's list of loaded latex packages* -- see org-latex-default-packages-alist. Therefore it would be painless for org users if \underline in org-latex-text-markup-alist were replaced with \ul -- and it would provide more complete support of underlining! Indeed. According to http://orgmode.org/worg/org-dependencies.html introducing soul package in default packages list was meant to provide underline and strike-through features. I fixed it in maint. Thanks for the heads up. When the article is writen with Chinese, soul will output: #+begin_src soul Error: Reconstruction failed. #+end_src and underline word will dispear from the output pdf file! A tmp solution is : \ul{\mbox{中文测试}} but,when it can't break lines properly too. Regards, --
Re: [O] Org-mode latex pdf export issue: Underlined lines not breaking properly
Nicolas Goaziou n.goaz...@gmail.com writes: Hello, Feng Shu tuma...@gmail.com writes: When the article is writen with Chinese, soul will output: #+begin_src soul Error: Reconstruction failed. #+end_src and underline word will dispear from the output pdf file! A tmp solution is : \ul{\mbox{中文测试}} but,when it can't break lines properly too. 1. Does \underline{中文测试} work properly (notwithstanding the line breaks)? \underline can show chinese, but the command can't resolve lines breaking properly. 2. Does \uline from ulem package handle it correctly, including the line breaks? \uline seem to work properly. Regards, --
Re: [O] Org-mode latex pdf export issue: Underlined lines not breaking properly
Nicolas Goaziou n.goaz...@gmail.com writes: Feng Shu tuma...@gmail.com writes: Nicolas Goaziou n.goaz...@gmail.com writes: 1. Does \underline{中文测试} work properly (notwithstanding the line breaks)? \underline can show chinese, but the command can't resolve lines breaking properly. 2. Does \uline from ulem package handle it correctly, including the line breaks? \uline seem to work properly. Then, the best solution seems to add ulem package to `org-latex-default-packages-alist' and use \ulem for underline. soul will only be used for strike-through. Is there any objection to this change? May be \ulem should be used for strike-through too! Regards, --
[O] [suggest] We should import latex template system
Hi: org-mode odt exporter are using 'org-odt-styles-file, which are odt templetes, I think latex exporter should do like this. for example: org-latex-styles-file or org-latex-templete-file we can include many different language's templates into org, and no need touch the ox-latex.el and the user can write theirs template easily, we can use locale to determine which template will be used converting latex fragements can use templates too, like: org-latex-fragment-templete-file --
Re: [O] [suggest] We should import latex template system
Viktor Rosenfeld listuse...@gmail.com writes: Hi, Feng Shu wrote: org-mode odt exporter are using 'org-odt-styles-file, which are odt templetes, I think latex exporter should do like this. for example: I would also like to have a template mechanism for my LaTeX exports. However, I think the way to do it in LaTeX is to write custom *.sty files which can then be included using #+LATEX_HEADER: \usepackage{...} for individual exports or more generally using org-latex-packages-alist. .sty can be easily resolved. The problem is that many template should be writen as class instead of style. If I want to use a custom class , I need to do: 1. (add-to-list 'org-latex-classes ...) 2. (setq org-latex-default-class ...) I don't know other language users, for Chinese latex user, the first thing of write a document may change the document class, for example, change article to ctexart. If I want use org-mode ,I should add all the class common used to the org-latex-classes, It will be a nightmare. In org-latex-class, article and ctexart elements are very similar, the only different may be their class names. I want such result: 1. I don't need customize 'org-latex-classes 2. #+LATEX_CLASS: ctexart can work! I've been wanting to learn how to do it but I did not find the time yet. (Any pointers to good tutorials would be appreciated.) Cheers, Viktor org-latex-styles-file or org-latex-templete-file we can include many different language's templates into org, and no need touch the ox-latex.el and the user can write theirs template easily, we can use locale to determine which template will be used converting latex fragements can use templates too, like: org-latex-fragment-templete-file -- --
Re: [O] [suggest] We should import latex template system
Feng Shu tuma...@gmail.com writes: Viktor Rosenfeld listuse...@gmail.com writes: Hi, Feng Shu wrote: org-mode odt exporter are using 'org-odt-styles-file, which are odt templetes, I think latex exporter should do like this. for example: I would also like to have a template mechanism for my LaTeX exports. However, I think the way to do it in LaTeX is to write custom *.sty files which can then be included using #+LATEX_HEADER: \usepackage{...} for individual exports or more generally using org-latex-packages-alist. .sty can be easily resolved. The problem is that many template should be writen as class instead of style. If I want to use a custom class , I need to do: 1. (add-to-list 'org-latex-classes ...) 2. (setq org-latex-default-class ...) I don't know other language users, for Chinese latex user, the first thing of write a document may change the document class, for example, change article to ctexart. If I want use org-mode ,I should add all the class common used to the org-latex-classes, It will be a nightmare. In org-latex-class, article and ctexart elements are very similar, the only different may be their class names. I want such result: 1. I don't need customize 'org-latex-classes 2. #+LATEX_CLASS: ctexart can work! #+LATEX_ARTICLE_CLASS: ctexart ? #+LATEX_CLASS: article:ctexart ? I've been wanting to learn how to do it but I did not find the time yet. (Any pointers to good tutorials would be appreciated.) Cheers, Viktor org-latex-styles-file or org-latex-templete-file we can include many different language's templates into org, and no need touch the ox-latex.el and the user can write theirs template easily, we can use locale to determine which template will be used converting latex fragements can use templates too, like: org-latex-fragment-templete-file -- --
Re: [O] [suggest] We should import latex template system
Nicolas Goaziou n.goaz...@gmail.com writes: Hello, Feng Shu tuma...@gmail.com writes: I don't know other language users, for Chinese latex user, the first thing of write a document may change the document class, for example, change article to ctexart. If I want use org-mode ,I should add all the class common used to the org-latex-classes, It will be a nightmare. In org-latex-class, article and ctexart elements are very similar, the only different may be their class names. I want such result: 1. I don't need customize 'org-latex-classes I don't see why customizing `org-latex-classes' _once_ would be a nightmare. If all the CJKV org-mode users need customize this virable _once_ , It's a nightmare for org-mode, for all the CJKV org-mode users need to know how to customize this virable! If we add all the class common used in the world, `org-latex-classes will be very very long! Regards, --
Re: [O] [suggest] We should import latex template system
(eval-after-load 'ox-latex '(add-to-list 'org-latex-classes '(myclass \\documentclass{article} [NO-DEFAULT-PACKAGES] [NO-PACKAGES] [EXTRA] \\usepackage{mychinesestylefile} (\\section{%s} . \\section*{%s}) (\\subsection{%s} . \\subsection*{%s}) (\\subsubsection{%s} . \\subsubsection*{%s}) (\\paragraph{%s} . \\paragraph*{%s}) (\\subparagraph{%s} . \\subparagraph*{%s} And then in any given document: #+LaTeX_CLASS: myclass At the moment, I am using the similar solution! If you use this way, org-mode fragement previewing may be broken if you setting \pagestyle{fancy}. If I need to layer another project-specific style file on top of that, I add a second line in the header: #+LaTeX_HEADER: \usepackage{someparticularpackage} Any document that might require Chinese starts as a myclass, and then goes from there. I set this up a year ago, and haven't needed to mess with it since. There are many, the first one is ctex, which may be the most popular latex solution of chinese users. All the university latex templates in China seem to be writen as class, instead of style. and nearly all of them are derive from class article or book It is the reason that I want this feature: #+LaTeX_CLASS: article:myclass It will use default article template, and replace class name to myclass! Hope that helps, Eric --
[O] [PATCH] Override the default class name with a new one.
#+LATEX_CLASS: article %%output: \documentclass[11pt]{article} ... -- #+LATEX_CLASS: article #+LATEX_CLASS_NAME: ctexart %%output: \documentclass[11pt]{ctexart} -- From 338ce85c306ae400ba8c62bfaecaf8973346faa0 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Thu, 13 Jun 2013 13:36:50 +0800 Subject: [PATCH] Override the default latex class name with a new one * lisp/ox-latex.el (latex): Add :latex-class-name to :options-alist. (org-latex-default-latex-class-name): The default name of LaTeX class file. (org-latex-template): Replace default latex class name with :latex-class-name. Override the default latex class name in template. It will be very useful if you are using a class and it's setting is very similar to one which has been defined in the `org-latex-classes, for example: If you want to use latex class: ctexart and you find that it's setting will be very similar to article, you don't need to add a new list to `org-latex-classes, just type: #+LATEX_CLASS: article #+LATEX_CLASS_NAME: ctexart --- lisp/ox-latex.el | 16 ++-- 1 个文件被修改,插入 14 行(+),删除 2 行(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 9172cd7..ecfb0ce 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -98,6 +98,7 @@ (if a (org-latex-export-to-pdf t s v b) (org-open-file (org-latex-export-to-pdf nil s v b))) :options-alist '((:latex-class LATEX_CLASS nil org-latex-default-class t) + (:latex-class-name LATEX_CLASS_NAME nil org-latex-default-latex-class-name t) (:latex-class-options LATEX_CLASS_OPTIONS nil nil t) (:latex-header LATEX_HEADER nil nil newline) (:latex-header-extra LATEX_HEADER_EXTRA nil nil newline) @@ -182,6 +183,11 @@ :group 'org-export-latex :type '(string :tag LaTeX class)) +(defcustom org-latex-default-latex-class-name + The default name of LaTeX class file. + :group 'org-export-latex + :type '(string :tag LaTeX class)) + (defcustom org-latex-classes '((article \\documentclass[11pt]{article} @@ -1061,15 +1067,21 @@ holding export options. (format-time-string %% Created %Y-%m-%d %a %H:%M\n)) ;; Document class and packages. (let ((class (plist-get info :latex-class)) + (latex-class-name (plist-get info :latex-class-name)) (class-options (plist-get info :latex-class-options))) (org-element-normalize-string (let* ((header (nth 1 (assoc class org-latex-classes))) - (document-class-string + (document-class-string-tmp (and (stringp header) (if (not class-options) header (replace-regexp-in-string ^[ \t]*documentclass\\(\\(\\[[^]]*\\]\\)?\\) - class-options header t nil 1) + class-options header t nil 1 + (document-class-string + (if (not latex-class-name) document-class-string-tmp + (replace-regexp-in-string + ^[ \t]*documentclass\\[[^]]*\\]?{\\(.*\\)} + latex-class-name document-class-string-tmp t nil 1 (if (not document-class-string) (user-error Unknown LaTeX class `%s' class) (org-latex-guess-babel-language -- 1.7.10.4
Re: [O] [PATCH] Override the default class name with a new one.
Feng Shu tuma...@gmail.com writes: #+LATEX_CLASS: article %%output: \documentclass[11pt]{article} ... -- #+LATEX_CLASS: article #+LATEX_CLASS_NAME: ctexart %%output: \documentclass[11pt]{ctexart} Hi: If possible, please merge this patch to master, thanks! I think it is a way reusing the exist class defines in `org-latex-classes If your class is similar with a exist one, For example: #+begin_example (article \\documentclass[11pt]{article} (\\section{%s} . \\section*{%s}) (\\subsection{%s} . \\subsection*{%s}) (\\subsubsection{%s} . \\subsubsection*{%s}) (\\paragraph{%s} . \\paragraph*{%s}) (\\subparagraph{%s} . \\subparagraph*{%s})) (ctexart \\documentclass[11pt]{ctexart} (\\section{%s} . \\section*{%s}) (\\subsection{%s} . \\subsection*{%s}) (\\subsubsection{%s} . \\subsubsection*{%s}) (\\paragraph{%s} . \\paragraph*{%s}) (\\subparagraph{%s} . \\subparagraph*{%s})) #+end_example You don't need to add ctexart to `org-latex-classes, just type: #+LATEX_CLASS: article #+LATEX_CLASS_NAME: ctexart -- From 338ce85c306ae400ba8c62bfaecaf8973346faa0 Mon Sep 17 00:00:00 2001 From: Feng Shu tuma...@gmail.com Date: Thu, 13 Jun 2013 13:36:50 +0800 Subject: [PATCH] Override the default latex class name with a new one * lisp/ox-latex.el (latex): Add :latex-class-name to :options-alist. (org-latex-default-latex-class-name): The default name of LaTeX class file. (org-latex-template): Replace default latex class name with :latex-class-name. Override the default latex class name in template. It will be very useful if you are using a class and it's setting is very similar to one which has been defined in the `org-latex-classes, for example: If you want to use latex class: ctexart and you find that it's setting will be very similar to article, you don't need to add a new list to `org-latex-classes, just type: #+LATEX_CLASS: article #+LATEX_CLASS_NAME: ctexart --- lisp/ox-latex.el | 16 ++-- 1 个文件被修改,插入 14 行(+),删除 2 行(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 9172cd7..ecfb0ce 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -98,6 +98,7 @@ (if a (org-latex-export-to-pdf t s v b) (org-open-file (org-latex-export-to-pdf nil s v b))) :options-alist '((:latex-class LATEX_CLASS nil org-latex-default-class t) +(:latex-class-name LATEX_CLASS_NAME nil org-latex-default-latex-class-name t) (:latex-class-options LATEX_CLASS_OPTIONS nil nil t) (:latex-header LATEX_HEADER nil nil newline) (:latex-header-extra LATEX_HEADER_EXTRA nil nil newline) @@ -182,6 +183,11 @@ :group 'org-export-latex :type '(string :tag LaTeX class)) +(defcustom org-latex-default-latex-class-name + The default name of LaTeX class file. + :group 'org-export-latex + :type '(string :tag LaTeX class)) + (defcustom org-latex-classes '((article \\documentclass[11pt]{article} @@ -1061,15 +1067,21 @@ holding export options. (format-time-string %% Created %Y-%m-%d %a %H:%M\n)) ;; Document class and packages. (let ((class (plist-get info :latex-class)) +(latex-class-name (plist-get info :latex-class-name)) (class-options (plist-get info :latex-class-options))) (org-element-normalize-string (let* ((header (nth 1 (assoc class org-latex-classes))) -(document-class-string +(document-class-string-tmp (and (stringp header) (if (not class-options) header (replace-regexp-in-string ^[ \t]*documentclass\\(\\(\\[[^]]*\\]\\)?\\) - class-options header t nil 1) + class-options header t nil 1 +(document-class-string + (if (not latex-class-name) document-class-string-tmp +(replace-regexp-in-string + ^[ \t]*documentclass\\[[^]]*\\]?{\\(.*\\)} + latex-class-name document-class-string-tmp t nil 1 (if (not document-class-string) (user-error Unknown LaTeX class `%s' class) (org-latex-guess-babel-language --
Re: [O] [PATCH] Override the default class name with a new one.
Nick Dokos ndo...@gmail.com writes: Rasmus ras...@gmx.us writes: Feng Shu tuma...@gmail.com writes: #+LATEX_CLASS: article #+LATEX_CLASS_NAME: ctexart I'm not sure this is the right approach. . . I can certainly see the value of generating classes on the fly, though. But somehow the proposed syntax just seems to counter-intuitive. I'm not sure how to overcome this, but perhaps it would be better to allow for an argument to LATEX_CLASS, e.g. (*) #+LATEX_CLASS: myclass :class-name ctexart. That was what popped into my head as well - I didn't much care for the OP's approach. Now that I've thought about it some more, I'm not sure I like this one much better... as e.g. the INCLUDE command. Of course (*) is somewhat different from how stuff like this is usually handled, cf. e.g. LATEX_CLASS_OPTIONS. ...but this sounds a bit more promising: maybe LATEX_CLASS_OPTIONS can be eliminated in favor of LATEX_CLASS with arguments: #+LATEX_CLASS: key :class-name foo :class-options a4paper,12pt May be we should add this feature too: #+LaTEX_CLASS: key :class-name foo :class-options+ twoside #+LaTEX_CLASS: key :class-name foo :class-options- twoside where key selects from org-latex-classes (and is optional, default article), class-name is optional and defaults to key (or article if key is absent). --
Re: [O] [PATCH] Override the default class name with a new one.
Rasmus ras...@gmx.us writes: Feng Shu tuma...@gmail.com writes: #+LATEX_CLASS: article #+LATEX_CLASS_NAME: ctexart I'm not sure this is the right approach. . . I can certainly see the value of generating classes on the fly, though. But somehow the proposed syntax just seems to counter-intuitive. I'm not sure how to overcome this, but perhaps it would be better to allow for an argument to LATEX_CLASS, e.g. (*) #+LATEX_CLASS: myclass :class-name ctexart. CLASS and class-name are confusing, I think LATEX_CLASS should rename to LATEX_CLASS_FORMAT or LATEX_CLASS_TEMPLATE, but this will break compatibility. as e.g. the INCLUDE command. Of course (*) is somewhat different from how stuff like this is usually handled, cf. e.g. LATEX_CLASS_OPTIONS. –Rasmus --
Re: [O] [PATCH] Override the default class name with a new one.
Nicolas Goaziou n.goaz...@gmail.com writes: Hello, Feng Shu tuma...@gmail.com writes: #+LATEX_CLASS: article %%output: \documentclass[11pt]{article} ... -- #+LATEX_CLASS: article #+LATEX_CLASS_NAME: ctexart %%output: \documentclass[11pt]{ctexart} Thanks for your patch. Though, it adds another keyword and another defcustom without providing any new functionality. I understand it is a shortcut, but the cons, IMO, outweigh the pros : adding a new class to `org-latex-classes' is a bit more tedious, but needs to be done only once. Therefore, unless you convince me this feature brings something new, or clearly eases a process, I'll stand on my ground. Not all the org-mode users are expert of lisp and not all of the org-mode users are well in English, so finding the variable `org-latex-classes can customize latex class and adding a lisp block to it may be not a easy things for many users. So I expect org-mode can properly export latex without any configure, but it is impossible for the complexity of tex system. So reusing exist `org-latex-classes items will become a valuable thing, it should be implement. My patch is not best way to implement and it can be deny, but the problem can't be ignore. 1. we can add a function `(defun org-latex-add-deriverd-class (class exist-class) ...) to menupulate `org-latex-classes 2. My patch's approach. 3. others. Regards, --
[O] [help] How to export a chapter as appendix
-- org: * This is a appendix -- latex: \appendix{This is a appendix} --
[O] [help] How to ignore a head but don't ignore it's subhead when export
#+begin_org * headA ** headB #+end_org When export to latex, how to ignore headA and don't ignore headB? Thanks --
[O] [Help] How to insert a latex command in table environment when export
---input--- #+CAPTION: test | a | b | | c | d | output- \begin{table}[htb] \caption{test} % How can I insert a command in this place? for example: % \bitablecaption{你好}{Hello} \centering \begin{tabular}{ll} a b\\ c d\\ \end{tabular} \end{table} Thanks --
Re: [O] [help] How to ignore a head but don't ignore it's subhead when export
Bastien b...@gnu.org writes: Hi Feng, Feng Shu tuma...@gmail.com writes: #+begin_org * headA ** headB #+end_org When export to latex, how to ignore headA and don't ignore headB? You can't, sorry. Thanks for the information --
[O] [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...}
HI: In my thesie, I need add a caption to table or figure with \bicaption{中文标题}{English title} I can't find the easy way to do this in org-mode ,so I add :caption to #+attr_latex: for example: #+attr_latex: :caption \bicaption{...}{} But the below function doesn't work as expected, someone can help me? thanks! #+begin_src emacs-lisp (defun org-latex--caption/label-string (element info) Return caption and label LaTeX string for ELEMENT. INFO is a plist holding contextual information. If there's no caption nor label, return the empty string. For non-floats, see `org-latex--wrap-label'. (let* ((label (org-element-property :name element)) (label-str (if (not (org-string-nw-p label)) (format \\label{%s} (org-export-solidify-link-text label (main (org-export-get-caption element)) (short (org-export-get-caption element t)) (caption-from-latex-attr (plist-get (org-export-read-attribute :attr_latex element) :caption))) (cond ((and (not main) (equal label-str )) (format %s caption-from-latex-attr)) ((not main) (concat label-str \n (format %s caption-from-latex-attr))) ;; Option caption format with short name. (short (format \\caption[%s]{%s%s}\n (org-export-data short info) label-str (org-export-data main info))) ;; Standard caption format. (t (format \\caption{%s%s}\n label-str (org-export-data main info)) #+end_src
[O] [PATCH] Add :caption attribute to #+ATTR_LATEX property
This feature is very useful when you export org to latex with custom caption command, for example: #+ATTR_LATEX: :caption \BiTableCaption{caption 1}{caption 2} |---+---| | x | y | |---+---| | 1 | 2 | |---+---| 0001-Add-caption-attribute-to-ATTR_LATEX-property.patch Description: Binary data
[O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property
This is the updated patch of Add :caption attribute to #+ATTR_LATEX property If possible, please include it to master This feature is very useful when you export org to latex with custom caption command, for example: #+ATTR_LATEX: :caption \BiTableCaption{caption 1}{caption 2} |---+---| | x | y | |---+---| | 1 | 2 | |---+---| -- 0001-Add-caption-attribute-to-ATTR_LATEX-property.patch Description: Binary data
Re: [O] [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...}
Rasmus ras...@gmx.us writes: Hi Feng, In my thesie, I need add a caption to table or figure with \bicaption{ä¸ææ é¢}{English title} I assume you'd still want to use the #+CAPTION-cookie, no? If so, one solution that comes to mind is writing captions like #+CAPTION: my-Asian-string (sorry about my ignorance) MYSPLIT my-English-string and write a filter using (org-split-string text MYSPLIT) and format it as (format \bicaption{%s}{%s} LIST) if the length is two. Org perhaps regexps could be used to identify 'my-Asian-string'. I'm not sure where to apply the filter, though, but a better solution than the one below would use `org-export-get-caption' on the correct elements at the correct time. . . --- #+caption: ä¸ææ é¢ #+caption: English Title | 1 | 2 | --- I think this is the best document construct, simple and intuitive. But, realizing this feature need some dirty hack, the main reason is that \bicaption often a custom latex command, fig caption and table caption are different in option, for example: \bicaption[å¾]{...}[fig]{...} \bicaption{å¾}{fig}{...}{...} \bicaption{...}{...} \bicaption[表]{...}[Table]{} ... Here's a dirty, inelegant regexp filter that's run on the final tex-string. #+begin_src emacs-lisp (defun org-latex-filter-split-caption (text backend info) When ## is present in a string make a bicaption. (when (org-export-derived-backend-p backend 'latex 'beamer) (replace-regexp-in-string caption{\\(.*?\\)[ \t]*##[ \t]+?\\(.*\\)} bicaption{\\1}{\\2} text) )) (add-to-list 'org-export-filter-final-output-functions 'org-latex-filter-split-caption) #+end_src It is a very useful tip, thanks! It will export this document 'correctly': #+begin_src org #+TITLE: my test doc #+CAPTION: - ## english title | 1 | 2 | 3 | #+CAPTION: english title | 2 | 3 | #+end_src Hope this inspires you to solve the problem in a more elegant manner. âRasmus --
Re: [O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property
Hi version 3 patch, add document about :caption attribute. On Sun, Jun 30, 2013 at 7:46 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, feng shu tuma...@gmail.com writes: This is the updated patch of Add :caption attribute to #+ATTR_LATEX property If possible, please include it to master Thanks for your patch. I agree that #+CAPTION isn't ready for complex caption commands (nor that it should), so a :caption attribute may be useful. Though, it must be documented in the manual (see 12.7.4 LaTeX specific attributes). In particular, documentation should insist on the fact that: 1. :caption attribute has precedence over #+caption keyword 2. :caption attribute is only meaningful special caption commands, i.e., this isn't the standard way to set a caption in Org. 3. This is a raw command, nothing in it will be interpreted by Org. Here are some comments about the code: + (caption-from-attr-latex (plist-get (org-export-read-attribute :attr_latex element) :caption))) You can use the following slightly shorter sexp: (caption-from-attr-latex (org-export-read-attribute :attr_latex element :caption)) +(if (and caption-from-attr-latex (not (equal caption-from-attr-latex ))) + (concat caption-from-attr-latex \n) + (cond + ((and (not main) (equal label-str ))) + ((not main) (concat label-str \n)) + ;; Option caption format with short name. + (short (format \\caption[%s]{%s%s}\n + (org-export-data short info) + label-str + (org-export-data main info))) + ;; Standard caption format. + (t (format \\caption{%s%s}\n label-str (org-export-data main info))) Here you can include the then part in the `cond', and use `org-string-nw-p': (cond ((org-string-nw-p caption-from-attr-latex) (concat caption-from-attr-latex \n)) ((and (not main) (equal label-str )) ) ...) (defun org-latex-guess-inputenc (header) Set the coding system in inputenc to what the buffer is. @@ -1655,7 +1658,7 @@ used as a communication channel. (cond ((and (not float) (plist-member attr :float)) nil) ((string= float wrap) 'wrap) ((string= float multicolumn) 'multicolumn) - ((or float (org-element-property :caption parent)) + ((or float (org-element-property :caption parent) (plist-get attr :caption)) Be careful here: (plist-get attr :caption) will be non-nil if :caption is set to the empty string. It may be bulkier to use: (org-string-nw-p (plist-get attr :caption)) 'figure (placement (let ((place (plist-get attr :placement))) @@ -2333,7 +2336,7 @@ This function assumes TABLE has `org' as its `:type' property and ((and (not float) (plist-member attr :float)) nil) ((string= float sidewaystable) sidewaystable) ((string= float multicolumn) table*) - ((or float (org-element-property :caption table)) + ((or float (org-element-property :caption table) (plist-get attr :caption)) Ditto. Regards, -- Nicolas Goaziou 0001-Add-caption-attribute-to-ATTR_LATEX-property.patch Description: Binary data
Re: [O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property
Thanks for your help. This is V4 patch. On Mon, Jul 1, 2013 at 4:27 AM, Bastien b...@gnu.org wrote: Hi Feng, feng shu tuma...@gmail.com writes: (org-latex--inline-image): Tiny change. org-latex--org-table): Tiny change. The Emacs usage is to write it like this: (org-latex--inline-image, org-latex--org-table): Tiny change. Thanks! -- Bastien, nitpicking again :) 0001-Add-caption-attribute-to-ATTR_LATEX-property.patch Description: Binary data
Re: [O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property
Thanks all the people! This is V5! On Tue, Jul 2, 2013 at 5:38 AM, Nicolas Goaziou n.goaz...@gmail.com wrote: Hello, feng shu tuma...@gmail.com writes: Thanks for your help. This is V4 patch. Thanks for the update. More comments below. +@item :caption +By default, you should use @code{#+caption} keyword to add a table caption. +If you want to add caption with complex or special latex commands, you can use +@code{:caption} attribute. It will precedence over @code{#+caption} keyword. +It should be set with raw latex command and nothing in it will be +interpreted by Org. You need to use upper cases for keywords: @code{#+CAPTION}. Also, sentences are expected to end with two spaces and latex should be typed @LaTeX{}. Here is a suggestion (note that I'm not a wording expert): @code{#+CAPTION} keyword is the simplest way to set a caption for a table (@pxref{Images and tables}). If you need more advanced commands for that task, you can use @code{:caption} attribute instead. Its value should be raw @LaTeX{} code. It has precedence over @code{#+CAPTION}. I think it's much good than mine. For me, writing documentation is a painful thing. +When export the below example to latex, the table caption will be set +with latex command @code{\bicaption@{Heading A@}@{Heading B@}} instead of +@code{#+CAPTION} keywords. In the example below, @LaTeX{} command @code{\bicaption@{Heading A@}@{Heading B@}} will set the caption. (I think you can drop the rest of the sentence). -@code{:width} and @code{:height} attributes. It is also possible to add any -other option with the @code{:options} attribute, as shown in the following -example: +@code{:width} and @code{:height} attributes. If you want to set image +caption with special latex command, you can use @code{:caption} attribute, +for example: Besides the missing two spaces at the end of the sentence, I suggest the following: You can specify specify image width or height with, respectively, @code{:width} and @code{:height} attributes. It is also possible to add any other option with the @code{:options} attribute, as shown in the following example: EXAMPLE If you need a specific command for the caption, use @code{:caption} attribute. It will override standard @code{#+CAPTION} value, if any. EXAMPLE? Also, you don't seem to document the feature for special blocks. - (short (org-export-get-caption element t))) -(cond - ((and (not main) (equal label-str )) ) - ((not main) (concat label-str \n)) - ;; Option caption format with short name. - (short (format \\caption[%s]{%s%s}\n - (org-export-data short info) - label-str - (org-export-data main info))) - ;; Standard caption format. - (t (format \\caption{%s%s}\n label-str (org-export-data main info)) + (short (org-export-get-caption element t)) + (caption-from-attr-latex (org-export-read-attribute :attr_latex element :caption))) +(cond ((org-string-nw-p caption-from-attr-latex) +(concat caption-from-attr-latex \n)) + ((and (not main) (equal label-str ))) Why do you drop the return value (empty string) here? It's my mistake! Regards, -- Nicolas Goaziou 0001-Add-caption-attribute-to-ATTR_LATEX-property.patch Description: Binary data
[O] [PATCH] Let =`make'= be an option to =`org-latex-pdf-process'=.
0001-Let-make-be-an-option-to-org-latex-pdf-process.patch Description: Binary data
[O] [PATCH] ox: add Simplified Chinese translations for `org-export-dictionary'
0001-ox-add-Simplified-Chinese-translations-for-org-expor.patch Description: Binary data
[O] [PATCH](v2) ox: add Simplified Chinese translations for `org-export-dictionary'
0001-ox-add-Simplified-Chinese-translations-for-org-expor.patch Description: Binary data
[O] [question] What does list of listing mean?
Hi List of listing = list of figure ? Thanks! feng
[O] [PATCH] (V3) ox: add Simplified Chinese translations for `org-export-dictionary'
0001-ox-add-Simplified-Chinese-translations-for-org-expor.patch Description: Binary data
Re: [O] [PATCH] (V3) ox: add Simplified Chinese translations for `org-export-dictionary'
Please include this V3 patch to master. Thanks! Feng