diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-10-12 13:44:56 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-10-12 13:44:56 -0700 |
commit | d0f910cbf862db2a89d56e6414c93a93e46e202b (patch) | |
tree | 0504513f33cdb0a31e5b04ecd60c374a5d096dda /src | |
parent | a346d5bd25acee99bb94f9b785507d4e4ccb554b (diff) | |
parent | 59b5dc60d660f81f8b781068d13727ed812ad555 (diff) | |
download | emacs-d0f910cbf862db2a89d56e6414c93a93e46e202b.tar.gz emacs-d0f910cbf862db2a89d56e6414c93a93e46e202b.tar.bz2 emacs-d0f910cbf862db2a89d56e6414c93a93e46e202b.zip |
Merge from origin/emacs-26
59b5dc60d6 Fix this-command-keys for "M-x foo" commands
2f4bd2fbda Let rename-file rename dirs across filesystems
413978727c Simplify Flymake user documentation
6ff18c3995 * etc/NEWS: Mention the new version of Org.
b78332c3c6 Don't use (format "%s" ...) for string copying (Bug#28774)
078fb7f6df Make frame-list-z-order on NS match Windows behaviour (bug...
# Conflicts:
# etc/NEWS
Diffstat (limited to 'src')
-rw-r--r-- | src/fileio.c | 14 | ||||
-rw-r--r-- | src/keyboard.c | 15 | ||||
-rw-r--r-- | src/nsfns.m | 11 |
3 files changed, 27 insertions, 13 deletions
diff --git a/src/fileio.c b/src/fileio.c index d8ecccd7930..ca21b0a115a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2261,7 +2261,7 @@ This is what happens in interactive use with M-x. */) (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists) { Lisp_Object handler; - Lisp_Object encoded_file, encoded_newname, symlink_target; + Lisp_Object encoded_file, encoded_newname; file = Fexpand_file_name (file, Qnil); @@ -2335,12 +2335,22 @@ This is what happens in interactive use with M-x. */) if (rename_errno != EXDEV) report_file_errno ("Renaming", list2 (file, newname), rename_errno); + struct stat file_st; bool dirp = !NILP (Fdirectory_name_p (file)); + if (!dirp) + { + if (lstat (SSDATA (encoded_file), &file_st) != 0) + report_file_error ("Renaming", list2 (file, newname)); + dirp = S_ISDIR (file_st.st_mode) != 0; + } if (dirp) call4 (Qcopy_directory, file, newname, Qt, Qnil); else { - symlink_target = Ffile_symlink_p (file); + Lisp_Object symlink_target + = (S_ISLNK (file_st.st_mode) + ? emacs_readlinkat (AT_FDCWD, SSDATA (encoded_file)) + : Qnil); if (!NILP (symlink_target)) Fmake_symbolic_link (symlink_target, newname, ok_if_already_exists); else diff --git a/src/keyboard.c b/src/keyboard.c index ee353d2b078..7ddd6b96747 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10055,7 +10055,12 @@ Internal use only. */) this_command_key_count = 0; this_single_command_key_start = 0; - int key0 = SREF (keys, 0); + + int charidx = 0, byteidx = 0; + int key0; + FETCH_STRING_CHAR_ADVANCE (key0, keys, charidx, byteidx); + if (CHAR_BYTE8_P (key0)) + key0 = CHAR_TO_BYTE8 (key0); /* Kludge alert: this makes M-x be in the form expected by novice.el. (248 is \370, a.k.a. "Meta-x".) Any better ideas? */ @@ -10064,7 +10069,13 @@ Internal use only. */) else add_command_key (make_number (key0)); for (ptrdiff_t i = 1; i < SCHARS (keys); i++) - add_command_key (make_number (SREF (keys, i))); + { + int key_i; + FETCH_STRING_CHAR_ADVANCE (key_i, keys, charidx, byteidx); + if (CHAR_BYTE8_P (key_i)) + key_i = CHAR_TO_BYTE8 (key_i); + add_command_key (make_number (key_i)); + } return Qnil; } diff --git a/src/nsfns.m b/src/nsfns.m index ba363629686..c8a41f5b4b0 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1476,13 +1476,8 @@ ns_window_is_ancestor (NSWindow *win, NSWindow *candidate) DEFUN ("ns-frame-list-z-order", Fns_frame_list_z_order, Sns_frame_list_z_order, 0, 1, 0, doc: /* Return list of Emacs' frames, in Z (stacking) order. -The optional argument TERMINAL specifies which display to ask about. -TERMINAL should be either a frame or a display name (a string). If -omitted or nil, that stands for the selected frame's display. Return -nil if TERMINAL contains no Emacs frame. - -As a special case, if TERMINAL is non-nil and specifies a live frame, -return the child frames of that frame in Z (stacking) order. +If TERMINAL is non-nil and specifies a live frame, return the child +frames of that frame in Z (stacking) order. Frames are listed from topmost (first) to bottommost (last). */) (Lisp_Object terminal) @@ -1492,8 +1487,6 @@ Frames are listed from topmost (first) to bottommost (last). */) if (FRAMEP (terminal) && FRAME_LIVE_P (XFRAME (terminal))) parent = [FRAME_NS_VIEW (XFRAME (terminal)) window]; - else if (!NILP (terminal)) - return Qnil; for (NSWindow *win in [[NSApp orderedWindows] reverseObjectEnumerator]) { |