Stefan Monnier [Mon, 5 Jan 2015 04:11:37 +0000 (23:11 -0500)]
* lisp/emacs-lisp/eieio*.el: Use class objects in `parent' field.
* lisp/emacs-lisp/eieio-core.el (eieio-class-object): New function.
(eieio-class-parents-fast): Remove macro.
(eieio--class-option-assoc): Rename from class-option-assoc.
Update all callers.
(eieio--class-option): Rename from class-option. Change `class' arg to
be a class object. Update all callers.
(eieio--class-method-invocation-order): Rename from
class-method-invocation-order. Change `class' arg to be a class
object. Update all callers.
(eieio-defclass-autoload, eieio-defclass): Set the `parent' field to
a list of class objects rather than names.
(eieio-defclass): Remove redundant quotes. Use `eieio-oref-default'
for accessors to class allocated slots.
(eieio--perform-slot-validation-for-default): Rename from
eieio-perform-slot-validation-for-default. Update all callers.
(eieio--add-new-slot): Rename from eieio-add-new-slot.
Update all callers. Use push.
(eieio-copy-parents-into-subclass): Adjust to new content of
`parent' field. Use dolist.
(eieio-oref): Remove support for providing a class rather than
an object.
(eieio-oref-default): Prefer class objects over class names.
(eieio--slot-originating-class-p): Rename from
eieio-slot-originating-class-p. Update all callers. Use `or'.
(eieio--slot-name-index): Turn check into assertion.
(eieio--class-slot-name-index): Rename from
eieio-class-slot-name-index. Change `class' arg to be a class object.
Update all callers.
(eieio-attribute-to-initarg): Move to eieio-test-persist.el.
(eieio--c3-candidate): Rename from eieio-c3-candidate.
Update all callers.
(eieio--c3-merge-lists): Rename from eieio-c3-merge-lists.
Update all callers.
(eieio--class-precedence-c3): Rename from eieio-class-precedence-c3.
Update all callers.
(eieio--class-precedence-dfs): Rename from eieio-class-precedence-dfs.
Update all callers.
(eieio--class-precedence-bfs): Rename from eieio-class-precedence-bfs.
Update all callers. Adjust to new `parent' content.
(eieio--class-precedence-list): Rename from -class-precedence-list.
Update all callers.
(eieio-generic-call): Use autoloadp and autoload-do-load.
Slight simplification.
(eieio-generic-call, eieio-generic-call-primary-only): Adjust to new
return value of `eieio-generic-form'.
(eieiomt-add): Index the hashtable with class objects rather than
class names.
(eieio-generic-form): Accept class objects as well.
* lisp/emacs-lisp/eieio.el (eieio-class-parents): Accept class objects.
(eieio--class-slot-initarg): Rename from class-slot-initarg.
Change `class' arg to be a class object. Update all callers.
(call-next-method): Adjust to new return value of `eieio-generic-form'.
(eieio-default-superclass): Set var to the class object.
(eieio-edebug-prin1-to-string): Fix recursive call for lists.
Change print behavior to affect class objects rather than
class symbols.
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-convert-list-to-object):
Adjust to new convention for eieio-persistent-validate/fix-slot-value.
(eieio-persistent-validate/fix-slot-value):
Change `class' arg to be a class object. Update all callers.
* test/automated/eieio-test-persist.el (eieio--attribute-to-initarg):
Move from eieio-core.el. Rename from eieio-attribute-to-initarg.
Change arg to be a class object. Update all callers.
* test/automated/eieio-tests.el (eieio-test-04-static-method)
(eieio-test-05-static-method-2): Use oref-default to access
class slots.
(eieio-test-23-inheritance-check): Don't assume that
eieio-class-parents returns class names, or that a class can only have
a single name.
Stefan Monnier [Mon, 29 Dec 2014 17:11:09 +0000 (12:11 -0500)]
lisp/emacs-lisp/eieio*.el: Reduce object header to 1 slot
* lisp/emacs-lisp/eieio-core.el (eieio--with-scoped-class): Use let-binding.
(object): Remove first (constant) slot; rename second to `class-tag'.
(eieio--object-class-object, eieio--object-class-name): New funs
to replace eieio--object-class.
(eieio--class-object, eieio--class-p): New functions.
(same-class-fast-p): Make it a defsubst, change its implementation
to check the class objects rather than their names.
(eieio-object-p): Rewrite.
(eieio-defclass): Adjust the object initialization according to the new
object layout.
(eieio--scoped-class): Declare it returns a class object (not a class
name any more). Adjust calls accordingly (along with calls to
eieio--with-scoped-class).
(eieio--slot-name-index): Rename from eieio-slot-name-index and change
its class arg to be a class object. Adjust callers accordingly.
(eieio-slot-originating-class-p): Make its start-class arg a class
object. Adjust all callers.
(eieio--initarg-to-attribute): Rename from eieio-initarg-to-attribute.
Make its `class' arg a class object. Adjust all callers.
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-validate/fix-slot-value):
Use eieio--slot-name-index rather than eieio-slot-name-index.
* lisp/emacs-lisp/eieio.el (child-of-class-p): Make it accept class objects
additionally to class names.
* test/automated/eieio-test-methodinvoke.el (eieio-test-method-store):
Adjust to new semantics of eieio--scoped-class.
(eieio-test-match): Improve error feedback.
Stefan Monnier [Tue, 23 Dec 2014 03:05:46 +0000 (22:05 -0500)]
* lisp/emacs-lisp/eieio*.el: Remove "name" field of objects
* lisp/emacs-lisp/eieio-base.el (clone) <eieio-instance-inheritor>:
Use call-next-method.
(eieio-constructor): Rename from `constructor'.
(eieio-persistent-convert-list-to-object): Drop objname.
(eieio-persistent-validate/fix-slot-value): Don't hardcode
eieio--object-num-slots.
(eieio-named): Use a normal slot.
(slot-missing) <eieio-named>: Remove.
(eieio-object-name-string, eieio-object-set-name-string, clone)
<eieio-named>: New methods.
* lisp/emacs-lisp/eieio-core.el (eieio--defalias): Follow aliases.
(eieio--object): Remove `name' field.
(eieio-defclass): Adjust to new convention where constructors don't
take an "object name" any more.
(eieio--defgeneric-init-form, eieio--defmethod): Follow aliases.
(eieio-validate-slot-value, eieio-oset-default)
(eieio-slot-name-index): Don't hardcode eieio--object-num-slots.
(eieio-generic-call-primary-only): Simplify.
* lisp/emacs-lisp/eieio-custom.el (eieio-widget-test): Remove dummy arg.
(eieio-object-value-get): Use eieio-object-set-name-string.
* lisp/emacs-lisp/eieio.el (make-instance): Simplify by not adding an object
name argument.
(eieio-object-name): Use eieio-object-name-string.
(eieio--object-names): New const.
(eieio-object-name-string, eieio-object-set-name-string): Re-implement
using a hashtable rather than a built-in slot.
(eieio-constructor): Rename from `constructor'. Remove `newname' arg.
(clone): Don't mess with the object's "name".
* test/automated/eieio-test-persist.el (persistent-with-objs-slot-subs):
The type FOO-child is the same as FOO.
Stefan Monnier [Mon, 22 Dec 2014 20:13:02 +0000 (15:13 -0500)]
* lisp/emacs-lisp/eieio*.el: Use hashtables rather than obarrays
* lisp/emacs-lisp/eieio-core.el (class): Rename field symbol-obarray to
symbol-hashtable. It contains a hashtable instead of an obarray.
(generic-p): Use symbol property `eieio-method-hashtable' instead of
`eieio-method-obarray'.
(generic-primary-only-p, generic-primary-only-one-p):
Slight optimization.
(eieio-defclass-autoload-map): Use a hashtable instead of an obarray.
(eieio-defclass-autoload, eieio-defclass): Adjust/simplify accordingly.
(eieio-class-un-autoload): Use autoload-do-load.
(eieio-defclass): Use dolist, cl-pushnew, cl-callf.
Use new cl-deftype-satisfies. Adjust to use of hashtables.
Don't hardcode the value of eieio--object-num-slots.
(eieio-defgeneric-form-primary-only-one): Remove `doc-string' arg.
Use a closure rather than a backquoted lambda.
(eieio--defmethod): Adjust call accordingly. Set doc-string via the
function-documentation property.
(eieio-slot-originating-class-p, eieio-slot-name-index)
(eieiomt--optimizing-hashtable, eieiomt-install, eieiomt-add)
(eieio-generic-form): Adjust to use of hashtables.
(eieiomt--sym-optimize): Rename from eieiomt-sym-optimize; take
additional class argument.
(eieio-generic-call-methodname): Remove, unused.
* lisp/emacs-lisp/eieio-custom.el: Use lexical-binding.
(eieio-object-value-to-abstract): Simplify.
* lisp/emacs-lisp/eieio-datadebug.el: Use lexical-binding.
* lisp/emacs-lisp/eieio-opt.el (eieio-build-class-list): Use cl-mapcan.
(eieio-build-class-alist): Use dolist.
(eieio-all-generic-functions): Adjust to use of hashtables.
* lisp/emacs-lisp/eieio.el (child-of-class-p): Fix case where `class' is
`eieio-default-superclass'.
* test/automated/eieio-test-methodinvoke.el (eieio-test-method-store):
Remove use of eieio-generic-call-methodname.
(eieio-test-method-order-list-3, eieio-test-method-order-list-6)
(eieio-test-method-order-list-7, eieio-test-method-order-list-8):
Adjust the expected result accordingly.
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-slot-type-is-class-p):
Prefer \' to $.
Stefan Monnier [Mon, 22 Dec 2014 17:35:29 +0000 (12:35 -0500)]
* lisp/completion.el: Use post-self-insert-hook.
Fixes: debbugs:19400
(completion-separator-self-insert-command)
(completion-separator-self-insert-autofilling): Remove.
(completion-separator-chars): New var.
(completion-c-mode-hook, completion-setup-fortran-mode): Use it instead
of changing the keymap.
(completion--post-self-insert): New function.
(dynamic-completion-mode): Use it instead of rebinding keys.
(cmpl--completion-string): Rename from completion-string.
(add-completion-to-head, delete-completion): Let-bind it explicitly.
Paul Eggert [Sat, 20 Dec 2014 23:20:56 +0000 (15:20 -0800)]
Let charset tick grow past USHRT_MAX
* charset.c, charset.h (charset_ordered_list_tick):
Now EMACS_UINT, not unsigned short.
* fontset.c (reorder_font_vector): Allow the tick to grow to the
maximum representable Emacs integer value before wrapping it around.
Paul Eggert [Sat, 20 Dec 2014 21:11:40 +0000 (13:11 -0800)]
Simplify unexec file mode setting
* unexaix.c, unexcoff.c, unexelf.c, unexmacosx.c:
Don't include <sys/stat.h> when no longer needed.
(unexec): Create file with correct mode in the first place,
rather than overwriting the mode later and fiddling with the
global umask in the mean time. Avoid bogus usage like
'umask (777)', which should have been 'umask (0777)'.
(mark_x): Remove. All callers removed.
Paul Eggert [Fri, 19 Dec 2014 02:12:01 +0000 (18:12 -0800)]
Minor cleanups for Lisp objects and symbols
* alloc.c (next_vector, set_next_vector):
* lisp.h (lisp_h_INTEGERP, make_number, XFASTINT, make_natnum):
(lisp_h_make_number) [USE_LSB_TAG]:
Use Lisp_Int0 instead of the mystery constant 0.
* alloc.c (mark_object): Always set and use po; that's simpler.
(CHECK_LIVE, CHECK_ALLOCATED_AND_LIVE):
Properly parenthesize definientia.
* bidi.c (bidi_initialize):
* buffer.c (init_buffer_once):
* nsfns.m (syms_of_nsfns):
* nsmenu.m (syms_of_nsmenu):
* nsselect.m (syms_of_nsselect):
Prefer DEFSYM to defining by hand.
* data.c: Fix too-long line.
* lisp.h (DECLARE_GDB_SYM): New macro.
(DEFINE_GDB_SYMBOL_BEGIN): Use it.
(DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END) [!MAIN_PROGRAM]:
Declare the symbol, so it's visible to everywhere lisp.h is included.
Move forward decls as far forward as they can go,
to allow future changes to use them.
Sam Steingold [Thu, 18 Dec 2014 21:41:34 +0000 (16:41 -0500)]
Keyboard interface (C-f10) to `mouse-buffer-menu' (C-down-mouse-1).
* lisp/mouse.el (mouse-buffer-menu-map): Extract from `mouse-buffer-menu'.
(mouse-buffer-menu): Use `mouse-buffer-menu-map'.
* lisp/menu-bar.el (menu-bar-buffer-vector): Extract from
`menu-bar-update-buffers'.
(menu-bar-update-buffers): Use `menu-bar-buffer-vector'.
(buffer-menu-open): New user command, bound globally to C-f10,
provides a keyboard interface to `mouse-buffer-menu' (C-down-mouse-1).
(mouse-buffer-menu-keymap): Use `menu-bar-buffer-vector' to
convert the value returned by `mouse-buffer-menu-map' to a list
acceptable to `popup-menu' for `buffer-menu-open'.
Stefan Monnier [Thu, 18 Dec 2014 18:19:54 +0000 (13:19 -0500)]
* lisp/gnus/gnus-art.el: Fix up compiler warnings.
(article-display-face, article-display-x-face): Remove unused `face'.
(gnus-article-browse-html-save-cid-content): Remove unused var `type'.
(article-date-ut): Remove unused var `first'.
(gnus-article-prepare): Remove unused var `gnus-article'.
(gnus-mime-save-part-and-strip): Remove unused var `param'.
(gnus-mime-inline-part): Remove unused vars `charset', `contents', and
`coding-system' along with corresponding dead code.
(gnus-mime-view-part-externally): Remove unused var
`mm-user-display-methods'.
(gnus-insert-mime-button): Let-bind gnus-tmp-id explicitly.
(gnus-display-mime): Remove unused var `handle'.
(gnus-mime-display-alternative): Remove unused var `props'.
(gnus-article-read-summary-keys): Remove unused var `up-to-top'.
(gnus-article-edit-done): Remove unused var `p'.
(gnus-url-mailto): Remove unused var `to'.
(gnus-treat-article): Let-bind gnus-treat-condition, part-number,
total-parts, and gnus-treat-type explicitly. Remove unused var `elem'.
* lisp/gnus/mm-util.el (mm-with-unibyte-current-buffer): Mark obsolete and
add warning.
Martin Rudalics [Thu, 18 Dec 2014 17:53:48 +0000 (18:53 +0100)]
Fix ispell window handling.
* textmodes/ispell.el (ispell-command-loop): Suppress horizontal
scroll bar on ispell's windows. Don't count window lines and
don't deal with dedicated windows.
(ispell-show-choices, ispell-help): Let `ispell-display-buffer'
do the window handling.
(ispell-adjusted-window-height, ispell-overlay-window): Remove.
(ispell-display-buffer): New function to reuse, create and fit
window to ispell's buffers. (Bug#3413)
Martin Rudalics [Thu, 18 Dec 2014 17:12:24 +0000 (18:12 +0100)]
Add code for "preserving" window sizes.
* frame.c (frame_windows_min_size): New argument IGNORE.
(adjust_frame_size): When called from change_frame_size call
frame_windows_min_size with IGNORE Qt so we can ignore size
restrictions.
* dired.el (dired-pop-to-buffer): Call fit-window-to-buffer with
`preserve-size' t.
(dired-mark-pop-up): Preserve size of window showing marked
files.
* electric.el (Electric-pop-up-window):
* help.el (resize-temp-buffer-window): Call fit-window-to-buffer
with `preserve-size' t.
* minibuffer.el (minibuffer-completion-help): Use
`resize-temp-buffer-window' instead of `fit-window-to-buffer'
(Bug#19355). Preserve size of completions window.
* register.el (register-preview): Preserve size of register
preview window.
* tmm.el (tmm-add-prompt): Call fit-window-to-buffer
with `preserve-size' t (Bug#1291).
* window.el (with-displayed-buffer-window): Add calls to
`window-preserve-size'.
(window-min-pixel-size, window--preservable-size)
(window-preserve-size, window-preserved-size)
(window--preserve-size, window--min-size-ignore-p): New
functions.
(window-min-size, window-min-delta, window--resizable)
(window--resize-this-window, split-window-below)
(split-window-right): Amend doc-string.
(adjust-window-trailing-edge): Handle preserving window
sizes. Signal user-error instead of an error when there's no
window above or below.
(window--min-size-1, window-sizable, window--size-fixed-1)
(window-size-fixed-p, window--min-delta-1)
(frame-windows-min-size, window--max-delta-1, window-resize)
(window--resize-child-windows, window--resize-siblings)
(enlarge-window, shrink-window, split-window): Handle preserving
window sizes.
(window--state-put-2): Handle horizontal scroll bars.
(window--display-buffer): Call `preserve-size' if asked for.
(display-buffer): Mention `preserve-size' alist member in
doc-string.
(fit-window-to-buffer): New argument PRESERVE-SIZE.
Eli Zaretskii [Thu, 18 Dec 2014 16:07:26 +0000 (18:07 +0200)]
Allow querying font by name for its height and other info. (Bug#19395)
src/font.c (Ffont_info): Add more font information to the vector
returned by the function, inspired by query-font. Doc fix.
doc/lispref/display.texi (Low-Level Font): Document font-info and query-font.
lisp/international/mule-diag.el (describe-font-internal): Display
additional info returned by font-info.
lisp/linum.el (linum--face-width): Rename from linum--face-height,
and use the new functionality of font-info.
(linum-update-window): Use linum--face-width and frame-char-width,
instead of approximating with height.
Eric Abrahamsen [Thu, 18 Dec 2014 11:22:02 +0000 (11:22 +0000)]
Fix Gnus registry pruning and sorting, and rename file
* lisp/gnus/gnus-registry.el (gnus-registry-prune-factor): Add new variable.
(gnus-registry-max-pruned-entries): Remove obsolete variable.
(gnus-registry-cache-file): Change default
filename extension to "eieio".
(gnus-registry-read): Add new function, split out from
`gnus-registry-load', that does the actual object reading.
(gnus-registry-load): Use it. Add condition case handler to check for
old filename extension and rename to the new one.
(gnus-registry-default-sort-function): New variable to specify a sort
function to use when pruning.
(gnus-registry-save, gnus-registry-insert): Use it.
(gnus-registry-sort-by-creation-time): Define a default sort function.
* lisp/gnus/registry.el (registry-db): Consolidate the :max-hard and
:max-soft slots into a :max-size slot.
(registry-db-version): Add new variable for database version number.
(registry-prune): Use :max-size slot. Accept and use a sort-function
argument.
(registry-collect-prune-candidates): Add new function for finding
non-precious pruning candidates.
(registry-prune-hard-candidates, registry-prune-soft-candidates):
Remove obsolete functions.
(initialize-instance): Upgrade registry version when starting.
Dmitry Gutov [Thu, 18 Dec 2014 10:10:34 +0000 (12:10 +0200)]
Don't reload packages at startup
Fixes: debbugs:19390
* lisp/emacs-lisp/package.el (package-activate-1): Add RELOAD argument
and a docstring.
(package-activate): Call itself on dependencies on PACKAGE with
the same FORCE argument. Pass FORCE as RELOAD into
`package-activate-1' .
Ulf Jasper [Wed, 17 Dec 2014 19:50:12 +0000 (20:50 +0100)]
Fix problem with images referenced within svg files. (bug#19373)
Fixes: debbugs:19373
* src/image.c: Additional parameter 'filename' for
svg_load_image. Include "buffer.h". Define library function
rsvg_handle_set_base_uri for WINDOWSNT.
(init_svg_functions): Initialize rsvg_handle_set_base_uri.
(fn_rsvg_handle_set_base_uri): Define fn_rsvg_handle_set_base_uri.
(svg_load): Pass a filename to svg_load_image: either name of
actual file or of current buffer's file.
(svg_load_image): New parameter 'filename', used for setting
base_uri, necessary for loading referenced images.
Juri Linkov [Mon, 15 Dec 2014 23:45:12 +0000 (01:45 +0200)]
Lazy-highlight the whole string at point
* lisp/isearch.el (isearch-lazy-highlight-search): Extend the bound of
the wrapped search by the length of the search string to be able
to lazy-highlight the whole search string at point.
Stefan Monnier [Mon, 15 Dec 2014 20:41:11 +0000 (15:41 -0500)]
* src/: Various fixes to use bool type and constants.
* src/dispnew.c (update_single_window): Remove arg `force_p' since it's
always true.
* src/xfaces.c (clear_face_cache): Use bool for the argument type.
Paul Eggert [Mon, 15 Dec 2014 08:00:50 +0000 (00:00 -0800)]
Correct same_at_end when restoring window points
* fileio.c (Finsert_file_contents): Compute same_at_end character
position using the old buffer size, not the new one, since
restore_window_points wants the old size. Fixes: debbugs:19161
Alan Mackenzie [Sun, 14 Dec 2014 18:26:44 +0000 (18:26 +0000)]
New feature optionally to accelerate auto-repeated scrolling.
src/xdisp.c: Remove "static" from declaration of
Qfontification_functions.
src/window.c (window_scroll): bind fontification-functions to nil when
scrolling by whole screens and fast-but-imprecise-scrolling is non-nil.
(syms_of_window): New DEFVAR_BOOL fast-but-imprecise-scrolling.
Dmitry Gutov [Sun, 14 Dec 2014 10:59:05 +0000 (12:59 +0200)]
Fix Semantic completion-at-point functions in non-Semantic buffers
Fixes: debbugs:19077
* lisp/cedet/semantic.el (semantic-analyze-completion-at-point-function)
(semantic-analyze-notc-completion-at-point-function)
(semantic-analyze-nolongprefix-completion-at-point-function): Do
nothing if the current buffer is not using Semantic.
Paul Eggert [Sun, 14 Dec 2014 07:40:04 +0000 (23:40 -0800)]
Spelling fixes
All uses changed.
* lib-src/etags.c (analyze_regex): Rename from analyse_regex.
* lisp/cedet/semantic/lex-spp.el:
(semantic-lex-spp-analyzer-do-replace):
Rename from semantic-lex-spp-anlyzer-do-replace.
* lisp/emacs-lisp/cconv.el (cconv--analyze-use):
Rename from cconv--analyse-use.
(cconv--analyze-function): Rename from cconv--analyse-function.
(cconv-analyze-form): Rename from cconv-analyse-form.
* src/regex.c (analyze_first): Rename from analyze_first.