org mode Capture templates - emacs

I would like to know how to use the annotation, %A in the org-template.
%a Annotation, normally the link created with org-store-link.
%A Like %a, but prompt for the description part.
I was able to use %A but got something to get the following:
** TODO
To improve
[[file:~/Documents/python/python/xml2csv.py::print%20elem.text,%20use.text][%^{Link description}]]
So I get a Link description as prompt but I don't know how to modify the prompt. link description. I wonder what should prompt the description part?
By contrast the regular prompt specify Prompt the user
%^{prop}p Prompt the user for a value for property prop.

You can use something like:
("r" "Meeting Schedule" entry
(file+headline "~/org/your-file.org" "HEADING")
"* TODO Meeting - %?
%i
Room: %^{Place}
Subject of the Meeting: %^{Subject}
Who will Atend: %^{Atendees}
%a ")
I've mixed many uses, but if you want some string to prompt you you can use it likee %^{Place}A (it'll prompt you for Place, and use the rules of annotation.
Cheers,

Related

How to use input box to enter formula?

I am using NetLog to test learning curve formula. I would like to use the input box to interactively enter something as simple as
current-tick * 23
No joy. I can capture a current ticks value in a set command, but I cannot get the input box to accept a formula. Once I learn how to do it, I can work out how to do larger formula.
set knowledge-increment []
set knowledge-increment + learning-equation * 25
learning-equation is the label for the input box.
Any suggestions?
The input box sets the value of the global variable specified. It is a string. To use that string in code, something like this will work
run (word "show " learning-equation)
or more to your point of setting a value
globals [new-equ]
to go
run (word "set new-equ " learning-equation)
show (word "new-equ is " new-equ)
end
I got it working in basic form. Now to apply it. The input box called increment, uses a no quotes equation.
I used stuff as a global.
The code line contains the set command within the quotes. Now I can use stuff as a constant as in:
run (word “set stuff ” increment)
show stuff * ticks
I just have to avoid using global variables such as ticks in a turtle setting.
Thank you Lon and Andrew

Automate a Grep Applescript to Word Document

I'm using a Mac and I'm preparing accounts for a company. Every payslip which I've made in Microsoft Word has a voucher number. Because a transaction was missed all voucher numbers are wrong so now there are hundreds of wrong payslips. I want to create a script that can find the following GREP (find beginning of paragraph, text:Vch, any character until \r):
^Vch.+\r
and replace it with nothing (thereby deleting the whole sentence).
I was thinking of using Applescript as it can open the document, perform the GREP find (tricky part), save the document and save it as a pdf (all which is needed).
But apparently my knowledge fails me. Commands from the dictionary like create range, execute find, all bring errors.
Somebody experienced in Applescript that could help me devise a script? Any suggestions? It should be something like:
Tell application "Microsoft Word"
tell active document
set myRange to create range start 0 end 0
tell myRange
execute find find "^Vch.+\r" replace with ""
end tell
end tell
end tell
Many thanks!
There are no special characters to indicate the beginning of a line.
To search at beginning of the paragraph, the script must use return & "some text"
You can use "^p" as paragraph mark, but it doesn't work when you set the match wildcards property to true
To match an entire paragraph, the script must use return & "some text" & return, and the script must use replace with return to delete one paragraph mark instead of two.
Because the first paragraph does not begin with a paragraph mark, the script must use two execute find commands.
The wildcard is *
tell application "Microsoft Word" -- (tested on version 15.25, Microsoft Office 2016)
-- check the first paragraph
select (characters of paragraph 1 of active document)
execute find (find object of selection) find text ("Vch*" & return) replace with "" replace replace one wrap find find stop with match wildcards and match case without match forward and find format
--to search forward toward the end of the document.
execute find (find object of selection) find text (return & "Vch*" & return) replace with return replace replace all wrap find find continue with match wildcards, match case and match forward without find format
save active document
-- export to PDF in the same directory as the active document
set pdfPath to path of active document & ":" & (get name of active window) & ".pdf"
set pdfPath to my createFile(pdfPath) -- create an empty file if not exists, the handler return a path of type alias (to avoid grant access issue)
save as active document file name pdfPath file format format PDF
end tell
on createFile(f)
do shell script "touch " & quoted form of POSIX path of f
return f as alias
end createFile

Dired: don't show file permissions

At my new job I'm using Emacs 24 on Windows, and its chief use for me in these particular circumstances is as a file manager.
I'd like to jettison everything from the Dired display except filename, size, and date. This question showed me how to use ls-lisp-verbosity to remove most of the detail that I don't want.
But I haven't found a way to keep from displaying the permissions. I've checked the documentation for ls and for dir, and there doesn't seem to be a flag for "don't show permissions". And so far I haven't found anything in Dired that will omit the permissions. Can this be done?
Your best option is to change the ls switches so that Dired does not list those fields. See M-x man ls for your particular platform, to see what ls switches are available to you.
dired-details.el (and dired-details+.el) are no longer needed if you have Emacs 24.4 (or a pre-release development snapshot). Just use ( to toggle between showing and hiding details.
And in that case you at least have two options to control whether symbolic-link targets or all lines except header and file lines are considered details to hide: dired-hide-details-hide-symlink-targets and
dired-hide-details-hide-information-lines.
If changing ls switches does not help in your case, then you would need to tweak function dired-details-make-current-line-overlay from dired-details.el. The details to be hidden are determined by the first cond clause, which is this (wrapped in ignore-errors):
(dired-move-to-filename t)
That moves point to the beginning of the file name. The next line is this:
(make-overlay (+ 2 bol) (point))
That creates the invisibility overlay from the beginning of the line (bol here) up to the beginning of the file name (point).
If you want something different then you need to get the limits that you want for the overlay. For example, if you want invisibility to start at the file size, then you would search forward with a regexp that finds the beginning of the file size.
You can come up with such a regexp by working from the regexp for dired-move-to-filename-regexp (in library dired.el). It is a very complex regexp that matches everything up to the file name. But you can use it to find the date+time portion, which is either the 7th matching regexp subgroup or the 2nd, depending on whether the date+time is expressed using a locale (western or eastern) or using ISO representation.
You can see how this is handled in the code defining variable diredp-font-lock-keywords-1 of library dired+.el.
But again, the best approach, if it does what you want, is to try to use ls switches to control which fields are listed in the first place. You can easily experiment with switches by using a prefix argument with C-x d - you are prompted for the switches to use.

matching property in agenda view

I want collect and create a block containing headlines which only has "ID" property in the headlines.
i.e The headlines to be filtered looks like
* Headline
:PROPERTIES:
:ID: my-id
:END:
I am using the following code to configure the custom agenda command which does not work
(setq org-agenda-custom-commands
'(("c" "MY Agenda"
((tags "ID")))))
I have read the org manual http://orgmode.org/manual/Matching-tags-and-properties.html#Matching-tags-and-properties but still unable to figure out how to do it.
Your code as such is asking it to find all headlines that have a :ID: tag on the headline. To look for properties you have to use the property match feature which is listed a bit lower on the linked manual page.
Since I'm assuming you need it to match any ID and not just a specific ID you'll have to use the regexp matching by either matching (=) or not matching (<>) the regexp that follows in curly brackets.
To match your ID property you'll need the regexp to be ID={.+}. If you used .* as the match it would also match headlines without any ID property. If you have some a set of IDs you want to match that have something in common you can adjust the regexp to match them.
So your custom agenda command will have to be:
(setq org-agenda-custom-commands
'(("c" "MY Agenda"
((tags "ID={.+}")))))

Emacs Gnus Faces (Fonts)

The slrn newsreader has an attractive interface with different colours for the author, subject and date columns when browsing list of articles in a newsgroup. I am looking for the Emacs font/face variables for these fields in gnus, but have not been able to find them. The gnus manual for faces does not list the available faces and none of the faces list in Emacs (M-x customize-face gnus-... looks relevant. I am using gnus 5.13 in Emacs 23.2.1.
(This question is not related to displaying "faces" (icons/avatars) in Emacs or gnus.)
Solved: See my answer below.
I think they're scattered a bit in the gnus codebase. The faces used in the article buffer are probably in gnus-art.el, etc.
It sounds like your biggest problem is that there are specific faces that you can't find the symbol for. You can always do M-x describe-face to see what is under the cursor to solve that problem.
Also, (face-list) returns a list of all defined faces. You could scan that list looking for things that look like likely candidates for the particular faces you're interested in.
The format string for various elements in gnus can be customized by modifying the appropriate variable. The variable for the summary line is gnus-summary-format-line. I am not using the default value for this variable, but instead am using the value %U%R%z %(%&user-date; %-15,15f %* %B%s%)\n.
As described here, a new face can be applied to any (sub)section of a format line by bracketing the section with %1{ and %}, where the 1 in this example corresponds to gnus-face-1. gnus-face-1 in my installation defaults to "italics", so adding the following to my ~/.emacs file results in the author in the summary line appearing in italics:
(setq gnus-summary-line-format "%U%R%z %(%&user-date; %1{%-15,15f%} %* %B%s%)\n")
I go with M-x list-faces-display (which opens a new buffer with all the currently defined face variables fontified to the color that they're set to, in alphabetic order) when I want to see what faces I need to change to get a mode working.
Then I setq them, using either the format from color-theme or from the new emacs built-in theme format, depending on which version of emacs I'm in.