<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments for Juan on programming</title>
	<atom:link href="http://juangarcia.890m.com/blog/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://juangarcia.890m.com/blog</link>
	<description>Programming themes</description>
	<pubDate>Fri, 21 Nov 2008 11:54:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>Comment on Uniquify and ido by JG</title>
		<link>http://juangarcia.890m.com/blog/2008/06/16/uniquify-and-ido/#comment-80</link>
		<dc:creator>JG</dc:creator>
		<pubDate>Wed, 18 Jun 2008 06:47:50 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/?p=19#comment-80</guid>
		<description>I'm glad you found it helpful Eric.  Cheers for letting me know.

JG</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad you found it helpful Eric.  Cheers for letting me know.</p>
<p>JG</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Uniquify and ido by Eric</title>
		<link>http://juangarcia.890m.com/blog/2008/06/16/uniquify-and-ido/#comment-78</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 17 Jun 2008 16:19:47 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/?p=19#comment-78</guid>
		<description>Thanks for this. Very helpful!  I already use ido but uniquify is addressing something that's always bothered me.</description>
		<content:encoded><![CDATA[<p>Thanks for this. Very helpful!  I already use ido but uniquify is addressing something that&#8217;s always bothered me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Wrapping FTP in emacs - part 2 by piyo</title>
		<link>http://juangarcia.890m.com/blog/2008/04/02/wrapping-ftp-in-emacs-part-2/#comment-71</link>
		<dc:creator>piyo</dc:creator>
		<pubDate>Mon, 09 Jun 2008 15:10:23 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/2008/04/02/wrapping-ftp-in-emacs-part-2/#comment-71</guid>
		<description>Sorry that the format of that post comment doesn't look right. Go ahead and tidy up and/or re-post. I hope someone will point out flaws in my elisp.

BTW, I noticed that echo on Windows doesn't work the same as echo in GNU bash. That is, echo on Windows does not care about the quotation delimiters and it will copy them and the space between the quote and the right angle bracket into the output file. Eww. So my post is technically wrong about filling in that configuration file, but I hope it is understandable in any case.</description>
		<content:encoded><![CDATA[<p>Sorry that the format of that post comment doesn&#8217;t look right. Go ahead and tidy up and/or re-post. I hope someone will point out flaws in my elisp.</p>
<p>BTW, I noticed that echo on Windows doesn&#8217;t work the same as echo in GNU bash. That is, echo on Windows does not care about the quotation delimiters and it will copy them and the space between the quote and the right angle bracket into the output file. Eww. So my post is technically wrong about filling in that configuration file, but I hope it is understandable in any case.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Emacs, muse and htmlize by Jeremy Bowers</title>
		<link>http://juangarcia.890m.com/blog/2008/05/20/emacs-muse-and-htmlize/#comment-68</link>
		<dc:creator>Jeremy Bowers</dc:creator>
		<pubDate>Thu, 05 Jun 2008 22:21:25 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/?p=12#comment-68</guid>
		<description>"Show me the code" - Python or Perl? The Perl one is a bit more sophisticated, because it picked up a couple of small features when I ported it from the Python one, but... it's perl.

Either way, the code in question isn't quite "done" simply because it hasn't had people beating on it, but it's decent.

(If you really are interested, please respond to my email, but be aware it may take me a day or three; I don't check it often anymore.)</description>
		<content:encoded><![CDATA[<p>&#8220;Show me the code&#8221; - Python or Perl? The Perl one is a bit more sophisticated, because it picked up a couple of small features when I ported it from the Python one, but&#8230; it&#8217;s perl.</p>
<p>Either way, the code in question isn&#8217;t quite &#8220;done&#8221; simply because it hasn&#8217;t had people beating on it, but it&#8217;s decent.</p>
<p>(If you really are interested, please respond to my email, but be aware it may take me a day or three; I don&#8217;t check it often anymore.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Emacs keymaps - prefix keys by JG</title>
		<link>http://juangarcia.890m.com/blog/2008/06/04/emacs-keymaps-prefix-keys/#comment-67</link>
		<dc:creator>JG</dc:creator>
		<pubDate>Wed, 04 Jun 2008 21:51:03 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/?p=17#comment-67</guid>
		<description>Hi guys, thanks for the suggestions.  I particularly like the kbd macro.

Cheers,

JG</description>
		<content:encoded><![CDATA[<p>Hi guys, thanks for the suggestions.  I particularly like the kbd macro.</p>
<p>Cheers,</p>
<p>JG</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Emacs keymaps - prefix keys by fubek</title>
		<link>http://juangarcia.890m.com/blog/2008/06/04/emacs-keymaps-prefix-keys/#comment-65</link>
		<dc:creator>fubek</dc:creator>
		<pubDate>Wed, 04 Jun 2008 16:04:33 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/?p=17#comment-65</guid>
		<description>I use the fabulous kbd macro:

(global-set-key (kbd "C-c i d") 'my-insert-date)

Works for me.</description>
		<content:encoded><![CDATA[<p>I use the fabulous kbd macro:</p>
<p>(global-set-key (kbd &#8220;C-c i d&#8221;) &#8216;my-insert-date)</p>
<p>Works for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Emacs keymaps - prefix keys by Rafal</title>
		<link>http://juangarcia.890m.com/blog/2008/06/04/emacs-keymaps-prefix-keys/#comment-64</link>
		<dc:creator>Rafal</dc:creator>
		<pubDate>Wed, 04 Jun 2008 07:10:13 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/?p=17#comment-64</guid>
		<description>In my .emacs file I have the following lines
(define-key mode-specific-map [?i ?d] 'my-insert-date)
(define-key mode-specific-map [?i ?i] 'ispell)
This way I don't need to define any prefix keys.</description>
		<content:encoded><![CDATA[<p>In my .emacs file I have the following lines<br />
(define-key mode-specific-map [?i ?d] &#8216;my-insert-date)<br />
(define-key mode-specific-map [?i ?i] &#8216;ispell)<br />
This way I don&#8217;t need to define any prefix keys.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Wrapping FTP in emacs - part 2 by JG</title>
		<link>http://juangarcia.890m.com/blog/2008/04/02/wrapping-ftp-in-emacs-part-2/#comment-63</link>
		<dc:creator>JG</dc:creator>
		<pubDate>Mon, 02 Jun 2008 21:31:58 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/2008/04/02/wrapping-ftp-in-emacs-part-2/#comment-63</guid>
		<description>Hi Piyo, I'm glad to hear I inspired someone to extend emacs to shortcut a common task.  This is really what the intention of my emacs postings is.  If you like, I can tidy up your comment and put it in a post with appropriate attribution of course.  What do you think?

JG</description>
		<content:encoded><![CDATA[<p>Hi Piyo, I&#8217;m glad to hear I inspired someone to extend emacs to shortcut a common task.  This is really what the intention of my emacs postings is.  If you like, I can tidy up your comment and put it in a post with appropriate attribution of course.  What do you think?</p>
<p>JG</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Wrapping FTP in emacs - part 2 by piyo</title>
		<link>http://juangarcia.890m.com/blog/2008/04/02/wrapping-ftp-in-emacs-part-2/#comment-61</link>
		<dc:creator>piyo</dc:creator>
		<pubDate>Fri, 30 May 2008 23:25:18 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/2008/04/02/wrapping-ftp-in-emacs-part-2/#comment-61</guid>
		<description>Thanks for the response. I think that I misunderstood your needs.

I tried implementing the strategy above, because I want the capability just like you
explained. However, I expect to use dired only, and not to ftp a currently visiting buffer. I
think this is where we differ in expected usage. Anyway, here's how I tried it:

First we want to define a file that stores the target url. This will be relative to each
directory.

(defvar *dired-cpauto-setting-file* ".dired-cpauto"
  "The relative path file to check in the local directory for the
target copy path.")

The file will look like this (UNIX or DOS line endings OK):
echo "/ftp:username@remotehost:/path/to/my/dir/" &#62; .dired-cpauto
echo "---- comments ----" &#62;&#62; .dired-cpauto

Then we need a function that will parse the setting in the file. 

(defun dired-cpauto-parse-setting (&#38;optional arg)
  "Get the target url setting in ange-ftp format from file
`*dired-cpauto-setting-file*'. If the file does not exist, nil is returned.

For parsing simplicity, the file's first non-blank line is returned, and
the rest are ignored.

ARG is currently ignored"
  (interactive)
  (let* ((file (expand-file-name *dired-cpauto-setting-file*
                                 (dired-current-directory)))
         (attr (file-attributes file))
         target-path)
    (if (and attr)                       ; file exists
        (save-match-data
          (with-current-buffer (generate-new-buffer "*dired-cpauto*")
            (insert-file-contents file)
            (goto-char (point-min))
            (skip-chars-forward " \t\r\n")
            ;; get the first line 
            (let* ((start (point))
                   (end (save-excursion
                          (skip-chars-forward "^\r\n")
                          (point))))
              (setq target-path (buffer-substring start end)))
            (if (string-match "\\(.*?\\)\\(?:\\s-\\&#124;[\n]\\)+\\'" target-path)
              (setq target-path (match-string 1 target-path)))
            (kill-buffer (current-buffer)))
          ))
    target-path))

Then, assuming we are in a dired buffer and we are file copying like normal, we just need to
reuse the dired copy command:

(defun dired-do-cpauto (&#38;optional arg)
  "Modeled after `dired-do-copy'"
  (interactive "P")
  (if (dired-cpauto-parse-setting)
      (flet ( ;; this is where to put it
             (dired-dwim-target-directory (&#38;rest args)
                                          (dired-cpauto-parse-setting))
             ;; stop asking me interactively where to put it
             (dired-mark-read-file-name (prompt target-dir &#38;rest args)
                                        target-dir)
             ;; stop asking me interactively if I want to overwrite
             (dired-query (&#38;rest args) t))
        (call-interactively 'dired-do-copy))
    (message "dired-do-cpauto: setting file %s does not exist, please create it with the
target directory in ange-ftp format" 
             *dired-cpauto-setting-file*)))

I use flet to redefine dired internal functions temporarily in order to get the functionality
I want.

I've tried this code and it works to my satisfaction. E.g. I select the file or files using
dired commands dired-mark ("m"), then activate the command dired-do-cpauto to upload it
automatically. It may have some rough edges on non-valid input, so YMMV.

This functionality should be more general because dired, ange-ftp and/or TRAMP packages are
doing the heavy lifting for us. In other words, not only is ftp supported, but any other
remote transport that ange-ftp/TRAMP supports, like sftp, ssh, rsync, etc.

I also wanted a useful reminder, because I can't remember commands to type in M-x. So I added
a menu item to the Dired special "Operate" menu.

(let ((menu-bar (lookup-key dired-mode-map [menu-bar])))
    (let ((menu (lookup-key menu-bar [operate])))
      (define-key-after
        menu
        [copy-auto]
        '(menu-item
          "Copy automatically"
          dired-do-cpauto
          :help "Copy marked files to specified remote automatically")
        'copy)))

Lastly, there is a problem with this on Windows if the source directory path has spaces in
it. The problem is that the path is copied verbatim to the ftp tool. This is a problem in the
underlying ange-ftp or tramp. :-(

Thanks for this topic. I use Filezilla all the time, but now that I have this, bye bye
Filezilla!</description>
		<content:encoded><![CDATA[<p>Thanks for the response. I think that I misunderstood your needs.</p>
<p>I tried implementing the strategy above, because I want the capability just like you<br />
explained. However, I expect to use dired only, and not to ftp a currently visiting buffer. I<br />
think this is where we differ in expected usage. Anyway, here&#8217;s how I tried it:</p>
<p>First we want to define a file that stores the target url. This will be relative to each<br />
directory.</p>
<p>(defvar *dired-cpauto-setting-file* &#8220;.dired-cpauto&#8221;<br />
  &#8220;The relative path file to check in the local directory for the<br />
target copy path.&#8221;)</p>
<p>The file will look like this (UNIX or DOS line endings OK):<br />
echo &#8220;/ftp:username@remotehost:/path/to/my/dir/&#8221; &gt; .dired-cpauto<br />
echo &#8220;&#8212;- comments &#8212;-&#8221; &gt;&gt; .dired-cpauto</p>
<p>Then we need a function that will parse the setting in the file. </p>
<p>(defun dired-cpauto-parse-setting (&amp;optional arg)<br />
  &#8220;Get the target url setting in ange-ftp format from file<br />
`*dired-cpauto-setting-file*&#8217;. If the file does not exist, nil is returned.</p>
<p>For parsing simplicity, the file&#8217;s first non-blank line is returned, and<br />
the rest are ignored.</p>
<p>ARG is currently ignored&#8221;<br />
  (interactive)<br />
  (let* ((file (expand-file-name *dired-cpauto-setting-file*<br />
                                 (dired-current-directory)))<br />
         (attr (file-attributes file))<br />
         target-path)<br />
    (if (and attr)                       ; file exists<br />
        (save-match-data<br />
          (with-current-buffer (generate-new-buffer &#8220;*dired-cpauto*&#8221;)<br />
            (insert-file-contents file)<br />
            (goto-char (point-min))<br />
            (skip-chars-forward &#8221; \t\r\n&#8221;)<br />
            ;; get the first line<br />
            (let* ((start (point))<br />
                   (end (save-excursion<br />
                          (skip-chars-forward &#8220;^\r\n&#8221;)<br />
                          (point))))<br />
              (setq target-path (buffer-substring start end)))<br />
            (if (string-match &#8220;\\(.*?\\)\\(?:\\s-\\|[\n]\\)+\\&#8217;&#8221; target-path)<br />
              (setq target-path (match-string 1 target-path)))<br />
            (kill-buffer (current-buffer)))<br />
          ))<br />
    target-path))</p>
<p>Then, assuming we are in a dired buffer and we are file copying like normal, we just need to<br />
reuse the dired copy command:</p>
<p>(defun dired-do-cpauto (&amp;optional arg)<br />
  &#8220;Modeled after `dired-do-copy&#8217;&#8221;<br />
  (interactive &#8220;P&#8221;)<br />
  (if (dired-cpauto-parse-setting)<br />
      (flet ( ;; this is where to put it<br />
             (dired-dwim-target-directory (&amp;rest args)<br />
                                          (dired-cpauto-parse-setting))<br />
             ;; stop asking me interactively where to put it<br />
             (dired-mark-read-file-name (prompt target-dir &amp;rest args)<br />
                                        target-dir)<br />
             ;; stop asking me interactively if I want to overwrite<br />
             (dired-query (&amp;rest args) t))<br />
        (call-interactively &#8216;dired-do-copy))<br />
    (message &#8220;dired-do-cpauto: setting file %s does not exist, please create it with the<br />
target directory in ange-ftp format&#8221;<br />
             *dired-cpauto-setting-file*)))</p>
<p>I use flet to redefine dired internal functions temporarily in order to get the functionality<br />
I want.</p>
<p>I&#8217;ve tried this code and it works to my satisfaction. E.g. I select the file or files using<br />
dired commands dired-mark (&#8221;m&#8221;), then activate the command dired-do-cpauto to upload it<br />
automatically. It may have some rough edges on non-valid input, so YMMV.</p>
<p>This functionality should be more general because dired, ange-ftp and/or TRAMP packages are<br />
doing the heavy lifting for us. In other words, not only is ftp supported, but any other<br />
remote transport that ange-ftp/TRAMP supports, like sftp, ssh, rsync, etc.</p>
<p>I also wanted a useful reminder, because I can&#8217;t remember commands to type in M-x. So I added<br />
a menu item to the Dired special &#8220;Operate&#8221; menu.</p>
<p>(let ((menu-bar (lookup-key dired-mode-map [menu-bar])))<br />
    (let ((menu (lookup-key menu-bar [operate])))<br />
      (define-key-after<br />
        menu<br />
        [copy-auto]<br />
        &#8216;(menu-item<br />
          &#8220;Copy automatically&#8221;<br />
          dired-do-cpauto<br />
          :help &#8220;Copy marked files to specified remote automatically&#8221;)<br />
        &#8216;copy)))</p>
<p>Lastly, there is a problem with this on Windows if the source directory path has spaces in<br />
it. The problem is that the path is copied verbatim to the ftp tool. This is a problem in the<br />
underlying ange-ftp or tramp. :-(</p>
<p>Thanks for this topic. I use Filezilla all the time, but now that I have this, bye bye<br />
Filezilla!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Wrapping FTP in emacs - part 2 by JG</title>
		<link>http://juangarcia.890m.com/blog/2008/04/02/wrapping-ftp-in-emacs-part-2/#comment-60</link>
		<dc:creator>JG</dc:creator>
		<pubDate>Fri, 30 May 2008 20:31:14 +0000</pubDate>
		<guid isPermaLink="false">http://juangarcia.890m.com/blog/2008/04/02/wrapping-ftp-in-emacs-part-2/#comment-60</guid>
		<description>Hi Piyo, I had actually integrated my ftp-wrappers with dired as you suggested.  See the post &lt;a href="http://juangarcia.890m.com/blog/2008/05/23/emacs-file-uploader/" rel="nofollow"&gt;emacs-file-uploader&lt;/a&gt;. 

ftp-wrappers is really all about saving me time and keystrokes.  I enumerated my reasons behind it in the post.

&lt;ul&gt;
 &lt;li&gt;As I generally put a file for a certain local location in a certain remote location I don't want to have to fire up dired after I've created a webpage in order to upload it.  M-x dired on its own is 6 keystrokes too many.&lt;/li&gt;
&lt;li&gt;Likewise when I've written a webpage, emacs is open already and using curl is too many keystrokes.  It might be worth wrapping though!&lt;/li&gt;
 &lt;li&gt;The ftp-server on my webserver has a short timeout so I like to manage that myself and reduce the number of times it has to connect when I'm uploading multiple files.&lt;/li&gt;
&lt;/ul&gt;

Thanks for the tip on .netrc.  I'll move the password info out of the elisp code.  I (mostly) trust the other user who uses my computer so putting passwords in files is not really an issue.  

JG</description>
		<content:encoded><![CDATA[<p>Hi Piyo, I had actually integrated my ftp-wrappers with dired as you suggested.  See the post <a href="http://juangarcia.890m.com/blog/2008/05/23/emacs-file-uploader/" rel="nofollow">emacs-file-uploader</a>. </p>
<p>ftp-wrappers is really all about saving me time and keystrokes.  I enumerated my reasons behind it in the post.</p>
<ul>
<li>As I generally put a file for a certain local location in a certain remote location I don&#8217;t want to have to fire up dired after I&#8217;ve created a webpage in order to upload it.  M-x dired on its own is 6 keystrokes too many.</li>
<li>Likewise when I&#8217;ve written a webpage, emacs is open already and using curl is too many keystrokes.  It might be worth wrapping though!</li>
<li>The ftp-server on my webserver has a short timeout so I like to manage that myself and reduce the number of times it has to connect when I&#8217;m uploading multiple files.</li>
</ul>
<p>Thanks for the tip on .netrc.  I&#8217;ll move the password info out of the elisp code.  I (mostly) trust the other user who uses my computer so putting passwords in files is not really an issue.  </p>
<p>JG</p>
]]></content:encoded>
	</item>
</channel>
</rss>
