summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit2
-rw-r--r--src/ChangeLog.12
-rw-r--r--src/ChangeLog.102
-rw-r--r--src/ChangeLog.112
-rw-r--r--src/ChangeLog.122
-rw-r--r--src/ChangeLog.132
-rw-r--r--src/ChangeLog.22
-rw-r--r--src/ChangeLog.32
-rw-r--r--src/ChangeLog.42
-rw-r--r--src/ChangeLog.52
-rw-r--r--src/ChangeLog.62
-rw-r--r--src/ChangeLog.72
-rw-r--r--src/ChangeLog.82
-rw-r--r--src/ChangeLog.92
-rw-r--r--src/Makefile.in4
-rw-r--r--src/README2
-rw-r--r--src/alloc.c2
-rw-r--r--src/atimer.c2
-rw-r--r--src/atimer.h2
-rw-r--r--src/bidi.c2
-rw-r--r--src/bignum.c2
-rw-r--r--src/bignum.h2
-rw-r--r--src/blockinput.h2
-rw-r--r--src/buffer.c2
-rw-r--r--src/buffer.h2
-rw-r--r--src/bytecode.c2
-rw-r--r--src/callint.c2
-rw-r--r--src/callproc.c7
-rw-r--r--src/casefiddle.c2
-rw-r--r--src/casetab.c2
-rw-r--r--src/category.c2
-rw-r--r--src/ccl.c4
-rw-r--r--src/character.c2
-rw-r--r--src/charset.c2
-rw-r--r--src/charset.h2
-rw-r--r--src/cm.c2
-rw-r--r--src/cm.h2
-rw-r--r--src/cmds.c2
-rw-r--r--src/coding.c2
-rw-r--r--src/coding.h2
-rw-r--r--src/commands.h2
-rw-r--r--src/composite.c2
-rw-r--r--src/composite.h2
-rw-r--r--src/conf_post.h2
-rw-r--r--src/cygw32.c2
-rw-r--r--src/cygw32.h2
-rw-r--r--src/data.c2
-rw-r--r--src/dbusbind.c45
-rw-r--r--src/decompress.c2
-rw-r--r--src/deps.mk2
-rw-r--r--src/dired.c2
-rw-r--r--src/dispextern.h2
-rw-r--r--src/dispnew.c2
-rw-r--r--src/disptab.h2
-rw-r--r--src/dmpstruct.awk2
-rw-r--r--src/doc.c40
-rw-r--r--src/doprnt.c2
-rw-r--r--src/dosfns.c2
-rw-r--r--src/dosfns.h2
-rw-r--r--src/dynlib.c2
-rw-r--r--src/dynlib.h2
-rw-r--r--src/editfns.c2
-rw-r--r--src/emacs-icon.h2
-rw-r--r--src/emacs-module.c2
-rw-r--r--src/emacs-module.h.in2
-rw-r--r--src/emacs.c2
-rw-r--r--src/emacsgtkfixed.c2
-rw-r--r--src/emacsgtkfixed.h2
-rw-r--r--src/epaths.in2
-rw-r--r--src/eval.c2
-rw-r--r--src/fileio.c2
-rw-r--r--src/filelock.c2
-rw-r--r--src/firstfile.c2
-rw-r--r--src/floatfns.c2
-rw-r--r--src/fns.c2
-rw-r--r--src/font.c2
-rw-r--r--src/font.h2
-rw-r--r--src/fontset.c2
-rw-r--r--src/fontset.h2
-rw-r--r--src/frame.c2
-rw-r--r--src/frame.h2
-rw-r--r--src/fringe.c2
-rw-r--r--src/ftcrfont.c2
-rw-r--r--src/ftfont.c2
-rw-r--r--src/getpagesize.h2
-rw-r--r--src/gfilenotify.c2
-rw-r--r--src/gmalloc.c2
-rw-r--r--src/gnutls.c2
-rw-r--r--src/gnutls.h2
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/gtkutil.h2
-rw-r--r--src/hbfont.c2
-rw-r--r--src/image.c2
-rw-r--r--src/indent.c2
-rw-r--r--src/indent.h2
-rw-r--r--src/inotify.c2
-rw-r--r--src/insdel.c2
-rw-r--r--src/intervals.c2
-rw-r--r--src/intervals.h2
-rw-r--r--src/json.c2
-rw-r--r--src/keyboard.c5
-rw-r--r--src/keyboard.h2
-rw-r--r--src/keymap.c210
-rw-r--r--src/keymap.h2
-rw-r--r--src/kqueue.c2
-rw-r--r--src/lastfile.c2
-rw-r--r--src/lcms.c2
-rw-r--r--src/lisp.h2
-rw-r--r--src/lread.c2
-rw-r--r--src/macfont.h2
-rw-r--r--src/macfont.m2
-rw-r--r--src/macros.c2
-rw-r--r--src/macros.h2
-rw-r--r--src/marker.c2
-rw-r--r--src/menu.c2
-rw-r--r--src/menu.h2
-rw-r--r--src/minibuf.c2
-rw-r--r--src/msdos.c2
-rw-r--r--src/msdos.h2
-rw-r--r--src/nsfns.m2
-rw-r--r--src/nsfont.m2
-rw-r--r--src/nsgui.h2
-rw-r--r--src/nsimage.m2
-rw-r--r--src/nsmenu.m641
-rw-r--r--src/nsselect.m2
-rw-r--r--src/nsterm.h46
-rw-r--r--src/nsterm.m461
-rw-r--r--src/nsxwidget.h2
-rw-r--r--src/nsxwidget.m2
-rw-r--r--src/pdumper.c2
-rw-r--r--src/pdumper.h2
-rw-r--r--src/print.c2
-rw-r--r--src/process.c84
-rw-r--r--src/process.h2
-rw-r--r--src/profiler.c2
-rw-r--r--src/puresize.h2
-rw-r--r--src/ralloc.c2
-rw-r--r--src/regex-emacs.c2
-rw-r--r--src/regex-emacs.h2
-rw-r--r--src/region-cache.c2
-rw-r--r--src/region-cache.h2
-rw-r--r--src/scroll.c2
-rw-r--r--src/search.c2
-rw-r--r--src/sheap.c2
-rw-r--r--src/sheap.h2
-rw-r--r--src/sound.c2
-rw-r--r--src/syntax.c2
-rw-r--r--src/syntax.h2
-rw-r--r--src/sysdep.c2
-rw-r--r--src/sysselect.h2
-rw-r--r--src/syssignal.h2
-rw-r--r--src/sysstdio.h2
-rw-r--r--src/systhread.c2
-rw-r--r--src/systhread.h2
-rw-r--r--src/systime.h2
-rw-r--r--src/systty.h2
-rw-r--r--src/syswait.h2
-rw-r--r--src/term.c2
-rw-r--r--src/termcap.c2
-rw-r--r--src/termchar.h2
-rw-r--r--src/termhooks.h2
-rw-r--r--src/terminal.c2
-rw-r--r--src/terminfo.c2
-rw-r--r--src/termopts.h2
-rw-r--r--src/textprop.c2
-rw-r--r--src/thread.c2
-rw-r--r--src/thread.h2
-rw-r--r--src/timefns.c2
-rw-r--r--src/tparam.c2
-rw-r--r--src/tparam.h2
-rw-r--r--src/undo.c2
-rw-r--r--src/unexaix.c2
-rw-r--r--src/unexcoff.c2
-rw-r--r--src/unexcw.c2
-rw-r--r--src/unexelf.c2
-rw-r--r--src/unexmacosx.c2
-rw-r--r--src/unexw32.c2
-rw-r--r--src/vm-limit.c2
-rw-r--r--src/w16select.c2
-rw-r--r--src/w32.c7
-rw-r--r--src/w32.h2
-rw-r--r--src/w32common.h2
-rw-r--r--src/w32console.c2
-rw-r--r--src/w32cygwinx.c2
-rw-r--r--src/w32fns.c2
-rw-r--r--src/w32font.c2
-rw-r--r--src/w32font.h2
-rw-r--r--src/w32gui.h2
-rw-r--r--src/w32heap.c2
-rw-r--r--src/w32heap.h2
-rw-r--r--src/w32image.c2
-rw-r--r--src/w32inevt.c2
-rw-r--r--src/w32inevt.h2
-rw-r--r--src/w32menu.c2
-rw-r--r--src/w32notify.c2
-rw-r--r--src/w32proc.c2
-rw-r--r--src/w32reg.c2
-rw-r--r--src/w32select.c2
-rw-r--r--src/w32select.h2
-rw-r--r--src/w32term.c2
-rw-r--r--src/w32term.h2
-rw-r--r--src/w32uniscribe.c2
-rw-r--r--src/w32xfns.c2
-rw-r--r--src/widget.c2
-rw-r--r--src/widget.h2
-rw-r--r--src/widgetprv.h2
-rw-r--r--src/window.c2
-rw-r--r--src/window.h2
-rw-r--r--src/xdisp.c68
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c31
-rw-r--r--src/xfont.c2
-rw-r--r--src/xftfont.c2
-rw-r--r--src/xgselect.c2
-rw-r--r--src/xgselect.h2
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xml.c2
-rw-r--r--src/xrdb.c2
-rw-r--r--src/xselect.c2
-rw-r--r--src/xsettings.c2
-rw-r--r--src/xsettings.h2
-rw-r--r--src/xsmfns.c2
-rw-r--r--src/xterm.c11
-rw-r--r--src/xterm.h2
-rw-r--r--src/xwidget.c2
-rw-r--r--src/xwidget.h2
226 files changed, 1080 insertions, 1006 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 78536fc01fb..f74e295f7ea 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-1998, 2000-2020 Free Software Foundation, Inc.
+# Copyright (C) 1992-1998, 2000-2021 Free Software Foundation, Inc.
#
# This file is part of GNU Emacs.
#
diff --git a/src/ChangeLog.1 b/src/ChangeLog.1
index 4ca7f90e7f7..3429aa4947b 100644
--- a/src/ChangeLog.1
+++ b/src/ChangeLog.1
@@ -3521,7 +3521,7 @@
* minibuf.c: Don't allow entry to minibuffer
while minibuffer is selected.
- Copyright (C) 1985-1986, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10
index fbbd3608909..bba161d3428 100644
--- a/src/ChangeLog.10
+++ b/src/ChangeLog.10
@@ -27912,7 +27912,7 @@ See ChangeLog.9 for earlier changes.
;; add-log-time-zone-rule: t
;; End:
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index cf9e87a6a80..41c35babda0 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -31385,7 +31385,7 @@ See ChangeLog.10 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 2007-2020 Free Software Foundation, Inc.
+ Copyright (C) 2007-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.12 b/src/ChangeLog.12
index 04983fe03e6..77540ee5b11 100644
--- a/src/ChangeLog.12
+++ b/src/ChangeLog.12
@@ -22936,7 +22936,7 @@ See ChangeLog.11 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.13 b/src/ChangeLog.13
index 87055d70315..3fb23ceff3d 100644
--- a/src/ChangeLog.13
+++ b/src/ChangeLog.13
@@ -17905,7 +17905,7 @@ See ChangeLog.12 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.2 b/src/ChangeLog.2
index a499350253e..44c575c564e 100644
--- a/src/ChangeLog.2
+++ b/src/ChangeLog.2
@@ -4771,7 +4771,7 @@
See ChangeLog.1 for earlier changes.
- Copyright (C) 1986-1988, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1986-1988, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index 4e403058837..1cae9bfc655 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -16503,7 +16503,7 @@ See ChangeLog.2 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 1993, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.4 b/src/ChangeLog.4
index cc8d22ceeb1..f34e4cb0f5e 100644
--- a/src/ChangeLog.4
+++ b/src/ChangeLog.4
@@ -6906,7 +6906,7 @@ See ChangeLog.3 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 1993-1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.5 b/src/ChangeLog.5
index 56bfb9f9eff..af0f6b9c388 100644
--- a/src/ChangeLog.5
+++ b/src/ChangeLog.5
@@ -7148,7 +7148,7 @@ See ChangeLog.4 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 1994-1995, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.6 b/src/ChangeLog.6
index 391d5fb8a52..709148569ed 100644
--- a/src/ChangeLog.6
+++ b/src/ChangeLog.6
@@ -5358,7 +5358,7 @@ See ChangeLog.5 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 1995-1996, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.7 b/src/ChangeLog.7
index bb3e1997ec7..7e9a085e505 100644
--- a/src/ChangeLog.7
+++ b/src/ChangeLog.7
@@ -11091,7 +11091,7 @@ See ChangeLog.6 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 1997-1998, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.8 b/src/ChangeLog.8
index c7b99a443d5..8587a14f2ce 100644
--- a/src/ChangeLog.8
+++ b/src/ChangeLog.8
@@ -13979,7 +13979,7 @@
See ChangeLog.7 for earlier changes.
- Copyright (C) 1999, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ChangeLog.9 b/src/ChangeLog.9
index 0c1f72a6787..25a17e74fe7 100644
--- a/src/ChangeLog.9
+++ b/src/ChangeLog.9
@@ -13294,7 +13294,7 @@ See ChangeLog.8 for earlier changes.
;; coding: utf-8
;; End:
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/Makefile.in b/src/Makefile.in
index c2641740bcc..9e105c157b9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,6 +1,6 @@
### @configure_input@
-# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2020 Free Software
+# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2021 Free Software
# Foundation, Inc.
# This file is part of GNU Emacs.
@@ -343,7 +343,7 @@ HAVE_PDUMPER = @HAVE_PDUMPER@
## ARM Macs require that all code have a valid signature. Since pump
## invalidates the signature, we must re-sign to fix it.
-DO_CODESIGN=$(patsubst arm-apple-darwin%,yes,@configuration@)
+DO_CODESIGN=$(patsubst aarch64-apple-darwin%,yes,@configuration@)
# 'make' verbosity.
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
diff --git a/src/README b/src/README
index fbebf6b95f5..1f42449eddc 100644
--- a/src/README
+++ b/src/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 2001-2021 Free Software Foundation, Inc.
See the end of the file for license conditions.
diff --git a/src/alloc.c b/src/alloc.c
index bdf721e5270..350fec25a02 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1,6 +1,6 @@
/* Storage allocation and gc for GNU Emacs Lisp interpreter.
-Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2020 Free Software
+Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/atimer.c b/src/atimer.c
index a7daf9dcf5b..9b198675ab4 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -1,5 +1,5 @@
/* Asynchronous timers.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/atimer.h b/src/atimer.h
index 660d77c9392..e3e283a75c0 100644
--- a/src/atimer.h
+++ b/src/atimer.h
@@ -1,5 +1,5 @@
/* Asynchronous timers.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/bidi.c b/src/bidi.c
index ef062addd16..1413ba6b888 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1,6 +1,6 @@
/* Low-level bidirectional buffer/string-scanning functions for GNU Emacs.
-Copyright (C) 2000-2001, 2004-2005, 2009-2020 Free Software Foundation,
+Copyright (C) 2000-2001, 2004-2005, 2009-2021 Free Software Foundation,
Inc.
Author: Eli Zaretskii <eliz@gnu.org>
diff --git a/src/bignum.c b/src/bignum.c
index dce5908a1e4..1ac75c19e24 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -1,6 +1,6 @@
/* Big numbers for Emacs.
-Copyright 2018-2020 Free Software Foundation, Inc.
+Copyright 2018-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/bignum.h b/src/bignum.h
index 251a19e338a..33a540e9093 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -1,6 +1,6 @@
/* Big numbers for Emacs.
-Copyright 2018-2020 Free Software Foundation, Inc.
+Copyright 2018-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/blockinput.h b/src/blockinput.h
index f94e62dd461..8e4657b27c7 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -1,5 +1,5 @@
/* blockinput.h - interface to blocking complicated interrupt-driven input.
- Copyright (C) 1989, 1993, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1993, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/buffer.c b/src/buffer.c
index 9e44345616e..81f7d922fdb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,6 +1,6 @@
/* Buffer manipulation primitives for GNU Emacs.
-Copyright (C) 1985-1989, 1993-1995, 1997-2020 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1995, 1997-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/buffer.h b/src/buffer.h
index b8c5162be4a..790291f1185 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1,6 +1,6 @@
/* Header file for the buffer manipulation primitives.
-Copyright (C) 1985-1986, 1993-1995, 1997-2020 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1995, 1997-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/bytecode.c b/src/bytecode.c
index 1c3b6eac0d1..4fd41acab85 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1,5 +1,5 @@
/* Execution of byte code produced by bytecomp.el.
- Copyright (C) 1985-1988, 1993, 2000-2020 Free Software Foundation,
+ Copyright (C) 1985-1988, 1993, 2000-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/callint.c b/src/callint.c
index d172af9e30b..d3f49bc35d1 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -1,5 +1,5 @@
/* Call a Lisp function interactively.
- Copyright (C) 1985-1986, 1993-1995, 1997, 2000-2020 Free Software
+ Copyright (C) 1985-1986, 1993-1995, 1997, 2000-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/callproc.c b/src/callproc.c
index 3ecd6880274..8d2a5619eb8 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1,6 +1,6 @@
/* Synchronous subprocess invocation for GNU Emacs.
-Copyright (C) 1985-1988, 1993-1995, 1999-2020 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1999-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
@@ -30,6 +30,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "lisp.h"
+#ifdef SETUP_SLAVE_PTY
+# include <sys/stream.h>
+# include <sys/stropts.h>
+#endif
+
#ifdef WINDOWSNT
#include <sys/socket.h> /* for fcntl */
#include <windows.h>
diff --git a/src/casefiddle.c b/src/casefiddle.c
index debd2412238..a948bb3bc88 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -1,7 +1,7 @@
/* -*- coding: utf-8 -*- */
/* GNU Emacs case conversion functions.
-Copyright (C) 1985, 1994, 1997-1999, 2001-2020 Free Software Foundation,
+Copyright (C) 1985, 1994, 1997-1999, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/casetab.c b/src/casetab.c
index 07cda36d95d..4699857cb8a 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -1,5 +1,5 @@
/* GNU Emacs routines to deal with case tables.
- Copyright (C) 1993-1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
Author: Howard Gayle
diff --git a/src/category.c b/src/category.c
index c80571ecd4f..ec8f61f7f00 100644
--- a/src/category.c
+++ b/src/category.c
@@ -1,6 +1,6 @@
/* GNU Emacs routines to deal with category tables.
-Copyright (C) 1998, 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/ccl.c b/src/ccl.c
index 796698eb1ce..7c033afc882 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1,5 +1,5 @@
/* CCL (Code Conversion Language) interpreter.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
@@ -1151,7 +1151,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
if (!INT_DIVIDE_OVERFLOW (reg[rrr], i))
reg[rrr] /= i;
break;
- case CCL_MOD: reg[rrr] %= i; break;
+ case CCL_MOD:
if (!i)
CCL_INVALID_CMD;
reg[rrr] = i == -1 ? 0 : reg[rrr] % i;
diff --git a/src/character.c b/src/character.c
index 00b73293a3f..a599a0355f4 100644
--- a/src/character.c
+++ b/src/character.c
@@ -1,6 +1,6 @@
/* Basic character support.
-Copyright (C) 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1997, 1998, 2001 Electrotechnical Laboratory, JAPAN.
Licensed to the Free Software Foundation.
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
diff --git a/src/charset.c b/src/charset.c
index f6b5173fad4..eb388d1868b 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1,6 +1,6 @@
/* Basic character set support.
-Copyright (C) 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
diff --git a/src/charset.h b/src/charset.h
index 62b28e6c8f0..97122d82a65 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -1,5 +1,5 @@
/* Header for charset handler.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/cm.c b/src/cm.c
index dc5a5a34eb7..fe81ca869e0 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -1,5 +1,5 @@
/* Cursor motion subroutines for GNU Emacs.
- Copyright (C) 1985, 1995, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1995, 2001-2021 Free Software Foundation, Inc.
based primarily on public domain code written by Chris Torek
This file is part of GNU Emacs.
diff --git a/src/cm.h b/src/cm.h
index 11d0b2b4b33..9bea33299ce 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -1,5 +1,5 @@
/* Cursor motion calculation definitions for GNU Emacs
- Copyright (C) 1985, 1989, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1989, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/cmds.c b/src/cmds.c
index c29cf00dad1..798fd68a920 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -1,6 +1,6 @@
/* Simple built-in editing commands.
-Copyright (C) 1985, 1993-1998, 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1998, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/coding.c b/src/coding.c
index 8c2443889d4..739dd6adcb5 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1,5 +1,5 @@
/* Coding system handler (conversion, detection, etc).
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/coding.h b/src/coding.h
index 9ad1e954f8d..d06bed3f5d9 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -1,5 +1,5 @@
/* Header for coding system handler.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/commands.h b/src/commands.h
index 81e9b7e4da9..a09858d050d 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -1,5 +1,5 @@
/* Definitions needed by most editing commands.
- Copyright (C) 1985, 1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/composite.c b/src/composite.c
index 66c1e86aae1..f1c011223b2 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1,5 +1,5 @@
/* Composite sequence support.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H14PRO021
diff --git a/src/composite.h b/src/composite.h
index bdf63fed10e..c5d3c0faabb 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -1,5 +1,5 @@
/* Header for composite sequence handler.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H14PRO021
diff --git a/src/conf_post.h b/src/conf_post.h
index 1ef4ff33428..bd56f29e287 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -1,6 +1,6 @@
/* conf_post.h --- configure.ac includes this via AH_BOTTOM
-Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2020 Free Software
+Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/cygw32.c b/src/cygw32.c
index d402669ec14..b11d94d3a62 100644
--- a/src/cygw32.c
+++ b/src/cygw32.c
@@ -1,5 +1,5 @@
/* Cygwin support routines.
- Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/cygw32.h b/src/cygw32.h
index 647211b3209..19cb77539bb 100644
--- a/src/cygw32.h
+++ b/src/cygw32.h
@@ -1,5 +1,5 @@
/* Header for Cygwin support routines.
- Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/data.c b/src/data.c
index c5476495bd6..3cf5bbbdd56 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1,5 +1,5 @@
/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
- Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2020 Free Software
+ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/dbusbind.c b/src/dbusbind.c
index dc4db5c8513..c005474d440 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1,5 +1,5 @@
/* Elisp bindings for D-Bus.
- Copyright (C) 2007-2020 Free Software Foundation, Inc.
+ Copyright (C) 2007-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -132,23 +132,36 @@ static bool xd_in_read_queued_messages = 0;
#define XD_BASIC_DBUS_TYPE(type) \
(dbus_type_is_valid (type) && dbus_type_is_basic (type))
#else
-#define XD_BASIC_DBUS_TYPE(type) \
- ((type == DBUS_TYPE_BYTE) \
- || (type == DBUS_TYPE_BOOLEAN) \
- || (type == DBUS_TYPE_INT16) \
- || (type == DBUS_TYPE_UINT16) \
- || (type == DBUS_TYPE_INT32) \
- || (type == DBUS_TYPE_UINT32) \
- || (type == DBUS_TYPE_INT64) \
- || (type == DBUS_TYPE_UINT64) \
- || (type == DBUS_TYPE_DOUBLE) \
- || (type == DBUS_TYPE_STRING) \
- || (type == DBUS_TYPE_OBJECT_PATH) \
- || (type == DBUS_TYPE_SIGNATURE) \
#ifdef DBUS_TYPE_UNIX_FD
- || (type == DBUS_TYPE_UNIX_FD) \
+#define XD_BASIC_DBUS_TYPE(type) \
+ ((type == DBUS_TYPE_BYTE) \
+ || (type == DBUS_TYPE_BOOLEAN) \
+ || (type == DBUS_TYPE_INT16) \
+ || (type == DBUS_TYPE_UINT16) \
+ || (type == DBUS_TYPE_INT32) \
+ || (type == DBUS_TYPE_UINT32) \
+ || (type == DBUS_TYPE_INT64) \
+ || (type == DBUS_TYPE_UINT64) \
+ || (type == DBUS_TYPE_DOUBLE) \
+ || (type == DBUS_TYPE_STRING) \
+ || (type == DBUS_TYPE_OBJECT_PATH) \
+ || (type == DBUS_TYPE_SIGNATURE) \
+ || (type == DBUS_TYPE_UNIX_FD))
+#else
+#define XD_BASIC_DBUS_TYPE(type) \
+ ((type == DBUS_TYPE_BYTE) \
+ || (type == DBUS_TYPE_BOOLEAN) \
+ || (type == DBUS_TYPE_INT16) \
+ || (type == DBUS_TYPE_UINT16) \
+ || (type == DBUS_TYPE_INT32) \
+ || (type == DBUS_TYPE_UINT32) \
+ || (type == DBUS_TYPE_INT64) \
+ || (type == DBUS_TYPE_UINT64) \
+ || (type == DBUS_TYPE_DOUBLE) \
+ || (type == DBUS_TYPE_STRING) \
+ || (type == DBUS_TYPE_OBJECT_PATH) \
+ || (type == DBUS_TYPE_SIGNATURE))
#endif
- )
#endif
/* This was a macro. On Solaris 2.11 it was said to compile for
diff --git a/src/decompress.c b/src/decompress.c
index afd43e13ac6..17224f61234 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -1,5 +1,5 @@
/* Interface to zlib.
- Copyright (C) 2013-2020 Free Software Foundation, Inc.
+ Copyright (C) 2013-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/deps.mk b/src/deps.mk
index 4d162eeb0f2..eda2ed63382 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -1,6 +1,6 @@
### deps.mk --- src/Makefile fragment for GNU Emacs
-## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2020 Free Software
+## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2021 Free Software
## Foundation, Inc.
## This file is part of GNU Emacs.
diff --git a/src/dired.c b/src/dired.c
index feb5f05cb18..ebcf77bc263 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -1,5 +1,5 @@
/* Lisp functions for making directory listings.
- Copyright (C) 1985-1986, 1993-1994, 1999-2020 Free Software
+ Copyright (C) 1985-1986, 1993-1994, 1999-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/dispextern.h b/src/dispextern.h
index c76822ff390..3ad98b8344e 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1,6 +1,6 @@
/* Interface definitions for display code.
-Copyright (C) 1985, 1993-1994, 1997-2020 Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1994, 1997-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/dispnew.c b/src/dispnew.c
index e0a64761904..36a6dd8a091 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1,6 +1,6 @@
/* Updating of data structures for redisplay.
-Copyright (C) 1985-1988, 1993-1995, 1997-2020 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1997-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/disptab.h b/src/disptab.h
index d5453474d95..adf411b805d 100644
--- a/src/disptab.h
+++ b/src/disptab.h
@@ -1,5 +1,5 @@
/* Things for GLYPHS and glyph tables.
- Copyright (C) 1993, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/dmpstruct.awk b/src/dmpstruct.awk
index a25bcf6f404..c7b93da3bcb 100644
--- a/src/dmpstruct.awk
+++ b/src/dmpstruct.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2020 Free Software Foundation, Inc.
+# Copyright (C) 2018-2021 Free Software Foundation, Inc.
#
# This file is part of GNU Emacs.
#
diff --git a/src/doc.c b/src/doc.c
index de904b42e2a..01f4368e3b6 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -1,6 +1,6 @@
/* Record indices of function doc strings stored in a file. -*- coding: utf-8 -*-
-Copyright (C) 1985-1986, 1993-1995, 1997-2020 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1995, 1997-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
@@ -82,10 +82,7 @@ Lisp_Object
get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
{
char *from, *to, *name, *p, *p1;
- int fd;
- int offset;
- EMACS_INT position;
- Lisp_Object file, tem, pos;
+ Lisp_Object file, pos;
ptrdiff_t count = SPECPDL_INDEX ();
USE_SAFE_ALLOCA;
@@ -102,7 +99,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
else
return Qnil;
- position = eabs (XFIXNUM (pos));
+ EMACS_INT position = eabs (XFIXNUM (pos));
if (!STRINGP (Vdoc_directory))
return Qnil;
@@ -113,7 +110,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
/* Put the file name in NAME as a C string.
If it is relative, combine it with Vdoc_directory. */
- tem = Ffile_name_absolute_p (file);
+ Lisp_Object tem = Ffile_name_absolute_p (file);
file = ENCODE_FILE (file);
Lisp_Object docdir
= NILP (tem) ? ENCODE_FILE (Vdoc_directory) : empty_unibyte_string;
@@ -123,7 +120,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
name = SAFE_ALLOCA (docdir_sizemax + SBYTES (file));
lispstpcpy (lispstpcpy (name, docdir), file);
- fd = emacs_open (name, O_RDONLY, 0);
+ int fd = emacs_open (name, O_RDONLY, 0);
if (fd < 0)
{
if (will_dump_p ())
@@ -150,7 +147,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
/* Seek only to beginning of disk block. */
/* Make sure we read at least 1024 bytes before `position'
so we can check the leading text for consistency. */
- offset = min (position, max (1024, position % (8 * 1024)));
+ int offset = min (position, max (1024, position % (8 * 1024)));
if (TYPE_MAXIMUM (off_t) < position
|| lseek (fd, position - offset, 0) < 0)
error ("Position %"pI"d out of range in doc string file \"%s\"",
@@ -164,7 +161,6 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
{
ptrdiff_t space_left = (get_doc_string_buffer_size - 1
- (p - get_doc_string_buffer));
- int nread;
/* Allocate or grow the buffer if we need to. */
if (space_left <= 0)
@@ -182,7 +178,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
If we read the same block last time, maybe skip this? */
if (space_left > 1024 * 8)
space_left = 1024 * 8;
- nread = emacs_read_quit (fd, p, space_left);
+ int nread = emacs_read_quit (fd, p, space_left);
if (nread < 0)
report_file_error ("Read error on documentation file", file);
p[nread] = 0;
@@ -240,10 +236,8 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
{
if (*from == 1)
{
- int c;
-
from++;
- c = *from++;
+ int c = *from++;
if (c == 1)
*to++ = c;
else if (c == '0')
@@ -313,10 +307,8 @@ Unless a non-nil second argument RAW is given, the
string is passed through `substitute-command-keys'. */)
(Lisp_Object function, Lisp_Object raw)
{
- Lisp_Object fun;
- Lisp_Object funcar;
Lisp_Object doc;
- bool try_reload = 1;
+ bool try_reload = true;
documentation:
@@ -330,7 +322,7 @@ string is passed through `substitute-command-keys'. */)
raw);
}
- fun = Findirect_function (function, Qnil);
+ Lisp_Object fun = Findirect_function (function, Qnil);
if (NILP (fun))
xsignal1 (Qvoid_function, function);
if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
@@ -367,7 +359,7 @@ string is passed through `substitute-command-keys'. */)
}
else if (CONSP (fun))
{
- funcar = XCAR (fun);
+ Lisp_Object funcar = XCAR (fun);
if (!SYMBOLP (funcar))
xsignal1 (Qinvalid_function, fun);
else if (EQ (funcar, Qkeymap))
@@ -411,7 +403,7 @@ string is passed through `substitute-command-keys'. */)
try_reload = reread_doc_file (Fcar_safe (doc));
if (try_reload)
{
- try_reload = 0;
+ try_reload = false;
goto documentation;
}
}
@@ -435,7 +427,7 @@ This differs from `get' in that it can refer to strings stored in the
aren't strings. */)
(Lisp_Object symbol, Lisp_Object prop, Lisp_Object raw)
{
- bool try_reload = 1;
+ bool try_reload = true;
Lisp_Object tem;
documentation_property:
@@ -467,7 +459,7 @@ aren't strings. */)
try_reload = reread_doc_file (Fcar_safe (doc));
if (try_reload)
{
- try_reload = 0;
+ try_reload = false;
goto documentation_property;
}
}
@@ -497,9 +489,7 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset)
fun = XCDR (fun);
if (CONSP (fun))
{
- Lisp_Object tem;
-
- tem = XCAR (fun);
+ Lisp_Object tem = XCAR (fun);
if (EQ (tem, Qlambda) || EQ (tem, Qautoload)
|| (EQ (tem, Qclosure) && (fun = XCDR (fun), 1)))
{
diff --git a/src/doprnt.c b/src/doprnt.c
index 7b742ad255a..b6b5978c891 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -1,7 +1,7 @@
/* Output like sprintf to a buffer of specified size. -*- coding: utf-8 -*-
Also takes args differently: pass one pointer to the end
of the format string in addition to the format string itself.
- Copyright (C) 1985, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/dosfns.c b/src/dosfns.c
index 7a6605dece6..10023c8c7f1 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -1,6 +1,6 @@
/* MS-DOS specific Lisp utilities. Coded by Manabu Higashida, 1991.
Major changes May-July 1993 Morten Welinder (only 10% original code left)
- Copyright (C) 1991, 1993, 1996-1998, 2001-2020 Free Software
+ Copyright (C) 1991, 1993, 1996-1998, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/dosfns.h b/src/dosfns.h
index bae199b6f6c..6ad2a034707 100644
--- a/src/dosfns.h
+++ b/src/dosfns.h
@@ -2,7 +2,7 @@
Coded by Manabu Higashida, 1991.
Modified by Morten Welinder, 1993-1994.
-Copyright (C) 1991, 1994-1995, 1997, 1999, 2001-2020 Free Software
+Copyright (C) 1991, 1994-1995, 1997, 1999, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/dynlib.c b/src/dynlib.c
index b3fd815e68c..1338e9109c9 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -1,6 +1,6 @@
/* Portable API for dynamic loading.
-Copyright 2015-2020 Free Software Foundation, Inc.
+Copyright 2015-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/dynlib.h b/src/dynlib.h
index cb3454b5563..e20d8891a23 100644
--- a/src/dynlib.h
+++ b/src/dynlib.h
@@ -1,6 +1,6 @@
/* Portable API for dynamic loading.
-Copyright 2015-2020 Free Software Foundation, Inc.
+Copyright 2015-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/editfns.c b/src/editfns.c
index e4c4141ef5e..6f04c998915 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1,6 +1,6 @@
/* Lisp functions pertaining to editing. -*- coding: utf-8 -*-
-Copyright (C) 1985-1987, 1989, 1993-2020 Free Software Foundation, Inc.
+Copyright (C) 1985-1987, 1989, 1993-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/emacs-icon.h b/src/emacs-icon.h
index c3fd7f3ce28..87790bbc29e 100644
--- a/src/emacs-icon.h
+++ b/src/emacs-icon.h
@@ -1,7 +1,7 @@
/* XPM */
/* Emacs icon
-Copyright (C) 2008-2020 Free Software Foundation, Inc.
+Copyright (C) 2008-2021 Free Software Foundation, Inc.
Author: Kentaro Ohkouchi <nanasess@fsm.ne.jp>
Nicolas Petton <nicolas@petton.fr>
diff --git a/src/emacs-module.c b/src/emacs-module.c
index b7cd835c83c..894dffcf21e 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -1,6 +1,6 @@
/* emacs-module.c - Module loading and runtime implementation
-Copyright (C) 2015-2020 Free Software Foundation, Inc.
+Copyright (C) 2015-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index 6a39d507c84..2989b439109 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -1,6 +1,6 @@
/* emacs-module.h - GNU Emacs module API.
-Copyright (C) 2015-2020 Free Software Foundation, Inc.
+Copyright (C) 2015-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/emacs.c b/src/emacs.c
index 4b3f4c7305a..5d9317ada17 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,6 +1,6 @@
/* Fully extensible Emacs, running on Unix, intended for GNU.
-Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2020 Free Software
+Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index ea9465d5536..996ded2acaa 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -1,7 +1,7 @@
/* A Gtk Widget that inherits GtkFixed, but can be shrunk.
This file is only use when compiling with Gtk+ 3.
-Copyright (C) 2011-2020 Free Software Foundation, Inc.
+Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/emacsgtkfixed.h b/src/emacsgtkfixed.h
index b230a4d4d8a..78879764d86 100644
--- a/src/emacsgtkfixed.h
+++ b/src/emacsgtkfixed.h
@@ -1,7 +1,7 @@
/* A Gtk Widget that inherits GtkFixed, but can be shrunk.
This file is only use when compiling with Gtk+ 3.
-Copyright (C) 2011-2020 Free Software Foundation, Inc.
+Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/epaths.in b/src/epaths.in
index 5b6c650b0da..0c72610c6c1 100644
--- a/src/epaths.in
+++ b/src/epaths.in
@@ -1,6 +1,6 @@
/* Hey Emacs, this is -*- C -*- code! */
/*
-Copyright (C) 1993, 1995, 1997, 1999, 2001-2020 Free Software
+Copyright (C) 1993, 1995, 1997, 1999, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/eval.c b/src/eval.c
index 368fa0944a1..e83df8ce221 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1,6 +1,6 @@
/* Evaluator for GNU Emacs Lisp interpreter.
-Copyright (C) 1985-1987, 1993-1995, 1999-2020 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1999-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/fileio.c b/src/fileio.c
index 23b4523c944..741e297d29c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,6 +1,6 @@
/* File IO for GNU Emacs.
-Copyright (C) 1985-1988, 1993-2020 Free Software Foundation, Inc.
+Copyright (C) 1985-1988, 1993-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/filelock.c b/src/filelock.c
index 39febd366d8..35baa0c6668 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -1,6 +1,6 @@
/* Lock files for editing.
-Copyright (C) 1985-1987, 1993-1994, 1996, 1998-2020 Free Software
+Copyright (C) 1985-1987, 1993-1994, 1996, 1998-2021 Free Software
Foundation, Inc.
Author: Richard King
diff --git a/src/firstfile.c b/src/firstfile.c
index 9dc70df9d3c..2733e1b5d64 100644
--- a/src/firstfile.c
+++ b/src/firstfile.c
@@ -1,5 +1,5 @@
/* Mark beginning of data space to dump as pure, for GNU Emacs.
- Copyright (C) 1997, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/floatfns.c b/src/floatfns.c
index 235e3b4cdfe..aadae4fd9d6 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -1,6 +1,6 @@
/* Primitive operations on floating point for GNU Emacs Lisp interpreter.
-Copyright (C) 1988, 1993-1994, 1999, 2001-2020 Free Software Foundation,
+Copyright (C) 1988, 1993-1994, 1999, 2001-2021 Free Software Foundation,
Inc.
Author: Wolfgang Rupprecht (according to ack.texi)
diff --git a/src/fns.c b/src/fns.c
index 2de1d26dd31..5fcc54f0d1f 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1,6 +1,6 @@
/* Random utility Lisp functions.
-Copyright (C) 1985-1987, 1993-1995, 1997-2020 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1997-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/font.c b/src/font.c
index 5f9db2ebb8c..a59ebe216b8 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1,6 +1,6 @@
/* font.c -- "Font" primitives.
-Copyright (C) 2006-2020 Free Software Foundation, Inc.
+Copyright (C) 2006-2021 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
diff --git a/src/font.h b/src/font.h
index 8614e7fa10a..d3e15306427 100644
--- a/src/font.h
+++ b/src/font.h
@@ -1,5 +1,5 @@
/* font.h -- Interface definition for font handling.
- Copyright (C) 2006-2020 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
diff --git a/src/fontset.c b/src/fontset.c
index 8c86075c07e..332be6c39d1 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1,6 +1,6 @@
/* Fontset handler.
-Copyright (C) 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/fontset.h b/src/fontset.h
index f8a6b1d62d2..42cca50d381 100644
--- a/src/fontset.h
+++ b/src/fontset.h
@@ -1,5 +1,5 @@
/* Header for fontset handler.
- Copyright (C) 1998, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/frame.c b/src/frame.c
index 164c05cae85..45ee96e9620 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1,6 +1,6 @@
/* Generic frame functions.
-Copyright (C) 1993-1995, 1997, 1999-2020 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 1997, 1999-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/frame.h b/src/frame.h
index 16ecfd311c3..8cf41dc0046 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1,5 +1,5 @@
/* Define frame-object for GNU Emacs.
- Copyright (C) 1993-1994, 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 1999-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/fringe.c b/src/fringe.c
index 75496692d53..65c9a84ac99 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1,5 +1,5 @@
/* Fringe handling (split from xdisp.c).
- Copyright (C) 1985-1988, 1993-1995, 1997-2020 Free Software
+ Copyright (C) 1985-1988, 1993-1995, 1997-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index b89510704e1..db417b3e77d 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -1,5 +1,5 @@
/* ftcrfont.c -- FreeType font driver on cairo.
- Copyright (C) 2015-2020 Free Software Foundation, Inc.
+ Copyright (C) 2015-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ftfont.c b/src/ftfont.c
index 6fca9c85093..0603dd9ce68 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1,5 +1,5 @@
/* ftfont.c -- FreeType font driver.
- Copyright (C) 2006-2020 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
diff --git a/src/getpagesize.h b/src/getpagesize.h
index f033d9739d1..ec497d04040 100644
--- a/src/getpagesize.h
+++ b/src/getpagesize.h
@@ -1,5 +1,5 @@
/* Emulate getpagesize on systems that lack it.
- Copyright (C) 1986, 1992, 1995, 2001-2020 Free Software Foundation,
+ Copyright (C) 1986, 1992, 1995, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index d083afc2fca..4da61569435 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -1,5 +1,5 @@
/* Filesystem notifications support with glib API.
- Copyright (C) 2013-2020 Free Software Foundation, Inc.
+ Copyright (C) 2013-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 3560c744539..66008ea69b2 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1,5 +1,5 @@
/* Declarations for `malloc' and friends.
- Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2020 Free
+ Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2021 Free
Software Foundation, Inc.
Written May 1989 by Mike Haertel.
diff --git a/src/gnutls.c b/src/gnutls.c
index 0010553a9d4..b995ffffa60 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -1,5 +1,5 @@
/* GnuTLS glue for GNU Emacs.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/gnutls.h b/src/gnutls.h
index 5f4ad603476..5fa08f8b129 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -1,5 +1,5 @@
/* GnuTLS glue for GNU Emacs.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 807ee17fa30..11e59b9fae5 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1,6 +1,6 @@
/* Functions for creating and updating GTK widgets.
-Copyright (C) 2003-2020 Free Software Foundation, Inc.
+Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 5419167cd78..31a12cd5d3c 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -1,6 +1,6 @@
/* Definitions and headers for GTK widgets.
-Copyright (C) 2003-2020 Free Software Foundation, Inc.
+Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/hbfont.c b/src/hbfont.c
index 82b115e6868..e9f4085b1ae 100644
--- a/src/hbfont.c
+++ b/src/hbfont.c
@@ -1,5 +1,5 @@
/* hbfont.c -- Platform-independent support for HarfBuzz font driver.
- Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ Copyright (C) 2019-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/image.c b/src/image.c
index e99ba09f515..a124cf91ba0 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1,6 +1,6 @@
/* Functions for image support on window system.
-Copyright (C) 1989, 1992-2020 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/indent.c b/src/indent.c
index 4ecf02b6b96..0a6b460f753 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1,5 +1,5 @@
/* Indentation functions.
- Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2020 Free Software
+ Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/indent.h b/src/indent.h
index 6058429ede5..776fe7ba4b9 100644
--- a/src/indent.h
+++ b/src/indent.h
@@ -1,5 +1,5 @@
/* Definitions for interface to indent.c
- Copyright (C) 1985-1986, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/inotify.c b/src/inotify.c
index 549a82b4013..df6145d7025 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -1,6 +1,6 @@
/* Inotify support for Emacs
-Copyright (C) 2012-2020 Free Software Foundation, Inc.
+Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/insdel.c b/src/insdel.c
index 6e245971085..e38b091f542 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1,5 +1,5 @@
/* Buffer insertion/deletion and gap motion for GNU Emacs. -*- coding: utf-8 -*-
- Copyright (C) 1985-1986, 1993-1995, 1997-2020 Free Software
+ Copyright (C) 1985-1986, 1993-1995, 1997-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/intervals.c b/src/intervals.c
index 0257591a142..f88a41f2549 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1,5 +1,5 @@
/* Code for doing intervals.
- Copyright (C) 1993-1995, 1997-1998, 2001-2020 Free Software
+ Copyright (C) 1993-1995, 1997-1998, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/intervals.h b/src/intervals.h
index 9a7ba910a10..c1b19345d2e 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -1,5 +1,5 @@
/* Definitions and global variables for intervals.
- Copyright (C) 1993-1994, 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/json.c b/src/json.c
index 744c40a1bef..2901a20811a 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1,6 +1,6 @@
/* JSON parsing and serialization.
-Copyright (C) 2017-2020 Free Software Foundation, Inc.
+Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/keyboard.c b/src/keyboard.c
index 54232aaea1e..d2f0cb405f0 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1,6 +1,6 @@
/* Keyboard and mouse input; editor command loop.
-Copyright (C) 1985-1989, 1993-1997, 1999-2020 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1997, 1999-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
@@ -3647,7 +3647,8 @@ kbd_buffer_unget_event (struct selection_input_event *event)
#define INPUT_EVENT_POS_MAX \
((ptrdiff_t) min (PTRDIFF_MAX, min (TYPE_MAXIMUM (Time) / 2, \
MOST_POSITIVE_FIXNUM)))
-#define INPUT_EVENT_POS_MIN (-1 - INPUT_EVENT_POS_MAX)
+#define INPUT_EVENT_POS_MIN (PTRDIFF_MIN < -INPUT_EVENT_POS_MAX \
+ ? -1 - INPUT_EVENT_POS_MAX : PTRDIFF_MIN)
/* Return a Time that encodes position POS. POS must be in range. */
diff --git a/src/keyboard.h b/src/keyboard.h
index 24e9a007888..91c6f4604f9 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -1,5 +1,5 @@
/* Declarations useful when processing input.
- Copyright (C) 1985-1987, 1993, 2001-2020 Free Software Foundation,
+ Copyright (C) 1985-1987, 1993, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/keymap.c b/src/keymap.c
index ca2d33dba47..f9aac6d7313 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1,5 +1,5 @@
/* Manipulation of keymaps
- Copyright (C) 1985-1988, 1993-1995, 1998-2020 Free Software
+ Copyright (C) 1985-1988, 1993-1995, 1998-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
@@ -218,15 +218,13 @@ when reading a key-sequence to be looked-up in this keymap. */)
Lisp_Object
get_keymap (Lisp_Object object, bool error_if_not_keymap, bool autoload)
{
- Lisp_Object tem;
-
autoload_retry:
if (NILP (object))
goto end;
if (CONSP (object) && EQ (XCAR (object), Qkeymap))
return object;
- tem = indirect_function (object);
+ Lisp_Object tem = indirect_function (object);
if (CONSP (tem))
{
if (EQ (XCAR (tem), Qkeymap))
@@ -265,12 +263,10 @@ get_keymap (Lisp_Object object, bool error_if_not_keymap, bool autoload)
static Lisp_Object
keymap_parent (Lisp_Object keymap, bool autoload)
{
- Lisp_Object list;
-
keymap = get_keymap (keymap, 1, autoload);
/* Skip past the initial element `keymap'. */
- list = XCDR (keymap);
+ Lisp_Object list = XCDR (keymap);
for (; CONSP (list); list = XCDR (list))
{
/* See if there is another `keymap'. */
@@ -306,8 +302,6 @@ DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0,
Return PARENT. PARENT should be nil or another keymap. */)
(Lisp_Object keymap, Lisp_Object parent)
{
- Lisp_Object list, prev;
-
/* Flush any reverse-map cache. */
where_is_cache = Qnil; where_is_cache_keymaps = Qt;
@@ -323,10 +317,10 @@ Return PARENT. PARENT should be nil or another keymap. */)
}
/* Skip past the initial element `keymap'. */
- prev = keymap;
+ Lisp_Object prev = keymap;
while (1)
{
- list = XCDR (prev);
+ Lisp_Object list = XCDR (prev);
/* If there is a parent keymap here, replace it.
If we came to the end, add the parent in PREV. */
if (!CONSP (list) || KEYMAPP (list))
@@ -805,14 +799,10 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def)
towards the front of the alist and character lookups in dense
keymaps will remain fast. Otherwise, this just points at the
front of the keymap. */
- Lisp_Object insertion_point;
-
- insertion_point = keymap;
+ Lisp_Object insertion_point = keymap;
for (tail = XCDR (keymap); CONSP (tail); tail = XCDR (tail))
{
- Lisp_Object elt;
-
- elt = XCAR (tail);
+ Lisp_Object elt = XCAR (tail);
if (VECTORP (elt))
{
if (FIXNATP (idx) && XFIXNAT (idx) < ASIZE (elt))
@@ -1018,9 +1008,8 @@ copy_keymap_1 (Lisp_Object keymap, int depth)
}
else if (VECTORP (elt))
{
- int i;
elt = Fcopy_sequence (elt);
- for (i = 0; i < ASIZE (elt); i++)
+ for (int i = 0; i < ASIZE (elt); i++)
ASET (elt, i, copy_keymap_item (AREF (elt, i), depth + 1));
}
else if (CONSP (elt))
@@ -1097,24 +1086,19 @@ binding is altered. If there is no binding for KEY, the new pair
binding KEY to DEF is added at the front of KEYMAP. */)
(Lisp_Object keymap, Lisp_Object key, Lisp_Object def)
{
- ptrdiff_t idx;
- Lisp_Object c;
- Lisp_Object cmd;
- bool metized = 0;
- int meta_bit;
- ptrdiff_t length;
+ bool metized = false;
keymap = get_keymap (keymap, 1, 1);
- length = CHECK_VECTOR_OR_STRING (key);
+ ptrdiff_t length = CHECK_VECTOR_OR_STRING (key);
if (length == 0)
return Qnil;
if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt))
Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands);
- meta_bit = (VECTORP (key) || (STRINGP (key) && STRING_MULTIBYTE (key))
- ? meta_modifier : 0x80);
+ int meta_bit = (VECTORP (key) || (STRINGP (key) && STRING_MULTIBYTE (key))
+ ? meta_modifier : 0x80);
if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0)))
{ /* DEF is apparently an XEmacs-style keyboard macro. */
@@ -1130,10 +1114,10 @@ binding KEY to DEF is added at the front of KEYMAP. */)
def = tmp;
}
- idx = 0;
+ ptrdiff_t idx = 0;
while (1)
{
- c = Faref (key, make_fixnum (idx));
+ Lisp_Object c = Faref (key, make_fixnum (idx));
if (CONSP (c))
{
@@ -1153,14 +1137,14 @@ binding KEY to DEF is added at the front of KEYMAP. */)
&& !metized)
{
c = meta_prefix_char;
- metized = 1;
+ metized = true;
}
else
{
if (FIXNUMP (c))
XSETINT (c, XFIXNUM (c) & ~meta_bit);
- metized = 0;
+ metized = false;
idx++;
}
@@ -1173,7 +1157,7 @@ binding KEY to DEF is added at the front of KEYMAP. */)
if (idx == length)
return store_in_keymap (keymap, c, def);
- cmd = access_keymap (keymap, c, 0, 1, 1);
+ Lisp_Object cmd = access_keymap (keymap, c, 0, 1, 1);
/* If this key is undefined, make it a prefix. */
if (NILP (cmd))
@@ -1250,23 +1234,19 @@ third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will
recognize the default bindings, just as `read-key-sequence' does. */)
(Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default)
{
- ptrdiff_t idx;
- Lisp_Object cmd;
- Lisp_Object c;
- ptrdiff_t length;
bool t_ok = !NILP (accept_default);
if (!CONSP (keymap) && !NILP (keymap))
keymap = get_keymap (keymap, true, true);
- length = CHECK_VECTOR_OR_STRING (key);
+ ptrdiff_t length = CHECK_VECTOR_OR_STRING (key);
if (length == 0)
return keymap;
- idx = 0;
+ ptrdiff_t idx = 0;
while (1)
{
- c = Faref (key, make_fixnum (idx++));
+ Lisp_Object c = Faref (key, make_fixnum (idx++));
if (CONSP (c) && lucid_event_type_list_p (c))
c = Fevent_convert_list (c);
@@ -1280,7 +1260,7 @@ recognize the default bindings, just as `read-key-sequence' does. */)
if (!FIXNUMP (c) && !SYMBOLP (c) && !CONSP (c) && !STRINGP (c))
message_with_string ("Key sequence contains invalid event %s", c, 1);
- cmd = access_keymap (keymap, c, t_ok, 0, 1);
+ Lisp_Object cmd = access_keymap (keymap, c, t_ok, 0, 1);
if (idx == length)
return cmd;
@@ -1299,9 +1279,7 @@ recognize the default bindings, just as `read-key-sequence' does. */)
static Lisp_Object
define_as_prefix (Lisp_Object keymap, Lisp_Object c)
{
- Lisp_Object cmd;
-
- cmd = Fmake_sparse_keymap (Qnil);
+ Lisp_Object cmd = Fmake_sparse_keymap (Qnil);
store_in_keymap (keymap, c, cmd);
return cmd;
@@ -1322,15 +1300,12 @@ append_key (Lisp_Object key_sequence, Lisp_Object key)
static void
silly_event_symbol_error (Lisp_Object c)
{
- Lisp_Object parsed, base, name, assoc;
- int modifiers;
-
- parsed = parse_modifiers (c);
- modifiers = XFIXNAT (XCAR (XCDR (parsed)));
- base = XCAR (parsed);
- name = Fsymbol_name (base);
+ Lisp_Object parsed = parse_modifiers (c);
+ int modifiers = XFIXNAT (XCAR (XCDR (parsed)));
+ Lisp_Object base = XCAR (parsed);
+ Lisp_Object name = Fsymbol_name (base);
/* This alist includes elements such as ("RET" . "\\r"). */
- assoc = Fassoc (name, exclude_keys, Qnil);
+ Lisp_Object assoc = Fassoc (name, exclude_keys, Qnil);
if (! NILP (assoc))
{
@@ -1391,16 +1366,14 @@ ptrdiff_t
current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
{
ptrdiff_t i = 0;
- int list_number = 0;
Lisp_Object alist, assoc, var, val;
- Lisp_Object emulation_alists;
+ Lisp_Object emulation_alists = Vemulation_mode_map_alists;
Lisp_Object lists[2];
- emulation_alists = Vemulation_mode_map_alists;
lists[0] = Vminor_mode_overriding_map_alist;
lists[1] = Vminor_mode_map_alist;
- for (list_number = 0; list_number < 2; list_number++)
+ for (int list_number = 0; list_number < 2; list_number++)
{
if (CONSP (emulation_alists))
{
@@ -1526,9 +1499,7 @@ like in the respective argument of `key-binding'. */)
if (CONSP (position))
{
- Lisp_Object window;
-
- window = POSN_WINDOW (position);
+ Lisp_Object window = POSN_WINDOW (position);
if (WINDOWP (window)
&& BUFFERP (XWINDOW (window)->contents)
@@ -1557,7 +1528,7 @@ like in the respective argument of `key-binding'. */)
if (NILP (XCDR (keymaps)))
{
Lisp_Object *maps;
- int nmaps, i;
+ int nmaps;
ptrdiff_t pt = click_position (position);
/* This usually returns the buffer's local map,
but that can be overridden by a `local-map' property. */
@@ -1575,9 +1546,7 @@ like in the respective argument of `key-binding'. */)
if (POSN_INBUFFER_P (position))
{
- Lisp_Object pos;
-
- pos = POSN_BUFFER_POSN (position);
+ Lisp_Object pos = POSN_BUFFER_POSN (position);
if (FIXNUMP (pos)
&& XFIXNUM (pos) >= BEG && XFIXNUM (pos) <= Z)
{
@@ -1597,15 +1566,13 @@ like in the respective argument of `key-binding'. */)
if (CONSP (string) && STRINGP (XCAR (string)))
{
- Lisp_Object pos, map;
-
- pos = XCDR (string);
+ Lisp_Object pos = XCDR (string);
string = XCAR (string);
if (FIXNUMP (pos)
&& XFIXNUM (pos) >= 0
&& XFIXNUM (pos) < SCHARS (string))
{
- map = Fget_text_property (pos, Qlocal_map, string);
+ Lisp_Object map = Fget_text_property (pos, Qlocal_map, string);
if (!NILP (map))
local_map = map;
@@ -1623,7 +1590,7 @@ like in the respective argument of `key-binding'. */)
/* Now put all the minor mode keymaps on the list. */
nmaps = current_minor_maps (0, &maps);
- for (i = --nmaps; i >= 0; i--)
+ for (int i = --nmaps; i >= 0; i--)
if (!NILP (maps[i]))
keymaps = Fcons (maps[i], keymaps);
@@ -1667,18 +1634,15 @@ specified buffer position instead of point are used.
*/)
(Lisp_Object key, Lisp_Object accept_default, Lisp_Object no_remap, Lisp_Object position)
{
- Lisp_Object value;
-
if (NILP (position) && VECTORP (key))
{
- Lisp_Object event;
-
if (ASIZE (key) == 0)
return Qnil;
/* mouse events may have a symbolic prefix indicating the
scrollbar or mode line */
- event = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0);
+ Lisp_Object event
+ = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0);
/* We are not interested in locations without event data */
@@ -1690,8 +1654,8 @@ specified buffer position instead of point are used.
}
}
- value = Flookup_key (Fcurrent_active_maps (Qt, position),
- key, accept_default);
+ Lisp_Object value = Flookup_key (Fcurrent_active_maps (Qt, position),
+ key, accept_default);
if (NILP (value) || FIXNUMP (value))
return Qnil;
@@ -1720,8 +1684,7 @@ If optional argument ACCEPT-DEFAULT is non-nil, recognize default
bindings; see the description of `lookup-key' for more details about this. */)
(Lisp_Object keys, Lisp_Object accept_default)
{
- register Lisp_Object map;
- map = BVAR (current_buffer, keymap);
+ register Lisp_Object map = BVAR (current_buffer, keymap);
if (NILP (map))
return Qnil;
return Flookup_key (map, keys, accept_default);
@@ -1760,15 +1723,11 @@ bindings; see the description of `lookup-key' for more details about this. */)
(Lisp_Object key, Lisp_Object accept_default)
{
Lisp_Object *modes, *maps;
- int nmaps;
- Lisp_Object binding;
- int i, j;
-
- nmaps = current_minor_maps (&modes, &maps);
-
- binding = Qnil;
+ int nmaps = current_minor_maps (&modes, &maps);
+ Lisp_Object binding = Qnil;
- for (i = j = 0; i < nmaps; i++)
+ int j;
+ for (int i = j = 0; i < nmaps; i++)
if (!NILP (maps[i])
&& !NILP (binding = Flookup_key (maps[i], key, accept_default))
&& !FIXNUMP (binding))
@@ -1795,8 +1754,7 @@ string for the map. This is required to use the keymap as a menu.
This function returns COMMAND. */)
(Lisp_Object command, Lisp_Object mapvar, Lisp_Object name)
{
- Lisp_Object map;
- map = Fmake_sparse_keymap (name);
+ Lisp_Object map = Fmake_sparse_keymap (name);
Ffset (command, map);
if (!NILP (mapvar))
Fset (mapvar, map);
@@ -1942,8 +1900,7 @@ then the value includes only maps for prefixes that start with PREFIX. */)
{
/* If a prefix was specified, start with the keymap (if any) for
that prefix, so we don't waste time considering other prefixes. */
- Lisp_Object tem;
- tem = Flookup_key (keymap, prefix, Qt);
+ Lisp_Object tem = Flookup_key (keymap, prefix, Qt);
/* Flookup_key may give us nil, or a number,
if the prefix is not defined in this particular map.
It might even give us a list that isn't a keymap. */
@@ -2406,7 +2363,6 @@ where_is_internal (Lisp_Object definition, Lisp_Object keymaps,
bool noindirect, bool nomenus)
{
Lisp_Object maps = Qnil;
- Lisp_Object found;
struct where_is_internal_data data;
/* Only important use of caching is for the menubar
@@ -2432,7 +2388,7 @@ where_is_internal (Lisp_Object definition, Lisp_Object keymaps,
we're filling it up. */
where_is_cache = Qnil;
- found = keymaps;
+ Lisp_Object found = keymaps;
while (CONSP (found))
{
maps =
@@ -2541,8 +2497,7 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
/* Whether or not we're handling remapped sequences. This is needed
because remapping is not done recursively by Fcommand_remapping: you
can't remap a remapped command. */
- bool remapped = 0;
- Lisp_Object tem = Qnil;
+ bool remapped = false;
/* Refresh the C version of the modifier preference. */
where_is_preferred_modifier
@@ -2556,7 +2511,7 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
else
keymaps = Fcurrent_active_maps (Qnil, Qnil);
- tem = Fcommand_remapping (definition, Qnil, keymaps);
+ Lisp_Object tem = Fcommand_remapping (definition, Qnil, keymaps);
/* If `definition' is remapped to `tem', then OT1H no key will run
that command (since they will run `tem' instead), so we should
return nil; but OTOH all keys bound to `definition' (or to `tem')
@@ -2598,7 +2553,7 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
considered remapped sequences yet, copy them over and
process them. */
|| (!remapped && (sequences = remapped_sequences,
- remapped = 1,
+ remapped = true,
CONSP (sequences))))
{
Lisp_Object sequence, function;
@@ -2744,9 +2699,7 @@ The optional argument MENUS, if non-nil, says to mention menu bindings.
\(Ordinarily these are omitted from the output.) */)
(Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus)
{
- Lisp_Object outbuf, shadow;
Lisp_Object nomenu = NILP (menus) ? Qt : Qnil;
- Lisp_Object start1;
const char *alternate_heading
= "\
@@ -2756,17 +2709,16 @@ You type Translation\n\
CHECK_BUFFER (buffer);
- shadow = Qnil;
- outbuf = Fcurrent_buffer ();
+ Lisp_Object shadow = Qnil;
+ Lisp_Object outbuf = Fcurrent_buffer ();
/* Report on alternates for keys. */
if (STRINGP (KVAR (current_kboard, Vkeyboard_translate_table)) && !NILP (prefix))
{
- int c;
const unsigned char *translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table));
int translate_len = SCHARS (KVAR (current_kboard, Vkeyboard_translate_table));
- for (c = 0; c < translate_len; c++)
+ for (int c = 0; c < translate_len; c++)
if (translate[c] != c)
{
char buf[KEY_DESCRIPTION_SIZE];
@@ -2803,7 +2755,7 @@ You type Translation\n\
}
/* Print the (major mode) local map. */
- start1 = Qnil;
+ Lisp_Object start1 = Qnil;
if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
start1 = KVAR (current_kboard, Voverriding_terminal_local_map);
@@ -2832,14 +2784,13 @@ You type Translation\n\
else
{
/* Print the minor mode and major mode keymaps. */
- int i, nmaps;
Lisp_Object *modes, *maps;
/* Temporarily switch to `buffer', so that we can get that buffer's
minor modes correctly. */
Fset_buffer (buffer);
- nmaps = current_minor_maps (&modes, &maps);
+ int nmaps = current_minor_maps (&modes, &maps);
Fset_buffer (outbuf);
start1 = get_local_map (BUF_PT (XBUFFER (buffer)),
@@ -2855,7 +2806,7 @@ You type Translation\n\
}
/* Print the minor mode maps. */
- for (i = 0; i < nmaps; i++)
+ for (int i = 0; i < nmaps; i++)
{
/* The title for a minor mode keymap
is constructed at run time.
@@ -3042,21 +2993,11 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
bool partial, Lisp_Object shadow, Lisp_Object entire_map,
bool keymap_p, bool mention_shadow)
{
- Lisp_Object definition;
- Lisp_Object tem2;
Lisp_Object elt_prefix = Qnil;
- int i;
- Lisp_Object suppress;
- Lisp_Object kludge;
- bool first = 1;
+ Lisp_Object suppress = Qnil;
+ bool first = true;
/* Range of elements to be handled. */
int from, to, stop;
- Lisp_Object character;
- int starting_i;
-
- suppress = Qnil;
-
- definition = Qnil;
if (!keymap_p)
{
@@ -3071,7 +3012,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
/* This vector gets used to present single keys to Flookup_key. Since
that is done once per vector element, we don't want to cons up a
fresh vector every time. */
- kludge = make_nil_vector (1);
+ Lisp_Object kludge = make_nil_vector (1);
if (partial)
suppress = intern ("suppress-keymap");
@@ -3082,12 +3023,12 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
else
stop = to = ASIZE (vector);
- for (i = from; ; i++)
+ for (int i = from; ; i++)
{
- bool this_shadowed = 0;
+ bool this_shadowed = false;
Lisp_Object shadowed_by = Qnil;
int range_beg, range_end;
- Lisp_Object val;
+ Lisp_Object val, tem2;
maybe_quit ();
@@ -3098,7 +3039,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
stop = to;
}
- starting_i = i;
+ int starting_i = i;
if (CHAR_TABLE_P (vector))
{
@@ -3108,21 +3049,19 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
}
else
val = AREF (vector, i);
- definition = get_keyelt (val, 0);
+ Lisp_Object definition = get_keyelt (val, 0);
if (NILP (definition)) continue;
/* Don't mention suppressed commands. */
if (SYMBOLP (definition) && partial)
{
- Lisp_Object tem;
-
- tem = Fget (definition, suppress);
+ Lisp_Object tem = Fget (definition, suppress);
if (!NILP (tem)) continue;
}
- character = make_fixnum (starting_i);
+ Lisp_Object character = make_fixnum (starting_i);
ASET (kludge, 0, character);
/* If this binding is shadowed by some other map, ignore it. */
@@ -3133,7 +3072,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
if (!NILP (shadowed_by) && !EQ (shadowed_by, definition))
{
if (mention_shadow)
- this_shadowed = 1;
+ this_shadowed = true;
else
continue;
}
@@ -3143,9 +3082,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
one in the same keymap. */
if (!NILP (entire_map))
{
- Lisp_Object tem;
-
- tem = Flookup_key (entire_map, kludge, Qt);
+ Lisp_Object tem = Flookup_key (entire_map, kludge, Qt);
if (!EQ (tem, definition))
continue;
@@ -3154,7 +3091,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
if (first)
{
insert ("\n", 1);
- first = 0;
+ first = false;
}
/* Output the prefix that applies to every entry in this map. */
@@ -3164,9 +3101,9 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
insert1 (Fkey_description (kludge, prefix));
/* Find all consecutive characters or rows that have the same
- definition. But, VECTOR is a char-table, we had better put a
- boundary between normal characters (-#x3FFF7F) and 8-bit
- characters (#x3FFF80-). */
+ definition. But, if VECTOR is a char-table, we had better
+ put a boundary between normal characters (-#x3FFF7F) and
+ 8-bit characters (#x3FFF80-). */
if (CHAR_TABLE_P (vector))
{
while (i + 1 < stop
@@ -3189,12 +3126,11 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
if they are, that they are shadowed by the same command. */
if (CHAR_TABLE_P (vector) && i != starting_i)
{
- Lisp_Object tem;
Lisp_Object key = make_nil_vector (1);
for (int j = starting_i + 1; j <= i; j++)
{
ASET (key, 0, make_fixnum (j));
- tem = shadow_lookup (shadow, key, Qt, 0);
+ Lisp_Object tem = shadow_lookup (shadow, key, Qt, 0);
if (NILP (Fequal (tem, shadowed_by)))
i = j - 1;
}
diff --git a/src/keymap.h b/src/keymap.h
index 2f7df2bd955..072c09348e2 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -1,5 +1,5 @@
/* Functions to manipulate keymaps.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/kqueue.c b/src/kqueue.c
index 590b747ef7c..0a0650d2081 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -1,6 +1,6 @@
/* Filesystem notifications support with kqueue API.
-Copyright (C) 2015-2020 Free Software Foundation, Inc.
+Copyright (C) 2015-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/lastfile.c b/src/lastfile.c
index 7ddfe23d3dd..7df6cf10b12 100644
--- a/src/lastfile.c
+++ b/src/lastfile.c
@@ -1,5 +1,5 @@
/* Mark end of data space to dump as pure, for GNU Emacs.
- Copyright (C) 1985, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/lcms.c b/src/lcms.c
index 924bdd299dc..b998c8c4eb2 100644
--- a/src/lcms.c
+++ b/src/lcms.c
@@ -1,5 +1,5 @@
/* Interface to Little CMS
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/lisp.h b/src/lisp.h
index 6f00ae84517..8906957ece4 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1,6 +1,6 @@
/* Fundamental definitions for GNU Emacs Lisp interpreter. -*- coding: utf-8 -*-
-Copyright (C) 1985-1987, 1993-1995, 1997-2020 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1997-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/lread.c b/src/lread.c
index cba28a8c1d8..e308fa88699 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1,6 +1,6 @@
/* Lisp parsing and input streams.
-Copyright (C) 1985-1989, 1993-1995, 1997-2020 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1995, 1997-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/macfont.h b/src/macfont.h
index 1341030f353..0ec11f513c0 100644
--- a/src/macfont.h
+++ b/src/macfont.h
@@ -1,5 +1,5 @@
/* Interface definition for macOS Core text font backend.
- Copyright (C) 2009-2020 Free Software Foundation, Inc.
+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/macfont.m b/src/macfont.m
index 904814647f9..d86f09f4850 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1,5 +1,5 @@
/* Font driver on macOS Core text.
- Copyright (C) 2009-2020 Free Software Foundation, Inc.
+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/macros.c b/src/macros.c
index 6006c863729..c8ce94e63b1 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -1,6 +1,6 @@
/* Keyboard macros.
-Copyright (C) 1985-1986, 1993, 2000-2020 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993, 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/macros.h b/src/macros.h
index d1d516bd837..23167a0763d 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -1,5 +1,5 @@
/* Definitions for keyboard macro interpretation in GNU Emacs.
- Copyright (C) 1985, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/marker.c b/src/marker.c
index 64f210db88b..59791513170 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -1,5 +1,5 @@
/* Markers: examining, setting and deleting.
- Copyright (C) 1985, 1997-1998, 2001-2020 Free Software Foundation,
+ Copyright (C) 1985, 1997-1998, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/menu.c b/src/menu.c
index e4fda572cd8..3b1d7402571 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1,6 +1,6 @@
/* Platform-independent code for terminal communications.
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2020 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/menu.h b/src/menu.h
index 44749ade75a..6c67ab20bb0 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -1,5 +1,5 @@
/* Functions to manipulate menus.
- Copyright (C) 2008-2020 Free Software Foundation, Inc.
+ Copyright (C) 2008-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/minibuf.c b/src/minibuf.c
index 1940564a80a..8b235690199 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1,6 +1,6 @@
/* Minibuffer input and completion.
-Copyright (C) 1985-1986, 1993-2020 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/msdos.c b/src/msdos.c
index b5f06c99c3d..5da01c9e7ca 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1,6 +1,6 @@
/* MS-DOS specific C utilities. -*- coding: cp850 -*-
-Copyright (C) 1993-1997, 1999-2020 Free Software Foundation, Inc.
+Copyright (C) 1993-1997, 1999-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/msdos.h b/src/msdos.h
index e08195ca6ad..f7d3b0d7029 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -1,5 +1,5 @@
/* MS-DOS specific C utilities, interface.
- Copyright (C) 1993, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/nsfns.m b/src/nsfns.m
index f3c5a9ef679..ee2daea0723 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1,6 +1,6 @@
/* Functions for the NeXT/Open/GNUstep and macOS window system.
-Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2020 Free Software
+Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/nsfont.m b/src/nsfont.m
index 9e4caca9102..f4f0d281674 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -1,6 +1,6 @@
/* Font back-end driver for the NeXT/Open/GNUstep and macOS window system.
See font.h
- Copyright (C) 2006-2020 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/nsgui.h b/src/nsgui.h
index 0536ef0c0a9..e4038d32267 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -1,5 +1,5 @@
/* Definitions and headers for communication on the NeXT/Open/GNUstep API.
- Copyright (C) 1995, 2005, 2008-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2005, 2008-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/nsimage.m b/src/nsimage.m
index c47a2b2d64a..f0014b50b9b 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -1,5 +1,5 @@
/* Image support for the NeXT/Open/GNUstep and macOS window system.
- Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2020 Free Software
+ Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/nsmenu.m b/src/nsmenu.m
index efad978316e..9b56958100a 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1,5 +1,5 @@
/* NeXT/Open/GNUstep and macOS Cocoa menu and toolbar module.
- Copyright (C) 2007-2020 Free Software Foundation, Inc.
+ Copyright (C) 2007-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -47,21 +47,11 @@ Carbon version by Yamamoto Mitsuharu. */
#endif
-#if 0
-/* Include lisp -> C common menu parsing code. */
-#define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str)
-#include "nsmenu_common.c"
-#endif
-
extern long context_menu_value;
EmacsMenu *svcsMenu;
/* Nonzero means a menu is currently active. */
static int popup_activated_flag;
-/* Nonzero means we are tracking and updating menus. */
-static int trackingMenu;
-
-
/* NOTE: toolbar implementation is at end,
following complete menu implementation. */
@@ -75,11 +65,22 @@ static int trackingMenu;
/* Supposed to discard menubar and free storage. Since we share the
menubar among frames and update its context for the focused window,
- there is nothing to do here. */
+ we do not discard the menu. We do, however, want to remove any
+ existing menu items. */
void
free_frame_menubar (struct frame *f)
{
- return;
+ id menu = [NSApp mainMenu];
+ for (int i = [menu numberOfItems] - 1 ; i >= 0; i--)
+ {
+ NSMenuItem *item = [menu itemAtIndex:i];
+ NSString *title = [item title];
+
+ if ([ns_app_name isEqualToString:title])
+ continue;
+
+ [menu removeItemAtIndex:i];
+ }
}
@@ -98,16 +99,19 @@ popup_activated (void)
3) deep_p, submenu = non-nil: Update contents of a single submenu.
-------------------------------------------------------------------------- */
static void
-ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
+ns_update_menubar (struct frame *f, bool deep_p)
{
NSAutoreleasePool *pool;
- id menu = [NSApp mainMenu];
- static EmacsMenu *last_submenu = nil;
BOOL needsSet = NO;
+ id menu = [NSApp mainMenu];
bool owfi;
+
Lisp_Object items;
widget_value *wv, *first_wv, *prev_wv = 0;
int i;
+ int *submenu_start, *submenu_end;
+ bool *submenu_top_level_items;
+ int *submenu_n_panes;
#if NSMENUPROFILE
struct timeb tb;
@@ -116,7 +120,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
NSTRACE ("ns_update_menubar");
- if (f != SELECTED_FRAME ())
+ if (f != SELECTED_FRAME () || FRAME_EXTERNAL_MENU_BAR (f) == 0)
return;
XSETFRAME (Vmenu_updating_frame, f);
/*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */
@@ -141,115 +145,102 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
t = -(1000*tb.time+tb.millitm);
#endif
-#ifdef NS_IMPL_GNUSTEP
- deep_p = 1; /* until GNUstep NSMenu implements the Panther delegation model */
-#endif
-
if (deep_p)
{
- /* Fully parse one or more of the submenus. */
- int n = 0;
- int *submenu_start, *submenu_end;
- bool *submenu_top_level_items;
- int *submenu_n_panes;
+ /* Make a widget-value tree representing the entire menu trees. */
+
struct buffer *prev = current_buffer;
Lisp_Object buffer;
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
int previous_menu_items_used = f->menu_bar_items_used;
Lisp_Object *previous_items
= alloca (previous_menu_items_used * sizeof *previous_items);
+ int subitems;
- /* lisp preliminaries */
buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents;
specbind (Qinhibit_quit, Qt);
+ /* Don't let the debugger step into this code
+ because it is not reentrant. */
specbind (Qdebug_on_next_call, Qnil);
+
record_unwind_save_match_data ();
if (NILP (Voverriding_local_map_menu_flag))
{
specbind (Qoverriding_terminal_local_map, Qnil);
specbind (Qoverriding_local_map, Qnil);
}
+
set_buffer_internal_1 (XBUFFER (buffer));
- /* TODO: for some reason this is not needed in other terms,
- but some menu updates call Info-extract-pointer which causes
- abort-on-error if waiting-for-input. Needs further investigation. */
+ /* TODO: for some reason this is not needed in other terms, but
+ some menu updates call Info-extract-pointer which causes
+ abort-on-error if waiting-for-input. Needs further
+ investigation. */
owfi = waiting_for_input;
waiting_for_input = 0;
- /* lucid hook and possible reset */
+ /* Run the Lucid hook. */
safe_run_hooks (Qactivate_menubar_hook);
+
+ /* If it has changed current-menubar from previous value,
+ really recompute the menubar from the value. */
if (! NILP (Vlucid_menu_bar_dirty_flag))
call0 (Qrecompute_lucid_menubar);
safe_run_hooks (Qmenu_bar_update_hook);
fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
- /* Now ready to go */
items = FRAME_MENU_BAR_ITEMS (f);
- /* Save the frame's previous menu bar contents data */
+ /* Save the frame's previous menu bar contents data. */
if (previous_menu_items_used)
- memcpy (previous_items, aref_addr (f->menu_bar_vector, 0),
- previous_menu_items_used * sizeof (Lisp_Object));
+ memcpy (previous_items, xvector_contents (f->menu_bar_vector),
+ previous_menu_items_used * word_size);
- /* parse stage 1: extract from lisp */
+ /* Fill in menu_items with the current menu bar contents.
+ This can evaluate Lisp code. */
save_menu_items ();
menu_items = f->menu_bar_vector;
menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
- submenu_start = alloca (ASIZE (items) * sizeof *submenu_start);
- submenu_end = alloca (ASIZE (items) * sizeof *submenu_end);
- submenu_n_panes = alloca (ASIZE (items) * sizeof *submenu_n_panes);
- submenu_top_level_items = alloca (ASIZE (items)
+ subitems = ASIZE (items) / 4;
+ submenu_start = alloca ((subitems + 1) * sizeof *submenu_start);
+ submenu_end = alloca (subitems * sizeof *submenu_end);
+ submenu_n_panes = alloca (subitems * sizeof *submenu_n_panes);
+ submenu_top_level_items = alloca (subitems
* sizeof *submenu_top_level_items);
init_menu_items ();
- for (i = 0; i < ASIZE (items); i += 4)
+ for (i = 0; i < subitems; i++)
{
Lisp_Object key, string, maps;
- key = AREF (items, i);
- string = AREF (items, i + 1);
- maps = AREF (items, i + 2);
+ key = AREF (items, 4 * i);
+ string = AREF (items, 4 * i + 1);
+ maps = AREF (items, 4 * i + 2);
if (NILP (string))
break;
- /* FIXME: we'd like to only parse the needed submenu, but this
- was causing crashes in the _common parsing code: need to make
- sure proper initialization done. */
- /* if (submenu && strcmp ([[submenu title] UTF8String], SSDATA (string)))
- continue; */
-
submenu_start[i] = menu_items_used;
menu_items_n_panes = 0;
- submenu_top_level_items[i] = parse_single_submenu (key, string, maps);
+ submenu_top_level_items[i]
+ = parse_single_submenu (key, string, maps);
submenu_n_panes[i] = menu_items_n_panes;
+
submenu_end[i] = menu_items_used;
- n++;
}
+ submenu_start[i] = -1;
finish_menu_items ();
waiting_for_input = owfi;
+ /* Convert menu_items into widget_value trees
+ to display the menu. This cannot evaluate Lisp code. */
- if (submenu && n == 0)
- {
- /* should have found a menu for this one but didn't */
- fprintf (stderr, "ERROR: did not find lisp menu for submenu '%s'.\n",
- [[submenu title] UTF8String]);
- discard_menu_items ();
- unbind_to (specpdl_count, Qnil);
- unblock_input ();
- return;
- }
-
- /* parse stage 2: insert into lucid 'widget_value' structures
- [comments in other terms say not to evaluate lisp code here] */
wv = make_widget_value ("menubar", NULL, true, Qnil);
wv->button_type = BUTTON_TYPE_NONE;
first_wv = wv;
- for (i = 0; i < 4*n; i += 4)
+ for (i = 0; submenu_start[i] >= 0; i++)
{
menu_items_n_panes = submenu_n_panes[i];
wv = digest_single_submenu (submenu_start[i], submenu_end[i],
@@ -259,169 +250,79 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
else
first_wv->contents = wv;
/* Don't set wv->name here; GC during the loop might relocate it. */
- wv->enabled = 1;
+ wv->enabled = true;
wv->button_type = BUTTON_TYPE_NONE;
prev_wv = wv;
}
set_buffer_internal_1 (prev);
- /* Compare the new menu items with previous, and leave off if no change. */
- /* FIXME: following other terms here, but seems like this should be
- done before parse stage 2 above, since its results aren't used. */
- if (previous_menu_items_used
- && (!submenu || (submenu && submenu == last_submenu))
- && menu_items_used == previous_menu_items_used)
- {
- for (i = 0; i < previous_menu_items_used; i++)
- /* FIXME: this ALWAYS fails on Buffers menu items.. something
- about their strings causes them to change every time, so we
- double-check failures. */
- if (!EQ (previous_items[i], AREF (menu_items, i)))
- if (!(STRINGP (previous_items[i])
- && STRINGP (AREF (menu_items, i))
- && !strcmp (SSDATA (previous_items[i]),
- SSDATA (AREF (menu_items, i)))))
- break;
- if (i == previous_menu_items_used)
- {
- /* No change. */
+ /* If there has been no change in the Lisp-level contents
+ of the menu bar, skip redisplaying it. Just exit. */
-#if NSMENUPROFILE
- ftime (&tb);
- t += 1000*tb.time+tb.millitm;
- fprintf (stderr, "NO CHANGE! CUTTING OUT after %ld msec.\n", t);
-#endif
+ /* Compare the new menu items with the ones computed last time. */
+ for (i = 0; i < previous_menu_items_used; i++)
+ if (menu_items_used == i
+ || (!EQ (previous_items[i], AREF (menu_items, i))))
+ break;
+ if (i == menu_items_used && i == previous_menu_items_used && i != 0)
+ {
+ /* The menu items have not changed. Don't bother updating
+ the menus in any form, since it would be a no-op. */
+ free_menubar_widget_value_tree (first_wv);
+ discard_menu_items ();
+ unbind_to (specpdl_count, Qnil);
+ return;
+ }
- free_menubar_widget_value_tree (first_wv);
- discard_menu_items ();
- unbind_to (specpdl_count, Qnil);
- unblock_input ();
- return;
- }
- }
/* The menu items are different, so store them in the frame. */
- /* FIXME: this is not correct for single-submenu case. */
fset_menu_bar_vector (f, menu_items);
f->menu_bar_items_used = menu_items_used;
- /* Calls restore_menu_items, etc., as they were outside. */
+ /* This undoes save_menu_items. */
unbind_to (specpdl_count, Qnil);
- /* Parse stage 2a: now GC cannot happen during the lifetime of the
- widget_value, so it's safe to store data from a Lisp_String. */
+ /* Now GC cannot happen during the lifetime of the widget_value,
+ so it's safe to store data from a Lisp_String. */
wv = first_wv->contents;
for (i = 0; i < ASIZE (items); i += 4)
{
Lisp_Object string;
string = AREF (items, i + 1);
if (NILP (string))
- break;
-
- wv->name = SSDATA (string);
+ break;
+ wv->name = SSDATA (string);
update_submenu_strings (wv->contents);
- wv = wv->next;
+ wv = wv->next;
}
- /* Now, update the NS menu; if we have a submenu, use that, otherwise
- create a new menu for each sub and fill it. */
- if (submenu)
- {
- const char *submenuTitle = [[submenu title] UTF8String];
- for (wv = first_wv->contents; wv; wv = wv->next)
- {
- if (!strcmp (submenuTitle, wv->name))
- {
- [submenu fillWithWidgetValue: wv->contents];
- last_submenu = submenu;
- break;
- }
- }
- }
- else
- {
- [menu fillWithWidgetValue: first_wv->contents frame: f];
- }
-
}
else
{
- static int n_previous_strings = 0;
- static char previous_strings[100][10];
- static struct frame *last_f = NULL;
- int n;
- Lisp_Object string;
+ /* Make a widget-value tree containing
+ just the top level menu bar strings. */
wv = make_widget_value ("menubar", NULL, true, Qnil);
wv->button_type = BUTTON_TYPE_NONE;
first_wv = wv;
- /* Make widget-value tree with just the top level menu bar strings. */
items = FRAME_MENU_BAR_ITEMS (f);
- if (NILP (items))
- {
- free_menubar_widget_value_tree (first_wv);
- unblock_input ();
- return;
- }
-
-
- /* Check if no change: this mechanism is a bit rough, but ready. */
- n = ASIZE (items) / 4;
- if (f == last_f && n_previous_strings == n)
- {
- for (i = 0; i<n; i++)
- {
- string = AREF (items, 4*i+1);
-
- if (EQ (string, make_fixnum (0))) // FIXME: Why??? --Stef
- continue;
- if (NILP (string))
- {
- if (previous_strings[i][0])
- break;
- else
- continue;
- }
- else if (memcmp (previous_strings[i], SDATA (string),
- min (10, SBYTES (string) + 1)))
- break;
- }
-
- if (i == n)
- {
- free_menubar_widget_value_tree (first_wv);
- unblock_input ();
- return;
- }
- }
-
- [menu clear];
for (i = 0; i < ASIZE (items); i += 4)
{
+ Lisp_Object string;
+
string = AREF (items, i + 1);
if (NILP (string))
break;
- if (n < 100)
- memcpy (previous_strings[i/4], SDATA (string),
- min (10, SBYTES (string) + 1));
-
wv = make_widget_value (SSDATA (string), NULL, true, Qnil);
wv->button_type = BUTTON_TYPE_NONE;
+ /* This prevents lwlib from assuming this
+ menu item is really supposed to be empty. */
+ /* The intptr_t cast avoids a warning.
+ This value just has to be different from small integers. */
wv->call_data = (void *) (intptr_t) (-1);
-#ifdef NS_IMPL_COCOA
- /* We'll update the real copy under app menu when time comes. */
- if (!strcmp ("Services", wv->name))
- {
- /* But we need to make sure it will update on demand. */
- [svcsMenu setFrame: f];
- }
- else
-#endif
- [menu addSubmenuWithTitle: wv->name forFrame: f];
-
if (prev_wv)
prev_wv->next = wv;
else
@@ -429,15 +330,58 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
prev_wv = wv;
}
- last_f = f;
- if (n < 100)
- n_previous_strings = n;
+ /* Forget what we thought we knew about what is in the
+ detailed contents of the menu bar menus.
+ Changing the top level always destroys the contents. */
+ f->menu_bar_items_used = 0;
+ }
+
+ /* Now, update the NS menu. */
+ i = 0;
+
+ /* Make sure we skip the "application" menu, which is always the
+ first entry in our top-level menu. */
+ if (i < [menu numberOfItems])
+ {
+ NSString *title = [[menu itemAtIndex:i] title];
+ if ([ns_app_name isEqualToString:title])
+ i += 1;
+ }
+
+ for (wv = first_wv->contents; wv; wv = wv->next)
+ {
+ EmacsMenu *submenu;
+
+ if (i < [menu numberOfItems])
+ {
+ NSString *titleStr = [NSString stringWithUTF8String: wv->name];
+ NSMenuItem *item = [menu itemAtIndex:i];
+ submenu = (EmacsMenu*)[item submenu];
+
+ [item setTitle:titleStr];
+ [submenu setTitle:titleStr];
+ [submenu removeAllItems];
+ }
else
- n_previous_strings = 0;
+ submenu = [menu addSubmenuWithTitle: wv->name];
+
+ if ([[submenu title] isEqualToString:@"Help"])
+ [NSApp setHelpMenu:submenu];
+
+ if (deep_p)
+ [submenu fillWithWidgetValue: wv->contents];
+ i += 1;
}
- free_menubar_widget_value_tree (first_wv);
+ while (i < [menu numberOfItems])
+ {
+ /* Remove any extra items. */
+ [menu removeItemAtIndex:i];
+ }
+
+
+ free_menubar_widget_value_tree (first_wv);
#if NSMENUPROFILE
ftime (&tb);
@@ -460,21 +404,10 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
void
set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
{
- ns_update_menubar (f, deep_p, nil);
-}
-
-void
-ns_activate_menubar (struct frame *f)
-{
-#ifdef NS_IMPL_COCOA
- ns_update_menubar (f, true, nil);
- ns_check_pending_open_menu ();
-#endif
+ ns_update_menubar (f, deep_p);
}
-
-
/* ==========================================================================
Menu: class implementation
@@ -490,97 +423,31 @@ ns_activate_menubar (struct frame *f)
/* override designated initializer */
- (instancetype)initWithTitle: (NSString *)title
{
- frame = 0;
if ((self = [super initWithTitle: title]))
[self setAutoenablesItems: NO];
- return self;
-}
-
-
-/* used for top-level */
-- (instancetype)initWithTitle: (NSString *)title frame: (struct frame *)f
-{
- [self initWithTitle: title];
- frame = f;
-#ifdef NS_IMPL_COCOA
[self setDelegate: self];
-#endif
- return self;
-}
-
-
-- (void)setFrame: (struct frame *)f
-{
- frame = f;
-}
-
-#ifdef NS_IMPL_COCOA
--(void)trackingNotification:(NSNotification *)notification
-{
- /* Update menu in menuNeedsUpdate only while tracking menus. */
- trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification
- ? 1 : 0);
- if (! trackingMenu) ns_check_menu_open (nil);
-}
-
-- (void)menuWillOpen:(NSMenu *)menu
-{
- ++trackingMenu;
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- // On 10.6 we get repeated calls, only the one for NSSystemDefined is "real".
- if (
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- NSAppKitVersionNumber < NSAppKitVersionNumber10_7 &&
-#endif
- [[NSApp currentEvent] type] != NSEventTypeSystemDefined)
- return;
-#endif
+ needsUpdate = YES;
- /* When dragging from one menu to another, we get willOpen followed by didClose,
- i.e. trackingMenu == 3 in willOpen and then 2 after didClose.
- We have updated all menus, so avoid doing it when trackingMenu == 3. */
- if (trackingMenu == 2)
- ns_check_menu_open (menu);
-}
-
-- (void)menuDidClose:(NSMenu *)menu
-{
- --trackingMenu;
+ return self;
}
-#endif /* NS_IMPL_COCOA */
/* Delegate method called when a submenu is being opened: run a 'deep' call
to set_frame_menubar. */
+
+/* TODO: GNUstep calls this method when the menu is still being built
+ which throws it into an infinite loop. One possible solution is to
+ use menuWillOpen instead, but the Apple docs explicitly warn
+ against changing the contents of the menu in it. I don't know what
+ the right thing to do for GNUstep is. */
- (void)menuNeedsUpdate: (NSMenu *)menu
{
- if (!FRAME_LIVE_P (frame))
+ if (!FRAME_LIVE_P (SELECTED_FRAME ()))
return;
- /* Cocoa/Carbon will request update on every keystroke
- via IsMenuKeyEvent -> CheckMenusForKeyEvent. These are not needed
- since key equivalents are handled through emacs.
- On Leopard, even keystroke events generate SystemDefined event.
- Third-party applications that enhance mouse / trackpad
- interaction, or also VNC/Remote Desktop will send events
- of type AppDefined rather than SysDefined.
- Menus will fail to show up if they haven't been initialized.
- AppDefined events may lack timing data.
-
- Thus, we rely on the didBeginTrackingNotification notification
- as above to indicate the need for updates.
- From 10.6 on, we could also use -[NSMenu propertiesToUpdate]: In the
- key press case, NSMenuPropertyItemImage (e.g.) won't be set.
- */
- if (trackingMenu == 0)
- return;
-/*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */
-#ifdef NS_IMPL_GNUSTEP
- /* Don't know how to do this for anything other than Mac OS X 10.5 and later.
- This is wrong, as it might run Lisp code in the event loop. */
- ns_update_menubar (frame, true, self);
-#endif
+ if (needsUpdate)
+ ns_update_menubar (SELECTED_FRAME (), true);
}
@@ -593,33 +460,8 @@ ns_activate_menubar (struct frame *f)
}
-/* Parse a widget_value's key rep (examples: 's-p', 's-S', '(C-x C-s)', '<f13>')
- into an accelerator string. We are only able to display a single character
- for an accelerator, together with an optional modifier combination. (Under
- Carbon more control was possible, but in Cocoa multi-char strings passed to
- NSMenuItem get ignored. For now we try to display a super-single letter
- combo, and return the others as strings to be appended to the item title.
- (This is signaled by setting keyEquivModMask to 0 for now.) */
--(NSString *)parseKeyEquiv: (const char *)key
-{
- const char *tpos = key;
- keyEquivModMask = NSEventModifierFlagCommand;
-
- if (!key || !*key)
- return @"";
-
- while (*tpos == ' ' || *tpos == '(')
- tpos++;
- if ((*tpos == 's') && (*(tpos+1) == '-'))
- {
- return [NSString stringWithFormat: @"%c", tpos[2]];
- }
- keyEquivModMask = 0; /* signal */
- return [NSString stringWithUTF8String: tpos];
-}
-
-
- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr
+ attributes: (NSDictionary *)attributes
{
NSMenuItem *item;
widget_value *wv = (widget_value *)wvptr;
@@ -627,36 +469,33 @@ ns_activate_menubar (struct frame *f)
if (menu_separator_name_p (wv->name))
{
item = [NSMenuItem separatorItem];
- [self addItem: item];
}
else
{
- NSString *title, *keyEq;
- title = [NSString stringWithUTF8String: wv->name];
+ NSString *title = [NSString stringWithUTF8String: wv->name];
if (title == nil)
title = @"< ? >"; /* (get out in the open so we know about it) */
- keyEq = [self parseKeyEquiv: wv->key];
-#ifdef NS_IMPL_COCOA
- /* macOS mangles modifier strings longer than one character. */
- if (keyEquivModMask == 0)
- {
- title = [title stringByAppendingFormat: @" (%@)", keyEq];
- item = [self addItemWithTitle: (NSString *)title
- action: @selector (menuDown:)
- keyEquivalent: @""];
- }
- else
+ item = [[[NSMenuItem alloc] init] autorelease];
+ if (wv->key)
{
-#endif
- item = [self addItemWithTitle: (NSString *)title
- action: @selector (menuDown:)
- keyEquivalent: keyEq];
+ NSString *key = [NSString stringWithUTF8String: wv->key];
#ifdef NS_IMPL_COCOA
- }
+ /* Cocoa only permits a single key (with modifiers) as
+ keyEquivalent, so we put them in the title string
+ in a tab-separated column. */
+ title = [title stringByAppendingFormat: @"\t%@", key];
+#else
+ [item setKeyEquivalent: key];
#endif
- [item setKeyEquivalentModifierMask: keyEquivModMask];
+ }
+ NSAttributedString *atitle = [[[NSAttributedString alloc]
+ initWithString: title
+ attributes: attributes]
+ autorelease];
+ [item setAction: @selector (menuDown:)];
+ [item setAttributedTitle: atitle];
[item setEnabled: wv->enabled];
/* Draw radio buttons and tickboxes. */
@@ -669,52 +508,145 @@ ns_activate_menubar (struct frame *f)
[item setTag: (NSInteger)wv->call_data];
}
+ [self addItem: item];
return item;
}
/* convenience */
--(void)clear
+-(void)removeAllItems
{
+#ifdef NS_IMPL_COCOA
+ [super removeAllItems];
+#else
+ /* GNUstep doesn't have removeAllItems yet, so do it
+ manually. */
int n;
for (n = [self numberOfItems]-1; n >= 0; n--)
- {
- NSMenuItem *item = [self itemAtIndex: n];
- NSString *title = [item title];
- if ([ns_app_name isEqualToString: title]
- && ![item isSeparatorItem])
- continue;
- [self removeItemAtIndex: n];
- }
+ [self removeItemAtIndex: n];
+#endif
+
+ needsUpdate = YES;
}
-- (void)fillWithWidgetValue: (void *)wvptr
+typedef struct {
+ const char *from, *to;
+} subst_t;
+
+/* Standard keyboard symbols used in menus. */
+static const subst_t key_symbols[] = {
+ {"<backspace>", "⌫"},
+ {"DEL", "⌫"},
+ {"<deletechar>", "⌦"},
+ {"<return>", "↩"},
+ {"RET", "↩"},
+ {"<left>", "←"},
+ {"<right>", "→"},
+ {"<up>", "↑"},
+ {"<down>", "↓"},
+ {"<prior>", "⇞"},
+ {"<next>", "⇟"},
+ {"<home>", "↖"},
+ {"<end>", "↘"},
+ {"<tab>", "⇥"},
+ {"TAB", "⇥"},
+ {"<backtab>", "⇤"},
+};
+
+/* Transform the key sequence KEY into something prettier by
+ substituting keyboard symbols. */
+static char *
+prettify_key (const char *key)
{
- [self fillWithWidgetValue: wvptr frame: (struct frame *)nil];
+ while (*key == ' ') key++;
+
+ int len = strlen (key);
+ char *buf = xmalloc (len + 1);
+ memcpy (buf, key, len + 1);
+ for (int i = 0; i < ARRAYELTS (key_symbols); i++)
+ {
+ ptrdiff_t fromlen = strlen (key_symbols[i].from);
+ char *p = buf;
+ while (p < buf + len)
+ {
+ char *match = memmem (buf, len, key_symbols[i].from, fromlen);
+ if (!match)
+ break;
+ ptrdiff_t tolen = strlen (key_symbols[i].to);
+ eassert (tolen <= fromlen);
+ memcpy (match, key_symbols[i].to, tolen);
+ memmove (match + tolen, match + fromlen,
+ len - (match + fromlen - buf) + 1);
+ len -= fromlen - tolen;
+ p = match + tolen;
+ }
+ }
+ Lisp_Object result = build_string (buf);
+ xfree (buf);
+ return SSDATA (result);
}
-- (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f
+- (void)fillWithWidgetValue: (void *)wvptr
{
- widget_value *wv = (widget_value *)wvptr;
+ widget_value *first_wv = (widget_value *)wvptr;
+ NSFont *menuFont = [NSFont menuFontOfSize:0];
+ NSDictionary *attributes = nil;
+
+#ifdef NS_IMPL_COCOA
+ /* Cocoa doesn't allow multi-key sequences in its menu display, so
+ work around it by using tabs to split the title into two
+ columns. */
+ NSDictionary *font_attribs = @{NSFontAttributeName: menuFont};
+ CGFloat maxNameWidth = 0;
+ CGFloat maxKeyWidth = 0;
+
+ /* Determine the maximum width of all menu items. */
+ for (widget_value *wv = first_wv; wv != NULL; wv = wv->next)
+ if (!menu_separator_name_p (wv->name))
+ {
+ NSString *name = [NSString stringWithUTF8String: wv->name];
+ NSSize nameSize = [name sizeWithAttributes: font_attribs];
+ maxNameWidth = MAX(maxNameWidth, nameSize.width);
+ if (wv->key)
+ {
+ wv->key = prettify_key (wv->key);
+ NSString *key = [NSString stringWithUTF8String: wv->key];
+ NSSize keySize = [key sizeWithAttributes: font_attribs];
+ maxKeyWidth = MAX(maxKeyWidth, keySize.width);
+ }
+ }
+
+ /* Put some space between the names and keys. */
+ CGFloat maxWidth = maxNameWidth + maxKeyWidth + 40;
+
+ /* Set a right-aligned tab stop at the maximum width, so that the
+ key will appear immediately to the left of it. */
+ NSTextTab *tab =
+ [[[NSTextTab alloc] initWithTextAlignment: NSTextAlignmentRight
+ location: maxWidth
+ options: @{}] autorelease];
+ NSMutableParagraphStyle *pstyle = [[[NSMutableParagraphStyle alloc] init]
+ autorelease];
+ [pstyle setTabStops: @[tab]];
+ attributes = @{NSParagraphStyleAttributeName: pstyle};
+#endif
/* clear existing contents */
- [self clear];
+ [self removeAllItems];
/* add new contents */
- for (; wv != NULL; wv = wv->next)
+ for (widget_value *wv = first_wv; wv != NULL; wv = wv->next)
{
- NSMenuItem *item = [self addItemWithWidgetValue: wv];
+ NSMenuItem *item = [self addItemWithWidgetValue: wv
+ attributes: attributes];
if (wv->contents)
{
EmacsMenu *submenu;
- if (f)
- submenu = [[EmacsMenu alloc] initWithTitle: [item title] frame:f];
- else
- submenu = [[EmacsMenu alloc] initWithTitle: [item title]];
+ submenu = [[EmacsMenu alloc] initWithTitle: [item title]];
[self setSubmenu: submenu forItem: item];
[submenu fillWithWidgetValue: wv->contents];
@@ -723,6 +655,8 @@ ns_activate_menubar (struct frame *f)
}
}
+ needsUpdate = NO;
+
#ifdef NS_IMPL_GNUSTEP
if ([[self window] isVisible])
[self sizeToFit];
@@ -731,13 +665,13 @@ ns_activate_menubar (struct frame *f)
/* Adds an empty submenu and returns it. */
-- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f
+- (EmacsMenu *)addSubmenuWithTitle: (const char *)title
{
NSString *titleStr = [NSString stringWithUTF8String: title];
NSMenuItem *item = [self addItemWithTitle: titleStr
action: (SEL)nil /*@selector (menuDown:) */
keyEquivalent: @""];
- EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f];
+ EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr];
[self setSubmenu: submenu forItem: item];
[submenu release];
return submenu;
@@ -1022,15 +956,12 @@ update_frame_tool_bar (struct frame *f)
int i, k = 0;
EmacsView *view = FRAME_NS_VIEW (f);
EmacsToolbar *toolbar = [view toolbar];
- int oldh;
NSTRACE ("update_frame_tool_bar");
if (view == nil || toolbar == nil) return;
block_input ();
- oldh = FRAME_TOOLBAR_HEIGHT (f);
-
#ifdef NS_IMPL_COCOA
[toolbar clearActive];
#else
@@ -1881,12 +1812,6 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
void
syms_of_nsmenu (void)
{
-#ifndef NS_IMPL_COCOA
- /* Don't know how to keep track of this in Next/Open/GNUstep. Always
- update menus there. */
- trackingMenu = 1;
- PDUMPER_REMEMBER_SCALAR (trackingMenu);
-#endif
defsubr (&Sns_reset_menu);
defsubr (&Smenu_or_popup_active_p);
diff --git a/src/nsselect.m b/src/nsselect.m
index 95fce4d0f78..27db9248e46 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -1,5 +1,5 @@
/* NeXT/Open/GNUstep / macOS Cocoa selection processing for emacs.
- Copyright (C) 1993-1994, 2005-2006, 2008-2020 Free Software
+ Copyright (C) 1993-1994, 2005-2006, 2008-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/nsterm.h b/src/nsterm.h
index 94472ec1070..3fb64494f76 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1,5 +1,5 @@
/* Definitions and headers for communication with NeXT/Open/GNUstep API.
- Copyright (C) 1989, 1993, 2005, 2008-2020 Free Software Foundation,
+ Copyright (C) 1989, 1993, 2005, 2008-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
@@ -414,6 +414,7 @@ typedef id instancetype;
========================================================================== */
@class EmacsToolbar;
+@class EmacsSurface;
#ifdef NS_IMPL_COCOA
@interface EmacsView : NSView <NSTextInput, NSWindowDelegate>
@@ -435,7 +436,7 @@ typedef id instancetype;
BOOL fs_is_native;
BOOL in_fullscreen_transition;
#ifdef NS_DRAW_TO_BUFFER
- CGContextRef drawingBuffer;
+ EmacsSurface *surface;
#endif
@public
struct frame *emacsframe;
@@ -478,7 +479,7 @@ typedef id instancetype;
#ifdef NS_DRAW_TO_BUFFER
- (void)focusOnDrawingBuffer;
-- (void)createDrawingBuffer;
+- (void)unfocusDrawingBuffer;
#endif
- (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect;
@@ -513,25 +514,17 @@ typedef id instancetype;
========================================================================== */
-#ifdef NS_IMPL_COCOA
@interface EmacsMenu : NSMenu <NSMenuDelegate>
-#else
-@interface EmacsMenu : NSMenu
-#endif
{
- struct frame *frame;
- unsigned long keyEquivModMask;
+ BOOL needsUpdate;
}
-- (instancetype)initWithTitle: (NSString *)title frame: (struct frame *)f;
-- (void)setFrame: (struct frame *)f;
- (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
-- (NSString *)parseKeyEquiv: (const char *)key;
-- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr;
+- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr
+ attributes: (NSDictionary *)attributes;
- (void)fillWithWidgetValue: (void *)wvptr;
-- (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f;
-- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f;
-- (void) clear;
+- (EmacsMenu *)addSubmenuWithTitle: (const char *)title;
+- (void) removeAllItems;
- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
keymaps: (bool)keymaps;
@end
@@ -712,6 +705,25 @@ typedef id instancetype;
+ (CGFloat)scrollerWidth;
@end
+#ifdef NS_DRAW_TO_BUFFER
+@interface EmacsSurface : NSObject
+{
+ NSMutableArray *cache;
+ NSSize size;
+ CGColorSpaceRef colorSpace;
+ IOSurfaceRef currentSurface;
+ IOSurfaceRef lastSurface;
+ CGContextRef context;
+}
+- (id) initWithSize: (NSSize)s ColorSpace: (CGColorSpaceRef)cs;
+- (void) dealloc;
+- (NSSize) getSize;
+- (CGContextRef) getContext;
+- (void) releaseContext;
+- (IOSurfaceRef) getSurface;
+@end
+#endif
+
/* ==========================================================================
@@ -1130,8 +1142,6 @@ extern int ns_lisp_to_color (Lisp_Object color, NSColor **col);
extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f);
extern unsigned long ns_index_color (NSColor *color, struct frame *f);
extern const char *ns_get_pending_menu_title (void);
-extern void ns_check_menu_open (NSMenu *menu);
-extern void ns_check_pending_open_menu (void);
#endif
/* Implemented in nsfns, published in nsterm. */
diff --git a/src/nsterm.m b/src/nsterm.m
index 2a117a07801..a4ee1476933 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1,6 +1,6 @@
/* NeXT/Open/GNUstep / macOS communication module. -*- coding: utf-8 -*-
-Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2020 Free Software
+Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
@@ -72,6 +72,10 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
#include <Carbon/Carbon.h>
#endif
+#ifdef NS_DRAW_TO_BUFFER
+#include <IOSurface/IOSurface.h>
+#endif
+
static EmacsMenu *dockMenu;
#ifdef NS_IMPL_COCOA
static EmacsMenu *mainMenu;
@@ -310,24 +314,6 @@ static struct {
NULL, 0, 0
};
-#ifdef NS_IMPL_COCOA
-/*
- * State for pending menu activation:
- * MENU_NONE Normal state
- * MENU_PENDING A menu has been clicked on, but has been canceled so we can
- * run lisp to update the menu.
- * MENU_OPENING Menu is up to date, and the click event is redone so the menu
- * will open.
- */
-#define MENU_NONE 0
-#define MENU_PENDING 1
-#define MENU_OPENING 2
-static int menu_will_open_state = MENU_NONE;
-
-/* Saved position for menu click. */
-static CGPoint menu_mouse_point;
-#endif
-
/* Convert modifiers in a NeXTstep event to emacs style modifiers. */
#define NS_FUNCTION_KEY_MASK 0x800000
#define NSLeftControlKeyMask (0x000001 | NSEventModifierFlagControl)
@@ -1165,7 +1151,7 @@ ns_update_end (struct frame *f)
if ([FRAME_NS_VIEW (f) wantsUpdateLayer])
{
#endif
- [NSGraphicsContext setCurrentContext:nil];
+ [FRAME_NS_VIEW (f) unfocusDrawingBuffer];
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
}
else
@@ -1273,6 +1259,8 @@ ns_unfocus (struct frame *f)
if ([FRAME_NS_VIEW (f) wantsUpdateLayer])
{
#endif
+ if (! ns_updating_frame)
+ [FRAME_NS_VIEW (f) unfocusDrawingBuffer];
[FRAME_NS_VIEW (f) setNeedsDisplay:YES];
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
}
@@ -3404,6 +3392,8 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
/* Prevent the cursor from being drawn outside the text area. */
r = NSIntersectionRect (r, ns_row_rect (w, glyph_row, TEXT_AREA));
+ ns_focus (f, &r, 1);
+
face = FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id);
if (face && NS_FACE_BACKGROUND (face)
== ns_index_color (FRAME_CURSOR_COLOR (f), f))
@@ -3414,8 +3404,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
else
[FRAME_CURSOR_COLOR (f) set];
- ns_focus (f, &r, 1);
-
switch (cursor_type)
{
case DEFAULT_CURSOR:
@@ -4607,79 +4595,6 @@ check_native_fs ()
}
#endif
-/* GNUstep does not have cancelTracking. */
-#ifdef NS_IMPL_COCOA
-/* Check if menu open should be canceled or continued as normal. */
-void
-ns_check_menu_open (NSMenu *menu)
-{
- /* Click in menu bar? */
- NSArray *a = [[NSApp mainMenu] itemArray];
- int i;
- BOOL found = NO;
-
- if (menu == nil) // Menu tracking ended.
- {
- if (menu_will_open_state == MENU_OPENING)
- menu_will_open_state = MENU_NONE;
- return;
- }
-
- for (i = 0; ! found && i < [a count]; i++)
- found = menu == [[a objectAtIndex:i] submenu];
- if (found)
- {
- if (menu_will_open_state == MENU_NONE && emacs_event)
- {
- NSEvent *theEvent = [NSApp currentEvent];
- struct frame *emacsframe = SELECTED_FRAME ();
-
- /* On macOS, the following can cause an event loop when the
- Spotlight for Help search field is populated. Avoid this by
- not postponing mouse drag and non-user-generated mouse down
- events (Bug#31371). */
- if (([theEvent type] == NSEventTypeLeftMouseDown)
- && [theEvent eventNumber])
- {
- [menu cancelTracking];
- menu_will_open_state = MENU_PENDING;
- emacs_event->kind = MENU_BAR_ACTIVATE_EVENT;
- EV_TRAILER (theEvent);
-
- CGEventRef ourEvent = CGEventCreate (NULL);
- menu_mouse_point = CGEventGetLocation (ourEvent);
- CFRelease (ourEvent);
- }
- }
- else if (menu_will_open_state == MENU_OPENING)
- {
- menu_will_open_state = MENU_NONE;
- }
- }
-}
-
-/* Redo saved menu click if state is MENU_PENDING. */
-void
-ns_check_pending_open_menu ()
-{
- if (menu_will_open_state == MENU_PENDING)
- {
- CGEventSourceRef source
- = CGEventSourceCreate (kCGEventSourceStateHIDSystemState);
-
- CGEventRef event = CGEventCreateMouseEvent (source,
- kCGEventLeftMouseDown,
- menu_mouse_point,
- kCGMouseButtonLeft);
- CGEventSetType (event, kCGEventLeftMouseDown);
- CGEventPost (kCGHIDEventTap, event);
- CFRelease (event);
- CFRelease (source);
-
- menu_will_open_state = MENU_OPENING;
- }
-}
-#endif /* NS_IMPL_COCOA */
static int
ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
@@ -4788,7 +4703,8 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
return -1;
}
- for (k = 0; k < nfds+1; k++)
+ eassert (nfds <= FD_SETSIZE);
+ for (k = 0; k < nfds; k++)
{
if (readfds && FD_ISSET(k, readfds)) ++nr;
if (writefds && FD_ISSET(k, writefds)) ++nr;
@@ -5164,15 +5080,13 @@ ns_judge_scroll_bars (struct frame *f)
id view;
EmacsView *eview = FRAME_NS_VIEW (f);
NSArray *subviews = [[eview superview] subviews];
- BOOL removed = NO;
NSTRACE ("ns_judge_scroll_bars");
for (i = [subviews count]-1; i >= 0; --i)
{
view = [subviews objectAtIndex: i];
if (![view isKindOfClass: [EmacsScroller class]]) continue;
- if ([view judge])
- removed = YES;
+ [view judge];
}
}
@@ -5416,7 +5330,6 @@ ns_create_terminal (struct ns_display_info *dpyinfo)
terminal->set_new_font_hook = ns_new_font;
terminal->implicit_set_name_hook = ns_implicitly_set_name;
terminal->menu_show_hook = ns_menu_show;
- terminal->activate_menubar_hook = ns_activate_menubar;
terminal->popup_dialog_hook = ns_popup_dialog;
terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar;
terminal->set_horizontal_scroll_bar_hook = ns_set_horizontal_scroll_bar;
@@ -5661,15 +5574,6 @@ ns_term_init (Lisp_Object display_name)
[NSApp setServicesMenu: svcsMenu];
/* Needed at least on Cocoa, to get dock menu to show windows */
[NSApp setWindowsMenu: [[NSMenu alloc] init]];
-
- [[NSNotificationCenter defaultCenter]
- addObserver: mainMenu
- selector: @selector (trackingNotification:)
- name: NSMenuDidBeginTrackingNotification object: mainMenu];
- [[NSNotificationCenter defaultCenter]
- addObserver: mainMenu
- selector: @selector (trackingNotification:)
- name: NSMenuDidEndTrackingNotification object: mainMenu];
}
#endif /* macOS menu setup */
@@ -6367,7 +6271,7 @@ not_in_argv (NSString *arg)
object:nil];
#ifdef NS_DRAW_TO_BUFFER
- CGContextRelease (drawingBuffer);
+ [surface release];
#endif
[toolbar release];
@@ -7390,8 +7294,9 @@ not_in_argv (NSString *arg)
if ([self wantsUpdateLayer])
{
CGFloat scale = [[self window] backingScaleFactor];
- int oldw = (CGFloat)CGBitmapContextGetWidth (drawingBuffer) / scale;
- int oldh = (CGFloat)CGBitmapContextGetHeight (drawingBuffer) / scale;
+ NSSize size = [surface getSize];
+ int oldw = size.width / scale;
+ int oldh = size.height / scale;
NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
@@ -7401,6 +7306,9 @@ not_in_argv (NSString *arg)
NSTRACE_MSG ("No change");
return;
}
+
+ [surface release];
+ surface = nil;
}
#endif
@@ -7413,9 +7321,6 @@ not_in_argv (NSString *arg)
FRAME_PIXEL_TO_TEXT_HEIGHT (emacsframe, newh),
0, YES, 0, 1);
-#ifdef NS_DRAW_TO_BUFFER
- [self createDrawingBuffer];
-#endif
SET_FRAME_GARBAGED (emacsframe);
cancel_mouse_face (emacsframe);
}
@@ -7686,10 +7591,6 @@ not_in_argv (NSString *arg)
[NSApp registerServicesMenuSendTypes: ns_send_types
returnTypes: [NSArray array]];
-#ifdef NS_DRAW_TO_BUFFER
- [self createDrawingBuffer];
-#endif
-
/* Set up view resize notifications. */
[self setPostsFrameChangedNotifications:YES];
[[NSNotificationCenter defaultCenter]
@@ -8409,45 +8310,41 @@ not_in_argv (NSString *arg)
#ifdef NS_DRAW_TO_BUFFER
-- (void)createDrawingBuffer
- /* Create and store a new CGGraphicsContext for Emacs to draw into.
-
- We can't do this in GNUstep as there's no equivalent, so under
- GNUstep we retain the old method of drawing direct to the
- EmacsView. */
+- (void)focusOnDrawingBuffer
{
- NSTRACE ("EmacsView createDrawingBuffer]");
+ CGFloat scale = [[self window] backingScaleFactor];
- if (! [self wantsUpdateLayer])
- return;
+ NSTRACE ("[EmacsView focusOnDrawingBuffer]");
- NSGraphicsContext *screen;
- CGColorSpaceRef colorSpace = [[[self window] colorSpace] CGColorSpace];
- CGFloat scale = [[self window] backingScaleFactor];
- NSRect frame = [self frame];
+ if (! surface)
+ {
+ NSRect frame = [self frame];
+ NSSize s = NSMakeSize (NSWidth (frame) * scale, NSHeight (frame) * scale);
- if (drawingBuffer != nil)
- CGContextRelease (drawingBuffer);
+ surface = [[EmacsSurface alloc] initWithSize:s
+ ColorSpace:[[[self window] colorSpace]
+ CGColorSpace]];
+ }
- drawingBuffer = CGBitmapContextCreate (nil, NSWidth (frame) * scale, NSHeight (frame) * scale,
- 8, 0, colorSpace,
- kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
+ CGContextRef context = [surface getContext];
- /* This fixes the scale to match the backing scale factor, and flips the image. */
- CGContextTranslateCTM(drawingBuffer, 0, NSHeight (frame) * scale);
- CGContextScaleCTM(drawingBuffer, scale, -scale);
+ CGContextTranslateCTM(context, 0, [surface getSize].height);
+ CGContextScaleCTM(context, scale, -scale);
+
+ [NSGraphicsContext
+ setCurrentContext:[NSGraphicsContext
+ graphicsContextWithCGContext:context
+ flipped:YES]];
}
-- (void)focusOnDrawingBuffer
+- (void)unfocusDrawingBuffer
{
- NSTRACE ("EmacsView focusOnDrawingBuffer]");
+ NSTRACE ("[EmacsView unfocusDrawingBuffer]");
- NSGraphicsContext *buf =
- [NSGraphicsContext
- graphicsContextWithCGContext:drawingBuffer flipped:YES];
-
- [NSGraphicsContext setCurrentContext:buf];
+ [NSGraphicsContext setCurrentContext:nil];
+ [surface releaseContext];
+ [self setNeedsDisplay:YES];
}
@@ -8456,11 +8353,11 @@ not_in_argv (NSString *arg)
{
NSTRACE ("EmacsView windowDidChangeBackingProperties:]");
- if (! [self wantsUpdateLayer])
- return;
-
NSRect frame = [self frame];
- [self createDrawingBuffer];
+
+ [surface release];
+ surface = nil;
+
ns_clear_frame (emacsframe);
expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
}
@@ -8478,33 +8375,28 @@ not_in_argv (NSString *arg)
if ([self wantsUpdateLayer])
{
#endif
- CGImageRef copy;
- NSRect frame = [self frame];
- NSAffineTransform *setOrigin = [NSAffineTransform transform];
-
- [[NSGraphicsContext currentContext] saveGraphicsState];
-
- /* Set the clipping before messing with the buffer's
- orientation. */
- NSRectClip (dstRect);
-
- /* Unflip the buffer as the copied image will be unflipped, and
- offset the top left so when we draw back into the buffer the
- correct part of the image is drawn. */
- CGContextScaleCTM(drawingBuffer, 1, -1);
- CGContextTranslateCTM(drawingBuffer,
- NSMinX (dstRect) - NSMinX (srcRect),
- -NSHeight (frame) - (NSMinY (dstRect) - NSMinY (srcRect)));
-
- /* Take a copy of the buffer and then draw it back to the buffer,
- limited by the clipping rectangle. */
- copy = CGBitmapContextCreateImage (drawingBuffer);
- CGContextDrawImage (drawingBuffer, frame, copy);
-
- CGImageRelease (copy);
-
- [[NSGraphicsContext currentContext] restoreGraphicsState];
- [self setNeedsDisplayInRect:dstRect];
+ double scale = [[self window] backingScaleFactor];
+ CGContextRef context = [[NSGraphicsContext currentContext] CGContext];
+ int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
+ void *pixels = CGBitmapContextGetData (context);
+ int rowSize = CGBitmapContextGetBytesPerRow (context);
+ int srcRowSize = NSWidth (srcRect) * scale * bpp;
+ void *srcPixels = pixels + (int)(NSMinY (srcRect) * scale * rowSize
+ + NSMinX (srcRect) * scale * bpp);
+ void *dstPixels = pixels + (int)(NSMinY (dstRect) * scale * rowSize
+ + NSMinX (dstRect) * scale * bpp);
+
+ if (NSIntersectsRect (srcRect, dstRect)
+ && NSMinY (srcRect) < NSMinY (dstRect))
+ for (int y = NSHeight (srcRect) * scale - 1 ; y >= 0 ; y--)
+ memmove (dstPixels + y * rowSize,
+ srcPixels + y * rowSize,
+ srcRowSize);
+ else
+ for (int y = 0 ; y < NSHeight (srcRect) * scale ; y++)
+ memmove (dstPixels + y * rowSize,
+ srcPixels + y * rowSize,
+ srcRowSize);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
}
@@ -8545,9 +8437,12 @@ not_in_argv (NSString *arg)
{
NSTRACE ("[EmacsView updateLayer]");
- CGImageRef contentsImage = CGBitmapContextCreateImage(drawingBuffer);
- [[self layer] setContents:(id)contentsImage];
- CGImageRelease(contentsImage);
+ /* This can fail to update the screen if the same surface is
+ provided twice in a row, even if its contents have changed.
+ There's a private method, -[CALayer setContentsChanged], that we
+ could use to force it, but we shouldn't often get the same
+ surface twice in a row. */
+ [[self layer] setContents:(id)[surface getSurface]];
}
#endif
@@ -9590,6 +9485,210 @@ not_in_argv (NSString *arg)
@end /* EmacsScroller */
+#ifdef NS_DRAW_TO_BUFFER
+
+/* ==========================================================================
+
+ A class to handle the screen buffer.
+
+ ========================================================================== */
+
+@implementation EmacsSurface
+
+
+/* An IOSurface is a pixel buffer that is efficiently copied to VRAM
+ for display. In order to use an IOSurface we must first lock it,
+ write to it, then unlock it. At this point it is transferred to
+ VRAM and if we modify it during this transfer we may see corruption
+ of the output. To avoid this problem we can check if the surface
+ is "in use", and if it is then avoid using it. Unfortunately to
+ avoid writing to a surface that's in use, but still maintain the
+ ability to draw to the screen at any time, we need to keep a cache
+ of multiple surfaces that we can use at will.
+
+ The EmacsSurface class maintains this cache of surfaces, and
+ handles the conversion to a CGGraphicsContext that AppKit can use
+ to draw on.
+
+ The cache is simple: if a free surface is found it is removed from
+ the cache and set as the "current" surface. Once Emacs is done
+ with drawing to the current surface, the previous surface that was
+ drawn to is added to the cache for reuse, and the current one is
+ set as the last surface. If no free surfaces are found in the
+ cache then a new one is created.
+
+ When AppKit wants to update the screen, we provide it with the last
+ surface, as that has the most recent data.
+
+ FIXME: It is possible for the cache to grow if Emacs draws faster
+ than the surfaces can be drawn to the screen, so there should
+ probably be some sort of pruning job that removes excess
+ surfaces. */
+
+
+- (id) initWithSize: (NSSize)s
+ ColorSpace: (CGColorSpaceRef)cs
+{
+ NSTRACE ("[EmacsSurface initWithSize:ColorSpace:]");
+
+ [super init];
+
+ cache = [[NSMutableArray arrayWithCapacity:3] retain];
+ size = s;
+ colorSpace = cs;
+
+ return self;
+}
+
+
+- (void) dealloc
+{
+ if (context)
+ CGContextRelease (context);
+
+ if (currentSurface)
+ CFRelease (currentSurface);
+ if (lastSurface)
+ CFRelease (lastSurface);
+
+ for (id object in cache)
+ CFRelease ((IOSurfaceRef)object);
+
+ [cache removeAllObjects];
+
+ [super dealloc];
+}
+
+
+/* Return the size values our cached data is using. */
+- (NSSize) getSize
+{
+ return size;
+}
+
+
+/* Return a CGContextRef that can be used for drawing to the screen.
+ This must ALWAYS be paired with a call to releaseContext, and the
+ calls cannot be nested. */
+- (CGContextRef) getContext
+{
+ IOSurfaceRef surface = NULL;
+
+ NSTRACE ("[EmacsSurface getContextWithSize:]");
+ NSTRACE_MSG (@"IOSurface count: %lu", [cache count] + (lastSurface ? 1 : 0));
+
+ for (id object in cache)
+ {
+ if (!IOSurfaceIsInUse ((IOSurfaceRef)object))
+ {
+ surface = (IOSurfaceRef)object;
+ [cache removeObject:object];
+ break;
+ }
+ }
+
+ if (!surface)
+ {
+ int bytesPerRow = IOSurfaceAlignProperty (kIOSurfaceBytesPerRow,
+ size.width * 4);
+
+ surface = IOSurfaceCreate
+ ((CFDictionaryRef)@{(id)kIOSurfaceWidth:[NSNumber numberWithInt:size.width],
+ (id)kIOSurfaceHeight:[NSNumber numberWithInt:size.height],
+ (id)kIOSurfaceBytesPerRow:[NSNumber numberWithInt:bytesPerRow],
+ (id)kIOSurfaceBytesPerElement:[NSNumber numberWithInt:4],
+ (id)kIOSurfacePixelFormat:[NSNumber numberWithUnsignedInt:'BGRA']});
+ }
+
+ IOReturn lockStatus = IOSurfaceLock (surface, 0, nil);
+ if (lockStatus != kIOReturnSuccess)
+ NSLog (@"Failed to lock surface: %x", lockStatus);
+
+ [self copyContentsTo:surface];
+
+ currentSurface = surface;
+
+ context = CGBitmapContextCreate (IOSurfaceGetBaseAddress (currentSurface),
+ IOSurfaceGetWidth (currentSurface),
+ IOSurfaceGetHeight (currentSurface),
+ 8,
+ IOSurfaceGetBytesPerRow (currentSurface),
+ colorSpace,
+ (kCGImageAlphaPremultipliedFirst
+ | kCGBitmapByteOrder32Host));
+ return context;
+}
+
+
+/* Releases the CGGraphicsContext and unlocks the associated
+ IOSurface, so it will be sent to VRAM. */
+- (void) releaseContext
+{
+ NSTRACE ("[EmacsSurface releaseContextAndGetSurface]");
+
+ CGContextRelease (context);
+ context = NULL;
+
+ IOReturn lockStatus = IOSurfaceUnlock (currentSurface, 0, nil);
+ if (lockStatus != kIOReturnSuccess)
+ NSLog (@"Failed to unlock surface: %x", lockStatus);
+
+ /* Put lastSurface back on the end of the cache. It may not have
+ been displayed on the screen yet, but we probably want the new
+ data and not some stale data anyway. */
+ if (lastSurface)
+ [cache addObject:(id)lastSurface];
+ lastSurface = currentSurface;
+ currentSurface = NULL;
+}
+
+
+/* Get the IOSurface that we want to draw to the screen. */
+- (IOSurfaceRef) getSurface
+{
+ /* lastSurface always contains the most up-to-date and complete data. */
+ return lastSurface;
+}
+
+
+/* Copy the contents of lastSurface to DESTINATION. This is required
+ every time we want to use an IOSurface as its contents are probably
+ blanks (if it's new), or stale. */
+- (void) copyContentsTo: (IOSurfaceRef) destination
+{
+ IOReturn lockStatus;
+ void *sourceData, *destinationData;
+ int numBytes = IOSurfaceGetAllocSize (destination);
+
+ NSTRACE ("[EmacsSurface copyContentsTo:]");
+
+ if (! lastSurface)
+ return;
+
+ lockStatus = IOSurfaceLock (lastSurface, kIOSurfaceLockReadOnly, nil);
+ if (lockStatus != kIOReturnSuccess)
+ NSLog (@"Failed to lock source surface: %x", lockStatus);
+
+ sourceData = IOSurfaceGetBaseAddress (lastSurface);
+ destinationData = IOSurfaceGetBaseAddress (destination);
+
+ /* Since every IOSurface should have the exact same settings, a
+ memcpy seems like the fastest way to copy the data from one to
+ the other. */
+ memcpy (destinationData, sourceData, numBytes);
+
+ lockStatus = IOSurfaceUnlock (lastSurface, kIOSurfaceLockReadOnly, nil);
+ if (lockStatus != kIOReturnSuccess)
+ NSLog (@"Failed to unlock source surface: %x", lockStatus);
+}
+
+
+@end /* EmacsSurface */
+
+
+#endif
+
+
#ifdef NS_IMPL_GNUSTEP
/* Dummy class to get rid of startup warnings. */
@implementation EmacsDocument
diff --git a/src/nsxwidget.h b/src/nsxwidget.h
index dcdb26cb34c..9cc90b0d09a 100644
--- a/src/nsxwidget.h
+++ b/src/nsxwidget.h
@@ -1,6 +1,6 @@
/* Header for NS Cocoa part of xwidget and webkit widget.
-Copyright (C) 2019-2020 Free Software Foundation, Inc.
+Copyright (C) 2019-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/nsxwidget.m b/src/nsxwidget.m
index 915fd8b59ce..eff5f0a9ce8 100644
--- a/src/nsxwidget.m
+++ b/src/nsxwidget.m
@@ -1,6 +1,6 @@
/* NS Cocoa part implementation of xwidget and webkit widget.
-Copyright (C) 2019-2020 Free Software Foundation, Inc.
+Copyright (C) 2019-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/pdumper.c b/src/pdumper.c
index a9c43a463db..e549478e7d7 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2018-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/pdumper.h b/src/pdumper.h
index c4baeaf8f94..24e99e22c7a 100644
--- a/src/pdumper.h
+++ b/src/pdumper.h
@@ -1,6 +1,6 @@
/* Header file for the portable dumper.
-Copyright (C) 2016, 2018-2020 Free Software Foundation, Inc.
+Copyright (C) 2016, 2018-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/print.c b/src/print.c
index 6284561921b..e7228a05f27 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1,6 +1,6 @@
/* Lisp object printing and output streams.
-Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2020 Free Software
+Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/process.c b/src/process.c
index 28ab15c9038..06d750d3368 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1,6 +1,6 @@
/* Asynchronous subprocess control for GNU Emacs.
-Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2020 Free Software
+Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
@@ -80,15 +80,6 @@ static struct rlimit nofile_limit;
#endif
-#ifdef NEED_BSDTTY
-#include <bsdtty.h>
-#endif
-
-#ifdef USG5_4
-# include <sys/stream.h>
-# include <sys/stropts.h>
-#endif
-
#ifdef HAVE_UTIL_H
#include <util.h>
#endif
@@ -465,6 +456,7 @@ add_read_fd (int fd, fd_callback func, void *data)
{
add_keyboard_wait_descriptor (fd);
+ eassert (0 <= fd && fd < FD_SETSIZE);
fd_callback_info[fd].func = func;
fd_callback_info[fd].data = data;
}
@@ -485,6 +477,7 @@ static void
add_process_read_fd (int fd)
{
add_non_keyboard_read_fd (fd);
+ eassert (0 <= fd && fd < FD_SETSIZE);
fd_callback_info[fd].flags |= PROCESS_FD;
}
@@ -495,6 +488,7 @@ delete_read_fd (int fd)
{
delete_keyboard_wait_descriptor (fd);
+ eassert (0 <= fd && fd < FD_SETSIZE);
if (fd_callback_info[fd].flags == 0)
{
fd_callback_info[fd].func = 0;
@@ -534,6 +528,7 @@ recompute_max_desc (void)
{
int fd;
+ eassert (max_desc < FD_SETSIZE);
for (fd = max_desc; fd >= 0; --fd)
{
if (fd_callback_info[fd].flags != 0)
@@ -542,6 +537,7 @@ recompute_max_desc (void)
break;
}
}
+ eassert (max_desc < FD_SETSIZE);
}
/* Stop monitoring file descriptor FD for when write is possible. */
@@ -549,6 +545,7 @@ recompute_max_desc (void)
void
delete_write_fd (int fd)
{
+ eassert (0 <= fd && fd < FD_SETSIZE);
if ((fd_callback_info[fd].flags & NON_BLOCKING_CONNECT_FD) != 0)
{
if (--num_pending_connects < 0)
@@ -571,6 +568,7 @@ compute_input_wait_mask (fd_set *mask)
int fd;
FD_ZERO (mask);
+ eassert (max_desc < FD_SETSIZE);
for (fd = 0; fd <= max_desc; ++fd)
{
if (fd_callback_info[fd].thread != NULL
@@ -593,6 +591,7 @@ compute_non_process_wait_mask (fd_set *mask)
int fd;
FD_ZERO (mask);
+ eassert (max_desc < FD_SETSIZE);
for (fd = 0; fd <= max_desc; ++fd)
{
if (fd_callback_info[fd].thread != NULL
@@ -616,6 +615,7 @@ compute_non_keyboard_wait_mask (fd_set *mask)
int fd;
FD_ZERO (mask);
+ eassert (max_desc < FD_SETSIZE);
for (fd = 0; fd <= max_desc; ++fd)
{
if (fd_callback_info[fd].thread != NULL
@@ -639,6 +639,7 @@ compute_write_mask (fd_set *mask)
int fd;
FD_ZERO (mask);
+ eassert (max_desc < FD_SETSIZE);
for (fd = 0; fd <= max_desc; ++fd)
{
if (fd_callback_info[fd].thread != NULL
@@ -660,6 +661,7 @@ clear_waiting_thread_info (void)
{
int fd;
+ eassert (max_desc < FD_SETSIZE);
for (fd = 0; fd <= max_desc; ++fd)
{
if (fd_callback_info[fd].waiting_thread == current_thread)
@@ -936,8 +938,10 @@ update_processes_for_thread_death (Lisp_Object dying_thread)
struct Lisp_Process *proc = XPROCESS (process);
pset_thread (proc, Qnil);
+ eassert (proc->infd < FD_SETSIZE);
if (proc->infd >= 0)
fd_callback_info[proc->infd].thread = NULL;
+ eassert (proc->outfd < FD_SETSIZE);
if (proc->outfd >= 0)
fd_callback_info[proc->outfd].thread = NULL;
}
@@ -1378,8 +1382,10 @@ If THREAD is nil, the process is unlocked. */)
proc = XPROCESS (process);
pset_thread (proc, thread);
+ eassert (proc->infd < FD_SETSIZE);
if (proc->infd >= 0)
fd_callback_info[proc->infd].thread = tstate;
+ eassert (proc->outfd < FD_SETSIZE);
if (proc->outfd >= 0)
fd_callback_info[proc->outfd].thread = tstate;
@@ -2099,6 +2105,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
}
}
+ if (FD_SETSIZE <= inchannel || FD_SETSIZE <= outchannel)
+ report_file_errno ("Creating pipe", Qnil, EMFILE);
+
#ifndef WINDOWSNT
if (emacs_pipe (p->open_fd + READ_FROM_EXEC_MONITOR) != 0)
report_file_error ("Creating pipe", Qnil);
@@ -2108,6 +2117,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
fcntl (outchannel, F_SETFL, O_NONBLOCK);
/* Record this as an active process, with its channels. */
+ eassert (0 <= inchannel && inchannel < FD_SETSIZE);
chan_process[inchannel] = process;
p->infd = inchannel;
p->outfd = outchannel;
@@ -2194,6 +2204,8 @@ create_pty (Lisp_Object process)
if (pty_fd >= 0)
{
p->open_fd[SUBPROCESS_STDIN] = pty_fd;
+ if (FD_SETSIZE <= pty_fd)
+ report_file_errno ("Opening pty", Qnil, EMFILE);
#if ! defined (USG) || defined (USG_SUBTTY_WORKS)
/* On most USG systems it does not work to open the pty's tty here,
then close it and reopen it in the child. */
@@ -2215,6 +2227,7 @@ create_pty (Lisp_Object process)
/* Record this as an active process, with its channels.
As a result, child_setup will close Emacs's side of the pipes. */
+ eassert (0 <= pty_fd && pty_fd < FD_SETSIZE);
chan_process[pty_fd] = process;
p->infd = pty_fd;
p->outfd = pty_fd;
@@ -2300,6 +2313,9 @@ usage: (make-pipe-process &rest ARGS) */)
outchannel = p->open_fd[WRITE_TO_SUBPROCESS];
inchannel = p->open_fd[READ_FROM_SUBPROCESS];
+ if (FD_SETSIZE <= inchannel || FD_SETSIZE <= outchannel)
+ report_file_errno ("Creating pipe", Qnil, EMFILE);
+
fcntl (inchannel, F_SETFL, O_NONBLOCK);
fcntl (outchannel, F_SETFL, O_NONBLOCK);
@@ -2308,6 +2324,7 @@ usage: (make-pipe-process &rest ARGS) */)
#endif
/* Record this as an active process, with its channels. */
+ eassert (0 <= inchannel && inchannel < FD_SETSIZE);
chan_process[inchannel] = proc;
p->infd = inchannel;
p->outfd = outchannel;
@@ -2637,6 +2654,7 @@ set up yet, this function will block until socket setup has completed. */)
return Qnil;
channel = XPROCESS (process)->infd;
+ eassert (0 <= channel && channel < FD_SETSIZE);
return conv_sockaddr_to_lisp (datagram_address[channel].sa,
datagram_address[channel].len);
}
@@ -2665,6 +2683,7 @@ set up yet, this function will block until socket setup has completed. */)
channel = XPROCESS (process)->infd;
len = get_lisp_to_sockaddr_size (address, &family);
+ eassert (0 <= channel && channel < FD_SETSIZE);
if (len == 0 || datagram_address[channel].len != len)
return Qnil;
conv_lisp_to_sockaddr (family, address, datagram_address[channel].sa, len);
@@ -3039,10 +3058,13 @@ usage: (make-serial-process &rest ARGS) */)
fd = serial_open (port);
p->open_fd[SUBPROCESS_STDIN] = fd;
+ if (FD_SETSIZE <= fd)
+ report_file_errno ("Opening serial port", port, EMFILE);
p->infd = fd;
p->outfd = fd;
if (fd > max_desc)
max_desc = fd;
+ eassert (0 <= fd && fd < FD_SETSIZE);
chan_process[fd] = proc;
buffer = Fplist_get (contact, QCbuffer);
@@ -3213,6 +3235,7 @@ finish_after_tls_connection (Lisp_Object proc)
Fplist_get (contact, QChost),
Fplist_get (contact, QCservice));
+ eassert (p->outfd < FD_SETSIZE);
if (NILP (result))
{
pset_status (p, list2 (Qfailed,
@@ -3258,6 +3281,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
if (!NILP (use_external_socket_p))
{
socket_to_use = external_sock_fd;
+ eassert (socket_to_use < FD_SETSIZE);
/* Ensure we don't consume the external socket twice. */
external_sock_fd = -1;
@@ -3299,6 +3323,14 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
xerrno = errno;
continue;
}
+ /* Reject file descriptors that would be too large. */
+ if (FD_SETSIZE <= s)
+ {
+ emacs_close (s);
+ s = -1;
+ xerrno = EMFILE;
+ continue;
+ }
}
if (p->is_non_blocking_client && ! (SOCK_NONBLOCK && socket_to_use < 0))
@@ -3463,6 +3495,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
#ifdef DATAGRAM_SOCKETS
if (p->socktype == SOCK_DGRAM)
{
+ eassert (0 <= s && s < FD_SETSIZE);
if (datagram_address[s].sa)
emacs_abort ();
@@ -3527,6 +3560,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
inch = s;
outch = s;
+ eassert (0 <= inch && inch < FD_SETSIZE);
chan_process[inch] = proc;
fcntl (inch, F_SETFL, O_NONBLOCK);
@@ -3553,6 +3587,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
if (! (connecting_status (p->status)
&& EQ (XCDR (p->status), addrinfos)))
pset_status (p, Fcons (Qconnect, addrinfos));
+ eassert (0 <= inch && inch < FD_SETSIZE);
if ((fd_callback_info[inch].flags & NON_BLOCKING_CONNECT_FD) == 0)
add_non_blocking_write_fd (inch);
}
@@ -4543,12 +4578,13 @@ network_lookup_address_info_1 (Lisp_Object host, const char *service,
DEFUN ("network-lookup-address-info", Fnetwork_lookup_address_info,
Snetwork_lookup_address_info, 1, 2, 0,
- doc: /* Look up ip address info of NAME.
+ doc: /* Look up Internet Protocol (IP) address info of NAME.
Optional parameter FAMILY controls whether to look up IPv4 or IPv6
addresses. The default of nil means both, symbol `ipv4' means IPv4
only, symbol `ipv6' means IPv6 only. Returns a list of addresses, or
nil if none were found. Each address is a vector of integers, as per
-the description of ADDRESS in `make-network-process'. */)
+the description of ADDRESS in `make-network-process'. In case of
+error displays the error message. */)
(Lisp_Object name, Lisp_Object family)
{
Lisp_Object addresses = Qnil;
@@ -4620,6 +4656,7 @@ deactivate_process (Lisp_Object proc)
close_process_fd (&p->open_fd[i]);
inchannel = p->infd;
+ eassert (inchannel < FD_SETSIZE);
if (inchannel >= 0)
{
p->infd = -1;
@@ -4756,6 +4793,13 @@ server_accept_connection (Lisp_Object server, int channel)
s = accept4 (channel, &saddr.sa, &len, SOCK_CLOEXEC);
+ if (FD_SETSIZE <= s)
+ {
+ emacs_close (s);
+ s = -1;
+ errno = EMFILE;
+ }
+
if (s < 0)
{
int code = errno;
@@ -4853,6 +4897,7 @@ server_accept_connection (Lisp_Object server, int channel)
Lisp_Object name = Fformat (nargs, args);
Lisp_Object proc = make_process (name);
+ eassert (0 <= s && s < FD_SETSIZE);
chan_process[s] = proc;
fcntl (s, F_SETFL, O_NONBLOCK);
@@ -5132,6 +5177,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
break;
+ eassert (max_desc < FD_SETSIZE);
+
#if defined HAVE_GETADDRINFO_A || defined HAVE_GNUTLS
{
Lisp_Object process_list_head, aproc;
@@ -5875,6 +5922,7 @@ read_process_output (Lisp_Object proc, int channel)
{
ssize_t nbytes;
struct Lisp_Process *p = XPROCESS (proc);
+ eassert (0 <= channel && channel < FD_SETSIZE);
struct coding_system *coding = proc_decode_coding_system[channel];
int carryover = p->decoding_carryover;
ptrdiff_t readmax = clip_to_bounds (1, read_process_output_max, PTRDIFF_MAX);
@@ -6039,6 +6087,7 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars,
proc_encode_coding_system[p->outfd] surely points to a
valid memory because p->outfd will be changed once EOF is
sent to the process. */
+ eassert (p->outfd < FD_SETSIZE);
if (NILP (p->encode_coding_system) && p->outfd >= 0
&& proc_encode_coding_system[p->outfd])
{
@@ -6278,6 +6327,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
if (p->outfd < 0)
error ("Output file descriptor of %s is closed", SDATA (p->name));
+ eassert (p->outfd < FD_SETSIZE);
coding = proc_encode_coding_system[p->outfd];
Vlast_coding_system_used = CODING_ID_NAME (coding->id);
@@ -6387,6 +6437,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
/* Send this batch, using one or more write calls. */
ptrdiff_t written = 0;
int outfd = p->outfd;
+ eassert (0 <= outfd && outfd < FD_SETSIZE);
#ifdef DATAGRAM_SOCKETS
if (DATAGRAM_CHAN_P (outfd))
{
@@ -6837,6 +6888,7 @@ traffic. */)
struct Lisp_Process *p;
p = XPROCESS (process);
+ eassert (p->infd < FD_SETSIZE);
if (EQ (p->command, Qt)
&& p->infd >= 0
&& (!EQ (p->filter, Qt) || EQ (p->status, Qlisten)))
@@ -6964,6 +7016,7 @@ process has been transmitted to the serial port. */)
outfd = XPROCESS (proc)->outfd;
+ eassert (outfd < FD_SETSIZE);
if (outfd >= 0)
coding = proc_encode_coding_system[outfd];
@@ -7011,11 +7064,13 @@ process has been transmitted to the serial port. */)
p->open_fd[WRITE_TO_SUBPROCESS] = new_outfd;
p->outfd = new_outfd;
+ eassert (0 <= new_outfd && new_outfd < FD_SETSIZE);
if (!proc_encode_coding_system[new_outfd])
proc_encode_coding_system[new_outfd]
= xmalloc (sizeof (struct coding_system));
if (old_outfd >= 0)
{
+ eassert (old_outfd < FD_SETSIZE);
*proc_encode_coding_system[new_outfd]
= *proc_encode_coding_system[old_outfd];
memset (proc_encode_coding_system[old_outfd], 0,
@@ -7464,6 +7519,7 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
struct Lisp_Process *p = XPROCESS (process);
if (p->infd < 0)
return Qnil;
+ eassert (p->infd < FD_SETSIZE);
struct coding_system *coding = proc_decode_coding_system[p->infd];
return (CODING_FOR_UNIBYTE (coding) ? Qnil : Qt);
}
@@ -7497,6 +7553,7 @@ keyboard_bit_set (fd_set *mask)
{
int fd;
+ eassert (max_desc < FD_SETSIZE);
for (fd = 0; fd <= max_desc; fd++)
if (FD_ISSET (fd, mask)
&& ((fd_callback_info[fd].flags & (FOR_READ | KEYBOARD_FD))
@@ -7744,6 +7801,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
void
add_timer_wait_descriptor (int fd)
{
+ eassert (0 <= fd && fd < FD_SETSIZE);
add_read_fd (fd, timerfd_callback, NULL);
fd_callback_info[fd].flags &= ~KEYBOARD_FD;
}
@@ -7806,6 +7864,7 @@ setup_process_coding_systems (Lisp_Object process)
if (inch < 0 || outch < 0)
return;
+ eassert (0 <= inch && inch < FD_SETSIZE);
if (!proc_decode_coding_system[inch])
proc_decode_coding_system[inch] = xmalloc (sizeof (struct coding_system));
coding_system = p->decode_coding_system;
@@ -7817,6 +7876,7 @@ setup_process_coding_systems (Lisp_Object process)
}
setup_coding_system (coding_system, proc_decode_coding_system[inch]);
+ eassert (0 <= outch && outch < FD_SETSIZE);
if (!proc_encode_coding_system[outch])
proc_encode_coding_system[outch] = xmalloc (sizeof (struct coding_system));
setup_coding_system (p->encode_coding_system,
diff --git a/src/process.h b/src/process.h
index a783a31cb86..d041ada5867 100644
--- a/src/process.h
+++ b/src/process.h
@@ -1,5 +1,5 @@
/* Definitions for asynchronous process control in GNU Emacs.
- Copyright (C) 1985, 1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/profiler.c b/src/profiler.c
index 9d2e828f221..21ae2447aa4 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -1,6 +1,6 @@
/* Profiler implementation.
-Copyright (C) 2012-2020 Free Software Foundation, Inc.
+Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/puresize.h b/src/puresize.h
index 7611f6e53f4..811d0b4d369 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -1,5 +1,5 @@
/* How much read-only Lisp storage a dumped Emacs needs.
- Copyright (C) 1993, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/ralloc.c b/src/ralloc.c
index a7cac137329..02689265f2e 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -1,5 +1,5 @@
/* Block-relocating memory allocator.
- Copyright (C) 1993, 1995, 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1995, 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 904ca0c7b95..8350e54b54a 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -1,6 +1,6 @@
/* Emacs regular expression matching and search
- Copyright (C) 1993-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/regex-emacs.h b/src/regex-emacs.h
index 354408bb2a7..027ab655580 100644
--- a/src/regex-emacs.h
+++ b/src/regex-emacs.h
@@ -1,6 +1,6 @@
/* Emacs regular expression API
- Copyright (C) 1985, 1989-1993, 1995, 2000-2020 Free Software
+ Copyright (C) 1985, 1989-1993, 1995, 2000-2021 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/src/region-cache.c b/src/region-cache.c
index 836296764d1..b75a9691b5d 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -1,6 +1,6 @@
/* Caching facts about regions of the buffer, for optimization.
-Copyright (C) 1985-1989, 1993, 1995, 2001-2020 Free Software Foundation,
+Copyright (C) 1985-1989, 1993, 1995, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/region-cache.h b/src/region-cache.h
index 46e45a2fbdb..128215718d8 100644
--- a/src/region-cache.h
+++ b/src/region-cache.h
@@ -1,6 +1,6 @@
/* Header file: Caching facts about regions of the buffer, for optimization.
-Copyright (C) 1985-1986, 1993, 1995, 2001-2020 Free Software Foundation,
+Copyright (C) 1985-1986, 1993, 1995, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/scroll.c b/src/scroll.c
index 145c256048a..9042888d1f2 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -1,6 +1,6 @@
/* Calculate what line insertion or deletion to do, and do it
-Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2020 Free Software
+Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/search.c b/src/search.c
index 50d82fd289d..c757bf3d1f2 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1,6 +1,6 @@
/* String search routines for GNU Emacs.
-Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2020 Free Software
+Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/sheap.c b/src/sheap.c
index 7d6429c532c..5401e791b07 100644
--- a/src/sheap.c
+++ b/src/sheap.c
@@ -1,7 +1,7 @@
/* simulate `sbrk' with an array in .bss, for `unexec' support for Cygwin;
complete rewrite of xemacs Cygwin `unexec' code
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
+ Copyright (C) 2004-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/sheap.h b/src/sheap.h
index 50f602a4467..f1004d6c2e5 100644
--- a/src/sheap.h
+++ b/src/sheap.h
@@ -1,6 +1,6 @@
/* Static heap allocation for GNU Emacs.
-Copyright 2016-2020 Free Software Foundation, Inc.
+Copyright 2016-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/sound.c b/src/sound.c
index f74c4769a44..e5f66f8f529 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -1,6 +1,6 @@
/* sound.c -- sound support.
-Copyright (C) 1998-1999, 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 1998-1999, 2001-2021 Free Software Foundation, Inc.
Author: Gerd Moellmann <gerd@gnu.org>
diff --git a/src/syntax.c b/src/syntax.c
index df07809aaaf..9fbf88535f3 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1,5 +1,5 @@
/* GNU Emacs routines to deal with syntax tables; also word and list parsing.
- Copyright (C) 1985, 1987, 1993-1995, 1997-1999, 2001-2020 Free
+ Copyright (C) 1985, 1987, 1993-1995, 1997-1999, 2001-2021 Free
Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/syntax.h b/src/syntax.h
index a2ec3301bab..66ee139a967 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -1,6 +1,6 @@
/* Declarations having to do with GNU Emacs syntax tables.
-Copyright (C) 1985, 1993-1994, 1997-1998, 2001-2020 Free Software
+Copyright (C) 1985, 1993-1994, 1997-1998, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/sysdep.c b/src/sysdep.c
index eeb9d184940..6ede06b1aa3 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1,5 +1,5 @@
/* Interfaces to system-dependent kernel and library entries.
- Copyright (C) 1985-1988, 1993-1995, 1999-2020 Free Software
+ Copyright (C) 1985-1988, 1993-1995, 1999-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/sysselect.h b/src/sysselect.h
index ecba1f329ee..017c02b77f4 100644
--- a/src/sysselect.h
+++ b/src/sysselect.h
@@ -1,5 +1,5 @@
/* sysselect.h - System-dependent definitions for the select function.
- Copyright (C) 1995, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/syssignal.h b/src/syssignal.h
index a3e462b5385..285a3c548ba 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -1,6 +1,6 @@
/* syssignal.h - System-dependent definitions for signals.
-Copyright (C) 1993, 1999, 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 1993, 1999, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/sysstdio.h b/src/sysstdio.h
index 461019273bd..d4df3d74567 100644
--- a/src/sysstdio.h
+++ b/src/sysstdio.h
@@ -1,6 +1,6 @@
/* Standard I/O for Emacs.
-Copyright 2013-2020 Free Software Foundation, Inc.
+Copyright 2013-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/systhread.c b/src/systhread.c
index ebd75526495..c68853cacac 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -1,5 +1,5 @@
/* System thread definitions
-Copyright (C) 2012-2020 Free Software Foundation, Inc.
+Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/systhread.h b/src/systhread.h
index 73c764a9401..0f47d7c1a8a 100644
--- a/src/systhread.h
+++ b/src/systhread.h
@@ -1,5 +1,5 @@
/* System thread definitions
-Copyright (C) 2012-2020 Free Software Foundation, Inc.
+Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/systime.h b/src/systime.h
index b59a3d1c690..08ab5bdde33 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -1,5 +1,5 @@
/* systime.h - System-dependent definitions for time manipulations.
- Copyright (C) 1993-1994, 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 2002-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/systty.h b/src/systty.h
index 43fe824123f..c19b4b35f18 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -1,5 +1,5 @@
/* systty.h - System-dependent definitions for terminals.
- Copyright (C) 1993-1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/syswait.h b/src/syswait.h
index 57b0f70eced..42e8c408549 100644
--- a/src/syswait.h
+++ b/src/syswait.h
@@ -1,5 +1,5 @@
/* Define wait system call interface for Emacs.
- Copyright (C) 1993-1995, 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-1995, 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/term.c b/src/term.c
index fee3b555751..a87f9c745ce 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1,5 +1,5 @@
/* Terminal control module for terminals described by TERMCAP
- Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2020 Free Software
+ Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/termcap.c b/src/termcap.c
index 1ace4c93103..227dbeb7d92 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -1,5 +1,5 @@
/* Work-alike for termcap, plus extra features.
- Copyright (C) 1985-1986, 1993-1995, 2000-2008, 2011, 2013-2020 Free
+ Copyright (C) 1985-1986, 1993-1995, 2000-2008, 2011, 2013-2021 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/src/termchar.h b/src/termchar.h
index c967e7d04f4..f50c1bfb6ea 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -1,5 +1,5 @@
/* Flags and parameters describing terminal's characteristics.
- Copyright (C) 1985-1986, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/termhooks.h b/src/termhooks.h
index e94959ca9a3..85a47c071b6 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -1,6 +1,6 @@
/* Parameters and display hooks for terminal devices.
-Copyright (C) 1985-1986, 1993-1994, 2001-2020 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1994, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/terminal.c b/src/terminal.c
index e3b666ba61d..b83adc596bb 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1,5 +1,5 @@
/* Functions related to terminal devices.
- Copyright (C) 2005-2020 Free Software Foundation, Inc.
+ Copyright (C) 2005-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/terminfo.c b/src/terminfo.c
index 0765996401f..15aff317f15 100644
--- a/src/terminfo.c
+++ b/src/terminfo.c
@@ -1,5 +1,5 @@
/* Interface from Emacs to terminfo.
- Copyright (C) 1985-1986, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/termopts.h b/src/termopts.h
index 5c5caeab52f..0a3dfa092fc 100644
--- a/src/termopts.h
+++ b/src/termopts.h
@@ -1,5 +1,5 @@
/* Flags and parameters describing user options for handling the terminal.
- Copyright (C) 1985-1986, 1990, 2001-2020 Free Software Foundation,
+ Copyright (C) 1985-1986, 1990, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/textprop.c b/src/textprop.c
index 0876badc873..d7d6a669232 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1,5 +1,5 @@
/* Interface code for dealing with text properties.
- Copyright (C) 1993-1995, 1997, 1999-2020 Free Software Foundation,
+ Copyright (C) 1993-1995, 1997, 1999-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/thread.c b/src/thread.c
index 7ab1e6de1fc..f74f6111486 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -1,5 +1,5 @@
/* Threading code.
-Copyright (C) 2012-2020 Free Software Foundation, Inc.
+Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/thread.h b/src/thread.h
index 9697e49f09f..cf3ce922c46 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -1,5 +1,5 @@
/* Thread definitions
-Copyright (C) 2012-2020 Free Software Foundation, Inc.
+Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/timefns.c b/src/timefns.c
index 4a28f707a3b..f0e2e97f555 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1,6 +1,6 @@
/* Timestamp functions for Emacs
-Copyright (C) 1985-1987, 1989, 1993-2020 Free Software Foundation, Inc.
+Copyright (C) 1985-1987, 1989, 1993-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/tparam.c b/src/tparam.c
index 6afef2ef849..c89a9bde9a0 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -1,5 +1,5 @@
/* Merge parameters into a termcap entry string.
- Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2020 Free
+ Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2021 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/src/tparam.h b/src/tparam.h
index 5cab1479ade..893c3cac12c 100644
--- a/src/tparam.h
+++ b/src/tparam.h
@@ -1,6 +1,6 @@
/* Interface definitions for termcap entries.
-Copyright (C) 2011-2020 Free Software Foundation, Inc.
+Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/undo.c b/src/undo.c
index 0fcd8af240a..2db401ebc7e 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -1,5 +1,5 @@
/* undo handling for GNU Emacs.
- Copyright (C) 1990, 1993-1994, 2000-2020 Free Software Foundation,
+ Copyright (C) 1990, 1993-1994, 2000-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/unexaix.c b/src/unexaix.c
index 0e57b25c51d..949750f4933 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -1,5 +1,5 @@
/* Dump an executable file.
- Copyright (C) 1985-1988, 1999, 2001-2020 Free Software Foundation,
+ Copyright (C) 1985-1988, 1999, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 3daa9d149b1..c4b2f6ebea7 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1985-1988, 1992-1994, 2001-2020 Free Software
+/* Copyright (C) 1985-1988, 1992-1994, 2001-2021 Free Software
* Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/unexcw.c b/src/unexcw.c
index 83efbc74bb1..7a80b05963b 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -1,7 +1,7 @@
/* unexec() support for Cygwin;
complete rewrite of xemacs Cygwin unexec() code
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
+ Copyright (C) 2004-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/unexelf.c b/src/unexelf.c
index 2506cc61175..b5cded5cfda 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1985-1988, 1990, 1992, 1999-2020 Free Software
+/* Copyright (C) 1985-1988, 1990, 1992, 1999-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 8cf68bb92e1..f226f1b6c19 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -1,5 +1,5 @@
/* Dump Emacs in Mach-O format for use on macOS.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/unexw32.c b/src/unexw32.c
index 3c0f33557dd..1c60e3da0ee 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -1,5 +1,5 @@
/* unexec for GNU Emacs on Windows NT.
- Copyright (C) 1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/vm-limit.c b/src/vm-limit.c
index 1a07ecfb323..b9058d04352 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -1,5 +1,5 @@
/* Functions for memory limit warnings.
- Copyright (C) 1990, 1992, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1992, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w16select.c b/src/w16select.c
index 75933526db1..37239137cf0 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -1,6 +1,6 @@
/* 16-bit Windows Selection processing for emacs on MS-Windows
-Copyright (C) 1996-1997, 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 1996-1997, 2001-2021 Free Software Foundation, Inc.
Author: Dale P. Smith <dpsm@en.com>
diff --git a/src/w32.c b/src/w32.c
index 0d38eae7fea..202acb7d5fd 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1,6 +1,6 @@
/* Utility and Unix shadow routines for GNU Emacs on the Microsoft Windows API.
-Copyright (C) 1994-1995, 2000-2020 Free Software Foundation, Inc.
+Copyright (C) 1994-1995, 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -8667,6 +8667,11 @@ pipe2 (int * phandles, int pipe2_flags)
{
_close (phandles[0]);
_close (phandles[1]);
+ /* Since we close the handles, set them to -1, so as to
+ avoid an assertion violation if the caller then tries to
+ close the handle again (emacs_close will abort otherwise
+ if errno is EBADF). */
+ phandles[0] = phandles[1] = -1;
errno = EMFILE;
rc = -1;
}
diff --git a/src/w32.h b/src/w32.h
index e23ea6a675d..3f8eb250cc1 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -2,7 +2,7 @@
#define EMACS_W32_H
/* Support routines for the NT version of Emacs.
- Copyright (C) 1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32common.h b/src/w32common.h
index bd01fd40401..90e88876aba 100644
--- a/src/w32common.h
+++ b/src/w32common.h
@@ -1,5 +1,5 @@
/* Common functions for Microsoft Windows builds of Emacs
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32console.c b/src/w32console.c
index 72df888b749..cb9e288e880 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -1,5 +1,5 @@
/* Terminal hooks for GNU Emacs on the Microsoft Windows API.
- Copyright (C) 1992, 1999, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1999, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32cygwinx.c b/src/w32cygwinx.c
index 2d729834600..b58febc4e04 100644
--- a/src/w32cygwinx.c
+++ b/src/w32cygwinx.c
@@ -1,6 +1,6 @@
/* Common functions for the Microsoft Windows and Cygwin builds.
-Copyright (C) 2018-2020 Free Software Foundation, Inc.
+Copyright (C) 2018-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32fns.c b/src/w32fns.c
index 36bee0676ba..c1e18ff7fad 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1,6 +1,6 @@
/* Graphical user interface functions for the Microsoft Windows API.
-Copyright (C) 1989, 1992-2020 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32font.c b/src/w32font.c
index c1d5f25d251..6b9ab0468cd 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -1,5 +1,5 @@
/* Font backend for the Microsoft Windows API.
- Copyright (C) 2007-2020 Free Software Foundation, Inc.
+ Copyright (C) 2007-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32font.h b/src/w32font.h
index a76f8c30cec..cf2bf3c2421 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -1,5 +1,5 @@
/* Shared GDI and Uniscribe Font backend declarations for the Windows API.
- Copyright (C) 2007-2020 Free Software Foundation, Inc.
+ Copyright (C) 2007-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32gui.h b/src/w32gui.h
index f6cfa9fb87e..d2c34bd00a9 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -1,5 +1,5 @@
/* Definitions and headers for communication on the Microsoft Windows API.
- Copyright (C) 1995, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32heap.c b/src/w32heap.c
index a72bed62caf..e002f72608a 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -1,5 +1,5 @@
/* Heap management routines for GNU Emacs on the Microsoft Windows API.
- Copyright (C) 1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32heap.h b/src/w32heap.h
index 5c062671494..0b34f8a356a 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -1,5 +1,5 @@
/* Heap management routines (including unexec) for GNU Emacs on Windows NT.
- Copyright (C) 1994, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32image.c b/src/w32image.c
index 70b2eb29b87..cc1a6eba22b 100644
--- a/src/w32image.c
+++ b/src/w32image.c
@@ -1,6 +1,6 @@
/* Implementation of MS-Windows native image API via the GDI+ library.
-Copyright (C) 2020 Free Software Foundation, Inc.
+Copyright (C) 2020-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 7023e7144a3..1a80a001974 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -1,5 +1,5 @@
/* Input event support for Emacs on the Microsoft Windows API.
- Copyright (C) 1992-1993, 1995, 2001-2020 Free Software Foundation,
+ Copyright (C) 1992-1993, 1995, 2001-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/w32inevt.h b/src/w32inevt.h
index 3426ac6251f..f0097716f35 100644
--- a/src/w32inevt.h
+++ b/src/w32inevt.h
@@ -1,5 +1,5 @@
/* Input routines for GNU Emacs on the Microsoft Windows API.
- Copyright (C) 1995, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32menu.c b/src/w32menu.c
index da2db78a940..8bf0c462030 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1,5 +1,5 @@
/* Menu support for GNU Emacs on the Microsoft Windows API.
- Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2020 Free
+ Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2021 Free
Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32notify.c b/src/w32notify.c
index 0871abb6027..b9e90633923 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -1,6 +1,6 @@
/* Filesystem notifications support for GNU Emacs on the Microsoft Windows API.
-Copyright (C) 2012-2020 Free Software Foundation, Inc.
+Copyright (C) 2012-2021 Free Software Foundation, Inc.
Author: Eli Zaretskii <eliz@gnu.org>
diff --git a/src/w32proc.c b/src/w32proc.c
index 66cdf7de461..2b6cb9c1e1d 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1,6 +1,6 @@
/* Process support for GNU Emacs on the Microsoft Windows API.
-Copyright (C) 1992, 1995, 1999-2020 Free Software Foundation, Inc.
+Copyright (C) 1992, 1995, 1999-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32reg.c b/src/w32reg.c
index 9ef50afce33..9794162bd09 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -1,6 +1,6 @@
/* Emulate the X Resource Manager through the registry.
-Copyright (C) 1990, 1993-1994, 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 1990, 1993-1994, 2001-2021 Free Software Foundation, Inc.
Author: Kevin Gallo
diff --git a/src/w32select.c b/src/w32select.c
index e754e1f1ed2..85f8e5556a2 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1,6 +1,6 @@
/* Selection processing for Emacs on the Microsoft Windows API.
-Copyright (C) 1993-1994, 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
Author: Kevin Gallo
Benjamin Riefenstahl
diff --git a/src/w32select.h b/src/w32select.h
index 2cdc51994a3..7ed8696ea98 100644
--- a/src/w32select.h
+++ b/src/w32select.h
@@ -1,6 +1,6 @@
/* Selection processing for Emacs on the Microsoft W32 API.
-Copyright (C) 1993-1994, 2001-2020 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32term.c b/src/w32term.c
index 989b056ff2e..e5a8a823b48 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1,6 +1,6 @@
/* Implementation of GUI terminal on the Microsoft Windows API.
-Copyright (C) 1989, 1993-2020 Free Software Foundation, Inc.
+Copyright (C) 1989, 1993-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32term.h b/src/w32term.h
index 694493c6c82..7d351df871d 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -1,5 +1,5 @@
/* Definitions and headers for communication on the Microsoft Windows API.
- Copyright (C) 1995, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 7a84b21f9da..0df1ff298f1 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -1,6 +1,6 @@
/* Font backend for the Microsoft W32 Uniscribe API.
Windows-specific parts of the HarfBuzz font backend.
- Copyright (C) 2008-2020 Free Software Foundation, Inc.
+ Copyright (C) 2008-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 70cee559f3c..712214b591b 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -1,5 +1,5 @@
/* Functions taken directly from X sources for use with the Microsoft Windows API.
- Copyright (C) 1989, 1992-1995, 1999, 2001-2020 Free Software
+ Copyright (C) 1989, 1992-1995, 1999, 2001-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/widget.c b/src/widget.c
index b141612b539..43f0307b4e0 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -1,5 +1,5 @@
/* The emacs frame widget.
- Copyright (C) 1992-1993, 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-1993, 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/widget.h b/src/widget.h
index 7ec5b63e128..105bc6646d1 100644
--- a/src/widget.h
+++ b/src/widget.h
@@ -1,5 +1,5 @@
/* The emacs frame widget public header file.
- Copyright (C) 1993, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/widgetprv.h b/src/widgetprv.h
index cf7cad7c01a..58620a05b2a 100644
--- a/src/widgetprv.h
+++ b/src/widgetprv.h
@@ -1,5 +1,5 @@
/* The emacs frame widget private header file.
- Copyright (C) 1993, 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/window.c b/src/window.c
index 5db166e345e..ba8682eed7c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,6 +1,6 @@
/* Window creation, deletion and examination for GNU Emacs.
Does not include redisplay.
- Copyright (C) 1985-1987, 1993-1998, 2000-2020 Free Software
+ Copyright (C) 1985-1987, 1993-1998, 2000-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/window.h b/src/window.h
index 167d1be7abb..1f94fc0252f 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1,5 +1,5 @@
/* Window definitions for GNU Emacs.
- Copyright (C) 1985-1986, 1993, 1995, 1997-2020 Free Software
+ Copyright (C) 1985-1986, 1993, 1995, 1997-2021 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xdisp.c b/src/xdisp.c
index b5adee51055..64ec0abad48 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1,6 +1,6 @@
/* Display generation from window structure and buffer text.
-Copyright (C) 1985-1988, 1993-1995, 1997-2020 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1997-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
@@ -1114,7 +1114,8 @@ static ptrdiff_t display_count_lines (ptrdiff_t, ptrdiff_t, ptrdiff_t,
static void pint2str (register char *, register int, register ptrdiff_t);
static int display_string (const char *, Lisp_Object, Lisp_Object,
- ptrdiff_t, ptrdiff_t, struct it *, int, int, int, int);
+ ptrdiff_t, ptrdiff_t, struct it *, int, int, int,
+ int);
static void compute_line_metrics (struct it *);
static void run_redisplay_end_trigger_hook (struct it *);
static bool get_overlay_strings (struct it *, ptrdiff_t);
@@ -25451,14 +25452,62 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
format_mode_line_unwind_data (NULL, NULL,
Qnil, false));
- mode_line_target = MODE_LINE_DISPLAY;
-
/* Temporarily make frame's keyboard the current kboard so that
kboard-local variables in the mode_line_format will get the right
values. */
push_kboard (FRAME_KBOARD (it.f));
record_unwind_save_match_data ();
- display_mode_element (&it, 0, 0, 0, format, Qnil, false);
+
+ if (NILP (Vmode_line_compact))
+ {
+ mode_line_target = MODE_LINE_DISPLAY;
+ display_mode_element (&it, 0, 0, 0, format, Qnil, false);
+ }
+ else
+ {
+ Lisp_Object mode_string = Fformat_mode_line (format, Qnil, Qnil, Qnil);
+ if (EQ (Vmode_line_compact, Qlong)
+ && WINDOW_TOTAL_COLS (w) >= SCHARS (mode_string))
+ {
+ /* The window is wide enough; just display the mode line we
+ just computed. */
+ display_string (NULL, mode_string, Qnil,
+ 0, 0, &it, 0, 0, 0,
+ STRING_MULTIBYTE (mode_string));
+ }
+ else
+ {
+ /* Compress the mode line. */
+ ptrdiff_t i = 0, i_byte = 0, start = 0;
+ int prev = 0;
+
+ while (i < SCHARS (mode_string))
+ {
+ int c = fetch_string_char_advance (mode_string, &i, &i_byte);
+ if (c == ' ' && prev == ' ')
+ {
+ display_string (NULL,
+ Fsubstring (mode_string, make_fixnum (start),
+ make_fixnum (i - 1)),
+ Qnil, 0, 0, &it, 0, 0, 0,
+ STRING_MULTIBYTE (mode_string));
+ /* Skip past the rest of the space characters. */
+ while (c == ' ' && i < SCHARS (mode_string))
+ c = fetch_string_char_advance (mode_string, &i, &i_byte);
+ start = i - 1;
+ }
+ prev = c;
+ }
+
+ /* Display the final bit. */
+ if (start < i)
+ display_string (NULL,
+ Fsubstring (mode_string, make_fixnum (start),
+ make_fixnum (i - 1)),
+ Qnil, 0, 0, &it, 0, 0, 0,
+ STRING_MULTIBYTE (mode_string));
+ }
+ }
pop_kboard ();
unbind_to (count, Qnil);
@@ -27090,6 +27139,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
with index START. */
reseat_to_string (it, NILP (lisp_string) ? string : NULL, lisp_string,
start, precision, field_width, multibyte);
+
if (string && STRINGP (lisp_string))
/* LISP_STRING is the one returned by decode_mode_spec. We should
ignore its text properties. */
@@ -34805,6 +34855,14 @@ wide as that tab on the display. */);
The face used for trailing whitespace is `trailing-whitespace'. */);
Vshow_trailing_whitespace = Qnil;
+ DEFVAR_LISP ("mode-line-compact", Vmode_line_compact,
+ doc: /* Non-nil means that mode lines should be compact.
+This means that repeating spaces will be replaced with a single space.
+If this variable is `long', only mode lines that are wider than the
+currently selected window are compressed. */);
+ Vmode_line_compact = Qnil;
+ DEFSYM (Qlong, "long");
+
DEFVAR_LISP ("nobreak-char-display", Vnobreak_char_display,
doc: /* Control highlighting of non-ASCII space and hyphen chars.
If the value is t, Emacs highlights non-ASCII chars which have the
diff --git a/src/xfaces.c b/src/xfaces.c
index 73a536b19c6..b3b19a9cb2e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1,6 +1,6 @@
/* xfaces.c -- "Face" primitives.
-Copyright (C) 1993-1994, 1998-2020 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 1998-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xfns.c b/src/xfns.c
index abe293e903e..9ab537ca8d9 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1,6 +1,6 @@
/* Functions for the X Window System.
-Copyright (C) 1989, 1992-2020 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -2321,24 +2321,6 @@ hack_wm_protocols (struct frame *f, Widget widget)
static XFontSet xic_create_xfontset (struct frame *);
static XIMStyle best_xim_style (XIMStyles *);
-
-/* Supported XIM styles, ordered by preference. */
-
-static const XIMStyle supported_xim_styles[] =
-{
- XIMPreeditPosition | XIMStatusArea,
- XIMPreeditPosition | XIMStatusNothing,
- XIMPreeditPosition | XIMStatusNone,
- XIMPreeditNothing | XIMStatusArea,
- XIMPreeditNothing | XIMStatusNothing,
- XIMPreeditNothing | XIMStatusNone,
- XIMPreeditNone | XIMStatusArea,
- XIMPreeditNone | XIMStatusNothing,
- XIMPreeditNone | XIMStatusNone,
- 0,
-};
-
-
#if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
/* Create an X fontset on frame F with base font name BASE_FONTNAME. */
@@ -2622,15 +2604,8 @@ xic_free_xfontset (struct frame *f)
static XIMStyle
best_xim_style (XIMStyles *xim)
{
- int i, j;
- int nr_supported = ARRAYELTS (supported_xim_styles);
-
- for (i = 0; i < nr_supported; ++i)
- for (j = 0; j < xim->count_styles; ++j)
- if (supported_xim_styles[i] == xim->supported_styles[j])
- return supported_xim_styles[i];
-
- /* Return the default style. */
+ /* Return the default style. This is what GTK3 uses and
+ should work fine with all modern input methods. */
return XIMPreeditNothing | XIMStatusNothing;
}
diff --git a/src/xfont.c b/src/xfont.c
index 32f63c3f7ce..0570ee96a90 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -1,5 +1,5 @@
/* xfont.c -- X core font driver.
- Copyright (C) 2006-2020 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
diff --git a/src/xftfont.c b/src/xftfont.c
index eb60d219a72..f7349316366 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -1,5 +1,5 @@
/* xftfont.c -- XFT font driver.
- Copyright (C) 2006-2020 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
diff --git a/src/xgselect.c b/src/xgselect.c
index be70107b756..0d91d55bad6 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -1,6 +1,6 @@
/* Function for handling the GLib event loop.
-Copyright (C) 2009-2020 Free Software Foundation, Inc.
+Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xgselect.h b/src/xgselect.h
index 512bf3ad85f..2142a236b23 100644
--- a/src/xgselect.h
+++ b/src/xgselect.h
@@ -1,6 +1,6 @@
/* Header for xg_select.
-Copyright (C) 2009-2020 Free Software Foundation, Inc.
+Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xmenu.c b/src/xmenu.c
index dba7e88f486..ea3813a64e2 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1,6 +1,6 @@
/* X Communication module for terminals which understand the X protocol.
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2020 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2021 Free Software
Foundation, Inc.
Author: Jon Arnold
diff --git a/src/xml.c b/src/xml.c
index d7da86404f6..495988ab232 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -1,5 +1,5 @@
/* Interface to libxml2.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xrdb.c b/src/xrdb.c
index 3d7f715c88f..7d84762978f 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -1,5 +1,5 @@
/* Deal with the X Resource Manager.
- Copyright (C) 1990, 1993-1994, 2000-2020 Free Software Foundation,
+ Copyright (C) 1990, 1993-1994, 2000-2021 Free Software Foundation,
Inc.
Author: Joseph Arceneaux
diff --git a/src/xselect.c b/src/xselect.c
index 383aebf96c8..030f6240712 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1,5 +1,5 @@
/* X Selection processing for Emacs.
- Copyright (C) 1993-1997, 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-1997, 2000-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xsettings.c b/src/xsettings.c
index 1ba1021e40b..58dfd43ad18 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -1,6 +1,6 @@
/* Functions for handling font and other changes dynamically.
-Copyright (C) 2009-2020 Free Software Foundation, Inc.
+Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xsettings.h b/src/xsettings.h
index f29ce77c7f0..26717fc08cb 100644
--- a/src/xsettings.h
+++ b/src/xsettings.h
@@ -1,6 +1,6 @@
/* Functions for handle font changes dynamically.
-Copyright (C) 2009-2020 Free Software Foundation, Inc.
+Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 203085e24f1..10565a4b25f 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -1,7 +1,7 @@
/* Session management module for systems which understand the X Session
management protocol.
-Copyright (C) 2002-2020 Free Software Foundation, Inc.
+Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xterm.c b/src/xterm.c
index 7f8728e47c4..0a86738cc20 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,6 +1,6 @@
/* X Communication module for terminals which understand the X protocol.
-Copyright (C) 1989, 1993-2020 Free Software Foundation, Inc.
+Copyright (C) 1989, 1993-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -9706,7 +9706,7 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
#ifdef HAVE_X_I18N
if (w == XWINDOW (f->selected_window))
- if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition))
+ if (FRAME_XIC (f))
xic_set_preeditarea (w, x, y);
#endif
}
@@ -10389,11 +10389,8 @@ xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_
create_frame_xic (f);
if (FRAME_XIC_STYLE (f) & XIMStatusArea)
xic_set_statusarea (f);
- if (FRAME_XIC_STYLE (f) & XIMPreeditPosition)
- {
- struct window *w = XWINDOW (f->selected_window);
- xic_set_preeditarea (w, w->cursor.x, w->cursor.y);
- }
+ struct window *w = XWINDOW (f->selected_window);
+ xic_set_preeditarea (w, w->cursor.x, w->cursor.y);
}
}
diff --git a/src/xterm.h b/src/xterm.h
index 0f8ba5e82b4..ebc42b7dd55 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1,5 +1,5 @@
/* Definitions and headers for communication with X protocol.
- Copyright (C) 1989, 1993-1994, 1998-2020 Free Software Foundation,
+ Copyright (C) 1989, 1993-1994, 1998-2021 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
diff --git a/src/xwidget.c b/src/xwidget.c
index accde65b523..e4b42e6e0c6 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -1,6 +1,6 @@
/* Support for embedding graphical components in a buffer.
-Copyright (C) 2011-2020 Free Software Foundation, Inc.
+Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xwidget.h b/src/xwidget.h
index 40ad8ae8334..591f23489db 100644
--- a/src/xwidget.h
+++ b/src/xwidget.h
@@ -1,6 +1,6 @@
/* Support for embedding graphical components in a buffer.
-Copyright (C) 2011-2020 Free Software Foundation, Inc.
+Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of GNU Emacs.