1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-02 10:11:05 -08:00
Commit graph

39526 commits

Author SHA1 Message Date
Paul Eggert
32fd876809 Fix bug with "%%" in error format
* src/doprnt.c (doprnt): Format "%%" correctly.
Problem reported by Philipp Stephani in:
http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00901.html
2017-05-31 16:50:24 -07:00
Paul Eggert
9c748b27c0 * src/editfns.c (Fmessage): Improve doc string (Bug#23425#130). 2017-05-31 16:23:47 -07:00
Eli Zaretskii
140ddc321b Support lower bound on hscrolling when only current line scrolls
* doc/emacs/display.texi (Horizontal Scrolling): Document the new
mode of auto-hscrolling only the current line.

* src/xdisp.c (init_iterator): When hscrolling only the
current line, apply the	window's min_hscroll here, so that
non-current lines will be hscrolled by that minimum.
Suggested by Stephen Berman <stephen.berman@gmx.net>.
(hscroll_window_tree): Account for window's min_hscroll when
deciding whether to recompute the hscroll.
(display_line): Subtract window's min_hscroll from x_incr, as that
was already accounted for in init_iterator.  (Bug#27008)
2017-05-31 19:01:31 +03:00
Eli Zaretskii
7b4a0e2884 Avoid inflooping in redisplay due to Spacemacs and linum-mode
* src/xdisp.c (redisplay_internal): Limit the number of redisplay
retries when a frame becomes garbaged as result of redisplaying
it.  (Bug#27115)
2017-05-31 12:05:06 +03:00
Tino Calancha
a20c799653 * src/editfns.c (decode-time): Fix docstring. 2017-05-31 10:15:20 +09:00
Alan Mackenzie
f8f58fe37e Mode line "%q" construct: Just use one number when both would be the same.
* src/xdisp (decode_mode_spec): recode the "%q" bit appropriately.
2017-05-30 17:42:52 +00:00
Noam Postavsky
75b8492946 Rename '--new-daemon' to 'fg-daemon' and '--old-daemon' to '--bg-daemon'
* doc/emacs/cmdargs.texi (Initial Options):
* doc/lispref/os.texi (Startup Summary):
* etc/NEWS:
* etc/emacs.service:
* src/emacs.c (main):
* src/lisp.h: Rename '--new-daemon' to 'fg-daemon' and '--old-daemon' to
'--bg-daemon'.
2017-05-29 22:18:55 -04:00
Paul Eggert
2a22a65fe1 Improve .gdbinit Lisp value pretty-printing
* src/.gdbinit (to_string): Use an unsigned representation for
Lisp values, as requested by Eli Zaretskii (Bug#27098).
Also, use "make_number(N)" for Lisp integers.
2017-05-29 17:15:38 -07:00
Alan Third
c503188f80 Fix build error on macOS 10.6
* src/nsfns.m (compute_tip_xy): Cast NSRect to CGRect and NSPoint to
CGPoint.
2017-05-29 17:03:30 +01:00
Paul Eggert
d387305062 Depromiscuify inotify with IN_MASK_ADD
Use IN_MASK_ADD instead of using a no-longer-promiscuous-enough
mask.  This simplifies the code and restores the ability to
use IN_ACCESS, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, and IN_OPEN
in some cases (Bug#26973).
* src/inotify.c (INOTIFY_DEFAULT_MASK): Remove.
(Finotify_add_watch): Use IN_MASK_ADD instead.
2017-05-27 11:14:30 -07:00
Paul Eggert
ad656a726f Restore inotify onlydir support
There was no need to remove it in the 2017-03-26 inotify change,
as it is like IN_DONT_FOLLOW and does not affect other watchers
for the same file.
* src/inotify.c (symbol_to_inotifymask, Finotify_add_watch)
(syms_of_inotify): Bring back onlydir.
2017-05-27 11:14:30 -07:00
Paul Eggert
8f59ff2461 Simplify computation of inotify mask
* src/inotify.c (add_watch): Accept uint32_t imask instead
of Lisp_Object aspect.  Caller changed.
(Finotify_add_watch): Use aspect_to_inotifymask earlier, to
simplify the code.
2017-05-27 11:14:30 -07:00
Philipp Stephani
a3a3ea0762 Avoid another compiler warning on macOS
When configured with --without-ns, HAVE_NS is not defined on macOS,
thus 'memory-limit' calls the deprecated sbrk(2) function.  Avoid that
by using the pre-defined __APPLE__ preprocessor macro.

* src/alloc.c (Fmemory_limit): Never use sbrk(2) on macOS.
2017-05-27 15:29:46 +02:00
Martin Rudalics
704fea97e4 Minor doc and doc-string fixes (Bug#27091)
* src/window.c (Fset_window_scroll_bars): Fix doc-string.

* doc/lispref/display.texi (Fringe Size/Pos, Scroll Bars)
(Display Margins): Mention that `set-window-buffer' may override
settings made by `set-window-fringes', `set-window-scroll-bars'
and `set-window-margins'.
* doc/lispref/windows.texi (Buffers and Windows): Fix doc of
`set-window-buffer'.
2017-05-27 15:14:52 +02:00
Eli Zaretskii
3fc36f427a Avoid args-out-of-range errors on fringe clicks after "C-h k"
* src/keyboard.c (echo_truncate): Don't call Ftruncate if the echo
message is already shorter than NCHARS.  (Bug#27040)
2017-05-27 15:57:38 +03:00
Alan Third
0d676deba4 Check if instancetype supported in ObjC
* configure.ac: Add check for instancetype.
* src/nsterm.h [!NATIVE_OBJC_INSTANCETYPE]: Define instancetype.
2017-05-27 00:46:23 +01:00
Paul Eggert
4681fbac90 * src/inotify.c: Add FIXME comments. 2017-05-26 10:53:35 -07:00
Andreas Politz
d02e8ab6d6 Fix Bug#26973
* src/inotify.c (INOTIFY_DEFAULT_MASK): Removing ACCESS, OPEN
and CLOSE events on order do let other processes also reading
from their descriptors.  (Bug#26973).
2017-05-26 16:42:43 +02:00
Alan Third
2ea4b84f5e Fix NS tooltips showing in the wrong place (bug#27053)
* src/nsfns.m (compute_tip_xy): Get current mouse position instead of
last recorded position.
2017-05-25 21:50:49 +01:00
Paul Eggert
d7284da858 Port ATTRIBUTE_MAY_ALIAS to recent icc
* src/conf_post.h (ATTRIBUTE_MAY_ALIAS) [__ICC]:
Define to empty.  Otherwise, icc (ICC) 17.0.4 20170411 says
“warning #2621: attribute "__may_alias__" does not apply here”
for constructs like ‘struct sockaddr *sa = (whatever);
struct sockaddr_in __attribute__ ((__may_alias__)) *sin
= (struct sockaddr_in *) sa;’.
2017-05-25 00:25:09 -07:00
Alan Third
ad8b60ee74 Raise version of macOS we define instancetype for (bug#27059)
* src/nsterm.m: Increase supported version number.
2017-05-24 20:18:52 +01:00
Alan Third
d61d443fc0 Define new types on macOS 10.6 (bug#27041)
* src/nsterm.h: Enable instancetype typedef for older macOS, and use
correct NSUInteger instead of int.
2017-05-24 19:56:23 +01:00
Stefan Monnier
7dfe682ee7 * src/fns.c (sxhash): Fix records hashing (bug#27057, bug#26639)
(sxhash_vector): Make it work on pseudo vectors as well.
(sxhash): Treat records like vectors.
2017-05-24 11:55:13 -04:00
Alan Third
4a485410ce Fix GNUstep build
* src/nsterm.h [NS_IMPL_GNUSTEP]: Add typedefs for Cocoa-only types.
(NSWindowStyleMaskUtilityWindow): #define to NSUtilityWindowMask in
GNUstep and old versions of macOS.
* src/nsfns.m (ns-set-mouse-absolute-pixel-position): Function only
works in cocoa, not GNUstep.
2017-05-23 02:45:13 -07:00
Eli Zaretskii
bf96464e2f Fix current-line hscrolling in buffers with header-line
* src/xdisp.c (display_line): When testing the glyph row's
vertical position against the cursor position, account for header
line, if any.  (Bug#27014)
2017-05-22 21:15:17 +03:00
Philipp Stephani
b69f6a779a Improve module function terminology
Module functions were previously called "function environments" when
the functions created by module_make_functions were lambdas.  Now we
can adapt the terminology and rename "function environments" to
"module functions" everywhere.  This also removes the name clash
between "function environments" and "module environments."

* src/emacs-module.c (module_make_function): Adapt comment to reality;
stop using "function environment" terminology.
(funcall_module): Stop using "function environment" terminology.
2017-05-21 22:33:50 +02:00
Philipp Stephani
6f1f88224c Avoid uninitialized read
* src/nsterm.m (ns_read_socket): Don't read uninitialized variable 'nevents'.
2017-05-21 21:50:36 +02:00
Philipp Stephani
fa389f5b54 Fix call of registerServicesMenuSendTypes
* src/nsterm.m (initFrameFromEmacs:): nil is not allowed for
returnTypes; pass an empty array instead.
2017-05-21 21:50:30 +02:00
Philipp Stephani
6dd94bcc6b Clean up code around 'ns-list-services'
* src/nsfns.m (Fns_list_services): Remove unreachable code.  In this
branch NS_IMPL_COCOA cannot be defined.
(interpret_services_menu): Define only if called to avoid compiler
warnings about unused static functions.
2017-05-21 21:50:25 +02:00
Philipp Stephani
2d8215ae6d Remove unused automatic variables
* nsterm.m (ns_read_socket):
* macfont.m (macfont_open): Remove unused automatic variables.
2017-05-21 21:50:18 +02:00
Philipp Stephani
74d43044d3 Nextstep: Replace deprecated enumerators
* src/nsmenu.m (initWithContentRect:styleMask:backing:defer:): Replace
deprecated enumerator.
2017-05-21 21:50:10 +02:00
Philipp Stephani
762be778fc Nextstep: remove some deprecated method calls
* src/nsterm.m (mouseDown:):
* src/nsmenu.m (runMenuAt:forFrame:keymaps:): Remove call to
deprecated method.  The return value is always nil.
* src/macfont.m (mac_font_shape_1): Replace call to deprecated method.
2017-05-21 21:50:04 +02:00
Philipp Stephani
f04e3d6e20 Remove trailing semicolons in method definitions
These semicolons are ignored and cause compiler warnings.

* src/nsimage.m (setPixelAtX:Y:toRed:green:blue:alpha:):
* src/nsterm.m (init, updateFrameSize:):
(setFrame:): Remove trailing semicolon.
2017-05-21 21:49:58 +02:00
Philipp Stephani
add0b69445 Remove calls to deprecated setUsesScreenFonts
* src/macfont.m (mac_screen_font_get_metrics): Don't call setUsesScreenFonts.
(mac_font_shape_1): Remove screen_font_p parameter.
(mac_screen_font_shape): Remove screen_font_p argument.
2017-05-21 21:49:52 +02:00
Philipp Stephani
cc6db8b6aa Make a function static that isn't used outside this file
* src/kqueue.c (kqueue_directory_listing): Make static.
2017-05-21 21:49:44 +02:00
Philipp Stephani
0446a5a040 Use NSCharacterCollection instead of CTCharacterCollection
This should not cause behavior changes, but fixes a compiler warning
due to implicit conversions between the enums.

* src/macfont.m (macfont_cache, macfont_lookup_cache)
(macfont_get_glyph_for_cid, macfont_get_uvs_table)
(macfont_variation_glyphs): Use NSCharacterCollection.
2017-05-21 21:49:38 +02:00
Philipp Stephani
d79a4ea632 Remove unused function print_regions 2017-05-21 21:49:25 +02:00
Philipp Stephani
cf68bb4aed Declare Nextstep unexec functions in lisp.h
This removes compiler warnings about missing prototypes on macOS.
2017-05-21 21:49:17 +02:00
Philipp Stephani
84b28ec759 Nextstep: Use instancetype explicit return type
This removes compiler warnings on macOS and improves type safety.

* nsterm.m (initFrameFromEmacs:):
(menuDown:):
(toolbarClicked:):
(toggleToolbar:):
(setMiniwindowImage:):
(initFrame🪟):
(condemn, reprieve, setPosition:portion:whole:):
(repeatScroll:):
* nsmenu.m (initWithTitle:):
(initWithTitle:frame:):
(initForView:withIdentifier:):
(init, initWithContentRect:styleMask:backing:defer:):
(initFromContents:isQuestion:):
* nsimage.m (allocInitFromFile:):
(initFromXBM:width:height:fg:bg:):
(setXBMColor:):
(initForXPMWithDepth:width:height:): Use instancetype as return
type instead of implicit id.
2017-05-21 21:49:09 +02:00
Alan Mackenzie
b0b02ca7f3 Enhance mode-line percentage offset facility, with "%o" and "%q"
"%o" will display the percentage "travel" of the window through the buffer.
"%q" will display a combination of the percentage offsets of the top and
bottom of the window.  The new user option mode-line-percent-position will
facilitate selecting a setting for this part of the mode line.

* lisp/bindings.el (mode-line-percent-position): New customizable user option.
(mode-line-position): Use mode-line-percent-position in place of "%p", etc.

* src/xdisp.c (decode_mode_spec): Add handlers for "%o" and "%q".

* doc/lispref/modes.texi (Mode Line Variables): Document
mode-line-percent-position.
(%-Constructs): Document %o and %q.

* etc/NEWS: Add an entry for these new facilities.
2017-05-21 10:16:09 +00:00
Paul Eggert
9759b249e9 Work around macOS bug in create_process, too
* src/process.c (create_process) [DARWIN_OS]:
Reset SIGCHLD after vfork here, too.
2017-05-21 02:00:29 -07:00
Paul Eggert
cb6d669744 Work around macOS bug with vforked child
* src/callproc.c (call_process) [DARWIN_OS]:
Include workaround for apparent macOS bug.
2017-05-21 01:47:31 -07:00
Paul Eggert
97c7a61d90 Pacify --enable-gcc-warnings without modules
* src/print.c (print_vectorlike): New function, taken from
part of print_object.  This one is indented properly, and
pacifies --enable-gcc-warnings by using a default case
instead of listing all the enum values, sometimes
incompletely.
(print_object): Use it.
2017-05-21 01:47:31 -07:00
Paul Eggert
b35293dfd0 Remove DARWIN_OS_CASE_SENSITIVE_FIXME code
It does not appear to be needed (Bug#24441).
* etc/PROBLEMS: Remove DARWIN_OS_CASE_SENSITIVE_FIXME stuff.
* src/fileio.c (file_name_case_insensitive_p):
Remove DARWIN_OS_CASE_SENSITIVE_FIXME code.
2017-05-20 22:56:36 -07:00
Paul Eggert
075bd64609 Narrow DARWIN_OS_CASE_SENSITIVE_FIXME to 1 choice
* etc/PROBLEMS: Document this (Bug#24441).
* src/fileio.c (file_name_case_insensitive_p): Prefer pathconf
with _PC_CASE_SENSITIVE, if it works, to
DARWIN_OS_CASE_SENSITIVE_FIXME code.
Support just one method for DARWIN_OS_CASE_SENSITIVE_FIXME,
which matches the Apple documentation more precisely.
2017-05-20 22:56:36 -07:00
Charles A. Roelli
7e5a8cdceb Fix macOS mouse movement
* lisp/frame.el (ns-set-mouse-absolute-pixel-position): New
function (Lisp).
(set-mouse-absolute-pixel-position): Change it to call
`ns-set-mouse-absolute-pixel-position' on macOS.
* src/nsfns.m (Fns_set_mouse_absolute_pixel_position): New
function.
* src/nsterm.h (NS_PARENT_WINDOW_TOP_POS): Use the primary
screen's height as a base for calculating global coordinates.
* src/nsterm.m (frame_set_mouse_pixel_position): Fix it in macOS.
* test/lisp/mouse-tests.el (bug26816-mouse-frame-movement): Test
movement of mouse relative to frame.
2017-05-21 00:09:41 +01:00
Alan Third
c969b39971 Show tooltip on correct screen (bug#26905)
* src/nsfns.m (compute_tip_xy): Find the correct screen for the
tooltip and constrain it to that screen.
2017-05-21 00:09:41 +01:00
Paul Eggert
848c90e3d4 Minor fixes for arity ranges in emacs modules
* src/emacs-module.c (module_make_function):
Check that arities fit into fixnums, for func-arity’s benefit.
(funcall_module): Avoid unnecessary conversion to EMACS_INT.
(module_function_arity): Allow arities greater than SHRT_MAX.
2017-05-20 13:43:56 -07:00
Philipp Stephani
31fded0370 Reimplement module functions
Instead of a lambda, create a new type containing all data required to
call the function, and support it in the evaluator.  Because this type
now also needs to store the function documentation, it is too big for
Lisp_Misc; use a pseudovector instead.  That also has the nice benefit
that we don't have to add special support to the garbage collector.

Since the new type is user-visible, give it a predicate.

Now we can easily support 'help-function-args' and 'func-arity'; add
unit tests for these.

* src/lisp.h (allocate_module_function, MODULE_FUNCTIONP)
(XMODULE_FUNCTION): New pseudovector type 'module function'.

* src/eval.c (FUNCTIONP): Also treat module functions as functions.
(funcall_lambda, Ffuncall, eval_sub): Add support for calling module
functions.
(Ffunc_arity): Add support for detecting the arity of module
functions.

* src/emacs-module.c (module_make_function): Adapt to new structure.
Return module function object directly instead of wrapping it in a
lambda; remove FIXME.
(funcall_module): New function to call module functions.  Replaces
`internal--module-call' and is called directly from eval.c.
(syms_of_module): Remove internal helper function, which is no longer
needed.
(module_function_arity): New helper function.

* src/data.c (Ftype_of): Adapt to new implementation.
(Fmodule_function_p, syms_of_data): New user-visible function.  Now
that module functions are first-class objects, they deserve a
predicate.  Define it even if not compiled with --enable-modules so
that Lisp code doesn't have to check for the function's existence.

* src/doc.c (Fdocumentation): Support module functions.

* src/print.c (print_object): Adapt to new implementation.

* src/alloc.c (mark_object): Specialized garbage collector support is
no longer needed.

* lisp/help.el (help-function-arglist): Support module functions.
While there, simplify the arity calculation by using `func-arity',
which does the right thing for all kinds of functions.

* test/data/emacs-module/mod-test.c: Amend docstring so we can test
the argument list.

* test/src/emacs-module-tests.el (mod-test-sum-docstring): Adapt to
new docstring.
(mod-test-non-local-exit-signal-test): Because `internal--module-call'
is gone, the backtrace has changed and no longer leaks the
implementation.
(module--func-arity): New test for `func-arity'.
(module--help-function-arglist): New test for `help-function-arglist'.
2017-05-20 15:32:52 +02:00
Eli Zaretskii
6c7bf039e9 Avoid crashes in GC due to unescaped characters warning
* src/lread.c (load_warn_unescaped_character_literals): Don't cons
Lisp objects from stack-based variables.  (Bug#26961)
2017-05-20 14:53:06 +03:00