------------------------------------------------------------ revno: 115423 committer: Leo Liu branch nick: trunk timestamp: Sun 2013-12-08 17:18:55 +0800 message: Re-write flymake-highlight-line in flymake.el * progmodes/flymake.el (flymake-highlight-line): Re-write. (flymake-make-overlay): Remove arg MOUSE-FACE. (flymake-save-string-to-file, flymake-read-file-to-string): Remove. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-08 08:11:50 +0000 +++ lisp/ChangeLog 2013-12-08 09:18:55 +0000 @@ -1,3 +1,9 @@ +2013-12-08 Leo Liu + + * progmodes/flymake.el (flymake-highlight-line): Re-write. + (flymake-make-overlay): Remove arg MOUSE-FACE. + (flymake-save-string-to-file, flymake-read-file-to-string): Remove. + 2013-12-08 Stefan Monnier * emulation/cua-rect.el (cua--rectangle-highlight-for-redisplay): === modified file 'lisp/progmodes/flymake.el' --- lisp/progmodes/flymake.el 2013-12-08 07:18:46 +0000 +++ lisp/progmodes/flymake.el 2013-12-08 09:18:55 +0000 @@ -509,16 +509,6 @@ (write-region nil nil file-name nil 566) (flymake-log 3 "saved buffer %s in file %s" (buffer-name) file-name)) -(defun flymake-save-string-to-file (file-name data) - "Save string DATA to file FILE-NAME." - (write-region data nil file-name nil 566)) - -(defun flymake-read-file-to-string (file-name) - "Read contents of file FILE-NAME and return as a string." - (with-temp-buffer - (insert-file-contents file-name) - (buffer-substring (point-min) (point-max)))) - (defun flymake-process-filter (process output) "Parse OUTPUT and highlight error lines. It's flymake process filter." @@ -697,7 +687,7 @@ "Determine whether overlay OV was created by flymake." (and (overlayp ov) (overlay-get ov 'flymake-overlay))) -(defun flymake-make-overlay (beg end tooltip-text face bitmap mouse-face) +(defun flymake-make-overlay (beg end tooltip-text face bitmap) "Allocate a flymake overlay in range BEG and END." (when (not (flymake-region-has-flymake-overlays beg end)) (let ((ov (make-overlay beg end nil t t)) @@ -708,7 +698,6 @@ bitmap (list bitmap))))))) (overlay-put ov 'face face) - (overlay-put ov 'mouse-face mouse-face) (overlay-put ov 'help-echo tooltip-text) (overlay-put ov 'flymake-overlay t) (overlay-put ov 'priority 100) @@ -760,42 +749,19 @@ Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting." (goto-char (point-min)) (forward-line (1- line-no)) - (let* ((line-beg (point-at-bol)) - (line-end (point-at-eol)) - (beg line-beg) - (end line-end) - (tooltip-text (flymake-ler-text (nth 0 line-err-info-list))) - (face nil) - (bitmap nil)) - - (goto-char line-beg) - (while (looking-at "[ \t]") - (forward-char)) - - (setq beg (point)) - - (goto-char line-end) - (while (and (looking-at "[ \t\r\n]") (> (point) 1)) - (backward-char)) - - (setq end (1+ (point))) - - (when (<= end beg) - (setq beg line-beg) - (setq end line-end)) - - (when (= end beg) - (goto-char end) - (forward-line) - (setq end (point))) - - (if (> (flymake-get-line-err-count line-err-info-list "e") 0) - (setq face 'flymake-errline - bitmap flymake-error-bitmap) - (setq face 'flymake-warnline - bitmap flymake-warning-bitmap)) - - (flymake-make-overlay beg end tooltip-text face bitmap nil))) + (pcase-let* ((beg (progn (back-to-indentation) (point))) + (end (progn + (end-of-line) + (skip-chars-backward " \t\f\t\n" beg) + (if (eq (point) beg) + (line-beginning-position 2) + (point)))) + (tooltip-text (mapconcat #'flymake-ler-text line-err-info-list "\n")) + (`(,face ,bitmap) + (if (> (flymake-get-line-err-count line-err-info-list "e") 0) + (list 'flymake-errline flymake-error-bitmap) + (list 'flymake-warnline flymake-warning-bitmap)))) + (flymake-make-overlay beg end tooltip-text face bitmap))) (defun flymake-parse-err-lines (err-info-list lines) "Parse err LINES, store info in ERR-INFO-LIST." @@ -883,19 +849,6 @@ Use `flymake-reformat-err-line-patterns-from-compile-el' to add patterns from compile.el") -;;(defcustom flymake-err-line-patterns -;; '( -;; ; MS Visual C++ 6.0 -;; ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)" -;; 1 3 4) -;; ; jikes -;; ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\):[ \t\n]*\\(.+\\)\\)" -;; 1 3 4)) -;; "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)" -;; :group 'flymake -;; :type '(repeat (string number number number)) -;;) - (define-obsolete-variable-alias 'flymake-warning-re 'flymake-warning-predicate "24.4") (defvar flymake-warning-predicate "^[wW]arning" "Predicate matching against error text to detect a warning. ------------------------------------------------------------ revno: 115422 author: Paul Eggert committer: Paul Eggert branch nick: trunk timestamp: Sun 2013-12-08 00:53:49 -0800 message: * configure.ac: Simplify supression of GTK deprecation warning. Move -DGDK_DISABLE_DEPRECATION_WARNINGS out of the command line and into config.h, to shorten the command line when doing 'make'. Don't AC_SUBST GTK_CFLAGS, as this is not needed. diff: === modified file 'ChangeLog' --- ChangeLog 2013-12-08 08:05:36 +0000 +++ ChangeLog 2013-12-08 08:53:49 +0000 @@ -1,5 +1,10 @@ 2013-12-08 Paul Eggert + * configure.ac: Simplify supression of GTK deprecation warning. + Move -DGDK_DISABLE_DEPRECATION_WARNINGS out of the command line + and into config.h, to shorten the command line when doing 'make'. + Don't AC_SUBST GTK_CFLAGS, as this is not needed. + Use libcrypto's checksum implementations if available, for speed. On commonly used platform libcrypto uses architecture-specific assembly code, which is significantly faster than the C code we === modified file 'configure.ac' --- configure.ac 2013-12-08 08:05:36 +0000 +++ configure.ac 2013-12-08 08:53:49 +0000 @@ -2185,8 +2185,10 @@ gtk_term_header=gtkutil.h USE_GTK_TOOLKIT="GTK3" if test "x$ac_enable_gtk_deprecation_warnings" = x; then - GTK_CFLAGS="$GTK_CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS" - GTK_CFLAGS="$GTK_CFLAGS -DGLIB_DISABLE_DEPRECATION_WARNINGS" + AC_DEFINE([GDK_DISABLE_DEPRECATION_WARNINGS], [1], + [Define to 1 to disable GTK+/GDK deprecation warnings.]) + AC_DEFINE([GLIB_DISABLE_DEPRECATION_WARNINGS], [1], + [Define to 1 to disable Glib deprecation warnings.]) fi else check_gtk2=yes @@ -2212,7 +2214,6 @@ if test x"$pkg_check_gtk" = xyes; then - AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS" CFLAGS="$CFLAGS $GTK_CFLAGS" ------------------------------------------------------------ revno: 115421 committer: Stefan Monnier branch nick: trunk timestamp: Sun 2013-12-08 03:11:50 -0500 message: Make CUA-mode use shift-select-mode. * lisp/emulation/cua-base.el (cua--explicit-region-start) (cua--last-region-shifted): Remove. (cua--deactivate): Use deactivate-mark. (cua--pre-command-handler-1): Don't handle shift-selection. (cua--post-command-handler-1): Don't change transient-mark-mode. (cua--select-keymaps): Use region-active-p rather than cua--explicit-region-start or cua--last-region-shifted. (cua-mode): Enable shift-select-mode. * lisp/emulation/cua-rect.el (cua--rectangle-highlight-for-redisplay): New function. (redisplay-highlight-region-function): Use it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-08 07:32:01 +0000 +++ lisp/ChangeLog 2013-12-08 08:11:50 +0000 @@ -1,7 +1,22 @@ +2013-12-08 Stefan Monnier + + * emulation/cua-rect.el (cua--rectangle-highlight-for-redisplay): + New function. + (redisplay-highlight-region-function): Use it. + + * emulation/cua-base.el (cua--explicit-region-start) + (cua--last-region-shifted): Remove. + (cua--deactivate): Use deactivate-mark. + (cua--pre-command-handler-1): Don't handle shift-selection. + (cua--post-command-handler-1): Don't change transient-mark-mode. + (cua--select-keymaps): Use region-active-p rather than + cua--explicit-region-start or cua--last-region-shifted. + (cua-mode): Enable shift-select-mode. + 2013-12-08 Leo Liu - * progmodes/flymake.el (flymake-popup-current-error-menu): Rename - from flymake-display-err-menu-for-current-line. Reimplement. + * progmodes/flymake.el (flymake-popup-current-error-menu): + Rename from flymake-display-err-menu-for-current-line. Reimplement. (flymake-posn-at-point-as-event, flymake-popup-menu) (flymake-make-emacs-menu): Remove. (Bug#16077) === modified file 'lisp/emulation/cua-base.el' --- lisp/emulation/cua-base.el 2013-12-08 06:24:54 +0000 +++ lisp/emulation/cua-base.el 2013-12-08 08:11:50 +0000 @@ -625,13 +625,6 @@ ;;; Aux. variables -;; Current region was started using cua-set-mark. -(defvar cua--explicit-region-start nil) -(make-variable-buffer-local 'cua--explicit-region-start) - -;; Latest region was started using shifted movement command. -(defvar cua--last-region-shifted nil) - ;; buffer + point prior to current command when rectangle is active ;; checked in post-command hook to see if point was moved (defvar cua--buffer-and-point-before-command nil) @@ -762,11 +755,9 @@ deactivate-mark nil)) (defun cua--deactivate (&optional now) - (setq cua--explicit-region-start nil) (if (not now) (setq deactivate-mark t) - (setq mark-active nil) - (run-hooks 'deactivate-mark-hook))) + (deactivate-mark))) (defun cua--filter-buffer-noprops (start end) (let ((str (filter-buffer-substring start end))) @@ -862,7 +853,6 @@ "Cancel the active region, rectangle, or global mark." (interactive) (setq mark-active nil) - (setq cua--explicit-region-start nil) (if (fboundp 'cua--cancel-rectangle) (cua--cancel-rectangle))) @@ -1109,8 +1099,6 @@ (message "Mark cleared")) (t (push-mark-command nil nil) - (setq cua--explicit-region-start t) - (setq cua--last-region-shifted nil) (if cua-enable-region-auto-help (cua-help-for-region t))))) @@ -1203,28 +1191,10 @@ ((not (eq (get this-command 'CUA) 'move)) nil) - ;; Handle shifted cursor keys and other movement commands. - ;; If region is not active, region is activated if key is shifted. - ;; If region is active, region is canceled if key is unshifted - ;; (and region not started with C-SPC). - ;; If rectangle is active, expand rectangle in specified direction and - ;; ignore the movement. - (this-command-keys-shift-translated - (unless mark-active - (push-mark-command nil t)) - (setq cua--last-region-shifted t) - (setq cua--explicit-region-start nil)) - ;; Set mark if user explicitly said to do so - ((or cua--explicit-region-start cua--rectangle) + (cua--rectangle ;FIXME: ?? (unless mark-active - (push-mark-command nil nil))) - - ;; Else clear mark after this command. - (t - ;; If we set mark-active to nil here, the region highlight will not be - ;; removed by the direct_output_ commands. - (setq deactivate-mark t))) + (push-mark-command nil nil)))) ;; Detect extension of rectangles by mouse or other movement (setq cua--buffer-and-point-before-command @@ -1244,22 +1214,13 @@ (when (fboundp 'cua--rectangle-post-command) (cua--rectangle-post-command)) (setq cua--buffer-and-point-before-command nil) - (if (or (not mark-active) deactivate-mark) - (setq cua--explicit-region-start nil)) ;; Debugging (if cua--debug (cond (cua--rectangle (cua--rectangle-assert)) - (mark-active (message "Mark=%d Point=%d Expl=%s" - (mark t) (point) cua--explicit-region-start)))) + (mark-active (message "Mark=%d Point=%d" (mark t) (point))))) - ;; Disable transient-mark-mode if rectangle active in current buffer. - (if (not (window-minibuffer-p)) - (setq transient-mark-mode (and (not cua--rectangle) - (if cua-highlight-region-shift-only - (not cua--explicit-region-start) - t)))) (if cua-enable-cursor-indications (cua--update-indications)) @@ -1323,7 +1284,7 @@ cua-enable-cua-keys (not cua-inhibit-cua-keys) (or (eq cua-enable-cua-keys t) - (not cua--explicit-region-start)) + (region-active-p)) (not executing-kbd-macro) (not cua--prefix-override-timer))) (setq cua--ena-prefix-repeat-keymap @@ -1334,7 +1295,7 @@ (and cua-enable-cua-keys (not cua-inhibit-cua-keys) (or (eq cua-enable-cua-keys t) - cua--last-region-shifted))) + (region-active-p)))) (setq cua--ena-global-mark-keymap (and cua--global-mark-active (not (window-minibuffer-p))))) @@ -1546,11 +1507,8 @@ (if (and (boundp 'pc-selection-mode) pc-selection-mode) (pc-selection-mode -1)) (cua--deactivate) - (setq shift-select-mode nil) - (setq transient-mark-mode (and cua-mode - (if cua-highlight-region-shift-only - (not cua--explicit-region-start) - t)))) + (setq shift-select-mode t) + (transient-mark-mode (if cua-highlight-region-shift-only -1 1))) (cua--saved-state (setq transient-mark-mode (car cua--saved-state)) (if (nth 1 cua--saved-state) === modified file 'lisp/emulation/cua-rect.el' --- lisp/emulation/cua-rect.el 2013-12-08 06:24:54 +0000 +++ lisp/emulation/cua-rect.el 2013-12-08 08:11:50 +0000 @@ -877,8 +877,7 @@ (push-mark nil nil t))) (cua--activate-rectangle) (cua--rectangle-set-corners) - (setq mark-active t - cua--explicit-region-start t) + (setq mark-active t) (if cua-enable-rectangle-auto-help (cua-help-for-rectangle t)))) @@ -886,8 +885,7 @@ "Cancel current rectangle." (interactive) (when cua--rectangle - (setq mark-active nil - cua--explicit-region-start nil) + (setq mark-active nil) (cua--deactivate-rectangle))) (defun cua-toggle-rectangle-mark () @@ -1378,6 +1376,14 @@ (add-function :around region-extract-function #'cua--rectangle-region-extract) +(add-function :around redisplay-highlight-region-function + #'cua--rectangle-highlight-for-redisplay) + +(defun cua--rectangle-highlight-for-redisplay (orig &rest args) + (if (not cua--rectangle) (apply orig args) + ;; When cua--rectangle is active, just don't highlight at all, since we + ;; already do it elsewhere. + )) (defun cua--rectangle-region-extract (orig &optional delete) (cond ------------------------------------------------------------ revno: 115420 committer: Paul Eggert branch nick: trunk timestamp: Sun 2013-12-08 00:05:36 -0800 message: Use libcrypto's checksum implementations if available, for speed. On commonly used platform libcrypto uses architecture-specific assembly code, which is significantly faster than the C code we were using. See Pádraig Brady's note in . Merge from gnulib, incorporating: 2013-12-07 md5, sha1, sha256, sha512: add gl_SET_CRYPTO_CHECK_DEFAULT 2013-12-07 md5, sha1, sha256, sha512: add 'auto', and set-default method 2013-12-04 include_next: minimize code duplication 2013-12-03 md5, sha1, sha256, sha512: support mandating use of openssl 2013-12-02 md5, sha1, sha256, sha512: use openssl routines if available * configure.ac (--without-all): Set with_openssl_default too. Use gl_SET_CRYPTO_CHECK_DEFAULT to default to 'auto'. (HAVE_LIB_CRYPTO): New var. Say whether Emacs is configured to use a crypto library. * lib/gl_openssl.h, m4/absolute-header.m4, m4/gl-openssl.m4: New files, copied from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/md5.c, lib/md5.h, lib/sha1.c, lib/sha1.h: * lib/sha256.c, lib/sha256.h, lib/sha512.c, lib/sha512.h: * m4/include_next.m4, m4/md5.m4, m4/sha1.m4, m4/sha256.m4, m4/sha512.m4: Update from gnulib. * src/Makefile.in (LIB_CRYPTO): New macro. (LIBES): Use it. diff: === modified file 'ChangeLog' --- ChangeLog 2013-12-01 13:40:19 +0000 +++ ChangeLog 2013-12-08 08:05:36 +0000 @@ -1,3 +1,28 @@ +2013-12-08 Paul Eggert + + Use libcrypto's checksum implementations if available, for speed. + On commonly used platform libcrypto uses architecture-specific + assembly code, which is significantly faster than the C code we + were using. See Pádraig Brady's note in + . + Merge from gnulib, incorporating: + 2013-12-07 md5, sha1, sha256, sha512: add gl_SET_CRYPTO_CHECK_DEFAULT + 2013-12-07 md5, sha1, sha256, sha512: add 'auto', and set-default method + 2013-12-04 include_next: minimize code duplication + 2013-12-03 md5, sha1, sha256, sha512: support mandating use of openssl + 2013-12-02 md5, sha1, sha256, sha512: use openssl routines if available + * configure.ac (--without-all): Set with_openssl_default too. + Use gl_SET_CRYPTO_CHECK_DEFAULT to default to 'auto'. + (HAVE_LIB_CRYPTO): New var. + Say whether Emacs is configured to use a crypto library. + * lib/gl_openssl.h, m4/absolute-header.m4, m4/gl-openssl.m4: + New files, copied from gnulib. + * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. + * lib/md5.c, lib/md5.h, lib/sha1.c, lib/sha1.h: + * lib/sha256.c, lib/sha256.h, lib/sha512.c, lib/sha512.h: + * m4/include_next.m4, m4/md5.m4, m4/sha1.m4, m4/sha256.m4, m4/sha512.m4: + Update from gnulib. + 2013-12-01 Dmitry Gutov * .dir-locals.el (log-edit-move): Add the "Author: " header. === modified file 'configure.ac' --- configure.ac 2013-12-01 22:33:13 +0000 +++ configure.ac 2013-12-08 08:05:36 +0000 @@ -94,8 +94,9 @@ [AS_HELP_STRING([--without-all], [omit almost all features and build small executable with minimal dependencies])], - with_features=$withval, - with_features=yes) + [with_features=$withval + with_openssl_default=$withval], + [with_features=yes]) dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING) dnl Create a new --with option that defaults to being disabled. @@ -4691,6 +4692,7 @@ LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS" gl_ASSERT_NO_GNULIB_POSIXCHECK gl_ASSERT_NO_GNULIB_TESTS +gl_SET_CRYPTO_CHECK_DEFAULT([auto]) gl_INIT CFLAGS=$SAVE_CFLAGS LIBS=$SAVE_LIBS @@ -4842,6 +4844,12 @@ acl_summary=no fi +if test -n "$LIB_CRYPTO"; then + HAVE_LIB_CRYPTO=yes +else + HAVE_LIB_CRYPTO=no +fi + echo " Configured for \`${canonical}'. @@ -4881,6 +4889,7 @@ echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}" echo " Does Emacs use a file notification library? ${NOTIFY_SUMMARY}" echo " Does Emacs use access control lists? ${acl_summary}" +echo " Does Emacs use a crypto library? ${HAVE_LIB_CRYPTO} $LIB_CRYPTO" echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}" echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}" === added file 'lib/gl_openssl.h' --- lib/gl_openssl.h 1970-01-01 00:00:00 +0000 +++ lib/gl_openssl.h 2013-12-08 08:05:36 +0000 @@ -0,0 +1,116 @@ +/* gl_openssl.h -- wrap openssl crypto hash routines in gnulib interface + + Copyright (C) 2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Pádraig Brady */ + +#ifndef GL_OPENSSL_NAME +# error "Please define GL_OPENSSL_NAME to 1,5,256 etc." +#endif + +#ifndef _GL_INLINE_HEADER_BEGIN +# error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef GL_OPENSSL_INLINE +# define GL_OPENSSL_INLINE _GL_INLINE +#endif + +/* Concatenate two preprocessor tokens. */ +#define _GLCRYPTO_CONCAT_(prefix, suffix) prefix##suffix +#define _GLCRYPTO_CONCAT(prefix, suffix) _GLCRYPTO_CONCAT_ (prefix, suffix) + +#if GL_OPENSSL_NAME == 5 +# define OPENSSL_ALG md5 +#else +# define OPENSSL_ALG _GLCRYPTO_CONCAT (sha, GL_OPENSSL_NAME) +#endif + +/* Context type mappings. */ +#if BASE_OPENSSL_TYPE != GL_OPENSSL_NAME +# undef BASE_OPENSSL_TYPE +# if GL_OPENSSL_NAME == 224 +# define BASE_OPENSSL_TYPE 256 +# elif GL_OPENSSL_NAME == 384 +# define BASE_OPENSSL_TYPE 512 +# endif +# define md5_CTX MD5_CTX +# define sha1_CTX SHA_CTX +# define sha224_CTX SHA256_CTX +# define sha224_ctx sha256_ctx +# define sha256_CTX SHA256_CTX +# define sha384_CTX SHA512_CTX +# define sha384_ctx sha512_ctx +# define sha512_CTX SHA512_CTX +# undef _gl_CTX +# undef _gl_ctx +# define _gl_CTX _GLCRYPTO_CONCAT (OPENSSL_ALG, _CTX) /* openssl type. */ +# define _gl_ctx _GLCRYPTO_CONCAT (OPENSSL_ALG, _ctx) /* gnulib type. */ + +struct _gl_ctx { _gl_CTX CTX; }; +#endif + +/* Function name mappings. */ +#define md5_prefix MD5 +#define sha1_prefix SHA1 +#define sha224_prefix SHA224 +#define sha256_prefix SHA256 +#define sha384_prefix SHA384 +#define sha512_prefix SHA512 +#define _GLCRYPTO_PREFIX _GLCRYPTO_CONCAT (OPENSSL_ALG, _prefix) +#define OPENSSL_FN(suffix) _GLCRYPTO_CONCAT (_GLCRYPTO_PREFIX, suffix) +#define GL_CRYPTO_FN(suffix) _GLCRYPTO_CONCAT (OPENSSL_ALG, suffix) + +GL_OPENSSL_INLINE void +GL_CRYPTO_FN (_init_ctx) (struct _gl_ctx *ctx) +{ (void) OPENSSL_FN (_Init) ((_gl_CTX *) ctx); } + +/* These were never exposed by gnulib. */ +#if ! (GL_OPENSSL_NAME == 224 || GL_OPENSSL_NAME == 384) +GL_OPENSSL_INLINE void +GL_CRYPTO_FN (_process_bytes) (const void *buf, size_t len, struct _gl_ctx *ctx) +{ OPENSSL_FN (_Update) ((_gl_CTX *) ctx, buf, len); } + +GL_OPENSSL_INLINE void +GL_CRYPTO_FN (_process_block) (const void *buf, size_t len, struct _gl_ctx *ctx) +{ GL_CRYPTO_FN (_process_bytes) (buf, len, ctx); } +#endif + +GL_OPENSSL_INLINE void * +GL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void *res) +{ OPENSSL_FN (_Final) (res, (_gl_CTX *) ctx); return res; } + +GL_OPENSSL_INLINE void * +GL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void *res) +{ return OPENSSL_FN () ((const unsigned char *) buf, len, res); } + +GL_OPENSSL_INLINE void * +GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *res) +{ + /* Assume any unprocessed bytes in ctx are not to be ignored. */ + _gl_CTX tmp_ctx = *(_gl_CTX *) ctx; + OPENSSL_FN (_Final) (res, &tmp_ctx); + return res; +} + +/* Undef so we can include multiple times. */ +#undef GL_CRYPTO_FN +#undef OPENSSL_FN +#undef _GLCRYPTO_PREFIX +#undef OPENSSL_ALG +#undef GL_OPENSSL_NAME + +_GL_INLINE_HEADER_END === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2013-10-12 20:00:38 +0000 +++ lib/gnulib.mk 2013-12-08 08:05:36 +0000 @@ -33,6 +33,15 @@ libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) EXTRA_libgnu_a_SOURCES = +## begin gnulib module absolute-header + +# Use this preprocessor expression to decide whether #include_next works. +# Do not rely on a 'configure'-time test for this, since the expression +# might appear in an installed header, which is used by some other compiler. +HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER) + +## end gnulib module absolute-header + ## begin gnulib module alloca-opt BUILT_SOURCES += $(ALLOCA_H) @@ -152,7 +161,7 @@ libgnu_a_SOURCES += md5.c -EXTRA_DIST += md5.h +EXTRA_DIST += gl_openssl.h md5.h ## end gnulib module crypto/md5 @@ -160,7 +169,7 @@ libgnu_a_SOURCES += sha1.c -EXTRA_DIST += sha1.h +EXTRA_DIST += gl_openssl.h sha1.h ## end gnulib module crypto/sha1 @@ -168,7 +177,7 @@ libgnu_a_SOURCES += sha256.c -EXTRA_DIST += sha256.h +EXTRA_DIST += gl_openssl.h sha256.h ## end gnulib module crypto/sha256 @@ -176,7 +185,7 @@ libgnu_a_SOURCES += sha512.c -EXTRA_DIST += sha512.h +EXTRA_DIST += gl_openssl.h sha512.h ## end gnulib module crypto/sha512 === modified file 'lib/md5.c' --- lib/md5.c 2013-01-02 16:37:04 +0000 +++ lib/md5.c 2013-12-08 08:05:36 +0000 @@ -21,6 +21,9 @@ #include +#if HAVE_OPENSSL_MD5 +# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE +#endif #include "md5.h" #include @@ -61,6 +64,7 @@ # error "invalid BLOCKSIZE" #endif +#if ! HAVE_OPENSSL_MD5 /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; @@ -128,6 +132,7 @@ return md5_read_ctx (ctx, resbuf); } +#endif /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes @@ -202,6 +207,7 @@ return 0; } +#if ! HAVE_OPENSSL_MD5 /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -459,3 +465,4 @@ ctx->C = C; ctx->D = D; } +#endif === modified file 'lib/md5.h' --- lib/md5.h 2013-01-01 09:11:05 +0000 +++ lib/md5.h 2013-12-08 08:05:36 +0000 @@ -23,6 +23,10 @@ #include #include +# if HAVE_OPENSSL_MD5 +# include +# endif + #define MD5_DIGEST_SIZE 16 #define MD5_BLOCK_SIZE 64 @@ -57,6 +61,10 @@ extern "C" { # endif +# if HAVE_OPENSSL_MD5 +# define GL_OPENSSL_NAME 5 +# include "gl_openssl.h" +# else /* Structure to save state of computation between the single steps. */ struct md5_ctx { @@ -106,11 +114,6 @@ extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; -/* Compute MD5 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 16 bytes - beginning at RESBLOCK. */ -extern int __md5_stream (FILE *stream, void *resblock) __THROW; - /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -118,6 +121,13 @@ extern void *__md5_buffer (const char *buffer, size_t len, void *resblock) __THROW; +# endif +/* Compute MD5 message digest for bytes read from STREAM. The + resulting message digest number will be written into the 16 bytes + beginning at RESBLOCK. */ +extern int __md5_stream (FILE *stream, void *resblock) __THROW; + + # ifdef __cplusplus } # endif === modified file 'lib/sha1.c' --- lib/sha1.c 2013-01-02 16:37:04 +0000 +++ lib/sha1.c 2013-12-08 08:05:36 +0000 @@ -23,6 +23,9 @@ #include +#if HAVE_OPENSSL_SHA1 +# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE +#endif #include "sha1.h" #include @@ -46,6 +49,7 @@ # error "invalid BLOCKSIZE" #endif +#if ! HAVE_OPENSSL_SHA1 /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; @@ -116,6 +120,7 @@ return sha1_read_ctx (ctx, resbuf); } +#endif /* Compute SHA1 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes @@ -190,6 +195,7 @@ return 0; } +#if ! HAVE_OPENSSL_SHA1 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -424,3 +430,4 @@ e = ctx->E += e; } } +#endif === modified file 'lib/sha1.h' --- lib/sha1.h 2013-01-01 09:11:05 +0000 +++ lib/sha1.h 2013-12-08 08:05:36 +0000 @@ -22,12 +22,20 @@ # include # include +# if HAVE_OPENSSL_SHA1 +# include +# endif + # ifdef __cplusplus extern "C" { # endif #define SHA1_DIGEST_SIZE 20 +# if HAVE_OPENSSL_SHA1 +# define GL_OPENSSL_NAME 1 +# include "gl_openssl.h" +# else /* Structure to save state of computation between the single steps. */ struct sha1_ctx { @@ -42,7 +50,6 @@ uint32_t buffer[32]; }; - /* Initialize structure containing state of computation. */ extern void sha1_init_ctx (struct sha1_ctx *ctx); @@ -73,17 +80,19 @@ extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); -/* Compute SHA1 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 20 bytes - beginning at RESBLOCK. */ -extern int sha1_stream (FILE *stream, void *resblock); - /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *sha1_buffer (const char *buffer, size_t len, void *resblock); +# endif +/* Compute SHA1 message digest for bytes read from STREAM. The + resulting message digest number will be written into the 20 bytes + beginning at RESBLOCK. */ +extern int sha1_stream (FILE *stream, void *resblock); + + # ifdef __cplusplus } # endif === modified file 'lib/sha256.c' --- lib/sha256.c 2013-01-02 16:37:04 +0000 +++ lib/sha256.c 2013-12-08 08:05:36 +0000 @@ -22,6 +22,9 @@ #include +#if HAVE_OPENSSL_SHA256 +# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE +#endif #include "sha256.h" #include @@ -45,6 +48,7 @@ # error "invalid BLOCKSIZE" #endif +#if ! HAVE_OPENSSL_SHA256 /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; @@ -163,6 +167,7 @@ sha256_conclude_ctx (ctx); return sha224_read_ctx (ctx, resbuf); } +#endif /* Compute SHA256 message digest for bytes read from STREAM. The resulting message digest number will be written into the 32 bytes @@ -308,6 +313,7 @@ return 0; } +#if ! HAVE_OPENSSL_SHA256 /* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -567,3 +573,4 @@ h = ctx->state[7] += h; } } +#endif === modified file 'lib/sha256.h' --- lib/sha256.h 2013-01-01 09:11:05 +0000 +++ lib/sha256.h 2013-12-08 08:05:36 +0000 @@ -21,10 +21,23 @@ # include # include +# if HAVE_OPENSSL_SHA256 +# include +# endif + # ifdef __cplusplus extern "C" { # endif +enum { SHA224_DIGEST_SIZE = 224 / 8 }; +enum { SHA256_DIGEST_SIZE = 256 / 8 }; + +# if HAVE_OPENSSL_SHA256 +# define GL_OPENSSL_NAME 224 +# include "gl_openssl.h" +# define GL_OPENSSL_NAME 256 +# include "gl_openssl.h" +# else /* Structure to save state of computation between the single steps. */ struct sha256_ctx { @@ -35,9 +48,6 @@ uint32_t buffer[32]; }; -enum { SHA224_DIGEST_SIZE = 224 / 8 }; -enum { SHA256_DIGEST_SIZE = 256 / 8 }; - /* Initialize structure containing state of computation. */ extern void sha256_init_ctx (struct sha256_ctx *ctx); extern void sha224_init_ctx (struct sha256_ctx *ctx); @@ -71,12 +81,6 @@ extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf); -/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The - resulting message digest number will be written into the 32 (28) bytes - beginning at RESBLOCK. */ -extern int sha256_stream (FILE *stream, void *resblock); -extern int sha224_stream (FILE *stream, void *resblock); - /* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -84,6 +88,14 @@ extern void *sha256_buffer (const char *buffer, size_t len, void *resblock); extern void *sha224_buffer (const char *buffer, size_t len, void *resblock); +# endif +/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The + resulting message digest number will be written into the 32 (28) bytes + beginning at RESBLOCK. */ +extern int sha256_stream (FILE *stream, void *resblock); +extern int sha224_stream (FILE *stream, void *resblock); + + # ifdef __cplusplus } # endif === modified file 'lib/sha512.c' --- lib/sha512.c 2013-01-02 16:37:04 +0000 +++ lib/sha512.c 2013-12-08 08:05:36 +0000 @@ -22,6 +22,9 @@ #include +#if HAVE_OPENSSL_SHA512 +# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE +#endif #include "sha512.h" #include @@ -52,6 +55,7 @@ # error "invalid BLOCKSIZE" #endif +#if ! HAVE_OPENSSL_SHA512 /* This array contains the bytes used to pad the buffer to the next 128-byte boundary. */ static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ }; @@ -171,6 +175,7 @@ sha512_conclude_ctx (ctx); return sha384_read_ctx (ctx, resbuf); } +#endif /* Compute SHA512 message digest for bytes read from STREAM. The resulting message digest number will be written into the 64 bytes @@ -316,6 +321,7 @@ return 0; } +#if ! HAVE_OPENSSL_SHA512 /* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -619,3 +625,4 @@ h = ctx->state[7] = u64plus (ctx->state[7], h); } } +#endif === modified file 'lib/sha512.h' --- lib/sha512.h 2013-01-01 09:11:05 +0000 +++ lib/sha512.h 2013-12-08 08:05:36 +0000 @@ -19,13 +19,25 @@ # define SHA512_H 1 # include - # include "u64.h" +# if HAVE_OPENSSL_SHA512 +# include +# endif + # ifdef __cplusplus extern "C" { # endif +enum { SHA384_DIGEST_SIZE = 384 / 8 }; +enum { SHA512_DIGEST_SIZE = 512 / 8 }; + +# if HAVE_OPENSSL_SHA512 +# define GL_OPENSSL_NAME 384 +# include "gl_openssl.h" +# define GL_OPENSSL_NAME 512 +# include "gl_openssl.h" +# else /* Structure to save state of computation between the single steps. */ struct sha512_ctx { @@ -36,9 +48,6 @@ u64 buffer[32]; }; -enum { SHA384_DIGEST_SIZE = 384 / 8 }; -enum { SHA512_DIGEST_SIZE = 512 / 8 }; - /* Initialize structure containing state of computation. */ extern void sha512_init_ctx (struct sha512_ctx *ctx); extern void sha384_init_ctx (struct sha512_ctx *ctx); @@ -75,12 +84,6 @@ extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf); -/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The - resulting message digest number will be written into the 64 (48) bytes - beginning at RESBLOCK. */ -extern int sha512_stream (FILE *stream, void *resblock); -extern int sha384_stream (FILE *stream, void *resblock); - /* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -88,6 +91,14 @@ extern void *sha512_buffer (const char *buffer, size_t len, void *resblock); extern void *sha384_buffer (const char *buffer, size_t len, void *resblock); +# endif +/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The + resulting message digest number will be written into the 64 (48) bytes + beginning at RESBLOCK. */ +extern int sha512_stream (FILE *stream, void *resblock); +extern int sha384_stream (FILE *stream, void *resblock); + + # ifdef __cplusplus } # endif === added file 'm4/absolute-header.m4' --- m4/absolute-header.m4 1970-01-01 00:00:00 +0000 +++ m4/absolute-header.m4 2013-12-08 08:05:36 +0000 @@ -0,0 +1,102 @@ +# absolute-header.m4 serial 16 +dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Derek Price. + +# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...) +# --------------------------------------- +# Find the absolute name of a header file, testing first if the header exists. +# If the header were sys/inttypes.h, this macro would define +# ABSOLUTE_SYS_INTTYPES_H to the '""' quoted absolute name of sys/inttypes.h +# in config.h +# (e.g. '#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"'). +# The three "///" are to pacify Sun C 5.8, which otherwise would say +# "warning: #include of /usr/include/... may be non-portable". +# Use '""', not '<>', so that the /// cannot be confused with a C99 comment. +# Note: This macro assumes that the header file is not empty after +# preprocessing, i.e. it does not only define preprocessor macros but also +# provides some type/enum definitions or function/variable declarations. +AC_DEFUN([gl_ABSOLUTE_HEADER], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PREPROC_REQUIRE()dnl +dnl FIXME: gl_absolute_header and ac_header_exists must be used unquoted +dnl until we can assume autoconf 2.64 or newer. +m4_foreach_w([gl_HEADER_NAME], [$1], + [AS_VAR_PUSHDEF([gl_absolute_header], + [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl + AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>], + m4_defn([gl_absolute_header]), + [AS_VAR_PUSHDEF([ac_header_exists], + [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl + AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl + if test AS_VAR_GET(ac_header_exists) = yes; then + gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME])) + fi + AS_VAR_POPDEF([ac_header_exists])dnl + ])dnl + AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])), + ["AS_VAR_GET(gl_absolute_header)"], + [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.]) + AS_VAR_POPDEF([gl_absolute_header])dnl +])dnl +])# gl_ABSOLUTE_HEADER + +# gl_ABSOLUTE_HEADER_ONE(HEADER) +# ------------------------------ +# Like gl_ABSOLUTE_HEADER, except that: +# - it assumes that the header exists, +# - it uses the current CPPFLAGS, +# - it does not cache the result, +# - it is silent. +AC_DEFUN([gl_ABSOLUTE_HEADER_ONE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])]) + dnl AIX "xlc -E" and "cc -E" omit #line directives for header files + dnl that contain only a #include of other header files and no + dnl non-comment tokens of their own. This leads to a failure to + dnl detect the absolute name of , , + dnl and others. The workaround is to force preservation of comments + dnl through option -C. This ensures all necessary #line directives + dnl are present. GCC supports option -C as well. + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac +changequote(,) + case "$host_os" in + mingw*) + dnl For the sake of native Windows compilers (excluding gcc), + dnl treat backslash as a directory separator, like /. + dnl Actually, these compilers use a double-backslash as + dnl directory separator, inside the + dnl # line "filename" + dnl directives. + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + dnl A sed expression that turns a string into a basic regular + dnl expression, for use within "/.../". + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo '$1' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' +changequote([,]) + dnl eval is necessary to expand gl_absname_cpp. + dnl Ultrix and Pyramid sh refuse to redirect output of eval, + dnl so use subshell. + AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]), +[`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + sed -n "$gl_absolute_header_sed"`]) +]) === added file 'm4/gl-openssl.m4' --- m4/gl-openssl.m4 1970-01-01 00:00:00 +0000 +++ m4/gl-openssl.m4 2013-12-08 08:05:36 +0000 @@ -0,0 +1,48 @@ +# gl-openssl.m4 serial 3 +dnl Copyright (C) 2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT], +[ + m4_define([gl_CRYPTO_CHECK_DEFAULT], [$1]) +]) +gl_SET_CRYPTO_CHECK_DEFAULT([no]) + +AC_DEFUN([gl_CRYPTO_CHECK], +[ + m4_divert_once([DEFAULTS], [with_openssl_default='gl_CRYPTO_CHECK_DEFAULT']) + + AC_ARG_WITH([openssl], + [AS_HELP_STRING([--with-openssl], + [use libcrypto hash routines. Valid ARGs are: + 'yes', 'no', 'auto' => use if available, + 'optional' => use if available and warn if not available; + default is ']gl_CRYPTO_CHECK_DEFAULT['])], + [], + [with_openssl=$with_openssl_default]) + + if test "x$1" = xMD5; then + ALG_header=md5.h + else + ALG_header=sha.h + fi + + LIB_CRYPTO= + AC_SUBST([LIB_CRYPTO]) + if test "x$with_openssl" != xno; then + AC_CHECK_LIB([crypto], [$1], + [AC_CHECK_HEADERS([openssl/$ALG_header], + [LIB_CRYPTO=-lcrypto + AC_DEFINE([HAVE_OPENSSL_$1], [1], + [Define to 1 if libcrypto is used for $1.])])]) + if test "x$LIB_CRYPTO" = x; then + if test "x$with_openssl" = xyes; then + AC_MSG_ERROR([openssl development library not found for $1]) + elif test "x$with_openssl" = xoptional; then + AC_MSG_WARN([openssl development library not found for $1]) + fi + fi + fi +]) === modified file 'm4/gnulib-comp.m4' --- m4/gnulib-comp.m4 2013-10-12 20:00:38 +0000 +++ m4/gnulib-comp.m4 2013-12-08 08:05:36 +0000 @@ -38,6 +38,7 @@ m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([gl_PROG_AR_RANLIB]) + # Code from module absolute-header: # Code from module alloca-opt: # Code from module allocator: # Code from module at-internal: @@ -847,6 +848,7 @@ lib/gettext.h lib/gettime.c lib/gettimeofday.c + lib/gl_openssl.h lib/group-member.c lib/intprops.h lib/inttypes.in.h @@ -921,6 +923,7 @@ lib/verify.h lib/xalloc-oversized.h m4/00gnulib.m4 + m4/absolute-header.m4 m4/acl.m4 m4/alloca.m4 m4/byteswap.m4 @@ -953,6 +956,7 @@ m4/getopt.m4 m4/gettime.m4 m4/gettimeofday.m4 + m4/gl-openssl.m4 m4/gnulib-common.m4 m4/group-member.m4 m4/include_next.m4 === modified file 'm4/include_next.m4' --- m4/include_next.m4 2013-01-01 09:11:05 +0000 +++ m4/include_next.m4 2013-12-08 08:05:36 +0000 @@ -192,56 +192,9 @@ if test AS_VAR_GET(gl_header_exists) = yes; then AS_VAR_POPDEF([gl_header_exists]) ]) - AC_LANG_CONFTEST( - [AC_LANG_SOURCE( - [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] - )]) - dnl AIX "xlc -E" and "cc -E" omit #line directives for header - dnl files that contain only a #include of other header files and - dnl no non-comment tokens of their own. This leads to a failure - dnl to detect the absolute name of , , - dnl and others. The workaround is to force preservation - dnl of comments through option -C. This ensures all necessary - dnl #line directives are present. GCC supports option -C as well. - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac -changequote(,) - case "$host_os" in - mingw*) - dnl For the sake of native Windows compilers (excluding gcc), - dnl treat backslash as a directory separator, like /. - dnl Actually, these compilers use a double-backslash as - dnl directory separator, inside the - dnl # line "filename" - dnl directives. - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - dnl A sed expression that turns a string into a basic regular - dnl expression, for use within "/.../". - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -changequote([,]) - gl_header_literal_regex=`echo ']m4_defn([gl_HEADER_NAME])[' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ -changequote(,)dnl - s|^/[^/]|//&| -changequote([,])dnl - p - q - }' - dnl eval is necessary to expand gl_absname_cpp. - dnl Ultrix and Pyramid sh refuse to redirect output of eval, - dnl so use subshell. - AS_VAR_SET(gl_next_header, - ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | - sed -n "$gl_absolute_header_sed"`'"']) + gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME) + AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME)) + AS_VAR_SET(gl_next_header, ['"'$gl_header'"']) m4_if([$2], [check], [else AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) === modified file 'm4/md5.m4' --- m4/md5.m4 2013-01-02 16:37:04 +0000 +++ m4/md5.m4 2013-12-08 08:05:36 +0000 @@ -1,4 +1,4 @@ -# md5.m4 serial 13 +# md5.m4 serial 14 dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,5 +8,7 @@ [ dnl Prerequisites of lib/md5.c. AC_REQUIRE([gl_BIGENDIAN]) - : + + dnl Determine HAVE_OPENSSL_MD5 and LIB_CRYPTO + gl_CRYPTO_CHECK([MD5]) ]) === modified file 'm4/sha1.m4' --- m4/sha1.m4 2013-01-02 16:37:04 +0000 +++ m4/sha1.m4 2013-12-08 08:05:36 +0000 @@ -1,4 +1,4 @@ -# sha1.m4 serial 11 +# sha1.m4 serial 12 dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,5 +8,7 @@ [ dnl Prerequisites of lib/sha1.c. AC_REQUIRE([gl_BIGENDIAN]) - : + + dnl Determine HAVE_OPENSSL_SHA1 and LIB_CRYPTO + gl_CRYPTO_CHECK([SHA1]) ]) === modified file 'm4/sha256.m4' --- m4/sha256.m4 2013-08-26 22:17:31 +0000 +++ m4/sha256.m4 2013-12-08 08:05:36 +0000 @@ -1,4 +1,4 @@ -# sha256.m4 serial 7 +# sha256.m4 serial 8 dnl Copyright (C) 2005, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,5 +8,7 @@ [ dnl Prerequisites of lib/sha256.c. AC_REQUIRE([gl_BIGENDIAN]) - : + + dnl Determine HAVE_OPENSSL_SHA256 and LIB_CRYPTO + gl_CRYPTO_CHECK([SHA256]) ]) === modified file 'm4/sha512.m4' --- m4/sha512.m4 2013-08-26 22:17:31 +0000 +++ m4/sha512.m4 2013-12-08 08:05:36 +0000 @@ -1,4 +1,4 @@ -# sha512.m4 serial 8 +# sha512.m4 serial 9 dnl Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,5 +8,7 @@ [ dnl Prerequisites of lib/sha512.c. AC_REQUIRE([gl_BIGENDIAN]) - : + + dnl Determine HAVE_OPENSSL_SHA512 and LIB_CRYPTO + gl_CRYPTO_CHECK([SHA512]) ]) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-08 05:59:27 +0000 +++ src/ChangeLog 2013-12-08 08:05:36 +0000 @@ -1,5 +1,9 @@ 2013-12-08 Paul Eggert + Use libcrypto's checksum implementations if available, for speed. + * Makefile.in (LIB_CRYPTO): New macro. + (LIBES): Use it. + * frame.h (SET_FRAME_VISIBLE): Now an inline function. The macro didn't conform to C99 due to type mismatch, which caused compilation failure with Sun C 5.12, === modified file 'src/Makefile.in' --- src/Makefile.in 2013-11-27 18:25:44 +0000 +++ src/Makefile.in 2013-12-08 08:05:36 +0000 @@ -139,6 +139,7 @@ LIB_ACL=@LIB_ACL@ LIB_CLOCK_GETTIME=@LIB_CLOCK_GETTIME@ +LIB_CRYPTO=@LIB_CRYPTO@ LIB_EACCESS=@LIB_EACCESS@ LIB_FDATASYNC=@LIB_FDATASYNC@ LIB_TIMER_TIME=@LIB_TIMER_TIME@ @@ -403,6 +404,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \ $(LIBX_OTHER) $(LIBSOUND) \ $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \ + $(LIB_CRYPTO) \ $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \ $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) \ $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ ------------------------------------------------------------ revno: 115419 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16066 committer: Stefan Monnier branch nick: trunk timestamp: Sun 2013-12-08 02:32:01 -0500 message: * lisp/rect.el (rectangle-mark-mode): Activate mark even if transient-mark-mode is off. (rectangle--highlight-for-redisplay): Fix boundary condition when point is > mark and at bolp. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-08 07:18:46 +0000 +++ lisp/ChangeLog 2013-12-08 07:32:01 +0000 @@ -7,6 +7,11 @@ 2013-12-08 Stefan Monnier + * rect.el (rectangle-mark-mode): Activate mark even if + transient-mark-mode is off (bug#16066). + (rectangle--highlight-for-redisplay): Fix boundary condition when point + is > mark and at bolp. + * emulation/cua-rect.el (cua--rectangle-region-extract): New function. (region-extract-function): Use it. (cua-mouse-save-then-kill-rectangle): Use cua-copy-region. === modified file 'lisp/rect.el' --- lisp/rect.el 2013-11-11 05:18:53 +0000 +++ lisp/rect.el 2013-12-08 07:32:01 +0000 @@ -443,7 +443,9 @@ Activates the region if needed. Only lasts until the region is deactivated." nil nil nil (when rectangle-mark-mode - (unless (region-active-p) (push-mark-command t)))) + (unless (region-active-p) + (push-mark) + (activate-mark)))) (defun rectangle--extract-region (orig &optional delete) (if (not rectangle-mark-mode) @@ -495,70 +497,72 @@ (leftcol (min ptcol markcol)) (rightcol (max ptcol markcol))) (goto-char start) - (while (< (point) end) - (let* ((mleft (move-to-column leftcol)) - (left (point)) - (mright (move-to-column rightcol)) - (right (point)) - (ol - (if (not old) - (let ((ol (make-overlay left right))) - (overlay-put ol 'window window) - (overlay-put ol 'face 'region) - ol) - (let ((ol (pop old))) - (move-overlay ol left right (current-buffer)) - ol)))) - ;; `move-to-column' may stop before the column (if bumping into - ;; EOL) or overshoot it a little, when column is in the middle - ;; of a char. - (cond - ((< mleft leftcol) ;`leftcol' is past EOL. - (overlay-put ol 'before-string - (spaces-string (- leftcol mleft))) - (setq mright (max mright leftcol))) - ((and (> mleft leftcol) ;`leftcol' is in the middle of a char. - (eq (char-before left) ?\t)) - (setq left (1- left)) - (move-overlay ol left right) - (goto-char left) - (overlay-put ol 'before-string - (spaces-string (- leftcol (current-column))))) - ((overlay-get ol 'before-string) - (overlay-put ol 'before-string nil))) - (cond - ((< mright rightcol) ;`rightcol' is past EOL. - (let ((str (make-string (- rightcol mright) ?\s))) - (put-text-property 0 (length str) 'face 'region str) - ;; If cursor happens to be here, draw it *before* rather than - ;; after this highlighted pseudo-text. - (put-text-property 0 1 'cursor t str) - (overlay-put ol 'after-string str))) - ((and (> mright rightcol) ;`rightcol' is in the middle of a char. - (eq (char-before right) ?\t)) - (setq right (1- right)) - (move-overlay ol left right) - (if (= rightcol leftcol) - (overlay-put ol 'after-string nil) - (goto-char right) - (let ((str (make-string - (- rightcol (max leftcol (current-column))) ?\s))) - (put-text-property 0 (length str) 'face 'region str) - (when (= left right) - ;; If cursor happens to be here, draw it *before* rather - ;; than after this highlighted pseudo-text. - (put-text-property 0 1 'cursor 1 str)) - (overlay-put ol 'after-string str)))) - ((overlay-get ol 'after-string) - (overlay-put ol 'after-string nil))) - (when (= leftcol rightcol) - ;; Make zero-width rectangles visible! - (overlay-put ol 'after-string - (concat (propertize " " - 'face '(region (:height 0.2))) - (overlay-get ol 'after-string)))) - (push ol nrol)) - (forward-line 1)) + (while + (let* ((mleft (move-to-column leftcol)) + (left (point)) + (mright (move-to-column rightcol)) + (right (point)) + (ol + (if (not old) + (let ((ol (make-overlay left right))) + (overlay-put ol 'window window) + (overlay-put ol 'face 'region) + ol) + (let ((ol (pop old))) + (move-overlay ol left right (current-buffer)) + ol)))) + ;; `move-to-column' may stop before the column (if bumping into + ;; EOL) or overshoot it a little, when column is in the middle + ;; of a char. + (cond + ((< mleft leftcol) ;`leftcol' is past EOL. + (overlay-put ol 'before-string + (spaces-string (- leftcol mleft))) + (setq mright (max mright leftcol))) + ((and (> mleft leftcol) ;`leftcol' is in the middle of a char. + (eq (char-before left) ?\t)) + (setq left (1- left)) + (move-overlay ol left right) + (goto-char left) + (overlay-put ol 'before-string + (spaces-string (- leftcol (current-column))))) + ((overlay-get ol 'before-string) + (overlay-put ol 'before-string nil))) + (cond + ((< mright rightcol) ;`rightcol' is past EOL. + (let ((str (make-string (- rightcol mright) ?\s))) + (put-text-property 0 (length str) 'face 'region str) + ;; If cursor happens to be here, draw it *before* rather than + ;; after this highlighted pseudo-text. + (put-text-property 0 1 'cursor t str) + (overlay-put ol 'after-string str))) + ((and (> mright rightcol) ;`rightcol's in the middle of a char. + (eq (char-before right) ?\t)) + (setq right (1- right)) + (move-overlay ol left right) + (if (= rightcol leftcol) + (overlay-put ol 'after-string nil) + (goto-char right) + (let ((str (make-string + (- rightcol (max leftcol (current-column))) + ?\s))) + (put-text-property 0 (length str) 'face 'region str) + (when (= left right) + ;; If cursor happens to be here, draw it *before* rather + ;; than after this highlighted pseudo-text. + (put-text-property 0 1 'cursor 1 str)) + (overlay-put ol 'after-string str)))) + ((overlay-get ol 'after-string) + (overlay-put ol 'after-string nil))) + (when (= leftcol rightcol) + ;; Make zero-width rectangles visible! + (overlay-put ol 'after-string + (concat (propertize " " + 'face '(region (:height 0.2))) + (overlay-get ol 'after-string)))) + (push ol nrol) + (and (zerop (forward-line 1)) + (<= (point) end)))) (mapc #'delete-overlay old) `(rectangle ,(buffer-chars-modified-tick) ,start ,end ,@nrol)))))) ------------------------------------------------------------ revno: 115418 fixes bug: http://debbugs.gnu.org/16077 committer: Leo Liu branch nick: trunk timestamp: Sun 2013-12-08 15:18:46 +0800 message: Re-implement popup menu for flymake * progmodes/flymake.el (flymake-popup-current-error-menu): Rename from flymake-display-err-menu-for-current-line. Reimplement. (flymake-posn-at-point-as-event, flymake-popup-menu) (flymake-make-emacs-menu): Remove. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-08 06:24:54 +0000 +++ lisp/ChangeLog 2013-12-08 07:18:46 +0000 @@ -1,3 +1,10 @@ +2013-12-08 Leo Liu + + * progmodes/flymake.el (flymake-popup-current-error-menu): Rename + from flymake-display-err-menu-for-current-line. Reimplement. + (flymake-posn-at-point-as-event, flymake-popup-menu) + (flymake-make-emacs-menu): Remove. (Bug#16077) + 2013-12-08 Stefan Monnier * emulation/cua-rect.el (cua--rectangle-region-extract): New function. === modified file 'lisp/progmodes/flymake.el' --- lisp/progmodes/flymake.el 2013-12-08 03:35:32 +0000 +++ lisp/progmodes/flymake.el 2013-12-08 07:18:46 +0000 @@ -192,55 +192,6 @@ (defvar-local flymake-new-err-info nil "Same as `flymake-err-info', effective when a syntax check is in progress.") -(defun flymake-posn-at-point-as-event (&optional position window dx dy) - "Return pixel position of top left corner of glyph at POSITION. - -The position is relative to top left corner of WINDOW, as a -mouse-1 click event (identical to the event that would be -triggered by clicking mouse button 1 at the top left corner of -the glyph). - -POSITION and WINDOW default to the position of point in the -selected window. - -DX and DY specify optional offsets from the top left of the glyph." - (let* ((window (or window (selected-window))) - (position (or position (window-point window))) - (dx (or dx 0)) - (dy (or dy 0)) - (pos (posn-at-point position window)) - (x-y (posn-x-y pos)) - (edges (window-inside-pixel-edges window)) - (win-x-y (window-pixel-edges window))) - ;; adjust for window edges - (setcar (nthcdr 2 pos) - (cons (+ (car x-y) (car edges) (- (car win-x-y)) dx) - (+ (cdr x-y) (cadr edges) (- (cadr win-x-y)) dy))) - (list 'mouse-1 pos))) - -;;; XXX: get rid of the following two functions - -(defun flymake-popup-menu (menu-data) - "Pop up the flymake menu at point, using the data MENU-DATA. -POS is a list of the form ((X Y) WINDOW), where X and Y are -pixels positions from the top left corner of WINDOW's frame. -MENU-DATA is a list of error and warning messages returned by -`flymake-make-err-menu-data'." - (x-popup-menu (flymake-posn-at-point-as-event) - (flymake-make-emacs-menu menu-data))) - -(defun flymake-make-emacs-menu (menu-data) - "Return a menu specifier using MENU-DATA. -MENU-DATA is a list of error and warning messages returned by -`flymake-make-err-menu-data'. -See `x-popup-menu' for the menu specifier format." - (let* ((menu-title (nth 0 menu-data)) - (menu-items (nth 1 menu-data)) - (menu-commands (mapcar (lambda (foo) - (cons (nth 0 foo) (nth 1 foo))) - menu-items))) - (list menu-title (cons "" menu-commands)))) - (defun flymake-log (level text &rest args) "Log a message at level LEVEL. If LEVEL is higher than `flymake-log-level', the message is @@ -1223,45 +1174,36 @@ (flymake-log 3 "starting syntax check as more than 1 second passed since last change") (flymake-start-syntax-check))))) -(defun flymake-display-err-menu-for-current-line () - "Display a menu with errors/warnings for current line if it has errors and/or warnings." - (interactive) - (let* ((line-no (line-number-at-pos)) - (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no))) - (menu-data (flymake-make-err-menu-data line-no line-err-info-list)) - (choice nil)) - (if menu-data - (progn - (setq choice (flymake-popup-menu menu-data)) - (flymake-log 3 "choice=%s" choice) - (when choice - (eval choice))) - (flymake-log 1 "no errors for line %d" line-no)))) +(define-obsolete-function-alias 'flymake-display-err-menu-for-current-line + 'flymake-popup-current-error-menu "24.4") -(defun flymake-make-err-menu-data (line-no line-err-info-list) - "Make a (menu-title (item-title item-action)*) list with errors/warnings from LINE-ERR-INFO-LIST." - (let* ((menu-items nil)) - (when line-err-info-list - (let* ((count (length line-err-info-list)) - (menu-item-text nil)) - (while (> count 0) - (setq menu-item-text (flymake-ler-text (nth (1- count) line-err-info-list))) - (let* ((file (flymake-ler-file (nth (1- count) line-err-info-list))) - (full-file (flymake-ler-full-file (nth (1- count) line-err-info-list))) - (line (flymake-ler-line (nth (1- count) line-err-info-list)))) - (if file - (setq menu-item-text (concat menu-item-text " - " file "(" (format "%d" line) ")"))) - (setq menu-items (cons (list menu-item-text - (if file (list 'flymake-goto-file-and-line full-file line) nil)) - menu-items))) - (setq count (1- count))) - (flymake-log 3 "created menu-items with %d item(s)" (length menu-items)))) - (if menu-items - (let* ((menu-title (format "Line %d: %d error(s), %d warning(s)" line-no - (flymake-get-line-err-count line-err-info-list "e") - (flymake-get-line-err-count line-err-info-list "w")))) - (list menu-title menu-items)) - nil))) +(defun flymake-popup-current-error-menu (&optional event) + "Pop up a menu with errors/warnings for current line." + (interactive (list last-nonmenu-event)) + (let* ((line-no (line-number-at-pos)) + (errors (or (car (flymake-find-err-info flymake-err-info line-no)) + (user-error "No errors for current line"))) + (menu (mapcar (lambda (x) + (if (flymake-ler-file x) + (cons (format "%s - %s(%d)" + (flymake-ler-text x) + (flymake-ler-file x) + (flymake-ler-line x)) + x) + (list (flymake-ler-text x)))) + errors)) + (event (if (mouse-event-p event) + event + (list 'mouse-1 (posn-at-point)))) + (title (format "Line %d: %d error(s), %d warning(s)" + line-no + (flymake-get-line-err-count errors "e") + (flymake-get-line-err-count errors "w"))) + (choice (x-popup-menu event (list title (cons "" menu))))) + (flymake-log 3 "choice=%s" choice) + (when choice + (flymake-goto-file-and-line (flymake-ler-full-file choice) + (flymake-ler-line choice))))) (defun flymake-goto-file-and-line (file line) "Try to get buffer for FILE and goto line LINE in it." ------------------------------------------------------------ revno: 115417 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16085 committer: Stefan Monnier branch nick: trunk timestamp: Sun 2013-12-08 01:24:54 -0500 message: Use delete-selection-mode in cua-mode. * lisp/emulation/cua-base.el (cua--prefix-copy-handler) (cua--prefix-cut-handler): Rely on region-extract-function rather than checking cua--rectangle. (cua-delete-region): Use region-extract-function. (cua-replace-region): Delete function. (cua-copy-region, cua-cut-region): Obey region-extract-function. (cua--pre-command-handler-1): Don't do the delete-selection thing. (cua--self-insert-char-p): Ignore `self-insert-iso'. (cua--init-keymaps): Don't remap delete-selection commands. (cua-mode): Use delete-selection-mode instead of rolling our own. * lisp/emulation/cua-rect.el (cua--rectangle-region-extract): New function. (region-extract-function): Use it. (cua-mouse-save-then-kill-rectangle): Use cua-copy-region. (cua-copy-rectangle, cua-cut-rectangle, cua-delete-rectangle): Delete functions. (cua--init-rectangles): Don't re-remap copy-region-as-kill, kill-ring-save, kill-region, delete-char, delete-forward-char. Ignore self-insert-iso. * lisp/menu-bar.el (clipboard-kill-ring-save, clipboard-kill-region): Obey region-extract-function. * lisp/emulation/cua-gmrk.el (cua--init-global-mark): Ignore `self-insert-iso'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-08 04:20:50 +0000 +++ lisp/ChangeLog 2013-12-08 06:24:54 +0000 @@ -1,5 +1,32 @@ 2013-12-08 Stefan Monnier + * emulation/cua-rect.el (cua--rectangle-region-extract): New function. + (region-extract-function): Use it. + (cua-mouse-save-then-kill-rectangle): Use cua-copy-region. + (cua-copy-rectangle, cua-cut-rectangle, cua-delete-rectangle): + Delete functions. + (cua--init-rectangles): Don't re-remap copy-region-as-kill, + kill-ring-save, kill-region, delete-char, delete-forward-char. + Ignore self-insert-iso. + + * emulation/cua-gmrk.el (cua--init-global-mark): + Ignore `self-insert-iso'. + + * emulation/cua-base.el (cua--prefix-copy-handler) + (cua--prefix-cut-handler): Rely on region-extract-function rather than + checking cua--rectangle. + (cua-delete-region): Use region-extract-function. + (cua-replace-region): Delete function. + (cua-copy-region, cua-cut-region): Obey region-extract-function. + (cua--pre-command-handler-1): Don't do the delete-selection thing. + (cua--self-insert-char-p): Ignore `self-insert-iso'. + (cua--init-keymaps): Don't remap delete-selection commands. + (cua-mode): Use delete-selection-mode instead of rolling our own + (bug#16085). + + * menu-bar.el (clipboard-kill-ring-save, clipboard-kill-region): + Obey region-extract-function. + Make registers and delete-selection-mode work on rectangles. * register.el (describe-register-1): Don't modify the register's value. (copy-to-register): Obey region-extract-function. === modified file 'lisp/emulation/cua-base.el' --- lisp/emulation/cua-base.el 2013-08-05 14:26:57 +0000 +++ lisp/emulation/cua-base.el 2013-12-08 06:24:54 +0000 @@ -96,10 +96,6 @@ ;; This is done by highlighting the first occurrence of "redo" ;; and type "repeat" M-v M-v. -;; Note: Since CUA-mode duplicates the functionality of the -;; delete-selection-mode, that mode is automatically disabled when -;; CUA-mode is enabled. - ;; CUA mode indications ;; -------------------- @@ -601,8 +597,6 @@ cua--last-killed-rectangle nil)) ;; All behind cua--rectangle tests. -(declare-function cua-copy-rectangle "cua-rect" (arg)) -(declare-function cua-cut-rectangle "cua-rect" (arg)) (declare-function cua--rectangle-left "cua-rect" (&optional val)) (declare-function cua--delete-rectangle "cua-rect" ()) (declare-function cua--insert-rectangle "cua-rect" @@ -733,9 +727,7 @@ (defun cua--prefix-copy-handler (arg) "Copy region/rectangle, then replay last key." (interactive "P") - (if cua--rectangle - (cua-copy-rectangle arg) - (cua-copy-region arg)) + (cua-copy-region arg) (let ((keys (this-single-command-keys))) (setq unread-command-events (cons (aref keys (1- (length keys))) unread-command-events)))) @@ -743,9 +735,7 @@ (defun cua--prefix-cut-handler (arg) "Cut region/rectangle, then replay last key." (interactive "P") - (if cua--rectangle - (cua-cut-rectangle arg) - (cua-cut-region arg)) + (cua-cut-region arg) (let ((keys (this-single-command-keys))) (setq unread-command-events (cons (aref keys (1- (length keys))) unread-command-events)))) @@ -815,10 +805,10 @@ (let ((start (mark)) (end (point))) (or (<= start end) (setq start (prog1 end (setq end start)))) - (setq cua--last-deleted-region-text (filter-buffer-substring start end)) + (setq cua--last-deleted-region-text + (funcall region-extract-function t)) (if cua-delete-copy-to-register-0 (set-register ?0 cua--last-deleted-region-text)) - (delete-region start end) (setq cua--last-deleted-region-pos (cons (current-buffer) (and (consp buffer-undo-list) @@ -826,17 +816,6 @@ (cua--deactivate) (/= start end))) -(defun cua-replace-region () - "Replace the active region with the character you type." - (interactive) - (let ((not-empty (and cua-delete-selection (cua-delete-region)))) - (unless (eq this-original-command this-command) - (let ((overwrite-mode - (and overwrite-mode - not-empty - (not (eq this-original-command 'self-insert-command))))) - (cua--fallback))))) - (defun cua-copy-region (arg) "Copy the region to the kill ring. With numeric prefix arg, copy to register 0-9 instead." @@ -848,11 +827,11 @@ (setq start (prog1 end (setq end start)))) (cond (cua--register - (copy-to-register cua--register start end nil)) + (copy-to-register cua--register start end nil 'region)) ((eq this-original-command 'clipboard-kill-ring-save) - (clipboard-kill-ring-save start end)) + (clipboard-kill-ring-save start end 'region)) (t - (copy-region-as-kill start end))) + (copy-region-as-kill start end 'region))) (if cua-keep-region-after-copy (cua--keep-active) (cua--deactivate)))) @@ -870,11 +849,11 @@ (setq start (prog1 end (setq end start)))) (cond (cua--register - (copy-to-register cua--register start end t)) + (copy-to-register cua--register start end t 'region)) ((eq this-original-command 'clipboard-kill-region) - (clipboard-kill-region start end)) + (clipboard-kill-region start end 'region)) (t - (kill-region start end)))) + (kill-region start end 'region)))) (cua--deactivate))) ;;; Generic commands for regions, rectangles, and global marks @@ -1135,9 +1114,9 @@ (if cua-enable-region-auto-help (cua-help-for-region t))))) -;;; Scrolling commands which does not signal errors at top/bottom -;;; of buffer at first key-press (instead moves to top/bottom -;;; of buffer). +;; Scrolling commands which do not signal errors at top/bottom +;; of buffer at first key-press (instead moves to top/bottom +;; of buffer). (defun cua-scroll-up (&optional arg) "Scroll text of current window upward ARG lines; or near full screen if no ARG. @@ -1221,30 +1200,8 @@ ((not (symbolp this-command)) nil) - ;; Handle delete-selection property on non-movement commands ((not (eq (get this-command 'CUA) 'move)) - (when (and mark-active (not deactivate-mark)) - (let* ((ds (or (get this-command 'delete-selection) - (get this-command 'pending-delete))) - (nc (cond - ((not ds) nil) - ((eq ds 'yank) - 'cua-paste) - ((eq ds 'kill) - (if cua--rectangle - 'cua-copy-rectangle - 'cua-copy-region)) - ((eq ds 'supersede) - (if cua--rectangle - 'cua-delete-rectangle - 'cua-delete-region)) - (t - (if cua--rectangle - 'cua-delete-rectangle ;; replace? - 'cua-replace-region))))) - (if nc - (setq this-original-command this-command - this-command nc))))) + nil) ;; Handle shifted cursor keys and other movement commands. ;; If region is not active, region is activated if key is shifted. @@ -1329,7 +1286,7 @@ ;; Return DEF if current key sequence is self-inserting in ;; global-map. (if (memq (global-key-binding (this-single-command-keys)) - '(self-insert-command self-insert-iso)) + '(self-insert-command)) def nil)) (defvar cua-global-keymap (make-sparse-keymap) @@ -1457,13 +1414,6 @@ (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix) (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix) - ;; replace current region - (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) - (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) - (define-key cua--region-keymap [remap insert-register] 'cua-replace-region) - (define-key cua--region-keymap [remap newline-and-indent] 'cua-replace-region) - (define-key cua--region-keymap [remap newline] 'cua-replace-region) - (define-key cua--region-keymap [remap open-line] 'cua-replace-region) ;; delete current region (define-key cua--region-keymap [remap delete-backward-char] 'cua-delete-region) (define-key cua--region-keymap [remap backward-delete-char] 'cua-delete-region) @@ -1589,8 +1539,10 @@ (and (boundp 'delete-selection-mode) delete-selection-mode) (and (boundp 'pc-selection-mode) pc-selection-mode) shift-select-mode)) - (if (and (boundp 'delete-selection-mode) delete-selection-mode) - (delete-selection-mode -1)) + (if cua-delete-selection + (delete-selection-mode 1) + (if (and (boundp 'delete-selection-mode) delete-selection-mode) + (delete-selection-mode -1))) (if (and (boundp 'pc-selection-mode) pc-selection-mode) (pc-selection-mode -1)) (cua--deactivate) @@ -1602,7 +1554,9 @@ (cua--saved-state (setq transient-mark-mode (car cua--saved-state)) (if (nth 1 cua--saved-state) - (delete-selection-mode 1)) + (delete-selection-mode 1) + (if (and (boundp 'delete-selection-mode) delete-selection-mode) + (delete-selection-mode -1))) (if (nth 2 cua--saved-state) (pc-selection-mode 1)) (setq shift-select-mode (nth 3 cua--saved-state)) === modified file 'lisp/emulation/cua-gmrk.el' --- lisp/emulation/cua-gmrk.el 2013-05-29 02:48:16 +0000 +++ lisp/emulation/cua-gmrk.el 2013-12-08 06:24:54 +0000 @@ -362,7 +362,6 @@ (define-key cua--global-mark-keymap [remap backward-delete-char] 'cua-delete-backward-char-at-global-mark) (define-key cua--global-mark-keymap [remap backward-delete-char-untabify] 'cua-delete-backward-char-at-global-mark) (define-key cua--global-mark-keymap [remap self-insert-command] 'cua-insert-char-at-global-mark) - (define-key cua--global-mark-keymap [remap self-insert-iso] 'cua-insert-char-at-global-mark) ;; Catch self-inserting characters which are "stolen" by other modes (define-key cua--global-mark-keymap [t] === modified file 'lisp/emulation/cua-rect.el' --- lisp/emulation/cua-rect.el 2013-05-29 02:48:16 +0000 +++ lisp/emulation/cua-rect.el 2013-12-08 06:24:54 +0000 @@ -461,7 +461,7 @@ (cua--deactivate)) (cua-mouse-resize-rectangle event) (let ((cua-keep-region-after-copy t)) - (cua-copy-rectangle arg) + (cua-copy-region arg) (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle))))) (defun cua--mouse-ignore (_event) @@ -945,32 +945,6 @@ (interactive) (cua--rectangle-move 'right)) -(defun cua-copy-rectangle (arg) - (interactive "P") - (setq arg (cua--prefix-arg arg)) - (cua--copy-rectangle-as-kill arg) - (if cua-keep-region-after-copy - (cua--keep-active) - (cua--deactivate))) - -(defun cua-cut-rectangle (arg) - (interactive "P") - (if buffer-read-only - (cua-copy-rectangle arg) - (setq arg (cua--prefix-arg arg)) - (goto-char (min (mark) (point))) - (cua--copy-rectangle-as-kill arg) - (cua--delete-rectangle)) - (cua--deactivate)) - -(defun cua-delete-rectangle () - (interactive) - (goto-char (min (point) (mark))) - (if cua-delete-copy-to-register-0 - (set-register ?0 (cua--extract-rectangle))) - (cua--delete-rectangle) - (cua--deactivate)) - (defun cua-rotate-rectangle () (interactive) (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1)) @@ -1402,6 +1376,30 @@ (goto-char cua--rect-undo-set-point) (setq cua--rect-undo-set-point nil))) +(add-function :around region-extract-function + #'cua--rectangle-region-extract) + +(defun cua--rectangle-region-extract (orig &optional delete) + (cond + ((not cua--rectangle) (funcall orig delete)) + ((eq delete 'delete-only) (cua--delete-rectangle)) + (t + (let* ((strs (cua--extract-rectangle)) + (str (mapconcat #'identity strs "\n"))) + (if delete (cua--delete-rectangle)) + (setq killed-rectangle strs) + (setq cua--last-killed-rectangle + (cons (and kill-ring (car kill-ring)) killed-rectangle)) + (when (eq last-command 'kill-region) + ;; Try to prevent kill-region from appending this to some + ;; earlier element. + (setq last-command 'kill-region-dont-append)) + (when strs + (put-text-property 0 (length str) 'yank-handler + `(rectangle--insert-for-yank ,strs t) + str) + str))))) + ;;; Initialization (defun cua--rect-M/H-key (key cmd) @@ -1414,11 +1412,6 @@ (cua--rect-M/H-key ?\s 'cua-clear-rectangle-mark) (cua--M/H-key cua--region-keymap ?\s 'cua-toggle-rectangle-mark)) - (define-key cua--rectangle-keymap [remap copy-region-as-kill] 'cua-copy-rectangle) - (define-key cua--rectangle-keymap [remap kill-ring-save] 'cua-copy-rectangle) - (define-key cua--rectangle-keymap [remap kill-region] 'cua-cut-rectangle) - (define-key cua--rectangle-keymap [remap delete-char] 'cua-delete-rectangle) - (define-key cua--rectangle-keymap [remap delete-forward-char] 'cua-delete-rectangle) (define-key cua--rectangle-keymap [remap set-mark-command] 'cua-toggle-rectangle-mark) (define-key cua--rectangle-keymap [remap forward-char] 'cua-resize-rectangle-right) @@ -1440,7 +1433,6 @@ (define-key cua--rectangle-keymap [remap backward-delete-char] 'cua-delete-char-rectangle) (define-key cua--rectangle-keymap [remap backward-delete-char-untabify] 'cua-delete-char-rectangle) (define-key cua--rectangle-keymap [remap self-insert-command] 'cua-insert-char-rectangle) - (define-key cua--rectangle-keymap [remap self-insert-iso] 'cua-insert-char-rectangle) ;; Catch self-inserting characters which are "stolen" by other modes (define-key cua--rectangle-keymap [t] === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2013-11-06 17:18:02 +0000 +++ lisp/menu-bar.el 2013-12-08 06:24:54 +0000 @@ -545,17 +545,17 @@ (let ((x-select-enable-clipboard t)) (yank))) -(defun clipboard-kill-ring-save (beg end) +(defun clipboard-kill-ring-save (beg end &optional region) "Copy region to kill ring, and save in the X clipboard." - (interactive "r") + (interactive "r\np") (let ((x-select-enable-clipboard t)) - (kill-ring-save beg end))) + (kill-ring-save beg end region))) -(defun clipboard-kill-region (beg end) +(defun clipboard-kill-region (beg end &optional region) "Kill the region, and save it in the X clipboard." - (interactive "r") + (interactive "r\np") (let ((x-select-enable-clipboard t)) - (kill-region beg end))) + (kill-region beg end region))) (defun menu-bar-enable-clipboard () "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard. ------------------------------------------------------------ revno: 115416 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-12-07 21:59:27 -0800 message: * frame.h (SET_FRAME_VISIBLE): Now an inline function. The macro didn't conform to C99 due to type mismatch, which caused compilation failure with Sun C 5.12, and it was confusing anyway. Include window.h to declare redisplay_other_windows. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-08 03:07:11 +0000 +++ src/ChangeLog 2013-12-08 05:59:27 +0000 @@ -1,3 +1,11 @@ +2013-12-08 Paul Eggert + + * frame.h (SET_FRAME_VISIBLE): Now an inline function. + The macro didn't conform to C99 due to type mismatch, + which caused compilation failure with Sun C 5.12, + and it was confusing anyway. Include window.h to declare + redisplay_other_windows. + 2013-12-08 Stefan Monnier * window.c (set_window_buffer): Update mode line (bug#16084). === modified file 'src/frame.h' --- src/frame.h 2013-12-01 22:33:13 +0000 +++ src/frame.h 2013-12-08 05:59:27 +0000 @@ -25,6 +25,7 @@ #include "dispextern.h" #include "termhooks.h" +#include "window.h" INLINE_HEADER_BEGIN @@ -956,10 +957,14 @@ if some changes were applied to it while it wasn't visible (and hence wasn't redisplayed). */ -#define SET_FRAME_VISIBLE(f, v) \ - (((f)->visible == 0 || ((f)->visible == 2)) && ((v) == 1) \ - ? redisplay_other_windows () : 0, \ - (f)->visible = (eassert (0 <= (v) && (v) <= 2), (v))) +INLINE void +SET_FRAME_VISIBLE (struct frame *f, int v) +{ + eassert (0 <= v && v <= 2); + if (v == 1 && f->visible != 1) + redisplay_other_windows (); + f->visible = v; +} /* Set iconify of frame F. */ ------------------------------------------------------------ revno: 115415 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2013-12-07 23:20:50 -0500 message: Make registers and delete-selection-mode work on rectangles. * lisp/register.el (describe-register-1): Don't modify the register's value. (copy-to-register): Obey region-extract-function. * lisp/delsel.el (delete-active-region): Obey region-extract-function. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-08 03:35:32 +0000 +++ lisp/ChangeLog 2013-12-08 04:20:50 +0000 @@ -1,3 +1,10 @@ +2013-12-08 Stefan Monnier + + Make registers and delete-selection-mode work on rectangles. + * register.el (describe-register-1): Don't modify the register's value. + (copy-to-register): Obey region-extract-function. + * delsel.el (delete-active-region): Obey region-extract-function. + 2013-12-08 Leo Liu * progmodes/flymake.el (flymake, flymake-error-bitmap) @@ -29,8 +36,7 @@ 2013-12-07 Lars Magne Ingebrigtsen - * net/shr.el (shr-tag-img): Don't bug out on - data. + * net/shr.el (shr-tag-img): Don't bug out on data. 2013-12-06 Michael Albinus @@ -42,8 +48,8 @@ 2013-12-06 Dmitry Gutov - * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Touch - up the last change. + * progmodes/ruby-mode.el (ruby-syntax-propertize-function): + Touch up the last change. 2013-12-06 Leo Liu @@ -73,8 +79,8 @@ 2013-12-06 Dmitry Gutov - * progmodes/octave.el (inferior-octave-completion-table): Turn - back into function, use `completion-table-with-cache' + * progmodes/octave.el (inferior-octave-completion-table): + Turn back into function, use `completion-table-with-cache' (Bug#11906). Update all references. * minibuffer.el (completion-table-with-cache): New function. === modified file 'lisp/delsel.el' --- lisp/delsel.el 2013-10-29 16:11:50 +0000 +++ lisp/delsel.el 2013-12-08 04:20:50 +0000 @@ -78,8 +78,8 @@ "Delete the active region. If KILLP in not-nil, the active region is killed instead of deleted." (if killp - (kill-region (point) (mark)) - (delete-region (point) (mark))) + (kill-region (point) (mark) t) + (funcall region-extract-function 'delete-only)) t) (defun delete-selection-helper (type) @@ -197,9 +197,9 @@ (define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit) (define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit) (define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit) - (dolist (sym '(self-insert-command self-insert-iso yank clipboard-yank - insert-register delete-backward-char backward-delete-char-untabify - delete-char newline-and-indent newline open-line)) + (dolist (sym '(self-insert-command yank clipboard-yank + insert-register + newline-and-indent newline open-line)) (put sym 'delete-selection nil)) ;; continue standard unloading nil) === modified file 'lisp/register.el' --- lisp/register.el 2013-10-08 06:02:20 +0000 +++ lisp/register.el 2013-12-08 04:20:50 +0000 @@ -364,6 +364,7 @@ (princ (car val)))) ((stringp val) + (setq val (copy-sequence val)) (if (eq yank-excluded-properties t) (set-text-properties 0 (length val) nil val) (remove-list-of-text-properties 0 (length val) @@ -417,19 +418,24 @@ (error "Register does not contain text")))) (if (not arg) (exchange-point-and-mark))) -(defun copy-to-register (register start end &optional delete-flag) +(defun copy-to-register (register start end &optional delete-flag region) "Copy region into register REGISTER. With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. -START and END are buffer positions indicating what to copy." +START and END are buffer positions indicating what to copy. +The optional argument REGION if non-nil, indicates that we're not just copying +some text between START and END, but we're copying the region." (interactive (list (register-read-with-preview "Copy to register: ") (region-beginning) (region-end) - current-prefix-arg)) - (set-register register (filter-buffer-substring start end)) + current-prefix-arg + t)) + (set-register register (if region + (funcall region-extract-function delete-flag) + (prog1 (filter-buffer-substring start end) + (if delete-flag (delete-region start end))))) (setq deactivate-mark t) - (cond (delete-flag - (delete-region start end)) + (cond (delete-flag) ((called-interactively-p 'interactive) (indicate-copied-region)))) ------------------------------------------------------------ revno: 115414 fixes bug: http://debbugs.gnu.org/16077 committer: Leo Liu branch nick: trunk timestamp: Sun 2013-12-08 11:35:32 +0800 message: Clean up flymake.el * lisp/progmodes/flymake.el (flymake, flymake-error-bitmap) (flymake-warning-bitmap, flymake-fringe-indicator-position) (flymake-compilation-prevents-syntax-check) (flymake-start-syntax-check-on-newline) (flymake-no-changes-timeout, flymake-gui-warnings-enabled) (flymake-start-syntax-check-on-find-file, flymake-log-level) (flymake-xml-program, flymake-master-file-dirs) (flymake-master-file-count-limit) (flymake-allowed-file-name-masks): Relocate. (flymake-makehash, flymake-float-time) (flymake-replace-regexp-in-string, flymake-split-string) (flymake-get-temp-dir): Remove. (flymake-popup-menu, flymake-nop, flymake-make-xemacs-menu) (flymake-current-row, flymake-selected-frame) (flymake-get-point-pixel-pos): Remove xemacs compatibity and related functions. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-07 18:46:03 +0000 +++ lisp/ChangeLog 2013-12-08 03:35:32 +0000 @@ -1,3 +1,22 @@ +2013-12-08 Leo Liu + + * progmodes/flymake.el (flymake, flymake-error-bitmap) + (flymake-warning-bitmap, flymake-fringe-indicator-position) + (flymake-compilation-prevents-syntax-check) + (flymake-start-syntax-check-on-newline) + (flymake-no-changes-timeout, flymake-gui-warnings-enabled) + (flymake-start-syntax-check-on-find-file, flymake-log-level) + (flymake-xml-program, flymake-master-file-dirs) + (flymake-master-file-count-limit) + (flymake-allowed-file-name-masks): Relocate. + (flymake-makehash, flymake-float-time) + (flymake-replace-regexp-in-string, flymake-split-string) + (flymake-get-temp-dir): Remove. + (flymake-popup-menu, flymake-nop, flymake-make-xemacs-menu) + (flymake-current-row, flymake-selected-frame) + (flymake-get-point-pixel-pos): Remove xemacs compatibity and + related functions. (Bug#16077) + 2013-12-07 Bozhidar Batsov * emacs-lisp/helpers.el (string-blank-p): Use `string-match-p'. === modified file 'lisp/progmodes/flymake.el' --- lisp/progmodes/flymake.el 2013-08-25 22:30:56 +0000 +++ lisp/progmodes/flymake.el 2013-12-08 03:35:32 +0000 @@ -1,9 +1,9 @@ -;;; flymake.el --- a universal on-the-fly syntax checker +;;; flymake.el --- a universal on-the-fly syntax checker -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2013 Free Software Foundation, Inc. ;; Author: Pavel Kobyakov -;; Maintainer: Pavel Kobyakov +;; Maintainer: Leo Liu ;; Version: 0.3 ;; Keywords: c languages tools @@ -24,9 +24,9 @@ ;;; Commentary: ;; -;; Flymake is a minor Emacs mode performing on-the-fly syntax -;; checks using the external syntax check tool (for C/C++ this -;; is usually the compiler) +;; Flymake is a minor Emacs mode performing on-the-fly syntax checks +;; using the external syntax check tool (for C/C++ this is usually the +;; compiler). ;;; Bugs/todo: @@ -36,77 +36,161 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) -(if (featurep 'xemacs) (require 'overlay)) - -(defvar flymake-is-running nil + +(defgroup flymake nil + "Universal on-the-fly syntax checker." + :version "23.1" + :group 'tools) + +(defcustom flymake-error-bitmap '(exclamation-mark error) + "Bitmap (a symbol) used in the fringe for indicating errors. +The value may also be a list of two elements where the second +element specifies the face for the bitmap. For possible bitmap +symbols, see `fringe-bitmaps'. See also `flymake-warning-bitmap'. + +The option `flymake-fringe-indicator-position' controls how and where +this is used." + :group 'flymake + :version "24.3" + :type '(choice (symbol :tag "Bitmap") + (list :tag "Bitmap and face" + (symbol :tag "Bitmap") + (face :tag "Face")))) + +(defcustom flymake-warning-bitmap 'question-mark + "Bitmap (a symbol) used in the fringe for indicating warnings. +The value may also be a list of two elements where the second +element specifies the face for the bitmap. For possible bitmap +symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'. + +The option `flymake-fringe-indicator-position' controls how and where +this is used." + :group 'flymake + :version "24.3" + :type '(choice (symbol :tag "Bitmap") + (list :tag "Bitmap and face" + (symbol :tag "Bitmap") + (face :tag "Face")))) + +(defcustom flymake-fringe-indicator-position 'left-fringe + "The position to put flymake fringe indicator. +The value can be nil (do not use indicators), `left-fringe' or `right-fringe'. +See `flymake-error-bitmap' and `flymake-warning-bitmap'." + :group 'flymake + :version "24.3" + :type '(choice (const left-fringe) + (const right-fringe) + (const :tag "No fringe indicators" nil))) + +(defcustom flymake-compilation-prevents-syntax-check t + "If non-nil, don't start syntax check if compilation is running." + :group 'flymake + :type 'boolean) + +(defcustom flymake-start-syntax-check-on-newline t + "Start syntax check if newline char was added/removed from the buffer." + :group 'flymake + :type 'boolean) + +(defcustom flymake-no-changes-timeout 0.5 + "Time to wait after last change before starting compilation." + :group 'flymake + :type 'number) + +(defcustom flymake-gui-warnings-enabled t + "Enables/disables GUI warnings." + :group 'flymake + :type 'boolean) + +(defcustom flymake-start-syntax-check-on-find-file t + "Start syntax check on find file." + :group 'flymake + :type 'boolean) + +(defcustom flymake-log-level -1 + "Logging level, only messages with level lower or equal will be logged. +-1 = NONE, 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG" + :group 'flymake + :type 'integer) + +(defcustom flymake-xml-program + (if (executable-find "xmlstarlet") "xmlstarlet" "xml") + "Program to use for XML validation." + :type 'file + :group 'flymake + :version "24.4") + +(defcustom flymake-master-file-dirs '("." "./src" "./UnitTest") + "Dirs where to look for master files." + :group 'flymake + :type '(repeat (string))) + +(defcustom flymake-master-file-count-limit 32 + "Max number of master files to check." + :group 'flymake + :type 'integer) + +(defcustom flymake-allowed-file-name-masks + '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-simple-make-init) + ("\\.xml\\'" flymake-xml-init) + ("\\.html?\\'" flymake-xml-init) + ("\\.cs\\'" flymake-simple-make-init) + ("\\.p[ml]\\'" flymake-perl-init) + ("\\.php[345]?\\'" flymake-php-init) + ("\\.h\\'" flymake-master-make-header-init flymake-master-cleanup) + ("\\.java\\'" flymake-simple-make-java-init flymake-simple-java-cleanup) + ("[0-9]+\\.tex\\'" flymake-master-tex-init flymake-master-cleanup) + ("\\.tex\\'" flymake-simple-tex-init) + ("\\.idl\\'" flymake-simple-make-init) + ;; ("\\.cpp\\'" 1) + ;; ("\\.java\\'" 3) + ;; ("\\.h\\'" 2 ("\\.cpp\\'" "\\.c\\'") + ;; ("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2)) + ;; ("\\.idl\\'" 1) + ;; ("\\.odl\\'" 1) + ;; ("[0-9]+\\.tex\\'" 2 ("\\.tex\\'") + ;; ("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2 )) + ;; ("\\.tex\\'" 1) + ) + "Files syntax checking is allowed for. +This is an alist with elements of the form: + REGEXP INIT [CLEANUP [NAME]] +REGEXP is a regular expression that matches a file name. +INIT is the init function to use. +CLEANUP is the cleanup function to use, default `flymake-simple-cleanup'. +NAME is the file name function to use, default `flymake-get-real-file-name'." + :group 'flymake + :type '(alist :key-type (regexp :tag "File regexp") + :value-type + (list :tag "Handler functions" + (function :tag "Init function") + (choice :tag "Cleanup function" + (const :tag "flymake-simple-cleanup" nil) + function) + (choice :tag "Name function" + (const :tag "flymake-get-real-file-name" nil) + function)))) + +(defvar-local flymake-is-running nil "If t, flymake syntax check process is running for the current buffer.") -(make-variable-buffer-local 'flymake-is-running) -(defvar flymake-timer nil +(defvar-local flymake-timer nil "Timer for starting syntax check.") -(make-variable-buffer-local 'flymake-timer) -(defvar flymake-last-change-time nil +(defvar-local flymake-last-change-time nil "Time of last buffer change.") -(make-variable-buffer-local 'flymake-last-change-time) -(defvar flymake-check-start-time nil +(defvar-local flymake-check-start-time nil "Time at which syntax check was started.") -(make-variable-buffer-local 'flymake-check-start-time) -(defvar flymake-check-was-interrupted nil +(defvar-local flymake-check-was-interrupted nil "Non-nil if syntax check was killed by `flymake-compile'.") -(make-variable-buffer-local 'flymake-check-was-interrupted) -(defvar flymake-err-info nil +(defvar-local flymake-err-info nil "Sorted list of line numbers and lists of err info in the form (file, err-text).") -(make-variable-buffer-local 'flymake-err-info) -(defvar flymake-new-err-info nil +(defvar-local flymake-new-err-info nil "Same as `flymake-err-info', effective when a syntax check is in progress.") -(make-variable-buffer-local 'flymake-new-err-info) - -;;;; [[ cross-emacs compatibility routines -(defsubst flymake-makehash (&optional test) - "Create and return a new hash table using TEST to compare keys. -It uses the function `make-hash-table' to make a hash-table if -you use GNU Emacs, otherwise it uses `makehash'." - (if (fboundp 'make-hash-table) - (if test (make-hash-table :test test) (make-hash-table)) - (with-no-warnings - (makehash test)))) - -(defalias 'flymake-float-time - (if (fboundp 'float-time) - 'float-time - (if (featurep 'xemacs) - (lambda () - (multiple-value-bind (s0 s1 s2) (values-list (current-time)) - (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2))))))) - -(defalias 'flymake-replace-regexp-in-string - (if (eval-when-compile (fboundp 'replace-regexp-in-string)) - 'replace-regexp-in-string - (lambda (regexp rep str) - (replace-in-string str regexp rep)))) - -(defalias 'flymake-split-string - (if (condition-case nil (equal (split-string " bc " " " t) '("bc")) - (error nil)) - (lambda (str pattern) (split-string str pattern t)) - (lambda (str pattern) - "Split STR into a list of substrings bounded by PATTERN. -Zero-length substrings at the beginning and end of the list are omitted." - (let ((split (split-string str pattern))) - (while (equal (car split) "") (setq split (cdr split))) - (setq split (nreverse split)) - (while (equal (car split) "") (setq split (cdr split))) - (nreverse split))))) - -(defalias 'flymake-get-temp-dir - (if (fboundp 'temp-directory) - 'temp-directory - (lambda () temporary-file-directory))) (defun flymake-posn-at-point-as-event (&optional position window dx dy) "Return pixel position of top left corner of glyph at POSITION. @@ -120,12 +204,11 @@ selected window. DX and DY specify optional offsets from the top left of the glyph." - (unless window (setq window (selected-window))) - (unless position (setq position (window-point window))) - (unless dx (setq dx 0)) - (unless dy (setq dy 0)) - - (let* ((pos (posn-at-point position window)) + (let* ((window (or window (selected-window))) + (position (or position (window-point window))) + (dx (or dx 0)) + (dy (or dy 0)) + (pos (posn-at-point position window)) (x-y (posn-x-y pos)) (edges (window-inside-pixel-edges window)) (win-x-y (window-pixel-edges window))) @@ -135,25 +218,16 @@ (+ (cdr x-y) (cadr edges) (- (cadr win-x-y)) dy))) (list 'mouse-1 pos))) +;;; XXX: get rid of the following two functions + (defun flymake-popup-menu (menu-data) "Pop up the flymake menu at point, using the data MENU-DATA. POS is a list of the form ((X Y) WINDOW), where X and Y are pixels positions from the top left corner of WINDOW's frame. MENU-DATA is a list of error and warning messages returned by `flymake-make-err-menu-data'." - (if (featurep 'xemacs) - (let* ((pos (flymake-get-point-pixel-pos)) - (x-pos (nth 0 pos)) - (y-pos (nth 1 pos)) - (fake-event-props '(button 1 x 1 y 1))) - (setq fake-event-props (plist-put fake-event-props 'x x-pos)) - (setq fake-event-props (plist-put fake-event-props 'y y-pos)) - (popup-menu (flymake-make-xemacs-menu menu-data) - (make-event 'button-press fake-event-props))) - (x-popup-menu (if (eval-when-compile (fboundp 'posn-at-point)) - (flymake-posn-at-point-as-event) - (list (flymake-get-point-pixel-pos) (selected-window))) - (flymake-make-emacs-menu menu-data)))) + (x-popup-menu (flymake-posn-at-point-as-event) + (flymake-make-emacs-menu menu-data))) (defun flymake-make-emacs-menu (menu-data) "Return a menu specifier using MENU-DATA. @@ -167,72 +241,6 @@ menu-items))) (list menu-title (cons "" menu-commands)))) -(if (featurep 'xemacs) (progn - -(defun flymake-nop () - "Do nothing." - nil) - -(defun flymake-make-xemacs-menu (menu-data) - "Return a menu specifier using MENU-DATA." - (let* ((menu-title (nth 0 menu-data)) - (menu-items (nth 1 menu-data)) - (menu-commands nil)) - (setq menu-commands (mapcar (lambda (foo) - (vector (nth 0 foo) (or (nth 1 foo) '(flymake-nop)) t)) - menu-items)) - (cons menu-title menu-commands))) - -)) ;; xemacs - -(unless (eval-when-compile (fboundp 'posn-at-point)) - -(defun flymake-current-row () - "Return current row number in current frame." - (if (fboundp 'window-edges) - (+ (car (cdr (window-edges))) (count-lines (window-start) (point))) - (count-lines (window-start) (point)))) - -(defun flymake-selected-frame () - "Return the frame that is now selected." - (if (fboundp 'window-edges) - (selected-frame) - (selected-window))) - -(defun flymake-get-point-pixel-pos () - "Return point position in pixels: (x, y)." - (let ((mouse-pos (mouse-position)) - (pixel-pos nil) - (ret nil)) - (if (car (cdr mouse-pos)) - (progn - (set-mouse-position (flymake-selected-frame) (current-column) (flymake-current-row)) - (setq pixel-pos (mouse-pixel-position)) - (set-mouse-position (car mouse-pos) (car (cdr mouse-pos)) (cdr (cdr mouse-pos))) - (setq ret (list (car (cdr pixel-pos)) (cdr (cdr pixel-pos))))) - (progn - (setq ret '(0 0)))) - (flymake-log 3 "mouse pos is %s" ret) - ret)) - -) ;; End of (unless (fboundp 'posn-at-point) - -;;;; ]] - -(defcustom flymake-log-level -1 - "Logging level, only messages with level lower or equal will be logged. --1 = NONE, 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG" - :group 'flymake - :type 'integer) - - -;; (defcustom flymake-log-file-name "~/flymake.log" -;; "Where to put the flymake log if logging is enabled. -;; -;; See `flymake-log-level' if you want to control what is logged." -;; :group 'flymake -;; :type 'string) - (defun flymake-log (level text &rest args) "Log a message at level LEVEL. If LEVEL is higher than `flymake-log-level', the message is @@ -241,13 +249,7 @@ are the string substitutions (see the function `format')." (if (<= level flymake-log-level) (let* ((msg (apply 'format text args))) - (message "%s" msg) - ;;(with-temp-buffer - ;; (insert msg) - ;; (insert "\n") - ;; (flymake-save-buffer-in-file "~/flymake.log") ; make log file name customizable - ;;) - ))) + (message "%s" msg)))) (defun flymake-ins-after (list pos val) "Insert VAL into LIST after position POS. @@ -266,61 +268,7 @@ (defvar flymake-processes nil "List of currently active flymake processes.") -(defvar flymake-output-residual nil) -(make-variable-buffer-local 'flymake-output-residual) - -(defgroup flymake nil - "Universal on-the-fly syntax checker." - :version "23.1" - :group 'tools) - -(defcustom flymake-xml-program - (if (executable-find "xmlstarlet") "xmlstarlet" "xml") - "Program to use for XML validation." - :type 'file - :group 'flymake - :version "24.4") - -(defcustom flymake-allowed-file-name-masks - '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-simple-make-init) - ("\\.xml\\'" flymake-xml-init) - ("\\.html?\\'" flymake-xml-init) - ("\\.cs\\'" flymake-simple-make-init) - ("\\.p[ml]\\'" flymake-perl-init) - ("\\.php[345]?\\'" flymake-php-init) - ("\\.h\\'" flymake-master-make-header-init flymake-master-cleanup) - ("\\.java\\'" flymake-simple-make-java-init flymake-simple-java-cleanup) - ("[0-9]+\\.tex\\'" flymake-master-tex-init flymake-master-cleanup) - ("\\.tex\\'" flymake-simple-tex-init) - ("\\.idl\\'" flymake-simple-make-init) - ;; ("\\.cpp\\'" 1) - ;; ("\\.java\\'" 3) - ;; ("\\.h\\'" 2 ("\\.cpp\\'" "\\.c\\'") - ;; ("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2)) - ;; ("\\.idl\\'" 1) - ;; ("\\.odl\\'" 1) - ;; ("[0-9]+\\.tex\\'" 2 ("\\.tex\\'") - ;; ("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2 )) - ;; ("\\.tex\\'" 1) - ) - "Files syntax checking is allowed for. -This is an alist with elements of the form: - REGEXP INIT [CLEANUP [NAME]] -REGEXP is a regular expression that matches a file name. -INIT is the init function to use. -CLEANUP is the cleanup function to use, default `flymake-simple-cleanup'. -NAME is the file name function to use, default `flymake-get-real-file-name'." - :group 'flymake - :type '(alist :key-type (regexp :tag "File regexp") - :value-type - (list :tag "Handler functions" - (function :tag "Init function") - (choice :tag "Cleanup function" - (const :tag "flymake-simple-cleanup" nil) - function) - (choice :tag "Name function" - (const :tag "flymake-get-real-file-name" nil) - function)))) +(defvar-local flymake-output-residual nil) (defun flymake-get-file-name-mode-and-masks (file-name) "Return the corresponding entry from `flymake-allowed-file-name-masks'." @@ -356,7 +304,7 @@ (or (nth 2 (flymake-get-file-name-mode-and-masks file-name)) 'flymake-get-real-file-name)) -(defvar flymake-find-buildfile-cache (flymake-makehash 'equal)) +(defvar flymake-find-buildfile-cache (make-hash-table :test #'equal)) (defun flymake-get-buildfile-from-cache (dir-name) "Look up DIR-NAME in cache and return its associated value. @@ -400,16 +348,6 @@ (equal (flymake-fix-file-name file-name-one) (flymake-fix-file-name file-name-two))) -(defcustom flymake-master-file-dirs '("." "./src" "./UnitTest") - "Dirs where to look for master files." - :group 'flymake - :type '(repeat (string))) - -(defcustom flymake-master-file-count-limit 32 - "Max number of master files to check." - :group 'flymake - :type 'integer) - ;; This is bound dynamically to pass a parameter to a sort predicate below (defvar flymake-included-file-name) @@ -456,12 +394,9 @@ (file-name-base file-one)) (not (equal file-one file-two)))) -(defcustom flymake-check-file-limit 8192 +(defvar flymake-check-file-limit 8192 "Maximum number of chars to look at when checking possible master file. -Nil means search the entire file." - :group 'flymake - :type '(choice (const :tag "No limit" nil) - (integer :tag "Characters"))) +Nil means search the entire file.") (defun flymake-check-patch-master-file-buffer (master-file-temp-buffer @@ -537,6 +472,7 @@ (flymake-log 2 "found master file %s" master-file-name)) found)) +;;; XXX: remove (defun flymake-replace-region (beg end rep) "Replace text in BUFFER in region (BEG END) with REP." (save-excursion @@ -681,7 +617,7 @@ (setq flymake-new-err-info nil) (setq flymake-err-info (flymake-fix-line-numbers - flymake-err-info 1 (flymake-count-lines))) + flymake-err-info 1 (count-lines (point-min) (point-max)))) (flymake-delete-own-overlays) (flymake-highlight-err-lines flymake-err-info) (let (err-count warn-count) @@ -689,7 +625,7 @@ (setq warn-count (flymake-get-err-count flymake-err-info "w")) (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)" (buffer-name) err-count warn-count - (- (flymake-float-time) flymake-check-start-time)) + (- (float-time) flymake-check-start-time)) (setq flymake-check-start-time nil) (if (and (equal 0 err-count) (equal 0 warn-count)) @@ -810,46 +746,6 @@ "Determine whether overlay OV was created by flymake." (and (overlayp ov) (overlay-get ov 'flymake-overlay))) -(defcustom flymake-error-bitmap '(exclamation-mark error) - "Bitmap (a symbol) used in the fringe for indicating errors. -The value may also be a list of two elements where the second -element specifies the face for the bitmap. For possible bitmap -symbols, see `fringe-bitmaps'. See also `flymake-warning-bitmap'. - -The option `flymake-fringe-indicator-position' controls how and where -this is used." - :group 'flymake - :version "24.3" - :type '(choice (symbol :tag "Bitmap") - (list :tag "Bitmap and face" - (symbol :tag "Bitmap") - (face :tag "Face")))) - -(defcustom flymake-warning-bitmap 'question-mark - "Bitmap (a symbol) used in the fringe for indicating warnings. -The value may also be a list of two elements where the second -element specifies the face for the bitmap. For possible bitmap -symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'. - -The option `flymake-fringe-indicator-position' controls how and where -this is used." - :group 'flymake - :version "24.3" - :type '(choice (symbol :tag "Bitmap") - (list :tag "Bitmap and face" - (symbol :tag "Bitmap") - (face :tag "Face")))) - -(defcustom flymake-fringe-indicator-position 'left-fringe - "The position to put flymake fringe indicator. -The value can be nil (do not use indicators), `left-fringe' or `right-fringe'. -See `flymake-error-bitmap' and `flymake-warning-bitmap'." - :group 'flymake - :version "24.3" - :type '(choice (const left-fringe) - (const right-fringe) - (const :tag "No fringe indicators" nil))) - (defun flymake-make-overlay (beg end tooltip-text face bitmap mouse-face) "Allocate a flymake overlay in range BEG and END." (when (not (flymake-region-has-flymake-overlays beg end)) @@ -978,7 +874,7 @@ Return last one as residual if it does not end with newline char. Returns ((LINES) RESIDUAL)." (when (and output (> (length output) 0)) - (let* ((lines (flymake-split-string output "[\n\r]+")) + (let* ((lines (split-string output "[\n\r]+" t)) (complete (equal "\n" (char-to-string (aref output (1- (length output)))))) (residual nil)) (when (not complete) @@ -1163,26 +1059,24 @@ (shell-quote-argument basedir) " DUMPVARS=INCLUDE_DIRS dumpvars")) (output (shell-command-to-string command-line)) - (lines (flymake-split-string output "\n")) + (lines (split-string output "\n" t)) (count (length lines)) (idx 0) (inc-dirs nil)) (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines)))) (setq idx (1+ idx))) (when (< idx count) - (let* ((inc-lines (flymake-split-string (nth idx lines) " *-I")) + (let* ((inc-lines (split-string (nth idx lines) " *-I" t)) (inc-count (length inc-lines))) (while (> inc-count 0) (when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines))) - (push (flymake-replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs)) + (push (replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs)) (setq inc-count (1- inc-count))))) (flymake-add-project-include-dirs-to-cache basedir inc-dirs) inc-dirs))) -(defcustom flymake-get-project-include-dirs-function 'flymake-get-project-include-dirs-imp - "Function used to get project include dirs, one parameter: basedir name." - :group 'flymake - :type 'function) +(defvar flymake-get-project-include-dirs-function #'flymake-get-project-include-dirs-imp + "Function used to get project include dirs, one parameter: basedir name.") (defun flymake-get-project-include-dirs (basedir) (funcall flymake-get-project-include-dirs-function basedir)) @@ -1190,9 +1084,9 @@ (defun flymake-get-system-include-dirs () "System include dirs - from the 'INCLUDE' env setting." (let* ((includes (getenv "INCLUDE"))) - (if includes (flymake-split-string includes path-separator) nil))) + (if includes (split-string includes path-separator t) nil))) -(defvar flymake-project-include-dirs-cache (flymake-makehash 'equal)) +(defvar flymake-project-include-dirs-cache (make-hash-table :test #'equal)) (defun flymake-get-project-include-dirs-from-cache (base-dir) (gethash base-dir flymake-project-include-dirs-cache)) @@ -1232,11 +1126,6 @@ (error (flymake-log 1 "Failed to delete dir %s, error ignored" dir-name)))) -(defcustom flymake-compilation-prevents-syntax-check t - "If non-nil, don't start syntax check if compilation is running." - :group 'flymake - :type 'boolean) - (defun flymake-start-syntax-check () "Start syntax checking for current buffer." (interactive) @@ -1280,7 +1169,7 @@ (setq flymake-is-running t) (setq flymake-last-change-time nil) - (setq flymake-check-start-time (flymake-float-time)) + (setq flymake-check-start-time (float-time)) (flymake-report-status nil "*") (flymake-log 2 "started process %d, command=%s, dir=%s" @@ -1321,36 +1210,23 @@ (flymake-stop-all-syntax-checks) (call-interactively 'compile)) -(defcustom flymake-no-changes-timeout 0.5 - "Time to wait after last change before starting compilation." - :group 'flymake - :type 'number) - (defun flymake-on-timer-event (buffer) "Start a syntax check for buffer BUFFER if necessary." (when (buffer-live-p buffer) (with-current-buffer buffer (when (and (not flymake-is-running) flymake-last-change-time - (> (- (flymake-float-time) flymake-last-change-time) + (> (- (float-time) flymake-last-change-time) flymake-no-changes-timeout)) (setq flymake-last-change-time nil) (flymake-log 3 "starting syntax check as more than 1 second passed since last change") (flymake-start-syntax-check))))) -(defun flymake-current-line-no () - "Return number of current line in current buffer." - (count-lines (point-min) (if (eobp) (point) (1+ (point))))) - -(defun flymake-count-lines () - "Return number of lines in buffer BUFFER." - (count-lines (point-min) (point-max))) - (defun flymake-display-err-menu-for-current-line () "Display a menu with errors/warnings for current line if it has errors and/or warnings." (interactive) - (let* ((line-no (flymake-current-line-no)) + (let* ((line-no (line-number-at-pos)) (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no))) (menu-data (flymake-make-err-menu-data line-no line-err-info-list)) (choice nil)) @@ -1396,17 +1272,9 @@ (forward-line (1- line)))) ;; flymake minor mode declarations -(defvar flymake-mode-line nil) - -(make-variable-buffer-local 'flymake-mode-line) - -(defvar flymake-mode-line-e-w nil) - -(make-variable-buffer-local 'flymake-mode-line-e-w) - -(defvar flymake-mode-line-status nil) - -(make-variable-buffer-local 'flymake-mode-line-status) +(defvar-local flymake-mode-line nil) +(defvar-local flymake-mode-line-e-w nil) +(defvar-local flymake-mode-line-status nil) (defun flymake-report-status (e-w &optional status) "Show status in mode line." @@ -1425,11 +1293,6 @@ "Display a warning to user." (message-box warning)) -(defcustom flymake-gui-warnings-enabled t - "Enables/disables GUI warnings." - :group 'flymake - :type 'boolean) - (defun flymake-report-fatal-status (status warning) "Display a warning and switch flymake mode off." (when flymake-gui-warnings-enabled @@ -1439,17 +1302,8 @@ (flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s" (buffer-name) status warning)) -(defcustom flymake-start-syntax-check-on-find-file t - "Start syntax check on find file." - :group 'flymake - :type 'boolean) - ;;;###autoload -(define-minor-mode flymake-mode - "Toggle on-the-fly syntax checking. -With a prefix argument ARG, enable the mode if ARG is positive, -and disable it otherwise. If called from Lisp, enable the mode -if ARG is omitted or nil." +(define-minor-mode flymake-mode nil :group 'flymake :lighter flymake-mode-line (cond @@ -1505,19 +1359,14 @@ (flymake-mode 0) (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name))) -(defcustom flymake-start-syntax-check-on-newline t - "Start syntax check if newline char was added/removed from the buffer." - :group 'flymake - :type 'boolean) - (defun flymake-after-change-function (start stop _len) "Start syntax check for current buffer if it isn't already running." - ;;+(flymake-log 0 "setting change time to %s" (flymake-float-time)) + ;;+(flymake-log 0 "setting change time to %s" (float-time)) (let((new-text (buffer-substring start stop))) (when (and flymake-start-syntax-check-on-newline (equal new-text "\n")) (flymake-log 3 "starting syntax check as new-line has been seen") (flymake-start-syntax-check)) - (setq flymake-last-change-time (flymake-float-time)))) + (setq flymake-last-change-time (float-time)))) (defun flymake-after-save-hook () (if (local-variable-p 'flymake-mode (current-buffer)) ; (???) other way to determine whether flymake is active in buffer being saved? @@ -1584,7 +1433,7 @@ (defun flymake-goto-next-error () "Go to next error in err ring." (interactive) - (let ((line-no (flymake-get-next-err-line-no flymake-err-info (flymake-current-line-no)))) + (let ((line-no (flymake-get-next-err-line-no flymake-err-info (line-number-at-pos)))) (when (not line-no) (setq line-no (flymake-get-first-err-line-no flymake-err-info)) (flymake-log 1 "passed end of file")) @@ -1595,7 +1444,7 @@ (defun flymake-goto-prev-error () "Go to previous error in err ring." (interactive) - (let ((line-no (flymake-get-prev-err-line-no flymake-err-info (flymake-current-line-no)))) + (let ((line-no (flymake-get-prev-err-line-no flymake-err-info (line-number-at-pos)))) (when (not line-no) (setq line-no (flymake-get-last-err-line-no flymake-err-info)) (flymake-log 1 "passed beginning of file")) @@ -1631,14 +1480,14 @@ ;; trying to remove the leading / of absolute file names. (slash-pos (string-match "/" dir)) (temp-dir (expand-file-name (substring dir (1+ slash-pos)) - (flymake-get-temp-dir)))) + temporary-file-directory))) (file-truename (expand-file-name (file-name-nondirectory file-name) temp-dir)))) (defun flymake-delete-temp-directory (dir-name) "Attempt to delete temp dir created by `flymake-create-temp-with-folder-structure', do not fail on error." - (let* ((temp-dir (flymake-get-temp-dir)) + (let* ((temp-dir temporary-file-directory) (suffix (substring dir-name (1+ (length temp-dir))))) (while (> (length suffix) 0) @@ -1648,17 +1497,10 @@ (file-truename (expand-file-name suffix temp-dir))) (setq suffix (file-name-directory suffix))))) -(defvar flymake-temp-source-file-name nil) -(make-variable-buffer-local 'flymake-temp-source-file-name) - -(defvar flymake-master-file-name nil) -(make-variable-buffer-local 'flymake-master-file-name) - -(defvar flymake-temp-master-file-name nil) -(make-variable-buffer-local 'flymake-temp-master-file-name) - -(defvar flymake-base-dir nil) -(make-variable-buffer-local 'flymake-base-dir) +(defvar-local flymake-temp-source-file-name nil) +(defvar-local flymake-master-file-name nil) +(defvar-local flymake-temp-master-file-name nil) +(defvar-local flymake-base-dir nil) (defun flymake-init-create-temp-buffer-copy (create-temp-f) "Make a temporary copy of the current buffer, save its name in buffer data and return the name." @@ -1899,5 +1741,4 @@ 'flymake-create-temp-inplace)))) (provide 'flymake) - ;;; flymake.el ends here ------------------------------------------------------------ revno: 115413 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16084 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2013-12-07 22:07:11 -0500 message: * src/window.c (set_window_buffer): Update mode line. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-07 23:04:10 +0000 +++ src/ChangeLog 2013-12-08 03:07:11 +0000 @@ -1,3 +1,7 @@ +2013-12-08 Stefan Monnier + + * window.c (set_window_buffer): Update mode line (bug#16084). + 2013-12-07 Paul Eggert Fix minor problems found by static checking. @@ -19,8 +23,8 @@ * nsterm.m (x_set_window_size): Remove fprintf. (init): Define always. Set applicationDidFinishLaunchingCalled for GNUStep. - (applicationDidFinishLaunching:): Set - applicationDidFinishLaunchingCalled, + (applicationDidFinishLaunching:): + Set applicationDidFinishLaunchingCalled. (applicationDidBecomeActive:): Call applicationDidFinishLaunching if not called. @@ -33,8 +37,8 @@ (updateFrameSize:): Remove gsextra. Adjust for pixelwise resize. (windowWillResize): Remove gsextra. Calculate extra as in updateFrameSize. - (x_new_font): Don't change frame size if fullscreen. Change - size pixelwise. + (x_new_font): Don't change frame size if fullscreen. + Change size pixelwise. * nsfns.m (Fx_create_frame): Call change_frame_size twice as per comment in xfns.c. Change to pixelwise call. @@ -236,8 +240,8 @@ ON_RIGHT_DIVIDER and ON_BOTTOM_DIVIDER. (struct glyph_matrix): Replace window_left_col and window_top_line by window_pixel_left and window_pixel_top. - (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P): Minor - rewrite. + (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P): + Minor rewrite. (enum face_id): Add WINDOW_DIVIDER_FACE_ID. (draw_window_divider, move_it_to, x_draw_right_divider) (x_draw_bottom_divider, change_frame_size): Add or fix @@ -252,8 +256,8 @@ (init_display): Adjusts calls of change_frame_size. (change_frame_size, change_frame_size_1): Handle pixelwise changes. - * frame.c (Qright_divider_width, Qbottom_divider_width): New - Lisp objects. + * frame.c (Qright_divider_width, Qbottom_divider_width): + New Lisp objects. (set_menu_bar_lines_1, set_menu_bar_lines, make_frame) (make_terminal_frame, Fmake_terminal_frame, Fframe_parameters) (x_set_internal_border_width, x_set_vertical_scroll_bars) @@ -264,15 +268,15 @@ (Fframe_text_width, Fframe_text_height, Fscroll_bar_width) (Ffringe_width, Fborder_width, Fright_divider_width) (Fbottom_divider_width): New functions, defsubr them. - (Fset_frame_height, Fset_frame_width, Fset_frame_size): New - argument pixelwise. + (Fset_frame_height, Fset_frame_width, Fset_frame_size): + New argument pixelwise. (struct frame_parm_table): New members Qright_divider_width and Qbottom_divider_width. (x_set_frame_parameters): Handle parameters for pixelwise sizes. (x_report_frame_params): Handle Qright_divider_width and Qbottom_divider_width. - (x_set_right_divider_width, x_set_bottom_divider_width): New - functions. + (x_set_right_divider_width, x_set_bottom_divider_width): + New functions. (frame_resize_pixelwise): New option. * frame.h (struct frame): Add tool_bar_height, menu_bar_height, new_pixelwise, right_divider_width and bottom_divider_width; @@ -283,8 +287,8 @@ FRAME_TEXT_WIDTH respectively. (FRAME_MENU_BAR_HEIGHT, FRAME_TOOL_BAR_HEIGHT) (FRAME_RIGHT_DIVIDER_WIDTH, FRAME_BOTTOM_DIVIDER_WIDTH) - (FRAME_TEXT_TO_PIXEL_WIDTH, FRAME_PIXEL_TO_TEXT_WIDTH): New - macros. + (FRAME_TEXT_TO_PIXEL_WIDTH, FRAME_PIXEL_TO_TEXT_WIDTH): + New macros. (FRAME_TOP_MARGIN_HEIGHT, FRAME_LEFT_SCROLL_BAR_AREA_WIDTH) (FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH, FRAME_SCROLL_BAR_AREA_WIDTH) (SET_FRAME_COLS, SET_FRAME_WIDTH, SET_FRAME_HEIGHT) @@ -294,8 +298,8 @@ * fringe.c (draw_fringe_bitmap_1): Handle right divder. * gtkutil.c (xg_frame_resized, xg_frame_set_char_size) (x_wm_set_size_hint): Handle frame pixel sizes. - * indent.c (compute_motion, Fcompute_motion): Call - window_body_width instead of window_body_cols. + * indent.c (compute_motion, Fcompute_motion): + Call window_body_width instead of window_body_cols. * keyboard.c (Qright_divider, Qbottom_divider): New symbols. (make_lispy_position): Handle right and bottom dividers. (Fsuspend_emacs): Pixelize call of change_frame_size. @@ -303,13 +307,13 @@ * lisp.h: Extern set_frame_param. * nsfns.m (x_set_tool_bar_lines): Pixelize call of x_set_window_size. - (Fx_create_frame): Add entry for vertical_drag_cursor. Pixelize - call of change_frame_size. + (Fx_create_frame): Add entry for vertical_drag_cursor. + Pixelize call of change_frame_size. * nsterm.h (struct ns_output): Add vertical_drag_cursor. * nsterm.m (ns_update_window_end): Optionally draw right divider. - (x_set_window_size): Add argument pixelwise. Call - check_frame_size and change_frame_size with pixelwise zero. + (x_set_window_size): Add argument pixelwise. + Call check_frame_size and change_frame_size with pixelwise zero. (ns_draw_window_divider): New function. (ns_redisplay_interface): Add ns_draw_window_divider. (updateFrameSize:): Call change_frame_size with pixelwise zero. @@ -320,12 +324,12 @@ * w32fns.c (x_set_mouse_color): Handle vertical drag cursor. (x_set_menu_bar_lines, x_set_tool_bar_lines): Calculate pixelwise. (w32_createwindow): Use scroll bar area width. - (w32_wnd_proc): Handle bottom divider width. For - WM_WINDOWPOSCHANGING return zero if we resize pixelwise. - (Fx_create_frame): Default divider width parameters. Caclulate - sizes pixelwise. Add vertical drag cursor support. - (x_create_tip_frame): Default divider widths to zero. Pixelize - call to change_frame_size. + (w32_wnd_proc): Handle bottom divider width. + For WM_WINDOWPOSCHANGING return zero if we resize pixelwise. + (Fx_create_frame): Default divider width parameters. + Caclulate sizes pixelwise. Add vertical drag cursor support. + (x_create_tip_frame): Default divider widths to zero. + Pixelize call to change_frame_size. (Fx_show_tip): Add handling of divider widths. Pixelize window position and sizes. (Fw32_frame_rect): New function. @@ -340,8 +344,8 @@ (x_update_window_end): Handle right divider. (w32_draw_fringe_bitmap, x_scroll_run) (w32_set_vertical_scroll_bar): Pixelize scrollbar widths. - (w32_read_socket): Handle SIZE_MAXIMIZED separately. Calculate - new frame sizes pixelwise. + (w32_read_socket): Handle SIZE_MAXIMIZED separately. + Calculate new frame sizes pixelwise. (x_new_font): Pixelize call to x_set_window_size. (x_check_fullscreen): Pixelize call to change_frame_size. (x_set_window_size_1, x_set_window_size): New argument @@ -360,16 +364,16 @@ (Fset_window_new_pixel, window_resize_apply_total) (Fwindow_resize_apply_total): New functions. (window_body_height, window_body_width): Rename from - window_body_lines. New argument PIXELWISE. Calculate - pixelwise. + window_body_lines. New argument PIXELWISE. + Calculate pixelwise. (Fwindow_body_height, Fwindow_body_width): New argument PIXELWISE. (coordinates_in_window, window_relative_x_coord): Use window's pixel width instead of total width. (replace_window, recombine_windows): Initialize pixel values. (resize_root_window, resize_frame_windows, grow_mini_window) - (shrink_mini_window): New argument PIXELWISE. Calculate - pixelwise. + (shrink_mini_window): New argument PIXELWISE. + Calculate pixelwise. (Fdelete_other_windows_internal, adjust_window_margins) (window_resize_check, window_resize_apply) (Fdelete_window_internal, Fresize_mini_window_internal) @@ -394,11 +398,11 @@ slots in save_window_data and saved_window. (Fset_window_scroll_bars): Fix doc-string. (window_resize_pixelwise): New variable. - (coordinates_in_window, Fcoordinates_in_window_p): Handle - dividers. + (coordinates_in_window, Fcoordinates_in_window_p): + Handle dividers. (make_parent_window): Adjust sequence_number. - (Fwindow_right_divider_width, Fwindow_bottom_divider_width): New - functions. + (Fwindow_right_divider_width, Fwindow_bottom_divider_width): + New functions. * window.h (struct window): New members new_pixel, pixel_left, pixel_top, pixel_width, pixel_height. Restore sequence_number. (wset_new_pixel): New function. @@ -432,10 +436,10 @@ encountered. (Fwindow_text_pixel_size): New function. (resize_mini_window, update_tool_bar): Calculate pixelwise. - (tool_bar_lines_needed): Rename to tool_bar_height. Calculate - pixelwise. - (Ftool_bar_lines_needed): Rename to Ftool_bar_height. Calculate - pixelwise. + (tool_bar_lines_needed): Rename to tool_bar_height. + Calculate pixelwise. + (Ftool_bar_lines_needed): Rename to Ftool_bar_height. + Calculate pixelwise. (redisplay_tool_bar): Calculate pixelwise. (redisplay_window): Calculate pixelwise. Handle dividers. (draw_glyphs, x_clear_end_of_line, note_mouse_highlight) @@ -450,8 +454,8 @@ (x_set_menu_bar_lines, x_set_tool_bar_lines): Calculate pixelwise. (x_set_scroll_bar_default_width): Default actual width to 16. (Fx_create_frame): Set sizes pixelwise. - (x_create_tip_frame): Default divider widths to zero. Pixelize - call of change_frame_size. + (x_create_tip_frame): Default divider widths to zero. + Pixelize call of change_frame_size. (Fx_show_tip): Handle divider widths. Initial pixel position and sizes. (frame_parm_handler x_frame_parm_handlers): Add divider widths. === modified file 'src/window.c' --- src/window.c 2013-12-04 21:08:21 +0000 +++ src/window.c 2013-12-08 03:07:11 +0000 @@ -3365,6 +3365,7 @@ /* Maybe we could move this into the `if' but it's not obviously safe and I doubt it's worth the trouble. */ wset_redisplay (w); + w->update_mode_line = true; /* We must select BUFFER for running the window-scroll-functions. */ /* We can't check ! NILP (Vwindow_scroll_functions) here ------------------------------------------------------------ revno: 115412 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-12-07 15:04:10 -0800 message: Fix minor problems found by static checking. * keyboard.c (poll_for_input_1, input_polling_used): Define only if HAVE_NTGUI. * xmenu.c (popup_activate_callback): Omit unnecessary check against USE_X_TOOLKIT, which must be defined here anyway. * xterm.c, xterm.h (x_dispatch_event) [! (USE_X_TOOLKIT || USE_MOTIF)]: Now static. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-07 17:48:52 +0000 +++ src/ChangeLog 2013-12-07 23:04:10 +0000 @@ -1,3 +1,13 @@ +2013-12-07 Paul Eggert + + Fix minor problems found by static checking. + * keyboard.c (poll_for_input_1, input_polling_used): + Define only if HAVE_NTGUI. + * xmenu.c (popup_activate_callback): Omit unnecessary + check against USE_X_TOOLKIT, which must be defined here anyway. + * xterm.c, xterm.h (x_dispatch_event) [! (USE_X_TOOLKIT || USE_MOTIF)]: + Now static. + 2013-12-07 Martin Rudalics * w32term.c (w32_read_socket): Fix int/Lisp_Object type mixup. === modified file 'src/keyboard.c' --- src/keyboard.c 2013-11-30 09:25:31 +0000 +++ src/keyboard.c 2013-12-07 23:04:10 +0000 @@ -1954,10 +1954,8 @@ static struct atimer *poll_timer; -/* Poll for input, so that we catch a C-g if it comes in. This - function is called from x_make_frame_visible, see comment - there. */ - +#ifdef HAVE_NTGUI +/* Poll for input, so that we catch a C-g if it comes in. */ void poll_for_input_1 (void) { @@ -1965,6 +1963,7 @@ && !waiting_for_input) gobble_input (); } +#endif /* Timer callback function for poll_timer. TIMER is equal to poll_timer. */ @@ -2016,6 +2015,8 @@ #endif } +#ifdef HAVE_NTGUI + /* True if we are using polling to handle input asynchronously. */ bool @@ -2030,6 +2031,7 @@ return 0; #endif } +#endif /* Turn off polling. */ === modified file 'src/xmenu.c' --- src/xmenu.c 2013-11-30 09:25:31 +0000 +++ src/xmenu.c 2013-12-07 23:04:10 +0000 @@ -510,9 +510,7 @@ popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data) { popup_activated_flag = 1; -#ifdef USE_X_TOOLKIT x_activate_timeout_atimer (); -#endif } #endif === modified file 'src/xterm.c' --- src/xterm.c 2013-12-06 05:49:05 +0000 +++ src/xterm.c 2013-12-07 23:04:10 +0000 @@ -248,6 +248,9 @@ static int handle_one_xevent (struct x_display_info *, const XEvent *, int *, struct input_event *); +#if ! (defined USE_X_TOOLKIT || defined USE_MOTIF) +static int x_dispatch_event (XEvent *, Display *); +#endif /* Don't declare this _Noreturn because we want no interference with debugging failing X calls. */ static void x_connection_closed (Display *, const char *); === modified file 'src/xterm.h' --- src/xterm.h 2013-12-06 05:49:05 +0000 +++ src/xterm.h 2013-12-07 23:04:10 +0000 @@ -945,7 +945,9 @@ extern void x_mouse_leave (struct x_display_info *); #endif +#if defined USE_X_TOOLKIT || defined USE_MOTIF extern int x_dispatch_event (XEvent *, Display *); +#endif extern int x_x_to_emacs_modifiers (struct x_display_info *, int); extern int x_display_pixel_height (struct x_display_info *); extern int x_display_pixel_width (struct x_display_info *); ------------------------------------------------------------ revno: 115411 committer: Bozhidar Batsov branch nick: master timestamp: Sat 2013-12-07 20:46:03 +0200 message: * lisp/emacs-lisp/helpers.el (string-blank-p): Use `string-match-p'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-07 17:05:38 +0000 +++ lisp/ChangeLog 2013-12-07 18:46:03 +0000 @@ -1,3 +1,7 @@ +2013-12-07 Bozhidar Batsov + + * emacs-lisp/helpers.el (string-blank-p): Use `string-match-p'. + 2013-12-07 Tassilo Horn * help-fns.el (describe-function-1): Use new advice-* functions === modified file 'lisp/emacs-lisp/helpers.el' --- lisp/emacs-lisp/helpers.el 2013-11-29 16:51:44 +0000 +++ lisp/emacs-lisp/helpers.el 2013-12-07 18:46:03 +0000 @@ -67,7 +67,7 @@ (defsubst string-blank-p (string) "Check whether STRING is either empty or only whitespace." - (string-empty-p (string-trim string))) + (string-match-p "\\`[ \t\n\r]*\\'" string)) (provide 'helpers) ------------------------------------------------------------ revno: 115410 committer: martin rudalics branch nick: trunk timestamp: Sat 2013-12-07 18:48:52 +0100 message: Fix int/Lisp_Object type mixup in w32_read_socket. * w32term.c (w32_read_socket): Fix int/Lisp_Object type mixup. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-07 17:41:02 +0000 +++ src/ChangeLog 2013-12-07 17:48:52 +0000 @@ -1,3 +1,7 @@ +2013-12-07 Martin Rudalics + + * w32term.c (w32_read_socket): Fix int/Lisp_Object type mixup. + 2013-12-07 Jan Djärv * gtkutil.c (tb_size_cb): Call xg_height_or_width_changed. === modified file 'src/w32term.c' --- src/w32term.c 2013-12-05 13:46:30 +0000 +++ src/w32term.c 2013-12-07 17:48:52 +0000 @@ -4743,9 +4743,9 @@ record_asynch_buffer_change (); } - if (get_frame_param (f, Qfullscreen) == Qnil) + if (EQ (get_frame_param (f, Qfullscreen), Qnil)) set_frame_param (f, Qfullscreen, Qmaximized); - else if (get_frame_param (f, Qfullscreen) != Qmaximized) + else if (! EQ (get_frame_param (f, Qfullscreen), Qmaximized)) set_frame_param (f, Qmaximized, Qmaximized); break; @@ -4782,9 +4782,9 @@ record_asynch_buffer_change (); } - if (get_frame_param (f, Qfullscreen) == Qmaximized) + if (EQ (get_frame_param (f, Qfullscreen), Qmaximized)) set_frame_param (f, Qfullscreen, Qnil); - else if (get_frame_param (f, Qmaximized) != Qnil) + else if (! EQ (get_frame_param (f, Qmaximized), Qnil)) set_frame_param (f, Qmaximized, Qnil); break; ------------------------------------------------------------ revno: 115409 committer: Jan D. branch nick: trunk timestamp: Sat 2013-12-07 18:41:02 +0100 message: * gtkutil.c (tb_size_cb): Call xg_height_or_width_changed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-07 16:48:12 +0000 +++ src/ChangeLog 2013-12-07 17:41:02 +0000 @@ -1,5 +1,7 @@ 2013-12-07 Jan Djärv + * gtkutil.c (tb_size_cb): Call xg_height_or_width_changed. + * nsterm.m (x_set_window_size): Remove fprintf. (init): Define always. Set applicationDidFinishLaunchingCalled for GNUStep. === modified file 'src/gtkutil.c' --- src/gtkutil.c 2013-12-03 18:08:14 +0000 +++ src/gtkutil.c 2013-12-07 17:41:02 +0000 @@ -4350,7 +4350,7 @@ size hints if tool bar size changes. Seen on Fedora 18 at least. */ struct frame *f = user_data; if (xg_update_tool_bar_sizes (f)) - x_wm_set_size_hint (f, 0, 0); + xg_height_or_width_changed (f); } /* Create a tool bar for frame F. */ ------------------------------------------------------------ revno: 115408 committer: Tassilo Horn branch nick: trunk timestamp: Sat 2013-12-07 18:05:38 +0100 message: Fix describe-function with advised functions. * lisp/help-fns.el (describe-function-1): Use new advice-* functions rather than old ad-* functions. Fix function type description and source links for advised functions and subrs. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-07 01:44:15 +0000 +++ lisp/ChangeLog 2013-12-07 17:05:38 +0000 @@ -1,3 +1,9 @@ +2013-12-07 Tassilo Horn + + * help-fns.el (describe-function-1): Use new advice-* functions + rather than old ad-* functions. Fix function type description and + source links for advised functions and subrs. + 2013-12-07 Lars Magne Ingebrigtsen * net/shr.el (shr-tag-img): Don't bug out on === modified file 'lisp/help-fns.el' --- lisp/help-fns.el 2013-06-15 01:12:05 +0000 +++ lisp/help-fns.el 2013-12-07 17:05:38 +0000 @@ -382,8 +382,6 @@ (match-string 1 str)))) (and src-file (file-readable-p src-file) src-file)))))) -(declare-function ad-get-advice-info "advice" (function)) - (defun help-fns--key-bindings (function) (when (commandp function) (let ((pt2 (with-current-buffer standard-output (point))) @@ -531,27 +529,34 @@ ;;;###autoload (defun describe-function-1 (function) - (let* ((advised (and (symbolp function) (featurep 'advice) - (ad-get-advice-info function))) + (let* ((advised (and (symbolp function) + (featurep 'nadvice) + (advice--p (advice--symbol-function function)))) ;; If the function is advised, use the symbol that has the ;; real definition, if that symbol is already set up. (real-function (or (and advised - (let ((origname (cdr (assq 'origname advised)))) - (and (fboundp origname) origname))) + (let* ((advised-fn (advice--cdr + (advice--symbol-function function)))) + (while (advice--p advised-fn) + (setq advised-fn (advice--cdr advised-fn))) + advised-fn)) function)) ;; Get the real definition. (def (if (symbolp real-function) (symbol-function real-function) - function)) - (aliased (symbolp def)) - (real-def (if aliased - (let ((f def)) - (while (and (fboundp f) - (symbolp (symbol-function f))) - (setq f (symbol-function f))) - f) - def)) + real-function)) + (aliased (or (symbolp def) + ;; Advised & aliased function. + (and advised (symbolp real-function)))) + (real-def (cond + (aliased (let ((f real-function)) + (while (and (fboundp f) + (symbolp (symbol-function f))) + (setq f (symbol-function f))) + f)) + ((subrp def) (intern (subr-name def))) + (t def))) (file-name (find-lisp-object-file-name function def)) (pt1 (with-current-buffer (help-buffer) (point))) (beg (if (and (or (byte-code-function-p def) @@ -571,14 +576,20 @@ (if (eq 'unevalled (cdr (subr-arity def))) (concat beg "special form") (concat beg "built-in function"))) + ;; Aliases are Lisp functions, so we need to check + ;; aliases before functions. + (aliased + (format "an alias for `%s'" real-def)) + ((or (eq (car-safe def) 'macro) + ;; For advised macros, def is a lambda + ;; expression or a byte-code-function-p, so we + ;; need to check macros before functions. + (macrop function)) + (concat beg "Lisp macro")) ((byte-code-function-p def) (concat beg "compiled Lisp function")) - (aliased - (format "an alias for `%s'" real-def)) ((eq (car-safe def) 'lambda) (concat beg "Lisp function")) - ((eq (car-safe def) 'macro) - (concat beg "Lisp macro")) ((eq (car-safe def) 'closure) (concat beg "Lisp closure")) ((autoloadp def) ------------------------------------------------------------ revno: 115407 committer: Jan D. branch nick: trunk timestamp: Sat 2013-12-07 17:48:12 +0100 message: Fix GNUStep issues with startup. * nsterm.h (EmacsApp): Add applicationDidFinishLaunchingCalled. Pixel resize changes for NS. * nsterm.m (x_set_window_size): Change parameters rows/cols to height/width. row/cols are locals. Pass pixelwise to check_frame_size. Don't set FRAME_PIXEL_WIDTH/HEIGHT. (updateFrameSize:): Remove gsextra. Adjust for pixelwise resize. (windowWillResize): Remove gsextra. Calculate extra as in updateFrameSize. (x_new_font): Don't change frame size if fullscreen. Change size pixelwise. * nsterm.m (x_set_window_size): Remove fprintf. (init): Define always. Set applicationDidFinishLaunchingCalled for GNUStep. (applicationDidFinishLaunching:): Set applicationDidFinishLaunchingCalled, (applicationDidBecomeActive:): Call applicationDidFinishLaunching if not called. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-07 14:26:29 +0000 +++ src/ChangeLog 2013-12-07 16:48:12 +0000 @@ -1,5 +1,15 @@ 2013-12-07 Jan Djärv + * nsterm.m (x_set_window_size): Remove fprintf. + (init): Define always. Set applicationDidFinishLaunchingCalled + for GNUStep. + (applicationDidFinishLaunching:): Set + applicationDidFinishLaunchingCalled, + (applicationDidBecomeActive:): Call applicationDidFinishLaunching if + not called. + + * nsterm.h (EmacsApp): Add applicationDidFinishLaunchingCalled. + Pixel resize changes for NS (Bug#16049). * nsterm.m (x_set_window_size): Change parameters rows/cols to height/width. row/cols are locals. === modified file 'src/nsterm.h' --- src/nsterm.h 2013-12-02 13:35:53 +0000 +++ src/nsterm.h 2013-12-07 16:48:12 +0000 @@ -90,6 +90,7 @@ BOOL isFirst; #endif #ifdef NS_IMPL_GNUSTEP + BOOL applicationDidFinishLaunchingCalled; @public int nextappdefined; #endif === modified file 'src/nsterm.m' --- src/nsterm.m 2013-12-07 14:21:53 +0000 +++ src/nsterm.m 2013-12-07 16:48:12 +0000 @@ -1320,8 +1320,6 @@ [view setRows: rows andColumns: cols]; [window setFrame: wr display: YES]; - fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight); - /* This is a trick to compensate for Emacs' managing the scrollbar area as a fixed number of standard character columns. Instead of leaving blank space for the extra, we chopped it off above. Now for @@ -4410,15 +4408,22 @@ @implementation EmacsApp -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 - (id)init { if (self = [super init]) - self->isFirst = YES; + { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 + self->isFirst = YES; +#endif +#ifdef NS_IMPL_GNUSTEP + self->applicationDidFinishLaunchingCalled = NO; +#endif + } return self; } +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 - (void)run { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; @@ -4605,6 +4610,9 @@ -------------------------------------------------------------------------- */ { NSTRACE (applicationDidFinishLaunching); +#ifdef NS_IMPL_GNUSTEP + ((EmacsApp *)self)->applicationDidFinishLaunchingCalled = YES; +#endif [NSApp setServicesProvider: NSApp]; ns_send_appdefined (-2); } @@ -4732,6 +4740,10 @@ { NSTRACE (applicationDidBecomeActive); +#ifdef NS_IMPL_GNUSTEP + if (! applicationDidFinishLaunchingCalled) + [self applicationDidFinishLaunching:notification]; +#endif //ns_app_active=YES; ns_update_auto_hide_menu_bar (); ------------------------------------------------------------ revno: 115406 committer: Jan D. branch nick: trunk timestamp: Sat 2013-12-07 15:26:29 +0100 message: Mention bug 16049. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-07 14:21:53 +0000 +++ src/ChangeLog 2013-12-07 14:26:29 +0000 @@ -1,5 +1,6 @@ 2013-12-07 Jan Djärv + Pixel resize changes for NS (Bug#16049). * nsterm.m (x_set_window_size): Change parameters rows/cols to height/width. row/cols are locals. Pass pixelwise to check_frame_size. Don't set FRAME_PIXEL_WIDTH/HEIGHT. ------------------------------------------------------------ revno: 115405 committer: Jan D. branch nick: trunk timestamp: Sat 2013-12-07 15:21:53 +0100 message: Handle pixelwise resize changes in NS port. * src/nsfns.m (Fx_create_frame): Call change_frame_size twice as per comment in xfns.c. Change to pixelwise call. * src/nsterm.m (x_set_window_size): Change parameters rows/cols to height/width. row/cols are locals. Pass pixelwise to check_frame_size. Don't set FRAME_PIXEL_WIDTH/HEIGHT. (updateFrameSize:): Remove gsextra. Adjust for pixelwise resize. (windowWillResize): Remove gsextra. Calculate extra as in updateFrameSize. (x_new_font): Don't change frame size if fullscreen. Change size pixelwise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-06 15:13:35 +0000 +++ src/ChangeLog 2013-12-07 14:21:53 +0000 @@ -1,3 +1,17 @@ +2013-12-07 Jan Djärv + + * nsterm.m (x_set_window_size): Change parameters rows/cols to + height/width. row/cols are locals. + Pass pixelwise to check_frame_size. Don't set FRAME_PIXEL_WIDTH/HEIGHT. + (updateFrameSize:): Remove gsextra. Adjust for pixelwise resize. + (windowWillResize): Remove gsextra. Calculate extra as in + updateFrameSize. + (x_new_font): Don't change frame size if fullscreen. Change + size pixelwise. + + * nsfns.m (Fx_create_frame): Call change_frame_size twice as per + comment in xfns.c. Change to pixelwise call. + 2013-12-06 Eli Zaretskii * buffer.c (Fset_buffer_multibyte): Invalidate buffer caches. === modified file 'src/nsfns.m' --- src/nsfns.m 2013-12-05 16:20:11 +0000 +++ src/nsfns.m 2013-12-07 14:21:53 +0000 @@ -1237,6 +1237,13 @@ init_frame_faces (f); + /* Read comment about this code in corresponding place in xfns.c. */ + width = FRAME_TEXT_WIDTH (f); + height = FRAME_TEXT_HEIGHT (f); + FRAME_TEXT_HEIGHT (f) = 0; + SET_FRAME_WIDTH (f, 0); + change_frame_size (f, width, height, 1, 0, 0, 1); + /* The resources controlling the menu-bar and tool-bar are processed specially at startup, and reflected in the mode variables; ignore them here. */ @@ -1301,12 +1308,11 @@ x_default_parameter (f, parms, Qfullscreen, Qnil, "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); - width = FRAME_COLS (f); - height = FRAME_LINES (f); - - SET_FRAME_COLS (f, 0); - FRAME_LINES (f) = 0; - change_frame_size (f, width, height, 1, 0, 0, 0); + width = FRAME_TEXT_WIDTH (f); + height = FRAME_TEXT_HEIGHT (f); + FRAME_TEXT_HEIGHT (f) = 0; + SET_FRAME_WIDTH (f, 0); + change_frame_size (f, width, height, 1, 0, 0, 1); if (! f->output_data.ns->explicit_parent) { === modified file 'src/nsterm.m' --- src/nsterm.m 2013-12-05 16:20:11 +0000 +++ src/nsterm.m 2013-12-07 14:21:53 +0000 @@ -1240,7 +1240,11 @@ void -x_set_window_size (struct frame *f, int change_grav, int cols, int rows, bool pixelwise) +x_set_window_size (struct frame *f, + int change_grav, + int width, + int height, + bool pixelwise) /* -------------------------------------------------------------------------- Adjust window pixel size based on given character grid size Impl is a bit more complex than other terms, need to do some @@ -1252,32 +1256,35 @@ NSRect wr = [window frame]; int tb = FRAME_EXTERNAL_TOOL_BAR (f); int pixelwidth, pixelheight; + int rows, cols; NSTRACE (x_set_window_size); if (view == nil) return; -/*fprintf (stderr, "\tsetWindowSize: %d x %d, pixelwise %d, font size %d x %d\n", cols, rows, pixelwise, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));*/ +/*fprintf (stderr, "\tsetWindowSize: %d x %d, pixelwise %d, font size %d x %d\n", width, height, pixelwise, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));*/ block_input (); - check_frame_size (f, &cols, &rows, 0); + check_frame_size (f, &width, &height, pixelwise); f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f); compute_fringe_widths (f, 0); if (pixelwise) { - pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, cols); - pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, rows); + pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); + pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); } else { - pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); - pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); + pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width); + pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height); + cols = width; + rows = height; } /* If we have a toolbar, take its height into account. */ @@ -1313,7 +1320,7 @@ [view setRows: rows andColumns: cols]; [window setFrame: wr display: YES]; -/*fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight); */ + fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight); /* This is a trick to compensate for Emacs' managing the scrollbar area as a fixed number of standard character columns. Instead of leaving @@ -1331,9 +1338,7 @@ [view setBoundsOrigin: origin]; } - change_frame_size (f, cols, rows, 0, 1, 0, 0); /* pretend, delay, safe */ - FRAME_PIXEL_WIDTH (f) = pixelwidth; - FRAME_PIXEL_HEIGHT (f) = pixelheight; + change_frame_size (f, width, height, 0, 1, 0, pixelwise); /* SET_FRAME_GARBAGED (f); // this short-circuits expose call in drawRect */ mark_window_cursors_off (XWINDOW (f->root_window)); @@ -5658,44 +5663,39 @@ NSWindow *window = [self window]; NSRect wr = [window frame]; int extra = 0; - int gsextra = 0; -#ifdef NS_IMPL_GNUSTEP - gsextra = 3; -#endif - int oldc = cols, oldr = rows; int oldw = FRAME_PIXEL_WIDTH (emacsframe), oldh = FRAME_PIXEL_HEIGHT (emacsframe); int neww, newh; - cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, wr.size.width + gsextra); - - if (cols < MINWIDTH) - cols = MINWIDTH; - if (! [self isFullscreen]) { extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) - + FRAME_TOOLBAR_HEIGHT (emacsframe) - gsextra; + + FRAME_TOOLBAR_HEIGHT (emacsframe); } - rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, wr.size.height - extra); - - if (rows < MINHEIGHT) - rows = MINHEIGHT; - neww = (int)wr.size.width - emacsframe->border_width; newh = (int)wr.size.height - extra; + cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, neww); + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, newh); + + if (cols < MINWIDTH) + cols = MINWIDTH; + + if (rows < MINHEIGHT) + rows = MINHEIGHT; + if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) { NSView *view = FRAME_NS_VIEW (emacsframe); NSWindow *win = [view window]; NSSize sz = [win resizeIncrements]; - FRAME_PIXEL_WIDTH (emacsframe) = neww; - FRAME_PIXEL_HEIGHT (emacsframe) = newh; - change_frame_size (emacsframe, cols, rows, 0, delay, 0, 0); + change_frame_size (emacsframe, + FRAME_PIXEL_TO_TEXT_WIDTH (emacsframe, neww), + FRAME_PIXEL_TO_TEXT_HEIGHT (emacsframe, newh), + 0, delay, 0, 1); SET_FRAME_GARBAGED (emacsframe); cancel_mouse_face (emacsframe); @@ -5717,10 +5717,6 @@ /* normalize frame to gridded text size */ { int extra = 0; - int gsextra = 0; -#ifdef NS_IMPL_GNUSTEP - gsextra = 3; -#endif NSTRACE (windowWillResize); /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ @@ -5738,8 +5734,13 @@ if (fs_state == FULLSCREEN_NONE) maximized_width = maximized_height = -1; - cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, - frameSize.width + gsextra); + if (! [self isFullscreen]) + { + extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + + FRAME_TOOLBAR_HEIGHT (emacsframe); + } + + cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, frameSize.width); if (cols < MINWIDTH) cols = MINWIDTH; @@ -7335,6 +7336,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) { struct font *font = XFONT_OBJECT (font_object); + EmacsView *view = FRAME_NS_VIEW (f); if (fontset < 0) fontset = fontset_from_font (font_object); @@ -7367,8 +7369,9 @@ } /* Now make the frame display the given font. */ - if (FRAME_NS_WINDOW (f) != 0) - x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f), 0); + if (FRAME_NS_WINDOW (f) != 0 && ! [view isFullscreen]) + x_set_window_size (f, 0, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), + FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 1); return font_object; } ------------------------------------------------------------ revno: 115404 committer: Dani Moncayo branch nick: trunk timestamp: Sat 2013-12-07 14:02:09 +0100 message: build-aux/msys-to-w32: Fix a typo in a comment. diff: === modified file 'build-aux/msys-to-w32' --- build-aux/msys-to-w32 2013-11-30 15:42:13 +0000 +++ build-aux/msys-to-w32 2013-12-07 13:02:09 +0000 @@ -110,7 +110,7 @@ # The path exists, so just translate it w32p=`cd "$p" && pwd -W` else - # The path does not exists. So, try to guess the + # The path does not exist. So, try to guess the # Windows-native translation, by looking for the deepest # existing directory in this path, and then translating the # existing part and concatenating the remainder. ------------------------------------------------------------ revno: 115403 committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Sat 2013-12-07 02:44:15 +0100 message: * net/shr.el (shr-tag-img): Don't bug out on data. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-06 15:34:06 +0000 +++ lisp/ChangeLog 2013-12-07 01:44:15 +0000 @@ -1,3 +1,8 @@ +2013-12-07 Lars Magne Ingebrigtsen + + * net/shr.el (shr-tag-img): Don't bug out on + data. + 2013-12-06 Michael Albinus * progmodes/compile.el (compilation-start): === modified file 'lisp/net/shr.el' --- lisp/net/shr.el 2013-12-01 22:33:13 +0000 +++ lisp/net/shr.el 2013-12-07 01:44:15 +0000 @@ -1173,7 +1173,7 @@ (defun shr-tag-img (cont &optional url) (when (or url (and cont - (cdr (assq :src cont)))) + (> (length (cdr (assq :src cont))) 0))) (when (and (> (current-column) 0) (not (eq shr-state 'image))) (insert "\n"))