From: Stefan Monnier Date: Wed, 26 Sep 2012 15:19:10 +0000 (-0400) Subject: Merge profiler branch X-Git-Tag: emacs-24.2.90~244^2~77 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3a880af4a79688e90da45311a8d85bae2d59a811;p=emacs.git Merge profiler branch --- 3a880af4a79688e90da45311a8d85bae2d59a811 diff --cc etc/NEWS index 8c206f049d3,fa8a9bd30d0..123ca4de93c --- a/etc/NEWS +++ b/etc/NEWS @@@ -678,8 -576,17 +678,13 @@@ are deprecated and will be removed even * Lisp changes in Emacs 24.3 -** New functions `autoloadp' and `autoload-do-load'. - -** New function `posnp' to test if an object is a `posn'. - -** `function-get' fetches the property of a function, following aliases. - -** `toggle-read-only' accepts a second argument specifying whether to -print a message, if called from Lisp. ++** New sampling-based Elisp profiler. ++Try M-x profiler-start ... M-x profiler-stop; and then M-x profiler-report. ++The sampling rate can be based on CPU time (only supported on some ++systems), or based on memory allocations. + ** CL-style generalized variables are now in core Elisp. -`setf' is autoloaded and `push' and `pop' accept generalized variables. +`setf' is autoloaded; `push' and `pop' accept generalized variables. ** `defun' also accepts a (declare DECLS) form, like `defmacro'. The interpretation of the DECLS is determined by `defun-declarations-alist'. diff --cc lisp/ChangeLog index 4599855e28d,d7304b68ade..349d74aa7d7 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@@ -1,1457 -1,49 +1,1462 @@@ ++2012-09-26 Tomohiro Matsuyama ++ Stefan Monnier ++ ++ * profiler.el: New file. ++ 2012-09-26 Stefan Monnier - * profiler.el (profiler-start): Don't prompt for choice when there - isn't any. - (profiler-stop): Use new semantics of profiler-*-stop. - (profiler-reset, profiler--report-cpu): Don't signal an error if the - cpu profiler is not available. - -2012-09-24 Stefan Monnier - - * profiler.el (profiler-sample-interval): Move before first use. - Change default to 1ms. - (profiler-entry=, profiler-backtrace-reverse, profiler-log-fixup-slot) - (profiler-calltree-elapsed<, profiler-calltree-elapsed>): Remove functions. - (profiler-entry-format): Don't use type-of. - (profiler-slot, profiler-log): Remove structs. - (profiler-log-timestamp, profiler-log-type, profiler-log-diff-p): - Redefine for new log representation. - (profiler-log-diff, profiler-log-fixup, profiler-calltree-build-1): - Rewrite for new log representation. - (profiler-calltree): Remove `elapsed' fields. - (profiler-calltree-count<, profiler-report-make-entry-part): - Remove gc special case. - (profiler-calltree-find): Use equal. - (profiler-calltree-walk): Remove `args'; rely on closures instead. - (profiler-calltree-compute-percentages-1): Remove; inlined. - (profiler-calltree-compute-percentages): Simplify. - (profiler-report-log, profiler-report-reversed) - (profiler-report-order): Use defvar-local. - (profiler-report-line-format): Remove `elapsed', do a bit of CSE. - (profiler-report-mode-map): Remove up/down bindings. - (profiler-report-make-buffer-name): Simplify by CSE. - (profiler-report-mode): Remove redundant code. - (profiler-report-expand-entry, profiler-report-collapse-entry): - Use inhibit-read-only. - (profiler-report-render-calltree-1): Simplify by CSE. - (profiler-reset): Rewrite for new subroutines. - (profiler--report-cpu): Rename from sample-profiler-report. - (profiler--report-memory): Rename from memory-profiler-report. - -2012-08-22 Tomohiro Matsuyama - - * profiler.el: Switch to cl-lib. - (profiler-start): Change mode spec. - (with-sample-profiling): New macro. - (with-memory-profiling): New macro. + * emacs-lisp/testcover.el (testcover-after): Add gv-expander. + (testcover-reinstrument): Simplify with CSE. + +2012-09-26 Juanma Barranquero + + * window.el (temp-buffer-window-setup): Fix typo in docstring. + +2012-09-25 Wilson Snyder + + * verilog-mode.el (verilog-auto-ascii-enum, verilog-auto-inout) + (verilog-auto-input, verilog-auto-insert-lisp) + (verilog-auto-output, verilog-auto-output-every, verilog-auto-reg) + (verilog-auto-reg-input, verilog-auto-tieoff, verilog-auto-undef) + (verilog-auto-unused, verilog-auto-wire) + (verilog-forward-or-insert-line): Fix AUTOs with no trailing + newline. Reported by Andrew Jones. + (verilog-auto-inst) Support expanding $clog2 in AUTOINST. + Reported by Brad Dobbie. + (verilog-batch-delete-trailing-whitespace): + Create verilog-batch-delete-trailing-whitespace. + Reported by Brad Dobbie. + (verilog-auto-inout-param): Support AUTOINOUTPARAM for copying + parameters from another module. Reported by Dan Katz. + (verilog-auto, verilog-auto-assign-modport) + (verilog-auto-inout-modport): Add AUTOASSIGNMODPORT and + AUTOINOUTMODPORT for UVM interface module shell generation. + Reported by Brad Dobbie. + (verilog-auto-inst-interfaced-ports): Make default nil, as more + standard behavior. + (verilog-auto): Fix AUTO parameters with parenthesis arguments. + Reported by Matt Martin. + +2012-09-25 Martin Rudalics + + * window.el (window--resize-child-windows): When resizing child + windows proportionally, process them in reverse order to + preserve the "when splitting a window the new one gets the odd + line" behavior. + (window--resize-root-window-vertically): When resizing the + minibuffer window try to affect only windows at the bottom of the + frame. (Bug#12419) + +2012-09-25 Chong Yidong + + * subr.el (declare): Doc fix. + + * help-fns.el (help-fns--obsolete): Handle macros properly. + +2012-09-25 Chong Yidong + + * bookmark.el (bookmark-jump-noselect): Use a declare form to mark + this function obsolete. + + * calendar/cal-x.el (calendar-two-frame-setup) + (calendar-only-one-frame-setup, calendar-one-frame-setup): + * calendar/calendar.el (american-calendar, european-calendar) + (calendar-for-loop): + * comint.el (comint-dynamic-simple-complete) + (comint-dynamic-complete-as-filename, comint-unquote-filename): + * desktop.el (desktop-load-default): + * dired-x.el (dired-omit-here-always) + (dired-hack-local-variables, dired-default-directory): + * emacs-lisp/derived.el (derived-mode-class): + * emacs-lisp/timer.el (timer-set-time-with-usecs): + * emacs-lock.el (toggle-emacs-lock): + * epa.el (epa-display-verify-result): + * epg.el (epg-sign-keys, epg-start-sign-keys) + (epg-passphrase-callback-function): + * eshell/esh-util.el (eshell-for): + * eshell/eshell.el (eshell-remove-from-window-buffer-names) + (eshell-add-to-window-buffer-names): + * files.el (locate-file-completion): + * imenu.el (imenu-example--create-c-index) + (imenu-example--create-lisp-index) + (imenu-example--lisp-extract-index-name) + (imenu-example--name-and-position): + * international/mule-cmds.el (princ-list): + * international/mule-diag.el (decode-codepage-char): + * international/mule-util.el (detect-coding-with-priority): + * iswitchb.el (iswitchb-read-buffer): + * mail/mailalias.el (mail-complete): + * mail/sendmail.el (mail-sent-via): + * mouse.el (mouse-popup-menubar-stuff, mouse-popup-menubar) + (mouse-major-mode-menu): + * password-cache.el (password-read-and-add): + * pcomplete.el (pcomplete-parse-comint-arguments): + * progmodes/sh-script.el (sh-maybe-here-document): + * replace.el (query-replace-regexp-eval): + * savehist.el (savehist-load): + * simple.el (choose-completion-delete-max-match): + * term.el (term-dynamic-simple-complete): + * vc/ediff-init.el (ediff-check-version): + * vc/ediff-wind.el (ediff-choose-window-setup-function-automatically): + * vc/vc.el (vc-diff-switches-list): + * view.el (view-return-to-alist-update): Likewise. + + * subr.el (eval-next-after-load, makehash, insert-string) + (assoc-ignore-representation, assoc-ignore-case): Use declare to + mark obsolete. + (mode-line-inverse-video): Variable deleted. + + * international/mule-util.el (string-to-sequence): Remove. + + * calendar/calendar.el (calendar-version): + * calendar/icalendar.el (icalendar-extract-ical-from-buffer) + (icalendar-convert-diary-to-ical): + * cus-edit.el (custom-mode): + * ansi-color.el (ansi-color-unfontify-region): + * international/latin1-disp.el (latin1-char-displayable-p): + * progmodes/cwarn.el (turn-on-cwarn-mode): + * progmodes/which-func.el (which-func-update-1): + Use define-obsolete-function-alias. + + * net/newst-backend.el (newsticker-cache-filename): + * net/newst-treeview.el (newsticker-groups-filename): + Fix incorrect obsolescence declaration. + + * allout.el (allout-passphrase-hint-string): Likewise. + (allout-init): Use a declare form to mark obsolete. + + * emacs-lisp/byte-run.el (make-obsolete): Doc fix; emphasize that + this applies to functions. + + * iswitchb.el (iswitchb-read-buffer): Move code of + iswitchb-define-mode-map here, and delete that obsolete function. + + * net/snmp-mode.el (snmp-font-lock-keywords-3): Don't use obsolete + font-lock-reference-face. + +2012-09-25 Glenn Morris + + * buff-menu.el (Buffer-menu-name-width, Buffer-menu-size-width): + Doc fixes. + + * eshell/em-term.el (eshell-term-name): + Default to term-term-name. (Bug#12485) + +2012-09-24 Fabián Ezequiel Gallina + + * progmodes/python.el (python-shell-send-buffer): Better handling + of "if __name__ == '__main__':" conditionals when sending the buffer. + +2012-09-24 Glenn Morris + + * eshell/esh-cmd.el (eshell-find-alias-function): + Tighten up file-name regexp. (Bug#12499) + +2012-09-24 Fabián Ezequiel Gallina + + Enhancements for triple-quote string syntax. + * progmodes/python.el (python-quote-syntax): Remove. + (python-syntax-propertize-function): New value. + (python-syntax-count-quotes, python-syntax-stringify): + New functions. + +2012-09-24 Chong Yidong + + * mail/supercite.el (sc-version): Remove obsolete function. + (sc-describe): Don't mark as obsolete, since it is bound. + (sc-submit-bug-report): Remove. + + * vc/log-edit.el (cvs-changelog-full-paragraphs) + (cvs-commit-buffer-require-final-newline): Remove. + (log-edit-require-final-newline) + (log-edit-changelog-full-paragraphs): Default to t. + + * vc/pcvs-defs.el (cvs-diff-buffer-name, cvs-diff-ignore-marks) + * vc/vc-hooks.el (vc-ignore-vc-files, vc-master-templates) + * vc/vc.el (vc-checkout-carefully): Likewise. + + * vc/emerge.el (emerge-mode): Make it an obsolete alias. + (emerge-version): Remove. + + * progmodes/compile.el (compile-internal): Remove. + (compilation-parse-errors-function): Fix typo. + + * international/mule.el (set-char-table-default): Remove. + (set-coding-priority, make-coding-system, generic-char-p) + (charset-list, charset-bytes, charset-id): Use declare to mark + functions as obsolete. + + * vc/pcvs-defs.el (cvs-buffer-name-alist) + (cvs-invert-ignore-marks): Remove references to obsolete vars. + * vc/vc-hooks.el (vc-default-registered): Don't use + vc-master-templates. + + * font-lock.el (font-lock-reference-face): + Use define-obsolete-variable-alias. + + * generic-x.el (rul-generic-mode): Use font-lock-constant-face. + * calendar/calendar.el (calendar-font-lock-keywords): + * calendar/diary-lib.el (diary-font-lock-keywords) + (diary-fancy-font-lock-keywords): + * textmodes/reftex-sel.el (reftex-insert-docstruct): + * textmodes/reftex-index.el (reftex-insert-index): + * textmodes/reftex-cite.el (reftex-format-bib-entry): + * progmodes/ruby-mode.el (ruby-font-lock-keywords): + * progmodes/ps-mode.el (ps-mode-font-lock-keywords-1): + * progmodes/prolog.el (prolog-font-lock-keywords): + * progmodes/idlwave.el (idlwave-idl-keywords): + * progmodes/ada-mode.el (ada-font-lock-keywords): + * net/snmp-mode.el (snmp-font-lock-keywords-3): Likewise. + +2012-09-24 Glenn Morris + + * mail/emacsbug.el (report-emacs-bug): Include `lsb_release -d'. + +2012-09-23 Fabián Ezequiel Gallina + + * progmodes/python.el (python-indent-line): More consistent cursor + movement behavior. + +2012-09-23 Stefan Merten + + * textmodes/rst.el: Fix compiler warning. + +2012-09-23 Roland Winkler + + * textmodes/bibtex.el (bibtex-autokey-transcriptions): + Transcribe also LaTeX hyphenation. + (bibtex-reformat): Bug fix. Do not quote twice the elements of + bibtex-reformat-previous-options. + +2012-09-23 Roland Winkler + + * proced.el (proced-renice-command): New variable. + (proced-marked-processes): New function. + (proced-with-processes-buffer): New macro. + (proced-send-signal): Use them. + (proced-renice): New command bound to r. + +2012-09-23 Roland Winkler + + * ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): If list + ibuffer-saved-filter-groups has one element, shortcut the call of + completing-read. (Bug#12331) + +2012-09-23 Chong Yidong + + * bindings.el (mode-line-toggle-read-only): + * bs.el (bs-toggle-readonly): + * buff-menu.el (Buffer-menu-toggle-read-only): + * dired.el (dired-toggle-read-only): + * ibuffer.el (ibuffer-do-toggle-read-only): Use read-only-mode. + +2012-09-23 Chong Yidong + + * image.el (image-type-available-p): Adapt to init-image-library + argument changes. + +2012-09-22 Juri Linkov + + * dired.el (dired-mode-map): Add [remap read-only-mode] for + `dired-toggle-read-only'. (Bug#12462) + +2012-09-22 Martin Rudalics + + * subr.el (temp-output-buffer-show): New function. + (with-output-to-temp-buffer): Call temp-output-buffer-show + instead of internal-temp-output-buffer-show. + +2012-09-22 Chong Yidong + + * files.el (ctl-x-map): Bind C-x C-q to read-only-mode + (Bug#12462). + + * repeat.el (repeat): Doc fix (Bug#12348). + + * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix + (Bug#10909). + + * simple.el (shell-command-on-region): Doc fix. + (read-only-mode): Doc fix. + +2012-09-22 Eli Zaretskii + + * emacs-lisp/timer.el (run-with-idle-timer) + (timer-activate-when-idle): Warn against reinvoking an idle timer + from within its own timer action. (Bug#12447) + +2012-09-22 Martin Rudalics + + * cus-start.el (window-combination-limit): Add new optional + values. + * window.el (temp-buffer-window-show) + (window--try-to-split-window): Handle new values of + window-combination-limit (Bug#1806). + (split-window): Test window-combination-limit for t instead of + non-nil. + (display-buffer-at-bottom): New buffer display action function. + * help.el (temp-buffer-resize-regexps): New option. + (temp-buffer-resize-mode): Rewrite doc-string. + (resize-temp-buffer-window): Obey temp-buffer-resize-regexps. + Don't resize reused window. Suggested by Glenn Morris. + +2012-09-22 Stefan Merten + + * textmodes/rst.el: Revamp section title faces. + (rst-official-version) + (rst-package-emacs-version-alist): Sync with official version + V1.4.0. + (rst-faces-defaults, rst-set-level-default) + (rst-level-face-max, rst-level-face-base-color) + (rst-level-face-base-light, rst-level-face-format-light) + (rst-level-face-step-light, rst-define-level-faces): Obsolete. + (rst-adornment-faces-alist): Match new setup. + (rst-level-1, rst-level-2, rst-level-3, rst-level-4) + (rst-level-5, rst-level-6): New faces. + +2012-09-22 Chong Yidong + + * simple.el (undo): Handle indirect buffers (Bug#8207). + +2012-09-21 Leo Liu + + IDO: Disable match re-ordering for buffer switching. + * ido.el (ido-buffer-disable-smart-matches): New variable. + (ido-set-matches-1): Use it. (Bug#2042) + +2012-09-21 Jose Marino (tiny change) + + * progmodes/idlw-shell.el (idlwave-shell-complete-filename): + Fix 2011-05-17 change. (Bug#12418) + +2012-09-21 Leo Liu + + * subr.el (ignore-errors): Mention with-demoted-errors in doc-string. + +2012-09-21 Glenn Morris + + * emacs-lisp/shadow.el (load-path-shadows-font-lock-keywords): + Be more robust about locating simple.el. + +2012-09-21 Glenn Morris + + * mail/emacsbug.el (report-emacs-bug): Trap load-path-shadows errors. + +2012-09-21 Joel Bion (tiny change) + + * pcmpl-gnu.el (pcmpl-gnu-tarfile-regexp): Add tar.xz. (Bug#12382) + +2012-09-20 Juri Linkov + + * replace.el (query-replace-read-from): Use `read-regexp' instead + of `read-from-minibuffer' when `regexp-flag' is non-nil. + (occur-read-primary-args): Use `read-regexp' instead of + `read-string'. + (multi-occur-in-matching-buffers): Use `read-regexp' instead of + `read-from-minibuffer'. + * isearch.el (isearch-occur): Use `read-regexp' instead of + `read-string'. + * dired.el (dired-read-regexp): Use `read-regexp' instead of + `read-from-minibuffer'. + * progmodes/grep.el (grep-read-regexp): Use `read-regexp' instead + of `read-string'. (Bug#7567) + + * replace.el (read-regexp): Rename DEFAULT-VALUE arg to DEFAULTS + and allow accepting a list of strings prepended to a list of + standard default values. Doc fix. (Bug#12321) + + * replace.el (read-regexp): Add HISTORY arg. (Bug#7567) + + * replace.el (read-regexp): Don't add ": " when PROMPT already + ends with a colon and space. (Bug#12321) + +2012-09-20 Tassilo Horn + + * doc-view.el (doc-view-display): Better fix for the cl-assertion + error. + +2012-09-20 Stefan Merten + + * textmodes/rst.el: Integrate support for `imenu' and `which-function'. + Fixes feature request bug#11711. + (rst-mode): Create `imenu-create-index-function'. + (rst-get-stripped-line): Delete after refactoring. + (rst-section-tree, rst-section-tree-rec) + (rst-section-tree-point): Refactor and document properly. + (rst-imenu-find-adornments-for-position) + (rst-imenu-convert-cell, rst-imenu-create-index): + New function. + +2012-09-20 Stefan Monnier + + * emacs-lisp/macroexp.el (macroexp--obsolete-warning): New function. + (macroexp--expand-all): Use it. + (macroexp--funcall-and-return): Remove by folding it into its sole + caller (macroexp--warn-and-return). + * emacs-lisp/bytecomp.el (byte-compile-warn-obsolete): + Use macroexp--obsolete-warning. + + * calc/calc.el: Fix last change by removing the whole chunk, since it + was only needed back when Calc was not bundled. + +2012-09-20 Martin Rudalics + + * emacs-lisp/debug.el (debug): Restore assignment to + debugger-old-buffer removed on 2012-09-08. + +2012-09-20 Juri Linkov + + * dired-aux.el (dired-diff): Remove (require 'diff) since + `diff-latest-backup-file' is now autoloaded. + +2012-09-20 Chong Yidong + + * vc/diff.el (diff-latest-backup-file): Autoload. + +2012-09-20 Stefan Monnier + + * calc/calc.el: Remove redundant autoload shape check. + (sel-mode): Don't defvar. + (calc-get-stack-element): Add `sel-mode' arg instead. + (calc-top, calc-top-list): Pass it this additional argument. + * calc/calc-store.el (calc-store-map): + * calc/calc-map.el (calc-apply, calc-reduce, calc-map) + (calc-map-equation, calc-outer-product, calc-inner-product): + * calc/calc-aent.el (calc-alg-entry): Don't bind sel-mode. + + * emacs-lisp/macroexp.el (macroexp--expand-all): Fix last change. + +2012-09-19 Juri Linkov + + * dired-aux.el (dired-diff): Add (require 'diff) because + `diff-latest-backup-file' is not autoloaded. + (dired-do-chxxx, dired-do-chmod): Set `no-error-if-not-filep' arg + of `dired-get-filename' to t to not report error when there is + no default file on the current line. + +2012-09-19 Stefan Monnier + + * emacs-lisp/macroexp.el (macroexp--funcall-if-compiled): Rename from + macroexp--eval-if-compile. + (macroexp--funcall-and-return, macroexp--warn-and-return): New funs. + (macroexp--expand-all): Use them (bug#12371). + + * doc-view.el (doc-view-guess-paper-size) + (doc-view-scale-bounding-box): Fix unbound `caddr'. + +2012-09-19 Tassilo Horn + + New feature: set optimal slice from BoundingBox information. + * doc-view.el (doc-view-mode-map): Add keybinding. + (doc-view-menu): Add menu entry. + (doc-view-set-slice): Adapt docstring. + (doc-view-get-bounding-box, doc-view-guess-paper-size) + (doc-view-scale-bounding-box) + (doc-view-set-slice-from-bounding-box): New functions. + (doc-view-paper-sizes): New defvar. + +2012-09-19 Glenn Morris + + * emacs-lisp/macroexp.el (byte-compile-warn-obsolete) + (byte-compile-log-warning): Autoload. (Bug#12371) + + * calendar/calendar.el (calendar-american-month-header) + (calendar-european-month-header, calendar-iso-month-header) + (calendar-month-header): New options. + (calendar-set-date-style): Set calendar-month-header. Redraw calendar. + (calendar-generate-month): Use calendar-month-header. (Bug#9510) + +2012-09-19 Jan Djärv + + * startup.el (command-line-ns-option-alist): Add -g and --geometry. + +2012-09-18 Juri Linkov + + * dired-aux.el (dired-diff): Restore original functionality of + getting the default value, but keep new feature of using the + latest existing backup file (`diff-latest-backup-file'). + +2012-09-18 Juri Linkov + + * dired.el (dired-mark): If the region is active in Transient Mark + mode, mark all files in the active region. Doc fix. + (dired-unmark, dired-flag-file-deletion, dired-unmark-backward): + Doc fix. (Bug#10624) + +2012-09-18 Juri Linkov + + * dired-aux.el (dired-do-chxxx, dired-do-chmod): Default file + attributes for M-n are pulled from the file at point. + (dired-do-chgrp, dired-do-chown, dired-do-touch): Doc fix. + Suggested by Drew Adams. (Bug#10624) + +2012-09-18 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-brace-to-do-end): Don't add extra + whitespace after "end". + (ruby-do-end-to-brace): Collapse block to one line if it fits + within fill-column. + +2012-09-18 Martin Rudalics + + * emacs-lisp/debug.el (debugger-bury-or-kill): Fix customization + value. + (debug): Don't remove debugger window when debugger is expected + to be back. + +2012-09-18 Chong Yidong + + * custom.el (defface): Doc fix. + + * cus-edit.el (custom-unlispify-remove-prefixes): Add warning. + +2012-09-18 Martin Blais (tiny change) + + * progmodes/compile.el (compilation-start): Use compilation-always-kill + to initialize query-on-exit; then test that instead (bug#12288). + +2012-09-17 Stefan Merten + + * textmodes/rst.el: Add support for `testcover'. + (rst-defcustom-testcover, rst-testcover-add-compose) + (rst-testcover-add-1value): New functions. + (rst-portable-mark-active-p): Replace by `use-region-p'. + (rst-update-section, rst-classify-adornment) + (rst-find-title-line): Mark `1value' forms. + (rst-classify-adornment): Remove superfluous form. + (rst-update-section, rst-get-adornments-around) + (rst-adornment-complete-p, rst-get-next-adornment) + (rst-adjust, rst-promote-region) + (rst-display-adornments-hierarchy, rst-straighten-adornments) + (rst-find-pfx-in-region, rst-section-tree-rec) + (rst-section-tree-point, rst-toc-insert, rst-toc-insert-node) + (rst-toc-node, rst-toc, rst-forward-section) + (rst-iterate-leftmost-paragraphs) + (rst-iterate-leftmost-paragraphs-2, rst-enumerate-region) + (rst-bullet-list-region) + (rst-convert-bullets-to-enumeration, rst-font-lock-keywords) + (rst-compile-find-conf, rst-compile) + (rst-repeat-last-character): Fix style. + +2012-09-17 Chong Yidong + + * comint.el (comint--complete-file-name-data): Don't add a space + if the status is `sole'; that adds a gratuitous space in the + completion-cycling case (Bug#12092). + + * pcomplete.el (pcomplete-completions-at-point): Likewise. + +2012-09-17 Richard Stallman + + * mail/rmailmm.el (rmail-mime-toggle-raw): Do rmail-mime-insert + only in the mime-shown mode, not in raw mode. + (rmail-mime): Toggle off mime by displaying the message without + mime processing. (Bug#12305) + + * mail/rmail.el (rmail-retry-failure): + Turn off mime processing first. (Bug#12037) + + * epa-mail.el (epa-mail-encrypt): Fix bug when a name has no key. + +2012-09-17 Chong Yidong + + * shell.el (shell-file-name-chars, shell-file-name-quote-list) + (shell-dynamic-complete-functions): Convert to defcustom. + (shell-prompt-pattern, shell-completion-fignore): Doc fix. + + * bookmark.el (bookmark-bmenu-toggle-filenames): Doc fixes. + * comint.el (comint-prompt-read-only): + * custom.el (defcustom): + * hi-lock.el (hi-lock-mode): + * ibuffer.el (ibuffer-formats): + * ielm.el (ielm-prompt-read-only): + * novice.el (disable-command): + * saveplace.el (toggle-save-place): + * speedbar.el (speedbar-supported-extension-expressions): + * startup.el (auto-save-list-file-prefix, init-file-user) + (after-init-hook, inhibit-startup-echo-area-message): + * strokes.el (strokes-help): + * time-stamp.el (time-stamp): + * calendar/calendar.el (calendar, diary-file): + * calendar/diary-lib.el (diary-mail-entries, diary) + (diary-list-entries-hook): + * calendar/holidays.el (holidays, calendar-holidays): + * calendar/lunar.el (lunar-phases): + * calendar/solar.el (sunrise-sunset): + * emulation/edt.el (edt-load-keys): + * emulation/viper.el (viper-mode): + * eshell/em-alias.el (eshell-command-aliases-list): + * eshell/esh-util.el (eshell-convert-numeric-arguments): + * international/ogonek.el (ogonek-information): + * net/tramp-cmds.el (tramp-bug): + * net/quickurl.el (quickurl-reread-hook-postfix): + * play/decipher.el (decipher-font-lock-keywords): + * progmodes/cc-styles.el (c-set-style): + * progmodes/idlw-shell.el (idlwave-shell-prompt-pattern): + * progmodes/inf-lisp.el (inferior-lisp-prompt): + * progmodes/octave-mod.el (octave-mode): + * progmodes/sql.el (sql-mode, sql-interactive-mode, sql-password): + * progmodes/verilog-mode.el (verilog-read-defines): + * textmodes/two-column.el (2C-mode): Likewise. + +2012-09-16 Katsumi Yamaoka + + * mail/mailabbrev.el (mail-abbrev-expand-hook): Work for a mail aliasee + that holds many addresses. + +2012-09-16 Chong Yidong + + * align.el (align-areas): Call the indication function with + positions instead of markers for arguments (Bug#12343). + + * files.el (parse-colon-path): Use split-string (Bug#12351). + + * window.el (special-display-popup-frame): Doc fix (Bug#8853). + (display-buffer-function): Mark as obsolete. + + * progmodes/compile.el (compilation-parse-errors): Accept list + values similar to font-lock-keywords (Bug#12136). + Suggested by Oleksandr Manzyuk. + (compilation-error-regexp-alist): Doc fix. + +2012-09-15 Glenn Morris + + * version.el (emacs-bzr-version-bzr): New function. + (emacs-bzr-get-version): Add optional EXTERNAL argument. + + * vc/vc-bzr.el (vc-bzr-working-revision): For lightweight local + checkouts, check the parent dirstate matches the branch. + Add "--tree" to "bzr revno" arguments. Don't try to shorten the + empty string. + + * version.el (emacs-bzr-version): Doc fix. + (emacs-bzr-version-dirstate): New function. + (emacs-bzr-get-version): For lightweight checkouts, if the parent + is local try and check that it matches the branch. If not, just + use dirstate information. (Bug#12441) + +2012-09-14 Juri Linkov + + * dired-aux.el (dired-do-chmod): Use `eq' to detect empty input. + (Bug#12399) + +2012-09-14 Stefan Monnier + + * emacs-lisp/advice.el (ad-prognify): Remove, use macroexp-progn. + + * emacs-lisp/edebug.el: Miscellaneous cleanup. + Remove obsolete byte-compiler hack that tried to silence some warnings. + (edebug-submit-bug-report): Remove. + (edebug-get-buffer-window, edebug-sit-for, edebug-input-pending-p): + Remove aliases, use the un-prefixed name instead. + (edebug-pop-to-buffer): Consider other frames. + (edebug-original-read):: Make it more obvious that it's always defined. + (edebug--make-form-data-entry, edebug--form-data-name) + (edebug--form-data-begin, edebug--form-data-end): Rename from the + single-dashed name, and implement with cl-defstruct. + (edebug-set-form-data-entry): Use the standard accessors. + (edebug-make-top-form-data-entry): Use push. + (edebug-no-match): Drop useless `funcall'. + (mapcar, mapconcat, mapatoms, apply, funcall): Don't add debug specs + to functions. + (defsubst, dont-compile, eval-when-compile, eval-and-compile) + (delay-mode-hooks, with-temp-file, with-temp-message, ad-dolist) + (with-syntax-table, push, pop, 1value, noreturn, defadvice) + (easy-menu-define, with-custom-print): Remove redundant specs. + (edebug-outside-overriding-local-map) + (edebug-outside-overriding-terminal-local-map): Remove, unused. + (edebug--display): Bind unread-command-events directly to nil rather + than binding it to unread-command-events and later setting it to nil. + (edebug--display): Kill edebug-eval-buffer here... + (edebug--recursive-edit): ...rather than here. + Bind standard-output and standard-input. + (edebug-eval): Check cl-macroexpand-all is fboundp. + (edebug-temp-display-freq-count): Fix last change. + + * emacs-lisp/easymenu.el (easy-menu-define): Add `debug' spec. + * subr.el (noreturn, 1value): Add `debug' spec. + * emacs-lisp/advice.el: Require cl-lib. + (ad-copy-tree): Remove, use copy-tree instead. + (ad-dolist): Remove use dolist or cl-dolist instead. + (ad-do-return): Remove, use cl-return instead. + (defadvice): Add `debug' spec. + +2012-09-13 Juri Linkov + + * dired-aux.el (dired-do-chxxx): Use `eq' to detect empty input. + (Bug#12399) + +2012-09-13 Glenn Morris + + * calc/calc.el (math-compose-expr): + * calc/calc-ext.el (math-compose-expr): + * progmodes/cc-defs.el (cl-macroexpand-all): + * progmodes/cc-langs.el (delete-duplicates, mapcan) + (cl-macroexpand-all): Update declarations. + + * vc/vc.el: No need to require ediff. + (ediff-load-version-control): Declare. + (ediff-vc-internal): Fix declaration. + (vc-version-ediff): Require ediff. + +2012-09-13 Paul Eggert + + Use a more backwards-compatible timer format (Bug#12430). + * emacs-lisp/timer.el (timer): PSECS is now at the end, rather than + being right after USECS, as that better supports old code that + inadvisedly looked directly at the timer vector. + +2012-09-13 Kenichi Handa + + * language/chinese.el ("Chinese-GB", "Chinese-BIG5") + ("Chinese-CNS", "Chinese-EUC-TW"): Add chinese-gbk to + `coding-priority' property of these language environment. + +2012-09-13 Paul Eggert + + Fix glitches caused by addition of psec to timers (Bug#12430). + * image.el (image-animate-timer): + * time.el (display-time-world-timer): + Use timer--function and timer--args rather than raw access to + timer vector. + +2012-09-13 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-warning-prefix): + If not compiling a file, try using load-file-name. + +2012-09-13 Stefan Monnier + + * emacs-lisp/edebug.el (edebug-outside-unread-command-events): + Fix last change. + (edebug-update-eval-list): Use `push'. + + * emacs-lisp/edebug.el: Use lexical-binding. + Remove the "edebug-" prefix from non-dynamically-scoped variables. + Mark unused args with underscore. + (edebug-save-restriction, edebug-outside-excursion): Use `declare'. + (edebug-form-data): Use defvar-local. + (edebug-make-before-and-after-form, edebug-make-after-form): + Use backquote. + (edebug-args, edebug-value, edebug-after-index, edebug-arg-mode): + Not dynamically scoped any more. + (edebug--enter-trace): Add arguments `function' and `args'. + Rename from edebug-enter-trace. + (edebug-enter): Call it accordingly. Bind edebug-function explicitly. + (edebug--update-coverage): Add `after-index' and `value' args. + Rename from edebug-update-coverage. + (edebug-slow-after): Call it accordingly. + (edebug--recursive-edit): Add arg `arg-mode'. Rename from + edebug-recursive-edit. + (edebug--display): Call it accordingly. Add args `value', + `offset-index', and `arg-mode'. Rename from edebug-display. + (edebug-debugger, edebug): Call it accordingly. + (edebug-eval-display-list): Use dolist. + +2012-09-12 Juri Linkov + + * info.el (Info-search): Don't check for isearch-mode and + isearch-regexp before let-binding search-spaces-regexp to + Info-search-whitespace-regexp. + (Info-isearch-search): Let-bind Info-search-whitespace-regexp to + search-whitespace-regexp if isearch-lax-whitespace or + isearch-regexp-lax-whitespace is non-nil. + (Info-mode): Don't set local variable search-whitespace-regexp. + http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00811.html + +2012-09-12 Stefan Monnier + + * emacs-lisp/debug.el (debugger-outer-unread-command-char, debug) + (debugger-env-macro): Remove support for unread-command-char. + + * subr.el (set-temporary-overlay-map): Minimize slightly the impact of + the temporary map re-appearing on emulation-mode-map-alists. + + * emacs-lisp/edebug.el (def-edebug-form-spec): Remove, it's been broken + since 22.1. + + * ehelp.el (with-electric-help): Accept functions in + electric-help-form-to-execute. + (electric-help-execute-extended, electric-help-ctrl-x-prefix): Use it. + And replace unread-command-char -> unread-command-events. + +2012-09-12 Michael Albinus + + Sync with Tramp 2.2.6. + + * net/tramp.el (tramp-accept-process-output): Don't use + JUST-THIS-ONE in the XEmacs case. + + * net/trampver.el: Update release number. + +2012-09-12 Martin Rudalics + + * emacs-lisp/debug.el (debugger-previous-window-height): + New variable. + (debug): When debugger-jumping-flag is non-nil try to restore + height of debugger window. (Bug#8789) + +2012-09-12 Stefan Monnier + + * emacs-lisp/edebug.el (edebug-enter): Don't mess with + overriding-local-map and pre/post-command-hook here. + (edebug-recursive-edit): Do it here instead (bug#12345). + (edebug-outside-unread-command-char): Remove all uses of + unread-command-char. + + * emacs-lisp/debug.el (debug): Don't bind debug-on-error since + inhibit-debugger is bound instead. + +2012-09-11 Bastien Guerry + + * subr.el (set-temporary-overlay-map): Add a docstring. + (Bug#12346) + +2012-09-11 Bastien Guerry + + * minibuffer.el (completion-table-subvert): Fix docstring. + (Bug#12347) + +2012-09-11 Bastien Guerry + + * help-fns.el (describe-variable): Fix typo. (Bug#12346) + +2012-09-10 Michael R. Mauger + + * progmodes/sql.el: Version 3.1 + (sql-db2-escape-newlines): New variable. + (sql-escape-newlines-filter): Use it. + +2012-09-10 Juanma Barranquero + + * custom.el (custom-theme-load-confirm): Remove unneeded assignment. + +2012-09-10 Dan Nicolaescu + + * vc/diff-mode.el (diff-mode-menu): + Bind diff-remove-trailing-whitespace. + +2012-09-10 Stefan Monnier + + * emacs-lisp/lisp-mode.el (emacs-list-byte-code-comment-re): New var. + (emacs-lisp-byte-code-comment, emacs-lisp-byte-code-syntax-propertize) + (emacs-lisp-byte-code-mode): New functions. + (eval-sexp-add-defvars): Don't skip defvars in column >0. + (eval-defun-2): Remove bogus interactive spec. + (lisp-indent-line): Remove redundant whole-exp code, now done in + indent-according-to-mode. + (save-match-data): Remove redundant indent data. + + * emacs-lisp/benchmark.el (benchmark-run, benchmark-run-compiled): + Use `declare'. + +2012-09-09 Juri Linkov + + * replace.el (replace-regexp-lax-whitespace): New defcustom. + (replace-lax-whitespace, query-replace-regexp) + (query-replace-regexp-eval, replace-regexp): Doc fix. + (perform-replace, replace-highlight): Let-bind + isearch-lax-whitespace to replace-lax-whitespace and + isearch-regexp-lax-whitespace to replace-regexp-lax-whitespace. + + * isearch.el (isearch-query-replace): Let-bind + replace-lax-whitespace to isearch-lax-whitespace and + replace-regexp-lax-whitespace to + isearch-regexp-lax-whitespace. (Bug#10885) + +2012-09-09 Stefan Monnier + + * eshell/em-unix.el (eshell/sudo): Explicitly drop return value. + +2012-09-09 Alan Mackenzie + + * progmodes/cc-engine.el (c-state-cache-init): + Initialise c-state-semi-nonlit-pos-cache\(-limit\)? properly. + (c-record-parse-state-state): + Record c-state-semi-nonlit-pos-cache\(-limit\)?. + +2012-09-09 Andreas Schwab + + * register.el (register-separator): Rename from + separator-register. All uses changed. Doc fix. + (register): Fix version. + +2012-09-09 Chong Yidong + + * replace.el (query-replace-map): Bind four new symbols for + requesting window scrolling. + + * subr.el (y-or-n-p): Handle the window-scrolling bindings in + query-replace-map (Bug#8948). + + * custom.el (custom-theme-load-confirm): Use y-or-n-p. + + * emacs-lisp/map-ynp.el (map-y-or-n-p): Don't bind scrolling keys + since they are now in query-replace-map. + + * window.el (scroll-other-window-down): Make the arg optional. + +2012-09-09 Chong Yidong + + * files.el (hack-local-variables-confirm): Use quit-window to kill + the *Local Variables* buffer. + +2012-09-08 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-toggle-block): Guess the current block, + not just expect to be at its beginning. Adjust callees. + Succeed when do-end block has no space before the pipe character. + (ruby-brace-to-do-end): When the original block is one-liner, + convert to multiline. Reindent the result. + +2012-09-08 Jambunathan K + + * register.el (register): New group. + (register-separator): New user option. + (increment-register): Route it to `append-to-register', if + register contains text. Implication is that `C-x r +' can now be + used for appending to a text register (bug#12217). + (append-to-register, prepend-to-register): Add separator based on + `register-separator. + +2012-09-08 Alan Mackenzie + + AWK Mode: make auto-newline work when there's "==" in the pattern. + * progmodes/cc-cmds.el (c-point-syntax): Handle virtual semicolons + correctly. + * progmodes/cc-engine.el (c-guess-basic-syntax CASE 5A.3): + Test more rigorously for "=" token. + +2012-09-08 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-match-expression-expansion): + Only fail when reached LIMIT. + +2012-09-08 Chong Yidong + + * dired.el (dired-mode-map): Don't bind M-=. + + * dired-aux.el (dired-diff): Use backup file as default. + +2012-09-08 Drew Adams + + * subr.el (add-to-history): Fix delete usage (Bug#12314). + +2012-09-08 Chong Yidong + + * subr.el (syntax-after, syntax-class): Doc fix. + +2012-09-08 Martin Rudalics + + * window.el (display-buffer-in-previous-window): New buffer + display action function. + + * emacs-lisp/debug.el (debugger-bury-or-kill): New option. + (debugger-previous-window): New variable. + (debug): Rewrite using display-buffer-in-previous-window, + quit-restore-window and debugger-bury-or-kill. (Bug#8789) + +2012-09-07 Stefan Monnier + + * emacs-lisp/byte-run.el (defun): Tweak message. Simplify code. + +2012-09-07 Matt McClure (tiny change) + + * progmodes/python.el (python-shell-send-string): + When default-directory is remote, create temp file on remote + filesystem. + (python-shell-send-file): When file is remote, pass local view of + file paths to remote Python interpreter. (Bug#12340) + +2012-09-07 Chong Yidong + + * window.el (switch-to-buffer): Doc fix (Bug#12181). + + * files.el (after-find-file): Don't fail on a read-only buffer if + require-final-newline is `visit' or `visit-save' (Bug#11156). + + * subr.el (read-char-choice): Allow quitting via ESC ESC. + + * userlock.el (ask-user-about-supersession-threat): + Use read-char-choice (Bug#12093). + +2012-09-07 Chong Yidong + + * subr.el (buffer-narrowed-p): New function. + + * ses.el (ses-widen): + * simple.el (count-words--buffer-message): + * net/browse-url.el (browse-url-of-buffer): Use it + + * simple.el (count-words-region): Don't signal an error if there + is a non-nil prefix arg and the mark is not set. + + * help.el (describe-key-briefly): Allow the message to be seen + when invoked from the minibuffer (Bug#7014). + +2012-09-07 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-end-of-defun) + (ruby-beginning-of-defun): Simplify, allow indentation before + block beginning and end keywords. + (ruby-beginning-of-defun): Only consider 3 keywords defun beginners. + (ruby-end-of-defun): Expect that the point is at the beginning of + the defun. + +2012-09-06 Stefan Monnier + + * emacs-lisp/cl-macs.el (cl--do-arglist): Understand _ on &key args + (bug#12367). + (cl--make-usage-args): Strip _ from argument names. + +2012-09-06 Rüdiger Sonderfeld + + * progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Don't use + obsolete alias speedbar-key-map. + (vhdl-doc-variable, vhdl-doc-mode): Use called-interactively-p. + (vhdl-index-menu-init): Don't use obsolete variable + font-lock-maximum-size. + +2012-09-06 Chong Yidong + + * frame.el (window-system-version): Mark as obsolete. + + * speedbar.el (speedbar-update-flag, speedbar-mode): Remove uses + of obsolete variable speedbar-key-map. + +2012-09-06 Juri Linkov + + * replace.el (replace-lax-whitespace): New defcustom. + (query-replace, query-replace-regexp, query-replace-regexp-eval) + (replace-string, replace-regexp): Mention it in docstrings. + (perform-replace, replace-highlight): Let-bind + isearch-lax-whitespace and isearch-regexp-lax-whitespace according + to the values of replace-lax-whitespace and regexp-flag. + Don't let-bind search-whitespace-regexp. (Bug#10885) + + * isearch.el (isearch-query-replace): Let-bind + replace-lax-whitespace instead of let-binding + replace-search-function and replace-re-search-function. + (isearch-lazy-highlight-search): Let-bind isearch-lax-whitespace + and isearch-regexp-lax-whitespace to lazy-highlight variables. + (isearch-toggle-symbol): Set isearch-regexp to nil + in isearch-word mode (like in isearch-toggle-word). + +2012-09-06 Juri Linkov + + * replace.el (replace-search-function) + (replace-re-search-function): Set default values to nil. + (perform-replace): Let-bind isearch-related variables based on + replace-related values, call `isearch-search-fun' and let-bind + the result to `search-function'. Remove code that sets + `search-function' and `search-string' separately for + `delimited-flag'. + (replace-highlight): Add new argument `delimited-flag' and + rename other arguments to the names used in `perform-replace'. + Let-bind `isearch-word' to the argument `delimited-flag'. + (Bug#10885, bug#10887) + +2012-09-07 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-indent-beg-re): Add pieces from + ruby-beginning-of-indent, simplify, allow all keywords to have + indentation before them. + (ruby-beginning-of-indent): Adjust for above. Search until the + found point is not inside a string or comment. + (ruby-font-lock-keywords): Allow symbols to start with "@" + character, give them higher priority than variables. + (ruby-syntax-propertize-function) + (ruby-font-lock-syntactic-keywords): Remove the "not comments" + matchers. Expression expansions are not comments when inside a + string, and there comment syntax status is irrelevant. + (ruby-match-expression-expansion): New function. Check that + expression expansion is inside a string, and it's not escaped. + (ruby-font-lock-keywords): Use it. + +2012-09-05 Martin Rudalics + + * help.el (temp-buffer-max-height): New default value. + (temp-buffer-resize-frames): New option. + (resize-temp-buffer-window): Optionally resize frame. + + * window.el (fit-frame-to-buffer-bottom-margin): New option. + (fit-frame-to-buffer): New function. + +2012-09-05 Glenn Morris + + * emulation/cua-rect.el (cua--init-rectangles): + * textmodes/picture.el (picture-mode-map): + * play/blackbox.el (blackbox-mode-map): Remap right-char and left-char + like forward-char and backward-char. (Bug#12317) + +2012-09-05 Leo Liu + + * progmodes/flymake.el (flymake-warning-re): New variable. + (flymake-parse-line): Use it. + +2012-09-05 Glenn Morris + + * calendar/holidays.el (holiday-christian-holidays): + Rename an entry. (Bug#12289) + +2012-09-05 Stefan Monnier + + * progmodes/sh-script.el (sh-font-lock-paren): Don't burp at BOB + (bug#12222). + +2012-09-04 Stefan Monnier + + * loadup.el: Load macroexp. Remove hack. + * emacs-lisp/macroexp.el (macroexp--eval-if-compile): New function. + (macroexp--expand-all): Use it to get better warnings. + (macroexp--backtrace, macroexp--trim-backtrace-frame) + (internal-macroexpand-for-load): New functions. + (macroexp--pending-eager-loads): New var. + (emacs-startup-hook): New hack to replace one in loadup.el. + * emacs-lisp/cl-macs.el (cl--compiler-macro-list*) + (cl--compiler-macro-cXXr): Move to top, before they can be used. + (cl-psetf): Simplify. + (cl-defstruct): Add indent rule. + +2012-09-04 Lars Ingebrigtsen + + * mail/smtpmail.el (smtpmail-send-it): Prefer the From: header + over `user-mail-address' for the SMTP MAIL FROM envelope. + (smtpmail-via-smtp): Ditto. + +2012-09-04 Dmitry Gutov + + * progmodes/ruby-mode.el: Clean up keybindings. + (ruby-mode-map): Don't bind ruby-electric-brace, + ruby-beginning-of-defun, ruby-end-of-defun, ruby-mark-defun, + backward-kill-word, reindent-then-newline-and-indent. + (ruby-mark-defun): Remove. + (ruby-electric-brace): Remove. Obsoleted by electric-indent-chars. + (ruby-mode): Set local beginning-of-defun-function and + end-of-defun-function values. + +2012-09-03 Martin Rudalics + + * window.el (temp-buffer-window-setup-hook) + (temp-buffer-window-show-hook): New hooks. + (temp-buffer-window-setup, temp-buffer-window-show) + (with-temp-buffer-window): New functions. + (fit-window-to-buffer): Remove unused optional argument OVERRIDE. + (special-display-popup-frame): Make sure the window used shows BUFFER. + + * help.el (temp-buffer-resize-mode): Fix doc-string. + (resize-temp-buffer-window): New optional argument WINDOW. + + * files.el (recover-file, save-buffers-kill-emacs): + * dired.el (dired-mark-pop-up): Use with-temp-buffer-window. + +2012-09-02 Michael Albinus + + * eshell/em-unix.el (eshell/sudo): When we have an ad-hoc + remote definition of `default-directory', ensure we can connect. + +2012-09-02 Juri Linkov + + Toggle whitespace matching mode with M-s SPC. + http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00008.html + + * isearch.el (search-whitespace-regexp): Doc fix. + Remove cons cell customization. + (isearch-mode-map): Bind "\M-s " to isearch-toggle-lax-whitespace. + (isearch-lax-whitespace, isearch-regexp-lax-whitespace): + New variables. + (isearch-forward, isearch-forward-regexp): Doc fix. + (isearch-toggle-lax-whitespace): New command. + (search-forward-lax-whitespace, search-backward-lax-whitespace) + (re-search-forward-lax-whitespace) + (re-search-backward-lax-whitespace): New functions. + (isearch-whitespace-regexp): Remove function. + (isearch-query-replace): Let-bind replace-search-function and + replace-re-search-function. + (isearch-occur): Let-bind search-spaces-regexp according to the + value of isearch-lax-whitespace and isearch-regexp-lax-whitespace. + (isearch-quote-char): Check isearch-regexp-lax-whitespace in the + condition for C-q SPC. + (isearch-search-fun-default): Use new functions mentioned above. + (isearch-search-forward, isearch-search-backward): Remove functions. + (isearch-search): Don't let-bind search-spaces-regexp. + (isearch-lazy-highlight-space-regexp): Remove variable. + (isearch-lazy-highlight-lax-whitespace) + (isearch-lazy-highlight-regexp-lax-whitespace): New variables. + (isearch-lazy-highlight-new-loop): Use them. + (isearch-lazy-highlight-search): Don't let-bind search-spaces-regexp. + +2012-09-02 Chong Yidong + + * dired.el (dired-mode-map): Menu string fixes (Bug#11616). + +2012-09-02 Glenn Morris + + * simple.el (undo): Tweak message in undo-only case. (Bug#12283) + +2012-09-01 Glenn Morris + + * term.el: Tidy up menu definitions. + (term-mode-map): Use easymenu for In/Out, Complete menus. + (term-pager-break-map): Initialize in the defvar. + (term-terminal-menu, term-signals-menu): Define with easymenu. + (term-terminal-menu): Also show it in line-mode. (Bug#11957) + (term-pager-menu): New, extracted from term-process-pager. + (term-mode, term-char-mode, term-process-pager): Use easymenu-add. + (term-update-mode-line): Propertize line/char and page items. + (term-process-pager): Move keymap initialization elsewhere. + +2012-09-01 Martin Rudalics + + * window.el (switch-to-prev-buffer): Handle additional values of + BURY-OR-KILL argument. Don't switch in minibuffer window. + (switch-to-next-buffer): Don't switch in minibuffer window. + (quit-restore-window): New function based on quit-window. + Handle additional values of former KILL argument. + (quit-window): Call quit-restore-window with appropriate + interpretation of KILL argument. + (display-buffer-below-selected): New buffer display action + function. + +2012-09-01 Stefan Monnier + + * minibuffer.el (completion-at-point-functions): Complete docstring + (bug#12254). + +2012-09-01 Paul Eggert + + Better seed support for (random). + * play/5x5.el, play/animate.el, play/cookie1.el, play/dissociate.el: + * play/doctor.el, play/dunnet.el, play/gomoku.el, play/landmark.el: + * play/mpuz.el, play/tetris.el, play/zone.el: + * calc/calc-comb.el (math-init-random-base): + * play/blackbox.el (bb-init-board): + * play/life.el (life): + * server.el (server-use-tcp): + * type-break.el (type-break): + Remove unnecessary call to (random t). + * net/sasl.el (sasl-unique-id-function): + Change (random t) to (random), now that the latter is more random. + * play/life.el (life-initialized): Remove no-longer-needed var. + +2012-08-31 Alp Aker + + * window.el (switch-to-prev-buffer, switch-to-next-buffer): + Consider frame's buffer predicate when choosing the buffer. + (Bug#12081) + +2012-08-30 Richard Stallman + + * simple.el (special-mode-map): Delete binding for `z'. + +2012-08-30 Andreas Schwab + + * progmodes/compile.el (compilation-always-kill): Doc fix. + +2012-08-30 Chong Yidong + + * window.el (display-buffer-reuse-frames): Make the obsolescence + message more informative. + +2012-08-30 Glenn Morris + + * paren.el (show-paren-delay): + Add a :set function. Doc fix. (Bug#12297) + +2012-08-29 Martin Blais (tiny change) + + * progmodes/compile.el (compilation-always-kill): New var. + (compilation-start): Use it. + +2012-08-29 Stefan Monnier + + * simple.el (read-only-mode): Move from files.el for bootstrapping. + * files.el (read-only-mode): Move to simple.el. + + * files.el (read-only-mode): New minor mode. + (toggle-read-only): Use it and mark obsolete. + (find-file--read-only): + * vc/vc.el (vc-next-action, vc-checkout): + * vc/vc-cvs.el (vc-cvs-checkout): + * obsolete/vc-mcvs.el (vc-mcvs-update): + * ffap.el (ffap--toggle-read-only): Update callers. + +2012-08-29 Michael Albinus + + * eshell/esh-ext.el (eshell-external-command): Do not examine + remote shell scripts. + See . + + * net/tramp-sh.el (tramp-remote-path): Add "/sbin" and + "/usr/local/sbin". + +2012-08-28 Stefan Monnier + + * emacs-lisp/cl-lib.el (buffer-string): Fix setter macro (bug#12293). + +2012-08-28 Leo Liu + + * progmodes/sh-script.el (sh-dynamic-complete-functions): Adapt to + completion-at-point. (Bug#12220) + + * skeleton.el (skeleton-untabify): Change to nil (bug#12223). + + * progmodes/sh-script.el (sh-indent-comment): Change to t (bug#12267). + +2012-08-28 Stefan Monnier + + * files.el (safe-local-eval-forms): Fix before-save-hook entry to + be buffer-local; add delete-trailing-whitespace (bug#12259). + +2012-08-28 Jeremy Moore (tiny change) + + * progmodes/hideif.el (hif-compress-define-list): + Fix typo. (Bug#11951) + +2012-08-28 Dan Nicolaescu + + * progmodes/hideshow.el (hs-block-end-regexp): Restore lost + buffer local setting. + + * net/rcirc.el (rcirc-split-message): Fix for buffer-local + rcirc-encode-coding-system. + +2012-08-28 Leo Liu + + * net/rcirc.el (rcirc-split-message): New function. + (rcirc-send-message): Use it. (Bug#12051) + +2012-08-28 Juri Linkov + + * info.el (Info-fontify-node): Hide empty lines at the end of + the node. (Bug#12272) + +2012-08-27 Drew Adams + + * dired.el (dired-pop-to-buffer): Make window start at beginning + of buffer (Bug#12281). + +2012-08-26 Chong Yidong + + * window.el (special-display-regexps, special-display-frame-alist) + (special-display-buffer-names, special-display-function) + (display-buffer-reuse-frames): Mark as obsolete. + + * progmodes/compile.el: Don't use display-buffer-reuse-frames. + + * help.el (help-print-return-message): Don't treat + display-buffer-reuse-frames specially. + +2012-08-26 Chong Yidong + + * progmodes/gdb-mi.el (gdb-display-buffer-other-frame-action): + New variable, replacing gdb-frame-parameters. + (gdb-frame-io-buffer, gdb-frame-breakpoints-buffer) + (gdb-frame-threads-buffer, gdb-frame-memory-buffer) + (gdb-frame-disassembly-buffer, gdb-frame-stack-buffer) + (gdb-frame-locals-buffer, gdb-frame-registers-buffer): Use it. + (def-gdb-frame-for-buffer): Macro deleted. It is easier to define + the functions directly with gdb-display-buffer-other-frame-action. + (gdb-display-breakpoints-buffer, gdb-display-threads-buffer) + (gdb-display-memory-buffer, gdb-display-disassembly-buffer) + (gdb-display-stack-buffer, gdb-display-locals-buffer) + (gdb-display-registers-buffer): Define directly. + (def-gdb-display-buffer): Macro deleted. + (gdb-display-buffer): Remove second and third args, callers don't + use them. Defer to the default display-buffer behavior, apart + from making windows dedicated. + (gdb-setup-windows): Don't call display-buffer unnecessarily. + + * progmodes/gud.el (gud-display-line): Just use display-buffer. + + * window.el (display-buffer-pop-up-frame): Handle a + pop-up-frame-parameters alist entry. + (display-buffer): Document it. + +2012-08-26 Chong Yidong + + * isearch.el (search-whitespace-regexp): Make string and nil + values apply to both ordinary and regexp search. Allow a cons + cell value to distinguish between the two. + (isearch-whitespace-regexp, isearch-search-forward) + (isearch-search-backward): New functions. + (isearch-occur, isearch-search-fun-default, isearch-search) + (isearch-lazy-highlight-new-loop): Use them. + (isearch-forward, isearch-forward-regexp): Doc fix. + +2012-08-26 Chong Yidong + + * faces.el (help-argument-name): Always inherit from italic + (Bug#12213). + +2012-08-25 Martin Rudalics + + * window.el (window--even-window-heights): Even heights when + WINDOW and the selected window form a vertical combination. + (display-buffer-use-some-window): Provide that window used gets + sized back by quit-window. (Bug#11880) and (Bug#12091) + +2012-08-24 Paul Eggert + + Fix file time stamp problem with bzr and CVS (Bug#12001). + * vc/vc-cvs.el (vc-cvs-parse-entry): Ignore subsecond information + in the file's time stamp, since the version control system loses + that information. + +2012-08-22 Juri Linkov + + * info.el (Info-fontify-node): Hide the suffix of the + Info file name in the header line. (Bug#12187) + +2012-08-22 Glenn Morris + + * calendar/cal-tex.el (cal-tex-weekly-common): + Restore leading blank page. + +2012-08-22 Le Wang (tiny change) + + * misc.el (forward-to-word, backward-to-word): Activate or extend + the region under `shift-select-mode'. (Bug#12231) + +2012-08-22 Bastien Guerry + + * progmodes/executable.el (executable-prefix): Set to "#!" instead + of "#! ". http://www.in-ulm.de/~mascheck/various/shebang/#details + gives details on why the space is never needed. + +2012-08-22 Martin Rudalics + + * window.el (walk-window-tree, window-with-parameter): + New optional argument MINIBUF to control whether these functions + should run on the minibuffer window. + (window-at-side-list): Don't operate on minibuffer window. + (window-in-direction): Simplify and rewrite doc-string. + (window--size-ignore): Rename to window--size-ignore-p. + Update callers. + (display-buffer-in-atom-window, window--major-non-side-window) + (window--major-side-window, display-buffer-in-major-side-window) + (delete-side-window, display-buffer-in-side-window): + New functions. + (window--side-check, window-deletable-p, delete-window) + (delete-other-windows, split-window): Handle side windows and + atomic windows appropriately. + (window--display-buffer): Call display-buffer-record-window also + when the window buffer did not change. + +2012-08-22 Christopher Schmidt + + * help-fns.el (help-fns--key-bindings): + Abbreviate non-symbol remap targets. (Bug#12174) + +2012-08-22 Martin Rudalics + + * dired.el (dired-mark-remembered): Don't clobber point. + (Bug#11795) + +2012-08-22 Glenn Morris + + * progmodes/bug-reference.el (bug-reference): New custom group. + (bug-reference-bug-regexp): Make it a defcustom. 2012-08-22 Daiki Ueno diff --cc lisp/profiler.el index 00000000000,91bd744fb35..5fc74573262 mode 000000,100644..100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@@ -1,0 -1,661 +1,665 @@@ + ;;; profiler.el --- UI and helper functions for Emacs's native profiler -*- lexical-binding: t -*- + + ;; Copyright (C) 2012 Free Software Foundation, Inc. + + ;; Author: Tomohiro Matsuyama + ;; Keywords: lisp + + ;; 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 . + + ;;; Commentary: + + ;; + + ;;; Code: + + (eval-when-compile + (require 'cl-lib)) + + (defgroup profiler nil + "Emacs profiler." + :group 'lisp + :prefix "profiler-") + + (defcustom profiler-sample-interval 1 + "Default sample interval in millisecond." + :type 'integer + :group 'profiler) + + ;;; Utilities + + (defun profiler-ensure-string (object) + (cond ((stringp object) + object) + ((symbolp object) + (symbol-name object)) + ((numberp object) + (number-to-string object)) + (t + (format "%s" object)))) + + (defun profiler-format (fmt &rest args) + (cl-loop for (width align subfmt) in fmt + for arg in args + for str = (cond + ((consp subfmt) + (apply 'profiler-format subfmt arg)) + ((stringp subfmt) + (format subfmt arg)) + ((and (symbolp subfmt) + (fboundp subfmt)) + (funcall subfmt arg)) + (t + (profiler-ensure-string arg))) + for len = (length str) + if (< width len) + collect (substring str 0 width) into frags + else + collect + (let ((padding (make-string (- width len) ?\s))) + (cl-ecase align + (left (concat str padding)) + (right (concat padding str)))) + into frags + finally return (apply #'concat frags))) + + (defun profiler-format-percent (number divisor) + (concat (number-to-string (/ (* number 100) divisor)) "%")) + + (defun profiler-format-nbytes (nbytes) + "Format NBYTES in humarn readable string." + (if (and (integerp nbytes) (> nbytes 0)) + (cl-loop with i = (% (1+ (floor (log10 nbytes))) 3) + for c in (append (number-to-string nbytes) nil) + if (= i 0) + collect ?, into s + and do (setq i 3) + collect c into s + do (cl-decf i) + finally return + (apply 'string (if (eq (car s) ?,) (cdr s) s))) + (profiler-ensure-string nbytes))) + + + ;;; Entries + + (defun profiler-entry-format (entry) + "Format ENTRY in human readable string. ENTRY would be a + function name of a function itself." + (cond ((memq (car-safe entry) '(closure lambda)) + (format "#" (sxhash entry))) + ((byte-code-function-p entry) + (format "#" (sxhash entry))) + ((or (subrp entry) (symbolp entry) (stringp entry)) + (format "%s" entry)) + (t + (format "#" (sxhash entry))))) + + ;;; Log data structure + + ;; The C code returns the log in the form of a hash-table where the keys are + ;; vectors (of size profiler-max-stack-depth, holding truncated + ;; backtraces, where the first element is the top of the stack) and + ;; the values are integers (which count how many times this backtrace + ;; has been seen, multiplied by a "weight factor" which is either the + ;; sample-interval or the memory being allocated). + ;; We extend it by adding a few other entries to the hash-table, most notably: + ;; - Key `type' has a value indicating the kind of log (`memory' or `cpu'). + ;; - Key `timestamp' has a value giving the time when the log was obtained. + ;; - Key `diff-p' indicates if this log represents a diff between two logs. + + (defun profiler-log-timestamp (log) (gethash 'timestamp log)) + (defun profiler-log-type (log) (gethash 'type log)) + (defun profiler-log-diff-p (log) (gethash 'diff-p log)) + + (defun profiler-log-diff (log1 log2) + "Compare LOG1 with LOG2 and return a diff log. Both logs must + be same type." + (unless (eq (profiler-log-type log1) + (profiler-log-type log2)) + (error "Can't compare different type of logs")) + (let ((newlog (make-hash-table :test 'equal))) + ;; Make a copy of `log1' into `newlog'. + (maphash (lambda (backtrace count) (puthash backtrace count newlog)) + log1) + (puthash 'diff-p t newlog) + (maphash (lambda (backtrace count) + (when (vectorp backtrace) + (puthash backtrace (- (gethash backtrace log1 0) count) + newlog))) + log2) + newlog)) + + (defun profiler-log-fixup-entry (entry) + (if (symbolp entry) + entry + (profiler-entry-format entry))) + + (defun profiler-log-fixup-backtrace (backtrace) + (mapcar 'profiler-log-fixup-entry backtrace)) + + (defun profiler-log-fixup (log) + "Fixup LOG so that the log could be serialized into file." + (let ((newlog (make-hash-table :test 'equal))) + (maphash (lambda (backtrace count) + (puthash (if (not (vectorp backtrace)) + backtrace + (profiler-log-fixup-backtrace backtrace)) + count newlog)) + log) + newlog)) + + (defun profiler-log-write-file (log filename &optional confirm) + "Write LOG into FILENAME." + (with-temp-buffer + (let (print-level print-length) + (print (profiler-log-fixup log) (current-buffer))) + (write-file filename confirm))) + + (defun profiler-log-read-file (filename) + "Read log from FILENAME." + (with-temp-buffer + (insert-file-contents filename) + (goto-char (point-min)) + (read (current-buffer)))) + + + ;;; Calltree data structure + + (cl-defstruct (profiler-calltree (:constructor profiler-make-calltree)) + entry + (count 0) (count-percent "") + parent children) + + (defun profiler-calltree-leaf-p (tree) + (null (profiler-calltree-children tree))) + + (defun profiler-calltree-count< (a b) + (cond ((eq (profiler-calltree-entry a) t) t) + ((eq (profiler-calltree-entry b) t) nil) + (t (< (profiler-calltree-count a) + (profiler-calltree-count b))))) + + (defun profiler-calltree-count> (a b) + (not (profiler-calltree-count< a b))) + + (defun profiler-calltree-depth (tree) + (let ((parent (profiler-calltree-parent tree))) + (if (null parent) + 0 + (1+ (profiler-calltree-depth parent))))) + + (defun profiler-calltree-find (tree entry) + "Return a child tree of ENTRY under TREE." + ;; OPTIMIZED + (let (result (children (profiler-calltree-children tree))) + ;; FIXME: Use `assoc'. + (while (and children (null result)) + (let ((child (car children))) + (when (equal (profiler-calltree-entry child) entry) + (setq result child)) + (setq children (cdr children)))) + result)) + + (defun profiler-calltree-walk (calltree function) + (funcall function calltree) + (dolist (child (profiler-calltree-children calltree)) + (profiler-calltree-walk child function))) + + (defun profiler-calltree-build-1 (tree log &optional reverse) ++ ;; FIXME: Do a better job of reconstructing a complete call-tree ++ ;; when the backtraces have been truncated. Ideally, we should be ++ ;; able to reduce profiler-max-stack-depth to 3 or 4 and still ++ ;; get a meaningful call-tree. + (maphash + (lambda (backtrace count) + (when (vectorp backtrace) + (let ((node tree) + (max (length backtrace))) + (dotimes (i max) + (let ((entry (aref backtrace (if reverse i (- max i 1))))) + (when entry + (let ((child (profiler-calltree-find node entry))) + (unless child + (setq child (profiler-make-calltree + :entry entry :parent node)) + (push child (profiler-calltree-children node))) + (cl-incf (profiler-calltree-count child) count) + (setq node child)))))))) + log)) + + (defun profiler-calltree-compute-percentages (tree) + (let ((total-count 0)) + ;; FIXME: the memory profiler's total wraps around all too easily! + (dolist (child (profiler-calltree-children tree)) + (cl-incf total-count (profiler-calltree-count child))) + (unless (zerop total-count) + (profiler-calltree-walk + tree (lambda (node) + (setf (profiler-calltree-count-percent node) + (profiler-format-percent (profiler-calltree-count node) + total-count))))))) + + (cl-defun profiler-calltree-build (log &key reverse) + (let ((tree (profiler-make-calltree))) + (profiler-calltree-build-1 tree log reverse) + (profiler-calltree-compute-percentages tree) + tree)) + + (defun profiler-calltree-sort (tree predicate) + (let ((children (profiler-calltree-children tree))) + (setf (profiler-calltree-children tree) (sort children predicate)) + (dolist (child (profiler-calltree-children tree)) + (profiler-calltree-sort child predicate)))) + + + ;;; Report rendering + + (defcustom profiler-report-closed-mark "+" + "An indicator of closed calltrees." + :type 'string + :group 'profiler) + + (defcustom profiler-report-open-mark "-" + "An indicator of open calltrees." + :type 'string + :group 'profiler) + + (defcustom profiler-report-leaf-mark " " + "An indicator of calltree leaves." + :type 'string + :group 'profiler) + + (defvar profiler-report-sample-line-format + '((60 left) + (14 right ((9 right) + (5 right))))) + + (defvar profiler-report-memory-line-format + '((55 left) + (19 right ((14 right profiler-format-nbytes) + (5 right))))) + + (defvar-local profiler-report-log nil + "The current profiler log.") + + (defvar-local profiler-report-reversed nil + "True if calltree is rendered in bottom-up. Do not touch this + variable directly.") + + (defvar-local profiler-report-order nil + "The value can be `ascending' or `descending'. Do not touch + this variable directly.") + + (defun profiler-report-make-entry-part (entry) + (let ((string (cond + ((eq entry t) + "Others") + ((and (symbolp entry) + (fboundp entry)) + (propertize (symbol-name entry) + 'face 'link + 'mouse-face 'highlight + 'help-echo "mouse-2 or RET jumps to definition")) + (t + (profiler-entry-format entry))))) + (propertize string 'profiler-entry entry))) + + (defun profiler-report-make-name-part (tree) + (let* ((entry (profiler-calltree-entry tree)) + (depth (profiler-calltree-depth tree)) + (indent (make-string (* (1- depth) 2) ?\s)) + (mark (if (profiler-calltree-leaf-p tree) + profiler-report-leaf-mark + profiler-report-closed-mark)) + (entry (profiler-report-make-entry-part entry))) + (format "%s%s %s" indent mark entry))) + + (defun profiler-report-header-line-format (fmt &rest args) + (let* ((header (apply 'profiler-format fmt args)) + (escaped (replace-regexp-in-string "%" "%%" header))) + (concat " " escaped))) + + (defun profiler-report-line-format (tree) + (let ((diff-p (profiler-log-diff-p profiler-report-log)) + (name-part (profiler-report-make-name-part tree)) + (count (profiler-calltree-count tree)) + (count-percent (profiler-calltree-count-percent tree))) + (profiler-format (cl-ecase (profiler-log-type profiler-report-log) + (cpu profiler-report-sample-line-format) + (memory profiler-report-memory-line-format)) + name-part + (if diff-p + (list (if (> count 0) + (format "+%s" count) + count) + "") + (list count count-percent))))) + + (defun profiler-report-insert-calltree (tree) + (let ((line (profiler-report-line-format tree))) + (insert (propertize (concat line "\n") 'calltree tree)))) + + (defun profiler-report-insert-calltree-children (tree) + (mapc 'profiler-report-insert-calltree + (profiler-calltree-children tree))) + + + ;;; Report mode + + (defvar profiler-report-mode-map + (let ((map (make-sparse-keymap))) + ;; FIXME: Add menu. + (define-key map "n" 'profiler-report-next-entry) + (define-key map "p" 'profiler-report-previous-entry) + ;; I find it annoying more than helpful to not be able to navigate + ;; normally with the cursor keys. --Stef + ;; (define-key map [down] 'profiler-report-next-entry) + ;; (define-key map [up] 'profiler-report-previous-entry) + (define-key map "\r" 'profiler-report-toggle-entry) + (define-key map "\t" 'profiler-report-toggle-entry) + (define-key map "i" 'profiler-report-toggle-entry) + (define-key map "f" 'profiler-report-find-entry) + (define-key map "j" 'profiler-report-find-entry) + (define-key map [mouse-2] 'profiler-report-find-entry) + (define-key map "d" 'profiler-report-describe-entry) + (define-key map "C" 'profiler-report-render-calltree) + (define-key map "B" 'profiler-report-render-reversed-calltree) + (define-key map "A" 'profiler-report-ascending-sort) + (define-key map "D" 'profiler-report-descending-sort) + (define-key map "=" 'profiler-report-compare-log) + (define-key map (kbd "C-x C-w") 'profiler-report-write-log) + (define-key map "q" 'quit-window) + map)) + + (defun profiler-report-make-buffer-name (log) + (format "*%s-Profiler-Report %s*" + (cl-ecase (profiler-log-type log) (cpu 'CPU) (memory 'Memory)) + (format-time-string "%Y-%m-%d %T" (profiler-log-timestamp log)))) + + (defun profiler-report-setup-buffer (log) + "Make a buffer for LOG and return it." + (let* ((buf-name (profiler-report-make-buffer-name log)) + (buffer (get-buffer-create buf-name))) + (with-current-buffer buffer + (profiler-report-mode) + (setq profiler-report-log log + profiler-report-reversed nil + profiler-report-order 'descending)) + buffer)) + + (define-derived-mode profiler-report-mode special-mode "Profiler-Report" + "Profiler Report Mode." + (setq buffer-read-only t + buffer-undo-list t + truncate-lines t)) + + + ;;; Report commands + + (defun profiler-report-calltree-at-point () + (get-text-property (point) 'calltree)) + + (defun profiler-report-move-to-entry () + (let ((point (next-single-property-change (line-beginning-position) + 'profiler-entry))) + (if point + (goto-char point) + (back-to-indentation)))) + + (defun profiler-report-next-entry () + "Move cursor to next entry." + (interactive) + (forward-line) + (profiler-report-move-to-entry)) + + (defun profiler-report-previous-entry () + "Move cursor to previous entry." + (interactive) + (forward-line -1) + (profiler-report-move-to-entry)) + + (defun profiler-report-expand-entry () + "Expand entry at point." + (interactive) + (save-excursion + (beginning-of-line) + (when (search-forward (concat profiler-report-closed-mark " ") + (line-end-position) t) + (let ((tree (profiler-report-calltree-at-point))) + (when tree + (let ((inhibit-read-only t)) + (replace-match (concat profiler-report-open-mark " ")) + (forward-line) + (profiler-report-insert-calltree-children tree) + t)))))) + + (defun profiler-report-collapse-entry () + "Collpase entry at point." + (interactive) + (save-excursion + (beginning-of-line) + (when (search-forward (concat profiler-report-open-mark " ") + (line-end-position) t) + (let* ((tree (profiler-report-calltree-at-point)) + (depth (profiler-calltree-depth tree)) + (start (line-beginning-position 2)) + d) + (when tree + (let ((inhibit-read-only t)) + (replace-match (concat profiler-report-closed-mark " ")) + (while (and (eq (forward-line) 0) + (let ((child (get-text-property (point) 'calltree))) + (and child + (numberp (setq d (profiler-calltree-depth child))))) + (> d depth))) + (delete-region start (line-beginning-position))))) + t))) + + (defun profiler-report-toggle-entry () + "Expand entry at point if the tree is collapsed, + otherwise collapse." + (interactive) + (or (profiler-report-expand-entry) + (profiler-report-collapse-entry))) + + (defun profiler-report-find-entry (&optional event) + "Find entry at point." + (interactive (list last-nonmenu-event)) + (if event (posn-set-point (event-end event))) + (let ((tree (profiler-report-calltree-at-point))) + (when tree + (let ((entry (profiler-calltree-entry tree))) + (find-function entry))))) + + (defun profiler-report-describe-entry () + "Describe entry at point." + (interactive) + (let ((tree (profiler-report-calltree-at-point))) + (when tree + (let ((entry (profiler-calltree-entry tree))) + (require 'help-fns) + (describe-function entry))))) + + (cl-defun profiler-report-render-calltree-1 + (log &key reverse (order 'descending)) + (let ((calltree (profiler-calltree-build profiler-report-log + :reverse reverse))) + (setq header-line-format + (cl-ecase (profiler-log-type log) + (cpu + (profiler-report-header-line-format + profiler-report-sample-line-format + "Function" (list "Time (ms)" "%"))) + (memory + (profiler-report-header-line-format + profiler-report-memory-line-format + "Function" (list "Bytes" "%"))))) + (let ((predicate (cl-ecase order + (ascending #'profiler-calltree-count<) + (descending #'profiler-calltree-count>)))) + (profiler-calltree-sort calltree predicate)) + (let ((inhibit-read-only t)) + (erase-buffer) + (profiler-report-insert-calltree-children calltree) + (goto-char (point-min)) + (profiler-report-move-to-entry)))) + + (defun profiler-report-rerender-calltree () + (profiler-report-render-calltree-1 profiler-report-log + :reverse profiler-report-reversed + :order profiler-report-order)) + + (defun profiler-report-render-calltree () + "Render calltree view." + (interactive) + (setq profiler-report-reversed nil) + (profiler-report-rerender-calltree)) + + (defun profiler-report-render-reversed-calltree () + "Render reversed calltree view." + (interactive) + (setq profiler-report-reversed t) + (profiler-report-rerender-calltree)) + + (defun profiler-report-ascending-sort () + "Sort calltree view in ascending order." + (interactive) + (setq profiler-report-order 'ascending) + (profiler-report-rerender-calltree)) + + (defun profiler-report-descending-sort () + "Sort calltree view in descending order." + (interactive) + (setq profiler-report-order 'descending) + (profiler-report-rerender-calltree)) + + (defun profiler-report-log (log) + (let ((buffer (profiler-report-setup-buffer log))) + (with-current-buffer buffer + (profiler-report-render-calltree)) + (pop-to-buffer buffer))) + + (defun profiler-report-compare-log (buffer) + "Compare the current profiler log with another." + (interactive (list (read-buffer "Compare to: "))) + (let* ((log1 (with-current-buffer buffer profiler-report-log)) + (log2 profiler-report-log) + (diff-log (profiler-log-diff log1 log2))) + (profiler-report-log diff-log))) + + (defun profiler-report-write-log (filename &optional confirm) + "Write the current profiler log into FILENAME." + (interactive + (list (read-file-name "Write log: " default-directory) + (not current-prefix-arg))) + (profiler-log-write-file profiler-report-log + filename + confirm)) + + + ;;; Profiler commands + + ;;;###autoload + (defun profiler-start (mode) + "Start/restart profilers. + MODE can be one of `cpu', `mem', or `cpu+mem'. + If MODE is `cpu' or `cpu+mem', time-based profiler will be started. + Also, if MODE is `mem' or `cpu+mem', then memory profiler will be started." + (interactive + (list (if (not (fboundp 'profiler-cpu-start)) 'mem + (intern (completing-read "Mode (default cpu): " + '("cpu" "mem" "cpu+mem") + nil t nil nil "cpu"))))) + (cl-ecase mode + (cpu + (profiler-cpu-start profiler-sample-interval) + (message "CPU profiler started")) + (mem + (profiler-memory-start) + (message "Memory profiler started")) + (cpu+mem + (profiler-cpu-start profiler-sample-interval) + (profiler-memory-start) + (message "CPU and memory profiler started")))) + + (defun profiler-stop () + "Stop started profilers. Profiler logs will be kept." + (interactive) + (let ((cpu (if (fboundp 'profiler-cpu-stop) (profiler-cpu-stop))) + (mem (profiler-memory-stop))) + (message "%s profiler stopped" + (cond ((and mem cpu) "CPU and memory") + (mem "Memory") + (cpu "CPU") + (t "No"))))) + + (defun profiler-reset () + "Reset profiler log." + (interactive) + (when (fboundp 'profiler-cpu-log) + (ignore (profiler-cpu-log))) + (ignore (profiler-memory-log)) + t) + + (defun profiler--report-cpu () + (let ((log (if (fboundp 'profiler-cpu-log) (profiler-cpu-log)))) + (when log + (puthash 'type 'cpu log) + (puthash 'timestamp (current-time) log) + (profiler-report-log log)))) + + (defun profiler--report-memory () + (let ((log (profiler-memory-log))) + (when log + (puthash 'type 'memory log) + (puthash 'timestamp (current-time) log) + (profiler-report-log log)))) + + (defun profiler-report () + "Report profiling results." + (interactive) + (profiler--report-cpu) + (profiler--report-memory)) + + ;;;###autoload + (defun profiler-find-log (filename) + "Read a profiler log from FILENAME and report it." + (interactive + (list (read-file-name "Find log: " default-directory))) + (profiler-report-log (profiler-log-read-file filename))) + + + ;;; Profiling helpers + -(cl-defmacro with-sample-profiling ((&key interval) &rest body) - `(unwind-protect - (progn - (ignore (profiler-cpu-log)) - (profiler-cpu-start ,interval) - ,@body) - (profiler-cpu-stop) - (profiler--report-cpu))) - -(defmacro with-memory-profiling (&rest body) - `(unwind-protect - (progn - (ignore (profiler-memory-log)) - (profiler-memory-start) - ,@body) - (profiler-memory-stop) - (profiler--report-memory))) ++;; (cl-defmacro with-sample-profiling ((&key interval) &rest body) ++;; `(unwind-protect ++;; (progn ++;; (ignore (profiler-cpu-log)) ++;; (profiler-cpu-start ,interval) ++;; ,@body) ++;; (profiler-cpu-stop) ++;; (profiler--report-cpu))) ++ ++;; (defmacro with-memory-profiling (&rest body) ++;; `(unwind-protect ++;; (progn ++;; (ignore (profiler-memory-log)) ++;; (profiler-memory-start) ++;; ,@body) ++;; (profiler-memory-stop) ++;; (profiler--report-memory))) + + (provide 'profiler) + ;;; profiler.el ends here diff --cc src/ChangeLog index 3e999f3f699,ce6f56fa8fc..47e2b7a7fea --- a/src/ChangeLog +++ b/src/ChangeLog @@@ -1,1963 -1,61 +1,1989 @@@ -2012-09-26 Stefan Monnier - - * profiler.c (Fprofiler_cpu_stop, Fprofiler_memory_stop): - Return whether the profiler was running, instead of signaling an error - if it wasn't. - -2012-09-26 Juanma Barranquero ++2012-09-26 Tomohiro Matsuyama ++ Stefan Monnier ++ Juanma Barranquero + ++ * profiler.c: New file. ++ * Makefile.in (base_obj): Add profiler.o. + * makefile.w32-in (OBJ2, GLOBAL_SOURCES): Add profiler.c. + ($(BLD)/profiler.$(O)): New target. ++ * emacs.c (main): Call syms_of_profiler. ++ * alloc.c (Qautomatic_gc): New constant. ++ (MALLOC_PROBE): New macro. ++ (xmalloc, xzalloc, xrealloc, lisp_malloc, lisp_align_malloc): Use it. ++ (total_bytes_of_live_objects): New function. ++ (Fgarbage_collect): Use it. Record itself in backtrace_list. ++ Call malloc_probe for the memory profiler. ++ (syms_of_alloc): Define Qautomatic_gc. ++ * eval.c (eval_sub, Ffuncall): Reorder assignments to avoid ++ race condition. ++ (struct backtrace): Move definition... ++ * lisp.h (struct backtrace): ..here. ++ (Qautomatic_gc, profiler_memory_running): Declare vars. ++ (malloc_probe, syms_of_profiler): Declare functions. ++ * xdisp.c (Qautomatic_redisplay): New constant. ++ (redisplay_internal): Record itself in backtrace_list. ++ (syms_of_xdisp): Define Qautomatic_redisplay. + -2012-09-25 Stefan Monnier +2012-09-25 Juanma Barranquero - * profiler.c: Rename sample_profiler_* to profiler_cpu_* and - memory_profiler_* to profiler_memory_*. Move sigprof_handler before - its first use, inside the PROFILER_CPU_SUPPORT conditional. + * makefile.w32-in ($(BLD)/callproc.$(O)): Update dependencies. -2012-09-24 Stefan Monnier +2012-09-25 Paul Eggert + + Prefer POSIX timers if available. + They avoid a race if the timer is too close to the current time. + * atimer.c (alarm_timer, alarm_timer_ok) [SIGEV_SIGNAL]: New static vars. + (set_alarm) [SIGEV_SIGNAL]: Use POSIX timers if available. + (init_atimer) [SIGEV_SIGNAL]: Initialize them. + +2012-09-25 Eli Zaretskii + + * coding.c (CHAR_STRING_ADVANCE_NO_UNIFY): Make it an alias of + CHAR_STRING_ADVANCE. + (STRING_CHAR_ADVANCE_NO_UNIFY): Make it an alias of + STRING_CHAR_ADVANCE. + +2012-09-25 Juanma Barranquero + + Move Vlibrary_cache to emacs.c and reset before dumping. + + * lisp.h (reset_image_types): Declare. + [WINDOWSNT] (Vlibrary_cache): Declare. + + * image.c (reset_image_types): New function. - * profiler.c (evict_lower_half): Fix typo. - (PROFILER_CPU_SUPPORT): Check and define if cpu-profiler is supported. - Don't compile the cpu-profiler code, if not supported. - (malloc_probe): Presume memory_log is non-nil. - (syms_of_profiler): Don't defsubr functions when they aren't defined. + * emacs.c [WINDOWSNT] (Vlibrary_cache): Move from w32.c. + (syms_of_emacs) [WINDOWSNT] : Initialize and staticpro. + (Fdump_emacs): Reset Vlibrary_cache and image_types. - * lisp.h (sample_profiler_running, gc_probe): Don't declare. + * w32.c (Vlibrary_cache): Do not define; moved to emacs.c + (globals_of_w32) : Do not initialize. + + * w32.h (Vlibrary_cache): Do not declare. + +2012-09-25 Eli Zaretskii + + * w32proc.c (sys_signal): Handle all signals defined by the + MS-Windows runtime, not just SIGCHLD. Actually install the signal + handlers for signals supported by Windows. Don't override + term_ntproc as the handler for SIGABRT. + (sigaction): Rewrite to call sys_signal instead of duplicating its + code. + (sys_kill): Improve commentary. + + * w32.c (term_ntproc): Accept (and ignore) one argument, for + consistency with a signature of a signal handler. All callers + changed. + (init_ntproc): Accept an argument DUMPING. If dumping, don't + install term_ntproc as a signal handler for SIGABRT, as that + should be done by the dumped Emacs. + + * w32.h (init_ntproc, term_ntproc): Adjust prototypes. + + * w32select.c (term_w32select): Protect against repeated + invocation by setting clipboard_owner to NULL after calling + DestroyWindow. + + * emacs.c (shut_down_emacs, main): Adapt the calls to init_ntproc + and term_ntproc to their modified signatures. + + * character.c (char_string, string_char): Remove calls to + MAYBE_UNIFY_CHAR. See the discussion starting at + http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00433.html + for the details. + +2012-09-25 Chong Yidong + + * xdisp.c (mode_line_inverse_video): Delete obsolete variable. 2012-09-24 Stefan Monnier - * xdisp.c (Qautomatic_redisplay): New constant. - (redisplay_internal): Record itself in backtrace_list. - (syms_of_xdisp): Define Qautomatic_redisplay. + * bytecode.c (exec_byte_code): Signal an error instead of aborting, + when encountering an unknown bytecode. + +2012-09-24 Paul Eggert + + image.c, indent.c: Use bool for booleans. + * dispextern.h (struct image_type): Members valid_p, load, init + now return bool, not int. All uses changed. + * image.c: Omit unnecessary static decls. + (x_create_bitmap_mask, x_build_heuristic_mask): + Return void, not int, since callers don't care about the return value. + (x_create_bitmap_mask, define_image_type, valid_image_p) + (struct image_keyword, parse_image_spec, image_spec_value) + (check_image_size, image_background) + (image_background_transparent, x_clear_image_1) + (postprocess_image, lookup_image, x_check_image_size) + (x_create_x_image_and_pixmap, xbm_image_p) + (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data) + (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color) + (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p) + (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color) + (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load) + (png_image_p, init_png_functions, png_load_body, png_load) + (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load) + (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p) + (init_gif_functions, gif_load, imagemagick_image_p) + (imagemagick_load_image, imagemagick_load, svg_image_p) + (init_svg_functions, svg_load, svg_load_image, gs_image_p) + (gs_load): + * nsimage.m (ns_load_image): + * nsterm.m (ns_defined_color): + * xfaces.c (tty_lookup_color, tty_defined_color, defined_color): + * xfns.c (x_defined_color): + * xterm.c (x_alloc_lighter_color_for_widget) + (x_alloc_nearest_color_1, x_alloc_nearest_color) + (x_alloc_lighter_color): + * indent.c (disptab_matches_widthtab, current_column) + (scan_for_column, string_display_width, indented_beyond_p) + (compute_motion, vmotion, Fvertical_motion): + Use bool for booleans. + +2012-09-24 Chong Yidong + + * chartab.c (Fset_char_table_default): Obsolete function removed. + +2012-09-23 Paul Eggert + + Move pid_t related decls out of lisp.h. + * lisp.h, syswait.h (record_child_status_change, wait_for_termination) + (interruptible_wait_for_termination): + Move these decls from lisp.h to syswait.h, since they use pid_t. + Needed on FreeBSD; see Herbert J. Skuhra in + . + * callproc.c: Include syswait.h. + + gnutls.c, gtkutil.c: Use bool for boolean. + * gnutls.c (gnutls_global_initialized, init_gnutls_functions) + (emacs_gnutls_handle_error): + * gtkutil.c (xg_check_special_colors, xg_prepare_tooltip) + (xg_hide_tooltip, xg_create_frame_widgets) + (create_dialog, xg_uses_old_file_dialog) + (xg_get_file_with_chooser, xg_get_file_with_selection) + (xg_get_file_name, xg_have_tear_offs, create_menus, xg_create_widget) + (xg_item_label_same_p, xg_update_menubar) + (xg_modify_menubar_widgets, xg_event_is_for_menubar) + (xg_ignore_gtk_scrollbar, xg_set_toolkit_scroll_bar_thumb) + (xg_event_is_for_scrollbar, xg_pack_tool_bar, xg_make_tool_item) + (is_box_type, xg_tool_item_stale_p, xg_update_tool_bar_sizes) + (update_frame_tool_bar, free_frame_tool_bar): + * gtkutil.c, w32term.c, xterm.c (x_wm_set_size_hint): + * nsmenu.m (ns_update_menubar): + * nsmenu.m, w32menu.c, xmenu.c (set_frame_menubar): + * xfns.c (Fx_show_tip) [USE_GTK]: + Use bool for boolean. + * gtkutil.c (xg_update_frame_menubar): + * xmenu.c (update_frame_menubar): + Return void, not int, since caller ignores return value. + * gtkutil.c (xg_change_toolbar_position): + Return void, not 1. + +2012-09-23 Juanma Barranquero + + * makefile.w32-in (BLOCKINPUT_H): Remove. + (SYSSIGNAL_H): New macro. + ($(BLD)/alloc.$(O), $(BLD)/atimer.$(O), $(BLD)/buffer.$(O)) + ($(BLD)/callproc.$(O), $(BLD)/data.$(O), $(BLD)/dired.$(O)) + ($(BLD)/dispnew.$(O), $(BLD)/editfns.$(O), $(BLD)/emacs.$(O)) + ($(BLD)/eval.$(O), $(BLD)/fileio.$(O), $(BLD)/floatfns.$(O)) + ($(BLD)/fns.$(O), $(BLD)/fontset.$(O), $(BLD)/frame.$(O)) + ($(BLD)/fringe.$(O), $(BLD)/image.$(O), $(BLD)/insdel.$(O)) + ($(BLD)/keyboard.$(O), $(BLD)/keymap.$(O), $(BLD)/lread.$(O)) + ($(BLD)/menu.$(O), $(BLD)/w32inevt.$(O), $(BLD)/w32proc.$(O)) + ($(BLD)/print.$(O), $(BLD)/process.$(O), $(BLD)/ralloc.$(O)) + ($(BLD)/search.$(O), $(BLD)/sound.$(O), $(BLD)/sysdep.$(O)) + ($(BLD)/term.$(O), $(BLD)/window.$(O), $(BLD)/xdisp.$(O)) + ($(BLD)/xfaces.$(O), $(BLD)/w32fns.$(O), $(BLD)/w32menu.$(O)) + ($(BLD)/w32term.$(O), $(BLD)/w32select.$(O), $(BLD)/w32reg.$(O)) + ($(BLD)/w32xfns.$(O)): Update dependencies. + +2012-09-23 Eli Zaretskii + + * .gdbinit: Set breakpoint on terminate_due_to_signal, not on + fatal_error_backtrace. + + * w32proc.c (sys_kill): Undo last change: don't do anything when + invoked to deliver SIGABRT to our own process. This is now + handled by emacs_raise. + +2012-09-23 Juanma Barranquero + + * w32term.c (w32_read_socket): Remove leftover reference to + interrupt_input_pending. + +2012-09-23 Paul Eggert + + Do not use SA_NODEFER. + Problem reported by Dani Moncayo in + . + * alloc.c (die): + * sysdep.c (emacs_abort): Do not reset signal handler. + * emacs.c (terminate_due_to_signal): Reset signal handler here. + * sysdep.c (init_signals): Do not use SA_NODEFER. It wasn't + wanted even on POSIXish hosts, and it doesn't work on Windows. + +2012-09-23 Jan Djärv + + * xterm.c (x_term_init): Call fixup_locale before and after calling + gtk_init (Bug#12392). + +2012-09-23 Chong Yidong + + * w32.c (w32_delayed_load): Remove LIBRARIES argument; always use + Vdynamic_library_alist. + + * gnutls.c (init_gnutls_functions): Caller changed; remove arg. + (Fgnutls_available_p): Caller changed. + + * xml.c (init_libxml2_functions, Flibxml_parse_html_region) + (Flibxml_parse_xml_region): Likewise. + + * dispextern.h (struct image_type): Remove arg from init function. + + * image.c (Finit_image_library, lookup_image_type) + (define_image_type): Remove now-unneeded second arg. + (init_xpm_functions, init_png_functions, init_jpeg_functions) + (init_tiff_functions, init_gif_functions, init_svg_functions): + Arglist and w32_delayed_load calling convention changed. + (gs_type): Remove init_gs_functions; there is no such function. + (valid_image_p, make_image): Fix caller to lookup_image_type. + +2012-09-23 Paul Eggert + + Simplify and avoid signal-handling races (Bug#12471). + * alloc.c (die): + * sysdep.c (emacs_abort) [HAVE_NTGUI]: + Avoid recursive loop if there's a fatal error in the function itself. + * atimer.c (pending_atimers): + * blockinput.h: Don't include "atimer.h"; no longer needed. + (interrupt_input_pending): Remove. All uses removed. + pending_signals now counts both atimers and ordinary interrupts. + This is less racy than having three separate pending-signal flags. + (block_input, unblock_input, totally_unblock_input, unblock_input_to) + (input_blocked_p): + Rename from their upper-case counterparts BLOCK_INPUT, + UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO, + INPUT_BLOCKED_P, and turn into functions. All uses changed. + This makes it easier to access volatile variables more accurately. + (BLOCK_INPUT_RESIGNAL): Remove. All uses replaced by unblock_input (). + (input_blocked_p): Prefer this to 'interrupt_input_blocked', as + that's more reliable if the code is buggy and sets + interrupt_input_blocked to a negative value. All uses changed. + * atimer.c (deliver_alarm_signal): + Remove. No need to deliver this to the parent; any thread can + handle this signal now. All uses replaced by underlying handler. + * atimer.c (turn_on_atimers): + * dispnew.c (handle_window_change_signal): + * emacs.c (handle_danger_signal): + * keyboard.c (kbd_buffer_get_event): + Don't reestablish signal handler; not needed with sigaction. + * blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT) + (UNBLOCK_INPUT_TO): + Rework to avoid unnecessary accesses to volatile variables. + (UNBLOCK_INPUT_TO): Now a function. + (totally_unblock_input, unblock_input): New decls. + * data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c + (init_data): Remove. Necessary stuff now done in init_signal. + * emacs.c, xdisp.c: Include "atimer.h", since we invoke atimer functions. + * emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c. + (fatal_error_code): Remove; no longer needed. + (terminate_due_to_signal): Rename from fatal_error_backtrace, since + it doesn't always backtrace. All uses changed. No need to reset + signal to default, since sigaction and/or die does that for us now. + Use emacs_raise (FOO), not kill (getpid (), FOO). + (main): Check more-accurately whether we're dumping. + Move fatal-error setup to sysdep.c + * floatfns.c: Do not include "syssignal.h"; no longer needed. + * gtkutil.c (xg_get_file_name, xg_get_font): + Remove no-longer-needed signal-mask manipulation. + * keyboard.c, process.c (POLL_FOR_INPUT): + Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined. + * keyboard.c (read_avail_input): Remove. + All uses replaced by gobble_input. + (Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code. + (kbd_buffer_store_event_hold, gobble_input): + (record_asynch_buffer_change) [USABLE_SIGIO]: + (store_user_signal_events): + No need to mess with signal mask. + (gobble_input): If blocking input and there are terminals, simply + set pending_signals to 1 and return. All hooks changed to not + worry about whether input is blocked. + (process_pending_signals): Clear pending_signals before processing + them, in case a signal comes in while we're processing. + By convention callers now test pending_signals before calling us. + (UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input): + New functions, to support changes to blockinput.h. + (handle_input_available_signal): Now extern. + (reinvoke_input_signal): Remove. All uses replaced by + handle_async_input. + (quit_count): Now volatile, since a signal handler uses it. - (handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg. All - callers changed. Block SIGINT only if not already blocked. ++ (handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg. ++ All callers changed. Block SIGINT only if not already blocked. + Clear sigmask reliably, even if Fsignal returns, which it can. + Omit unnecessary accesses to volatile var. + (quit_throw_to_read_char): No need to restore sigmask. + * keyboard.c (gobble_input, handle_user_signal): + * process.c (wait_reading_process_output): + Call signal-handling code rather than killing ourselves. + * lisp.h: Include , for... + (IEEE_FLOATING_POINT): New macro, moved here to avoid duplication. + (pending_signals): Now volatile. + (syms_of_data): Now const if IEEE floating point. + (handle_input_available_signal) [USABLE_SIGIO]: + (terminate_due_to_signal, record_child_status_change): New decls. + * process.c (create_process): Avoid disaster if memory is exhausted + while we're processing a vfork, by tightening the critical section + around the vfork. + (send_process_frame, process_sent_to, handle_pipe_signal) + (deliver_pipe_signal): Remove. No longer needed, as Emacs now + ignores SIGPIPE. + (send_process): No need for setjmp/longjmp any more, since the + SIGPIPE stuff is now gone. Instead, report an error if errno + is EPIPE. + (record_child_status_change): Now extern. PID and W are now args. + Return void, not bool. All callers changed. + * sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]: + Remove. All uses removed. This bug should be fixed now in a + different way. + (wait_for_termination_1): Use waitpid rather than sigsuspend, + and record the child status change directly. This avoids the + need to futz with the signal mask. + (process_fatal_action): Move here from emacs.c. + (emacs_sigaction_flags): New function, containing + much of what used to be in emacs_sigaction_init. + (emacs_sigaction_init): Use it. Block nonfatal system signals that are + caught by emacs, to make races less likely. + (deliver_process_signal): Rename from handle_on_main_thread. + All uses changed. + (BACKTRACE_LIMIT_MAX): Now at top level. + (thread_backtrace_buffer, threadback_backtrace_pointers): + New static vars. + (deliver_thread_signal, deliver_fatal_thread_signal): + New functions, for more-accurate delivery of thread-specific signals. + (handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c. + (deliver_arith_signal): Handle in this thread, not + in the main thread, since it's triggered by this thread. + (maybe_fatal_sig): New function. + (init_signals): New arg DUMPING so that we can be more accurate + about whether we're dumping. Caller changed. + Treat thread-specific signals differently from process-general signals. + Block all signals while handling fatal error; that's safer. + xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal + on IEEE hosts. + When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored. + Ignore SIGPIPE unless batch. + (emacs_backtrace): Output backtrace for the appropriate thread, + which is not necessarily the main thread. + * syssignal.h: Include . + (emacs_raise): New macro. + * xterm.c (x_connection_signal): Remove; no longer needed + now that we use sigaction. + (x_connection_closed): No need to mess with sigmask now. + (x_initialize): No need to reset SIGPIPE handler here, since + init_signals does this for us now. - * profiler.c: Remove filtering functionality. - (is_in_trace, Qgc): Remove vars. - (make_log, record_backtrace, Fsample_profiler_log): - Rewrite, using Elisp hash-tables. - (approximate_median, evict_lower_half): New functions. - (cpu_log): Rename from sample_log. - (cpu_gc_count): New var. - (Fsample_profiler_reset, Fmemory_profiler_reset): Remove. - (sigprof_handler): Add count to cpu_gc_count during GC, detected via - backtrace_list. - (block_sigprof, unblock_sigprof): Remove. - (gc_probe, mark_profiler): Remove functions. - (syms_of_profiler): Staticpro cpu_log and memory_log. - - * lisp.h (SXHASH_COMBINE): Move back to... - * fns.c (SXHASH_COMBINE): ...here. - - * alloc.c (Fgarbage_collect): Record itself in backtrace_list. - Don't set is_in_trace any more. Don't call mark_profiler. - Only call gc_probe for the memory profiler. - (syms_of_alloc): Define Qautomatic_gc. +2012-09-23 Jan Djärv + + * nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into, + background rect may be larger (Bug#12245). + +2012-09-23 Chong Yidong + + * keyboard.c (timer_check): Avoid quitting during Fcopy_sequence. + +2012-09-22 Paul Eggert + + * .gdbinit: Just stop at fatal_error_backtrace. + See Stefan Monnier's request in + . + Remove no-longer-used query of system type. + +2012-09-22 Chong Yidong + + * search.c (Freplace_match): Doc fix (Bug#12325). + + * minibuf.c (Finternal_complete_buffer): Doc fix (Bug#12391). + + * editfns.c (Fline_beginning_position): Doc fix (Bug#12416). + (Fline_end_position): Doc fix. + + * cmds.c (Fforward_char, Fbackward_char): Doc fix (Bug#12414). + +2012-09-22 Chong Yidong + + * dispextern.h (struct image_type): Add new slot, storing a type + initialization function. + + * image.c (define_image_type): Call the image initializer function + if it is defined. Arguments and return value changed. + (valid_image_p, make_image): Callers changed. + (xbm_type, xpm_type, pbm_type, png_type, jpeg_type, tiff_type) - (gif_type, imagemagick_type, svg_type, gs_type): Add - initialization functions. ++ (gif_type, imagemagick_type, svg_type, gs_type): ++ Add initialization functions. + (Finit_image_library): Call lookup_image_type. + (CHECK_LIB_AVAILABLE): Macro deleted. + (lookup_image_type): Call define_image_type here, rather than via + Finit_image_library, and without using CHECK_LIB_AVAILABLE. + (syms_of_image): Move define_image_type calls for xbm_type and + pbm_type to lookup_image_type. + +2012-09-22 Eli Zaretskii + + * keyboard.c (timer_check_2): Move calculation of 'timers' and + 'idle_timers' from here ... + (timer_check): ... to here. Use Fcopy_sequence to copy the timer + lists, to avoid infloops when the timer does something stupid, + like reinvoke itself with the same or smaller time-out. + (Bug#12447) + +2012-09-22 Martin Rudalics + + * window.c (Fsplit_window_internal): Handle only Qt value of + Vwindow_combination_limit separately. + (Qtemp_buffer_resize): New symbol. - (Vwindow_combination_limit): New default value. Rewrite - doc-string. ++ (Vwindow_combination_limit): New default value. ++ Rewrite doc-string. + +2012-09-22 Eli Zaretskii + + * xdisp.c (next_overlay_string): Initialize it->end_charpos for + the new overlay string. (Bug#10159) + +2012-09-22 Paul Eggert + + * emacs.c (shut_down_emacs): Don't assume stderr is buffered, + or that fprintf is async-signal-safe. POSIX doesn't require + either assumption. + +2012-09-22 Chong Yidong + + * buffer.c (Fset_buffer_modified_p): Handle indirect buffers + (Bug#8207). + +2012-09-22 Kenichi Handa + + * composite.c (composition_reseat_it): Handle the case that a + grapheme cluster is not covered by a single font (Bug#12352). + +2012-09-21 Chong Yidong + + * image.c (define_image_type): Avoid adding duplicate types to + image_types (Bug#12463). Suggested by Jörg Walter. + +2012-09-21 YAMAMOTO Mitsuharu + + * unexmacosx.c: Define LC_DATA_IN_CODE if not defined. + (print_load_command_name): Add case LC_DATA_IN_CODE. + (dump_it) [LC_DATA_IN_CODE]: Call copy_linkedit_data. + +2012-09-21 Glenn Morris + + * eval.c (Frun_hook_with_args_until_success) + (Frun_hook_with_args_until_failure): Doc fixes. (Bug#12393) + +2012-09-21 Andreas Schwab + + * fileio.c (Ffile_selinux_context): Only call freecon when + lgetfilecon succeeded. + (Fset_file_selinux_context): Likewise. (Bug#12444) + +2012-09-21 Eli Zaretskii + + * xdisp.c (try_window_reusing_current_matrix): Under bidi + reordering, locate the cursor by calling set_cursor_from_row; if + that fails, clear the desired glyph matrix before returning a + failure indication to the caller. Fixes leaving garbled display + when fast scrolling with a down-key. (Bug#12403) + (compute_stop_pos_backwards): Fix a typo that caused crashes while + scrolling through multibyte text. + +2012-09-20 Stefan Monnier + + * alloc.c (mark_object) : Mark prev/next_buffers *after* + calling mark_vectorlike since that's the one that marks the window. + (mark_discard_killed_buffers): Mark the final cdr. + * window.h (struct window): Move prev/next_buffers to the + non-standard fields. + * window.c (make_window): Initialize prev/next_buffers manually. + +2012-09-20 Paul Eggert + + Omit unused arg EXPECTED from socket hooks. + * keyboard.c (gobble_input, read_avail_input, tty_read_avail_input): + * nsterm.m (ns_term_init): + * termhooks.h (struct terminal.read_socket_hook): + * w32inevt.c (w32_console_read_socket): + * w32term.c (w32_read_socket): + * xterm.c (XTread_socket): + Omit unused arg EXPECTED. All callers changed. + (store_user_signal_events): Return void, not int, since callers no + longer care about the return value. All uses changed. + +2012-09-20 Juanma Barranquero + + * w32gui.h (XParseGeometry): Do not declare. + +2012-09-19 Paul Eggert + + * w32inevt.c (w32_console_read_socket): Return -1 on failure, not 0. + Ignore 'expected'. See Eli Zaretskii in + (last line). + + * frame.c (read_integer): Remove. All uses replaced by strtol/strtoul. + (XParseGeometry): Now static. Substitute extremal values for + values that are out of range. + +2012-09-19 Jan Djärv + + * w32xfns.c (read_integer, XParseGeometry): Move to frame.c. + + * nsfns.m (XParseGeometry): Remove. + (Fx_create_frame): Call x_set_offset to correctly interpret + top_pos in geometry. + - * frame.c (read_integer, XParseGeometry): Moved from w32xfns.c. ++ * frame.c (read_integer, XParseGeometry): Move from w32xfns.c. + (Fx_parse_geometry): If there is a space in string, call + Qns_parse_geometry, otherwise do as on other terms (Bug#12368). + +2012-09-17 Eli Zaretskii + + * search.c (scan_buffer): Use character positions in calls to + region_cache_forward and region_cache_backward, not byte + positions. (Bug#12196) + + * w32term.c (w32_read_socket): Set pending_signals to 1, like + xterm.c does. Reported by Daniel Colascione . + + * ralloc.c (r_alloc_init) [!SYSTEM_MALLOC]: Initialize + __malloc_extra_blocks to 32 instead of 64, like alloc.c did in + emacs_blocked_malloc, now deleted. + +2012-09-17 Paul Eggert + + Remove no-longer-needed Solaris 2.4 vfork bug workaround. + The workaround was for improving performance on Solaris 2.4, but + is getting in the way now. Emacs will still work if someone is + still running Solaris 2.4 in a museum somewhere; Sun dropped + support for Solaris 2.4 in 2003. + * callproc.c (Fcall_process) [HAVE_WORKING_VFORK]: + * process.c (create_process) [HAVE_WORKING_VFORK]: + Omit now-unnecessary workaround for the Solaris 2.4 vfork bug, + since Emacs no longer uses vfork on that platform. + +2012-09-17 Glenn Morris + + * emacs.c: Use COPYRIGHT. + +2012-09-16 Paul Eggert + + Remove configure's --without-sync-input option (Bug#12450). + When auditing signal-handling in preparation for cleaning it up, + I found that SYNC_INPUT has race conditions and would be a real + pain to fix. Since it's an undocumented and deprecated + configure-time option, now seems like a good time to remove it. + Also see . + * alloc.c (_bytes_used, __malloc_extra_blocks, _malloc_internal) + (_free_internal) [!DOUG_LEA_MALLOC]: Remove decls. + (alloc_mutex) [!SYSTEM_MALLOC && !SYNC_INPUT && HAVE_PTHREAD]: + (malloc_hysteresis): + (check_depth) [XMALLOC_OVERRUN_CHECK]: + (MALLOC_BLOCK_INPUT, MALLOC_UNBLOCK_INPUT): + (__malloc_hook, __realloc_hook, __free_hook, BYTES_USED) + (dont_register_blocks, bytes_used_when_reconsidered) + (bytes_used_when_full, emacs_blocked_free, emacs_blocked_malloc) + (emacs_blocked_realloc, reset_malloc_hooks, uninterrupt_malloc): + [!SYSTEM_MALLOC && !SYNC_INPUT]: + Remove. All uses removed. + (MALLOC_BLOCK_INPUT, MALLOC_UNBLOCK_INPUT): Use a different + implementation, one that depends on whether the new macro + XMALLOC_BLOCK_INPUT_CHECK is defined, not on whether SYNC_INPUT + is defined. + * atimer.c (run_timers, handle_alarm_signal): + * keyboard.c (pending_signal, poll_for_input_1, poll_for_input) + (handle_async_input, process_pending_signals) + (handle_input_available_signal, init_keyboard): + * nsterm.m (ns_read_socket): + * process.c (wait_reading_process_output): + * regex.c (immediate_quit, IMMEDIATE_QUIT_CHECK): + * sysdep.c (emacs_sigaction_init) [SA_RESTART]: + (emacs_write): + * xterm.c (XTread_socket): + Assume SYNC_INPUT. + * conf_post.h (SA_RESTART) [IRIX6_5]: Do not #undef. + * eval.c (handling_signal): Remove. All uses removed. + * lisp.h (ELSE_PENDING_SIGNALS): Remove. + All uses replaced with the SYNC_INPUT version. + (reset_malloc_hooks, uninterrupt_malloc, handling_signal): + Remove decls. + * sysdep.c, syssignal.h (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]: + Now static. + + * font.c (Ffont_shape_gstring): Remove unused local. + +2012-09-16 Glenn Morris + + * Makefile.in (clean): No longer run nextstep's clean. + + * Makefile.in (ns_appdir, ns_appbindir, ns_appsrc): Remove variables. + (ns_frag): Remove. + (ns-app): Move here from ns.mk, and simplify. + (clean): Simplify nextstep entry. + * ns.mk: Remove file. + +2012-09-17 Kenichi Handa + + * font.c (Ffont_shape_gstring): Fix previous change; GLYPHs may + not covert the last few charactes. + +2012-09-16 Kenichi Handa + + * font.c (Ffont_shape_gstring): Don't adjust grapheme cluster + here, but just check the validity of glyphs in the glyph-string. + +2012-09-16 Martin Rudalics + - * window.c (Fwindow_parameter, Fset_window_parameter): Accept - any window as argument (Bug#12452). ++ * window.c (Fwindow_parameter, Fset_window_parameter): ++ Accept any window as argument (Bug#12452). + +2012-09-16 Jan Djärv + + * nsfns.m (Fx_open_connection): Move initialization of ns_*_types + to ns_term_init to avoid memory leak. + + * nsterm.m (ns_update_begin): Initialize bp after lcokFocus, use + explicit retain/release. + (ns_term_init): Only allow one display. Initialize outerpool and + ns_*_types. + +2012-09-15 Paul Eggert + + Port _setjmp fix to POSIXish hosts as well as Microsoft. + * image.c (_setjmp) [!HAVE__SETJMP]: Restore definition, as + it's needed on POSIXish hosts that lack _setjmp. Attempt to solve + the Microsoft problem in a different way, by altering ../nt/config.nt. + +2012-09-15 Eli Zaretskii + + * w32xfns.c: + * w32uniscribe.c: + * w32term.c: + * w32select.c: + * w32reg.c: + * w32proc.c: + * w32menu.c: + * w32inevt.c: + * w32heap.c: + * w32font.c: + * w32fns.c: + * w32console.c: + * w32.c: + * w16select.c: Remove inclusion of setjmp.h, as it is now included + by lisp.h. This completes removal of setjmp.h inclusion + erroneously announced in the previous commit. (Bug#12446) + + * lisp.h [!HAVE__SETJMP, !HAVE_SIGSETJMP]: Make the commentary + more accurate. + + * image.c (_setjmp) [!HAVE__SETJMP]: Define only if 'setjmp' is + not defined as a macro. The latter happens on MS-Windows. + (Bug#12446) + +2012-09-15 Paul Eggert + + Port better to POSIX hosts lacking _setjmp (Bug#12446). + * lisp.h: Include here, since we use its symbols here. + Some instances of '#include ' removed, if the + only reason for the instance was because "lisp.h" was included. + (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols. + Unless otherwise specified, replace all uses of jmp_buf, _setjmp, + and _longjmp with the new symbols. Emacs already uses _setjmp if + available, so this change affects only POSIXish hosts that have + sigsetjmp but not _setjmp, such as some versions of Solaris and + Unixware. (Also, POSIX-2008 marks _setjmp as obsolescent.) + * image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros. + (png_load_body) [HAVE_PNG]: + (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]: + (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]: + Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp, + since PNG requires jmp_buf. This is the only exception to the + general rule that we now use sys_setjmp and sys_longjmp. + This exception is OK since this code does not change the signal + mask or longjmp out of a signal handler. + +2012-09-14 Paul Eggert + + * alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT && HAVE_PTHREAD]: + Include "syssignal.h", for 'main_thread'. + +2012-09-14 Dmitry Antipov + + Avoid out-of-range marker position (Bug#12426). - * insdel.c (replace_range, replace_range_2): Adjust - markers before overlays, as suggested by comments. ++ * insdel.c (replace_range, replace_range_2): ++ Adjust markers before overlays, as suggested by comments. + (insert_1_both, insert_from_buffer_1, adjust_after_replace): + Remove redundant check before calling offset_intervals. + +2012-09-14 Martin Rudalics + + * xdisp.c (Fformat_mode_line): Unconditionally save/restore + current buffer (Bug#12387). + +2012-09-14 Juanma Barranquero + + * makefile.w32-in ($(BLD)/alloc.$(O)): Update dependencies. + +2012-09-13 Paul Eggert + + Use a more backwards-compatible timer format (Bug#12430). + * keyboard.c (decode_timer): Get PSECS from the 8th (origin-0) + vector element, not from the 4th, since PSECS is now at the end. + (Fcurrent_idle_time): Doc fix. + +2012-09-13 Dmitry Antipov + + Function to mark objects and remove killed buffers at once. + * alloc.c (discard_killed_buffers): Rename to ... + (mark_discard_killed buffers) ... new name. Add marking + of remaining objects. Fix comment. Adjust users. + (mark_object): Do not touch frame buffer lists here. + * frame.c (delete_frame): Reset frame buffer lists here. + +2012-09-13 Paul Eggert + + Better workaround for GNOME bug when --enable-gcc-warnings. + * emacsgtkfixed.c (G_STATIC_ASSERT): Remove, undoing last change. + Instead, disable -Wunused-local-typedefs. See Dmitry Antipov in + . + + Simplify SIGIO usage (Bug#12408). + The code that dealt with SIGIO was crufty and confusing, e.g., it + played tricks like "#undef SIGIO" but these tricks were not used + consistently. Simplify mostly by not #undeffing standard symbols, + e.g., use "defined USABLE_SIGIO" (our symbol, which we can define + or not as we please) rather than "defined SIGIO" (standard symbol + that we probably shouldn't #undef). + * conf_post.h [USG5_4]: Do not include here. + Modules that need it can include it. + [USG5_4 && emacs]: Likewise, do not include the streams stuff here. + * dispextern.h (ignore_sigio): New decl. + * emacs.c (shut_down_emacs): Invoke unrequest_sigio + unconditionally, since it's now a no-op if !USABLE_SIGIO. + * emacs.c (shut_down_emacs): + * keyboard.c (kbd_buffer_store_event_hold): + Use ignore_sigio rather than invoking 'signal' directly. + * keyboard.c (USABLE_FIONREAD && USG5_4): Include , + for FIONREAD. + (FIONREAD, SIGIO): Do not #undef. + (tty_read_avail_input): Use #error rather than a syntax error. + * process.c [USG5_4]: Include and , + for I_PIPE, used by SETUP_SLAVE_PTY. + (DATAGRAM_SOCKETS): Simplify defn, based on USABLE_FIONREAD. + * sysdep.c (croak): Remove; no longer needed. This bit of + temporary code, with Fred N. Fish's comment that it's temporary, + has been in Emacs since at least 1992! + (init_sigio, reset_sigio, request_sigio, unrequest_sigio): + Arrange for them to be no-ops in all cases when ! USABLE_SIGIO. + * syssignal.h (croak): Remove decl. + (SIGIO, SIGPOO, SIGAIO, SIGPTY): Do not #undef; that's too fragile. + * systty.h [!NO_TERMIO]: Do not include ; no longer needed + now that we're termios-only. + (FIONREAD, ASYNC) [BROKEN_FIONREAD]: Do not #undef. + * term.c (dissociate_if_controlling_tty): Use #error rather than + a run-time error. + + Work around GCC and GNOME bugs when --enable-gcc-warnings. + * emacsgtkfixed.c (G_STATIC_ASSERT): Redefine to use 'verify', + to work around GNOME bug 683906. + * image.c (jpeg_load_body) [HAVE_JPEG && lint]: Pacify gcc -Wclobber. + (struct my_jpeg_error_mgr) [HAVE_JPEG && lint]: New member fp. + This works around GCC bug 54561. + +2012-09-12 Paul Eggert + + More fixes for 'volatile' and setjmp/longjmp. + * eval.c (Fdefvar, Fcondition_case): Remove unnecessary 'volatile's. + * image.c (struct png_load_context) [HAVE_PNG]: New type. + (png_load_body) [HAVE_PNG]: + (jpeg_load_body) [HAVE_JPEG]: + New function, with most of the old parent function's body. + (png_load) [HAVE_PNG]: + (jpeg_load) [HAVE_JPEG]: + Invoke the new function, to avoid longjmp munging our locals. + (struct my_jpeg_error_mgr) [HAVE_JPEG]: New members cinfo, failure_code. + (my_error_exit) [HAVE_JPEG]: Don't trust 'setjmp' to return 2 when + longjmp is passed 2, as the C standard doesn't guarantee this. + Instead, store the failure code into mgr->failure_code. + +2012-09-12 Stefan Monnier + + * keyboard.c (read_char, requeued_events_pending_p, Finput_pending_p) + (Fdiscard_input, quit_throw_to_read_char, init_keyboard) + (syms_of_keyboard): Remove support for unread-command-char. + +2012-09-12 Eli Zaretskii + + * w32proc.c (sys_kill): If PID is our process ID and the signal is + SIGABRT, call emacs_abort. Avoids silently exiting upon assertion + violation. (Bug#12426) + +2012-09-12 Paul Eggert + + * image.c (jpeg_memory_src): Don't assume string len fits in unsigned. + +2012-09-12 Stefan Monnier + + * eval.c: Add `inhibit-debugger'. + (Qinhibit_debugger): New symbol. + (call_debugger): Bind it instead of Qdebug_on_error. + (maybe_call_debugger): Test Vinhibit_debugger. + (syms_of_eval): Define inhibit-debugger. + * xdisp.c (set_message): Don't bind Qinhibit_debug_on_message. + (syms_of_xdisp): Remove inhibit-debug-on-message. + +2012-09-11 Paul Eggert + + Avoid _setjmp/_longjmp problems with local nonvolatile variables. + If a nonvolatile local variable is written before a _longjmp to + the frame containing the variable, and is read after the _longjmp, + the value read is indeterminate. Some local variables of type + 'struct handler' and 'struct catchtag' are used in this way, so + mark each of their slots as volatile if the slot can be set before + _longjmp and read afterwards. + * lisp.h (struct handler): var and chosen_clause are now volatile. + (struct catchtag): val, next, and pdlcount are now volatile. + + * bidi.c (bidi_push_it, bidi_pop_it): + * fns.c (copy_hash_table): + * image.c (define_image_type): + * keyboard.c (kbd_buffer_store_event_hold): + * process.c (Fprocess_send_eof): + * xfaces.c (x_create_gc) [HAVE_NS]: + * xgselect.c (xg_select): + Prefer assignment to memcpy when either will do. + + * alloc.c (discard_killed_buffers): Tune and simplify a bit. + Use pointer-to-a-pointer to simplify and avoid a NILP check each + time an item is removed. No need to mark this function 'inline'; + the compiler knows better than we do. + +2012-09-11 Jan Djärv + + * nsterm.m (ns_judge_scroll_bars): Pass NO to updateFrameSize. + (updateFrameSize:): Add delay parameter to updateFrameSize, send it + to change_frame_size (Bug#12388). + (windowDidResize:): Pass YES to updateFrameSize. + + * nsterm.h: Add delay parameter to updateFrameSize. + +2012-09-11 Dmitry Antipov + + Discard killed buffers from deleted window and frame objects. + This reduces an amount of references to killed buffers and + helps GC to reclaim them faster. + * alloc.c (discard_killed_buffers): New function. + (mark_object): Use it for deleted windows and frames. + (mark_object): If symbol's value is set up for a killed buffer + or deleted frame, restore it's global binding. + * data.c (swap_in_global_binding): Add GC notice. + (swap_in_symval_forwarding): Use convenient set_blv_where. + * window.c (wset_next_buffers, wset_prev_buffers): Move ... + * window.h: ... to here. + +2012-09-11 Dmitry Antipov + + Convenient macro to check whether the buffer is live. + * buffer.h (BUFFER_LIVE_P): New macro. + * alloc.c, buffer.c, editfns.c, insdel.c, lread.c, marker.c: + * minibuf.c, print.c, process.c, window.c, xdisp.c: Use it. + +2012-09-11 YAMAMOTO Mitsuharu + + * xdisp.c (right_overwritten, right_overwriting): Also handle gstring + composition cases (Bug#12364). + + * xterm.c (x_draw_glyph_string): Avoid overwriting inverted left + overhang of succeeding glyphs overlapping box cursor. + + * w32term.c (x_draw_glyph_string): Likewise. + +2012-09-11 Paul Eggert + + Simplify, document, and port floating-point (Bug#12381). + The porting part of this patch fixes bugs on non-IEEE platforms + with frexp, ldexp, logb. + * data.c, lisp.h (Qdomain_error, Qsingularity_error, Qunderflow_error): + Now static. + * floatfns.c: Simplify discussion of functions that Emacs doesn't + support, by removing commented-out code and briefly listing the + C89 functions excluded. The commented-out stuff was confusing + maintenance, e.g., we thought we needed cbrt but it was commented out. + (logb): Remove decl; no longer needed. + (isfinite): New macro, if not already supplied. + (isnan): Don't replace any existing macro. + (Ffrexp, Fldexp): Define even if !HAVE_COPYSIGN, as frexp and ldexp + are present on all C89 platforms. + (Ffrexp): Do not special-case zero, as frexp does the right thing + for that case. + (Flogb): Do not use logb, as it doesn't have the desired meaning + on hosts that use non-base-2 floating point. Instead, stick with + frexp, which is C89 anyway. Do not pass an infinity or a NaN to + frexp, to avoid getting an unspecified result. + + * xdisp.c (Qinhibit_debug_on_message): Now static. + +2012-09-10 Jan Djärv + + * nsterm.m (ns_update_begin): Set clip path to whole view by using + NSBezierPath (Bug#12131). + +2012-09-10 Chong Yidong + + * fns.c (Fdelq, Fdelete): Doc fix. + +2012-09-10 Paul Eggert + + * lisp.h (XSETINT, XSETCONS, XSETVECTOR, XSETSTRING, XSETSYMBOL) + (XSETFLOAT, XSETMISC): Parenthesize macro bodies. + +2012-09-09 Stefan Monnier + + * lisp.h (make_lisp_ptr): New macro to replace XSET. + (XSETCONS, XSETVECTOR, XSETSTRING, XSETSYMBOL, XSETFLOAT, XSETMISC): + Use it. + +2012-09-09 Eli Zaretskii + + * fringe.c (draw_fringe_bitmap_1): Don't reduce the width of the + left fringe if the window has a left margin. This avoids leaving + traces of the cursor because its leftmost pixel is not drawn over. + + * dispnew.c (update_window_line): When the left margin area of a + screen line is updated, set the redraw_fringe_bitmaps_p flag of + that screen line. (Bug#12277) + +2012-09-09 Paul Eggert + + Assume C89 or later for math functions (Bug#12381). + This simplifies the code, and makes it a bit smaller and faster, + and (most important) makes it easier to clean up signal handling + since we can stop worring about floating-point exceptions in + library code. That was a problem before C89, but the problem + went away many years ago on all practical Emacs targets. + * data.c, image.c, lread.c, print.c: + Don't include ; no longer needed. + * data.c, floatfns.c (IEEE_FLOATING_POINT): Don't worry that it + might be autoconfigured, as that never happens. + * data.c (fmod): + * doprnt.c (DBL_MAX_10_EXP): + * print.c (DBL_DIG): + Remove. C89 or later always defines these. + * floatfns.c (HAVE_MATHERR, FLOAT_CHECK_ERRNO, FLOAT_CHECK_DOMAIN) + (in_float, float_error_arg, float_error_arg2, float_error_fn_name) + (arith_error, domain_error, domain_error2): + Remove all this pre-C89 cruft. Do not include as that's + no longer needed -- we simply return what C returns. All uses removed. + (IN_FLOAT, IN_FLOAT2): Remove. All uses replaced with + the wrapped code. + (FLOAT_TO_INT, FLOAT_TO_INT2, range_error, range_error2): + Remove. All uses expanded, as these macros are no longer used + more than once and are now more trouble than they're worth. + (Ftan): Use tan, not sin / cos. + (Flogb): Assume C89 frexp. + (fmod_float): Assume C89 fmod. + (matherr) [HAVE_MATHERR]: Remove; no longer needed. + (init_floatfns): Remove. All uses removed. + +2012-09-08 Jan Djärv + + * nsterm.m (ns_draw_fringe_bitmap, ns_dumpglyphs_image): Take back + compositeToPoint for OSX < 10.6 (Bug#12390). + +2012-09-08 Paul Eggert + + * floatfns.c (Ftan): Use tan (x), not (sin (x) / cos (x)). + This produces more-accurate results. + +2012-09-08 Jan Djärv + + * nsterm.m (updateFrameSize): Call setFrame: on the view when size + changes (Bug#12088). + +2012-09-08 Chong Yidong + + * syntax.c (Fstring_to_syntax): Doc fix. + +2012-09-08 Jan Djärv + + * nsterm.m (ns_clip_to_row): Remove code that deals with drawing fringe + in the internal border. + (x_set_window_size): Remove static variables and their usage. + (ns_redraw_scroll_bars): Fix NSTRACE arg. - (ns_after_update_window_line, ns_draw_fringe_bitmap): Remove - fringe/internal border adjustment (Bug#11052). ++ (ns_after_update_window_line, ns_draw_fringe_bitmap): ++ Remove fringe/internal border adjustment (Bug#11052). + (ns_draw_fringe_bitmap): Make code more like other terms (xterm.c). + (ns_draw_window_cursor): Remove fringe/internal border adjustment. + (ns_fix_rect_ibw): Remove. + (ns_get_glyph_string_clip_rect): Remove call to ns_fix_rect_ibw. + (ns_dumpglyphs_box_or_relief): Ditto. + (ns_maybe_dumpglyphs_background): Remove fringe/internal border + adjustment. + (ns_dumpglyphs_image): Ditto. + (ns_dumpglyphs_stretch): Fix coding style. Remove fringe/internal + border adjustment. + (ns_set_vertical_scroll_bar): Remove variables barOnVeryLeft/Right and + their usage. Add fringe_extended_p and its use as in other terms. + (ns_judge_scroll_bars): Code style fix. Call updateFrameSize if + scroll bar was removed. + (updateFrameSize): New function. + (windowDidResize): Move code to updateFrameSize and call it. + + * nsterm.h (EmacsView): Add updateFrameSize. + +2012-09-07 Chong Yidong + + * textprop.c (Fget_text_property): Minor doc fix (Bug#12323). + + * data.c (Flocal_variable_if_set_p): Doc fix (Bug#10713). + +2012-09-07 Paul Eggert + + More signal-handler cleanup (Bug#12327). + * emacs.c (main): Convert three 'signal' calls to 'sigaction' calls. + Problem introduced when merging patches. Noted by Eli Zaretskii in + . + * floatfns.c: Comment fix. + * lisp.h (force_auto_save_soon): Declare regardless of SIGDANGER. + SIGDANGER might not be in scope so "#ifdef SIGDANGER" is not right, + and anyway the declaration is harmless even if SIGDANGER is not defined. + * syssignal.h (SIGIO): Also #undef if (! defined FIONREAD || + defined BROKEN_FIONREAD). systty.h formerly did this, but other + source files not surprisingly expected syssignal.h to define, or + not define, SIGIO, and it's cleaner to do it that way, for consistency. + Include , for FIONREAD. + * systty.h (SIGIO): Do not #undef here; it's now syssignal.h's job. + This eliminates a problem whereby other files mysteriously had + to include "syssignal.h" before including "systty.h" if they + wanted to use "#ifdef SIGIO". + +2012-09-07 Eli Zaretskii + + * w32proc.c (sigaction): New function, emulates Posix 'sigaction'. + + * w32.c (sigemptyset): Empty the set. + (sigsetmask, sigmask, sigblock, sigunblock): Remove unused functions. + + * alloc.c [ENABLE_CHECKING]: Include signal.h, since we need SIGABRT. + +2012-09-07 Dmitry Antipov + + * alloc.c (mark_buffer): Revert unsafe marking optimization. + (mark_object): Likewise for frame objects. + +2012-09-07 Paul Eggert + + * syssignal.h (handle_on_main_thread): Always declare, + even if FORWARD_SIGNAL_TO_MAIN_THREAD is not defined. + This ports to platforms without HAVE_PTHREAD. + +2012-09-06 Paul Eggert + + Signal-handler cleanup (Bug#12327). + Emacs's signal handlers were written in the old 4.2BSD style with + sigblock and sigmask and so forth, and this led to some + inefficiencies and confusion. Rewrite these to use + pthread_sigmask etc. without copying signal sets around. Also, + get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and + 'signal', and instead use functions that do not attempt to take + over the system name space. This patch causes Emacs's text + segment to shrink by 0.7% on my platform, Fedora 17 x86-64. + * alloc.c, emacsgtkfixed.c, nsfns.m, widget.c, xmenu.c: + Do not include or "syssignal.h", as these + modules do not use signals. + * atimer.c, callproc.c, data.c, dispnew.c, emacs.c, floatfns.c: + * gtkutil.c, keyboard.c, process.c, sound.c, sysdep.c, term.c, xterm.c: + Do not include , as "syssignal.h" does that for us now. + * atimer.c (sigmask_atimers): New function. + (block_atimers, unblock_atimers): New functions, + replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS. + All uses replaced. + * conf_post.h [SIGNAL_H_AHB]: Do not include ; + no longer needed here. + * emacs.c (main): Inspect existing signal handler with sigaction, + so that there's no need to block and unblock SIGHUP. + * sysdep.c (struct save_signal): New member 'action', replacing + old member 'handler'. + (save_signal_handlers, restore_signal_handlers): + Use sigaction instead of 'signal' to save and restore. + (get_set_sighandler, set_sighandler) [!WINDOWSNT]: + New function. All users of 'signal' modified to use set_sighandler + if they're writeonly, and to use sys_signal if they're read+write. + (emacs_sigaction_init, forwarded_signal): New functions. + (sys_signal): Remove. All uses replaced by calls to sigaction + and emacs_sigaction_init, or by direct calls to 'signal'. + (sys_sigmask) [!__GNUC__]: Remove; no longer needed. + (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove; + all uses replaced by pthread_sigmask etc. calls. + * syssignal.h: Include . + (emacs_sigaction_init, forwarded_signal): New decls. + (SIGMASKTYPE): Remove. All uses replaced by its definiens, sigset_t. + (SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask. + (sigmask, sys_sigmask): Remove; no longer needed. + (sigpause): Remove. All uses replaced by its definiens, sigsuspend. + (sigblock, sigunblock, sigfree): + (sigsetmask) [!defined sigsetmask]: + Remove. All uses replaced by pthread_sigmask. + (signal): Remove. Its remaining uses (with SIG_DFL and SIG_IGN) + no longer need to be replaced, and its typical old uses + are now done via emacs_sigaction_init and sigaction. + (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls. + (sys_sigdel): Remove; unused. + (NSIG): Remove a FIXME; the code's fine. Remove an unnecessary ifdef. + +2012-09-06 Eli Zaretskii + + * process.c (CAN_HANDLE_MULTIPLE_CHILDREN): Fix a typo that broke + SIGCHLD handling on systems that don't have WNOHANG. (Bug#12327) + +2012-09-06 Dmitry Antipov + + Explicitly mark buffer_defaults and buffer_local_symbols. + * alloc.c (Fgarbage_collect): Mark buffer_defaults and + mark_local_symbols here. + (mark_object): If GC_CHECK_MARKED_OBJECTS, simplify checking + since special buffers aren't marked here any more. + (allocate_buffer): Chain new buffer with all_buffers here... + * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): ...and + not here. + (Vbuffer_defaults, Vbuffer_local_symbols): Remove. + (syms_of_buffer): Remove staticpro of the above. + (init_buffer_once): Set names for buffer_defaults and + buffer_local_symbols. + +2012-09-06 Paul Eggert + + Use bool for booleans in font-related modules. + * font.c (font_intern_prop, font_style_to_value) + (font_style_symbolic, font_parse_xlfd, font_parse_fcname) + (generate_otf_features, font_check_otf_features, font_check_otf) + (font_match_p, font_list_entities, font_at): + * fontset.c (fontset_id_valid_p, reorder_font_vector + (fontset_find_font, Fset_fontset_font) + (face_suitable_for_char_p) [0]: + * ftfont.c (fc_initialized, ftfont_get_open_type_spec) + (ftfont_open, ftfont_text_extents, ftfont_check_otf): + (m17n_flt_initialized, ftfont_shape_by_flt): + * ftxfont.c (ftxfont_draw_bitmap, ftxfont_draw): + * nsfont.m (nsfont_draw): + * w32font.c (w32font_draw): + * w32term.c (x_draw_glyphless_glyph_string_foreground): + Use bool for booleans. + * font.h: Adjust to above API changes. + (struct font, struct font_driver, struct font_driver_list): + Use bool for booleans. + (struct font): Remove useless member encoding_type. + All users removed. + * fontset.c, xftfont.c: Omit unnecessary static decls. + +2012-09-06 Dmitry Antipov + + * alloc.c (mark_object): Revert window marking code + since it's unsafe for the Fset_window_configuration. + +2012-09-05 Paul Eggert + + Fix race conditions with signal handlers and errno (Bug#12327). + Be more systematic about preserving errno whenever a signal + handler returns, even if it's not in the main thread. Do this by + renaming signal handlers to distinguish between signal delivery + and signal handling. All uses changed. + * atimer.c (deliver_alarm_signal): Rename from alarm_signal_handler. + * data.c (deliver_arith_signal): Rename from arith_error. + * dispnew.c (deliver_window_change_signal): Rename from + window_change_signal. + * emacs.c (deliver_error_signal): Rename from fatal_error_signal. + (deliver_danger_signal) [SIGDANGER]: Rename from memory_warning_signal. + * keyboard.c (deliver_input_available_signal): Rename from + input_available_signal. + (deliver_user_signal): Rename from handle_user_signal. + (deliver_interrupt_signal): Rename from interrupt_signal. + * process.c (deliver_pipe_signal): Rename from send_process_trap. + (deliver_child_signal): Rename from sigchld_handler. + * atimer.c (handle_alarm_signal): + * data.c (handle_arith_signal): + * dispnew.c (handle_window_change_signal): + * emacs.c (handle_fatal_signal, handle_danger_signal): + * keyboard.c (handle_input_available_signal): + * keyboard.c (handle_user_signal, handle_interrupt_signal): + * process.c (handle_pipe_signal, handle_child_signal): + New functions, with the actual signal-handling code taken from the + original respective signal handlers, sans the sporadic attempts to + preserve errno, since that's now done by handle_on_main_thread. + * atimer.c (alarm_signal_handler): Remove unnecessary decl. + * emacs.c, floatfns.c, lisp.h: Remove unused FLOAT_CATCH_SIGKILL cruft. + * emacs.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]: + Move to sysdep.c. + (main) [FORWARD_SIGNAL_TO_MAIN_THREAD]: + Move initialization of main_thread to sysdep.c's init_signals. + * process.c (waitpid) [!WNOHANG]: #define to wait; that's good enough for + our usage, and simplifies the mainline code. + (record_child_status_change): New static function, as a helper + for handle_child_signal, and with most of the old child handler's + contents. + (CAN_HANDLE_MULTIPLE_CHILDREN): New constant. + (handle_child_signal): Use the above. + * sysdep.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]: + Moved here from emacs.c. + (init_signals) [FORWARD_SIGNAL_TO_MAIN_THREAD]: Initialize it; + code moved here from emacs.c's main function. + * sysdep.c, syssignal.h (handle_on_main_thread): New function, - replacing the old SIGNAL_THREAD_CHECK. All uses changed. This - lets callers save and restore errno properly. ++ replacing the old SIGNAL_THREAD_CHECK. All uses changed. ++ This lets callers save and restore errno properly. + +2012-09-05 Dmitry Antipov + + Remove redundant or unused things here and there. + * lisp.h (CYCLE_CHECK, CHAR_TABLE_TRANSLATE): Remove. + * conf_post.h (RE_TRANSLATE): Use char_table_translate. + * editfns.c (Fcompare_buffer_substrings): Likewise. + * frame.h (struct terminal, struct font_driver_list): + Remove redundant declarations. + * window.h (Qleft, Qright): Likewise. + +2012-09-05 Dmitry Antipov + + Do not mark objects from deleted buffers, windows and frames. + * alloc.c (mark_buffer): Mark just the buffer if it is dead. + (mark_object): Likewise for windows and frames. + +2012-09-05 Dmitry Antipov + + * alloc.c (valid_lisp_object_p): Treat killed buffers, + buffer_defaults and buffer_local_symbols as valid objects. + Return special value to denote them. + +2012-09-05 Paul Eggert + + * fileio.c, filelock.c, floatfns.c, fns.c: Use bool for boolean. + * fileio.c (auto_saving, auto_save_error_occurred, make_temp_name) + (Fexpand_file_name, barf_or_query_if_file_exists, Fcopy_file) + (file_name_absolute_p, Fsubstitute_in_file_name): + (check_executable, check_writable, Ffile_accessible_directory_p) + (Fset_file_selinux_context, Fdefault_file_modes) + (Finsert_file_contents, choose_write_coding_system) + (Fwrite_region, build_annotations, a_write, e_write) + (Fdo_auto_save): + * filelock.c (boot_time_initialized, get_boot_time) + (get_boot_time_1, lock_file_1, within_one_second): + * floatfns.c (in_float): + * fns.c (concat, internal_equal, Frequire, base64_encode_1) + (base64_decode_1, cmpfn_eql, cmpfn_user_defined) + (sweep_weak_table, sweep_weak_hash_tables, secure_hash): + * lisp.h (struct Lisp_Hash_Table.cmpfn): + * window.c (compare_window_configurations): + Use bool for booleans. + * fileio.c (auto_saving_dir_umask, auto_saving_mode_bits) + (Fdefault_file_modes): Now mode_t, not int, for modes. + (Fdo_auto_save): Set a boolean to 1 rather than using ++. + (internal_delete_file): Now returns void, not a (boolean) int, + since nobody was looking at the return value. + * lisp.h, window.h: Adjust to above API changes. + + * xdisp.c (set_message): Simplify and reindent last change. + +2012-09-05 Juanma Barranquero + + * makefile.w32-in ($(BLD)/sysdep.$(O)): Update dependencies. + +2012-09-04 Lars Ingebrigtsen + + * eval.c (call_debugger): Make the function non-static so that we + can call it from set_message. + + * xdisp.c (set_message): Implement the new variable `debug-on-message'. + (syms_of_xdisp): Defvar it and `inhibit-debug-on-message'. + +2012-09-04 Paul Eggert + + Give more-useful info on a fatal error (Bug#12328). + * alloc.c [ENABLE_CHECKING]: Do not include . + (die) [ENABLE_CHECKING]: Call fatal_error_backtrace instead + of doing the work ourselves. + * emacs.c (fatal_error_signal): Let fatal_error_backtrace + do most of the work. + (fatal_error_backtrace): New function, taken from the guts + of the old fatal_error_signal, but with a new option to output + a backtrace. + (shut_down_emacs) [!DOS_NT]: Use strsignal to give more-useful + info about the signal than just its number. + * lisp.h (fatal_error_backtrace, emacs_backtrace): New decls. + * sysdep.c: Include + (emacs_backtrace): New function, taken partly from the previous + code of the 'die' function. + (emacs_abort): Call fatal_error_backtrace rather than abort. + +2012-09-04 Stefan Monnier + + * lread.c (readevalloop): Call internal-macroexpand-for-load to perform + eager (load-time) macro-expansion. + * lisp.mk (lisp): Add macroexp. + +2012-09-04 Paul Eggert + + Simplify redefinition of 'abort' (Bug#12316). + Do not try to redefine the 'abort' function. Instead, redo + the code so that it calls 'emacs_abort' rather than 'abort'. + This removes the need for the NO_ABORT configure-time macro + and makes it easier to change the abort code to do a backtrace. + * .gdbinit: Just stop at emacs_abort, not at w32_abort or abort. + * emacs.c (abort) [!DOS_NT && !NO_ABORT]: + Remove; sysdep.c's emacs_abort now takes its place. + * lisp.h (emacs_abort): New decl. All calls from Emacs code to + 'abort' changed to use 'emacs_abort'. + * msdos.c (dos_abort) [defined abort]: Remove; not used. + (abort) [!defined abort]: Rename to ... + (emacs_abort): ... new name. + * sysdep.c (emacs_abort) [!HAVE_NTGUI]: New function, taking + the place of the old 'abort' in emacs.c. + * w32.c, w32fns.c (abort): Do not #undef. + * w32.c (emacs_abort): Rename from w32_abort. + +2012-09-04 Eli Zaretskii + + * w32uniscribe.c (uniscribe_shape): Reverse the sign of + offsets[j].dv, since the y axis of the screen coordinates points + down, while the y axis of the font definition coordinates points + up. This fixes display of Arabic diacritics such as KASRA and + KASRATAN. (Bug#11860) + +2012-09-04 Paul Eggert + + Be more systematic about _setjmp vs setjmp. + * alloc.c (test_setjmp, mark_stack): + * image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]: + (PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]: + (png_load, my_error_exit, jpeg_load): + * process.c (send_process_trap, send_process): + Uniformly prefer _setjmp and _longjmp to setjmp and longjmp. + The underscored versions are up to 30x faster on some hosts. + Formerly, the code used setjmp+longjmp sometimes and + _setjmp+_longjmp at other times, with no particular reason to + prefer setjmp+longjmp. + +2012-09-03 Paul Eggert + + Fix minor problem found by static checking. + * buffer.c (Fdelete_all_overlays): Return nil. + +2012-09-03 Martin Rudalics + + * buffer.c (Fdelete_all_overlays): New function. + +2012-09-03 Chong Yidong + + * gtkutil.c: Add extern decl for Qxft. + +2012-09-02 Paul Eggert + + * emacs.c, eval.c: Use bool for boolean. + * emacs.c (initialized, inhibit_window_system, running_asynch_code): + (malloc_using_checking) [DOUG_LEA_MALLOC]: + (display_arg) [HAVE_X_WINDOWS || HAVE_NS]: + (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch) + (main, decode_env_path, Fdaemon_initialized): + * eval.c (call_debugger, Finteractive_p, interactive_p): + (unwind_to_catch, Fsignal, wants_debugger, skip_debugger) + (maybe_call_debugger, Fbacktrace): + * process.c (read_process_output, exec_sentinel): + Use bool for booleans. + * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X. + All callers changed. + * eval.c (interactive_p): Omit always-true boolean argument + EXCLUDE_SUBRS_P. All callers changed. + * dispextern.h, lisp.h: Reflect above API changes. + * firstfile.c (dummy): Use the address of 'main', whose signature + won't change, instead of the address of 'initialize', whose + signature just changed from int to bool. + * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ... + * msdos.c (fatal_error_in_progress): ... from here. + * xdisp.c (redisplaying_p): Now a boolean. Set it to 1 instead + of incrementing it. + (redisplay_internal, unwind_redisplay): Simply clear + REDISPLAYING_P when unwinding, instead of saving its previous, + always-false value and then restoring it. + + Clean up some extern decls. + Mostly, this hoists extern decls out of .c files and into .h files. + That way, we're more likely to catch errors if the interfaces change. + * alloc.c [USE_GTK]: Include "gtkutil.h" so that we need not + declare xg_mark_data. + * dispextern.h (x_frame_parm_handlers): + * font.h (Qxft): + * lisp.h (Qlexical_binding, Qinternal_interpreter_environment) + (Qextra_light, Qlight, Qsemi_light, Qsemi_bold, Qbold, Qextra_bold) + (Qultra_bold, Qoblique, Qitalic): + Move extern decl here from .c file. + * alloc.c (xg_mark_data) [USE_GTK]: + * doc.c (Qclosure): + * eval.c (Qlexical_binding): + * fns.c (time) [!HAVE_UNISTD_H]: + * gtkutil.c (Qxft, Qnormal, Qextra_light, Qlight, Qsemi_light) + (Qsemi_bold, Qbold, Qextra_bold, Qultra_bold, Qoblique, Qitalic): + * image.c (Vlibrary_cache, QCloaded_from) [HAVE_NTGUI]: + * lread.c (Qinternal_interpreter_environment): + * minibuf.c (Qbuffer): + * process.c (QCfamily, QCfilter): + * widget.c (free_frame_faces): + * xfaces.c (free_frame_menubar) [USE_X_TOOLKIT]: + * xfont.c (x_clear_errors): + * xterm.c (x_frame_parm_handlers): + Remove now-redundant extern decls. + * keyboard.c, keyboard.h (ignore_mouse_drag_p) [USE_GTK || HAVE_NS]: + * xfaces.c (Qultra_light, Qreverse_oblique, Qreverse_italic): + Now static. + * xfaces.c: Remove unnecessary static decls. + * xterm.c (updating_frame): Remove decl of nonexistent object. + + * Makefile.in (gl-stamp): Don't scan $(SOME_MACHINE_OBJECTS) + when building globals.h, as the objects that are not built on + this host are not needed to compile C files on this host. + +2012-09-02 Jan Djärv + + * gtkutil.h: Remove prototype for x_wm_set_size_hint. + + * frame.h: Add missing prototype for x_wm_set_size_hint. + +2012-09-02 Paul Eggert + + * doc.c, editfns.c, insdel.c, intervals.c: Use bool for boolean. + * doc.c (read_bytecode_char, get_doc_string, reread_doc_file) + (Fdocumentation, Fdocumentation_property, Fsnarf_documentation) + (Fsubstitute_command_keys): + * editfns.c (region_limit, find_field, Fconstrain_to_field) + (save_excursion_save, save_excursion_restore) + (disassemble_lisp_time, decode_time_components, emacs_nmemftime) + (format_time_string, general_insert_function) + (make_buffer_string, make_buffer_string_both) + (Fsubst_char_in_region, Ftranslate_region_internal, Fformat): + * insdel.c (check_markers, gap_left, adjust_markers_for_insert) + (copy_text, insert_1, insert_1_both, insert_from_string) + (insert_from_string_before_markers, insert_from_string_1) + (insert_from_buffer, insert_from_buffer_1, replace_range) + (replace_range_2, del_range_1, del_range_byte, del_range_both) + (del_range_2, modify_region): + * intervals.c (intervals_equal, balance_possible_root_interval) + (adjust_intervals_for_insertion, merge_properties_sticky) + (graft_intervals_into_buffer, lookup_char_property) + (adjust_for_invis_intang, set_point_both) + (get_property_and_range, compare_string_intervals) + (set_intervals_multibyte_1, set_intervals_multibyte): + * keyboard.c (decode_timer): + Use bool for boolean. + * intervals.h, lisp.h, systime.h: Reflect above API changes. + * editfns.c (struct info): Use 1-bit unsigned bitfields for booleans. + +2012-09-02 Chong Yidong + + * keymap.c (push_key_description): Print M-TAB as C-M-i + (Bug#11758). + +2012-09-02 Juanma Barranquero + + * makefile.w32-in (CCL_H, W32FONT_H): New macros. + (ATIMER_H, FONT_H, $(BLD)/alloc.$(O), $(BLD)/callproc.$(O)) + ($(BLD)/editfns.$(O), $(BLD)/ccl.$(O), $(BLD)/chartab.$(O)) + ($(BLD)/coding.$(O), $(BLD)/sysdep.$(O), $(BLD)/fontset.$(O)) + ($(BLD)/sysdep.$(O), $(BLD)/w32fns.$(O), $(BLD)/keyboard.$(O)) + ($(BLD)/w32term.$(O), $(BLD)/w32menu.$(O), $(BLD)/process.$(O)) + ($(BLD)/w32font.$(O), $(BLD)/w32uniscribe.$(O)): Update dependencies. + +2012-09-01 Eli Zaretskii + + * w32uniscribe.c (uniscribe_shape): Handle correctly the case of + more than one grapheme cluster passed to the shaper: compute the + offset adjustment values separately for each cluster. (Bug#11860) + + * image.c: Restore mistakenly removed inclusion of w32.h. Without + it, GCC doesn't see prototypes of w32_delayed_load, and complains + about implicit conversions from integer to pointer. + +2012-09-01 Daniel Colascione + + * w32fns.c (x_display_info_for_name): Prevent crash if w32 window + system used too early. + +2012-09-01 Paul Eggert + + Better seed support for (random). + * emacs.c (main): Call init_random. + * fns.c (Frandom): Set the seed from a string argument, if given. + Remove long-obsolete Gentzel cruft. + * lisp.h, sysdep.c (seed_random): Now takes address and size, not long. + (init_random): New function. + +2012-09-01 Daniel Colascione + + * xterm.h: Add header guards. Declare x_menubar_window_to_frame. + Remove x_set_frame_alpha, x_bitmap_icon, x_make_frame_visible, + x_make_frame_invisible, x_iconify_frame, x_free_frame_resources, + x_wm_set_size_hint, x_query_colors, x_real_positions, + x_set_menu_bar_lines, x_char_width, x_char_height, x_sync, + x_set_tool_bar_lines, x_activate_menubar, and free_frame_menubar, + all of which have been moved to common code. + + * xfaces.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * w32xfns.c (x_sync): Correct definition of x_sync (a no-op here) + to match header. + + * w32term.h (FRAME_X_WINDOW): Use FRAME_W32_WINDOW instead of + directly accessing frame internals. + + * w32font.h: Include font.h. Define syms_of_w32font and + globals_of_w32font. + + * process.c: Include TERM_HEADER instead of listing all possible + window-system headers. + - * nsterm.h: Remove declarations now in frame.h. Define - FRAME_X_SCREEN, FRAME_X_VISUAL. ++ * nsterm.h: Remove declarations now in frame.h. ++ Define FRAME_X_SCREEN, FRAME_X_VISUAL. + + * menu.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * keyboard.h: Declare ignore_mouse_drag_p whenever we have a + window system. + + * keyboard.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * image.c: Include TERM_HEADER instead of listing all possible + window-system headers. Declare Vlibrary_cache when compiling for + Windows. + + * gtkutil.h (xg_list_node_): Include xterm.h to pick up needed + window system declarations. + + * frame.h: Move common functions here: set_frame_menubar, + x_set_window_size, x_sync, x_get_focus_frame, + x_set_mouse_position, x_set_mouse_pixel_position, + x_make_frame_visible, x_make_frame_invisible, x_iconify_frame, + x_char_width, x_char_height, x_pixel_width, x_pixel_height, + x_set_frame_alpha, x_set_menu_bar_lines, x_set_tool_bar_lines, + x_activate_menubar, x_real_positions, x_bitmap_icon, + x_set_menu_bar_lines, free_frame_menubar, x_free_frame_resources, + and x_query_colors. + + * frame.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * font.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * emacs.c: Include TERM_HEADER. + + * dispnew.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * ccl.h: Include character.h. + + * Makefile.in: Define WINDOW_SYSTEM_OBJ to hold objects needed for + the current window system; include in list of objects to link into + Emacs. + +2012-08-31 Dmitry Antipov + + Remove mark_ttys function and fix tty_display_info initialization. + * lisp.h (mark_ttys): Remove prototype. + * alloc.c (Fgarbage_collect): Remove redundant (and the only) call + to mark_ttys because all possible values of 'top_frame' slot are + the frames which are reachable from Vframe_list. + * term.c (mark_ttys): Remove. + (init_tty): Safely initialize 'top_frame' slot with Qnil. + +2012-08-31 Dmitry Antipov + + Change struct frame bitfields from unsigned char to unsigned. + * frame.h (struct frame): Change type of 'display_preempted', + 'visible', 'iconified', 'has_minibuffer', 'wants_modeline', + 'auto_raise', 'auto_lower', 'no_split', 'explicit_name', + 'window_sizes_changed', 'mouse_moved' and 'pointer_invisible' + bitfields from unsigned char to unsigned. + +2012-08-31 Dmitry Antipov + + Remove unused member of struct x_output and struct w32_output. + * xterm.h (struct x_output): Remove unused field 'needs_exposure'. + * w32term.h (struct w32_output): Likewise. + +2012-08-30 Jan Djärv + + * gtkutil.c (x_wm_set_size_hint): Use 1 col for base_width so it + does not become zero (Bug#12234). + +2012-08-30 Paul Eggert + + * dispnew.c (update_frame_1): Pacify gcc -Wstrict-overflow + for GCC 4.7.1 x86-64. + +2012-08-30 Glenn Morris + + * lread.c (init_lread): For out-of-tree builds, only add the + source directory's site-lisp dir to the load-path if it exists, + consistent with in-tree builds. (Bug#12302) + +2012-08-28 Jan Djärv + + * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize + button_values to NULL. Call setStykeMask so dialogs get a close button. + (windowShouldClose:): Set window_closed. + (dealloc): New member, free button_values. + (process_dialog:): Make member function. Remove window argument, + replace window with self. Count buttons and allocate and store values + in button_values. + (addButton:value:row:): value is int with the name tag. Call setTag + with tag. Remove return self, declare return value as void. + (addString:row:): Remove return self, declare return value as void. + (addSplit): Remove return self, declare return value as void. + (clicked:): Remove return self, declare return value as void. + Set dialog_return to button_values[seltag]. Code formatting change. + (initFromContents:isQuestion:): Adjust call to process_dialog. + Code formatting change. + (timeout_handler:): Set timer_fired to YES. + (runDialogAt:): Set timer_fired to NO. + Handle click on close button as quit. + + * nsterm.h (EmacsDialogPanel): Make timer_fired BOOL. + Add window_closed and button_values. Add void as return value for + add(Button|String|Split). addButton takes int instead of Lisp_Object. + Add process_dialog as new member. + +2012-08-28 Eli Zaretskii + + * ralloc.c (free_bloc): Don't dereference a 'heap' structure if it + is not one of the heaps we manage. (Bug#12242) + +2012-08-28 Glenn Morris + + * eval.c (Fcalled_interactively_p): Doc fix. (Bug#11747) + +2012-08-28 Martin Rudalics + + * window.c (Fset_window_configuration): Remove handling of + auto-buffer-name window parameter. Install revision of reverted + fix. + +2012-08-28 Dmitry Antipov + + Do not allow to set major mode for a dead buffer. + * buffer.c (Fset_buffer_major_mode): Signal an error + if the buffer is dead. + (Fother_buffer, other_buffer_safely): Remove redundant + nested declaration. + +2012-08-28 Dmitry Antipov + + Always use set_buffer_if_live to restore original buffer at unwind. + * buffer.h (record_unwind_current_buffer): New function. + * bytecode.c, dispnew.c, editfns.c, fileio.c, fns.c, insdel.c: + * keyboard.c, keymap.c, minibuf.c, print.c, process.c, textprop.c: + * undo.c, window.c: Adjust users. + * buffer.c (set_buffer_if_live): Fix comment. + +2012-08-28 Dmitry Antipov + + Fix usage of set_buffer_internal. + * buffer.h (set_buffer_internal): Make it BUFFER_INLINE. + * buffer.c (set_buffer_if_live): Use set_buffer_internal. + * coding.c (decode_coding): Omit redundant test. + * fileio.c (decide_coding_unwind): Likewise. + * fns.c (secure_hash): Likewise. + * insdel.c (modify_region): Likewise. + * keyboard.c (command_loop_1): Likewise. + * print.c (PRINTFINISH): Likewise. + * xdisp.c (run_window_scroll_functions): Use set_buffer_internal. + +2012-08-27 Paul Eggert + + * dispnew.c: Use bool for boolean. + (frame_garbaged, display_completed, delayed_size_change) + (fonts_changed_p, add_window_display_history) + (add_frame_display_history, verify_row_hash) + (adjust_glyph_matrix, clear_window_matrices, glyph_row_slice_p) + (row_equal_p, realloc_glyph_pool) + (allocate_matrices_for_frame_redisplay) + (showing_window_margins_p) + (adjust_frame_glyphs_for_frame_redisplay) + (build_frame_matrix_from_leaf_window, make_current) + (mirrored_line_dance, mirror_line_dance, update_frame) + (update_window_tree, update_single_window) + (check_current_matrix_flags, update_window, update_text_area) + (update_window_line, set_window_update_flags, scrolling_window) + (update_frame_1, scrolling, buffer_posn_from_coords) + (do_pending_window_change, change_frame_size) + (change_frame_size_1, sit_for): + Use bool for boolean. + (clear_glyph_matrix_rows): Rename from enable_glyph_matrix_rows, + and remove last int (actually boolean) argument, which was always 0. + All callers changed. + * dispextern.h, frame.h, lisp.h: Reflect above API changes. + * dispextern.h (struct composition_it): Use bool for boolean. + (struct glyph_matrix): Don't assume buffer sizes can fit in 'int'. + (struct bidi_it): Use unsigned:1, not int, for boolean prev_was_pdf. + * dired.c (file_name_completion): + Use bool for boolean. (This was missed in an earlier change.) + +2012-08-27 Martin Rudalics + + * window.c (Fset_window_configuration): Revert first part of + last change. + +2012-08-27 Jan Djärv + + * nsterm.h (NSPanel): New class variable dialog_return. + - * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize - dialog_return. ++ * nsmenu.m (initWithContentRect:styleMask:backing:defer:): ++ Initialize dialog_return. + (windowShouldClose:): Use stop instead of stopModalWithCode. + (clicked:): Ditto, and also set dialog_return (Bug#12258). + (timeout_handler:): Use stop instead of abortModal. Send a dummy + event. + (runDialogAt:): Make ret Lisp_Object. Set it from dialog_return when + modal loop returns. + +2012-08-27 Paul Eggert + + * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans. + * composite.c (find_composition, composition_gstring_p) + (composition_reseat_it, find_automatic_composition): + * data.c (let_shadows_buffer_binding_p) + (let_shadows_global_binding_p, set_internal, make_blv) + (Fmake_variable_buffer_local, Fmake_local_variable) + (Fmake_variable_frame_local, arithcompare, cons_to_unsigned) + (cons_to_signed, arith_driver): + * dbusbind.c (xd_in_read_queued_messages): + * dired.c (directory_files_internal, file_name_completion): + Use bool for booleans. + * dired.c (file_name_completion): + * process.h (fd_callback): + Omit int (actually boolean) argument. It wasn't being used. + All uses changed. + * composite.h, lisp.h: Reflect above API changes. + + * cmds.c, coding.c: Use bool for booleans. + * cmds.c (move_point, Fself_insert_command): + * coding.h (struct composition status, struct coding_system): + * coding.c (detect_coding_utf_8, encode_coding_utf_8) + (detect_coding_utf_16, encode_coding_utf_16, detect_coding_emacs_mule) + (emacs_mule_char, decode_coding_emacs_mule) + (encode_coding_emacs_mule, detect_coding_iso_2022) + (decode_coding_iso_2022, encode_invocation_designation) + (encode_designation_at_bol, encode_coding_iso_2022) + (detect_coding_sjis, detect_coding_big5, decode_coding_sjis) + (decode_coding_big5, encode_coding_sjis, encode_coding_big5) + (detect_coding_ccl, encode_coding_ccl, decode_coding_raw_text) + (encode_coding_raw_text, detect_coding_charset) + (decode_coding_charset, encode_coding_charset, detect_eol) + (detect_coding, get_translation_table, produce_chars) + (consume_chars, reused_workbuf_in_use) + (make_conversion_work_buffer, code_conversion_save) + (decode_coding_object, encode_coding_object) + (detect_coding_system, char_encodable_p) + (Funencodable_char_position, code_convert_region) + (code_convert_string, code_convert_string_norecord) + (Fset_coding_system_priority): + * fileio.c (Finsert_file_contents): + Use bool for booleans. + * coding.h, lisp.h: Reflect above API changes. + * coding.c: Remove unnecessary static function decls. + (detect_coding): Use unsigned, not signed, to copy an unsigned field. + (decode_coding, encode_coding, decode_coding_gap): Return 'void', + not a boolean 'int', since callers never look at the return value. + (ALLOC_CONVERSION_WORK_AREA): Assume caller returns 'void', not 'int'. + * coding.h (decoding_buffer_size, encoding_buffer_size) + (emacs_mule_string_char): Remove unused extern decls. + (struct iso_2022_spec, struct coding_system): + Use 'unsigned int : 1' for boolean fields, since there's more than one. + (struct emacs_mule_spec): Remove unused field 'full_support'. + All initializations removed. + * cmds.c (internal_self_insert): Don't assume EMACS_INT fits in 'int'. + +2012-08-27 Dmitry Antipov + + Fix spare memory change (Bug#12286). + * alloc.c (mark_maybe_pointer): Handle MEM_TYPE_SPARE. + (valid_lisp_object_p): Likewise. + +2012-08-27 Martin Rudalics + + * window.c (Fset_window_configuration): Record any window's old + buffer if it's replaced (see Bug#8789). If the new current + buffer doesn't appear in the selected window, go to its old + point (Bug#12208). + +2012-08-27 Dmitry Antipov + + Special MEM_TYPE_SPARE to denote reserved memory. + * alloc.c (enum mem_type): New memory type. + (refill_memory_reserve): Use new type for spare memory. + This prevents live_cons_p and live_string_p from incorrect + detection of uninitialized objects from spare memory as live. + +2012-08-26 Paul Eggert + + Spelling fixes. + * Makefile.in (.PHONY): versioclean -> versionclean. + + Remove unused external symbols. + * data.c (Qcons, Qfloat, Qmisc, Qstring, Qvector): + * window.c (Qwindow_valid_p, decode_valid_window): + Now static, not extern. + * data.c (Qinterval): Remove; unused. + (syms_of_data): Do not define 'interval'. + * lisp.h (Qinteger, Qstring, Qmisc, Qvector, Qfloat, Qcons): + * window.h (decode_valid_window): + Remove decls. + + * character.c, charset.c, chartab.c: Use bool for booleans. + * character.c (lisp_string_width, string_count_byte8) + (string_escape_byte8): + * charset.c (charset_map_loaded, load_charset_map, read_hex): + (load_charset_map_from_file, map_charset_chars) + (Fdefine_charset_internal, define_charset_internal) + (Fdeclare_equiv_charset, find_charsets_in_text) + (Ffind_charset_region, char_charset, Fiso_charset): + * chartab.c (sub_char_table_ref, sub_char_table_ref_and_range) + (sub_char_table_set, sub_char_table_set_range) + (char_table_set_range, optimize_sub_char_table) + (map_sub_char_table): + Use bool for boolean. + * character.c (str_to_unibyte): Omit last boolean argument; it was + always 0. All callers changed. + * character.h, charset.h: Adjust to match previous changes. + * character.h (char_printable_p): Remove decl of nonexistent function. + * charset.h (struct charset): Members code_linear_p, iso_chars_96, + ascii_compatible_p, supplementary_p, compact_codes_p, unified_p + are all boolean, so make them single-bit bitfields. + + * lisp.h (ASET): Remove attempt to detect side effects. + It was meant to be temporary and it often doesn't work, + because when IDX has side effects the behavior of IDX==IDX + is undefined. See Stefan Monnier in + . + +2012-08-26 Barry OReilly (tiny change) + + * lisp.h (functionp): New function (extracted from Ffunctionp). + (FUNCTIONP): Use it. + * eval.c (Ffunctionp): Use it. + +2012-08-25 Paul Eggert + + * xgselect.c (xg_select): Use auto storage for the GPollFD buffer + as that's faster and simpler than static storage. Don't bother + with the g_main_context_query overhead if g_main_context_pending + says no events are pending. + (gfds, gfds_size): Remove these static vars. + (xgselect_initialize): Remove; no longer needed. + All uses and decls removed. + + * emacs.c (fatal_error_signal_hook): Remove. + All uses removed. This leftover from old code was always 0. + + * casefiddle.c, casetab.c, category.c: Use bool for boolean. + * casefiddle.c (casify_object, casify_region): + * casetab.c (set_case_table): + * category.c, category.h (word_boundary_p): + * category.h (CHAR_HAS_CATEGORY): + Use bool for booleans, instead of int. + +2012-08-25 Eli Zaretskii + + * makefile.w32-in ($(BLD)/alloc.$(O)): Depend on $(GNU_LIB)/execinfo.h. + +2012-08-25 Paul Eggert + + On assertion failure, print backtrace if available. + * alloc.c [ENABLE_CHECKING]: Include . + (die) [ENABLE_CHECKING]: Print a backtrace if available. + * Makefile.in (LIB_EXECINFO): New macro. + (LIBES): Use it. + + * bytecode.c, callint.c, callproc.c: Use bool for boolean. + * bytecode.c (exec_byte_code): + * callint.c (check_mark, Fcall_interactively): + * callproc.c (Fcall_process, add_env, child_setup, getenv_internal_1) + (getenv_internal, sync_process_alive, call_process_exited): + * lisp.h (USE_SAFE_ALLOCA): + Use bool for booleans, instead of int. + * lisp.h, process.h: Adjust prototypes to match above changes. + * callint.c (Fcall_interactively): Don't assume the mark's + offset fits in 'int'. + +2012-08-24 Paul Eggert + + * buffer.c, buffer.h: Use bool for boolean. + * buffer.c (reset_buffer_local_variables) + (buffer_lisp_local_variables, Fset_buffer_modified_p) + (Frestore_buffer_modified_p, Fset_buffer_multibyte): + (overlays_at, overlays_in, mouse_face_overlay_overlaps) + (overlay_touches_p, overlay_strings, Foverlay_put) + (report_overlay_modification, call_overlay_mod_hooks): + (mmap_enlarge, mmap_set_vars): + * buffer.h (buffer_has_overlays, uppercasep, lowercasep): + Use bool for booleans, instead of int. + * buffer.c (compact_buffer, mmap_free_1): Return void, not int, + since the 1-or-0 return value is always ignored anyway. + (mmap_initialized_p): + * buffer.h (struct buffer_text.inhibit_shrinking): Now bool, not int. + * buffer.h, lisp.h: Adjust prototypes to match above changes. + +2012-08-23 Paul Eggert + + * bidi.c: Use bool for boolean. + This is a bit more readable, and makes the text segment of bidi.o + 0.4% smaller on my platform (GCC 4.7.1 x86-64, Fedora 15). + Presumably it's faster too. + (bidi_initialized, bidi_ignore_explicit_marks_for_paragraph_level): + Now bool. + (bidi_cache_find_level_change, bidi_cache_iterator_state) + (bidi_unshelve_cache, bidi_init_it, bidi_count_bytes) + (bidi_char_at_pos, bidi_fetch_char, bidi_paragraph_init) + (bidi_explicit_dir_char, bidi_level_of_next_char) + (bidi_find_other_level_edge, bidi_move_to_visually_next): + Use bool for booleans, instead of int. + * dispextern.h (bidi_init_it, bidi_paragraph_init) + (bidi_unshelve_cache): Adjust decls to match code. + +2012-08-23 Martin Rudalics + + * keyboard.c (Fposn_at_x_y): Do not allow internal window as + argument. + +2012-08-23 Paul Eggert + + * atimer.c, atimer.h (turn_on_atimers): Use bool for boolean. + * atimer.h: Include . + +2012-08-22 Dan Nicolaescu + + * frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_NS_P): Change to + compile time tests instead of run time tests on systems that do + not use them. + (FRAME_MAC_P): Remove leftover from deleted code. + * frame.c (syms_of_frame): Remove leftover from deleted code. + +2012-08-22 Jan Djärv + + * nsterm.m (insertText:): Don't clear modifiers if code is space. -2012-09-15 Tomohiro Matsuyama +2012-08-22 Paul Eggert - * alloc.c (emacs_blocked_malloc): Remove redundant MALLOC_PROBE. + * fontset.c (FONTSET_ADD): Return void, not Lisp_Object. + Otherwise, the compiler complains about (A?B:C) where B is void + and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12. + (fontset_add): Return void, for FONTSET_ADD. 2012-08-21 Paul Eggert diff --cc src/Makefile.in index 37da170edbd,02b702bc055..e43f83e1172 --- a/src/Makefile.in +++ b/src/Makefile.in @@@ -339,8 -338,8 +339,9 @@@ base_obj = dispnew.o frame.o scroll.o x process.o gnutls.o callproc.o \ region-cache.o sound.o atimer.o \ doprnt.o intervals.o textprop.o composite.o xml.o \ + profiler.o \ - $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) + $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ + $(WINDOW_SYSTEM_OBJ) obj = $(base_obj) $(NS_OBJC_OBJ) ## Object files used on some machine or other. diff --cc src/alloc.c index 923e8736a86,8c0f99cbb05..46c9a10c725 --- a/src/alloc.c +++ b/src/alloc.c @@@ -619,35 -705,16 +620,42 @@@ overrun_check_free (void *block #define free overrun_check_free #endif -#ifdef SYNC_INPUT -/* When using SYNC_INPUT, we don't call malloc from a signal handler, so - there's no need to block input around malloc. */ -#define MALLOC_BLOCK_INPUT ((void)0) -#define MALLOC_UNBLOCK_INPUT ((void)0) +/* If compiled with XMALLOC_BLOCK_INPUT_CHECK, define a symbol + BLOCK_INPUT_IN_MEMORY_ALLOCATORS that is visible to the debugger. + If that variable is set, block input while in one of Emacs's memory + allocation functions. There should be no need for this debugging + option, since signal handlers do not allocate memory, but Emacs + formerly allocated memory in signal handlers and this compile-time + option remains as a way to help debug the issue should it rear its + ugly head again. */ +#ifdef XMALLOC_BLOCK_INPUT_CHECK +bool block_input_in_memory_allocators EXTERNALLY_VISIBLE; +static void +malloc_block_input (void) +{ + if (block_input_in_memory_allocators) + block_input (); +} +static void +malloc_unblock_input (void) +{ + if (block_input_in_memory_allocators) + unblock_input (); +} +# define MALLOC_BLOCK_INPUT malloc_block_input () +# define MALLOC_UNBLOCK_INPUT malloc_unblock_input () #else -#define MALLOC_BLOCK_INPUT BLOCK_INPUT -#define MALLOC_UNBLOCK_INPUT UNBLOCK_INPUT +# define MALLOC_BLOCK_INPUT ((void) 0) +# define MALLOC_UNBLOCK_INPUT ((void) 0) #endif ++#define MALLOC_PROBE(size) \ ++ do { \ ++ if (profiler_memory_running) \ ++ malloc_probe (size); \ ++ } while (0) ++ ++ /* Like malloc but check for no memory and block interrupt input.. */ void * @@@ -5068,9 -5421,11 +5099,11 @@@ See Info node `(elisp)Garbage Collectio ptrdiff_t count = SPECPDL_INDEX (); EMACS_TIME start; Lisp_Object retval = Qnil; + size_t tot_before = 0; + struct backtrace backtrace; if (abort_on_gc) - abort (); + emacs_abort (); /* Can't GC if pure storage overflowed because we can't determine if something is a pure object or not. */ diff --cc src/lisp.h index 35efa67e707,a0390fd360f..21ac55c1063 --- a/src/lisp.h +++ b/src/lisp.h @@@ -2031,10 -2015,19 +2031,22 @@@ extern ptrdiff_t specpdl_size #define SPECPDL_INDEX() (specpdl_ptr - specpdl) + struct backtrace + { + struct backtrace *next; + Lisp_Object *function; + Lisp_Object *args; /* Points to vector of args. */ + ptrdiff_t nargs; /* Length of vector. */ + /* Nonzero means call value of debugger when done with this operation. */ + unsigned int debug_on_exit : 1; + }; + + extern struct backtrace *backtrace_list; + -/* Everything needed to describe an active condition case. */ +/* Everything needed to describe an active condition case. + + Members are volatile if their values need to survive _longjmp when + a 'struct handler' is a local variable. */ struct handler { /* The handler clauses and variable from the condition-case form. */ @@@ -3534,8 -3525,20 +3547,15 @@@ extern int have_menus_p (void) void syms_of_dbusbind (void); #endif + + /* Defined in profiler.c. */ + extern bool profiler_memory_running; + extern void malloc_probe (size_t); -#define MALLOC_PROBE(size) \ - do { \ - if (profiler_memory_running) \ - malloc_probe (size); \ - } while (0) + extern void syms_of_profiler (void); + + #ifdef DOS_NT -/* Defined in msdos.c, w32.c */ +/* Defined in msdos.c, w32.c. */ extern char *emacs_root_dir (void); #endif /* DOS_NT */ diff --cc src/makefile.w32-in index bed6f215711,f89a4c83ee7..6f228ed0bb3 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@@ -973,9 -967,13 +974,14 @@@ $(BLD)/xml.$(O) : $(CONFIG_H) \ $(LISP_H) + $(BLD)/profiler.$(O) : \ + $(SRC)/profiler.c \ + $(CONFIG_H) \ + $(LISP_H) + $(BLD)/image.$(O) : \ $(SRC)/image.c \ + $(SRC)/blockinput.h \ $(SRC)/epaths.h \ $(SRC)/w32.h \ $(NT_INC)/unistd.h \ diff --cc src/profiler.c index 00000000000,e7593a6a0e0..f8fa697d79d mode 000000,100644..100644 --- a/src/profiler.c +++ b/src/profiler.c @@@ -1,0 -1,422 +1,426 @@@ + /* Profiler implementation. + + Copyright (C) 2012 Free Software Foundation, Inc. + + This file is part of GNU Emacs. + + GNU Emacs 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. + + GNU Emacs 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 GNU Emacs. If not, see . */ + + #include + #include + #include + #include + #include + #include + #include "lisp.h" + + /* Logs. */ + + typedef struct Lisp_Hash_Table log_t; + + static Lisp_Object + make_log (int heap_size, int max_stack_depth) + { + /* We use a standard Elisp hash-table object, but we use it in + a special way. This is OK as long as the object is not exposed + to Elisp, i.e. until it is returned by *-profiler-log, after which + it can't be used any more. */ + Lisp_Object log = make_hash_table (Qequal, make_number (heap_size), + make_float (DEFAULT_REHASH_SIZE), + make_float (DEFAULT_REHASH_THRESHOLD), + Qnil, Qnil, Qnil); + struct Lisp_Hash_Table *h = XHASH_TABLE (log); + + /* What is special about our hash-tables is that the keys are pre-filled + with the vectors we'll put in them. */ + int i = ASIZE (h->key_and_value) / 2; + while (0 < i) + set_hash_key_slot (h, --i, + Fmake_vector (make_number (max_stack_depth), Qnil)); + return log; + } + + /* Evict the least used half of the hash_table. + + When the table is full, we have to evict someone. + The easiest and most efficient is to evict the value we're about to add + (i.e. once the table is full, stop sampling). + + We could also pick the element with the lowest count and evict it, + but finding it is O(N) and for that amount of work we get very + little in return: for the next sample, this latest sample will have + count==1 and will hence be a prime candidate for eviction :-( + + So instead, we take O(N) time to eliminate more or less half of the + entries (the half with the lowest counts). So we get an amortized + cost of O(1) and we get O(N) time for a new entry to grow larger + than the other least counts before a new round of eviction. */ + + static EMACS_INT approximate_median (log_t *log, + ptrdiff_t start, ptrdiff_t size) + { + eassert (size > 0); + if (size < 2) + return XINT (HASH_VALUE (log, start)); + if (size < 3) + /* Not an actual median, but better for our application than + choosing either of the two numbers. */ + return ((XINT (HASH_VALUE (log, start)) + + XINT (HASH_VALUE (log, start + 1))) + / 2); + else + { + ptrdiff_t newsize = size / 3; + ptrdiff_t start2 = start + newsize; + EMACS_INT i1 = approximate_median (log, start, newsize); + EMACS_INT i2 = approximate_median (log, start2, newsize); + EMACS_INT i3 = approximate_median (log, start2 + newsize, + size - 2 * newsize); + return (i1 < i2 + ? (i2 < i3 ? i2 : (i1 < i3 ? i3 : i1)) + : (i1 < i3 ? i1 : (i2 < i3 ? i3 : i2))); + } + } + + static void evict_lower_half (log_t *log) + { + ptrdiff_t size = ASIZE (log->key_and_value) / 2; + EMACS_INT median = approximate_median (log, 0, size); + ptrdiff_t i; + + for (i = 0; i < size; i++) + /* Evict not only values smaller but also values equal to the median, + so as to make sure we evict something no matter what. */ + if (XINT (HASH_VALUE (log, i)) <= median) + { + Lisp_Object key = HASH_KEY (log, i); + { /* FIXME: we could make this more efficient. */ + Lisp_Object tmp; + XSET_HASH_TABLE (tmp, log); /* FIXME: Use make_lisp_ptr. */ + Fremhash (key, tmp); + } + eassert (EQ (log->next_free, make_number (i))); + { + int j; + eassert (VECTORP (key)); + for (j = 0; j < ASIZE (key); j++) + ASET (key, j, Qnil); + } + set_hash_key_slot (log, i, key); + } + } + + /* Record the current backtrace in LOG. BASE is a special name for + describing which the backtrace come from. BASE can be nil. COUNT is + a number how many times the profiler sees the backtrace at the + time. ELAPSED is a elapsed time in millisecond that the backtrace + took. */ + + static void + record_backtrace (log_t *log, size_t count) + { + struct backtrace *backlist = backtrace_list; + Lisp_Object backtrace; + ptrdiff_t index, i = 0; + ptrdiff_t asize; + + if (!INTEGERP (log->next_free)) + /* FIXME: transfer the evicted counts to a special entry rather + than dropping them on the floor. */ + evict_lower_half (log); + index = XINT (log->next_free); + + /* Get a "working memory" vector. */ + backtrace = HASH_KEY (log, index); + asize = ASIZE (backtrace); + + /* Copy the backtrace contents into working memory. */ + for (; i < asize && backlist; i++, backlist = backlist->next) + /* FIXME: For closures we should ignore the environment. */ + ASET (backtrace, i, *backlist->function); + + /* Make sure that unused space of working memory is filled with nil. */ + for (; i < asize; i++) + ASET (backtrace, i, Qnil); + + { /* We basically do a `gethash+puthash' here, except that we have to be + careful to avoid memory allocation since we're in a signal + handler, and we optimize the code to try and avoid computing the + hash+lookup twice. See fns.c:Fputhash for reference. */ + EMACS_UINT hash; + ptrdiff_t j = hash_lookup (log, backtrace, &hash); + if (j >= 0) + set_hash_value_slot (log, j, + make_number (count + XINT (HASH_VALUE (log, j)))); + else + { /* BEWARE! hash_put in general can allocate memory. + But currently it only does that if log->next_free is nil. */ + int j; + eassert (!NILP (log->next_free)); + j = hash_put (log, backtrace, make_number (count), hash); + /* Let's make sure we've put `backtrace' right where it + already was to start with. */ + eassert (index == j); + + /* FIXME: If the hash-table is almost full, we should set + some global flag so that some Elisp code can offload its + data elsewhere, so as to avoid the eviction code. + There are 2 ways to do that, AFAICT: + - Set a flag checked in QUIT, such that QUIT can then call + Fprofiler_cpu_log and stash the full log for later use. + - Set a flag check in post-gc-hook, so that Elisp code can call + profiler-cpu-log. That gives us more flexibility since that + Elisp code can then do all kinds of fun stuff like write + the log to disk. Or turn it right away into a call tree. + Of course, using Elisp is generally preferable, but it may + take longer until we get a chance to run the Elisp code, so + there's more risk that the table will get full before we + get there. */ + } + } + } + + /* Sample profiler. */ + ++/* FIXME: Add support for the CPU profiler in W32. */ ++/* FIXME: the sigprof_handler suffers from race-conditions if the signal ++ is delivered to a thread other than the main Emacs thread. */ ++ + #if defined SIGPROF && defined HAVE_SETITIMER + #define PROFILER_CPU_SUPPORT + + /* True if sampling profiler is running. */ + static bool profiler_cpu_running; + + static Lisp_Object cpu_log; + /* Separate counter for the time spent in the GC. */ + static EMACS_INT cpu_gc_count; + + /* The current sample interval in millisecond. */ + + static int current_sample_interval; + + /* Signal handler for sample profiler. */ + + static void + sigprof_handler (int signal, siginfo_t *info, void *ctx) + { + eassert (HASH_TABLE_P (cpu_log)); + if (backtrace_list && EQ (*backtrace_list->function, Qautomatic_gc)) + /* Special case the time-count inside GC because the hash-table + code is not prepared to be used while the GC is running. + More specifically it uses ASIZE at many places where it does + not expect the ARRAY_MARK_FLAG to be set. We could try and + harden the hash-table code, but it doesn't seem worth the + effort. */ + cpu_gc_count += current_sample_interval; + else + record_backtrace (XHASH_TABLE (cpu_log), current_sample_interval); + } + + DEFUN ("profiler-cpu-start", Fprofiler_cpu_start, Sprofiler_cpu_start, + 1, 1, 0, + doc: /* Start or restart the cpu profiler. + The cpu profiler will take call-stack samples each SAMPLE-INTERVAL (expressed in milliseconds). + See also `profiler-log-size' and `profiler-max-stack-depth'. */) + (Lisp_Object sample_interval) + { + struct sigaction sa; + struct itimerval timer; + + if (profiler_cpu_running) + error ("Sample profiler is already running"); + + if (NILP (cpu_log)) + { + cpu_gc_count = 0; + cpu_log = make_log (profiler_log_size, + profiler_max_stack_depth); + } + + current_sample_interval = XINT (sample_interval); + + sa.sa_sigaction = sigprof_handler; + sa.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset (&sa.sa_mask); + sigaction (SIGPROF, &sa, 0); + + timer.it_interval.tv_sec = 0; + timer.it_interval.tv_usec = current_sample_interval * 1000; + timer.it_value = timer.it_interval; + setitimer (ITIMER_PROF, &timer, 0); + + profiler_cpu_running = true; + + return Qt; + } + + DEFUN ("profiler-cpu-stop", Fprofiler_cpu_stop, Sprofiler_cpu_stop, + 0, 0, 0, + doc: /* Stop the cpu profiler. The profiler log is not affected. + Return non-nil if the profiler was running. */) + (void) + { + if (!profiler_cpu_running) + return Qnil; + profiler_cpu_running = false; + + setitimer (ITIMER_PROF, 0, 0); + + return Qt; + } + + DEFUN ("profiler-cpu-running-p", + Fprofiler_cpu_running_p, Sprofiler_cpu_running_p, + 0, 0, 0, + doc: /* Return non-nil iff cpu profiler is running. */) + (void) + { + return profiler_cpu_running ? Qt : Qnil; + } + + DEFUN ("profiler-cpu-log", Fprofiler_cpu_log, Sprofiler_cpu_log, + 0, 0, 0, + doc: /* Return the current cpu profiler log. + The log is a hash-table mapping backtraces to counters which represent + the amount of time spent at those points. Every backtrace is a vector + of functions, where the last few elements may be nil. + Before returning, a new log is allocated for future samples. */) + (void) + { + Lisp_Object result = cpu_log; + /* Here we're making the log visible to Elisp , so it's not safe any + more for our use afterwards since we can't rely on its special + pre-allocated keys anymore. So we have to allocate a new one. */ + cpu_log = (profiler_cpu_running + ? make_log (profiler_log_size, profiler_max_stack_depth) + : Qnil); + Fputhash (Fmake_vector (make_number (1), Qautomatic_gc), + make_number (cpu_gc_count), + result); + cpu_gc_count = 0; + return result; + } + #endif /* not defined PROFILER_CPU_SUPPORT */ + + /* Memory profiler. */ + + /* True if memory profiler is running. */ + bool profiler_memory_running; + + static Lisp_Object memory_log; + + DEFUN ("profiler-memory-start", Fprofiler_memory_start, Sprofiler_memory_start, + 0, 0, 0, + doc: /* Start/restart the memory profiler. + The memory profiler will take samples of the call-stack whenever a new + allocation takes place. Note that most small allocations only trigger + the profiler occasionally. + See also `profiler-log-size' and `profiler-max-stack-depth'. */) + (void) + { + if (profiler_memory_running) + error ("Memory profiler is already running"); + + if (NILP (memory_log)) + memory_log = make_log (profiler_log_size, + profiler_max_stack_depth); + + profiler_memory_running = true; + + return Qt; + } + + DEFUN ("profiler-memory-stop", + Fprofiler_memory_stop, Sprofiler_memory_stop, + 0, 0, 0, + doc: /* Stop the memory profiler. The profiler log is not affected. + Return non-nil if the profiler was running. */) + (void) + { + if (!profiler_memory_running) + return Qnil; + profiler_memory_running = false; + return Qt; + } + + DEFUN ("profiler-memory-running-p", + Fprofiler_memory_running_p, Sprofiler_memory_running_p, + 0, 0, 0, + doc: /* Return non-nil if memory profiler is running. */) + (void) + { + return profiler_memory_running ? Qt : Qnil; + } + + DEFUN ("profiler-memory-log", + Fprofiler_memory_log, Sprofiler_memory_log, + 0, 0, 0, + doc: /* Return the current memory profiler log. + The log is a hash-table mapping backtraces to counters which represent + the amount of memory allocated at those points. Every backtrace is a vector + of functions, where the last few elements may be nil. + Before returning, a new log is allocated for future samples. */) + (void) + { + Lisp_Object result = memory_log; + /* Here we're making the log visible to Elisp , so it's not safe any + more for our use afterwards since we can't rely on its special + pre-allocated keys anymore. So we have to allocate a new one. */ + memory_log = (profiler_memory_running + ? make_log (profiler_log_size, profiler_max_stack_depth) + : Qnil); + return result; + } + + + /* Signals and probes. */ + + /* Record that the current backtrace allocated SIZE bytes. */ + void + malloc_probe (size_t size) + { + eassert (HASH_TABLE_P (memory_log)); + record_backtrace (XHASH_TABLE (memory_log), size); + } + + void + syms_of_profiler (void) + { + DEFVAR_INT ("profiler-max-stack-depth", profiler_max_stack_depth, + doc: /* Number of elements from the call-stack recorded in the log. */); + profiler_max_stack_depth = 16; + DEFVAR_INT ("profiler-log-size", profiler_log_size, + doc: /* Number of distinct call-stacks that can be recorded in a profiler log. + If the log gets full, some of the least-seen call-stacks will be evicted + to make room for new entries. */); + profiler_log_size = 10000; + + #ifdef PROFILER_CPU_SUPPORT + profiler_cpu_running = false; + cpu_log = Qnil; + staticpro (&cpu_log); + defsubr (&Sprofiler_cpu_start); + defsubr (&Sprofiler_cpu_stop); + defsubr (&Sprofiler_cpu_running_p); + defsubr (&Sprofiler_cpu_log); + #endif + profiler_memory_running = false; + memory_log = Qnil; + staticpro (&memory_log); + defsubr (&Sprofiler_memory_start); + defsubr (&Sprofiler_memory_stop); + defsubr (&Sprofiler_memory_running_p); + defsubr (&Sprofiler_memory_log); + } diff --cc src/xdisp.c index 0f02997be22,3bb2dacb531..fa6460d7be2 --- a/src/xdisp.c +++ b/src/xdisp.c @@@ -12964,13 -12968,22 +12966,21 @@@ redisplay_internal (void if (redisplaying_p) return; - /* Record a function that resets redisplaying_p to its old value + /* Record a function that clears redisplaying_p when we leave this function. */ count = SPECPDL_INDEX (); - record_unwind_protect (unwind_redisplay, - Fcons (make_number (redisplaying_p), selected_frame)); - ++redisplaying_p; + record_unwind_protect (unwind_redisplay, selected_frame); + redisplaying_p = 1; specbind (Qinhibit_free_realized_faces, Qnil); + /* Record this function, so it appears on the profiler's backtraces. */ + backtrace.next = backtrace_list; + backtrace.function = &Qautomatic_redisplay; + backtrace.args = &Qautomatic_redisplay; + backtrace.nargs = 0; + backtrace.debug_on_exit = 0; + backtrace_list = &backtrace; + { Lisp_Object tail, frame;