From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rick Frankel Subject: Re: Drag images from Firefox to org-mode Date: Fri, 18 Oct 2013 16:45:53 -0400 Message-ID: <20131018204553.GA87254@BigDog.local> References: <87eh7irjvi.fsf@yahoo.fr> <52610C29.3000505@yahoo.fr> <526114B4.6060303@yahoo.fr> <2d5635af9ad6d51badb40e1e19c85572@mail.rickster.com> <87y55qpp44.fsf@yahoo.fr> <857b1a922e24dda4404df4d19fabd7e2@mail.rickster.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXGvt-000239-Az for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 16:46:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXGvl-0007DR-LH for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 16:46:05 -0400 Received: from [204.62.15.78] (port=33180 helo=mail.rickster.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXGvl-0007DH-Ht for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 16:45:57 -0400 Content-Disposition: inline In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Oleh Cc: Nicolas Richard , org mode On Fri, Oct 18, 2013 at 09:22:17PM +0200, Oleh wrote: > Thanks, Rick and Nico, I've merged the code. > All except the last bit from Rick: I can't think of any sensible > way to enter an image URL except pasting it. > And since link will be in the clipboard at some point, why not use > it straight away without prompting. > Maybe URL can be prompted for when called with a prefix arg, > but I don't know how to do that yet. I strongly disagree, for a couple of reasons: - Esp. on non-unix systems, the contents of the cut-buffer are not necessarily the same as the contents of the system clipboard. This is the problem I was having w/ your code on windows, where the cut-buffer contained the value of the current (or possibly last) selection, but the clipboard had a url. - It is certainly possible to type in a url - You might want to DND a url from another buffer. - It is ergonomically wrong for an interactive function defined to take an argument (and called "download-image") to automagically use a value from somewhere else and not actually take an argument. It would however, make sense for the function to use the current clipboard contents if called with a prefix. In the same vein, I was thinking about the automagically creating a subdirectory based on a top level heading. This is also wrong for a couple reasons: - Creating a potentially =very long directory name with spaces= can cause multiple problems, both on unix and esp. non-unix systems, where spaces may not be allowed in directory names, or there may be limits on filename/directory length. - The use of the top-level heading is arbitrary and may have nothing to do with the current context (for instance, i sometimes group together multiple documents to be output w/ export subtree in the same master document) The default should be to save it in the same directory as the document (which by the way, may not be in emacs's idea of the current directory). Also, the filename should not be expanded to an absolute path, which makes the document non-portable and will break publishing. If you want the ability to create arbitrary output directories based on document context, the customization can be made to accept a function (lambda) as a value, which could then return a directory prefix. While i realize the current implementation meets your needs, if the code is to be included in the org-mode distribution it should follow emacs and org conventions and not contains any suprises. I would be glad to make the above changes on tuesday when i get back to the office. Please send me (again) the url of the github repos with the current set of changes and I will update it so that it will allow the current functionality but have less magical default behavior. rick