Now on revision 109111. ------------------------------------------------------------ revno: 109111 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2012-07-17 09:01:33 +0400 message: Simple free memory accounting feature. * alloc.c (bytes_free, total_free_vector_bytes): New variable. (sweep_vectors): Accumulate size of free vectors. (Fgarbage_collect): Setup bytes_free. (Fmemory_free): New function. (syms_of_alloc): Register it. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-17 04:29:50 +0000 +++ src/ChangeLog 2012-07-17 05:01:33 +0000 @@ -1,5 +1,14 @@ 2012-07-17 Dmitry Antipov + Simple free memory accounting feature. + * alloc.c (bytes_free, total_free_vector_bytes): New variable. + (sweep_vectors): Accumulate size of free vectors. + (Fgarbage_collect): Setup bytes_free. + (Fmemory_free): New function. + (syms_of_alloc): Register it. + +2012-07-17 Dmitry Antipov + Cleanup overlays checking. * buffer.h (OVERLAY_VALID): Remove as useless synonym of OVERLAYP. * buffer.c (overlay_touches_p, recenter_overlay_lists): Change to === modified file 'src/alloc.c' --- src/alloc.c 2012-07-15 11:17:09 +0000 +++ src/alloc.c 2012-07-17 05:01:33 +0000 @@ -84,6 +84,10 @@ #define MMAP_MAX_AREAS 100000000 +/* Value of mallinfo ().fordblks as seen at the end of last GC. */ + +static int bytes_free; + #else /* not DOUG_LEA_MALLOC */ /* The following come from gmalloc.c. */ @@ -191,7 +195,7 @@ static EMACS_INT total_conses, total_markers, total_symbols, total_vector_size; static EMACS_INT total_free_conses, total_free_markers, total_free_symbols; -static EMACS_INT total_free_floats, total_floats; +static EMACS_INT total_free_floats, total_floats, total_free_vector_bytes; /* Points to memory space allocated as "spare", to be freed if we run out of memory. We keep one large block, four cons-blocks, and @@ -3048,7 +3052,7 @@ struct vector_block *block = vector_blocks, **bprev = &vector_blocks; struct Lisp_Vector *vector, *next, **vprev = &large_vectors; - total_vector_size = 0; + total_free_vector_bytes = total_vector_size = 0; memset (vector_free_lists, 0, sizeof (vector_free_lists)); /* Looking through vector blocks. */ @@ -3095,6 +3099,7 @@ else { int tmp; + total_free_vector_bytes += total_bytes; SETUP_ON_FREE_LIST (vector, total_bytes, tmp); } } @@ -5605,6 +5610,10 @@ total[7] = Fcons (make_number (total_strings), make_number (total_free_strings)); +#ifdef DOUG_LEA_MALLOC + bytes_free = mallinfo ().fordblks; +#endif + #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES { /* Compute average percentage of zombies. */ @@ -6549,6 +6558,37 @@ return end; } +DEFUN ("memory-free", Fmemory_free, Smemory_free, 0, 0, 0, + doc: /* Return a list of two counters that measure how much free memory +is hold by the Emacs process. Both counters are in KBytes. First +counter shows how much memory holds in a free lists maintained by +the Emacs itself. Second counter shows how much free memory is in +the heap (freed by Emacs but not released back to the operating +system). If the second counter is zero, heap statistics is not +available. Since both counters are updated after each garbage +collection, use (progn (garbage-collect) (memory-free)) to get +accurate numbers. */) + (void) +{ + Lisp_Object data[2]; + + data[0] = make_number + (min (MOST_POSITIVE_FIXNUM, + (total_free_conses * sizeof (struct Lisp_Cons) + + total_free_markers * sizeof (union Lisp_Misc) + + total_free_symbols * sizeof (struct Lisp_Symbol) + + total_free_floats * sizeof (struct Lisp_Float) + + total_free_intervals * sizeof (struct interval) + + total_free_strings * sizeof (struct Lisp_String) + + total_free_vector_bytes) / 1024)); +#ifdef DOUG_LEA_MALLOC + data[1] = make_number (min (MOST_POSITIVE_FIXNUM, bytes_free / 1024)); +#else + data[1] = make_number (0); +#endif + return Flist (2, data); +} + DEFUN ("memory-use-counts", Fmemory_use_counts, Smemory_use_counts, 0, 0, 0, doc: /* Return a list of counters that measure how much consing there has been. Each of these counters increments for a certain kind of object. @@ -6785,6 +6825,7 @@ defsubr (&Spurecopy); defsubr (&Sgarbage_collect); defsubr (&Smemory_limit); + defsubr (&Smemory_free); defsubr (&Smemory_use_counts); #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES ------------------------------------------------------------ revno: 109110 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2012-07-17 08:29:50 +0400 message: Cleanup overlays checking. * buffer.h (OVERLAY_VALID): Remove as useless synonym of OVERLAYP. * buffer.c (overlay_touches_p, recenter_overlay_lists): Change to eassert and OVERLAYP. (sort_overlays): Change to use OVERLAYP. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-17 04:17:23 +0000 +++ src/ChangeLog 2012-07-17 04:29:50 +0000 @@ -1,3 +1,11 @@ +2012-07-17 Dmitry Antipov + + Cleanup overlays checking. + * buffer.h (OVERLAY_VALID): Remove as useless synonym of OVERLAYP. + * buffer.c (overlay_touches_p, recenter_overlay_lists): Change to + eassert and OVERLAYP. + (sort_overlays): Change to use OVERLAYP. + 2012-07-16 René Kyllingstad (tiny change) * editfns.c (Finsert_char): Make it interactive, and make the === modified file 'src/buffer.c' --- src/buffer.c 2012-07-10 23:24:36 +0000 +++ src/buffer.c 2012-07-17 04:29:50 +0000 @@ -2827,8 +2827,7 @@ ptrdiff_t endpos; XSETMISC (overlay ,tail); - if (!OVERLAYP (overlay)) - abort (); + eassert (OVERLAYP (overlay)); endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); if (endpos < pos) @@ -2842,8 +2841,7 @@ ptrdiff_t startpos; XSETMISC (overlay, tail); - if (!OVERLAYP (overlay)) - abort (); + eassert (OVERLAYP (overlay)); startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); if (pos < startpos) @@ -2898,7 +2896,7 @@ Lisp_Object overlay; overlay = overlay_vec[i]; - if (OVERLAY_VALID (overlay) + if (OVERLAYP (overlay) && OVERLAY_POSITION (OVERLAY_START (overlay)) > 0 && OVERLAY_POSITION (OVERLAY_END (overlay)) > 0) { @@ -3169,22 +3167,7 @@ { next = tail->next; XSETMISC (overlay, tail); - - /* If the overlay is not valid, get rid of it. */ - if (!OVERLAY_VALID (overlay)) -#if 1 - abort (); -#else - { - /* Splice the cons cell TAIL out of overlays_before. */ - if (!NILP (prev)) - XCDR (prev) = next; - else - buf->overlays_before = next; - tail = prev; - continue; - } -#endif + eassert (OVERLAYP (overlay)); beg = OVERLAY_START (overlay); end = OVERLAY_END (overlay); @@ -3209,7 +3192,7 @@ Lisp_Object otherbeg, otheroverlay; XSETMISC (otheroverlay, other); - eassert (OVERLAY_VALID (otheroverlay)); + eassert (OVERLAYP (otheroverlay)); otherbeg = OVERLAY_START (otheroverlay); if (OVERLAY_POSITION (otherbeg) >= where) @@ -3237,22 +3220,7 @@ { next = tail->next; XSETMISC (overlay, tail); - - /* If the overlay is not valid, get rid of it. */ - if (!OVERLAY_VALID (overlay)) -#if 1 - abort (); -#else - { - /* Splice the cons cell TAIL out of overlays_after. */ - if (!NILP (prev)) - XCDR (prev) = next; - else - buf->overlays_after = next; - tail = prev; - continue; - } -#endif + eassert (OVERLAYP (overlay)); beg = OVERLAY_START (overlay); end = OVERLAY_END (overlay); @@ -3282,7 +3250,7 @@ Lisp_Object otherend, otheroverlay; XSETMISC (otheroverlay, other); - eassert (OVERLAY_VALID (otheroverlay)); + eassert (OVERLAYP (otheroverlay)); otherend = OVERLAY_END (otheroverlay); if (OVERLAY_POSITION (otherend) <= where) === modified file 'src/buffer.h' --- src/buffer.h 2012-07-05 18:35:48 +0000 +++ src/buffer.h 2012-07-17 04:29:50 +0000 @@ -971,10 +971,6 @@ /* Overlays */ -/* 1 if the OV is an overlay object. */ - -#define OVERLAY_VALID(OV) (OVERLAYP (OV)) - /* Return the marker that stands for where OV starts in the buffer. */ #define OVERLAY_START(OV) (XOVERLAY (OV)->start) ------------------------------------------------------------ revno: 109109 author: René Kyllingstad committer: Chong Yidong branch nick: trunk timestamp: Tue 2012-07-17 12:17:23 +0800 message: Make insert-char interactive, and ucs-insert an obsolete alias for it. * lisp/international/mule-cmds.el (ucs-insert): Make it an obsolete alias for insert-char. * editfns.c (Finsert_char): Make it interactive, and make the second arg optional. Copy interactive spec and docstring from ucs-insert. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-07-15 00:52:16 +0000 +++ etc/NEWS 2012-07-17 04:17:23 +0000 @@ -140,6 +140,9 @@ ** Setting `enable-remote-dir-locals' to non-nil allows directory local variables on remote hosts. +** `insert-char' is now a command, and `ucs-insert' an obsolete alias +for it. + * Editing Changes in Emacs 24.2 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-16 17:18:39 +0000 +++ lisp/ChangeLog 2012-07-17 04:17:23 +0000 @@ -1,3 +1,8 @@ +2012-07-16 René Kyllingstad (tiny change) + + * international/mule-cmds.el (ucs-insert): Make it an obsolete + alias for insert-char. + 2012-07-16 Fabián Ezequiel Gallina * progmodes/python.el: Simplified imenu implementation. === modified file 'lisp/international/mule-cmds.el' --- lisp/international/mule-cmds.el 2012-06-27 21:15:13 +0000 +++ lisp/international/mule-cmds.el 2012-07-17 04:17:23 +0000 @@ -2954,43 +2954,7 @@ (t (cdr (assoc-string input (ucs-names) t)))))) -(defun ucs-insert (character &optional count inherit) - "Insert COUNT copies of CHARACTER of the given Unicode code point. -Interactively, prompts for a Unicode character name or a hex number -using `read-char-by-name'. - -You can type a few of the first letters of the Unicode name and -use completion. If you type a substring of the Unicode name -preceded by an asterisk `*' and use completion, it will show all -the characters whose names include that substring, not necessarily -at the beginning of the name. - -This function also accepts a hexadecimal number of Unicode code -point or a number in hash notation, e.g. #o21430 for octal, -#x2318 for hex, or #10r8984 for decimal. - -The optional third arg INHERIT (non-nil when called interactively), -says to inherit text properties from adjoining text, if those -properties are sticky." - (interactive - (list (read-char-by-name "Unicode (name or hex): ") - (prefix-numeric-value current-prefix-arg) - t)) - (unless count (setq count 1)) - (if (and (stringp character) - (string-match-p "\\`[0-9a-fA-F]+\\'" character)) - (setq character (string-to-number character 16))) - (cond - ((null character) - (error "Not a Unicode character")) - ((not (integerp character)) - (error "Not a Unicode character code: %S" character)) - ((or (< character 0) (> character #x10FFFF)) - (error "Not a Unicode character code: 0x%X" character))) - (if inherit - (dotimes (i count) (insert-and-inherit character)) - (dotimes (i count) (insert character)))) - -(define-key ctl-x-map "8\r" 'ucs-insert) +(define-obsolete-variable-alias 'ucs-insert 'insert-char "24.2") +(define-key ctl-x-map "8\r" 'insert-char) ;;; mule-cmds.el ends here === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-17 02:56:00 +0000 +++ src/ChangeLog 2012-07-17 04:17:23 +0000 @@ -1,3 +1,9 @@ +2012-07-16 René Kyllingstad (tiny change) + + * editfns.c (Finsert_char): Make it interactive, and make the + second arg optional. Copy interactive spec and docstring from + ucs-insert. + 2012-07-17 Paul Eggert * floatfns.c (Fabs): Do not wrap fabs inside IN_FLOAT (Bug#11913). === modified file 'src/editfns.c' --- src/editfns.c 2012-07-10 23:24:36 +0000 +++ src/editfns.c 2012-07-17 04:17:23 +0000 @@ -2368,11 +2368,28 @@ return Qnil; } -DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0, +DEFUN ("insert-char", Finsert_char, Sinsert_char, 1, 3, + "(list (read-char-by-name \"Unicode (name or hex): \")\ + (prefix-numeric-value current-prefix-arg)\ + t))", doc: /* Insert COUNT copies of CHARACTER. +Interactively, prompts for a Unicode character name or a hex number +using `read-char-by-name'. + +You can type a few of the first letters of the Unicode name and +use completion. If you type a substring of the Unicode name +preceded by an asterisk `*' and use completion, it will show all +the characters whose names include that substring, not necessarily +at the beginning of the name. + +This function also accepts a hexadecimal number of Unicode code +point or a number in hash notation, e.g. #o21430 for octal, +#x2318 for hex, or #10r8984 for decimal. + Point, and before-insertion markers, are relocated as in the function `insert'. The optional third arg INHERIT, if non-nil, says to inherit text properties -from adjoining text, if those properties are sticky. */) +from adjoining text, if those properties are sticky. If called +interactively, INHERIT is t. */) (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) { int i, stringlen; @@ -2382,6 +2399,8 @@ char string[4000]; CHECK_CHARACTER (character); + if (NILP (count)) + XSETFASTINT (count, 1); CHECK_NUMBER (count); c = XFASTINT (character); ------------------------------------------------------------ revno: 109108 fixes bug(s): http://debbugs.gnu.org/11913 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-07-16 19:56:00 -0700 message: * floatfns.c (Fabs): Do not wrap fabs inside IN_FLOAT. Unlike the other wrapped functions, fabs has an unspecified effect on errno. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-16 11:02:09 +0000 +++ src/ChangeLog 2012-07-17 02:56:00 +0000 @@ -1,3 +1,9 @@ +2012-07-17 Paul Eggert + + * floatfns.c (Fabs): Do not wrap fabs inside IN_FLOAT (Bug#11913). + Unlike the other wrapped functions, fabs has an unspecified + effect on errno. + 2012-07-16 Jan Djärv * nsterm.m (keyDown): Interpret flags without left/right bits === modified file 'src/floatfns.c' --- src/floatfns.c 2012-02-10 18:58:48 +0000 +++ src/floatfns.c 2012-07-17 02:56:00 +0000 @@ -664,7 +664,7 @@ CHECK_NUMBER_OR_FLOAT (arg); if (FLOATP (arg)) - IN_FLOAT (arg = make_float (fabs (XFLOAT_DATA (arg))), "abs", arg); + arg = make_float (fabs (XFLOAT_DATA (arg))); else if (XINT (arg) < 0) XSETINT (arg, - XINT (arg)); ------------------------------------------------------------ revno: 109107 fixes bug(s): http://debbugs.gnu.org/11884 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-07-16 19:09:58 -0700 message: Fix regression with pthread_sigmask on FreeBSD. * configure.ac: Configure gnulib at the end, not before running pkg-config. This restores the behavior before 2012-06-22, when higher-resolution time stamps were added, and fixes a bug whereby LIB_PTHREAD was not used and gnulib's part of 'configure' therefore incorrectly assumed that pthread_sigmask wasn't working. Fix the problem with -lrt and clock_gettime a different way. This should complete the fix for Bug#11884. (pre_PKG_CONFIG_CFLAGS, pre_PKG_CONFIG_LIBS): New shell vars. diff: === modified file 'ChangeLog' --- ChangeLog 2012-07-15 18:18:37 +0000 +++ ChangeLog 2012-07-17 02:09:58 +0000 @@ -1,3 +1,15 @@ +2012-07-17 Paul Eggert + + Fix regression with pthread_sigmask on FreeBSD (Bug#11884). + * configure.ac: Configure gnulib at the end, not before running + pkg-config. This restores the behavior before 2012-06-22, when + higher-resolution time stamps were added, and fixes a bug whereby + LIB_PTHREAD was not used and gnulib's part of 'configure' + therefore incorrectly assumed that pthread_sigmask wasn't working. + Fix the problem with -lrt and clock_gettime a different way. + This should complete the fix for Bug#11884. + (pre_PKG_CONFIG_CFLAGS, pre_PKG_CONFIG_LIBS): New shell vars. + 2012-07-15 Paul Eggert Merge from gnulib, incorporating: === modified file 'configure.ac' --- configure.ac 2012-07-14 00:04:10 +0000 +++ configure.ac 2012-07-17 02:09:58 +0000 @@ -1104,12 +1104,8 @@ esac -# Configure gnulib before invoking PKG_CHECK_MODULES, as the latter might -# for example add -lrt to RSVG_LIBS, which would then cause gnulib to -# incorrectly conclude that -lrt is not needed to link clock_gettime. -gl_ASSERT_NO_GNULIB_POSIXCHECK -gl_ASSERT_NO_GNULIB_TESTS -gl_INIT +pre_PKG_CONFIG_CFLAGS=$CFLAGS +pre_PKG_CONFIG_LIBS=$LIBS AC_PATH_PROG(PKG_CONFIG, pkg-config, no) @@ -3156,7 +3152,7 @@ aix4-2) dnl Unfortunately without libXmu we cannot support EditRes. if test x$ac_cv_lib_Xmu_XmuConvertStandardSelection != xyes; then - AC_DEFINE(NO_EDITRES, 1) + AC_DEFINE(NO_EDITRES, 1) fi ;; @@ -3405,7 +3401,7 @@ dnl Not used, because PTY_ITERATION is defined. AC_DEFINE(FIRST_PTY_LETTER, ['q']) AC_DEFINE(PTY_OPEN, [ { struct sigaction ocstat, cstat; struct stat stb; char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; cstat.sa_flags = 0; sigaction(SIGCLD, &cstat, &ocstat); name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCLD, &ocstat, (struct sigaction *)0); if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) return -1; strcpy (pty_name, name); }] ) - dnl No need to get the pty name at all. + dnl No need to get the pty name at all. AC_DEFINE(PTY_NAME_SPRINTF, [] ) dnl No need to use sprintf to get the tty name--we get that from _getpty. AC_DEFINE(PTY_TTY_NAME_SPRINTF, [] ) @@ -3450,7 +3446,7 @@ AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1) ;; - dnl 21 Jun 06: Eric Hanchrow says this works. + dnl 21 Jun 06: Eric Hanchrow says this works. dnl FIXME Does gnu-kfreebsd have linux/version.h? It seems unlikely... gnu-linux | gnu-kfreebsd ) @@ -4006,6 +4002,24 @@ AC_SUBST(PRE_ALLOC_OBJ) AC_SUBST(POST_ALLOC_OBJ) +# Configure gnulib. Although this does not affect CFLAGS or LIBS permanently. +# it temporarily reverts them to their pre-pkg-config values, +# because gnulib needs to work with both src (which uses the +# pkg-config stuff) and lib-src (which does not). For example, gnulib +# may need to determine whether LIB_CLOCK_GETTIME should contain -lrt, +# and it therefore needs to run in an environment where LIBS does not +# already contain -lrt merely because 'pkg-config --libs' printed '-lrt' +# for some package unrelated to lib-src. +SAVE_CFLAGS=$CFLAGS +SAVE_LIBS=$LIBS +CFLAGS=$pre_PKG_CONFIG_CFLAGS +LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS" +gl_ASSERT_NO_GNULIB_POSIXCHECK +gl_ASSERT_NO_GNULIB_TESTS +gl_INIT +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS + case "$opsys" in aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;; ------------------------------------------------------------ revno: 109106 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Mon 2012-07-16 14:18:39 -0300 message: * progmodes/python.el: Simplified imenu implementation. (python-nav-jump-to-defun): Remove command. (python-mode-map): Use `imenu' instead. (python-nav-list-defun-positions-cache) (python-imenu-include-defun-type, python-imenu-make-tree) (python-imenu-subtree-root-label, python-imenu-index-alist): Remove vars. (python-nav-list-defun-positions, python-nav-read-defun) (python-imenu-tree-assoc, python-imenu-make-element-tree) (python-imenu-make-tree, python-imenu-create-index): Remove functions. (python-mode): Update to interact with imenu by setting `imenu-extract-index-name-function' only. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-16 13:13:01 +0000 +++ lisp/ChangeLog 2012-07-16 17:18:39 +0000 @@ -1,5 +1,21 @@ 2012-07-16 Fabián Ezequiel Gallina + * progmodes/python.el: Simplified imenu implementation. + (python-nav-jump-to-defun): Remove command. + (python-mode-map): Use `imenu' instead. + (python-nav-list-defun-positions-cache) + (python-imenu-include-defun-type, python-imenu-make-tree) + (python-imenu-subtree-root-label, python-imenu-index-alist): + Remove vars. + (python-nav-list-defun-positions, python-nav-read-defun) + (python-imenu-tree-assoc, python-imenu-make-element-tree) + (python-imenu-make-tree, python-imenu-create-index): Remove + functions. + (python-mode): Update to interact with imenu by setting + `imenu-extract-index-name-function' only. + +2012-07-16 Fabián Ezequiel Gallina + * progmodes/python.el: Enhancements to navigation commands. (python-nav-backward-sentence) (python-nav-forward-sentence): Remove. === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-07-16 13:13:01 +0000 +++ lisp/progmodes/python.el 2012-07-16 17:18:39 +0000 @@ -53,8 +53,6 @@ ;; `python-nav-backward-statement', `python-nav-statement-start', ;; `python-nav-statement-end', `python-nav-block-start' and ;; `python-nav-block-end' are included but no bound to any key. -;; `python-nav-jump-to-defun' is provided and allows jumping to a -;; function or class definition quickly in the current buffer. ;; Shell interaction: is provided and allows you to execute easily any ;; block of code of your current buffer in an inferior Python process. @@ -168,10 +166,10 @@ ;; might guessed you should run `python-shell-send-buffer' from time ;; to time to get better results too. -;; imenu: This mode supports imenu. It builds a plain or tree menu -;; depending on the value of `python-imenu-make-tree'. Also you can -;; customize if menu items should include its type using -;; `python-imenu-include-defun-type'. +;; imenu: This mode supports imenu in its most basic form, letting it +;; build the necessary alist via `imenu-default-create-index-function' +;; by having set `imenu-extract-index-name-function' to +;; `python-info-current-defun'. ;; If you used python-mode.el you probably will miss auto-indentation ;; when inserting newlines. To achieve the same behavior you have @@ -234,7 +232,7 @@ (substitute-key-definition 'forward-sentence 'python-nav-forward-block map global-map) - (define-key map "\C-c\C-j" 'python-nav-jump-to-defun) + (define-key map "\C-c\C-j" 'imenu) ;; Indent specific (define-key map "\177" 'python-indent-dedent-line-backspace) (define-key map (kbd "") 'python-indent-dedent-line) @@ -275,7 +273,7 @@ :help "Go to end of definition around point"] ["Mark def/class" mark-defun :help "Mark outermost definition around point"] - ["Jump to def/class" python-nav-jump-to-defun + ["Jump to def/class" imenu :help "Jump to a class or function definition"] "--" ("Skeletons") @@ -1304,62 +1302,6 @@ (t (python-nav-block-start)))) (setq arg (1+ arg)))) -(defvar python-nav-list-defun-positions-cache nil) -(make-variable-buffer-local 'python-nav-list-defun-positions-cache) - -(defun python-nav-list-defun-positions (&optional include-type rescan) - "Make an Alist of defun names and point markers for current buffer. -When optional argument INCLUDE-TYPE is non-nil the type is -included the defun name. With optional argument RESCAN the -`python-nav-list-defun-positions-cache' is invalidated and the -list of defun is regenerated again." - (if (and python-nav-list-defun-positions-cache (not rescan)) - python-nav-list-defun-positions-cache - (let ((defs)) - (save-restriction - (widen) - (save-excursion - (goto-char (point-max)) - (while (re-search-backward python-nav-beginning-of-defun-regexp nil t) - (when (and (not (python-info-ppss-context 'string)) - (not (python-info-ppss-context 'comment)) - (not (python-info-ppss-context 'parent))) - (add-to-list - 'defs (cons - (python-info-current-defun include-type) - (point-marker))))) - (setq python-nav-list-defun-positions-cache defs)))))) - -(defun python-nav-read-defun (&optional rescan) - "Read a defun name of current buffer and return its point marker. -A cons cell with the form (DEFUN-NAME . POINT-MARKER) is returned -when defun is completed, else nil. With optional argument RESCAN -forces `python-nav-list-defun-positions' to invalidate its -cache." - (let ((defs (python-nav-list-defun-positions nil rescan))) - (minibuffer-with-setup-hook - (lambda () - (setq minibuffer-completion-table (mapcar 'car defs))) - (let ((stringdef - (read-from-minibuffer - "Jump to definition: " nil - minibuffer-local-must-match-map))) - (when (not (string= stringdef "")) - (assoc-string stringdef defs)))))) - -(defun python-nav-jump-to-defun (def) - "Jump to the definition of DEF in current file. -Locations are cached; use a `C-u' prefix argument to force a -rescan." - (interactive - (list (python-nav-read-defun current-prefix-arg))) - (when (not (called-interactively-p 'interactive)) - (setq def (assoc-string def (python-nav-list-defun-positions)))) - (let ((def-marker (cdr def))) - (when (markerp def-marker) - (goto-char (marker-position def-marker)) - (back-to-indentation)))) - ;;; Shell integration @@ -2602,119 +2544,6 @@ (message (python-eldoc--get-doc-at-point symbol process))))) -;;; Imenu - -(defcustom python-imenu-include-defun-type t - "Non-nil make imenu items to include its type." - :type 'boolean - :group 'python - :safe 'booleanp) - -(defcustom python-imenu-make-tree t - "Non-nil make imenu to build a tree menu. -Set to nil for speed." - :type 'boolean - :group 'python - :safe 'booleanp) - -(defcustom python-imenu-subtree-root-label "" - "Label displayed to navigate to root from a subtree. -It can contain a \"%s\" which will be replaced with the root name." - :type 'string - :group 'python - :safe 'stringp) - -(defvar python-imenu-index-alist nil - "Calculated index tree for imenu.") - -(defun python-imenu-tree-assoc (keylist tree) - "Using KEYLIST traverse TREE." - (if keylist - (python-imenu-tree-assoc (cdr keylist) - (ignore-errors (assoc (car keylist) tree))) - tree)) - -(defun python-imenu-make-element-tree (element-list full-element plain-index) - "Make a tree from plain alist of module names. -ELEMENT-LIST is the defun name split by \".\" and FULL-ELEMENT -is the same thing, the difference is that FULL-ELEMENT remains -untouched in all recursive calls. -Argument PLAIN-INDEX is the calculated plain index used to build the tree." - (when (not (python-imenu-tree-assoc full-element python-imenu-index-alist)) - (when element-list - (let* ((subelement-point (cdr (assoc - (mapconcat #'identity full-element ".") - plain-index))) - (subelement-name (car element-list)) - (subelement-position (python-util-position - subelement-name full-element)) - (subelement-path (when subelement-position - (butlast - full-element - (- (length full-element) - subelement-position))))) - (let ((path-ref (python-imenu-tree-assoc subelement-path - python-imenu-index-alist))) - (if (not path-ref) - (push (cons subelement-name subelement-point) - python-imenu-index-alist) - (when (not (listp (cdr path-ref))) - ;; Modify root cdr to be a list. - (setcdr path-ref - (list (cons (format python-imenu-subtree-root-label - (car path-ref)) - (cdr (assoc - (mapconcat #'identity - subelement-path ".") - plain-index)))))) - (when (not (assoc subelement-name path-ref)) - (push (cons subelement-name subelement-point) (cdr path-ref)))))) - (python-imenu-make-element-tree (cdr element-list) - full-element plain-index)))) - -(defun python-imenu-make-tree (index) - "Build the imenu alist tree from plain INDEX. - -The idea of this function is that given the alist: - - '((\"Test\" . 100) - (\"Test.__init__\" . 200) - (\"Test.some_method\" . 300) - (\"Test.some_method.another\" . 400) - (\"Test.something_else\" . 500) - (\"test\" . 600) - (\"test.reprint\" . 700) - (\"test.reprint\" . 800)) - -This tree gets built: - - '((\"Test\" . ((\"jump to...\" . 100) - (\"__init__\" . 200) - (\"some_method\" . ((\"jump to...\" . 300) - (\"another\" . 400))) - (\"something_else\" . 500))) - (\"test\" . ((\"jump to...\" . 600) - (\"reprint\" . 700) - (\"reprint\" . 800)))) - -Internally it uses `python-imenu-make-element-tree' to create all -branches for each element." - (setq python-imenu-index-alist nil) - (mapc (lambda (element) - (python-imenu-make-element-tree element element index)) - (mapcar (lambda (element) - (split-string (car element) "\\." t)) index)) - python-imenu-index-alist) - -(defun python-imenu-create-index () - "`imenu-create-index-function' for Python." - (let ((index - (python-nav-list-defun-positions python-imenu-include-defun-type))) - (if python-imenu-make-tree - (python-imenu-make-tree index) - index))) - - ;;; Misc helpers (defun python-info-current-defun (&optional include-type) @@ -3019,7 +2848,8 @@ (add-hook 'post-self-insert-hook 'python-indent-post-self-insert-function nil 'local) - (setq imenu-create-index-function #'python-imenu-create-index) + (set (make-local-variable 'imenu-extract-index-name-function) + #'python-info-current-defun) (set (make-local-variable 'add-log-current-defun-function) #'python-info-current-defun) ------------------------------------------------------------ revno: 109105 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Mon 2012-07-16 10:13:01 -0300 message: * progmodes/python.el: Enhancements to navigation commands. (python-nav-backward-sentence) (python-nav-forward-sentence): Remove. (python-nav-backward-statement, python-nav-forward-statement) (python-nav-statement-start, python-nav-statement-end) (python-nav-backward-block, python-nav-forward-block) (python-nav-block-start, python-nav-block-end) (python-nav-forward-sexp-function) (python-info-current-line-comment-p) (python-info-current-line-empty-p): New functions. (python-indent-context): Use `python-nav-statement-start'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-16 11:42:01 +0000 +++ lisp/ChangeLog 2012-07-16 13:13:01 +0000 @@ -1,3 +1,17 @@ +2012-07-16 Fabián Ezequiel Gallina + + * progmodes/python.el: Enhancements to navigation commands. + (python-nav-backward-sentence) + (python-nav-forward-sentence): Remove. + (python-nav-backward-statement, python-nav-forward-statement) + (python-nav-statement-start, python-nav-statement-end) + (python-nav-backward-block, python-nav-forward-block) + (python-nav-block-start, python-nav-block-end) + (python-nav-forward-sexp-function) + (python-info-current-line-comment-p) + (python-info-current-line-empty-p): New functions. + (python-indent-context): Use `python-nav-statement-start'. + 2012-07-16 Michael Albinus * eshell/em-ls.el (eshell/ls): Use `apply'. === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-06-23 09:28:10 +0000 +++ lisp/progmodes/python.el 2012-07-16 13:13:01 +0000 @@ -46,11 +46,13 @@ ;; Movement: `beginning-of-defun' and `end-of-defun' functions are ;; properly implemented. There are also specialized -;; `forward-sentence' and `backward-sentence' replacements -;; (`python-nav-forward-sentence', `python-nav-backward-sentence' -;; respectively). Extra functions `python-nav-sentence-start' and -;; `python-nav-sentence-end' are included to move to the beginning and -;; to the end of a sentence while taking care of multiline definitions. +;; `forward-sentence' and `backward-sentence' replacements called +;; `python-nav-forward-block', `python-nav-backward-block' +;; respectively which navigate between beginning of blocks of code. +;; Extra functions `python-nav-forward-statement', +;; `python-nav-backward-statement', `python-nav-statement-start', +;; `python-nav-statement-end', `python-nav-block-start' and +;; `python-nav-block-end' are included but no bound to any key. ;; `python-nav-jump-to-defun' is provided and allows jumping to a ;; function or class definition quickly in the current buffer. @@ -227,10 +229,10 @@ (let ((map (make-sparse-keymap))) ;; Movement (substitute-key-definition 'backward-sentence - 'python-nav-backward-sentence + 'python-nav-backward-block map global-map) (substitute-key-definition 'forward-sentence - 'python-nav-forward-sentence + 'python-nav-forward-block map global-map) (define-key map "\C-c\C-j" 'python-nav-jump-to-defun) ;; Indent specific @@ -664,7 +666,7 @@ ((setq start (save-excursion (back-to-indentation) (python-util-forward-comment -1) - (python-nav-sentence-start) + (python-nav-statement-start) (point-marker))) 'after-line) ;; Do not indent @@ -1097,10 +1099,10 @@ (python-info-ppss-context-type)) (forward-line 1))))))) -(defun python-nav-sentence-start () - "Move to start of current sentence." +(defun python-nav-statement-start () + "Move to start of current statement." (interactive "^") - (while (and (not (back-to-indentation)) + (while (and (or (back-to-indentation) t) (not (bobp)) (when (or (save-excursion @@ -1110,8 +1112,8 @@ (python-info-ppss-context 'paren)) (forward-line -1))))) -(defun python-nav-sentence-end () - "Move to end of current sentence." +(defun python-nav-statement-end () + "Move to end of current statement." (interactive "^") (while (and (goto-char (line-end-position)) (not (eobp)) @@ -1121,28 +1123,185 @@ (python-info-ppss-context 'paren)) (forward-line 1))))) -(defun python-nav-backward-sentence (&optional arg) - "Move backward to start of sentence. With ARG, do it arg times. -See `python-nav-forward-sentence' for more information." +(defun python-nav-backward-statement (&optional arg) + "Move backward to previous statement. +With ARG, repeat. See `python-nav-forward-statement'." (interactive "^p") (or arg (setq arg 1)) - (python-nav-forward-sentence (- arg))) + (python-nav-forward-statement (- arg))) -(defun python-nav-forward-sentence (&optional arg) - "Move forward to next end of sentence. With ARG, repeat. -With negative argument, move backward repeatedly to start of sentence." +(defun python-nav-forward-statement (&optional arg) + "Move forward to next statement. +With ARG, repeat. With negative argument, move ARG times +backward to previous statement." (interactive "^p") (or arg (setq arg 1)) (while (> arg 0) + (python-nav-statement-end) (python-util-forward-comment) - (python-nav-sentence-end) - (forward-line 1) + (python-nav-statement-start) (setq arg (1- arg))) (while (< arg 0) - (python-nav-sentence-end) + (python-nav-statement-start) (python-util-forward-comment -1) - (python-nav-sentence-start) - (forward-line -1) + (python-nav-statement-start) + (setq arg (1+ arg)))) + +(defun python-nav-block-start () + "Move to start of current block." + (interactive "^") + (let ((starting-pos (point)) + (block-regexp (python-rx + line-start (* whitespace) block-start))) + (if (progn + (python-nav-statement-start) + (looking-at (python-rx block-start))) + (point-marker) + ;; Go to first line beginning a statement + (while (and (not (bobp)) + (or (and (python-nav-statement-start) nil) + (python-info-current-line-comment-p) + (python-info-current-line-empty-p))) + (forward-line -1)) + (let ((block-matching-indent + (- (current-indentation) python-indent-offset))) + (while + (and (python-nav-backward-block) + (> (current-indentation) block-matching-indent))) + (if (and (looking-at (python-rx block-start)) + (= (current-indentation) block-matching-indent)) + (point-marker) + (and (goto-char starting-pos) nil)))))) + +(defun python-nav-block-end () + "Move to end of current block." + (interactive "^") + (when (python-nav-block-start) + (let ((block-indentation (current-indentation))) + (python-nav-statement-end) + (while (and (forward-line 1) + (not (eobp)) + (or (and (> (current-indentation) block-indentation) + (or (python-nav-statement-end) t)) + (python-info-current-line-comment-p) + (python-info-current-line-empty-p)))) + (python-util-forward-comment -1) + (point-marker)))) + +(defun python-nav-backward-block (&optional arg) + "Move backward to previous block of code. +With ARG, repeat. See `python-nav-forward-block'." + (interactive "^p") + (or arg (setq arg 1)) + (python-nav-forward-block (- arg))) + +(defun python-nav-forward-block (&optional arg) + "Move forward to next block of code. +With ARG, repeat. With negative argument, move ARG times +backward to previous block." + (interactive "^p") + (or arg (setq arg 1)) + (let ((block-start-regexp + (python-rx line-start (* whitespace) block-start)) + (starting-pos (point))) + (while (> arg 0) + (python-nav-statement-end) + (while (and + (re-search-forward block-start-regexp nil t) + (or (python-info-ppss-context 'string) + (python-info-ppss-context 'comment) + (python-info-ppss-context 'paren)))) + (setq arg (1- arg))) + (while (< arg 0) + (python-nav-statement-start) + (while (and + (re-search-backward block-start-regexp nil t) + (or (python-info-ppss-context 'string) + (python-info-ppss-context 'comment) + (python-info-ppss-context 'paren)))) + (setq arg (1+ arg))) + (python-nav-statement-start) + (if (not (looking-at (python-rx block-start))) + (and (goto-char starting-pos) nil) + (and (not (= (point) starting-pos)) (point-marker))))) + +(defun python-nav-forward-sexp-function (&optional arg) + "Move forward across one block of code. +With ARG, do it that many times. Negative arg -N means +move backward N times." + (interactive "^p") + (or arg (setq arg 1)) + (while (> arg 0) + (let ((block-starting-pos + (save-excursion (python-nav-block-start))) + (block-ending-pos + (save-excursion (python-nav-block-end))) + (next-block-starting-pos + (save-excursion (python-nav-forward-block)))) + (cond ((not block-starting-pos) + (python-nav-forward-block)) + ((= (point) block-starting-pos) + (if (or (not next-block-starting-pos) + (< block-ending-pos next-block-starting-pos)) + (python-nav-block-end) + (python-nav-forward-block))) + ((= block-ending-pos (point)) + (let ((parent-block-end-pos + (save-excursion + (python-util-forward-comment) + (python-nav-block-start) + (python-nav-block-end)))) + (if (and parent-block-end-pos + (or (not next-block-starting-pos) + (> next-block-starting-pos parent-block-end-pos))) + (goto-char parent-block-end-pos) + (python-nav-forward-block)))) + (t (python-nav-block-end)))) + (setq arg (1- arg))) + (while (< arg 0) + (let* ((block-starting-pos + (save-excursion (python-nav-block-start))) + (block-ending-pos + (save-excursion (python-nav-block-end))) + (prev-block-ending-pos + (save-excursion (when (python-nav-backward-block) + (python-nav-block-end)))) + (prev-block-parent-ending-pos + (save-excursion + (when prev-block-ending-pos + (goto-char prev-block-ending-pos) + (python-util-forward-comment) + (python-nav-block-start) + (python-nav-block-end))))) + (cond ((not block-ending-pos) + (and (python-nav-backward-block) + (python-nav-block-end))) + ((= (point) block-ending-pos) + (let ((candidates)) + (dolist (name + '(prev-block-parent-ending-pos + prev-block-ending-pos + block-ending-pos + block-starting-pos)) + (when (and (symbol-value name) + (< (symbol-value name) (point))) + (add-to-list 'candidates (symbol-value name)))) + (goto-char (apply 'max candidates)))) + ((> (point) block-ending-pos) + (python-nav-block-end)) + ((= (point) block-starting-pos) + (if (not (> (point) (or prev-block-ending-pos (point)))) + (python-nav-backward-block) + (goto-char prev-block-ending-pos) + (let ((parent-block-ending-pos + (save-excursion + (python-nav-forward-sexp-function) + (and (not (looking-at (python-rx block-start))) + (point))))) + (when (and parent-block-ending-pos + (> parent-block-ending-pos prev-block-ending-pos)) + (goto-char parent-block-ending-pos))))) + (t (python-nav-block-start)))) (setq arg (1+ arg)))) (defvar python-nav-list-defun-positions-cache nil) @@ -2766,6 +2925,20 @@ (beginning-of-line 1) (looking-at python-nav-beginning-of-defun-regexp)))) +(defun python-info-current-line-comment-p () + "Check if current line is a comment line." + (char-equal (or (char-after (+ (point) (current-indentation))) ?_) ?#)) + +(defun python-info-current-line-empty-p () + "Check if current line is empty, ignoring whitespace." + (save-excursion + (beginning-of-line 1) + (looking-at + (python-rx line-start (* whitespace) + (group (* not-newline)) + (* whitespace) line-end)) + (string-equal "" (match-string-no-properties 1)))) + ;;; Utility functions @@ -2818,6 +2991,9 @@ (set (make-local-variable 'parse-sexp-lookup-properties) t) (set (make-local-variable 'parse-sexp-ignore-comments) t) + (set (make-local-variable 'forward-sexp-function) + 'python-nav-forward-sexp-function) + (set (make-local-variable 'font-lock-defaults) '(python-font-lock-keywords nil nil nil nil)) ------------------------------------------------------------ revno: 109104 committer: Michael Albinus branch nick: trunk timestamp: Mon 2012-07-16 13:42:01 +0200 message: * eshell/em-ls.el (eshell/ls): Use `apply'. * eshell/em-unix.el (eshell/su, eshell/sudo): Apply Tramp's ad-hoc multi-hops, instead of Tramp internals. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-16 10:19:56 +0000 +++ lisp/ChangeLog 2012-07-16 11:42:01 +0000 @@ -1,5 +1,10 @@ 2012-07-16 Michael Albinus + * eshell/em-ls.el (eshell/ls): Use `apply'. + + * eshell/em-unix.el (eshell/su, eshell/sudo): Apply Tramp's ad-hoc + multi-hops, instead of Tramp internals. + * vc/ediff.el (ediff-directories): Add trailing space to prompts. * vc/ediff-diff.el (ediff-same-file-contents): Handle the case, === modified file 'lisp/eshell/em-ls.el' --- lisp/eshell/em-ls.el 2012-07-11 23:13:41 +0000 +++ lisp/eshell/em-ls.el 2012-07-16 11:42:01 +0000 @@ -312,7 +312,7 @@ (let ((insert-func 'eshell-buffered-print) (error-func 'eshell-error) (flush-func 'eshell-flush)) - (eshell-do-ls args))) + (apply 'eshell-do-ls args))) (put 'eshell/ls 'eshell-no-numeric-conversions t) === modified file 'lisp/eshell/em-unix.el' --- lisp/eshell/em-unix.el 2012-06-27 07:08:06 +0000 +++ lisp/eshell/em-unix.el 2012-07-16 11:42:01 +0000 @@ -1037,12 +1037,8 @@ (put 'eshell/occur 'eshell-no-numeric-conversions t) -;; Pacify the byte-compiler. -(defvar tramp-default-proxies-alist) - (defun eshell/su (&rest args) "Alias \"su\" to call Tramp." - (require 'tramp) (setq args (eshell-stringify-list (eshell-flatten-list args))) (let ((orig-args (copy-tree args))) (eshell-eval-using-options @@ -1057,29 +1053,29 @@ (host (or (file-remote-p default-directory 'host) "localhost")) (dir (or (file-remote-p default-directory 'localname) - (expand-file-name default-directory)))) + (expand-file-name default-directory))) + (prefix (file-remote-p default-directory))) (dolist (arg args) (if (string-equal arg "-") (setq login t) (setq user arg))) ;; `eshell-eval-using-options' does not handle "-". (if (member "-" orig-args) (setq login t)) (if login (setq dir "~/")) - (if (and (file-remote-p default-directory) + (if (and prefix (or (not (string-equal "su" (file-remote-p default-directory 'method))) (not (string-equal user (file-remote-p default-directory 'user))))) - (add-to-list - 'tramp-default-proxies-alist - (list host user (file-remote-p default-directory)))) - (eshell-parse-command - "cd" (list (format "/su:%s@%s:%s" user host dir)))))))) + (eshell-parse-command + "cd" (list (format "%s|su:%s@%s:%s" + (substring prefix 0 -1) user host dir))) + (eshell-parse-command + "cd" (list (format "/su:%s@%s:%s" user host dir))))))))) (put 'eshell/su 'eshell-no-numeric-conversions t) (defun eshell/sudo (&rest args) "Alias \"sudo\" to call Tramp." - (require 'tramp) (setq args (eshell-stringify-list (eshell-flatten-list args))) (let ((orig-args (copy-tree args))) (eshell-eval-using-options @@ -1094,21 +1090,26 @@ (host (or (file-remote-p default-directory 'host) "localhost")) (dir (or (file-remote-p default-directory 'localname) - (expand-file-name default-directory)))) + (expand-file-name default-directory))) + (prefix (file-remote-p default-directory))) ;; `eshell-eval-using-options' reads options of COMMAND. (while (and (stringp (car orig-args)) (member (car orig-args) '("-u" "--user"))) (setq orig-args (cddr orig-args))) - (if (and (file-remote-p default-directory) - (or - (not (string-equal - "sudo" (file-remote-p default-directory 'method))) - (not (string-equal - user (file-remote-p default-directory 'user))))) - (add-to-list - 'tramp-default-proxies-alist - (list host user (file-remote-p default-directory)))) - (let ((default-directory (format "/sudo:%s@%s:%s" user host dir))) + (let ((default-directory + (if (and prefix + (or + (not + (string-equal + "sudo" + (file-remote-p default-directory 'method))) + (not + (string-equal + user + (file-remote-p default-directory 'user))))) + (format "%s|sudo:%s@%s:%s" + (substring prefix 0 -1) user host dir) + (format "/sudo:%s@%s:%s" user host dir)))) (eshell-named-command (car orig-args) (cdr orig-args)))))))) (put 'eshell/sudo 'eshell-no-numeric-conversions t) ------------------------------------------------------------ revno: 109103 fixes bug(s): http://debbugs.gnu.org/11670 committer: Jan D. branch nick: trunk timestamp: Mon 2012-07-16 13:02:09 +0200 message: * nsterm.m (keyDown): Interpret flags without left/right bits as the left key. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-16 04:47:31 +0000 +++ src/ChangeLog 2012-07-16 11:02:09 +0000 @@ -1,3 +1,8 @@ +2012-07-16 Jan Djärv + + * nsterm.m (keyDown): Interpret flags without left/right bits + as the left key (Bug#11670). + 2012-07-16 Dmitry Antipov Remove empty and useless init functions. === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-13 18:03:10 +0000 +++ src/nsterm.m 2012-07-16 11:02:09 +0000 @@ -4720,8 +4720,13 @@ if (!processingCompose) { + /* When using screen sharing, no left or right information is sent, + so use Left key in those cases. */ + int is_left_key, is_right_key; + code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; + /* (Carbon way: [theEvent keyCode]) */ /* is it a "function key"? */ @@ -4746,13 +4751,17 @@ if (flags & NSShiftKeyMask) emacs_event->modifiers |= shift_modifier; - if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask) + is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask; + is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask + || (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask); + + if (is_right_key) emacs_event->modifiers |= parse_solitary_modifier (EQ (ns_right_command_modifier, Qleft) ? ns_command_modifier : ns_right_command_modifier); - if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask) + if (is_left_key) { emacs_event->modifiers |= parse_solitary_modifier (ns_command_modifier); @@ -4789,13 +4798,17 @@ } } - if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask) + is_right_key = (flags & NSRightControlKeyMask) == NSRightControlKeyMask; + is_left_key = (flags & NSLeftControlKeyMask) == NSLeftControlKeyMask + || (! is_right_key && (flags & NSControlKeyMask) == NSControlKeyMask); + + if (is_right_key) emacs_event->modifiers |= parse_solitary_modifier (EQ (ns_right_control_modifier, Qleft) ? ns_control_modifier : ns_right_control_modifier); - if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask) + if (is_left_key) emacs_event->modifiers |= parse_solitary_modifier (ns_control_modifier); @@ -4806,7 +4819,13 @@ left_is_none = NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone); - if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask) + is_right_key = (flags & NSRightAlternateKeyMask) + == NSRightAlternateKeyMask; + is_left_key = (flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask + || (! is_right_key + && (flags & NSAlternateKeyMask) == NSAlternateKeyMask); + + if (is_right_key) { if ((NILP (ns_right_alternate_modifier) || EQ (ns_right_alternate_modifier, Qnone) @@ -4826,7 +4845,7 @@ : ns_right_alternate_modifier); } - if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /* default = meta */ + if (is_left_key) /* default = meta */ { if (left_is_none && !fnKeysym) { /* accept pre-interp alt comb */ ------------------------------------------------------------ revno: 109102 committer: Michael Albinus branch nick: trunk timestamp: Mon 2012-07-16 12:19:56 +0200 message: * vc/ediff.el (ediff-directories): Add trailing space to prompts. * vc/ediff-diff.el (ediff-same-file-contents): Handle the case, when F1 and F2 are located on different hosts. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-14 15:40:12 +0000 +++ lisp/ChangeLog 2012-07-16 10:19:56 +0000 @@ -1,3 +1,10 @@ +2012-07-16 Michael Albinus + + * vc/ediff.el (ediff-directories): Add trailing space to prompts. + + * vc/ediff-diff.el (ediff-same-file-contents): Handle the case, + when F1 and F2 are located on different hosts. + 2012-07-14 Chong Yidong * xt-mouse.el: Implement extended mouse coordinates (Bug#10642). === modified file 'lisp/vc/ediff-diff.el' --- lisp/vc/ediff-diff.el 2012-07-03 07:42:31 +0000 +++ lisp/vc/ediff-diff.el 2012-07-16 10:19:56 +0000 @@ -1406,18 +1406,27 @@ "Return t if files F1 and F2 have identical contents." (if (and (not (file-directory-p f1)) (not (file-directory-p f2))) - (let ((res - ;; In the remote case, this works only if F1 and F2 are - ;; located on the same remote host. - (apply 'process-file ediff-cmp-program nil nil nil - (append ediff-cmp-options - (list (or (file-remote-p f1 'localname) - (expand-file-name f1)) - (or (file-remote-p f2 'localname) - (expand-file-name f2))))) - )) - (and (numberp res) (eq res 0))) - )) + (if (equal (file-remote-p f1) (file-remote-p f2)) + (let ((res + ;; In the remote case, this works only if F1 and F2 are + ;; located on the same remote host. + (apply 'process-file ediff-cmp-program nil nil nil + (append ediff-cmp-options + (list (or (file-remote-p f1 'localname) + (expand-file-name f1)) + (or (file-remote-p f2 'localname) + (expand-file-name f2))))) + )) + (and (numberp res) (eq res 0))) + + ;; F1 and F2 are not located on the same host. + (let ((t1 (file-local-copy f1)) + (t2 (file-local-copy f2))) + (unwind-protect + (ediff-same-file-contents (or t1 f1) (or t2 f2)) + (and t1 (delete-file t1)) + (and t2 (delete-file t2)))) + ))) (defun ediff-same-contents (d1 d2 &optional filter-re) === modified file 'lisp/vc/ediff.el' --- lisp/vc/ediff.el 2012-07-13 07:06:09 +0000 +++ lisp/vc/ediff.el 2012-07-16 10:19:56 +0000 @@ -491,12 +491,12 @@ (setq buf-B-file-name (file-name-nondirectory buf-B-file-name))) (if (stringp buf-C-file-name) (setq buf-C-file-name (file-name-nondirectory buf-C-file-name))) - + (setq file-A (ediff-make-temp-file buf-A buf-A-file-name) file-B (ediff-make-temp-file buf-B buf-B-file-name)) (if buf-C-is-alive (setq file-C (ediff-make-temp-file buf-C buf-C-file-name))) - + (ediff-setup (get-buffer buf-A) file-A (get-buffer buf-B) file-B (if buf-C-is-alive (get-buffer buf-C)) @@ -542,8 +542,8 @@ (default-regexp (eval ediff-default-filtering-regexp)) f) (list (setq f (read-directory-name - "Directory A to compare:" dir-A nil 'must-match)) - (read-directory-name "Directory B to compare:" + "Directory A to compare: " dir-A nil 'must-match)) + (read-directory-name "Directory B to compare: " (if ediff-use-last-dir ediff-last-dir-B (ediff-strip-last-dir f)) @@ -1072,7 +1072,7 @@ (ediff-with-current-buffer buffer-B (setq beg-B (move-marker (make-marker) beg-B) end-B (move-marker (make-marker) end-B))) - + ;; make file-A (if word-mode (ediff-wordify beg-A end-A buffer-A tmp-buffer) @@ -1084,7 +1084,7 @@ (ediff-wordify beg-B end-B buffer-B tmp-buffer) (ediff-copy-to-buffer beg-B end-B buffer-B tmp-buffer)) (setq file-B (ediff-make-temp-file tmp-buffer "regB")) - + (setq overl-A (ediff-make-bullet-proof-overlay beg-A end-A buffer-A)) (setq overl-B (ediff-make-bullet-proof-overlay beg-B end-B buffer-B)) (ediff-setup buffer-A file-A ------------------------------------------------------------ revno: 109101 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2012-07-16 08:47:31 +0400 message: Remove empty and useless init functions. * lisp.h (init_character_once, init_fns, init_image) (init_filelock, init_sound): Remove prototype. * character.c (init_character_once): Remove. * filelock.c (init_filelock): Likewise. * fns.c (init_fns): Likewise. * image.c (init_image): Likewise. * sound.c (init_sound): Likewise. * emacs.c (main): Adjust accordingly. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-16 03:36:46 +0000 +++ src/ChangeLog 2012-07-16 04:47:31 +0000 @@ -1,5 +1,17 @@ 2012-07-16 Dmitry Antipov + Remove empty and useless init functions. + * lisp.h (init_character_once, init_fns, init_image) + (init_filelock, init_sound): Remove prototype. + * character.c (init_character_once): Remove. + * filelock.c (init_filelock): Likewise. + * fns.c (init_fns): Likewise. + * image.c (init_image): Likewise. + * sound.c (init_sound): Likewise. + * emacs.c (main): Adjust accordingly. + +2012-07-16 Dmitry Antipov + * gtkutil.h: Tiny cleanups. (use_old_gtk_file_dialog): Remove useless declaration. (xg_uses_old_file_dialog): Add suggested const attribute. === modified file 'src/character.c' --- src/character.c 2012-06-30 09:13:54 +0000 +++ src/character.c 2012-07-16 04:47:31 +0000 @@ -1010,12 +1010,6 @@ return make_number (c); } - -void -init_character_once (void) -{ -} - #ifdef emacs void === modified file 'src/emacs.c' --- src/emacs.c 2012-07-12 23:56:39 +0000 +++ src/emacs.c 2012-07-16 04:47:31 +0000 @@ -1254,7 +1254,6 @@ init_alloc_once (); init_obarray (); init_eval_once (); - init_character_once (); init_charset_once (); init_coding_once (); init_syntax_once (); /* Create standard syntax table. */ @@ -1307,9 +1306,6 @@ init_eval (); init_data (); -#ifdef CLASH_DETECTION - init_filelock (); -#endif init_atimer (); running_asynch_code = 0; @@ -1602,17 +1598,12 @@ init_keyboard (); /* This too must precede init_sys_modes. */ if (!noninteractive) init_display (); /* Determine terminal type. Calls init_sys_modes. */ - init_fns (); init_xdisp (); #ifdef HAVE_WINDOW_SYSTEM init_fringe (); - init_image (); #endif /* HAVE_WINDOW_SYSTEM */ init_macros (); init_floatfns (); -#ifdef HAVE_SOUND - init_sound (); -#endif init_window (); init_font (); === modified file 'src/filelock.c' --- src/filelock.c 2012-07-10 06:23:45 +0000 +++ src/filelock.c 2012-07-16 04:47:31 +0000 @@ -708,15 +708,6 @@ return ret; } - -/* Initialization functions. */ - -void -init_filelock (void) -{ - boot_time = 0; - boot_time_initialized = 0; -} #endif /* CLASH_DETECTION */ === modified file 'src/fns.c' --- src/fns.c 2012-07-15 11:17:09 +0000 +++ src/fns.c 2012-07-16 04:47:31 +0000 @@ -5022,9 +5022,3 @@ defsubr (&Ssecure_hash); defsubr (&Slocale_info); } - - -void -init_fns (void) -{ -} === modified file 'src/image.c' --- src/image.c 2012-07-13 12:20:07 +0000 +++ src/image.c 2012-07-16 04:47:31 +0000 @@ -8951,8 +8951,3 @@ #endif } - -void -init_image (void) -{ -} === modified file 'src/lisp.h' --- src/lisp.h 2012-07-15 11:17:09 +0000 +++ src/lisp.h 2012-07-16 04:47:31 +0000 @@ -2402,7 +2402,6 @@ extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t); extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST; extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST; -extern void init_character_once (void) ATTRIBUTE_CONST; extern void syms_of_character (void); /* Defined in charset.c */ @@ -2437,7 +2436,6 @@ ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, EMACS_UINT); -extern void init_fns (void) ATTRIBUTE_CONST; extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); @@ -2473,7 +2471,6 @@ extern Lisp_Object QCconversion; extern int x_bitmap_mask (struct frame *, ptrdiff_t); extern void syms_of_image (void); -extern void init_image (void) ATTRIBUTE_CONST; /* Defined in insdel.c */ extern Lisp_Object Qinhibit_modification_hooks; @@ -3162,11 +3159,9 @@ extern void unlock_file (Lisp_Object); extern void unlock_buffer (struct buffer *); extern void syms_of_filelock (void); -extern void init_filelock (void); /* Defined in sound.c */ extern void syms_of_sound (void); -extern void init_sound (void) ATTRIBUTE_CONST; /* Defined in category.c */ extern void init_category_once (void); === modified file 'src/sound.c' --- src/sound.c 2012-07-11 02:16:25 +0000 +++ src/sound.c 2012-07-16 04:47:31 +0000 @@ -1473,10 +1473,4 @@ defsubr (&Splay_sound_internal); } - -void -init_sound (void) -{ -} - #endif /* HAVE_SOUND */