diff options
| author | Kenichi Handa | 2012-09-30 23:43:39 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-09-30 23:43:39 +0900 |
| commit | 34f36ab2477611399e6b537ebd87df839ef09299 (patch) | |
| tree | dc129a60013f285c27859ae57cc0686f5a1adc5b /src | |
| parent | c194970e15b6d6efa07697679a25dfab3aa76442 (diff) | |
| parent | d7e642cc001a237dda8511f99b284e1a22865024 (diff) | |
| download | emacs-34f36ab2477611399e6b537ebd87df839ef09299.tar.gz emacs-34f36ab2477611399e6b537ebd87df839ef09299.zip | |
merge trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/fileio.c | 3 | ||||
| -rw-r--r-- | src/nsfns.m | 36 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/xfns.c | 4 |
5 files changed, 41 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f69ab42bd90..1f5ad1e6d05 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -5,6 +5,15 @@ | |||
| 5 | 5 | ||
| 6 | 2012-09-30 Jan Djärv <jan.h.d@swipnet.se> | 6 | 2012-09-30 Jan Djärv <jan.h.d@swipnet.se> |
| 7 | 7 | ||
| 8 | * xfns.c (Fx_file_dialog): Update comment. | ||
| 9 | |||
| 10 | * w32fns.c (Fx_file_dialog): Update comment. | ||
| 11 | |||
| 12 | * nsfns.m (Fns_read_file_name): Add argument DIR_ONLY_P. | ||
| 13 | Initialize panel name field if OSX >= 10.6. | ||
| 14 | |||
| 15 | * fileio.c (Fnext_read_file_uses_dialog_p): Add HAVE_NS. | ||
| 16 | |||
| 8 | * nsfns.m (ns_frame_parm_handlers): Add x_set_fullscreen. | 17 | * nsfns.m (ns_frame_parm_handlers): Add x_set_fullscreen. |
| 9 | 18 | ||
| 10 | * nsterm.m (NEW_STYLE_FS): New define. | 19 | * nsterm.m (NEW_STYLE_FS): New define. |
diff --git a/src/fileio.c b/src/fileio.c index 9d8a0dc8b45..9ce9e7b8395 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5520,7 +5520,8 @@ The return value is only relevant for a call to `read-file-name' that happens | |||
| 5520 | before any other event (mouse or keypress) is handled. */) | 5520 | before any other event (mouse or keypress) is handled. */) |
| 5521 | (void) | 5521 | (void) |
| 5522 | { | 5522 | { |
| 5523 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) | 5523 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) \ |
| 5524 | || defined (HAVE_NS) | ||
| 5524 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | 5525 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
| 5525 | && use_dialog_box | 5526 | && use_dialog_box |
| 5526 | && use_file_dialog | 5527 | && use_file_dialog |
diff --git a/src/nsfns.m b/src/nsfns.m index c96ec99ed2e..1efadf0cb98 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -1467,13 +1467,15 @@ DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel, | |||
| 1467 | } | 1467 | } |
| 1468 | 1468 | ||
| 1469 | 1469 | ||
| 1470 | DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 4, 0, | 1470 | DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 5, 0, |
| 1471 | doc: /* Use a graphical panel to read a file name, using prompt PROMPT. | 1471 | doc: /* Use a graphical panel to read a file name, using prompt PROMPT. |
| 1472 | Optional arg DIR, if non-nil, supplies a default directory. | 1472 | Optional arg DIR, if non-nil, supplies a default directory. |
| 1473 | Optional arg MUSTMATCH, if non-nil, means the returned file or | 1473 | Optional arg MUSTMATCH, if non-nil, means the returned file or |
| 1474 | directory must exist. | 1474 | directory must exist. |
| 1475 | Optional arg INIT, if non-nil, provides a default file name to use. */) | 1475 | Optional arg INIT, if non-nil, provides a default file name to use. |
| 1476 | (Lisp_Object prompt, Lisp_Object dir, Lisp_Object mustmatch, Lisp_Object init) | 1476 | Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) |
| 1477 | (Lisp_Object prompt, Lisp_Object dir, Lisp_Object mustmatch, | ||
| 1478 | Lisp_Object init, Lisp_Object dir_only_p) | ||
| 1477 | { | 1479 | { |
| 1478 | static id fileDelegate = nil; | 1480 | static id fileDelegate = nil; |
| 1479 | int ret; | 1481 | int ret; |
| @@ -1498,21 +1500,36 @@ Optional arg INIT, if non-nil, provides a default file name to use. */) | |||
| 1498 | if ([dirS characterAtIndex: 0] == '~') | 1500 | if ([dirS characterAtIndex: 0] == '~') |
| 1499 | dirS = [dirS stringByExpandingTildeInPath]; | 1501 | dirS = [dirS stringByExpandingTildeInPath]; |
| 1500 | 1502 | ||
| 1501 | panel = NILP (mustmatch) ? | 1503 | panel = NILP (mustmatch) && NILP (dir_only_p) ? |
| 1502 | (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; | 1504 | (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; |
| 1503 | 1505 | ||
| 1504 | [panel setTitle: promptS]; | 1506 | [panel setTitle: promptS]; |
| 1505 | 1507 | ||
| 1506 | /* Puma (10.1) does not have */ | 1508 | [panel setAllowsOtherFileTypes: YES]; |
| 1507 | if ([panel respondsToSelector: @selector (setAllowsOtherFileTypes:)]) | ||
| 1508 | [panel setAllowsOtherFileTypes: YES]; | ||
| 1509 | |||
| 1510 | [panel setTreatsFilePackagesAsDirectories: YES]; | 1509 | [panel setTreatsFilePackagesAsDirectories: YES]; |
| 1511 | [panel setDelegate: fileDelegate]; | 1510 | [panel setDelegate: fileDelegate]; |
| 1512 | 1511 | ||
| 1513 | panelOK = 0; | 1512 | panelOK = 0; |
| 1513 | if (! NILP (dir_only_p)) | ||
| 1514 | { | ||
| 1515 | [panel setCanChooseDirectories: YES]; | ||
| 1516 | [panel setCanChooseFiles: NO]; | ||
| 1517 | } | ||
| 1518 | |||
| 1514 | block_input (); | 1519 | block_input (); |
| 1515 | if (NILP (mustmatch)) | 1520 | #if defined (NS_IMPL_COCOA) && \ |
| 1521 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | ||
| 1522 | if (! NILP (mustmatch) || ! NILP (dir_only_p)) | ||
| 1523 | [panel setAllowedFileTypes: nil]; | ||
| 1524 | if (dirS) [panel setDirectoryURL: [NSURL fileURLWithPath: dirS]]; | ||
| 1525 | if (initS && NILP (Ffile_directory_p (init))) | ||
| 1526 | [panel setNameFieldStringValue: [initS lastPathComponent]]; | ||
| 1527 | else | ||
| 1528 | [panel setNameFieldStringValue: @""]; | ||
| 1529 | |||
| 1530 | ret = [panel runModal]; | ||
| 1531 | #else | ||
| 1532 | if (NILP (mustmatch) && NILP (dir_only_p)) | ||
| 1516 | { | 1533 | { |
| 1517 | ret = [panel runModalForDirectory: dirS file: initS]; | 1534 | ret = [panel runModalForDirectory: dirS file: initS]; |
| 1518 | } | 1535 | } |
| @@ -1521,6 +1538,7 @@ Optional arg INIT, if non-nil, provides a default file name to use. */) | |||
| 1521 | [panel setCanChooseDirectories: YES]; | 1538 | [panel setCanChooseDirectories: YES]; |
| 1522 | ret = [panel runModalForDirectory: dirS file: initS types: nil]; | 1539 | ret = [panel runModalForDirectory: dirS file: initS types: nil]; |
| 1523 | } | 1540 | } |
| 1541 | #endif | ||
| 1524 | 1542 | ||
| 1525 | ret = (ret == NSOKButton) || panelOK; | 1543 | ret = (ret == NSOKButton) || panelOK; |
| 1526 | 1544 | ||
diff --git a/src/w32fns.c b/src/w32fns.c index 808e19d0b66..d7b45e263b3 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -5945,7 +5945,7 @@ Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file | |||
| 5945 | selection box, if specified. If MUSTMATCH is non-nil, the returned file | 5945 | selection box, if specified. If MUSTMATCH is non-nil, the returned file |
| 5946 | or directory must exist. | 5946 | or directory must exist. |
| 5947 | 5947 | ||
| 5948 | This function is only defined on MS Windows, and X Windows with the | 5948 | This function is only defined on NS, MS Windows, and X Windows with the |
| 5949 | Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. | 5949 | Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. |
| 5950 | Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | 5950 | Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) |
| 5951 | (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) | 5951 | (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) |
diff --git a/src/xfns.c b/src/xfns.c index 928e6367743..d497cffe3df 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5344,7 +5344,7 @@ Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file | |||
| 5344 | selection box, if specified. If MUSTMATCH is non-nil, the returned file | 5344 | selection box, if specified. If MUSTMATCH is non-nil, the returned file |
| 5345 | or directory must exist. | 5345 | or directory must exist. |
| 5346 | 5346 | ||
| 5347 | This function is only defined on MS Windows, and X Windows with the | 5347 | This function is only defined on NS, MS Windows, and X Windows with the |
| 5348 | Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. | 5348 | Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. |
| 5349 | Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | 5349 | Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) |
| 5350 | (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) | 5350 | (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) |
| @@ -5517,7 +5517,7 @@ Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file | |||
| 5517 | selection box, if specified. If MUSTMATCH is non-nil, the returned file | 5517 | selection box, if specified. If MUSTMATCH is non-nil, the returned file |
| 5518 | or directory must exist. | 5518 | or directory must exist. |
| 5519 | 5519 | ||
| 5520 | This function is only defined on MS Windows, and X Windows with the | 5520 | This function is only defined on NS, MS Windows, and X Windows with the |
| 5521 | Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. | 5521 | Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. |
| 5522 | Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | 5522 | Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) |
| 5523 | (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) | 5523 | (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) |