[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109566: * nsterm.m (not_in_argv): Ne
From: |
Jan D. |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109566: * nsterm.m (not_in_argv): New function. |
Date: |
Sat, 11 Aug 2012 11:10:08 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109566
fixes bug: http://debbugs.gnu.org/12171
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sat 2012-08-11 11:10:08 +0200
message:
* nsterm.m (not_in_argv): New function.
(application:openFile, application:openTempFile:):
(application:openFileWithoutUI:, application:openFiles:): Open file
if not_in_argv returns non-zero.
modified:
src/ChangeLog
src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-08-11 08:54:35 +0000
+++ b/src/ChangeLog 2012-08-11 09:10:08 +0000
@@ -1,5 +1,10 @@
2012-08-11 Jan Djärv <address@hidden>
+ * nsterm.m (not_in_argv): New function.
+ (application:openFile, application:openTempFile:):
+ (application:openFileWithoutUI:, application:openFiles:): Open file
+ if not_in_argv returns non-zero (bug#12171).
+
* gtkutil.c (gtk_font_chooser_dialog_new, GTK_FONT_CHOOSER)
(gtk_font_chooser_set_font, gtk_font_chooser_get_font): Define
for Gtk+ versions less than 3.2.
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2012-08-10 09:24:03 +0000
+++ b/src/nsterm.m 2012-08-11 09:10:08 +0000
@@ -4448,11 +4448,20 @@
return NSTerminateNow; /* just in case */
}
+static int
+not_in_argv (NSString *arg)
+{
+ int k;
+ const char *a = [arg UTF8String];
+ for (k = 1; k < initial_argc; ++k)
+ if (strcmp (a, initial_argv[k]) == 0) return 0;
+ return 1;
+}
/* Notification from the Workspace to open a file */
- (BOOL)application: sender openFile: (NSString *)file
{
- if (ns_do_open_file)
+ if (ns_do_open_file || not_in_argv (file))
[ns_pending_files addObject: file];
return YES;
}
@@ -4461,7 +4470,7 @@
/* Open a file as a temporary file */
- (BOOL)application: sender openTempFile: (NSString *)file
{
- if (ns_do_open_file)
+ if (ns_do_open_file || not_in_argv (file))
[ns_pending_files addObject: file];
return YES;
}
@@ -4470,25 +4479,22 @@
/* Notification from the Workspace to open a file noninteractively (?) */
- (BOOL)application: sender openFileWithoutUI: (NSString *)file
{
- if (ns_do_open_file)
+ if (ns_do_open_file || not_in_argv (file))
[ns_pending_files addObject: file];
return YES;
}
-
/* Notification from the Workspace to open multiple files */
- (void)application: sender openFiles: (NSArray *)fileList
{
- /* Don't open files from the command line, Cocoa parses the command line
- wrong anyway, --option value tries to open value if --option is the last
- option. */
- if (ns_do_open_file)
- {
- NSEnumerator *files = [fileList objectEnumerator];
- NSString *file;
- while ((file = [files nextObject]) != nil)
- [ns_pending_files addObject: file];
- }
+ NSEnumerator *files = [fileList objectEnumerator];
+ NSString *file;
+ /* Don't open files from the command line unconditionally,
+ Cocoa parses the command line wrong, --option value tries to open value
+ if --option is the last option. */
+ while ((file = [files nextObject]) != nil)
+ if (ns_do_open_file || not_in_argv (file))
+ [ns_pending_files addObject: file];
[self replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109566: * nsterm.m (not_in_argv): New function.,
Jan D. <=