aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2017-10-12 13:44:56 -0700
committerPaul Eggert2017-10-12 13:44:56 -0700
commitd0f910cbf862db2a89d56e6414c93a93e46e202b (patch)
tree0504513f33cdb0a31e5b04ecd60c374a5d096dda
parenta346d5bd25acee99bb94f9b785507d4e4ccb554b (diff)
parent59b5dc60d660f81f8b781068d13727ed812ad555 (diff)
downloademacs-d0f910cbf862db2a89d56e6414c93a93e46e202b.tar.gz
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
-rw-r--r--doc/misc/flymake.texi166
-rw-r--r--lisp/ido.el2
-rw-r--r--lisp/progmodes/flymake.el31
-rw-r--r--src/fileio.c14
-rw-r--r--src/keyboard.c15
-rw-r--r--src/nsfns.m11
6 files changed, 101 insertions, 138 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index d89a555ff73..05d879d8f4b 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -52,8 +52,6 @@ modify this GNU manual.''
52@end ifnottex 52@end ifnottex
53 53
54@menu 54@menu
55* Overview of Flymake::
56* Installing Flymake::
57* Using Flymake:: 55* Using Flymake::
58* Extending Flymake:: 56* Extending Flymake::
59* The legacy Proc backend:: 57* The legacy Proc backend::
@@ -61,50 +59,57 @@ modify this GNU manual.''
61* Index:: 59* Index::
62@end menu 60@end menu
63 61
64@node Overview of Flymake 62@node Using Flymake
65@chapter Overview 63@chapter Using Flymake
66@cindex overview of flymake 64@cindex overview of flymake
65@cindex using flymake
67 66
68Flymake is a universal on-the-fly buffer checker implemented as an 67Flymake is a universal on-the-fly buffer checker implemented as an
69Emacs minor mode. When enabled, Flymake visually annotates the buffer 68Emacs minor minor. To use Flymake, you must first activate
70with diagnostic information coming from one or more different sources, 69@code{flymake-mode} by using the command @kbd{flymake-mode}.
71or @dfn{backends}.
72 70
73Flymake annotates the buffer by highlighting problematic buffer 71When enabled, Flymake collects information about problems in the
74regions with a special space. It displays an overall buffer status in 72buffer, called @dfn{diagnostics}, from one or more different sources,
75the mode line containing totals for different types of diagnostics. 73or @dfn{backends}, and then visually annotates the buffer by
76 74highlighting problematic buffer regions with a special face.
77@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are
78commands that allow easy navigation to the next/previous erroneous
79line, respectively. If might be a good idea to map them to @kbd{M-n}
80and @kbd{M-p} in @code{flymake-mode}, by adding to your init file:
81 75
82@lisp 76It also displays an overall buffer status in the mode line containing
83(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error) 77totals for different types of diagnostics.
84(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
85@end lisp
86 78
87Syntax check is done ``on-the-fly''. It is started whenever 79Syntax check is done ``on-the-fly''. It is started whenever
88 80
89@itemize @bullet 81@itemize @bullet
90@item 82@item
91@code{flymake-mode} is started, unless 83@code{flymake-mode} is started, unless
92@code{flymake-start-on-flymake-mode} is nil. 84@code{flymake-start-on-flymake-mode} is nil;
93 85
94@item 86@item
95a newline character is added to the buffer, unless 87a newline character is added to the buffer, unless
96@code{flymake-start-syntax-check-on-newline} is nil. 88@code{flymake-start-syntax-check-on-newline} is nil;
97 89
98@item 90@item
99some changes were made to the buffer more than @code{0.5} seconds ago 91some changes were made to the buffer more than @code{0.5} seconds ago
100(the delay is configurable in @code{flymake-no-changes-timeout}). 92(the delay is configurable in @code{flymake-no-changes-timeout}).
101@end itemize 93@end itemize
102 94
95Syntax check can also be started manually by typing the @kbd{M-x
96flymake-start @key{RET}} command.
97
98@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are
99commands that allow easy navigation to the next/previous erroneous
100line, respectively. If might be a good idea to map them to @kbd{M-n}
101and @kbd{M-p} in @code{flymake-mode}, by adding to your init file:
102
103@lisp
104(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
105(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
106@end lisp
107
103Flymake is a universal syntax checker in the sense that it's easily 108Flymake is a universal syntax checker in the sense that it's easily
104extended to support new backends (@pxref{Extending Flymake}). 109extended to support new backends (@pxref{Extending Flymake}).
105 110
106Historically, Flymake used to accept diagnostics from a single, albeit 111Historically, Flymake used to accept diagnostics from a single
107reasonably flexible, backend. 112backend, albeit a reasonably flexible one.
108 113
109This backend isn't (yet) obsolete, and so is still available as a 114This backend isn't (yet) obsolete, and so is still available as a
110fallback and active by default (@pxref{The legacy Proc backend}). It works by 115fallback and active by default (@pxref{The legacy Proc backend}). It works by
@@ -114,105 +119,45 @@ background, passing it a temporary file which is a copy of the current
114buffer, and parsing the output for known error/warning message 119buffer, and parsing the output for known error/warning message
115patterns. 120patterns.
116 121
117@node Installing Flymake
118@chapter Installing
119@cindex installing flymake
120
121Flymake is included with Emacs and its main commands, like
122@code{flymake-mode}, are autoloaded. This means there is usually
123nothing to do by way of installation.
124
125@node Using Flymake
126@chapter Using Flymake
127@cindex using flymake
128
129@menu 122@menu
130* Flymake mode::
131* Running the syntax check::
132* Navigating to error lines:: @c * Viewing error messages::
133* Syntax check statuses:: 123* Syntax check statuses::
134* Backend exceptions:: 124* Backend exceptions::
135* Customizable variables:: 125* Customizable variables::
136@end menu 126@end menu
137 127
138@node Flymake mode
139@section Flymake mode
140@cindex flymake-mode
141@cindex activating flymake-mode
142
143Flymake is an Emacs minor mode. To use Flymake, you
144must first activate @code{flymake-mode} by using the command
145@kbd{flymake-mode}.
146
147Instead of manually activating @code{flymake-mode}, you can configure
148Emacs to automatically enable @code{flymake-mode} upon opening any
149file for which syntax check is possible. To do so, place the following
150line in your @file{~/.emacs}:
151
152@lisp
153(add-hook 'find-file-hook 'flymake-find-file-hook)
154@end lisp
155
156@node Running the syntax check
157@section Running the syntax check
158@cindex manually starting syntax check
159@cindex syntax check, start manually
160
161@findex flymake-start
162When @code{flymake-mode} is active, syntax check is started
163automatically on any of the three conditions mentioned in
164@ref{Overview of Flymake}. Syntax check can also be started manually
165by typing the @kbd{M-x flymake-start @key{RET}} command.
166
167@node Navigating to error lines
168@section Navigating to error lines
169@cindex navigating to error lines
170
171After syntax check is completed, lines for which at least one error or
172warning has been reported are highlighted, and the total number of errors
173and warning is shown in the mode line. Use the following functions to
174navigate the highlighted lines:
175
176@table @code
177@findex flymake-goto-next-error
178@item flymake-goto-next-error
179Moves point to the next erroneous line, if any.
180
181@findex flymake-goto-prev-error
182@item flymake-goto-prev-error
183Moves point to the previous erroneous line.
184@end table
185
186If the user option @code{flymake-wrap-around} is active
187(@pxref{Customizable variables}), these functions treat diagnostics
188as a linked list. Therefore, @code{flymake-goto-next-error} will go
189to the first diagnostic when invoked in the end of the buffer.
190
191@node Syntax check statuses 128@node Syntax check statuses
192@section Syntax check statuses 129@section Syntax check statuses
193@cindex Syntax check statuses 130@cindex Syntax check statuses
194 131
195While enabled, Flymake displays its status in the mode line. 132When enabled, Flymake displays its status in the mode line, which
133provides a visual summary of diagnostic collection. It may also hint
134at certain exceptional situations encountered when communicating with
135backends.
136
196The following statuses are defined: 137The following statuses are defined:
197 138
198@multitable @columnfractions 0.25 0.75 139@multitable @columnfractions 0.25 0.75
140@item [@var{nerrors} @var{nwarnings} ...]
141@tab Normal operation. @var{nerrors} and @var{nwarnings} are, respectively,
142the total number of errors and warnings found during the last buffer
143check, for all backends. They may be followed by other totals for
144other types of diagnostics (@pxref{Flymake error types}).
145
199@item @code{Wait} 146@item @code{Wait}
200@tab Some flymake backends haven't reported since the last time they 147@tab Some Flymake backends haven't reported since the last time they
201where questioned. 148where questioned. It is reasonable to assume that this is a temporary
149delay and Flymake will resume normal operation soon.
202 150
203@item @code{!} 151@item @code{!}
204@tab All the configured Flymake backends have disabled themselves. 152@tab All the configured Flymake backends have disabled themselves: Flymake
205Left-clicking Flymake's mode line indicator pops up a menu listing the 153cannot annotate the buffer and action from the user is needed to
206option to visit Flymake's log buffer. In this buffer these situations 154investigate and remedy the situation (@pxref{Backend exceptions}).
207can be investigated.
208 155
209@item @code{?} 156@item @code{?}
210@tab There are no configured Flymake backends in 157@tab There are no applicable Flymake backends for this buffer, thus Flymake
211@code{flymake-diagnostic-functions}. 158cannot annotate it. To fix this, a user may look to extending Flymake
159and add a new backend (@pxref{Extending Flymake}).
212 160
213@item @emph{[nerrors nwarnings]}
214@tab Normal operation, number of errors/warnings found by the syntax
215check process.
216@end multitable 161@end multitable
217 162
218@node Backend exceptions 163@node Backend exceptions
@@ -223,8 +168,9 @@ check process.
223@cindex backends, disabled 168@cindex backends, disabled
224Some backends may take longer than others to respond or complete, and 169Some backends may take longer than others to respond or complete, and
225some may decide to @emph{disable} themselves if they are not suitable 170some may decide to @emph{disable} themselves if they are not suitable
226for the current buffer. A disabled backend is not tried again for 171for the current buffer or encounter some unavoidable problem. A
227future checks of the current buffer. 172disabled backend is not tried again for future checks of the current
173buffer.
228 174
229@findex flymake-reporting-backends 175@findex flymake-reporting-backends
230@findex flymake-running-backends 176@findex flymake-running-backends
@@ -240,10 +186,12 @@ disabled backend list, so that they will be tried again in the next check.
240 186
241@cindex logging 187@cindex logging
242@cindex flymake logging 188@cindex flymake logging
243Flymake also uses a simple logging facility for indicating important points 189Flymake also uses a simple logging facility for indicating important
244in the control flow. The logging facility sends logging messages to 190points in the control flow. The logging facility sends logging
245the @file{*Flymake log*} buffer. The information logged can be used for 191messages to the @file{*Flymake log*} buffer. The information logged
246resolving various problems related to Flymake. 192can be used for resolving various problems related to Flymake. For
193convenience, a shortcut to this buffer can be found in Flymake's menu,
194accessible from the top menu bar or just left of the status indicator.
247 195
248@vindex warning-minimum-log-level 196@vindex warning-minimum-log-level
249@vindex warning-minimum-level 197@vindex warning-minimum-level
diff --git a/lisp/ido.el b/lisp/ido.el
index 47cbcb63c69..4f1e36ba914 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -4701,7 +4701,7 @@ Modified from `icomplete-completions'."
4701 (if (and ido-use-faces comps) 4701 (if (and ido-use-faces comps)
4702 (let* ((fn (ido-name (car comps))) 4702 (let* ((fn (ido-name (car comps)))
4703 (ln (length fn))) 4703 (ln (length fn)))
4704 (setq first (format "%s" fn)) 4704 (setq first (copy-sequence fn))
4705 (put-text-property 0 ln 'face 4705 (put-text-property 0 ln 'face
4706 (if (= (length comps) 1) 4706 (if (= (length comps) 1)
4707 (if ido-incomplete-regexp 4707 (if ido-incomplete-regexp
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index e4c6a38a77e..8c9c4b211a2 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -878,11 +878,11 @@ Do it only if `flymake-no-changes-timeout' is non-nil."
878 (flymake-log :warning "Turned on in `flymake-find-file-hook'"))) 878 (flymake-log :warning "Turned on in `flymake-find-file-hook'")))
879 879
880(defun flymake-goto-next-error (&optional n filter interactive) 880(defun flymake-goto-next-error (&optional n filter interactive)
881 "Go to Nth next Flymake error in buffer matching FILTER. 881 "Go to Nth next Flymake diagnostic that matches FILTER.
882Interactively, always move to the next error. With a prefix arg, 882Interactively, always move to the next diagnostic. With a prefix
883skip any diagnostics with a severity less than `:warning'. 883arg, skip any diagnostics with a severity less than `:warning'.
884 884
885If `flymake-wrap-around' is non-nil and no more next errors, 885If `flymake-wrap-around' is non-nil and no more next diagnostics,
886resumes search from top. 886resumes search from top.
887 887
888FILTER is a list of diagnostic types found in 888FILTER is a list of diagnostic types found in
@@ -933,12 +933,13 @@ applied."
933 "")))))) 933 ""))))))
934 934
935(defun flymake-goto-prev-error (&optional n filter interactive) 935(defun flymake-goto-prev-error (&optional n filter interactive)
936 "Go to Nth previous Flymake error in buffer matching FILTER. 936 "Go to Nth previous Flymake diagnostic that matches FILTER.
937Interactively, always move to the previous error. With a prefix 937Interactively, always move to the previous diagnostic. With a
938arg, skip any diagnostics with a severity less than `:warning'. 938prefix arg, skip any diagnostics with a severity less than
939`:warning'.
939 940
940If `flymake-wrap-around' is non-nil and no more previous errors, 941If `flymake-wrap-around' is non-nil and no more previous
941resumes search from bottom. 942diagnostics, resumes search from bottom.
942 943
943FILTER is a list of diagnostic types found in 944FILTER is a list of diagnostic types found in
944`flymake-diagnostic-types-alist', or nil, if no filter is to be 945`flymake-diagnostic-types-alist', or nil, if no filter is to be
@@ -953,13 +954,13 @@ applied."
953;;; 954;;;
954(easy-menu-define flymake-menu flymake-mode-map "Flymake" 955(easy-menu-define flymake-menu flymake-mode-map "Flymake"
955 `("Flymake" 956 `("Flymake"
956 [ "Go to next error" flymake-goto-next-error t ] 957 [ "Go to next problem" flymake-goto-next-error t ]
957 [ "Go to previous error" flymake-goto-prev-error t ] 958 [ "Go to previous problem" flymake-goto-prev-error t ]
958 [ "Check now" flymake-start t ] 959 [ "Check now" flymake-start t ]
959 [ "Go to log buffer" flymake-switch-to-log-buffer t ] 960 [ "List all problems" flymake-show-diagnostics-buffer t ]
960 [ "Show error buffer" flymake-show-diagnostics-buffer t ]
961 "--" 961 "--"
962 [ "Turn off Flymake" flymake-mode t ])) 962 [ "Go to log buffer" flymake-switch-to-log-buffer t ]
963 [ "Turn off Flymake" flymake-mode t ]))
963 964
964(defvar flymake--mode-line-format `(:eval (flymake--mode-line-format))) 965(defvar flymake--mode-line-format `(:eval (flymake--mode-line-format)))
965 966
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. */)
2261 (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists) 2261 (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists)
2262{ 2262{
2263 Lisp_Object handler; 2263 Lisp_Object handler;
2264 Lisp_Object encoded_file, encoded_newname, symlink_target; 2264 Lisp_Object encoded_file, encoded_newname;
2265 2265
2266 file = Fexpand_file_name (file, Qnil); 2266 file = Fexpand_file_name (file, Qnil);
2267 2267
@@ -2335,12 +2335,22 @@ This is what happens in interactive use with M-x. */)
2335 if (rename_errno != EXDEV) 2335 if (rename_errno != EXDEV)
2336 report_file_errno ("Renaming", list2 (file, newname), rename_errno); 2336 report_file_errno ("Renaming", list2 (file, newname), rename_errno);
2337 2337
2338 struct stat file_st;
2338 bool dirp = !NILP (Fdirectory_name_p (file)); 2339 bool dirp = !NILP (Fdirectory_name_p (file));
2340 if (!dirp)
2341 {
2342 if (lstat (SSDATA (encoded_file), &file_st) != 0)
2343 report_file_error ("Renaming", list2 (file, newname));
2344 dirp = S_ISDIR (file_st.st_mode) != 0;
2345 }
2339 if (dirp) 2346 if (dirp)
2340 call4 (Qcopy_directory, file, newname, Qt, Qnil); 2347 call4 (Qcopy_directory, file, newname, Qt, Qnil);
2341 else 2348 else
2342 { 2349 {
2343 symlink_target = Ffile_symlink_p (file); 2350 Lisp_Object symlink_target
2351 = (S_ISLNK (file_st.st_mode)
2352 ? emacs_readlinkat (AT_FDCWD, SSDATA (encoded_file))
2353 : Qnil);
2344 if (!NILP (symlink_target)) 2354 if (!NILP (symlink_target))
2345 Fmake_symbolic_link (symlink_target, newname, ok_if_already_exists); 2355 Fmake_symbolic_link (symlink_target, newname, ok_if_already_exists);
2346 else 2356 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. */)
10055 10055
10056 this_command_key_count = 0; 10056 this_command_key_count = 0;
10057 this_single_command_key_start = 0; 10057 this_single_command_key_start = 0;
10058 int key0 = SREF (keys, 0); 10058
10059 int charidx = 0, byteidx = 0;
10060 int key0;
10061 FETCH_STRING_CHAR_ADVANCE (key0, keys, charidx, byteidx);
10062 if (CHAR_BYTE8_P (key0))
10063 key0 = CHAR_TO_BYTE8 (key0);
10059 10064
10060 /* Kludge alert: this makes M-x be in the form expected by 10065 /* Kludge alert: this makes M-x be in the form expected by
10061 novice.el. (248 is \370, a.k.a. "Meta-x".) Any better ideas? */ 10066 novice.el. (248 is \370, a.k.a. "Meta-x".) Any better ideas? */
@@ -10064,7 +10069,13 @@ Internal use only. */)
10064 else 10069 else
10065 add_command_key (make_number (key0)); 10070 add_command_key (make_number (key0));
10066 for (ptrdiff_t i = 1; i < SCHARS (keys); i++) 10071 for (ptrdiff_t i = 1; i < SCHARS (keys); i++)
10067 add_command_key (make_number (SREF (keys, i))); 10072 {
10073 int key_i;
10074 FETCH_STRING_CHAR_ADVANCE (key_i, keys, charidx, byteidx);
10075 if (CHAR_BYTE8_P (key_i))
10076 key_i = CHAR_TO_BYTE8 (key_i);
10077 add_command_key (make_number (key_i));
10078 }
10068 return Qnil; 10079 return Qnil;
10069} 10080}
10070 10081
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)
1476DEFUN ("ns-frame-list-z-order", Fns_frame_list_z_order, 1476DEFUN ("ns-frame-list-z-order", Fns_frame_list_z_order,
1477 Sns_frame_list_z_order, 0, 1, 0, 1477 Sns_frame_list_z_order, 0, 1, 0,
1478 doc: /* Return list of Emacs' frames, in Z (stacking) order. 1478 doc: /* Return list of Emacs' frames, in Z (stacking) order.
1479The optional argument TERMINAL specifies which display to ask about. 1479If TERMINAL is non-nil and specifies a live frame, return the child
1480TERMINAL should be either a frame or a display name (a string). If 1480frames of that frame in Z (stacking) order.
1481omitted or nil, that stands for the selected frame's display. Return
1482nil if TERMINAL contains no Emacs frame.
1483
1484As a special case, if TERMINAL is non-nil and specifies a live frame,
1485return the child frames of that frame in Z (stacking) order.
1486 1481
1487Frames are listed from topmost (first) to bottommost (last). */) 1482Frames are listed from topmost (first) to bottommost (last). */)
1488 (Lisp_Object terminal) 1483 (Lisp_Object terminal)
@@ -1492,8 +1487,6 @@ Frames are listed from topmost (first) to bottommost (last). */)
1492 1487
1493 if (FRAMEP (terminal) && FRAME_LIVE_P (XFRAME (terminal))) 1488 if (FRAMEP (terminal) && FRAME_LIVE_P (XFRAME (terminal)))
1494 parent = [FRAME_NS_VIEW (XFRAME (terminal)) window]; 1489 parent = [FRAME_NS_VIEW (XFRAME (terminal)) window];
1495 else if (!NILP (terminal))
1496 return Qnil;
1497 1490
1498 for (NSWindow *win in [[NSApp orderedWindows] reverseObjectEnumerator]) 1491 for (NSWindow *win in [[NSApp orderedWindows] reverseObjectEnumerator])
1499 { 1492 {