all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: lisp/term/ns-win.el modification
Date: Thu, 27 Apr 2017 19:13:46 +0900	[thread overview]
Message-ID: <74D20593-63B6-46FB-BAC3-D841D0BCD461@gmail.com> (raw)
In-Reply-To: <CABr8ebbyvSgSD8ZTShCKOdegygD1USjVA-t_M7fR0RtSa892hA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3960 bytes --]

Anders,

Thank you very much for the feedback.

> * All authors of a patch much assign the copyright to FSF in order for it to be included in Emacs. This mean that you can't include a random piece of code from the internet (in this case the `trim-spaces' function).

Ok, but such a trimming function is trivial and I don't see how my rewriting it to make it different from that code would add to it. What should I do?

> * You must follow the coding standards. First, every function should be prefixed with a module name, normally this corresponds the name of the name of the file they are defined in. However, in this case, ns-win, use "ns-". Secondly, there are hanging parentheses in the code, indentation isn't correct, and there are lines longer than 79 characters.

I'll do. Thank you very much.

> Comments on the patch itself:
> 
> * I'm not exactly sure which problem you were trying to solve. I just tested to select a number of files in the Finder on macOS (10.10.5) and dragged then to Emacs (25.1), and they open just fine. Please include a description in the source code for the situation your code handle.

Services are called from the Services menu, not by drag-and-dropping.

The "Open Selected File" service takes a string as its argument, tries to parse that as a path on the file system and if a file corresponds to that path opens it, otherwise creates a buffer with the file name as its name.

The service is basically used on text files, not in the Finder.

> * I miss a description, or link to a description, of the format of `ns-input-spi-argument'. Without it it's hard to tell what the code is trying to do, and whether or not it does it correctly.

You mean `ns_input_spi_arg', right? The line above (defvar ns-input-spi-name) refers to a `nsterm.m' file where it  seems to be defined the following way:

ns_input_spi_arg = build_string ([arg UTF8String]);

> * The code will be smaller, and more easy to read, if you would use `dolist' instead of `while'. Also, if you do this change, I see no need to break out the code into a separate function, as it will only be two or three lines long.

I don't want to modify the ns-spi-service-call block more than necessary.

> * File names in macOS may start or end with spaces. It's probably not a good idea to trim spaces. (Again, it's hard to tell without a description of the format.)

Yes, but we're not talking about file names but file paths in a text file here.
The problem with not trimming is that when a legit file is tripple-clicked, the whole line is selected, including trailing spaces. The way the service is currently implemented considers that spaces a belonging to the file name and since that file does not exist just opens a blank buffer.

So I guess I could add a test to check wether the trimmed file exist and if not add the selected white space until I get an existing file (but then we'd hit cases where 2 files ending with different sorts of white space could be confused for each other).

> Again, thanks for submitting the patch.

Thank me when I have something that's acceptable :)

Jean-Christophe

>     -- Anders
> 
> 
> On Thu, Apr 27, 2017 at 6:50 AM, Jean-Christophe Helary <jean.christophe.helary@gmail.com <mailto:jean.christophe.helary@gmail.com>> wrote:
> I've noticed that the system service provided by NS-Emacs (and Aquamacs) did not allow multiple strings to be selected for opening them in emacs since the function called (dnd-open-file) accepts only one argument.
> 
> A few days ago I've written a patch to the aquamacs/ns-win.el that was accepted today by David.
> 
> https://github.com/davidswelt/aquamacs-emacs/pull/128/files <https://github.com/davidswelt/aquamacs-emacs/pull/128/files>
> 
> Since the issue exists also in NS-Emacs I was wondering what could be done to have the patch (or an adaptation) applied to the original lisp/term/ns-win.el file.
> 
> Jean-Christophe
> 


[-- Attachment #2: Type: text/html, Size: 6172 bytes --]

  reply	other threads:[~2017-04-27 10:13 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27  4:50 lisp/term/ns-win.el modification Jean-Christophe Helary
2017-04-27  9:02 ` Anders Lindgren
2017-04-27 10:13   ` Jean-Christophe Helary [this message]
2017-04-27 11:30     ` Anders Lindgren
2017-04-27 14:53       ` Jean-Christophe Helary
2017-04-27 15:09         ` Davis Herring
2017-04-27 15:31           ` Jean-Christophe Helary
2017-04-27 23:32           ` Jean-Christophe Helary
     [not found]             ` <15112485-03CC-4FFF-8A9D-BA28D2490A91-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-28  1:49               ` Jean-Christophe Helary
2017-04-29 12:24                 ` Anders Lindgren
     [not found]                   ` <CABr8ebaB1Fp0BgVy7LWwtOnSs1UOXr3CJumMfOWR4JOooQMT4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-29 12:49                     ` Jean-Christophe Helary
2017-04-30  5:36                       ` Anders Lindgren
2017-04-30 12:14                         ` Noam Postavsky
2017-04-30  6:41                   ` Jean-Christophe Helary
2017-04-30 14:12                     ` Eli Zaretskii
2017-04-30 15:06                       ` Clément Pit-Claudel
2017-04-30 15:24                         ` Eli Zaretskii
2017-04-30 22:28                           ` Jean-Christophe Helary
2017-05-01  6:33                             ` Eli Zaretskii
2017-05-01  8:23                               ` Jean-Christophe Helary
2017-05-01  8:59                                 ` Eli Zaretskii
2017-05-01 10:53                                   ` Jean-Christophe Helary
2017-05-01 11:27                                     ` Eli Zaretskii
2017-05-02  4:00                                       ` Jean-Christophe Helary
2017-05-02  6:44                                         ` Eli Zaretskii
2017-05-02  6:47                                           ` Jean-Christophe Helary
2017-05-01 15:12                                   ` Jean-Christophe Helary
2017-05-01 15:27                                     ` Eli Zaretskii
2017-05-01 15:58                                       ` Jean-Christophe Helary
2017-05-01 16:25                                         ` Eli Zaretskii
2017-05-02 12:57                                           ` Jean-Christophe Helary
2017-05-03 20:40                                             ` Anders Lindgren
2017-05-04  0:10                                               ` Jean-Christophe Helary
2017-05-04  8:50                                               ` Jean-Christophe Helary
2017-05-04 18:37                                                 ` Anders Lindgren
2017-05-05  8:36                                                   ` Jean-Christophe Helary
2017-04-30 22:23                       ` Jean-Christophe Helary
2017-05-01  6:30                         ` Eli Zaretskii
2017-04-27 12:24     ` Noam Postavsky
2017-04-27 14:53       ` Jean-Christophe Helary
2017-04-27 12:51     ` mituharu
2017-04-27 14:55       ` Jean-Christophe Helary
2017-04-27 15:35       ` Jean-Christophe Helary
2017-04-27 18:28         ` mituharu
2017-04-27 23:29           ` Jean-Christophe Helary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74D20593-63B6-46FB-BAC3-D841D0BCD461@gmail.com \
    --to=jean.christophe.helary@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.