summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-03-29 16:35:49 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-03-29 16:35:49 -0700
commit8289296548281f6fa4c8b6b1ee9ead764c4c9aa3 (patch)
tree61d1528d9dab94f1be62dd0c76496c9edd00dc1f
parent792c7b2ba5319f436b459ff2c0d21e20207db550 (diff)
parentd806ab682a8e914345db3f2eede292f85745c98c (diff)
downloademacs-8289296548281f6fa4c8b6b1ee9ead764c4c9aa3.tar.gz
Merge from mainline.
-rw-r--r--ChangeLog7
-rw-r--r--INSTALL.BZR2
-rwxr-xr-xautogen.sh13
-rw-r--r--autogen/config.in8
-rwxr-xr-xautogen/configure34
-rwxr-xr-xautogen/update_autogen2
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/commands.texi5
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/ChangeLog34
-rw-r--r--lisp/abbrev.el22
-rw-r--r--lisp/allout-widgets.el16
-rw-r--r--lisp/allout.el5
-rw-r--r--lisp/cus-start.el1
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/mm-view.el3
-rw-r--r--lisp/ido.el2
-rw-r--r--lisp/net/imap.el3
-rw-r--r--src/ChangeLog80
-rw-r--r--src/character.c7
-rw-r--r--src/character.h2
-rw-r--r--src/cmds.c2
-rw-r--r--src/coding.c7
-rw-r--r--src/dispextern.h2
-rw-r--r--src/editfns.c2
-rw-r--r--src/eval.c148
-rw-r--r--src/keyboard.c82
-rw-r--r--src/keymap.c2
-rw-r--r--src/lisp.h9
-rw-r--r--src/nsmenu.m3
-rw-r--r--src/nsterm.m131
-rw-r--r--src/print.c131
-rw-r--r--src/scroll.c11
-rw-r--r--src/search.c35
-rw-r--r--src/w32.c235
-rw-r--r--src/xdisp.c76
36 files changed, 727 insertions, 413 deletions
diff --git a/ChangeLog b/ChangeLog
index ef040cdd2c8..bf7a6af63b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-28 Glenn Morris <rgm@gnu.org>
+
+ * autogen/update_autogen: Pass -f to autoreconf.
+
+ * autogen.sh (get_version): Discard "not found" lines.
+ (check_version): Respect $AUTOCONF etc environment variables.
+
2011-03-27 Glenn Morris <rgm@gnu.org>
* configure.in (AC_TYPE_SIGNAL): Remove obsolete macro.
diff --git a/INSTALL.BZR b/INSTALL.BZR
index abb98fd796b..93229ec7a79 100644
--- a/INSTALL.BZR
+++ b/INSTALL.BZR
@@ -17,7 +17,7 @@ The `autogen.sh' script can help you figure out if you have the
necessary tools.
The first time you build, there are a couple of extra steps.
-First, generate the `configure' script:
+First, generate the `configure' script and some related files:
$ ./autogen.sh
diff --git a/autogen.sh b/autogen.sh
index ce742a9c18a..d15817d0596 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -30,6 +30,7 @@
### Code:
## Tools we need:
+## Note that we respect the values of AUTOCONF etc, like autoreconf does.
progs="autoconf automake"
## Minimum versions we need:
@@ -46,7 +47,8 @@ automake_min=1.11
## Also note that we do not handle micro versions.
get_version ()
{
- $1 --version 2>&1 | sed -n '1 s/.* \([1-9][0-9\.]*\).*/\1/p'
+ ## Remove eg "./autogen.sh: line 50: autoconf: command not found".
+ $1 --version 2>&1 | sed -e '/not found/d' -n -e '1 s/.* \([1-9][0-9\.]*\).*/\1/p'
}
## $1 = version string, eg "2.59"
@@ -71,7 +73,14 @@ minor_version ()
## Return 3 for unexpected error (eg failed to parse version).
check_version ()
{
- have_version=`get_version $1`
+ ## Respect eg $AUTOMAKE if it is set, like autoreconf does.
+ uprog=`echo $1 | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+
+ eval uprog=\$${uprog}
+
+ [ x"$uprog" = x ] && uprog=$1
+
+ have_version=`get_version $uprog`
[ x"$have_version" = x ] && return 1
diff --git a/autogen/config.in b/autogen/config.in
index eb7fd7749dd..57ff5f45e0c 100644
--- a/autogen/config.in
+++ b/autogen/config.in
@@ -999,9 +999,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
slash */
#undef REPLACE_FUNC_STAT_FILE
-/* Define as the return type of signal handlers (`int' or `void'). */
-#undef RETSIGTYPE
-
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'sig_atomic_t'. */
#undef SIG_ATOMIC_T_SUFFIX
@@ -1274,11 +1271,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# define SYSTEM_PURESIZE_EXTRA 30000
#endif
-/* SIGTYPE is the macro we actually use. */
-#ifndef SIGTYPE
-#define SIGTYPE RETSIGTYPE
-#endif
-
#ifdef emacs /* Don't do this for lib-src. */
/* Tell regex.c to use a type compatible with Emacs. */
#define RE_TRANSLATE_TYPE Lisp_Object
diff --git a/autogen/configure b/autogen/configure
index 47b760c2dd8..94c65d62ccd 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -7899,40 +7899,6 @@ $as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <signal.h>
-
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_type_signal=int
-else
- ac_cv_type_signal=void
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
-
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for speed_t" >&5
$as_echo_n "checking for speed_t... " >&6; }
if test "${emacs_cv_speed_t+set}" = set; then :
diff --git a/autogen/update_autogen b/autogen/update_autogen
index d8b451c370b..b2a6d0b42a4 100755
--- a/autogen/update_autogen
+++ b/autogen/update_autogen
@@ -126,7 +126,7 @@ done < $tempfile
echo "Running autoreconf..."
-autoreconf -i -I m4 2>| $tempfile
+autoreconf -f -i -I m4 2>| $tempfile
retval=$?
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index c705aae4934..1eb3cfa2556 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * commands.texi (Command Overview): post-command-hook is not reset to
+ nil any more.
+
2011-03-19 Stefan Monnier <monnier@iro.umontreal.ca>
* strings.texi (String Conversion): Don't mention
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 4f8d554a68b..eb42ddb11a4 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -91,8 +91,9 @@ and also when the command loop is first entered. At that time,
Quitting is suppressed while running @code{pre-command-hook} and
@code{post-command-hook}. If an error happens while executing one of
-these hooks, it terminates execution of the hook, and clears the hook
-variable to @code{nil} so as to prevent an infinite loop of errors.
+these hooks, it does not terminate execution of the hook; instead
+the error is silenced and the function in which the error occurred
+is removed from the hook.
A request coming into the Emacs server (@pxref{Emacs Server,,,
emacs, The GNU Emacs Manual}) runs these two hooks just as a keyboard
diff --git a/etc/NEWS b/etc/NEWS
index 263ab2eff3b..969b1cdcf5f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -162,6 +162,9 @@ cannot be encoded by the `terminal-coding-system'.
** On graphical displays, the mode-line no longer ends in dashes.
+** On Nextstep/OSX, the menu bar can be hidden by customizing
+ ns-auto-hide-menu-bar.
+
** Basic SELinux support has been added.
This requires Emacs to be linked with libselinux at build time.
@@ -745,6 +748,11 @@ sc.el, x-menu.el, rnews.el, rnewspost.el
* Lisp changes in Emacs 24.1
+** pre/post-command-hook are not reset to nil upon error.
+Instead, the offending function is removed.
+
+** New low-level function run-hook-wrapped.
+
** byte-compile-disable-print-circle is obsolete.
** deferred-action-list and deferred-action-function are obsolete.
** Removed the stack-trace-on-error variable.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f6d06821062..8e6e78c705e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,37 @@
+2011-03-29 Ken Manheimer <ken.manheimer@gmail.com>
+
+ * allout.el (allout-hide-by-annotation, allout-flag-region):
+ Reduce possibility of overlay leakage by making them volatile.
+
+ * allout-widgets.el (allout-widgets-tally): Define as nil so the
+ hash is not shared between buffers. Mode initialization is
+ responsible for giving it a useful starting value.
+ (allout-item-span): Reduce possibility of overlay leakage by
+ making them volatile.
+ (allout-widgets-count-buttons-in-region): Add diagnostic function
+ for tracking down button overlay leaks.
+
+2011-03-29 Leo Liu <sdl.web@gmail.com>
+
+ * ido.el (ido-read-internal): Use the default history var
+ minibuffer-history if no HISTORY is specified.
+
+2011-03-28 Brian T. Sniffen <bsniffen@akamai.com> (tiny change)
+
+ * net/imap.el (imap-shell-open, imap-process-connection-type): Use
+ imap-process-connection-type for 'shell' streams as well as
+ Kerberos, SSL, other subprocesses.
+
+2011-03-28 Leo Liu <sdl.web@gmail.com>
+
+ * abbrev.el (abbrev-table-empty-p): New function.
+ (prepare-abbrev-list-buffer): Place empty abbrev tables after
+ nonempty ones. (Bug#5937)
+
+2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
+
+ * cus-start.el (all): Add boolean ns-auto-hide-menu-bar.
+
2011-03-27 Leo Liu <sdl.web@gmail.com>
* ansi-color.el (ansi-color-names-vector): Allow cons cell value
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 3b383a5f5b8..504d9fcbbce 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -123,8 +123,13 @@ Otherwise display all abbrevs."
(if local
(insert-abbrev-table-description
(abbrev-table-name local-table) t)
- (dolist (table abbrev-table-name-list)
- (insert-abbrev-table-description table t)))
+ (let (empty-tables)
+ (dolist (table abbrev-table-name-list)
+ (if (abbrev-table-empty-p (symbol-value table))
+ (push table empty-tables)
+ (insert-abbrev-table-description table t)))
+ (dolist (table (nreverse empty-tables))
+ (insert-abbrev-table-description table t))))
(goto-char (point-min))
(set-buffer-modified-p nil)
(edit-abbrevs-mode)
@@ -420,6 +425,19 @@ PROPS is a list of properties."
(and (vectorp object)
(numberp (abbrev-table-get object :abbrev-table-modiff))))
+(defun abbrev-table-empty-p (object &optional ignore-system)
+ "Return nil if there are no abbrev symbols in OBJECT.
+If IGNORE-SYSTEM is non-nil, system definitions are ignored."
+ (unless (abbrev-table-p object)
+ (error "Non abbrev table object"))
+ (not (catch 'some
+ (mapatoms (lambda (abbrev)
+ (unless (or (zerop (length (symbol-name abbrev)))
+ (and ignore-system
+ (abbrev-get abbrev :system)))
+ (throw 'some t)))
+ object))))
+
(defvar global-abbrev-table (make-abbrev-table)
"The abbrev table whose abbrevs affect all buffers.
Each buffer may also have a local abbrev table.
diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index 47f181ab76b..ae4265bda1f 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -238,7 +238,7 @@ buffer, and tracking increases as new widgets are added and
decreases as obsolete widgets are garbage collected."
:type 'boolean
:group 'allout-widgets-developer)
-(defvar allout-widgets-tally (make-hash-table :test 'eq :weakness 'key)
+(defvar allout-widgets-tally nil
"Hash-table of existing allout widgets, for debugging.
Table is maintained iff `allout-widgets-maintain-tally' is non-nil.
@@ -2100,6 +2100,7 @@ previously established or is not moved."
(cond ((not overlay) (when start
(setq overlay (make-overlay start end nil t nil))
(overlay-put overlay 'button item-widget)
+ (overlay-put overlay 'evaporate t)
(widget-put item-widget :span-overlay overlay)
t))
;; report:
@@ -2343,6 +2344,19 @@ The elements of LIST are not copied, just the list structure itself."
(while (consp list) (push (pop list) res))
(prog1 (nreverse res) (setcdr res list)))
(car list)))
+;;;_ . allout-widgets-count-buttons-in-region (start end)
+(defun allout-widgets-count-buttons-in-region (start end)
+ "Debugging/diagnostic tool - count overlays with 'button' property in region."
+ (interactive "r")
+ (setq start (or start (point-min))
+ end (or end (point-max)))
+ (if (> start end) (let ((interim start)) (setq start end end interim)))
+ (let ((button-overlays (delq nil
+ (mapcar (function (lambda (o)
+ (if (overlay-get o 'button)
+ o)))
+ (overlays-in start end)))))
+ (length button-overlays)))
;;;_ : Run unit tests:
(defun allout-widgets-run-unit-tests ()
diff --git a/lisp/allout.el b/lisp/allout.el
index 3fb8ed7ccd5..736ec42718b 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -4489,8 +4489,9 @@ Topic exposure is marked with text-properties, to be used by
;; advance to just after end of this annotation:
(setq next (allout-next-single-char-property-change
(point) 'allout-was-hidden nil end))
- (overlay-put (make-overlay prev next nil 'front-advance)
- 'category 'allout-exposure-category)
+ (let ((o (make-overlay prev next nil 'front-advance)))
+ (overlay-put o 'category 'allout-exposure-category)
+ (overlay-put o 'evaporate t))
(allout-deannotate-hidden prev next)
(setq prev next)
(if next (goto-char next)))))
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 788731e4dbc..1188d37150a 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -356,6 +356,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
(const alt) (const hyper)
(const super)) "23.1")
(ns-antialias-text ns boolean "23.1")
+ (ns-auto-hide-menu-bar ns boolean "24.0")
;; process.c
(delete-exited-processes processes-basics boolean)
;; syntax.c
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index f257ff51f3d..a6faaf036a5 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-29 Julien Danjou <julien@danjou.info>
+
+ * mm-view.el (mm-display-inline-fontify): Use `set-normal-mode' with
+ local variables disabled rather than `normal-mode'.
+
2011-03-26 Chong Yidong <cyd@stupidchicken.com>
* proto-stream.el: Changes preparatory to merging open-protocol-stream
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 39d49af0600..abd78b8de02 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -603,9 +603,10 @@ If MODE is not set, try to find mode automatically."
;; I find font-lock a bit too verbose.
(font-lock-verbose nil))
(setq buffer-file-name (mm-handle-filename handle))
+ (set (make-local-variable 'enable-local-variables) nil)
(if mode
(funcall mode)
- (normal-mode))
+ (set-auto-mode))
;; The mode function might have already turned on font-lock.
(unless (symbol-value 'font-lock-mode)
(font-lock-fontify-buffer)))
diff --git a/lisp/ido.el b/lisp/ido.el
index 177f9338870..0ce83d9b88c 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -2151,7 +2151,7 @@ If INITIAL is non-nil, it specifies the initial input string."
(t
(setq done t))))))
- (and history (add-to-history history ido-selected))
+ (add-to-history (or history 'minibuffer-history) ido-selected)
ido-selected))
(defun ido-edit-input ()
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index 6d80b97fd23..f4af03f100f 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -211,7 +211,7 @@ until a successful connection is made."
:type '(repeat string))
(defcustom imap-process-connection-type nil
- "*Value for `process-connection-type' to use for Kerberos4, GSSAPI and SSL.
+ "*Value for `process-connection-type' to use for Kerberos4, GSSAPI, shell, and SSL.
The `process-connection-type' variable controls the type of device
used to communicate with subprocesses. Values are nil to use a
pipe, or t or `pty' to use a pty. The value has no effect if the
@@ -770,6 +770,7 @@ sure of changing the value of `foo'."
(let* ((port (or port imap-default-port))
(coding-system-for-read imap-coding-system-for-read)
(coding-system-for-write imap-coding-system-for-write)
+ (process-connection-type imap-process-connection-type)
(process (start-process
name buffer shell-file-name shell-command-switch
(format-spec
diff --git a/src/ChangeLog b/src/ChangeLog
index 6ba04202854..4e84f9510dd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -8,8 +8,6 @@
* dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]:
Omit unused local var.
-2011-03-27 Paul Eggert <eggert@cs.ucla.edu>
-
* keyboard.c (parse_modifiers_uncached, parse_modifiers):
Don't assume string length fits in int.
(keyremap_step, read_key_sequence): Use size_t for sizes.
@@ -62,12 +60,86 @@
* fns.c (get_key_arg): Now accepts and returns size_t, and returns
0 if not found, not -1. All callers changed.
-2011-03-26 Paul Eggert <eggert@cs.ucla.edu>
-
* alloc.c (garbage_collect): Don't assume stack size fits in int.
(stack_copy_size): Now size_t, not int.
(stack_copy, stack_copy_size): Define only if MAX_SAVE_STACK > 0.
+2011-03-28 Juanma Barranquero <lekktu@gmail.com>
+
+ * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end',
+ unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
+ All callers changed.
+
+ * lisp.h (multibyte_char_to_unibyte):
+ * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl',
+ unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
+ * character.h (CHAR_TO_BYTE8):
+ * cmds.c (internal_self_insert):
+ * editfns.c (general_insert_function):
+ * keymap.c (push_key_description):
+ * search.c (Freplace_match):
+ * xdisp.c (message_dolog, set_message_1): All callers changed.
+
+2011-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * keyboard.c (safe_run_hook_funcall): New function.
+ (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error,
+ don't set the hook to nil, but remove the offending function instead.
+ (Qcommand_hook_internal): Remove, unused.
+ (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define
+ Vcommand_hook_internal.
+
+ * eval.c (enum run_hooks_condition): Remove.
+ (funcall_nil, funcall_not): New functions.
+ (run_hook_with_args): Call each function through a `funcall' argument.
+ Remove `cond' argument, now redundant.
+ (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success)
+ (Frun_hook_with_args_until_failure): Adjust accordingly.
+ (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions.
+
+2011-03-28 Juanma Barranquero <lekktu@gmail.com>
+
+ * dispextern.h (string_buffer_position): Remove declaration.
+
+ * print.c (strout): Remove parameter `multibyte', unused since
+ 1999-08-21T19:30:21Z!gerd@gnu.org. All callers changed.
+
+ * search.c (boyer_moore): Remove parameters `len', `pos' and `lim',
+ never used since function introduction in 1998-02-08T21:33:56Z!rms@gnu.org.
+ All callers changed.
+
+ * w32.c (_wsa_errlist): Use braces for struct initializers.
+
+ * xdisp.c (string_buffer_position_lim): Remove parameter `w',
+ never used since function introduction in 2001-03-09T18:41:50Z!gerd@gnu.org.
+ All callers changed.
+ (string_buffer_position): Likewise. Also, make static (it's never
+ used outside xdisp.c).
+ (cursor_row_p): Remove parameter `w', unused since
+ 2000-10-17T16:08:57Z!gerd@gnu.org. All callers changed.
+ (decode_mode_spec): Remove parameter `precision', introduced during
+ Gerd Moellmann's rewrite at 1999-07-21T21:43:52Z!gerd@gnu.org, but never used.
+ All callers changed.
+
+2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar.
+
+2011-03-27 Anders Lindgren <andlind@gmail.com>
+
+ * nsterm.m (ns_menu_bar_is_hidden): New variable.
+ (ns_constrain_all_frames, ns_menu_bar_should_be_hidden)
+ (ns_update_auto_hide_menu_bar): New functions.
+ (ns_update_begin): Call ns_update_auto_hide_menu_bar.
+ (applicationDidBecomeActive): Call ns_update_auto_hide_menu_bar and
+ ns_constrain_all_frames.
+ (constrainFrameRect): Return at once if ns_menu_bar_should_be_hidden.
+ (syms_of_nsterm): DEFVAR ns-auto-hide-menu-bar, init to Qnil.
+
+2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsmenu.m (runDialogAt): Remove argument to timer_check.
+
2011-03-27 Glenn Morris <rgm@gnu.org>
* syssignal.h: Replace RETSIGTYPE with void.
diff --git a/src/character.c b/src/character.c
index c106fc0ba20..bac9f6af81e 100644
--- a/src/character.c
+++ b/src/character.c
@@ -232,13 +232,10 @@ translate_char (Lisp_Object table, int c)
}
/* Convert ASCII or 8-bit character C to unibyte. If C is none of
- them, return (C & 0xFF).
-
- The argument REV_TBL is now ignored. It will be removed in the
- future. */
+ them, return (C & 0xFF). */
int
-multibyte_char_to_unibyte (int c, Lisp_Object rev_tbl)
+multibyte_char_to_unibyte (int c)
{
if (c < 0x80)
return c;
diff --git a/src/character.h b/src/character.h
index 91020cadedc..7a75ac186fa 100644
--- a/src/character.h
+++ b/src/character.h
@@ -69,7 +69,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define CHAR_TO_BYTE8(c) \
(CHAR_BYTE8_P (c) \
? (c) - 0x3FFF00 \
- : multibyte_char_to_unibyte (c, Qnil))
+ : multibyte_char_to_unibyte (c))
/* Return the raw 8-bit byte for character C,
or -1 if C doesn't correspond to a byte. */
diff --git a/src/cmds.c b/src/cmds.c
index ebbb223c2db..1cf7ff24fec 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -352,7 +352,7 @@ internal_self_insert (int c, EMACS_INT n)
{
str[0] = (SINGLE_BYTE_CHAR_P (c)
? c
- : multibyte_char_to_unibyte (c, Qnil));
+ : multibyte_char_to_unibyte (c));
len = 1;
}
if (!NILP (overwrite)
diff --git a/src/coding.c b/src/coding.c
index a93a9a4d0e4..9e28a1c9f9b 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -853,8 +853,7 @@ static unsigned char *alloc_destination (struct coding_system *,
EMACS_INT, unsigned char *);
static void setup_iso_safe_charsets (Lisp_Object);
static unsigned char *encode_designation_at_bol (struct coding_system *,
- int *, int *,
- unsigned char *);
+ int *, unsigned char *);
static int detect_eol (const unsigned char *,
EMACS_INT, enum coding_category);
static Lisp_Object adjust_coding_eol_type (struct coding_system *, int);
@@ -4299,7 +4298,7 @@ encode_invocation_designation (struct charset *charset,
static unsigned char *
encode_designation_at_bol (struct coding_system *coding, int *charbuf,
- int *charbuf_end, unsigned char *dst)
+ unsigned char *dst)
{
struct charset *charset;
/* Table of charsets to be designated to each graphic register. */
@@ -4390,7 +4389,7 @@ encode_coding_iso_2022 (struct coding_system *coding)
unsigned char *dst_prev = dst;
/* We have to produce designation sequences if any now. */
- dst = encode_designation_at_bol (coding, charbuf, charbuf_end, dst);
+ dst = encode_designation_at_bol (coding, charbuf, dst);
bol_designation = 0;
/* We are sure that designation sequences are all ASCII bytes. */
produced_chars += dst - dst_prev;
diff --git a/src/dispextern.h b/src/dispextern.h
index d1e0475dd15..17a9bc39fb2 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2953,8 +2953,6 @@ extern int bidi_mirror_char (int);
struct glyph_row *row_containing_pos (struct window *, EMACS_INT,
struct glyph_row *,
struct glyph_row *, int);
-EMACS_INT string_buffer_position (struct window *, Lisp_Object,
- EMACS_INT);
int line_bottom_y (struct it *);
int display_prop_intangible_p (Lisp_Object);
void resize_echo_area_exactly (void);
diff --git a/src/editfns.c b/src/editfns.c
index 99832db1b4c..58f634fa479 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2226,7 +2226,7 @@ general_insert_function (void (*insert_func)
{
str[0] = (ASCII_CHAR_P (XINT (val))
? XINT (val)
- : multibyte_char_to_unibyte (XINT (val), Qnil));
+ : multibyte_char_to_unibyte (XINT (val)));
len = 1;
}
(*insert_func) ((char *) str, len);
diff --git a/src/eval.c b/src/eval.c
index 982fec66bbf..c3f9cd158f7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -30,8 +30,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "xterm.h"
#endif
-/* This definition is duplicated in alloc.c and keyboard.c */
-/* Putting it in lisp.h makes cc bomb out! */
+/* This definition is duplicated in alloc.c and keyboard.c. */
+/* Putting it in lisp.h makes cc bomb out! */
struct backtrace
{
@@ -40,9 +40,9 @@ struct backtrace
Lisp_Object *args; /* Points to vector of args. */
size_t nargs; /* Length of vector.
If nargs is (size_t) UNEVALLED, args points
- to slot holding list of unevalled args */
+ to slot holding list of unevalled args. */
char evalargs;
- /* Nonzero means call value of debugger when done with this operation. */
+ /* Nonzero means call value of debugger when done with this operation. */
char debug_on_exit;
};
@@ -146,7 +146,7 @@ init_eval (void)
when_entered_debugger = -1;
}
-/* unwind-protect function used by call_debugger. */
+/* Unwind-protect function used by call_debugger. */
static Lisp_Object
restore_stack_limits (Lisp_Object data)
@@ -556,7 +556,7 @@ interactive_p (int exclude_subrs_p)
|| btp->nargs == (size_t) UNEVALLED))
btp = btp->next;
- /* btp now points at the frame of the innermost function that isn't
+ /* `btp' now points at the frame of the innermost function that isn't
a special form, ignoring frames for Finteractive_p and/or
Fbytecode at the top. If this frame is for a built-in function
(such as load or eval-region) return nil. */
@@ -564,7 +564,7 @@ interactive_p (int exclude_subrs_p)
if (exclude_subrs_p && SUBRP (fun))
return 0;
- /* btp points to the frame of a Lisp function that called interactive-p.
+ /* `btp' points to the frame of a Lisp function that called interactive-p.
Return t if that function was called interactively. */
if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively))
return 1;
@@ -965,11 +965,11 @@ usage: (let VARLIST BODY...) */)
varlist = Fcar (args);
- /* Make space to hold the values to give the bound variables */
+ /* Make space to hold the values to give the bound variables. */
elt = Flength (varlist);
SAFE_ALLOCA_LISP (temps, XFASTINT (elt));
- /* Compute the values and store them in `temps' */
+ /* Compute the values and store them in `temps'. */
GCPRO2 (args, *temps);
gcpro2.nvars = 0;
@@ -1072,7 +1072,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */)
/* SYM is not mentioned in ENVIRONMENT.
Look at its function definition. */
if (EQ (def, Qunbound) || !CONSP (def))
- /* Not defined or definition not suitable */
+ /* Not defined or definition not suitable. */
break;
if (EQ (XCAR (def), Qautoload))
{
@@ -1213,10 +1213,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
byte_stack_list = catch->byte_stack;
gcprolist = catch->gcpro;
#ifdef DEBUG_GCPRO
- if (gcprolist != 0)
- gcpro_level = gcprolist->level + 1;
- else
- gcpro_level = 0;
+ gcpro_level = gcprolist ? gcprolist->level + 1 : gcpro_level = 0;
#endif
backtrace_list = catch->backlist;
lisp_eval_depth = catch->lisp_eval_depth;
@@ -1824,7 +1821,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
? debug_on_quit
: wants_debugger (Vdebug_on_error, conditions))
&& ! skip_debugger (conditions, combined_data)
- /* rms: what's this for? */
+ /* RMS: What's this for? */
&& when_entered_debugger < num_nonmacro_input_events)
{
call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil)));
@@ -1891,7 +1888,7 @@ find_handler_clause (Lisp_Object handlers, Lisp_Object conditions,
}
-/* dump an error message; called like vprintf */
+/* Dump an error message; called like vprintf. */
void
verror (const char *m, va_list ap)
{
@@ -1928,7 +1925,7 @@ verror (const char *m, va_list ap)
}
-/* dump an error message; called like printf */
+/* Dump an error message; called like printf. */
/* VARARGS 1 */
void
@@ -2024,7 +2021,7 @@ this does nothing and returns nil. */)
CHECK_SYMBOL (function);
CHECK_STRING (file);
- /* If function is defined and not as an autoload, don't override */
+ /* If function is defined and not as an autoload, don't override. */
if (!EQ (XSYMBOL (function)->function, Qunbound)
&& !(CONSP (XSYMBOL (function)->function)
&& EQ (XCAR (XSYMBOL (function)->function), Qautoload)))
@@ -2159,7 +2156,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
backtrace.next = backtrace_list;
backtrace_list = &backtrace;
- backtrace.function = &original_fun; /* This also protects them from gc */
+ backtrace.function = &original_fun; /* This also protects them from gc. */
backtrace.args = &original_args;
backtrace.nargs = UNEVALLED;
backtrace.evalargs = 1;
@@ -2169,7 +2166,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
do_debug_on_call (Qt);
/* At this point, only original_fun and original_args
- have values that will be used below */
+ have values that will be used below. */
retry:
/* Optimize for no indirection. */
@@ -2190,8 +2187,9 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
CHECK_CONS_LIST ();
- if (XINT (numargs) < XSUBR (fun)->min_args ||
- (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs)))
+ if (XINT (numargs) < XSUBR (fun)->min_args
+ || (0 <= XSUBR (fun)->max_args
+ && XSUBR (fun)->max_args < XINT (numargs)))
xsignal2 (Qwrong_number_of_arguments, original_fun, numargs);
else if (XSUBR (fun)->max_args == UNEVALLED)
@@ -2201,7 +2199,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
}
else if (XSUBR (fun)->max_args == MANY)
{
- /* Pass a vector of evaluated arguments */
+ /* Pass a vector of evaluated arguments. */
Lisp_Object *vals;
register size_t argnum = 0;
USE_SAFE_ALLOCA;
@@ -2364,7 +2362,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
fun = indirect_function (fun);
if (EQ (fun, Qunbound))
{
- /* Let funcall get the error */
+ /* Let funcall get the error. */
fun = args[0];
goto funcall;
}
@@ -2373,11 +2371,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
{
if (numargs < XSUBR (fun)->min_args
|| (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
- goto funcall; /* Let funcall get the error */
+ goto funcall; /* Let funcall get the error. */
else if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs)
{
/* Avoid making funcall cons up a yet another new vector of arguments
- by explicitly supplying nil's for optional values */
+ by explicitly supplying nil's for optional values. */
SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args);
for (i = numargs; i < XSUBR (fun)->max_args;)
funcall_args[++i] = Qnil;
@@ -2415,9 +2413,12 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
/* Run hook variables in various ways. */
-enum run_hooks_condition {to_completion, until_success, until_failure};
-static Lisp_Object run_hook_with_args (size_t, Lisp_Object *,
- enum run_hooks_condition);
+static Lisp_Object
+funcall_nil (size_t nargs, Lisp_Object *args)
+{
+ Ffuncall (nargs, args);
+ return Qnil;
+}
DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0,
doc: /* Run each hook in HOOKS.
@@ -2442,7 +2443,7 @@ usage: (run-hooks &rest HOOKS) */)
for (i = 0; i < nargs; i++)
{
hook[0] = args[i];
- run_hook_with_args (1, hook, to_completion);
+ run_hook_with_args (1, hook, funcall_nil);
}
return Qnil;
@@ -2465,7 +2466,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument.
usage: (run-hook-with-args HOOK &rest ARGS) */)
(size_t nargs, Lisp_Object *args)
{
- return run_hook_with_args (nargs, args, to_completion);
+ return run_hook_with_args (nargs, args, funcall_nil);
}
DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success,
@@ -2485,7 +2486,13 @@ Instead, use `add-hook' and specify t for the LOCAL argument.
usage: (run-hook-with-args-until-success HOOK &rest ARGS) */)
(size_t nargs, Lisp_Object *args)
{
- return run_hook_with_args (nargs, args, until_success);
+ return run_hook_with_args (nargs, args, Ffuncall);
+}
+
+static Lisp_Object
+funcall_not (size_t nargs, Lisp_Object *args)
+{
+ return NILP (Ffuncall (nargs, args)) ? Qt : Qnil;
}
DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure,
@@ -2504,22 +2511,45 @@ Instead, use `add-hook' and specify t for the LOCAL argument.
usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */)
(size_t nargs, Lisp_Object *args)
{
- return run_hook_with_args (nargs, args, until_failure);
+ return NILP (run_hook_with_args (nargs, args, funcall_not)) ? Qt : Qnil;
+}
+
+static Lisp_Object
+run_hook_wrapped_funcall (size_t nargs, Lisp_Object *args)
+{
+ Lisp_Object tmp = args[0], ret;
+ args[0] = args[1];
+ args[1] = tmp;
+ ret = Ffuncall (nargs, args);
+ args[1] = args[0];
+ args[0] = tmp;
+ return ret;
+}
+
+DEFUN ("run-hook-wrapped", Frun_hook_wrapped, Srun_hook_wrapped, 2, MANY, 0,
+ doc: /* Run HOOK, passing each function through WRAP-FUNCTION.
+I.e. instead of calling each function FUN directly with arguments ARGS,
+it calls WRAP-FUNCTION with arguments FUN and ARGS.
+As soon as a call to WRAP-FUNCTION returns non-nil, `run-hook-wrapped'
+aborts and returns that value.
+usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */)
+ (size_t nargs, Lisp_Object *args)
+{
+ return run_hook_with_args (nargs, args, run_hook_wrapped_funcall);
}
/* ARGS[0] should be a hook symbol.
Call each of the functions in the hook value, passing each of them
as arguments all the rest of ARGS (all NARGS - 1 elements).
- COND specifies a condition to test after each call
- to decide whether to stop.
+ FUNCALL specifies how to call each function on the hook.
The caller (or its caller, etc) must gcpro all of ARGS,
except that it isn't necessary to gcpro ARGS[0]. */
-static Lisp_Object
+Lisp_Object
run_hook_with_args (size_t nargs, Lisp_Object *args,
- enum run_hooks_condition cond)
+ Lisp_Object (*funcall) (size_t nargs, Lisp_Object *args))
{
- Lisp_Object sym, val, ret;
+ Lisp_Object sym, val, ret = Qnil;
struct gcpro gcpro1, gcpro2, gcpro3;
/* If we are dying or still initializing,
@@ -2529,14 +2559,13 @@ run_hook_with_args (size_t nargs, Lisp_Object *args,
sym = args[0];
val = find_symbol_value (sym);
- ret = (cond == until_failure ? Qt : Qnil);
if (EQ (val, Qunbound) || NILP (val))
return ret;
else if (!CONSP (val) || EQ (XCAR (val), Qlambda))
{
args[0] = val;
- return Ffuncall (nargs, args);
+ return funcall (nargs, args);
}
else
{
@@ -2544,9 +2573,7 @@ run_hook_with_args (size_t nargs, Lisp_Object *args,
GCPRO3 (sym, val, global_vals);
for (;
- CONSP (val) && ((cond == to_completion)
- || (cond == until_success ? NILP (ret)
- : !NILP (ret)));
+ CONSP (val) && NILP (ret);
val = XCDR (val))
{
if (EQ (XCAR (val), Qt))
@@ -2559,30 +2586,26 @@ run_hook_with_args (size_t nargs, Lisp_Object *args,
if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda))
{
args[0] = global_vals;
- ret = Ffuncall (nargs, args);
+ ret = funcall (nargs, args);
}
else
{
for (;
- (CONSP (global_vals)
- && (cond == to_completion
- || (cond == until_success
- ? NILP (ret)
- : !NILP (ret))));
+ CONSP (global_vals) && NILP (ret);
global_vals = XCDR (global_vals))
{
args[0] = XCAR (global_vals);
/* In a global value, t should not occur. If it does, we
must ignore it to avoid an endless loop. */
if (!EQ (args[0], Qt))
- ret = Ffuncall (nargs, args);
+ ret = funcall (nargs, args);
}
}
}
else
{
args[0] = XCAR (val);
- ret = Ffuncall (nargs, args);
+ ret = funcall (nargs, args);
}
}
@@ -2604,7 +2627,7 @@ run_hook_with_args_2 (Lisp_Object hook, Lisp_Object arg1, Lisp_Object arg2)
Frun_hook_with_args (3, temp);
}
-/* Apply fn to arg */
+/* Apply fn to arg. */
Lisp_Object
apply1 (Lisp_Object fn, Lisp_Object arg)
{
@@ -2623,7 +2646,7 @@ apply1 (Lisp_Object fn, Lisp_Object arg)
}
}
-/* Call function fn on no arguments */
+/* Call function fn on no arguments. */
Lisp_Object
call0 (Lisp_Object fn)
{
@@ -2633,7 +2656,7 @@ call0 (Lisp_Object fn)
RETURN_UNGCPRO (Ffuncall (1, &fn));
}
-/* Call function fn with 1 argument arg1 */
+/* Call function fn with 1 argument arg1. */
/* ARGSUSED */
Lisp_Object
call1 (Lisp_Object fn, Lisp_Object arg1)
@@ -2648,7 +2671,7 @@ call1 (Lisp_Object fn, Lisp_Object arg1)
RETURN_UNGCPRO (Ffuncall (2, args));
}
-/* Call function fn with 2 arguments arg1, arg2 */
+/* Call function fn with 2 arguments arg1, arg2. */
/* ARGSUSED */
Lisp_Object
call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
@@ -2663,7 +2686,7 @@ call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
RETURN_UNGCPRO (Ffuncall (3, args));
}
-/* Call function fn with 3 arguments arg1, arg2, arg3 */
+/* Call function fn with 3 arguments arg1, arg2, arg3. */
/* ARGSUSED */
Lisp_Object
call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
@@ -2679,7 +2702,7 @@ call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
RETURN_UNGCPRO (Ffuncall (4, args));
}
-/* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */
+/* Call function fn with 4 arguments arg1, arg2, arg3, arg4. */
/* ARGSUSED */
Lisp_Object
call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
@@ -2697,7 +2720,7 @@ call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
RETURN_UNGCPRO (Ffuncall (5, args));
}
-/* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */
+/* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5. */
/* ARGSUSED */
Lisp_Object
call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
@@ -2716,7 +2739,7 @@ call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
RETURN_UNGCPRO (Ffuncall (6, args));
}
-/* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */
+/* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6. */
/* ARGSUSED */
Lisp_Object
call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
@@ -2736,7 +2759,7 @@ call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
RETURN_UNGCPRO (Ffuncall (7, args));
}
-/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */
+/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7. */
/* ARGSUSED */
Lisp_Object
call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
@@ -3082,7 +3105,7 @@ grow_specpdl (void)
specpdl_ptr = specpdl + count;
}
-/* specpdl_ptr->symbol is a field which describes which variable is
+/* `specpdl_ptr->symbol' is a field which describes which variable is
let-bound, so it can be properly undone when we unbind_to.
It can have the following two shapes:
- SYMBOL : if it's a plain symbol, it means that we have let-bound
@@ -3320,7 +3343,7 @@ Output stream used is value of `standard-output'. */)
else
{
tem = *backlist->function;
- Fprin1 (tem, Qnil); /* This can QUIT */
+ Fprin1 (tem, Qnil); /* This can QUIT. */
write_string ("(", -1);
if (backlist->nargs == (size_t) MANY)
{
@@ -3593,6 +3616,7 @@ The value the function returns is not used. */);
defsubr (&Srun_hook_with_args);
defsubr (&Srun_hook_with_args_until_success);
defsubr (&Srun_hook_with_args_until_failure);
+ defsubr (&Srun_hook_wrapped);
defsubr (&Sfetch_bytecode);
defsubr (&Sbacktrace_debug);
defsubr (&Sbacktrace);
diff --git a/src/keyboard.c b/src/keyboard.c
index 6c706590dc4..86a2b3e8abd 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -254,7 +254,6 @@ Lisp_Object Qecho_area_clear_hook;
/* Hooks to run before and after each command. */
Lisp_Object Qpre_command_hook;
Lisp_Object Qpost_command_hook;
-Lisp_Object Qcommand_hook_internal;
Lisp_Object Qdeferred_action_function;
@@ -1815,20 +1814,63 @@ adjust_point_for_property (EMACS_INT last_pt, int modified)
static Lisp_Object
safe_run_hooks_1 (void)
{
- return Frun_hooks (1, &Vinhibit_quit);
+ eassert (CONSP (Vinhibit_quit));
+ return call0 (XCDR (Vinhibit_quit));
}
-/* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */
+/* Subroutine for safe_run_hooks: handle an error by clearing out the function
+ from the hook. */
static Lisp_Object
-safe_run_hooks_error (Lisp_Object data)
+safe_run_hooks_error (Lisp_Object error_data)
+{
+ Lisp_Object hook
+ = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit;
+ Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil;
+ Lisp_Object args[4];
+ args[0] = build_string ("Error in %s (%s): %s");
+ args[1] = hook;
+ args[2] = fun;
+ args[3] = error_data;
+ Fmessage (4, args);
+ if (SYMBOLP (hook))
+ {
+ Lisp_Object val;
+ int found = 0;
+ Lisp_Object newval = Qnil;
+ for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val))
+ if (EQ (fun, XCAR (val)))
+ found = 1;
+ else
+ newval = Fcons (XCAR (val), newval);
+ if (found)
+ return Fset (hook, Fnreverse (newval));
+ /* Not found in the local part of the hook. Let's look at the global
+ part. */
+ newval = Qnil;
+ for (val = (NILP (Fdefault_boundp (hook)) ? Qnil
+ : Fdefault_value (hook));
+ CONSP (val); val = XCDR (val))
+ if (EQ (fun, XCAR (val)))
+ found = 1;
+ else
+ newval = Fcons (XCAR (val), newval);
+ if (found)
+ return Fset_default (hook, Fnreverse (newval));
+ }
+ return Qnil;
+}
+
+static Lisp_Object
+safe_run_hook_funcall (size_t nargs, Lisp_Object *args)
{
- Lisp_Object args[3];
- args[0] = build_string ("Error in %s: %s");
- args[1] = Vinhibit_quit;
- args[2] = data;
- Fmessage (3, args);
- return Fset (Vinhibit_quit, Qnil);
+ eassert (nargs == 1);
+ if (CONSP (Vinhibit_quit))
+ XSETCDR (Vinhibit_quit, args[0]);
+ else
+ Vinhibit_quit = Fcons (Vinhibit_quit, args[0]);
+
+ return internal_condition_case (safe_run_hooks_1, Qt, safe_run_hooks_error);
}
/* If we get an error while running the hook, cause the hook variable
@@ -1838,10 +1880,13 @@ safe_run_hooks_error (Lisp_Object data)
void
safe_run_hooks (Lisp_Object hook)
{
+ /* FIXME: our `internal_condition_case' does not provide any way to pass data
+ to its body or to its handlers other than via globals such as
+ dynamically-bound variables ;-) */
int count = SPECPDL_INDEX ();
specbind (Qinhibit_quit, hook);
- internal_condition_case (safe_run_hooks_1, Qt, safe_run_hooks_error);
+ run_hook_with_args (1, &hook, safe_run_hook_funcall);
unbind_to (count, Qnil);
}
@@ -11442,9 +11487,6 @@ syms_of_keyboard (void)
Qdeferred_action_function = intern_c_string ("deferred-action-function");
staticpro (&Qdeferred_action_function);
- Qcommand_hook_internal = intern_c_string ("command-hook-internal");
- staticpro (&Qcommand_hook_internal);
-
Qfunction_key = intern_c_string ("function-key");
staticpro (&Qfunction_key);
Qmouse_click = intern_c_string ("mouse-click");
@@ -11912,22 +11954,18 @@ Buffer modification stores t in this variable. */);
Qdeactivate_mark = intern_c_string ("deactivate-mark");
staticpro (&Qdeactivate_mark);
- DEFVAR_LISP ("command-hook-internal", Vcommand_hook_internal,
- doc: /* Temporary storage of `pre-command-hook' or `post-command-hook'. */);
- Vcommand_hook_internal = Qnil;
-
DEFVAR_LISP ("pre-command-hook", Vpre_command_hook,
doc: /* Normal hook run before each command is executed.
If an unhandled error happens in running this hook,
-the hook value is set to nil, since otherwise the error
-might happen repeatedly and make Emacs nonfunctional. */);
+the function in which the error occurred is unconditionally removed, since
+otherwise the error might happen repeatedly and make Emacs nonfunctional. */);
Vpre_command_hook = Qnil;
DEFVAR_LISP ("post-command-hook", Vpost_command_hook,
doc: /* Normal hook run after each command is executed.
If an unhandled error happens in running this hook,
-the hook value is set to nil, since otherwise the error
-might happen repeatedly and make Emacs nonfunctional. */);
+the function in which the error occurred is unconditionally removed, since
+otherwise the error might happen repeatedly and make Emacs nonfunctional. */);
Vpost_command_hook = Qnil;
#if 0
diff --git a/src/keymap.c b/src/keymap.c
index 440df06ba4e..10000b935aa 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2387,7 +2387,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi
/* Now we are sure that C is a valid character code. */
if (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! force_multibyte)
- *p++ = multibyte_char_to_unibyte (c, Qnil);
+ *p++ = multibyte_char_to_unibyte (c);
else
p += CHAR_STRING (c, (unsigned char *) p);
}
diff --git a/src/lisp.h b/src/lisp.h
index edf6130e5b5..85838d111db 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2278,7 +2278,7 @@ void staticpro (Lisp_Object *);
struct window;
struct frame;
-/* Defined in data.c */
+/* Defined in data.c. */
extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
extern Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
@@ -2403,7 +2403,7 @@ EXFUN (Fchar_width, 1);
EXFUN (Fstring, MANY);
extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT);
extern EMACS_INT multibyte_chars_in_text (const unsigned char *, EMACS_INT);
-extern int multibyte_char_to_unibyte (int, Lisp_Object);
+extern int multibyte_char_to_unibyte (int);
extern int multibyte_char_to_unibyte_safe (int);
extern void init_character_once (void);
extern void syms_of_character (void);
@@ -2812,7 +2812,7 @@ extern void init_obarray (void);
extern void init_lread (void);
extern void syms_of_lread (void);
-/* Defined in eval.c */
+/* Defined in eval.c. */
extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
extern Lisp_Object Qinhibit_quit;
extern Lisp_Object Vautoload_queue;
@@ -2830,6 +2830,9 @@ EXFUN (Frun_hooks, MANY);
EXFUN (Frun_hook_with_args, MANY);
EXFUN (Frun_hook_with_args_until_failure, MANY);
extern void run_hook_with_args_2 (Lisp_Object, Lisp_Object, Lisp_Object);
+extern Lisp_Object run_hook_with_args (size_t nargs, Lisp_Object *args,
+ Lisp_Object (*funcall)
+ (size_t nargs, Lisp_Object *args));
EXFUN (Fprogn, UNEVALLED);
EXFUN (Finteractive_p, 0);
EXFUN (Fthrow, 2) NO_RETURN;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index e8d4a256906..623c933ce8e 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1705,7 +1705,6 @@ void process_dialog (id window, Lisp_Object list)
- (Lisp_Object)runDialogAt: (NSPoint)p
{
NSInteger ret;
- extern EMACS_TIME timer_check (int do_it_now); /* TODO: add to a header */
/* initiate a session that will be ended by pop_down_menu */
popupSession = [NSApp beginModalSessionForWindow: self];
@@ -1715,7 +1714,7 @@ void process_dialog (id window, Lisp_Object list)
{
/* Run this for timers.el, indep of atimers; might not return.
TODO: use return value to avoid calling every iteration. */
- timer_check (1);
+ timer_check ();
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]];
}
diff --git a/src/nsterm.m b/src/nsterm.m
index c7cd411c614..91f0cbba585 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -170,6 +170,7 @@ BOOL ns_in_resize = NO;
static BOOL ns_fake_keydown = NO;
int ns_tmp_flags; /* FIXME */
struct nsfont_info *ns_tmp_font; /* FIXME */
+static BOOL ns_menu_bar_is_hidden = NO;
/*static int debug_lock = 0; */
/* event loop */
@@ -505,6 +506,118 @@ ns_resize_handle_rect (NSWindow *window)
}
+//
+// Window constraining
+// -------------------
+//
+// To ensure that the windows are not placed under the menu bar, they
+// are typically moved by the call-back constrainFrameRect. However,
+// by overriding it, it's possible to inhibit this, leaving the window
+// in it's original position.
+//
+// It's possible to hide the menu bar. However, technically, it's only
+// possible to hide it when the application is active. To ensure that
+// this work properly, the menu bar and window constraining are
+// deferred until the application becomes active.
+//
+// Even though it's not possible to manually move a window above the
+// top of the screen, it is allowed if it's done programmatically,
+// when the menu is hidden. This allows the editable area to cover the
+// full screen height.
+//
+// Test cases
+// ----------
+//
+// Use the following extra files:
+//
+// init.el:
+// ;; Hide menu and place frame slightly above the top of the screen.
+// (setq ns-auto-hide-menu-bar t)
+// (set-frame-position (selected-frame) 0 -20)
+//
+// Test 1:
+//
+// emacs -Q -l init.el
+//
+// Result: No menu bar, and the title bar should be above the screen.
+//
+// Test 2:
+//
+// emacs -Q
+//
+// Result: Menu bar visible, frame placed immediately below the menu.
+//
+
+static void
+ns_constrain_all_frames (void)
+{
+ Lisp_Object tail, frame;
+
+ FOR_EACH_FRAME (tail, frame)
+ {
+ struct frame *f = XFRAME (frame);
+ if (FRAME_NS_P (f))
+ {
+ NSView *view = FRAME_NS_VIEW (f);
+ /* This no-op will trigger the default window placing
+ * constriant system. */
+ f->output_data.ns->dont_constrain = 0;
+ [[view window] setFrameOrigin:[[view window] frame].origin];
+ }
+ }
+}
+
+
+/* True, if the menu bar should be hidden. */
+
+static BOOL
+ns_menu_bar_should_be_hidden (void)
+{
+ return !NILP (ns_auto_hide_menu_bar)
+ && [NSApp respondsToSelector:@selector(setPresentationOptions:)];
+}
+
+
+/* Show or hide the menu bar, based on user setting. */
+
+static void
+ns_update_auto_hide_menu_bar (void)
+{
+ BLOCK_INPUT;
+
+ NSTRACE (ns_update_auto_hide_menu_bar);
+
+ if (NSApp != nil
+ && [NSApp isActive]
+ && [NSApp respondsToSelector:@selector(setPresentationOptions:)])
+ {
+ // Note, "setPresentationOptions" triggers an error unless the
+ // application is active.
+ BOOL menu_bar_should_be_hidden = ns_menu_bar_should_be_hidden ();
+
+ if (menu_bar_should_be_hidden != ns_menu_bar_is_hidden)
+ {
+ NSApplicationPresentationOptions options
+ = NSApplicationPresentationAutoHideDock;
+
+ if (menu_bar_should_be_hidden)
+ options |= NSApplicationPresentationAutoHideMenuBar;
+
+ [NSApp setPresentationOptions: options];
+
+ ns_menu_bar_is_hidden = menu_bar_should_be_hidden;
+
+ if (!ns_menu_bar_is_hidden)
+ {
+ ns_constrain_all_frames ();
+ }
+ }
+ }
+
+ UNBLOCK_INPUT;
+}
+
+
static void
ns_update_begin (struct frame *f)
/* --------------------------------------------------------------------------
@@ -515,6 +628,8 @@ ns_update_begin (struct frame *f)
NSView *view = FRAME_NS_VIEW (f);
NSTRACE (ns_update_begin);
+ ns_update_auto_hide_menu_bar ();
+
ns_updating_frame = f;
[view lockFocus];
@@ -4205,7 +4320,13 @@ ns_term_shutdown (int sig)
}
- (void)applicationDidBecomeActive: (NSNotification *)notification
{
+ NSTRACE (applicationDidBecomeActive);
+
//ns_app_active=YES;
+
+ ns_update_auto_hide_menu_bar ();
+ // No constrining takes place when the application is not active.
+ ns_constrain_all_frames ();
}
- (void)applicationDidResignActive: (NSNotification *)notification
{
@@ -5689,7 +5810,10 @@ ns_term_shutdown (int sig)
/* When making the frame visible for the first time, we want to
constrain. Other times not. */
struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
- if (f->output_data.ns->dont_constrain)
+ NSTRACE (constrainFrameRect);
+
+ if (f->output_data.ns->dont_constrain
+ || ns_menu_bar_should_be_hidden ())
return frameRect;
f->output_data.ns->dont_constrain = 1;
@@ -6361,6 +6485,11 @@ allowing it to be used at a lower level for accented character entry.");
staticpro (&last_mouse_motion_frame);
last_mouse_motion_frame = Qnil;
+ DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar,
+ doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near.
+Only works on OSX 10.6 or later. */);
+ ns_auto_hide_menu_bar = Qnil;
+
/* TODO: move to common code */
DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
doc: /* If not nil, Emacs uses toolkit scroll bars. */);
diff --git a/src/print.c b/src/print.c
index 5b2778cf251..e44d4d14f36 100644
--- a/src/print.c
+++ b/src/print.c
@@ -273,7 +273,7 @@ printchar (unsigned int ch, Lisp_Object fun)
static void
strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
- Lisp_Object printcharfun, int multibyte)
+ Lisp_Object printcharfun)
{
if (size < 0)
size_byte = size = strlen (ptr);
@@ -406,16 +406,13 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
SAFE_ALLOCA (buffer, char *, nbytes);
memcpy (buffer, SDATA (string), nbytes);
- strout (buffer, chars, SBYTES (string),
- printcharfun, STRING_MULTIBYTE (string));
+ strout (buffer, chars, SBYTES (string), printcharfun);
SAFE_FREE ();
}
else
/* No need to copy, since output to print_buffer can't GC. */
- strout (SSDATA (string),
- chars, SBYTES (string),
- printcharfun, STRING_MULTIBYTE (string));
+ strout (SSDATA (string), chars, SBYTES (string), printcharfun);
}
else
{
@@ -472,7 +469,7 @@ write_string (const char *data, int size)
printcharfun = Vstandard_output;
PRINTPREPARE;
- strout (data, size, size, printcharfun, 0);
+ strout (data, size, size, printcharfun);
PRINTFINISH;
}
@@ -486,7 +483,7 @@ write_string_1 (const char *data, int size, Lisp_Object printcharfun)
PRINTDECLARE;
PRINTPREPARE;
- strout (data, size, size, printcharfun, 0);
+ strout (data, size, size, printcharfun);
PRINTFINISH;
}
@@ -1404,7 +1401,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
if (EQ (obj, being_printed[i]))
{
sprintf (buf, "#%d", i);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
return;
}
being_printed[print_depth] = obj;
@@ -1420,7 +1417,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
{ /* Add a prefix #n= if OBJ has not yet been printed;
that is, its status field is nil. */
sprintf (buf, "#%d=", -n);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
/* OBJ is going to be printed. Remember that fact. */
Fputhash (obj, make_number (- n), Vprint_number_table);
}
@@ -1428,7 +1425,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
{
/* Just print #n# if OBJ has already been printed. */
sprintf (buf, "#%d#", n);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
return;
}
}
@@ -1446,7 +1443,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
sprintf (buf, "%ld", (long) XINT (obj));
else
abort ();
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
break;
case Lisp_Float:
@@ -1454,7 +1451,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
char pigbuf[FLOAT_TO_STRING_BUFSIZE];
float_to_string (pigbuf, XFLOAT_DATA (obj));
- strout (pigbuf, -1, -1, printcharfun, 0);
+ strout (pigbuf, -1, -1, printcharfun);
}
break;
@@ -1532,7 +1529,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
sprintf (outbuf, "\\x%04x", c);
need_nonhex = 1;
}
- strout (outbuf, -1, -1, printcharfun, 0);
+ strout (outbuf, -1, -1, printcharfun);
}
else if (! multibyte
&& SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c)
@@ -1544,7 +1541,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
using octal escapes. */
char outbuf[5];
sprintf (outbuf, "\\%03o", c);
- strout (outbuf, -1, -1, printcharfun, 0);
+ strout (outbuf, -1, -1, printcharfun);
}
else
{
@@ -1557,7 +1554,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
if ((c >= 'a' && c <= 'f')
|| (c >= 'A' && c <= 'F')
|| (c >= '0' && c <= '9'))
- strout ("\\ ", -1, -1, printcharfun, 0);
+ strout ("\\ ", -1, -1, printcharfun);
}
if (c == '\"' || c == '\\')
@@ -1645,7 +1642,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
/* If deeper than spec'd depth, print placeholder. */
if (INTEGERP (Vprint_level)
&& print_depth > XINT (Vprint_level))
- strout ("...", -1, -1, printcharfun, 0);
+ strout ("...", -1, -1, printcharfun);
else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
&& (EQ (XCAR (obj), Qquote)))
{
@@ -1705,7 +1702,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
if (i != 0 && EQ (obj, halftail))
{
sprintf (buf, " . #%d", i / 2);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
goto end_of_list;
}
}
@@ -1717,7 +1714,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
if (INTEGERP (num))
{
- strout (" . ", 3, 3, printcharfun, 0);
+ strout (" . ", 3, 3, printcharfun);
print_object (obj, printcharfun, escapeflag);
goto end_of_list;
}
@@ -1729,7 +1726,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
if (print_length && i > print_length)
{
- strout ("...", 3, 3, printcharfun, 0);
+ strout ("...", 3, 3, printcharfun);
goto end_of_list;
}
@@ -1744,7 +1741,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
/* OBJ non-nil here means it's the end of a dotted list. */
if (!NILP (obj))
{
- strout (" . ", 3, 3, printcharfun, 0);
+ strout (" . ", 3, 3, printcharfun);
print_object (obj, printcharfun, escapeflag);
}
@@ -1758,7 +1755,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
{
if (escapeflag)
{
- strout ("#<process ", -1, -1, printcharfun, 0);
+ strout ("#<process ", -1, -1, printcharfun);
print_string (XPROCESS (obj)->name, printcharfun);
PRINTCHAR ('>');
}
@@ -1779,7 +1776,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
PRINTCHAR ('#');
PRINTCHAR ('&');
sprintf (buf, "%ld", (long) XBOOL_VECTOR (obj)->size);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
PRINTCHAR ('\"');
/* Don't print more characters than the specified maximum.
@@ -1824,18 +1821,18 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
}
else if (SUBRP (obj))
{
- strout ("#<subr ", -1, -1, printcharfun, 0);
- strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun, 0);
+ strout ("#<subr ", -1, -1, printcharfun);
+ strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun);
PRINTCHAR ('>');
}
else if (WINDOWP (obj))
{
- strout ("#<window ", -1, -1, printcharfun, 0);
+ strout ("#<window ", -1, -1, printcharfun);
sprintf (buf, "%ld", (long) XFASTINT (XWINDOW (obj)->sequence_number));
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
if (!NILP (XWINDOW (obj)->buffer))
{
- strout (" on ", -1, -1, printcharfun, 0);
+ strout (" on ", -1, -1, printcharfun);
print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun);
}
PRINTCHAR ('>');
@@ -1843,13 +1840,13 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
else if (TERMINALP (obj))
{
struct terminal *t = XTERMINAL (obj);
- strout ("#<terminal ", -1, -1, printcharfun, 0);
+ strout ("#<terminal ", -1, -1, printcharfun);
sprintf (buf, "%d", t->id);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
if (t->name)
{
- strout (" on ", -1, -1, printcharfun, 0);
- strout (t->name, -1, -1, printcharfun, 0);
+ strout (" on ", -1, -1, printcharfun);
+ strout (t->name, -1, -1, printcharfun);
}
PRINTCHAR ('>');
}
@@ -1859,21 +1856,21 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
int i;
EMACS_INT real_size, size;
#if 0
- strout ("#<hash-table", -1, -1, printcharfun, 0);
+ strout ("#<hash-table", -1, -1, printcharfun);
if (SYMBOLP (h->test))
{
PRINTCHAR (' ');
PRINTCHAR ('\'');
- strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun, 0);
+ strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun);
PRINTCHAR (' ');
- strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0);
+ strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun);
PRINTCHAR (' ');
sprintf (buf, "%ld/%ld", (long) h->count,
(long) XVECTOR (h->next)->size);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
}
sprintf (buf, " 0x%lx", (unsigned long) h);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
PRINTCHAR ('>');
#endif
/* Implement a readable output, e.g.:
@@ -1881,33 +1878,33 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
/* Always print the size. */
sprintf (buf, "#s(hash-table size %ld",
(long) XVECTOR (h->next)->size);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
if (!NILP (h->test))
{
- strout (" test ", -1, -1, printcharfun, 0);
+ strout (" test ", -1, -1, printcharfun);
print_object (h->test, printcharfun, escapeflag);
}
if (!NILP (h->weak))
{
- strout (" weakness ", -1, -1, printcharfun, 0);
+ strout (" weakness ", -1, -1, printcharfun);
print_object (h->weak, printcharfun, escapeflag);
}
if (!NILP (h->rehash_size))
{
- strout (" rehash-size ", -1, -1, printcharfun, 0);
+ strout (" rehash-size ", -1, -1, printcharfun);
print_object (h->rehash_size, printcharfun, escapeflag);
}
if (!NILP (h->rehash_threshold))
{
- strout (" rehash-threshold ", -1, -1, printcharfun, 0);
+ strout (" rehash-threshold ", -1, -1, printcharfun);
print_object (h->rehash_threshold, printcharfun, escapeflag);
}
- strout (" data ", -1, -1, printcharfun, 0);
+ strout (" data ", -1, -1, printcharfun);
/* Print the data here as a plist. */
real_size = HASH_TABLE_SIZE (h);
@@ -1929,7 +1926,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
}
if (size < real_size)
- strout (" ...", 4, 4, printcharfun, 0);
+ strout (" ...", 4, 4, printcharfun);
PRINTCHAR (')');
PRINTCHAR (')');
@@ -1938,10 +1935,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
else if (BUFFERP (obj))
{
if (NILP (BVAR (XBUFFER (obj), name)))
- strout ("#<killed buffer>", -1, -1, printcharfun, 0);
+ strout ("#<killed buffer>", -1, -1, printcharfun);
else if (escapeflag)
{
- strout ("#<buffer ", -1, -1, printcharfun, 0);
+ strout ("#<buffer ", -1, -1, printcharfun);
print_string (BVAR (XBUFFER (obj), name), printcharfun);
PRINTCHAR ('>');
}
@@ -1950,16 +1947,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
}
else if (WINDOW_CONFIGURATIONP (obj))
{
- strout ("#<window-configuration>", -1, -1, printcharfun, 0);
+ strout ("#<window-configuration>", -1, -1, printcharfun);
}
else if (FRAMEP (obj))
{
strout ((FRAME_LIVE_P (XFRAME (obj))
? "#<frame " : "#<dead frame "),
- -1, -1, printcharfun, 0);
+ -1, -1, printcharfun);
print_string (XFRAME (obj)->name, printcharfun);
sprintf (buf, " 0x%lx", (unsigned long) (XFRAME (obj)));
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
PRINTCHAR ('>');
}
else if (FONTP (obj))
@@ -1969,9 +1966,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
if (! FONT_OBJECT_P (obj))
{
if (FONT_SPEC_P (obj))
- strout ("#<font-spec", -1, -1, printcharfun, 0);
+ strout ("#<font-spec", -1, -1, printcharfun);
else
- strout ("#<font-entity", -1, -1, printcharfun, 0);
+ strout ("#<font-entity", -1, -1, printcharfun);
for (i = 0; i < FONT_SPEC_MAX; i++)
{
PRINTCHAR (' ');
@@ -1984,7 +1981,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
}
else
{
- strout ("#<font-object ", -1, -1, printcharfun, 0);
+ strout ("#<font-object ", -1, -1, printcharfun);
print_object (AREF (obj, FONT_NAME_INDEX), printcharfun,
escapeflag);
}
@@ -2037,7 +2034,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
print_object (tem, printcharfun, escapeflag);
}
if (size < real_size)
- strout (" ...", 4, 4, printcharfun, 0);
+ strout (" ...", 4, 4, printcharfun);
}
PRINTCHAR (']');
}
@@ -2047,32 +2044,32 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
switch (XMISCTYPE (obj))
{
case Lisp_Misc_Marker:
- strout ("#<marker ", -1, -1, printcharfun, 0);
+ strout ("#<marker ", -1, -1, printcharfun);
/* Do you think this is necessary? */
if (XMARKER (obj)->insertion_type != 0)
- strout ("(moves after insertion) ", -1, -1, printcharfun, 0);
+ strout ("(moves after insertion) ", -1, -1, printcharfun);
if (! XMARKER (obj)->buffer)
- strout ("in no buffer", -1, -1, printcharfun, 0);
+ strout ("in no buffer", -1, -1, printcharfun);
else
{
sprintf (buf, "at %ld", (long)marker_position (obj));
- strout (buf, -1, -1, printcharfun, 0);
- strout (" in ", -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
+ strout (" in ", -1, -1, printcharfun);
print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun);
}
PRINTCHAR ('>');
break;
case Lisp_Misc_Overlay:
- strout ("#<overlay ", -1, -1, printcharfun, 0);
+ strout ("#<overlay ", -1, -1, printcharfun);
if (! XMARKER (OVERLAY_START (obj))->buffer)
- strout ("in no buffer", -1, -1, printcharfun, 0);
+ strout ("in no buffer", -1, -1, printcharfun);
else
{
sprintf (buf, "from %ld to %ld in ",
(long)marker_position (OVERLAY_START (obj)),
(long)marker_position (OVERLAY_END (obj)));
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name),
printcharfun);
}
@@ -2082,15 +2079,15 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
/* Remaining cases shouldn't happen in normal usage, but let's print
them anyway for the benefit of the debugger. */
case Lisp_Misc_Free:
- strout ("#<misc free cell>", -1, -1, printcharfun, 0);
+ strout ("#<misc free cell>", -1, -1, printcharfun);
break;
case Lisp_Misc_Save_Value:
- strout ("#<save_value ", -1, -1, printcharfun, 0);
+ strout ("#<save_value ", -1, -1, printcharfun);
sprintf(buf, "ptr=0x%08lx int=%d",
(unsigned long) XSAVE_VALUE (obj)->pointer,
XSAVE_VALUE (obj)->integer);
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
PRINTCHAR ('>');
break;
@@ -2104,16 +2101,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
{
/* We're in trouble if this happens!
Probably should just abort () */
- strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun, 0);
+ strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun);
if (MISCP (obj))
sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
else if (VECTORLIKEP (obj))
sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size);
else
sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
- strout (buf, -1, -1, printcharfun, 0);
+ strout (buf, -1, -1, printcharfun);
strout (" Save your buffers immediately and please report this bug>",
- -1, -1, printcharfun, 0);
+ -1, -1, printcharfun);
}
}
diff --git a/src/scroll.c b/src/scroll.c
index f013ebbee0e..fcec596daa3 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -239,7 +239,9 @@ calculate_scrolling (FRAME_PTR frame,
of lines. */
static void
-do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct matrix_elt *matrix, int window_size, int unchanged_at_top)
+do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
+ struct matrix_elt *matrix, int window_size,
+ int unchanged_at_top)
{
struct matrix_elt *p;
int i, j, k;
@@ -831,7 +833,9 @@ scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top,
such a line will have little weight. */
int
-scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *cost)
+scrolling_max_lines_saved (int start, int end,
+ int *oldhash, int *newhash,
+ int *cost)
{
struct { int hash; int count; } lines[01000];
register int i, h;
@@ -920,7 +924,8 @@ scroll_cost (FRAME_PTR frame, int from, int to, int amount)
overhead and multiply factor values */
static void
-line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int *ov, register int *mf)
+line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
+ register int *ov, register int *mf)
{
register EMACS_INT i;
register EMACS_INT frame_lines = FRAME_LINES (frame);
diff --git a/src/search.c b/src/search.c
index bf93a7fe442..682fa185bbb 100644
--- a/src/search.c
+++ b/src/search.c
@@ -95,10 +95,9 @@ static void save_search_regs (void);
static EMACS_INT simple_search (EMACS_INT, unsigned char *, EMACS_INT,
EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT,
EMACS_INT, EMACS_INT);
-static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, EMACS_INT, EMACS_INT,
- Lisp_Object, Lisp_Object,
- EMACS_INT, EMACS_INT,
- EMACS_INT, EMACS_INT, int);
+static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, EMACS_INT,
+ Lisp_Object, Lisp_Object, EMACS_INT,
+ EMACS_INT, int);
static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT,
EMACS_INT, EMACS_INT, EMACS_INT, int,
Lisp_Object, Lisp_Object, int);
@@ -1416,15 +1415,14 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
}
len_byte = pat - patbuf;
- len = raw_pattern_size;
pat = base_pat = patbuf;
if (boyer_moore_ok)
- return boyer_moore (n, pat, len, len_byte, trt, inverse_trt,
- pos, pos_byte, lim, lim_byte,
+ return boyer_moore (n, pat, len_byte, trt, inverse_trt,
+ pos_byte, lim_byte,
char_base);
else
- return simple_search (n, pat, len, len_byte, trt,
+ return simple_search (n, pat, raw_pattern_size, len_byte, trt,
pos, pos_byte, lim, lim_byte);
}
}
@@ -1636,8 +1634,8 @@ simple_search (EMACS_INT n, unsigned char *pat,
}
/* Do Boyer-Moore search N times for the string BASE_PAT,
- whose length is LEN/LEN_BYTE,
- from buffer position POS/POS_BYTE until LIM/LIM_BYTE.
+ whose length is LEN_BYTE,
+ from buffer position POS_BYTE until LIM_BYTE.
DIRECTION says which direction we search in.
TRT and INVERSE_TRT are translation tables.
Characters in PAT are already translated by TRT.
@@ -1652,10 +1650,10 @@ simple_search (EMACS_INT n, unsigned char *pat,
static EMACS_INT
boyer_moore (EMACS_INT n, unsigned char *base_pat,
- EMACS_INT len, EMACS_INT len_byte,
+ EMACS_INT len_byte,
Lisp_Object trt, Lisp_Object inverse_trt,
- EMACS_INT pos, EMACS_INT pos_byte,
- EMACS_INT lim, EMACS_INT lim_byte, int char_base)
+ EMACS_INT pos_byte, EMACS_INT lim_byte,
+ int char_base)
{
int direction = ((n > 0) ? 1 : -1);
register EMACS_INT dirlen;
@@ -1776,8 +1774,8 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
stride_for_teases = BM_tab[j];
BM_tab[j] = dirlen - i;
- /* A translation table is accompanied by its inverse -- see */
- /* comment following downcase_table for details */
+ /* A translation table is accompanied by its inverse -- see
+ comment following downcase_table for details. */
if (ch >= 0)
{
int starting_ch = ch;
@@ -2636,11 +2634,8 @@ since only regular expressions have distinguished subexpressions. */)
EMACS_INT substed_alloc_size, substed_len;
int buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
int str_multibyte = STRING_MULTIBYTE (newtext);
- Lisp_Object rev_tbl;
int really_changed = 0;
- rev_tbl = Qnil;
-
substed_alloc_size = length * 2 + 100;
substed = (unsigned char *) xmalloc (substed_alloc_size + 1);
substed_len = 0;
@@ -2660,7 +2655,7 @@ since only regular expressions have distinguished subexpressions. */)
{
FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte);
if (!buf_multibyte)
- c = multibyte_char_to_unibyte (c, rev_tbl);
+ c = multibyte_char_to_unibyte (c);
}
else
{
@@ -2683,7 +2678,7 @@ since only regular expressions have distinguished subexpressions. */)
FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext,
pos, pos_byte);
if (!buf_multibyte && !ASCII_CHAR_P (c))
- c = multibyte_char_to_unibyte (c, rev_tbl);
+ c = multibyte_char_to_unibyte (c);
}
else
{
diff --git a/src/w32.c b/src/w32.c
index 5643b3f073e..da403671115 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1505,6 +1505,7 @@ w32_get_resource (char *key, LPDWORD lpdwtype)
}
char *get_emacs_configuration (void);
+
void
init_environment (char ** argv)
{
@@ -1591,25 +1592,25 @@ init_environment (char ** argv)
If not, then we can try to default to the appdata directory under the
user's profile, which is more likely to be writable. */
if (stat ("C:/.emacs", &ignored) < 0)
- {
- HRESULT profile_result;
- /* Dynamically load ShGetFolderPath, as it won't exist on versions
- of Windows 95 and NT4 that have not been updated to include
- MSIE 5. */
- ShGetFolderPath_fn get_folder_path;
- get_folder_path = (ShGetFolderPath_fn)
- GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA");
-
- if (get_folder_path != NULL)
- {
- profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL,
- 0, default_home);
+ {
+ HRESULT profile_result;
+ /* Dynamically load ShGetFolderPath, as it won't exist on versions
+ of Windows 95 and NT4 that have not been updated to include
+ MSIE 5. */
+ ShGetFolderPath_fn get_folder_path;
+ get_folder_path = (ShGetFolderPath_fn)
+ GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA");
+
+ if (get_folder_path != NULL)
+ {
+ profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL,
+ 0, default_home);
- /* If we can't get the appdata dir, revert to old behavior. */
- if (profile_result == S_OK)
- env_vars[0].def_value = default_home;
- }
- }
+ /* If we can't get the appdata dir, revert to old behavior. */
+ if (profile_result == S_OK)
+ env_vars[0].def_value = default_home;
+ }
+ }
/* Get default locale info and use it for LANG. */
if (GetLocaleInfo (LOCALE_USER_DEFAULT,
@@ -2082,42 +2083,42 @@ GetCachedVolumeInformation (char * root_dir)
info = lookup_volume_info (root_dir);
if (info == NULL || ! VOLINFO_STILL_VALID (root_dir, info))
- {
- char name[ 256 ];
- DWORD serialnum;
- DWORD maxcomp;
- DWORD flags;
- char type[ 256 ];
-
- /* Info is not cached, or is stale. */
- if (!GetVolumeInformation (root_dir,
- name, sizeof (name),
- &serialnum,
- &maxcomp,
- &flags,
- type, sizeof (type)))
- return NULL;
+ {
+ char name[ 256 ];
+ DWORD serialnum;
+ DWORD maxcomp;
+ DWORD flags;
+ char type[ 256 ];
+
+ /* Info is not cached, or is stale. */
+ if (!GetVolumeInformation (root_dir,
+ name, sizeof (name),
+ &serialnum,
+ &maxcomp,
+ &flags,
+ type, sizeof (type)))
+ return NULL;
- /* Cache the volume information for future use, overwriting existing
- entry if present. */
- if (info == NULL)
- {
- info = (volume_info_data *) xmalloc (sizeof (volume_info_data));
- add_volume_info (root_dir, info);
- }
- else
- {
- xfree (info->name);
- xfree (info->type);
- }
+ /* Cache the volume information for future use, overwriting existing
+ entry if present. */
+ if (info == NULL)
+ {
+ info = (volume_info_data *) xmalloc (sizeof (volume_info_data));
+ add_volume_info (root_dir, info);
+ }
+ else
+ {
+ xfree (info->name);
+ xfree (info->type);
+ }
- info->name = xstrdup (name);
- info->serialnum = serialnum;
- info->maxcomp = maxcomp;
- info->flags = flags;
- info->type = xstrdup (type);
- info->timestamp = GetTickCount ();
- }
+ info->name = xstrdup (name);
+ info->serialnum = serialnum;
+ info->maxcomp = maxcomp;
+ info->flags = flags;
+ info->type = xstrdup (type);
+ info->timestamp = GetTickCount ();
+ }
return info;
}
@@ -4517,75 +4518,75 @@ struct {
int errnum;
char * msg;
} _wsa_errlist[] = {
- WSAEINTR , "Interrupted function call",
- WSAEBADF , "Bad file descriptor",
- WSAEACCES , "Permission denied",
- WSAEFAULT , "Bad address",
- WSAEINVAL , "Invalid argument",
- WSAEMFILE , "Too many open files",
-
- WSAEWOULDBLOCK , "Resource temporarily unavailable",
- WSAEINPROGRESS , "Operation now in progress",
- WSAEALREADY , "Operation already in progress",
- WSAENOTSOCK , "Socket operation on non-socket",
- WSAEDESTADDRREQ , "Destination address required",
- WSAEMSGSIZE , "Message too long",
- WSAEPROTOTYPE , "Protocol wrong type for socket",
- WSAENOPROTOOPT , "Bad protocol option",
- WSAEPROTONOSUPPORT , "Protocol not supported",
- WSAESOCKTNOSUPPORT , "Socket type not supported",
- WSAEOPNOTSUPP , "Operation not supported",
- WSAEPFNOSUPPORT , "Protocol family not supported",
- WSAEAFNOSUPPORT , "Address family not supported by protocol family",
- WSAEADDRINUSE , "Address already in use",
- WSAEADDRNOTAVAIL , "Cannot assign requested address",
- WSAENETDOWN , "Network is down",
- WSAENETUNREACH , "Network is unreachable",
- WSAENETRESET , "Network dropped connection on reset",
- WSAECONNABORTED , "Software caused connection abort",
- WSAECONNRESET , "Connection reset by peer",
- WSAENOBUFS , "No buffer space available",
- WSAEISCONN , "Socket is already connected",
- WSAENOTCONN , "Socket is not connected",
- WSAESHUTDOWN , "Cannot send after socket shutdown",
- WSAETOOMANYREFS , "Too many references", /* not sure */
- WSAETIMEDOUT , "Connection timed out",
- WSAECONNREFUSED , "Connection refused",
- WSAELOOP , "Network loop", /* not sure */
- WSAENAMETOOLONG , "Name is too long",
- WSAEHOSTDOWN , "Host is down",
- WSAEHOSTUNREACH , "No route to host",
- WSAENOTEMPTY , "Buffer not empty", /* not sure */
- WSAEPROCLIM , "Too many processes",
- WSAEUSERS , "Too many users", /* not sure */
- WSAEDQUOT , "Double quote in host name", /* really not sure */
- WSAESTALE , "Data is stale", /* not sure */
- WSAEREMOTE , "Remote error", /* not sure */
-
- WSASYSNOTREADY , "Network subsystem is unavailable",
- WSAVERNOTSUPPORTED , "WINSOCK.DLL version out of range",
- WSANOTINITIALISED , "Winsock not initialized successfully",
- WSAEDISCON , "Graceful shutdown in progress",
+ {WSAEINTR , "Interrupted function call"},
+ {WSAEBADF , "Bad file descriptor"},
+ {WSAEACCES , "Permission denied"},
+ {WSAEFAULT , "Bad address"},
+ {WSAEINVAL , "Invalid argument"},
+ {WSAEMFILE , "Too many open files"},
+
+ {WSAEWOULDBLOCK , "Resource temporarily unavailable"},
+ {WSAEINPROGRESS , "Operation now in progress"},
+ {WSAEALREADY , "Operation already in progress"},
+ {WSAENOTSOCK , "Socket operation on non-socket"},
+ {WSAEDESTADDRREQ , "Destination address required"},
+ {WSAEMSGSIZE , "Message too long"},
+ {WSAEPROTOTYPE , "Protocol wrong type for socket"},
+ {WSAENOPROTOOPT , "Bad protocol option"},
+ {WSAEPROTONOSUPPORT , "Protocol not supported"},
+ {WSAESOCKTNOSUPPORT , "Socket type not supported"},
+ {WSAEOPNOTSUPP , "Operation not supported"},
+ {WSAEPFNOSUPPORT , "Protocol family not supported"},
+ {WSAEAFNOSUPPORT , "Address family not supported by protocol family"},
+ {WSAEADDRINUSE , "Address already in use"},
+ {WSAEADDRNOTAVAIL , "Cannot assign requested address"},
+ {WSAENETDOWN , "Network is down"},
+ {WSAENETUNREACH , "Network is unreachable"},
+ {WSAENETRESET , "Network dropped connection on reset"},
+ {WSAECONNABORTED , "Software caused connection abort"},
+ {WSAECONNRESET , "Connection reset by peer"},
+ {WSAENOBUFS , "No buffer space available"},
+ {WSAEISCONN , "Socket is already connected"},
+ {WSAENOTCONN , "Socket is not connected"},
+ {WSAESHUTDOWN , "Cannot send after socket shutdown"},
+ {WSAETOOMANYREFS , "Too many references"}, /* not sure */
+ {WSAETIMEDOUT , "Connection timed out"},
+ {WSAECONNREFUSED , "Connection refused"},
+ {WSAELOOP , "Network loop"}, /* not sure */
+ {WSAENAMETOOLONG , "Name is too long"},
+ {WSAEHOSTDOWN , "Host is down"},
+ {WSAEHOSTUNREACH , "No route to host"},
+ {WSAENOTEMPTY , "Buffer not empty"}, /* not sure */
+ {WSAEPROCLIM , "Too many processes"},
+ {WSAEUSERS , "Too many users"}, /* not sure */
+ {WSAEDQUOT , "Double quote in host name"}, /* really not sure */
+ {WSAESTALE , "Data is stale"}, /* not sure */
+ {WSAEREMOTE , "Remote error"}, /* not sure */
+
+ {WSASYSNOTREADY , "Network subsystem is unavailable"},
+ {WSAVERNOTSUPPORTED , "WINSOCK.DLL version out of range"},
+ {WSANOTINITIALISED , "Winsock not initialized successfully"},
+ {WSAEDISCON , "Graceful shutdown in progress"},
#ifdef WSAENOMORE
- WSAENOMORE , "No more operations allowed", /* not sure */
- WSAECANCELLED , "Operation cancelled", /* not sure */
- WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider",
- WSAEINVALIDPROVIDER , "Invalid service provider version number",
- WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider",
- WSASYSCALLFAILURE , "System call failure",
- WSASERVICE_NOT_FOUND , "Service not found", /* not sure */
- WSATYPE_NOT_FOUND , "Class type not found",
- WSA_E_NO_MORE , "No more resources available", /* really not sure */
- WSA_E_CANCELLED , "Operation already cancelled", /* really not sure */
- WSAEREFUSED , "Operation refused", /* not sure */
+ {WSAENOMORE , "No more operations allowed"}, /* not sure */
+ {WSAECANCELLED , "Operation cancelled"}, /* not sure */
+ {WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider"},
+ {WSAEINVALIDPROVIDER , "Invalid service provider version number"},
+ {WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider"},
+ {WSASYSCALLFAILURE , "System call failure"},
+ {WSASERVICE_NOT_FOUND , "Service not found"}, /* not sure */
+ {WSATYPE_NOT_FOUND , "Class type not found"},
+ {WSA_E_NO_MORE , "No more resources available"}, /* really not sure */
+ {WSA_E_CANCELLED , "Operation already cancelled"}, /* really not sure */
+ {WSAEREFUSED , "Operation refused"}, /* not sure */
#endif
- WSAHOST_NOT_FOUND , "Host not found",
- WSATRY_AGAIN , "Authoritative host not found during name lookup",
- WSANO_RECOVERY , "Non-recoverable error during name lookup",
- WSANO_DATA , "Valid name, no data record of requested type",
+ {WSAHOST_NOT_FOUND , "Host not found"},
+ {WSATRY_AGAIN , "Authoritative host not found during name lookup"},
+ {WSANO_RECOVERY , "Non-recoverable error during name lookup"},
+ {WSANO_DATA , "Valid name, no data record of requested type"},
- -1, NULL
+ {-1, NULL}
};
char *
diff --git a/src/xdisp.c b/src/xdisp.c
index f286000c966..bbbf37b68ac 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -754,7 +754,7 @@ static void setup_for_ellipsis (struct it *, int);
static void mark_window_display_accurate_1 (struct window *, int);
static int single_display_spec_string_p (Lisp_Object, Lisp_Object);
static int display_prop_string_p (Lisp_Object, Lisp_Object);
-static int cursor_row_p (struct window *, struct glyph_row *);
+static int cursor_row_p (struct glyph_row *);
static int redisplay_mode_lines (Lisp_Object, int);
static char *decode_mode_spec_coding (Lisp_Object, char *, int);
@@ -823,8 +823,7 @@ static int display_mode_lines (struct window *);
static int display_mode_line (struct window *, enum face_id, Lisp_Object);
static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int);
static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object);
-static const char *decode_mode_spec (struct window *, int, int, int,
- Lisp_Object *);
+static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *);
static void display_menu_bar (struct window *);
static int display_count_lines (EMACS_INT, EMACS_INT, EMACS_INT, int,
EMACS_INT *);
@@ -4420,20 +4419,18 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string)
return 0;
}
-/* Look for STRING in overlays and text properties in W's buffer,
- between character positions FROM and TO (excluding TO).
+/* Look for STRING in overlays and text properties in the current
+ buffer, between character positions FROM and TO (excluding TO).
BACK_P non-zero means look back (in this case, TO is supposed to be
less than FROM).
Value is the first character position where STRING was found, or
zero if it wasn't found before hitting TO.
- W's buffer must be current.
-
This function may only use code that doesn't eval because it is
called asynchronously from note_mouse_highlight. */
static EMACS_INT
-string_buffer_position_lim (struct window *w, Lisp_Object string,
+string_buffer_position_lim (Lisp_Object string,
EMACS_INT from, EMACS_INT to, int back_p)
{
Lisp_Object limit, prop, pos;
@@ -4471,27 +4468,25 @@ string_buffer_position_lim (struct window *w, Lisp_Object string,
return found ? XINT (pos) : 0;
}
-/* Determine which buffer position in W's buffer STRING comes from.
+/* Determine which buffer position in current buffer STRING comes from.
AROUND_CHARPOS is an approximate position where it could come from.
Value is the buffer position or 0 if it couldn't be determined.
- W's buffer must be current.
-
This function is necessary because we don't record buffer positions
in glyphs generated from strings (to keep struct glyph small).
This function may only use code that doesn't eval because it is
called asynchronously from note_mouse_highlight. */
-EMACS_INT
-string_buffer_position (struct window *w, Lisp_Object string, EMACS_INT around_charpos)
+static EMACS_INT
+string_buffer_position (Lisp_Object string, EMACS_INT around_charpos)
{
const int MAX_DISTANCE = 1000;
- EMACS_INT found = string_buffer_position_lim (w, string, around_charpos,
+ EMACS_INT found = string_buffer_position_lim (string, around_charpos,
around_charpos + MAX_DISTANCE,
0);
if (!found)
- found = string_buffer_position_lim (w, string, around_charpos,
+ found = string_buffer_position_lim (string, around_charpos,
around_charpos - MAX_DISTANCE, 1);
return found;
}
@@ -7967,7 +7962,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
c = string_char_and_length (msg + i, &char_bytes);
work[0] = (ASCII_CHAR_P (c)
? c
- : multibyte_char_to_unibyte (c, Qnil));
+ : multibyte_char_to_unibyte (c));
insert_1_both (work, 1, 1, 1, 0, 0);
}
}
@@ -9228,7 +9223,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
c = string_char_and_length (msg + i, &n);
work[0] = (ASCII_CHAR_P (c)
? c
- : multibyte_char_to_unibyte (c, Qnil));
+ : multibyte_char_to_unibyte (c));
insert_1_both (work, 1, 1, 1, 0, 0);
}
}
@@ -12731,7 +12726,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
EMACS_INT tem;
str = glyph->object;
- tem = string_buffer_position_lim (w, str, pos, pos_after, 0);
+ tem = string_buffer_position_lim (str, pos, pos_after, 0);
if (tem == 0 /* from overlay */
|| pos <= tem)
{
@@ -13457,7 +13452,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
&& row < w->current_matrix->rows
+ w->current_matrix->nrows - 1
&& MATRIX_ROW_START_CHARPOS (row+1) == PT
- && !cursor_row_p (w, row))
+ && !cursor_row_p (row))
++row;
/* If within the scroll margin, scroll. Note that
@@ -13509,7 +13504,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
skip forward over overlay strings. */
while (MATRIX_ROW_BOTTOM_Y (row) < last_y
&& MATRIX_ROW_END_CHARPOS (row) == PT
- && !cursor_row_p (w, row))
+ && !cursor_row_p (row))
++row;
/* If within the scroll margin, scroll. */
@@ -13605,7 +13600,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
{
if (MATRIX_ROW_START_CHARPOS (row) <= PT
&& PT <= MATRIX_ROW_END_CHARPOS (row)
- && cursor_row_p (w, row))
+ && cursor_row_p (row))
rv |= set_cursor_from_row (w, row, w->current_matrix,
0, 0, 0, 0);
/* As soon as we've found the first suitable row
@@ -13644,7 +13639,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
}
while (MATRIX_ROW_BOTTOM_Y (row) < last_y
&& MATRIX_ROW_START_CHARPOS (row) == PT
- && cursor_row_p (w, row));
+ && cursor_row_p (row));
}
}
}
@@ -16968,11 +16963,11 @@ highlight_trailing_whitespace (struct frame *f, struct glyph_row *row)
}
-/* Value is non-zero if glyph row ROW in window W should be
+/* Value is non-zero if glyph row ROW should be
used to hold the cursor. */
static int
-cursor_row_p (struct window *w, struct glyph_row *row)
+cursor_row_p (struct glyph_row *row)
{
int result = 1;
@@ -17885,7 +17880,7 @@ display_line (struct it *it)
&& !MATRIX_ROW (it->w->desired_matrix, cvpos)->ends_at_zv_p))
&& PT >= MATRIX_ROW_START_CHARPOS (row)
&& PT <= MATRIX_ROW_END_CHARPOS (row)
- && cursor_row_p (it->w, row))
+ && cursor_row_p (row))
set_cursor_from_row (it->w, row, it->w->desired_matrix, 0, 0, 0, 0);
/* Highlight trailing whitespace. */
@@ -18537,7 +18532,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
charpos = (STRING_MULTIBYTE (elt)
? string_byte_to_char (elt, bytepos)
: bytepos);
- spec = decode_mode_spec (it->w, c, field, prec, &string);
+ spec = decode_mode_spec (it->w, c, field, &string);
multibyte = STRINGP (string) && STRING_MULTIBYTE (string);
switch (mode_line_target)
@@ -19208,9 +19203,8 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
}
/* Return a string for the output of a mode line %-spec for window W,
- generated by character C. PRECISION >= 0 means don't return a
- string longer than that value. FIELD_WIDTH > 0 means pad the
- string returned with spaces to that value. Return a Lisp string in
+ generated by character C. FIELD_WIDTH > 0 means pad the string
+ returned with spaces to that value. Return a Lisp string in
*STRING if the resulting string is taken from that Lisp string.
Note we operate on the current buffer for most purposes,
@@ -19220,7 +19214,7 @@ static char lots_of_dashes[] = "------------------------------------------------
static const char *
decode_mode_spec (struct window *w, register int c, int field_width,
- int precision, Lisp_Object *string)
+ Lisp_Object *string)
{
Lisp_Object obj;
struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -24317,7 +24311,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
END_CHARPOS, or if they come from an overlay. */
if (EQ (glyph->object, before_string))
{
- pos = string_buffer_position (w, before_string,
+ pos = string_buffer_position (before_string,
start_charpos);
/* If pos == 0, it means before_string came from an
overlay, not from a buffer position. */
@@ -24326,7 +24320,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
}
else if (EQ (glyph->object, after_string))
{
- pos = string_buffer_position (w, after_string, end_charpos);
+ pos = string_buffer_position (after_string, end_charpos);
if (!pos || (pos >= start_charpos && pos < end_charpos))
break;
}
@@ -24368,7 +24362,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
END_CHARPOS, or if they come from an overlay. */
if (EQ (glyph->object, before_string))
{
- pos = string_buffer_position (w, before_string, start_charpos);
+ pos = string_buffer_position (before_string, start_charpos);
/* If pos == 0, it means before_string came from an
overlay, not from a buffer position. */
if (!pos || (pos >= start_charpos && pos < end_charpos))
@@ -24376,7 +24370,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
}
else if (EQ (glyph->object, after_string))
{
- pos = string_buffer_position (w, after_string, end_charpos);
+ pos = string_buffer_position (after_string, end_charpos);
if (!pos || (pos >= start_charpos && pos < end_charpos))
break;
}
@@ -24434,13 +24428,13 @@ mouse_face_from_buffer_pos (Lisp_Object window,
END_CHARPOS, or if they come from an overlay. */
if (EQ (end->object, before_string))
{
- pos = string_buffer_position (w, before_string, start_charpos);
+ pos = string_buffer_position (before_string, start_charpos);
if (!pos || (pos >= start_charpos && pos < end_charpos))
break;
}
else if (EQ (end->object, after_string))
{
- pos = string_buffer_position (w, after_string, end_charpos);
+ pos = string_buffer_position (after_string, end_charpos);
if (!pos || (pos >= start_charpos && pos < end_charpos))
break;
}
@@ -24484,13 +24478,13 @@ mouse_face_from_buffer_pos (Lisp_Object window,
END_CHARPOS, or if they come from an overlay. */
if (EQ (end->object, before_string))
{
- pos = string_buffer_position (w, before_string, start_charpos);
+ pos = string_buffer_position (before_string, start_charpos);
if (!pos || (pos >= start_charpos && pos < end_charpos))
break;
}
else if (EQ (end->object, after_string))
{
- pos = string_buffer_position (w, after_string, end_charpos);
+ pos = string_buffer_position (after_string, end_charpos);
if (!pos || (pos >= start_charpos && pos < end_charpos))
break;
}
@@ -25473,7 +25467,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
check if the text under it has one. */
struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos);
EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
- pos = string_buffer_position (w, object, start);
+ pos = string_buffer_position (object, start);
if (pos > 0)
{
mouse_face = get_char_property_and_overlay
@@ -25583,7 +25577,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
struct glyph_row *r
= MATRIX_ROW (w->current_matrix, vpos);
EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
- EMACS_INT p = string_buffer_position (w, obj, start);
+ EMACS_INT p = string_buffer_position (obj, start);
if (p > 0)
{
help = Fget_char_property (make_number (p),
@@ -25639,7 +25633,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
struct glyph_row *r
= MATRIX_ROW (w->current_matrix, vpos);
EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
- EMACS_INT p = string_buffer_position (w, obj, start);
+ EMACS_INT p = string_buffer_position (obj, start);
if (p > 0)
pointer = Fget_char_property (make_number (p),
Qpointer, w->buffer);