Note that there are some explanatory texts on larger screens.

plurals
  1. POElisp: get quotation marks in format/echo
    text
    copied!<p>In <code>.mailrc</code>, I would like to get the first row, but I get the second row</p> <pre><code>alias UIF "UIF Boxning &lt;uifboxning@boxing.se&gt;" # cool (written manually by me) alias test_alias test_name &lt;test_mail&gt; # no quotation marks (written by below defun) </code></pre> <p>I am unsure if the problem is with <code>format</code> or <code>echo</code>. Have a look:</p> <pre><code>(defun save-mail-address (address name alias) "add an alias to the .mailrc file" (interactive "sMail address: \nsFull name: \nsAlias: ") (let ((compl-alias (format "alias %s \"%s \&lt;%s\&gt;\"" alias name address))) (shell-command (concat "echo " compl-alias " &gt;&gt; .mailrc")) )) (defalias 'sma 'save-mail-address) </code></pre> <p><strong>Edit:</strong></p> <p>OK, the goal is keep it like this:</p> <pre><code>alias long "Long Long &lt;long@long.long&gt;" # 123456 alias s "S S &lt;s@s.s&gt;" # 1 </code></pre> <p>Also, made I check so not to include duplicates:</p> <pre><code>(defun append-blanks (str len) (concat str (make-string (- len (length str)) ? )) ) (defun save-mail-address (mail name alias phone) "add an alias to the .mailrc file" (interactive "sMail mail: \nsFull name: \nsAlias: \nnPhone: ") (let*( (alias-alias (format "alias %s" alias)) (alias-alias-blanks (append-blanks alias-alias 16)) (mail-str (append-blanks (format "\"%s \&lt;%s\&gt;\"" name mail) 48)) (line (format "%s%s\# %d\n" alias-alias-blanks mail-str phone)) (file "~/.mailrc") ) (with-temp-buffer (insert-file file) (if (search-forward alias-alias (point-max) t) ; t = return nil on fail (message (format "Error: The alias %s is already in use." alias)) (progn (insert line) (sort-columns nil (point-min) (point-max)) ; nil = not reversed (write-file file nil) ))))) ; nil = inhibit confirm </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload