Re: [O] Pushing and pulling to google calendar

2014-06-29 Thread Jorge A. Alfaro-Murillo
Parnell Springmeyer parn...@ixmat.us writes:

 MobileOrg is the best solution so far. But there's no
 bi-directionality, which is annoying, the sync options in MobileOrg
 are pretty solid but getting MobileOrg first setup was enormously
 confusing for me. I've used dropbox and btsync to sync and they aren't
 bad.

I have been using MobileOrg in multiple computers with Dropbox for quite
a while and I do not have any complaints. I generally try to avoid
Google calendar and use it only for remainders in the Google Now App of
my phone, and to share my calendar with other people. But when I have to
create a new item in the calendar I rather use MobileOrg to create a
capture, and let it handle the synchronization just one way.




Re: [O] org-agenda-files and customize

2014-06-29 Thread Jorge A. Alfaro-Murillo
David Masterson dsmaster...@gmail.com writes:

 2. I removed org-agenda-files from the custom-set-variables section of
 my .emacs.
 3. I set org-agenda-files in the standard way (C-c [).
 4. I notices that org-agenda-files was back in the custom-set-variables
 section of my .emacs.

 Is that supposed to happen?

Yes. Where do you expect them to be?

If you do not like the custom-set-variables, you have three options (but
you cannot use 'C-c ['):

#+BEGIN_SRC emacs-lisp
  (setq org-agenda-files
(list file1 file2 ...))
#+END_SRC

#+BEGIN_SRC emacs-lisp
  (setq org-agenda-files
path_to_a_directory_that_contains_all_your_files)
#+END_SRC

#+BEGIN_SRC emacs-lisp
  (setq org-agenda-files
path_to_a_file_with_the_names_and_location_of_all_your_files)
#+END_SRC




Re: [O] org-ref in action

2014-06-26 Thread Jorge A. Alfaro-Murillo
Grant Rettke g...@wisdomandwonder.com writes:

 How do people choose today?

 Why choose bibtex over biblatex?

For journal submission. With BibTeX you only have to copy paste at the
end of your LaTeX file the contents of the generated .bbl file.
Moreover, journals provide a default style for BibTeX, not biblatex. And
I have never seen a journal that supports biblatex (there might be a
few), but any journal that supports LaTeX supports BibTeX.

 Where do people discuss such questions like this in real life?

In the orgmode list =)




Re: [O] Alternative to arrow keys (more ergonomic)?

2014-06-13 Thread Jorge A. Alfaro-Murillo
Martin Beck elwood...@web.de writes:

 Sorry, if it may be obvious, but how do I remap CapsLock to H
 (Hyper)?
 

 p.s. I tried ;; remap CapsLock Key to Hyper Key ;;source:
 http://ergoemacs.org/emacs/emacs_hyper_super_keys.html ,
 http://emacs-fu.blogspot.de/2008/12/remapping-caps-lock.html (setq
 w32-enable-caps-lock nil) (global-set-key [capslock] 'hyper)

Dear Martin,

I think you should try to do that outside of emacs, in the configuration
of your system. I use Linux so I only have an answer for that.

I think the easiest way is to create a configuration file for xmodmap,
the common location and name is ~/.Xmodmap. My file looks like this:

#+BEGIN_EXAMPLE
clear control
clear lock
clear mod1
clear mod3
clear mod4

keycode 66 = Hyper_L
keycode 37 = Super_L
keycode 133 = Alt_L Meta_L
keycode 64 = Control_L
keycode 108 = Control_R
keycode 135 = Alt_R Meta_R
keycode 105 = Menu

add mod1 = Alt_R Alt_L Meta_R Meta_L
add mod3 = Hyper_L
add mod4= Super_L
add control = Control_R Control_L
#+END_EXAMPLE

In this case I have Hyper where the CapsLock key is, and the final row
which in the keyboard is:

Control Super Alt Space Alt MenuKey Control

gets mapped to:

Super Alt/Meta Control Space Control Alt/Meta MenuKey

(which drives anyone that tries my computer nuts, but it is very
comfortable for emacs.)

The keycodes with numbers in the example are the positions of the keys
in my keyboard. This is different depending on your keyboard, so you
have to figure out yours. For that, use the program xev (in a terminal
type xev) and press the keys that you are interested to map. Between
many information it will give you the keycode for each key you press.

Once you finish with the .Xmodmap file, you can load the configuration
by typing in a terminal 'xmodmap .Xmodmap' (without the single quotes).

If you are using GDM, XDM or KDM, in particular under Gnome or KDE, the
.Xmodmap file is loaded automatically every time you start a session. If
you are not using any of those, you can modify the file ~/.xinitrc (or
~/.config/openbox/autostart in Openbox):

#+BEGIN_EXAMPLE
if [ -s ~/.Xmodmap ]; then
xmodmap ~/.Xmodmap
fi
#+END_EXAMPLE

I hope it helps.

Best,

Jorge

PS: For linux check also XKB.




Re: [O] Alternative to arrow keys (more ergonomic)?

2014-06-12 Thread Jorge A. Alfaro-Murillo
Hi Martin,

Martin Beck elwood...@web.de writes:

 I'm using Shift+RightArrow and Shift+LeftArrow quite often to change
 the scheduled or deadline dates of a task in my agenda view. As I have
 a normal large keyboard (where the arrow keys are between the
 alphanumeric block and the numeric keypad like here:
 http://www.microsoft.com/hardware/_base_v1//products/wireless-desktop-3000/mk_
 wd3000_otherviews01.jpg ). So the arrow key is difficult to reach and
 forces me to leave the QUERTZ keys with the right hand. Can I define
 an additional key or key combination which does the same thing like
 RightArrow and is easier to reach? Which one would be available in the
 agenda view?

I have the (totally useless) CapsLock key of my keyboard remapped to
Hyper, which allows me to use an extra modifier for emacs commands.

For your case after you have a Hyper key you could make your own arrow
keys without your right fingers moving away from J K L ; where they
belong:

#+BEGIN_SRC emacs-lisp
  (global-set-key (kbd H-i) 'previous-line)
  (global-set-key (kbd H-k) 'next-line)
  (global-set-key (kbd H-j) 'left-char)
  (global-set-key (kbd H-l) 'right-char)
#+END_SRC

and for org:

#+BEGIN_SRC emacs-lisp
  (define-key org-mode-map (kbd H-S-i) 'org-shiftup)
  (define-key org-mode-map (kbd H-S-k) 'org-shiftdown)
  (define-key org-mode-map (kbd H-S-j) 'org-shiftleft)
  (define-key org-mode-map (kbd H-S-l) 'org-shiftright)
#+END_SRC

In Linux I use xmodmap for the remapping of the CapsLock key. While you
are at it you can also remap the Alt key to Cntrl and the Super to Meta,
to that you press C- commands with your left thumb and not with your
left pinky, avoiding the common emacs pinky problem.

Best,

Jorge.

PS: http://i.stack.imgur.com/2kbJv.jpg
http://www.splitreason.com/Product_Images/4e3477bef139.jpg 

PPS: to be fair some very fast typists use CapsLock
(http://seanwrona.com/typing.php)




Re: [O] Alternative to arrow keys (more ergonomic)?

2014-06-12 Thread Jorge A. Alfaro-Murillo
Thorsten Jolitz tjol...@gmail.com writes:

 Just out of curiosity - did you try this on the console (without X) too? 

Xmodmap does not work without X, at least I suppose that is what the X
stands for =)

If someone knows how to remap outside of X please let me know.

Since I use emacs not in X in my phone, my workaround is to create a
hyper key in another place (F6 is a good place for the keyboard of
JuiceSSH in Android). It is not really a modifier, so to press 'H-j',
you actually do 'F6 j', that is 'F6' followed by 'j', but I guess that
is as good as you can get with a keyboard onscreen without installing a
super tiny keyboard (e.g. Hacker's Keyboard).

#+BEGIN_SRC emacs-lisp
  (defun hyperify (prompt)
(let ((e (read-event)))
  (vector (if (numberp e)
  (logior (lsh 1 24) e)
(if (memq 'hyper (event-modifiers e))
e
  (add-event-modifier H- e))

  (defun add-event-modifier (string e)
(let ((symbol (if (symbolp e) e (car e
  (setq symbol (intern (concat string
   (symbol-name symbol
  (if (symbolp e)
  symbol
(cons symbol (cdr e)

  (define-key key-translation-map (kbd f6) 'hyperify)
#+END_SRC

Best,

Jorge.




Re: [O] (require 'org-publish) causes downgrade in org-version

2014-06-09 Thread Jorge A. Alfaro-Murillo
psycho_punch psychopunc...@gmail.com writes:

 So I need to explicitly call (package-initialize) in init.el, probably
 one of the, if not the, first line?

Yes, I had a similar issue with different versions from ELPA, and
applying (package-initialize) early (first line in my .emacs) fixed.




Re: [O] babel setup

2014-06-09 Thread Jorge A. Alfaro-Murillo
Shiyuan gshy2...@gmail.com writes:

 Hi all, 
 I am using Emacs 24.3.9 + org-mode 8.2.6(from ELPA) 
 I followed this instruction
 http://orgmode.org/worg/org-contrib/babel/languages.html#configure

 and added the following to my .emacs file. 

 (org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)
 (emacs-lisp . t)))

 After that, org-mode mysteriously switched back to the old version
 7.9. Another problem is that export command C-c C-e no longer works
 and generates error: Symbol's function definition is void:
 org-defvaralias. Is there any step I missed? Thanks. 

 Shiyuan 

Hi Shiyuan,

Have you tried to put (package-initialize) early (say first line) in
your .emacs?

Best,

Jorge.




Re: [O] Repeat work / week days

2014-06-09 Thread Jorge A. Alfaro-Murillo
Hi SabreWolfy,

SabreWolfy sabrewo...@gmail.com writes:

 I searched here and elsewhere, and then played with various diary sexp
 settings, but I could not find a way to repeat an entry on work/week days
 (Monday to Friday) every week. I would like a task to appear on all Mondays
 to Fridays.

You could add five entries like this:

#+BEGIN_SRC emacs-lisp
* Test
  SCHEDULED: 2014-06-09 Mon +1w
  SCHEDULED: 2014-06-10 Tue +1w
  SCHEDULED: 2014-06-11 Wed +1w
  SCHEDULED: 2014-06-12 Thu +1w
  SCHEDULED: 2014-06-13 Fri +1w
#+END_SRC

Then Test will appear in your agenda every Mon, Tue, Wed, Thu and Fri.

 The repeat should preferably be from Monday to Tuesday, Tuesday to
 Wednesday, etc., rather than from Monday to Monday, Tuesday to
 Tuesday, etc., but this is not so important.

This I do not understand, can you explain further?

Best,

Jorge.




Re: [O] Repeat work / week days

2014-06-09 Thread Jorge A. Alfaro-Murillo
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 This is not valid syntax. A given headline cannot have more than one
 SCHEDULED entry attached to it. Even if it works (I didn't test),
 I wouldn't count on it: this is a bug.

I guess if you do not plan to do start working on the task you should
not put the SCHEDULED and just a simple timestamp. But if you plan to
work on a task every day of the week, why shouldn't you be able to do it
this way? It does work, btw. Is it because it can conflict with changing
TODO states?

Also related, if you want it to repeat in your agenda only for a certain
period, look at org-class. For example, while I was a student I had used
things like

#+BEGIN_SRC emacs-lisp
%%(org-class 2013 1 7 2013 4 27 2) 12:00pm-01:15pm The name of the class
%%(org-class 2013 1 7 2013 4 27 4) 12:00pm-01:15pm The name of the class
#+END_SRC

for classes that were Tuesday and Thursday. It was also under a single
headline. Is this, or several simple timestamps under a single headline
also bad syntax?

Best,

Jorge.




Re: [O] Repeat work / week days

2014-06-09 Thread Jorge A. Alfaro-Murillo
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 It is probably because you don't need it. Syntax wise, SCHEDULED,
 DEADLINE and CLOSED can only appear once, on the line right after the
 related headline.

 There is no limitation to the number of plain timestamps under a headline.

Thanks for the clarification.

Best,

Jorge.




Re: [O] When is the right time to modify the contents of org-structure-template-alist?

2014-06-09 Thread Jorge A. Alfaro-Murillo
Grant Rettke g...@wisdomandwonder.com writes:

 Hi,

 Wanting to modify the contents of org-structure-template-alist I had
 this code run at startup after org was required:

 (mapc (lambda (asc)
 (let ((org-sce-dc (downcase (nth 1 asc
   (setf (nth 1 asc) org-sce-dc)))
   org-structure-template-alist)

 That didn't modify the list, though.

 When I run that code after Emacs is started up, it works as expected.

 I tried putting that code in the org mode hook too, with the same result.

Hi Grant,

Since org-structure-template-alist is defined in org.el, you could
modify it after org.el loads:

#+BEGIN_SRC emacs-lisp
  (eval-after-load org
'(progn
   ;; modify org-structure-template-alist here
  ))
#+END_SRC

Best,

Jorge.





Re: [O] latex equations and $ sign

2014-06-06 Thread Jorge A. Alfaro-Murillo

Federico Beffa be...@ieee.org writes:

 Hi,

 I would like to have a mathematical equation typeset in latex and
 automatically generated by sympy, embedded in an equation environment:

 #+NAME: mass-energy
 #+BEGIN_SRC python :results raw :exports results :wrap EQUATION
 import sympy as sp
 E, m, c = sp.symbols('E, m, c', real=True, positive=True)
 E = m*c**2
 return sp.latex(E)
 #+END_SRC

 #+NAME: eq:1
 #+RESULTS: mass-energy
 #+BEGIN_EQUATION
 c^{2} m
 #+END_EQUATION

 The problem I'm facing is that despite the fact that the equation is
 already in a mathematical mode latex environment, it still gets sub-
 and superscripts surrounded by a $ sign. Here is the generated latex
 snippet:

 \begin{equation}
 \label{eq:1}
 c$^{\text{2}}$ m
 \end{equation}

 Is there a way to teach org-mode not to insert $ signs in equation
 environments?

 Thanks,
 Fede

Hi Federico,

I don't think that Org has a way to know that you want everything inside
#+BEGIN_EQUATION and #+END_EQUATION to be an equation in LaTeX, if
instead of EQUATION you write CENTER it does a \begin{center}
\end{center}. So by default it tries to produce text.

I would change your code to:

#+NAME: mass-energy
#+BEGIN_SRC python :results raw :exports results :wrap LaTeX
  import sympy as sp
  E, m, c = sp.symbols('E, m, c', real=True, positive=True)
  E = m*c**2
  return \\begin{equation}\n + str(sp.latex(E)) + \n\\end{equation}\n
#+END_SRC

which produces:

#+RESULTS: mass-energy
#+BEGIN_LaTeX
\begin{equation}
c^{2} m
\end{equation}
#+END_LaTeX

and gets exported to LaTeX as an equation. 

In fact if you use it often, you could make a function in python:

#+NAME: mass-energy
#+BEGIN_SRC python :results raw :exports results :wrap LaTeX
  import sympy as sp
  def org_equation(the_equation):
  return \\begin{equation}\n + str(sp.latex(the_equation)) + 
\n\\end{equation}\n

  E, m, c = sp.symbols('E, m, c', real=True, positive=True)
  E = m*c**2
  return org_equation(E)
#+END_SRC

Best,

Jorge.




Re: [O] An org password manager

2014-06-02 Thread Jorge A. Alfaro-Murillo
Bastien b...@gnu.org writes:

 This is now in contrib/lisp/ - thanks!

Great! Thanks a lot.




Re: [O] An org password manager

2014-05-31 Thread Jorge A. Alfaro-Murillo

Dear Bastien, 

This is my first time submitting a patch, so I do not know if
this is the way I am supposed to do it.

Best,

Jorge

---
org-passwords.el: Add an org derived mode for managing passwords

* contrib/lisp/org-passwords.el: new file.

The file gives a mode for consulting a passwords database with entries
in org format.  The database opens in Read-Only mode and a timer is
set to close the database.  The file provides functions for making
usernames and passwords available to the facility for pasting text of
the window system (clipboard on X and MS-Windows, pasteboard on
Nextstep/Mac OS, etc.) without inserting them in the kill-ring.  It
also provides functions for generating passwords as a random string of
characters or as a number of random words from a dictionary.

1 file changed, 342 insertions(+)
 contrib/lisp/org-passwords.el | 342 ++

Newcontrib/lisp/org-passwords.el
diff --git a/contrib/lisp/org-passwords.el b/contrib/lisp/org-passwords.el
new file mode 100644
index 000..8c00d61
--- /dev/null
+++ b/contrib/lisp/org-passwords.el
@@ -0,0 +1,342 @@
+;;; org-passwords.el --- org derived mode for managing passwords
+
+;; Author: Jorge A. Alfaro-Murillo jorge.alfaro-muri...@yale.edu
+;; Created: December 26, 2012
+;; Keywords: passwords, password
+
+;; This file is NOT part of GNU Emacs.
+;;
+;; 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.  If not, see http://www.gnu.org/licenses/.
+;
+;;
+;;; Commentary:
+
+;; This file contains the code for managing your passwords with
+;; Org-mode.
+
+;; A basic setup needs to indicate a passwords file, and a dictionary
+;; for the random words:
+
+;;   (require org-passwords)
+;;   (setq org-passwords-file ~/documents/passwords.gpg)
+;;   (setq org-passwords-random-words-dictionary 
/etc/dictionaries-common/words)
+
+;; Basic usage:
+
+;;   `M-x org-passwords' opens the passwords file in
+;;   `org-passwords-mode'.
+
+;;   `M-x org-passwords-generate-password' generates a random string
+;;   of numbers, lowercase letters and uppercase letters.
+
+;;   `C-u M-x org-passwords-generate-password' generates a random
+;;   string of numbers, lowercase letters, uppercase letters and
+;;   symbols.
+
+;;   `M-x org-passwords-random-words' concatenates random words from
+;;   the dictionary defined by `org-passwords-random-words-dictionary'
+;;   into a string, each word separated by the string defined in
+;;   `org-passwords-random-words-separator'.
+
+;;   `C-u M-x org-passwords-random-words' does the same as above, and
+;;   also makes substitutions according to
+;;   `org-passwords-random-words-substitutions'.
+
+;; It is also useful to set up keybindings for the functions
+;; `org-passwords-copy-username' and
+;; `org-passwords-copy-password' in the
+;; `org-passwords-mode', to easily make the passwords and usernames
+;; available to the facility for pasting text of the window system
+;; (clipboard on X and MS-Windows, pasteboard on Nextstep/Mac OS,
+;; etc.), without inserting them in the kill-ring. You can set for
+;; example:
+
+;;   (eval-after-load org-passwords
+;; '(progn
+;;(define-key org-passwords-mode-map
+;;  (kbd C-c u)
+;;  'org-passwords-copy-username)
+;;(define-key org-passwords-mode-map
+;;  (kbd C-c p)
+;;  'org-passwords-copy-password)))
+
+;; Finally, to enter new passwords, you can use `org-capture' and a minimal 
template like:
+ 
+;;   (p password entry (file ~/documents/passwords.gpg)
+;;* %^{Title}\n  %^{PASSWORD}p %^{USERNAME}p)
+
+;; When asked for the password you can then call either
+;; `org-passwords-generate-password' or `org-passwords-random-words'.
+;; Be sure to enable recursive minibuffers to call those functions
+;; from the minibuffer:
+
+;;   (setq enable-recursive-minibuffers t)
+
+;;; Code:
+
+(require 'org)
+
+(define-derived-mode org-passwords-mode org-mode
+  org-passwords-mode
+  Mode for storing passwords
+  nil)
+
+(defgroup org-passwords nil
+  Options for password management.
+  :group 'org)
+
+(defcustom org-passwords-password-property PASSWORD
+  Name of the property for password entry password.
+  :type 'string
+  :group 'org-passwords)
+
+(defcustom org-passwords-username-property USERNAME
+  Name of the property for password entry

Re: [O] org-edit-src-code outside of org

2014-05-17 Thread Jorge A. Alfaro-Murillo
I figure it out, I am updating the variable that causes problems and it
is working very well so in case you want to use org-edit-src-code in
Message mode all is needed is:

#+BEGIN_SRC emacs-lisp
  (eval-after-load message
'(progn
   (define-key message-mode-map (kbd tab)
 (lambda ()
   (interactive)
   (if (not (org-try-structure-completion))
   (message-tab
   (define-key message-mode-map (kbd C-c ')
 (lambda ()
   (interactive)
   (org-edit-src-code)
   (setq-local org-edit-src-from-org-mode t)
#+END_SRC

I just used it right now =)

Jorge.




Re: [O] An org password manager

2014-05-13 Thread Jorge A. Alfaro-Murillo
Dear Ramon and Colin,

If you are using an (add-to-list 'auto-mode-alist ...) for the gpg
files, that sets the major mode on. If you want to leave the major mode
as Org, do not use auto-mode-alist, but instead use a hook:
(add-hook 'org-mode-hook 'your-function), where your-function should be
one that checks if the file name ends with gpg and if so turns your
sensitivity-mode on.

Alternatively, define another major mode:

#+BEGIN_SRC emacs-lisp
  (define-derived-mode org-but-sensitive-mode org-mode
...)
#+END_SRC

and copy in ... whatever your sensitive-minor-mode has.

Best,

Jorge.




[O] org-edit-src-code outside of org

2014-05-13 Thread Jorge A. Alfaro-Murillo
Hi, I would like to use org-edit-src-code outside of org, I think it
would be very handy in Message mode, to send messages that contain code
and edit that code in the proper mode.

I put something like this

 #+BEGIN_SRC emacs-lisp
   (defun mm-org-try-structure-completion ()
 (interactive)
 (if (not (org-try-structure-completion))
 (message-tab)))
   (eval-after-load message
 '(progn
(define-key message-mode-map (kbd tab)
'mm-org-try-structure-completion)))
 #+END_SRC

which allows me now to do 'a letter' and hit tab and get a the proper
source block just as in org.

I can enter the editing of the source block without problems with
org-edit-src-code (which I plan to bind to C-c ', just as in org),
however when I am want to close the editing and go back to the message
buffer it fails, specifically the part of org-edit-src-exit that says:

 #+BEGIN_SRC emacs-lisp
   (unless (org-bound-and-true-p org-edit-src-from-org-mode)
  (error This is not a sub-editing buffer, something is wrong))
 #+END_SRC
  
Is there a particular reason why the code has to check to see if it is
coming from org-mode? Shouldn't it be enough that already the
org-in-block-p was passed?

If I evaluate the function definition of org-edit-src-exit without the
last part everything works as expect, I can exit with C-c ' and the code
is there. Even doing C-x C-s before exiting works as well.

Best,

Jorge.

PS: What is the alternative when you write messages with code, do you
guys first write it in org and then copy and yank it?




Re: [O] org-edit-src-code outside of org

2014-05-13 Thread Jorge A. Alfaro-Murillo
Thanks Ken, I wonder if there is already something like that in Message
mode. I like gnus a lot, so I do not think that I am going to change to
mu4e just for that =)




Re: [O] An org password manager

2014-05-11 Thread Jorge A. Alfaro-Murillo
Thanks Ramon,

Regarding your question, probably the bug is related to running a for
with all the buffers that are open. To get what you want you can try
something creating a minor mode for gpg files and adding a hook that
adds the buffer name of the gpg file that you open to a list of buffers
to kill:

  #+BEGIN_SRC emacs-lisp
(define-minor-mode gpg-killing-mode
  A mode to kill gpg files
  :after-hook 
  (add-to-list 'gpg-buffers (buffer-name)))

(add-to-list 'auto-mode-alist '(\\.gpg$ . gpg-killing-mode))

(setq gpg-buffers nil)

(run-at-time t 120 '(lambda () 
 (mapcar 'kill-buffer gpg-buffers)
 (setq gpg-buffers nil)))
  
  #+END_SRC

Instead killing all at the same time, I would probably kill each one
after a certain time, to avoid opening a file and have it right away
killed it was close to the end of the 2 min cycle:

  #+BEGIN_SRC emacs-lisp
(define-minor-mode gpg-killing-mode
  A mode to kill gpg files
  :after-hook 
  (progn
(setq gpg-buffers (append gpg-buffers (list (buffer-name
(run-at-time 120 nil '(lambda () 
(kill-buffer (car gpg-buffers))
(setq gpg-buffers (cdr gpg-buffers))

(add-to-list 'auto-mode-alist '(\\.gpg$ . gpg-killing-mode))  

(setq gpg-buffers nil)
  #+END_SRC

Best,

Jorge.




Re: [O] An org password manager

2014-05-11 Thread Jorge A. Alfaro-Murillo
jorge.a.alf...@gmail.com (Jorge A. Alfaro-Murillo) writes:

I forgot to mention that what org-passwords.el does is to set a timer
each time that the password file is opened (analogous to the second
option in my previous message) rather than having just one timer with
repeat.

Jorge.

 Thanks Ramon,

 Regarding your question, probably the bug is related to running a for
 with all the buffers that are open. To get what you want you can try
 something creating a minor mode for gpg files and adding a hook that
 adds the buffer name of the gpg file that you open to a list of buffers
 to kill:

   #+BEGIN_SRC emacs-lisp
 (define-minor-mode gpg-killing-mode
   A mode to kill gpg files
   :after-hook 
   (add-to-list 'gpg-buffers (buffer-name)))

 (add-to-list 'auto-mode-alist '(\\.gpg$ . gpg-killing-mode))

 (setq gpg-buffers nil)

 (run-at-time t 120 '(lambda () 
  (mapcar 'kill-buffer gpg-buffers)
  (setq gpg-buffers nil)))
   
   #+END_SRC

 Instead killing all at the same time, I would probably kill each one
 after a certain time, to avoid opening a file and have it right away
 killed it was close to the end of the 2 min cycle:

   #+BEGIN_SRC emacs-lisp
 (define-minor-mode gpg-killing-mode
   A mode to kill gpg files
   :after-hook 
   (progn
 (setq gpg-buffers (append gpg-buffers (list (buffer-name
 (run-at-time 120 nil '(lambda () 
 (kill-buffer (car gpg-buffers))
 (setq gpg-buffers (cdr gpg-buffers))

 (add-to-list 'auto-mode-alist '(\\.gpg$ . gpg-killing-mode))  

 (setq gpg-buffers nil)
   #+END_SRC

 Best,

 Jorge.




[O] An org password manager

2014-05-10 Thread Jorge A. Alfaro-Murillo
Hi! I have been using org for managing passwords for a some time now. In
case someone is interested, the code is in:
https://bitbucket.org/alfaromurillo/org-passwords.el

To consult the database, the code provides a function to open the Org
file with the passwords in Read-Only mode, sets a timer after which the
buffer is killed and provides functions for copying the password without
it getting into the kill-ring. It also provides two types of functions
for generating passwords: strings of random characters, and random words
of the correcthorsebatterystaple-type. The README file in bitbucket has
detailed information about the usage.

If there is interest from the community this can also go to /contrib.

Best,

Jorge.




Re: [O] .emacs (init.el) on Dropbox: Ho to access it?

2014-04-11 Thread Jorge A. Alfaro Murillo
On 1/18/14, 1:44 PM, Renato wrote:
 Hi,
 I use org mode on two pc:
 - windows (from work)
 - Debian (at home)

 How can have just one .emacs/init.el file?

 I would store the file on a Dropbox folder that I access from both
 devices.


I have several machines and just one .emacs file in Dropbox. I use symbolic
links to it in each computer in ~/.emacs

From the terminal do:
ln -s /path/to/your/Dropbox/.emacs ~/.emacs

I assume windows works the same. If not then put in your windows .emacs a
single line with:

(load-file /path/to/your/Dropbox/.emacs)

Best,

Jorge.


Re: [O] managing articles in my personal library, and their citational material, using org mode instead of bibtex

2013-11-20 Thread Jorge A. Alfaro Murillo
I once tried to do something similar in org mode, at the end I thought I
was doing twice the work, so I ended up with just one big .bib file.

I copy the bib info from the website and then I have a function to yank it
a little bit cleaner into my bib file, something like this:

  (defun bibtex-yank-citation ()
Yanks a citation in a .bib file. Eliminates several fields,
  removes the key for the entry, and changes the abstract field for
  an annote field.
(interactive)
(goto-char (point-max))
(let ((position (point)))
  (insert (current-kill 0))
  (goto-char position)
  (re-search-forward \\(@.+?{\\).+?, nil t)
  (replace-match \\1, nil nil)
  (goto-char position)
  (while (re-search-forward % nil t)
 (replace-match % nil nil))
  (goto-char position)
  (while (re-search-forward ’ nil t)
 (replace-match ' nil nil))
  (goto-char position)
  (while (re-search-forward á nil t)
 (replace-match {\'a} nil nil))
  (goto-char position)
  (while (re-search-forward é nil t)
 (replace-match {\'e} nil nil))
  (goto-char position)
  (while (re-search-forward í nil t)
 (replace-match {\'i} nil nil))
  (goto-char position)
  (while (re-search-forward ó nil t)
 (replace-match {\'o} nil nil))
  (goto-char position)
  (while (re-search-forward ú nil t)
 (replace-match {\'u} nil nil))
  (goto-char position)
  (while (re-search-forward ñ nil t)
 (replace-match {~n} nil nil))
  (goto-char position)
  (while (re-search-forward ç nil t)
 (replace-match {c{c}} nil nil))
  (goto-char position)
  (while (re-search-forward – nil t)
 (replace-match - nil nil))
  (goto-char position)
  (delete-matching-lines

^[[:space:]]*\\(keywords\\)\\|\\(note\\)\\|\\(url\\)\\|\\(jstor\\)\\|\\(doi\\)\\|\\(issn\\)\\|\\(html\\)\\|\\(language\\)\\|\\(copyright\\)\\|\\(eprint\\))
  (goto-char position)
  (while (re-search-forward \\(^[[:space:]]*\\)abstract nil t)
 (replace-match annote nil nil


It also removes the key, so that then I just add extra information into the
annote field and then I generate the key with C-c C-c (bibtex-clean-entry).
You can configure your key type very specifically. See all the variables
bibtex-autokey-

That takes care of the new bibtex entry without effort. Now I have

  (defun bibtex-kill-ring-save-key ()
Kill-ring-save the bibtex key.
(interactive)
(let ((position (point)))
  (if (not (eq (point-max) position))
  (forward-char))
  (search-backward-regexp ^@ nil nil)
  (search-forward {)
  (copy-region-as-kill (point)
   (funcall (lambda ()
  (search-forward ,)
  (backward-char)
  (point
  (goto-char position)))

To save the key to the kill-ring, and then I save the paper with that
filename under a unique folder.

Finally I have a function that opens the respective pdf when the cursor is
within one entry. And keys for the functions, bound to Hyper keys:
  (eval-after-load bibtex '(progn
   (define-key bibtex-mode-map
 (kbd H-y) 'bibtex-yank-citation)
   (define-key bibtex-mode-map
 (kbd H-r) 'bibtex-kill-ring-save-key)
   (define-key bibtex-mode-map
 (kbd H-o)
'bibtex-open-reference-at-point)))

I even have a similar function that I use globally:
  (defun open-reference-at-point ()
(interactive)
(er/expand-region 2)
(let* ((beg (region-beginning))
  (end (region-end))
  (article-name (buffer-substring beg end)))
  (call-process evince nil 0 nil
(concat ~/documents/references/articles/
article-name
.pdf)))
(keyboard-quit))

So if I am in LaTeX, it is enough to call open-reference-at-point over the
text in \cite{...} and the pdf opens automatically.

As you can see everything just depends on using one folder for all the
references, one file for all the bib entries and the same name of the key
dot pdf for the pdf name. And you end up with an automatically super good
documented bib file. Which is very handy when you call C-c [ in LaTeX
(reftex-citation) and just vaguely remember something about what you want
to cite. Also if you want to open a certain reference you can search your
well documented bib file and open the reference with one key.

One last thing to get navigation a la org mode (C-c C-p and C-c C-n) and
folding with TAB in your bib file:

  (defun bibtex-previous-entry ()
Go to the previous bibtex entry.

Re: [O] Agenda in MobileOrg for Android

2013-04-09 Thread Jorge A. Alfaro Murillo
I think entries of the form
%%(org-class 2013 1 7 2013 4 27 2) 12:00pm-01:15pm TITLE
show up on MobileOrg.

I have org-mobile-agendas set up to 'default and they do for me.

Also the synchronization with Google Calendar is quite good in Android, you
can let then Google Calendar handles the remainders in your phone.

 Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 Dnia 2013-04-07, o godz. 14:16:54
 David Rogers davidandrewrog...@gmail.com napisał(a):

 I have felt the same way. Is the reason it's not already done (and the
 pitfall for you if you take on a project like this) that re-write
 major chunks of Emacs is a pretty big job?

 ...
 Remember that the purpose of something like such an app (as opposed to
 Org-mode proper) would not be *editing* of text, but (primarily)
 *entering* texts (and short ones, for that matter), entering
 timestamps (which is quite convenient with any pointing device,
 including touchscreens) and things like changing todo states and
 clocking in and out - and that's basically it.  In other words, a very
 small subset of Org-mode is needed here (at least for me).

 I see what you mean. That makes more sense than what I said, and I like
 your idea.

 The part that I want most from Org-mode on Android is being able to
 automatically get audible reminders for all my appointments, whether
 through a transfer into the phone's own calendar or some other way. The
 current MobileOrg doesn't quite do the job, since it doesn't yet parse
 things like this:

 %%(org-class 2013 03 01 2013 06 22 5 52 1 12 13)

 ... In fact, last time I checked, it didn't even parse date stamps that
 weren't in the headline...

 ... so my whole Org file has to be specially formatted, and some of
 Org-mode's extremely useful features avoided, if I am going to satisfy
 MobileOrg's requirements.

 Being able to edit is nice, but that doesn't take advantage of what I
 really have the phone with me for - I see my phone as mainly a reminder
 machine, not mainly an editing machine, and would love to see MobileOrg
 (or some new project) gain the ability to parse every possible agenda
 feature used in Org files, so that I can actually receive reminders for
 all the items in my Org-mode agenda. If it came with a better way of
 simple editing, that would be even better.

 --
 David


Re: [O] org-mobile-push fails

2012-10-25 Thread Jorge A. Alfaro Murillo
I think I figured it out. I think it was a problem of having upgraded org
from the package manager once, when I had another version of emacs. I
removed the package, reinstall emacs-snapshot and now it is working again.

Thanks.
On Oct 25, 2012 4:02 AM, Bastien b...@altern.org wrote:

 Hi Jorge,

 Jorge A. Alfaro Murillo jorge.a.alf...@gmail.com writes:

  This is strange, since I get the whole emacs from a repository
  (http://emacs.naquadah.org/ unstable/ ). I should not have to compile
  anything.

 I double-checked and the source on Julien's server are okay.

 Can you do

 C-h f org-mobile-create-index-file REt

 and report where the related source file is located?

 Removing it should be enough to clean up your installation.

 Best,

 --
  Bastien



Re: [O] org-mobile-push fails

2012-10-24 Thread Jorge A. Alfaro Murillo
This is strange, since I get the whole emacs from a repository
(http://emacs.naquadah.org/ unstable/ ). I should not have to compile
anything.

I guess there must be a bug in the package from the repository.

What do you recommend me to do? Install the org from source?

On Wed, Oct 24, 2012 at 5:35 AM, Bastien b...@altern.org wrote:
 Hi Jorge,

 Jorge A. Alfaro Murillo jorge.a.alf...@gmail.com writes:

 Hi, I am having trouble with org-mobile-push, it fails and gives the
 following error:
 org-mobile-create-index-file: Symbol's function definition is void:
 org-prepare-agenda-buffers

 The function `org-prepare-agenda-buffers' has been renamed to
 `org-agenda-prepare-buffers'.

 It might be related to the fact that now when run org-version the result is:
 Org-mode version 7.9.2 (7.9.2-GNU-Emacs-24-3 @ org-install.el can not be 
 found!)

 Bingo!  It is related.  :)

 My emacs version is:
 GNU Emacs 24.2.50.1 (i486-pc-linux-gnu, GTK+ Version 3.4.2) of
 2012-10-18 on dex, modified by Debian

 I updated today and since then the issue has come up.

 You certainly need to run make  make install so that the correct
 functions' names are autoloaded when Emacs fires up.

 See http://orgmode.org/worg/dev/org-build-system.html for details.

 This is also my first post to this list, which I hope to check out
 more regularly, since lately org-mode has taken over my life. Thanks
 for the help, best

 Welcome!

 --
  Bastien



<    1   2