Now on revision 114077. ------------------------------------------------------------ revno: 114077 fixes bug: http://debbugs.gnu.org/15220 committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-08-30 13:40:39 -0400 message: * bytecomp.el (byte-recompile-directory): Fix is-this-a-directory logic. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-29 21:00:18 +0000 +++ lisp/ChangeLog 2013-08-30 17:40:39 +0000 @@ -1,3 +1,8 @@ +2013-08-30 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-recompile-directory): + Fix is-this-a-directory logic. (Bug#15220) + 2013-08-29 Stefan Monnier * textmodes/css-mode.el: Use SMIE. === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2013-08-16 06:53:41 +0000 +++ lisp/emacs-lisp/bytecomp.el 2013-08-30 17:40:39 +0000 @@ -1,7 +1,7 @@ ;;; bytecomp.el --- compilation of Lisp code into byte code -*- lexical-binding: t -*- -;; Copyright (C) 1985-1987, 1992, 1994, 1998, 2000-2013 Free Software -;; Foundation, Inc. +;; Copyright (C) 1985-1987, 1992, 1994, 1998, 2000-2013 +;; Free Software Foundation, Inc. ;; Author: Jamie Zawinski ;; Hallvard Furuseth @@ -1593,14 +1593,14 @@ (message "Checking %s..." directory) (dolist (file (directory-files directory)) (let ((source (expand-file-name file directory))) - (if (and (not (member file '("RCS" "CVS"))) - (not (eq ?\. (aref file 0))) - (file-directory-p source) - (not (file-symlink-p source))) - ;; This file is a subdirectory. Handle them differently. - (when (or (null arg) (eq 0 arg) - (y-or-n-p (concat "Check " source "? "))) - (setq directories (nconc directories (list source)))) + (if (file-directory-p source) + (and (not (member file '("RCS" "CVS"))) + (not (eq ?\. (aref file 0))) + (not (file-symlink-p source)) + ;; This file is a subdirectory. Handle them differently. + (or (null arg) (eq 0 arg) + (y-or-n-p (concat "Check " source "? "))) + (setq directories (nconc directories (list source)))) ;; It is an ordinary file. Decide whether to compile it. (if (and (string-match emacs-lisp-file-regexp source) ;; The next 2 tests avoid compiling lock files ------------------------------------------------------------ revno: 114076 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-08-30 16:17:44 +0400 message: Minor cleanup to avoid forward declarations. * coding.h (struct ccl_spec): Remove forward declaration. * composite.h (toplevel): Include font.h. (struct composition_it, struct face, struct font_metrics): Remove forward declaration. * dispextern.h (struct image, struct atimer): Likewise. * emacsgtkfixed.h (struct frame): Likewise. * emacsgtkfixed.c (toplevel): Reorder headers and drop stdio.h. * font.h (struct font_driver, struct font, struct glyph_string) (struct face): Remove forward declaration. * fontset.h (struct face, struct font): Likewise. * frame.h (toplevel): Style cleanup. (enum output_method): Move to... * termhooks.h (enum output_method): ...here. (struct glyph, struct frame, struct ns_display_info) (struct x_display_info, struct w32_display_info): Remove forward declaration. * xterm.h (toplevel): Include termhooks.h. (struct font, struct window, struct glyph_matrix, struct frame) (struct input_event, struct face, struct image): Remove forward declaration. * gtkutil.h (struct _widget_value): Likewise. * keyboard.h (toplevel): Include termhooks.h. (struct input_event): Remove forward declaration. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-29 16:36:54 +0000 +++ src/ChangeLog 2013-08-30 12:17:44 +0000 @@ -1,3 +1,30 @@ +2013-08-30 Dmitry Antipov + + Minor cleanup to avoid forward declarations. + * coding.h (struct ccl_spec): Remove forward declaration. + * composite.h (toplevel): Include font.h. + (struct composition_it, struct face, struct font_metrics): + Remove forward declaration. + * dispextern.h (struct image, struct atimer): Likewise. + * emacsgtkfixed.h (struct frame): Likewise. + * emacsgtkfixed.c (toplevel): Reorder headers and drop stdio.h. + * font.h (struct font_driver, struct font, struct glyph_string) + (struct face): Remove forward declaration. + * fontset.h (struct face, struct font): Likewise. + * frame.h (toplevel): Style cleanup. + (enum output_method): Move to... + * termhooks.h (enum output_method): ...here. + (struct glyph, struct frame, struct ns_display_info) + (struct x_display_info, struct w32_display_info): + Remove forward declaration. + * xterm.h (toplevel): Include termhooks.h. + (struct font, struct window, struct glyph_matrix, struct frame) + (struct input_event, struct face, struct image): Remove forward + declaration. + * gtkutil.h (struct _widget_value): Likewise. + * keyboard.h (toplevel): Include termhooks.h. + (struct input_event): Remove forward declaration. + 2013-08-29 Dmitry Antipov * intervals.c (set_point_from_marker): New function. === modified file 'src/coding.h' --- src/coding.h 2013-06-29 15:52:20 +0000 +++ src/coding.h 2013-08-30 12:17:44 +0000 @@ -378,8 +378,6 @@ struct composition_status cmp_status; }; -struct ccl_spec; - struct undecided_spec { /* Inhibit null byte detection. 1 means always inhibit, === modified file 'src/composite.h' --- src/composite.h 2013-08-03 21:09:57 +0000 +++ src/composite.h 2013-08-30 12:17:44 +0000 @@ -25,6 +25,8 @@ #ifndef EMACS_COMPOSITE_H #define EMACS_COMPOSITE_H +#include "font.h" + INLINE_HEADER_BEGIN #ifndef COMPOSITE_INLINE # define COMPOSITE_INLINE INLINE @@ -312,10 +314,6 @@ #define LGLYPH_WADJUST(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \ ? XINT (AREF (LGLYPH_ADJUSTMENT (g), 2)) : 0) -struct composition_it; -struct face; -struct font_metrics; - extern Lisp_Object composition_gstring_put_cache (Lisp_Object, ptrdiff_t); extern Lisp_Object composition_gstring_from_id (ptrdiff_t); extern bool composition_gstring_p (Lisp_Object); === modified file 'src/dispextern.h' --- src/dispextern.h 2013-08-28 11:00:03 +0000 +++ src/dispextern.h 2013-08-30 12:17:44 +0000 @@ -2869,11 +2869,6 @@ #ifdef HAVE_WINDOW_SYSTEM -/* Structure forward declarations. */ - -struct image; - - /* Each image format (JPEG, TIFF, ...) supported is described by a structure of the type below. */ @@ -3401,8 +3396,6 @@ extern void start_hourglass (void); extern void cancel_hourglass (void); extern int hourglass_shown_p; - -struct atimer; /* Defined in atimer.h. */ /* If non-null, an asynchronous timer that, when it expires, displays an hourglass cursor on all frames. */ extern struct atimer *hourglass_atimer; === modified file 'src/emacsgtkfixed.c' --- src/emacsgtkfixed.c 2013-07-23 06:38:51 +0000 +++ src/emacsgtkfixed.c 2013-08-30 12:17:44 +0000 @@ -20,12 +20,10 @@ #include -#include "emacsgtkfixed.h" -#include - #include "lisp.h" #include "frame.h" #include "xterm.h" +#include "emacsgtkfixed.h" /* Silence a bogus diagnostic; see GNOME bug 683906. */ #if 4 < __GNUC__ + (7 <= __GNUC_MINOR__) === modified file 'src/emacsgtkfixed.h' --- src/emacsgtkfixed.h 2013-01-01 09:11:05 +0000 +++ src/emacsgtkfixed.h 2013-08-30 12:17:44 +0000 @@ -25,8 +25,6 @@ G_BEGIN_DECLS -struct frame; - extern GtkWidget *emacs_fixed_new (struct frame *f); G_END_DECLS === modified file 'src/font.h' --- src/font.h 2013-08-13 08:18:11 +0000 +++ src/font.h 2013-08-30 12:17:44 +0000 @@ -56,11 +56,6 @@ extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; - -struct font_driver; -struct font; -struct glyph_string; - /* An enumerator for each font property. This is used as an index to the vector of FONT-SPEC and FONT-ENTITY. @@ -487,8 +482,6 @@ this value. */ #define FONT_PIXEL_SIZE_QUANTUM 1 -struct face; - #define FONT_INVALID_CODE 0xFFFFFFFF /* Font driver. Members specified as "optional" can be NULL. */ === modified file 'src/fontset.h' --- src/fontset.h 2013-08-03 03:29:03 +0000 +++ src/fontset.h 2013-08-30 12:17:44 +0000 @@ -26,8 +26,6 @@ #ifndef EMACS_FONTSET_H #define EMACS_FONTSET_H -struct face; - extern void free_face_fontset (struct frame *, struct face *); extern int face_for_char (struct frame *, struct face *, int, int, Lisp_Object); @@ -42,7 +40,6 @@ extern Lisp_Object fontset_name (int); extern Lisp_Object fontset_ascii (int); -struct font; extern int face_for_font (struct frame *, Lisp_Object, struct face *); #endif /* EMACS_FONTSET_H */ === modified file 'src/frame.h' --- src/frame.h 2013-08-23 04:03:25 +0000 +++ src/frame.h 2013-08-30 12:17:44 +0000 @@ -24,31 +24,13 @@ #define EMACS_FRAME_H #include "dispextern.h" +#include "termhooks.h" INLINE_HEADER_BEGIN #ifndef FRAME_INLINE # define FRAME_INLINE INLINE #endif - -/* Miscellanea. */ - -/* Nonzero means there is at least one garbaged frame. */ -extern bool frame_garbaged; - - -/* The structure representing a frame. */ - -enum output_method -{ - output_initial, - output_termcap, - output_x_window, - output_msdos_raw, - output_w32, - output_ns -}; - enum vertical_scroll_bar_type { vertical_scroll_bar_none, @@ -66,10 +48,7 @@ FULLSCREEN_WAIT = 0x100 }; - -#define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel) -#define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel) - +/* The structure representing a frame. */ struct frame { @@ -884,6 +863,9 @@ #define FRAME_CURSOR_WIDTH(f) ((f)->cursor_width) #define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->blink_off_cursor_width) +#define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel) +#define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel) + /* Return a pointer to the face cache of frame F. */ #define FRAME_FACE_CACHE(F) (F)->face_cache @@ -950,6 +932,9 @@ extern Lisp_Object Qterminal; extern Lisp_Object Qnoelisp; +/* Nonzero means there is at least one garbaged frame. */ +extern bool frame_garbaged; + extern struct frame *last_nonminibuf_frame; extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); === modified file 'src/gtkutil.h' --- src/gtkutil.h 2013-08-03 03:29:03 +0000 +++ src/gtkutil.h 2013-08-30 12:17:44 +0000 @@ -74,8 +74,6 @@ } xg_menu_item_cb_data; -struct _widget_value; - extern struct _widget_value *malloc_widget_value (void); extern void free_widget_value (struct _widget_value *); === modified file 'src/keyboard.h' --- src/keyboard.h 2013-08-27 18:47:55 +0000 +++ src/keyboard.h 2013-08-30 12:17:44 +0000 @@ -19,6 +19,7 @@ #include "systime.h" /* for struct timespec, Time */ #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ +#include "termhooks.h" INLINE_HEADER_BEGIN #ifndef KEYBOARD_INLINE @@ -477,9 +478,6 @@ /* The primary selection. */ extern Lisp_Object QPRIMARY; -/* Forward declaration for prototypes. */ -struct input_event; - extern Lisp_Object parse_modifiers (Lisp_Object); extern Lisp_Object reorder_modifiers (Lisp_Object); extern Lisp_Object read_char (int, Lisp_Object, Lisp_Object, === modified file 'src/termhooks.h' --- src/termhooks.h 2013-07-16 11:41:06 +0000 +++ src/termhooks.h 2013-08-30 12:17:44 +0000 @@ -18,7 +18,9 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ - +#ifndef EMACS_TERMHOOKS_H +#define EMACS_TERMHOOKS_H + /* Miscellanea. */ #include "systime.h" /* for Time */ @@ -28,10 +30,6 @@ # define TERMHOOKS_INLINE INLINE #endif -struct glyph; -struct frame; - - enum scroll_bar_part { scroll_bar_above_handle, scroll_bar_handle, @@ -49,7 +47,18 @@ may do something OS dependent, like extended window manager hints on X11. */ extern void (*fullscreen_hook) (struct frame *f); - +/* Output method of a terminal (and frames on this terminal, respectively). */ + +enum output_method +{ + output_initial, + output_termcap, + output_x_window, + output_msdos_raw, + output_w32, + output_ns +}; + /* Input queue declarations and hooks. */ enum event_kind @@ -321,11 +330,6 @@ extern struct tty_display_info *gpm_tty; #endif - -struct ns_display_info; -struct x_display_info; -struct w32_display_info; - /* Terminal-local parameters. */ struct terminal { @@ -660,3 +664,5 @@ #endif INLINE_HEADER_END + +#endif /* EMACS_TERMHOOKS_H */ === modified file 'src/xterm.h' --- src/xterm.h 2013-08-29 07:27:27 +0000 +++ src/xterm.h 2013-08-30 12:17:44 +0000 @@ -20,8 +20,6 @@ #ifndef XTERM_H #define XTERM_H -#include "dispextern.h" - #include #include @@ -73,14 +71,13 @@ #define USE_GTK_TOOLTIP #endif - -/* Bookkeeping to distinguish X versions. */ - - #ifdef HAVE_X_I18N #include #endif - + +#include "dispextern.h" +#include "termhooks.h" + #define BLACK_PIX_DEFAULT(f) BlackPixel (FRAME_X_DISPLAY (f), \ XScreenNumberOfScreen (FRAME_X_SCREEN (f))) #define WHITE_PIX_DEFAULT(f) WhitePixel (FRAME_X_DISPLAY (f), \ @@ -409,9 +406,6 @@ extern void select_visual (struct x_display_info *); - -struct font; - /* Each X frame object points to its own struct x_output object in the output_data.x field. The x_output structure contains the information that is specific to X windows. */ @@ -919,14 +913,6 @@ #define SELECTION_EVENT_TIME(eventp) \ (((struct selection_input_event *) (eventp))->time) - -struct window; -struct glyph_matrix; -struct frame; -struct input_event; -struct face; -struct image; - /* From xselect.c. */ void x_handle_selection_notify (XSelectionEvent *); ------------------------------------------------------------ revno: 114075 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-08-29 17:00:18 -0400 message: * lisp/textmodes/css-mode.el: Use SMIE. (css-smie-grammar): New var. (css-smie--forward-token, css-smie--backward-token) (css-smie-rules): New functions. (css-mode): Use them. (css-navigation-syntax-table): Remove var. (css-backward-sexp, css-forward-sexp, css-indent-calculate-virtual) (css-indent-calculate, css-indent-line): Remove functions. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-29 19:18:16 +0000 +++ lisp/ChangeLog 2013-08-29 21:00:18 +0000 @@ -1,5 +1,32 @@ 2013-08-29 Stefan Monnier + * textmodes/css-mode.el: Use SMIE. + (css-smie-grammar): New var. + (css-smie--forward-token, css-smie--backward-token) + (css-smie-rules): New functions. + (css-mode): Use them. + (css-navigation-syntax-table): Remove var. + (css-backward-sexp, css-forward-sexp, css-indent-calculate-virtual) + (css-indent-calculate, css-indent-line): Remove functions. + + Misc changes to reduce use of `(lambda...); and other cleanups. + * cus-edit.el: Use lexical-binding. + (customize-push-and-save, customize-apropos) + (custom-buffer-create-internal): Use closures. + * progmodes/bat-mode.el (bat-mode-syntax-table): "..." are strings. + * progmodes/ada-xref.el: Use setq. + * net/tramp.el (with-tramp-progress-reporter): Avoid setq. + * dframe.el: Use lexical-binding. + (dframe-frame-mode): Fix calling convention for hooks. Use a closure. + * speedbar.el (speedbar-frame-mode): Adjust call accordingly. + * descr-text.el: Use lexical-binding. + (describe-text-widget, describe-text-sexp, describe-property-list): + Use closures. + * comint.el (comint-history-isearch-push-state): Use a closure. + * calculator.el: Use lexical-binding. + (calculator-number-to-string): Make it work with lexical-binding. + (calculator-funcall): Same and use cl-letf. + * emacs-lisp/lisp.el (lisp--company-doc-buffer) (lisp--company-doc-string, lisp--company-location): New functions. (lisp-completion-at-point): Use them to improve Company support. === modified file 'lisp/textmodes/css-mode.el' --- lisp/textmodes/css-mode.el 2013-01-02 16:13:04 +0000 +++ lisp/textmodes/css-mode.el 2013-08-29 21:00:18 +0000 @@ -263,6 +263,48 @@ (defvar css-font-lock-defaults '(css-font-lock-keywords nil t)) +(defcustom css-indent-offset 4 + "Basic size of one indentation step." + :version "22.2" + :type 'integer) + +(require 'smie) + +(defconst css-smie-grammar + (smie-prec2->grammar + (smie-precs->prec2 '((assoc ";") (assoc ",") (left ":"))))) + +(defun css-smie--forward-token () + (cond + ((and (eq (char-before) ?\}) + ;; FIXME: If the next char is not whitespace, what should we do? + (or (memq (char-after) '(?\s ?\t ?\n)) + (looking-at comment-start-skip))) + (if (memq (char-after) '(?\s ?\t ?\n)) + (forward-char 1) (forward-comment 1)) + ";") + ((progn (forward-comment (point-max)) + (looking-at "[;,:]")) + (forward-char 1) (match-string 0)) + (t (smie-default-forward-token)))) + +(defun css-smie--backward-token () + (let ((pos (point))) + (forward-comment (- (point))) + (cond + ;; FIXME: If the next char is not whitespace, what should we do? + ((and (eq (char-before) ?\}) (> pos (point))) ";") + ((memq (char-before) '(?\; ?\, ?\:)) + (forward-char -1) (string (char-after))) + (t (smie-default-backward-token))))) + +(defun css-smie-rules (kind token) + (pcase (cons kind token) + (`(:elem . basic) css-indent-offset) + (`(:elem . arg) 0) + (`(:before . "{") (if (smie-rule-hanging-p) + (smie-rule-parent 0))))) + ;;;###autoload (define-derived-mode css-mode fundamental-mode "CSS" "Major mode to edit Cascading Style Sheets." @@ -271,11 +313,13 @@ (setq-local comment-start-skip "/\\*+[ \t]*") (setq-local comment-end "*/") (setq-local comment-end-skip "[ \t]*\\*+/") - (setq-local forward-sexp-function 'css-forward-sexp) (setq-local parse-sexp-ignore-comments t) (setq-local indent-line-function 'css-indent-line) (setq-local fill-paragraph-function 'css-fill-paragraph) (setq-local add-log-current-defun-function #'css-current-defun-name) + (smie-setup css-smie-grammar #'css-smie-rules + :forward-token #'css-smie--forward-token + :backward-token #'css-smie--backward-token) (when css-electric-keys (let ((fc (make-char-table 'auto-fill-chars))) (set-char-table-parent fc auto-fill-chars) @@ -355,132 +399,6 @@ ;; Don't use the default filling code. t))))))) -;;; Navigation and indentation. - -(defconst css-navigation-syntax-table - (let ((st (make-syntax-table css-mode-syntax-table))) - (map-char-table (lambda (c v) - ;; Turn punctuation (code = 1) into symbol (code = 1). - (if (eq (car-safe v) 1) - (set-char-table-range st c (cons 3 (cdr v))))) - st) - st)) - -(defun css-backward-sexp (n) - (let ((forward-sexp-function nil)) - (if (< n 0) (css-forward-sexp (- n)) - (while (> n 0) - (setq n (1- n)) - (forward-comment (- (point-max))) - (if (not (eq (char-before) ?\;)) - (backward-sexp 1) - (while (progn (backward-sexp 1) - (save-excursion - (forward-comment (- (point-max))) - ;; FIXME: We should also skip punctuation. - (not (or (bobp) (memq (char-before) '(?\; ?\{)))))))))))) - -(defun css-forward-sexp (n) - (let ((forward-sexp-function nil)) - (if (< n 0) (css-backward-sexp (- n)) - (while (> n 0) - (setq n (1- n)) - (forward-comment (point-max)) - (if (not (eq (char-after) ?\;)) - (forward-sexp 1) - (while (progn (forward-sexp 1) - (save-excursion - (forward-comment (point-max)) - ;; FIXME: We should also skip punctuation. - (not (memq (char-after) '(?\; ?\}))))))))))) - -(defun css-indent-calculate-virtual () - (if (or (save-excursion (skip-chars-backward " \t") (bolp)) - (if (looking-at "\\s(") - (save-excursion - (forward-char 1) (skip-chars-forward " \t") - (not (or (eolp) (looking-at comment-start-skip)))))) - (current-column) - (css-indent-calculate))) - -(defcustom css-indent-offset 4 - "Basic size of one indentation step." - :version "22.2" - :type 'integer - :group 'css) - -(defun css-indent-calculate () - (let ((ppss (syntax-ppss)) - pos) - (with-syntax-table css-navigation-syntax-table - (save-excursion - (cond - ;; Inside a string. - ((nth 3 ppss) 'noindent) - ;; Inside a comment. - ((nth 4 ppss) - (setq pos (point)) - (forward-line -1) - (skip-chars-forward " \t") - (if (>= (nth 8 ppss) (point)) - (progn - (goto-char (nth 8 ppss)) - (if (eq (char-after pos) ?*) - (forward-char 1) - (if (not (looking-at comment-start-skip)) - (error "Internal css-mode error") - (goto-char (match-end 0)))) - (current-column)) - (if (and (eq (char-after pos) ?*) (eq (char-after) ?*)) - (current-column) - ;; 'noindent - (current-column) - ))) - ;; In normal code. - (t - (or - (when (looking-at "\\s)") - (forward-char 1) - (backward-sexp 1) - (css-indent-calculate-virtual)) - (when (looking-at comment-start-skip) - (forward-comment (point-max)) - (css-indent-calculate)) - (when (save-excursion (forward-comment (- (point-max))) - (setq pos (point)) - (eq (char-syntax (preceding-char)) ?\()) - (goto-char (1- pos)) - (if (not (looking-at "\\s([ \t]*")) - (error "Internal css-mode error") - (if (or (memq (char-after (match-end 0)) '(?\n nil)) - (save-excursion (goto-char (match-end 0)) - (looking-at comment-start-skip))) - (+ (css-indent-calculate-virtual) css-indent-offset) - (progn (goto-char (match-end 0)) (current-column))))) - (progn - (css-backward-sexp 1) - (if (looking-at "\\s(") - (css-indent-calculate) - (css-indent-calculate-virtual)))))))))) - - -(defun css-indent-line () - "Indent current line according to CSS indentation rules." - (interactive) - (let* ((savep (point)) - (forward-sexp-function nil) - (indent (condition-case nil - (save-excursion - (forward-line 0) - (skip-chars-forward " \t") - (if (>= (point) savep) (setq savep nil)) - (css-indent-calculate)) - (error nil)))) - (if (not (numberp indent)) 'noindent - (if savep - (save-excursion (indent-line-to indent)) - (indent-line-to indent))))) - (defun css-current-defun-name () "Return the name of the CSS section at point, or nil." (save-excursion