Re: Storing database credentials outside an org file

2021-11-01 Thread Mike Gauland

On 1/11/21 4:33 pm, Tim Cross wrote:

Mike Gauland  writes:


I often use an org file to record database queries, using sql source blocks.
I've been putting the database credentials in the file using header-args:sql
properties, but I'd prefer to have the credentials saved in a separate file for
security reasons.

Any ideas on how I could make this work?

It probably wouldn't be too hard to use the authinfo.gpg facility via
the auth-source library which is included in Emacs. In fact, I think
sql-mode might already have support for this built in.

Thanks for the suggestion. I didn't see it on worg, but in ob-sql.el I 
found support for ":dbconnection". I can set up an entry in 
sql-connection-alist, and give the name of the entry to the sql block 
via :dbconnection. Now, my password is safely out of the .org file. As a 
bonus, it is easier to maintain across different org files.







Storing database credentials outside an org file

2021-10-31 Thread Mike Gauland
I often use an org file to record database queries, using sql source 
blocks. I've been putting the database credentials in the file using 
header-args:sql properties, but I'd prefer to have the credentials saved 
in a separate file for security reasons.


Any ideas on how I could make this work?




Re: nbsp as blank

2021-10-19 Thread Mike Gauland

On 20/10/21 12:54 pm, Alexandre Garreau wrote:

Hello,

nbsp (non-breaking space, #xA0) is not recognized as blank in org-mode,
such that “*text* :” (it’s a nbsp here) doesn’t recognize as emphasized…

I recall a variable containing such characters but can’t find it again,
does anyone know? the manual seems large and that looks non-obvious to find
quickly…


I've been using "INVISIBLE SEPARATOR", and invoke:

  (modify-syntax-entry ?⁣ " ")

(there's a invisible separator after the "?"), which tells emacs to 
consider that character to be whitespace.


I know there is a (possibly more than one) variable defining regular 
what can appear immediately before and after emphasis and other markers, 
but I've never puzzled out how to get them to include invisible characters.


I generally use this technique for combining markup, or making a 
marked-up name plural (e.g., ~object name~s).





Re: Using a code block as input to another code block

2020-11-22 Thread Mike Gauland
As far as I know, referencing a code block this way uses the results of 
executing the block as the variable, not the contents of the block.


On 22/11/2020 11:30 am, Magnus Therning wrote:

I know I can use an example block (literal example) as input to a code
block, but I haven't found a way to fontify examples. Since my input is
code (JSON, and various programming languages) I would really like to
have that, as well as the language's mode when editing by using
~org-edit-source-code~.

A code block gives me fontification, but I haven't found a way to pass a
code block as is to another code block.

For instance, something like this:

#+name: code-input
#+begin_src C
#include 
#+end_src

#+begin_src bash :var input=input :results verbatim
cat 

LaTeX Headers not in partial export

2020-10-22 Thread Mike Gauland

Not sure if I'm doing something wrong, or this is expected.

I have a number of #+LATEX directives at the top of my org file, for 
configuring the minted package.


When I export the whole thing to LaTeX, the source blocks are formatted 
with the desired minted options.


If I export only part of the document--either my marking it, or by 
adding an "export" tag--the source blocks are *not* formatted with the 
desired options. On looking at the generated tex file, I find that the 
options from the top of the org file are missing.


Does this sound like a bug, or user (possibly local configuration) 
error? If the former, I'll generate a small file that demonstrates the 
problem.


Kind regards,

MIke





Re: Framing images?

2020-10-01 Thread Mike Gauland

On 1/10/2020 5:59 am, Eric S Fraga wrote:

On Wednesday, 30 Sep 2020 at 11:21, Mike Gauland wrote:

I'd like to have a frame around images in my exported documents. I'm
primarily interested in LaTeX export, but html is a secondary concern.

There are definitely LaTeX ways of doing this (e.g. using mdframed is
the best I've found for general framing of both text and images
[1]).  But obviously these won't work for HTML export.

You might, however, be able to get what you want with a 1 row 1 column
table?

eric

Footnotes:
[1]  https://www.ctan.org/pkg/mdframed
Thanks for the suggestion. In the end, I've found the simplest solution 
for my purposes is to use graphicsmagick to  add a border around the images.




Framing images?

2020-09-29 Thread Mike Gauland
I'd like to have a frame around images in my exported documents. I'm 
primarily interested in LaTeX export, but html is a secondary concern.


Is there any easy way to do this that I'm failing to find?

Kind regards,

Mike





Re: Accessing properties in code blocks

2020-01-09 Thread Mike Gauland

Looking at git, it seems that was introduced in 9.2.

On 10/01/2020 10:32 am, sergio ruiz wrote:

I am getting:

eval: Symbol’s function definition is void: org-macro--get-property

I am using:

Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/Applications/Emacs.app/Contents/Resources/lisp/org/)

Mark set

Is this a newer function?

Thanks!



You can use elisp code to look up the property you want to pass as a 
variable:


#+BEGIN_SRC shell :var url=(org-macro--get-property "url" "")
curl $url
#+END_SRC





peace,
sergio
photographer, journalist, visionary

Public Key: 
https://pgp.key-server.io/pks/lookup?op=get=0x69B08F58923AB3A2

#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social 
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



Re: Accessing properties in code blocks

2020-01-09 Thread Mike Gauland

On 10/01/2020 9:23 am, sergio ruiz wrote:

* Report section
:PROPERTIES:
:url: http://www.googole.com
:END:

I'd like to have several sections like this. Each section woudl have 
different values for the same property. They would make different 
calls to respective url. something like


#+BEGIN_SRC shell
curl 
#+END_SRC

You can use elisp code to look up the property you want to pass as a 
variable:


#+BEGIN_SRC shell :var url=(org-macro--get-property "url" "")
curl $url
#+END_SRC




Re: [org-babel] String interpolation using shell

2020-01-09 Thread Mike Gauland

On 10/01/2020 5:56 am, sergio ruiz wrote:

#+BEGIN_SRC shell :var url_input=url_name
  curl url_input
#+END_SRC

#+RESULTS:

^^ This doesn't work. It is trying to use "url_input" in the curl command.


You need  a $ in front of the name when referencing a variable in the shell:

#+BEGIN_SRC shell :var url_input=url_name
  curl $url_input
#+END_SRC





[O] Getting text at position?

2019-06-09 Thread Mike Gauland
I'd like to be able to be able to get the text associated with a given 
heading (based on the current point, for example).


Can anyone point me to an example for doing this in the approved manner 
(assuming there is one), or to functions to help with this?


Kind regards,
Mike




Re: [O] Org-mode as a metalanguage: calling SQL functions

2013-04-01 Thread Mike Gauland
Gary Oberbrunner garyo at oberbrunner.com writes:
 Is this supposed to work?
 -- Gary

I'm not sure how it's /supposed/ to work, either, but this example works for a
sqlite database I've been playing with:

  #+NAME: artist
  #+BEGIN_SRC sqlite :db the_sound_A-Z.sql :var song_title=
  select artist from playlist where title==$song_title;
  #+END_SRC

  #+CALL: artist(song_title=Pressure)

  #+RESULTS: artist(song_title=Pressure)
  : Billy Joel

Note the need for double quotes around $song_title in the SRC block.

I'm using the latest from git, and emacs 23.2.1 on Debian.

Hope that helps.

Kind Regards,
Mike Gauland






[O] :wrap behaviour

2013-02-28 Thread Mike Gauland
I've been using the :wrap parameter extensively, to give me control over the
formatting of results from code blocks.  For files with many such blocks, it
makes sense to specify the formatting at the file level. This works well, unless
I want a particular block to be unwrapped. Just specifying :wrap with no
parameter wraps the output in #+BEGIN_RESULTS...#+END_RESULTS, which is *not*
what I want. The only way to get what I want is to move :wrap from the file
level to each block I *do* want wrapped.

I'd like to be able to disable wrapping for particular blocks. I've started
experimenting with code to do that, but I'm not sure what the best behaviour
should be, and would appreciate suggestions.

Some ideas I've considered:
  + Have :wrap by itself disable wrapping; if you want to wrap in   
BEGIN_RESULTS..END_RESULTS you'll have to specify :wrap RESULTS.
  + Use a special string (e.g., :wrap off) to disable wrapping. Of course,
this makes it impossible to wrap your output in a BEGIN_OFF..END_OFF block, 
 
should you ever want to do that.
  + Use a special symbol instead of a string to turn off wrapping (e.g., :wrap 
:off)

Kind Regards,
Mike Gauland




Re: [O] How to make the new exporter open PDF using evince?

2013-02-24 Thread Mike Gauland
James Harkins jamshark70 at gmail.com writes:

 
 A quick web search didn't turn up anything handy, so I thought I'd ask here.
 
 Is it possible to configure the new exporter to open a PDF (generated
 by LaTeX) using evince instead of okular?

I think you can do that my changing the order of the entries in /etc/mailcap,
but it's been a while since I've mucked with that.




[O] Previewing inline-LaTeX with imagemagick?

2012-07-02 Thread Mike Gauland
I've been playing with tikz to create a flowchart in my org file. The image is
rendered correctly when I export to PDF, of course, and setting the 'latex'
option to 'imagemagick' generates a PNG when I export the file to HTML. However,
if I try to preview that block with org-preview-latex-fragment (C-c C-x C-l), I
 just get a blank square (a placeholder).

I think this is because dvipng doesn't handle the postscript generated by tikz.
I've worked around this by shadowing the system dvipng with a script in my local
bin directory, that sends the dvi through dvips then convert to generate the
png. This also works for HTML export (using latex:dvipng).  

The new 'latex:imagemagick' option is a cleaner solution. Would it be possible
to use the same code for previewing fragments?

I'm happy to help with the necessary changes, if some knowledgeable with the
relevant source code can get me started in the right direction.

--Mike





[Orgmode] Re: [babel] support plantuml

2010-08-25 Thread Mike Gauland
This looks very useful, but I'm having trouble getting it to work. Do you have
an example?

I tried this:
#+BEGIN_SRC plantuml :file uml.png
Alice - Bob: Authentication Request
Bob -- Alice: Authentication Response

Alice - Bob: Another authentication Request
Alice -- Bob: another authentication Response
#+END_SRC

If I also change 'at enduml' to '@uml' in this line:
 (with-temp-file in-file (insert (concat @startuml\n body \n at 
enduml)))

I can get an image if I evaluate the block manually (e.g., via 'C-c C-c' with
the cursor on the BEGIN block), but when I export the file the image is invalid.

Any suggestions would be appreciated.

Thanks,
Mike





___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [babel] support plantuml

2010-08-25 Thread Mike Gauland
Mike Gauland mikelygee at gmail.com writes:

 I can get an image if I evaluate the block manually (e.g., via 'C-c C-c' with
 the cursor on the BEGIN block), but when I export the file the image is
 invalid.

I figured it out.  I was getting extra carriage returns in the file. I've fixed
them by setting coding-system-for-write to 'no-conversion within the (let).

--Mike




___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Indentation in html tables

2010-07-16 Thread Mike Gauland
 I frequently use a columnview dynamic block to create a table (generally a task
list, with effort estimates and notes). I export these to HTML, so they look
pretty for my Emacsphobic colleagues.  I've noticed that when my table includes
nested levels, sometimes the level is indicated in the HTML with *'s, and other
times a span of invisible x's is used instead.  I haven't had any luck trying
to figure out why this happens, or what I'm doing differently to get one or the
other. Can anyone explain this?

I prefer to use padding for indentation, since some of my headings get wrapped
to several lines. Padding prevents the second and subsequent lines from starting
at the left edge, making the structure of the table clearer.  For those who
share this preference, I present the following from my .emacs. When exporting a
table to HTML, it replaces invisible x's with *'s, and converts *'s to a padding
directive:

(add-hook 'org-export-html-final-hook
  (lambda ()
(goto-char (point-min))
(while (re-search-forward td\\(\\*+\\)  nil t)
  (replace-match 
   (format td style=\padding-left:%dem\
   (- (length (match-string 1)) 1)))
  )))
(add-hook 'org-export-html-final-hook
  (lambda () 
(goto-char (point-min))
(while (re-search-forward span
style=\visibility:hidden;\\\(\\x+\\)/span nil t)
  (replace-match (concat (make-string (length (match-string 1)) ?*)
 ))
  )))



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Estimate ranges in column view

2010-06-17 Thread Mike Gauland
When planning my work, I estimate the effort required as a range, rather than a
single value. That is, instead of estimating a certain task will take 4 days,
I'll use a range of 3-5 days. If I'm a bit less confident I know how long it
will take, I'll use a wider range (e.g., 2-6 days).  

When I first started doing this, I switched from using a single 'Effort' column
in org mode, to two columns (Effort_Low and Effort_High), simply summing each
column to get an estimate for a composite task.  However, this magnifies the
level of uncertainty in the estimate. The final 'Effort_Low' value tells me what
to expect if everything goes optimally; 'Effort_High' provides the extremely
pessimistic view.

More realistic summaries come from considering the range of each pair, using the
combined statistical variance in each (low, high) pair to determine the variance
in the final value. This is the method used by LiquidPlanner, for example.

I've been mucking about with org-colview.el to automate this calculation for me,
and am quite pleased with the results so far. I've approached this by adding a
new summary type (est) to org-columns-compile-map, and extending
org-columns-number-to-string and org-columns-string-to-number to convert ranges
to and from strings. This lets me populate an 'Estimates' column with values
such as [2 4], and specify a summary type est to have the algorithm
described above used to produce the final estimates.

I have two questions for the list:

  1. Is this the right approach, or should I change the behaviour of the
existing EFFORT property?
  2. Is this something others would find useful?

Thanks,
Mike



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode