Stefan Monnier [Thu, 6 Dec 2012 20:16:38 +0000 (15:16 -0500)]
* lisp/ses.el: Use advice-add/remove.
(ses--advice-copy-region-as-kill, ses--advice-yank): New functions.
(copy-region-as-kill, yank): Use advice-add.
(ses-unload-function): Use advice-remove.
Jonas Bernoulli [Thu, 6 Dec 2012 20:10:36 +0000 (15:10 -0500)]
* lisp/button.el: Make them work in header-lines.
(button-map): Add bindings for header-line and mode-line use.
(button-get, button-put, button-label): `button' may now be a string.
(button-activate): Don't make it a defsubst.
(button--area-button-p, button--area-button-string): New functions.
(make-text-button): Fix the return value when `beg' was a string.
(push-button): Handle the mode-line case.
Eli Zaretskii [Thu, 6 Dec 2012 18:36:22 +0000 (20:36 +0200)]
Avoid busy-waiting for child processes on Windows. (Bug#13086)
src/w32proc.c (waitpid): Avoid busy-waiting when called with WNOHANG
if the child process is still running. Instead, exit the wait
loop and return zero.
Stefan Monnier [Thu, 6 Dec 2012 17:29:30 +0000 (12:29 -0500)]
* lisp/progmodes/sql.el: Use cl-lib and lexical-binding; various cleanup.
(sql-signum): Remove. Use `cl-signum' instead.
(sql-read-passwd): Remove; use read-passwd instread.
(sql-get-login-ext): Use read-string.
(sql-get-login): Use dolist and pcase.
(sql--completion-table): Rename from sql-try-completion.
Use complete-with-action.
(sql-mode): Don't change abbrev-all-caps globally.
(sql-connect): Don't rely on dynamic scoping for `new-name'.
(sql-postgres-completion-object): Initialize vars in their `let'.
(sql-comint-sybase, sql-comint-sqlite, sql-comint-mysql)
(sql-comint-solid, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase): Use a single append, without setq.
(sql-comint-linter): Same, and unwind-protect the LINTER_MBX var.
Stefan Monnier [Thu, 6 Dec 2012 16:17:11 +0000 (11:17 -0500)]
* lisp/hi-lock.el: Rework the default face and the serialize regexp code.
(hi-lock--auto-select-face-defaults): Remove.
(hi-lock-string-serialize-serial): Remove.
(hi-lock--hashcons-hash): Rename from hi-lock-string-serialize-hash;
make weak.
(hi-lock--hashcons): Rename from hi-lock-string-serialize, return an
equal string.
(hi-lock-set-pattern): Adjust accordingly.
(hi-lock--regexps-at-point): Simplify accordingly.
(hi-lock--auto-select-face-defaults): Remove.
(hi-lock--last-face): New var to replace it.
(hi-lock-read-face-name): Rewrite.
(hi-lock-unface-buffer): Arrange for the face to be the next default.
Paul Eggert [Thu, 6 Dec 2012 07:31:58 +0000 (23:31 -0800)]
Fix a recently-introduced delete-process race condition.
* callproc.c, process.h (record_kill_process):
New function, containing part of the old call_process_kill.
(call_process_kill): Use it.
This does not change call_process_kill's behavior.
* process.c (Fdelete_process): Use record_kill_process to fix a
race condition that could cause Emacs to lose track of a child.
Dmitry Antipov [Thu, 6 Dec 2012 06:23:51 +0000 (10:23 +0400)]
Avoid code duplication between prev_frame and next_frame.
* frame.c (candidate_frame): New function. Add comment.
(prev_frame, next_frame): Use it. Adjust comment.
Katsumi Yamaoka [Thu, 6 Dec 2012 04:28:00 +0000 (04:28 +0000)]
gmm-utils.el (gmm-called-interactively-p): Restore as a macro.
gnus-art.el (article-unsplit-urls)
gnus-bookmark.el (gnus-bookmark-bmenu-list)
gnus-registry.el (gnus-registry-get-article-marks)
message.el (message-goto-body): Use it.
(message-called-interactively-p): Remove.
spam-stat.el (spam-stat-called-interactively-p): New macro.
(spam-stat-score-buffer): Use it.
spam.el: Silence the warnings against BBDB functions when compiling.
gnus-score.el (gnus-score-decode-text-parts):
Use append+mapcar instead of the cl function mapcan.
Katsumi Yamaoka [Thu, 6 Dec 2012 03:30:23 +0000 (03:30 +0000)]
Avoid letf macro use from Gnus
gnus/gmm-utils.el (gmm-flet): Remove.
gnus/gnus-sync.el (gnus-sync-lesync-call): Avoid overriding json-alist-p.
gnus/message.el (message-read-from-minibuffer): Avoid overriding mail-abbrev-in-expansion-header-p.
mail/mailabbrev.el (mail-abbrev-expand-wrapper): Work in minibuffer so as to enable message-read-from-minibuffer to expand mail aliases.
Stefan Monnier [Thu, 6 Dec 2012 01:39:03 +0000 (20:39 -0500)]
* lisp/minibuf-eldef.el (minibuf-eldef-update-minibuffer): Don't mess with
the `intangible' property.
Suggested by Christopher Schmidt <christopher@ch.ristopher.com>
Paul Eggert [Wed, 5 Dec 2012 22:27:56 +0000 (14:27 -0800)]
Fix minor whitespace issues after "." in manual.
Be more systematic about using "@." (not ".") at end of sentence that
ends in a capital letter, and about appending "@:" after non-ends of
sentences that end in a lower case letter followed by "." followed by
whitespace. Omit unnecessary use of "@:" and "@.". Similarly for "?"
and "!". Be more consistent about putting a comma after "i.e." and
"e.g."; this is the typical American style and it's easier to code in
Texinfo.
Paul Eggert [Wed, 5 Dec 2012 18:29:52 +0000 (10:29 -0800)]
Minor call-process cleanups.
* callproc.c (Fcall_process): Do record-unwind-protect on MSDOS
at the same time as other platforms, to simplify analysis.
No need for fd0_volatile since we have synch_process_fd.
Avoid needless emacs_close; arg is always negative.
Sam Steingold [Wed, 5 Dec 2012 18:13:38 +0000 (13:13 -0500)]
* lisp/gnus/gnus.el (gnus-delete-gnus-frame): Extract from `gnus-other-frame'.
(gnus-other-frame): Add `gnus-delete-gnus-frame' to
`gnus-suspend-gnus-hook' in addition to `gnus-exit-gnus-hook'.
Deniz Dogan [Wed, 5 Dec 2012 16:45:37 +0000 (17:45 +0100)]
* lisp/net/rcirc.el (rcirc-urls): Update documentation.
(rcirc-condition-filter): New function.
(rcirc-browse-url, rcirc-markup-urls): Use only URLs before point
and exclude consecutive duplicate URLs.
Chong Yidong [Wed, 5 Dec 2012 07:29:02 +0000 (15:29 +0800)]
Improve url matching in ffap.el.
* ffap.el (ffap-url-regexp): Don't require matching at front of string.
(ffap-url-p): If only a substring matches, return that.
(ffap-url-at-point): Use the return value of ffap-url-p.
(ffap-read-file-or-url, ffap-read-file-or-url-internal)
(find-file-at-point, dired-at-point, dired-at-point-prompter)
(ffap-guess-file-name-at-point): Likewise.
(ffap-replace-file-component): Fix typo.
Chong Yidong [Wed, 5 Dec 2012 06:14:11 +0000 (14:14 +0800)]
Improve completion behavior of info-display-manual.
* lisp/info.el (info-display-manual): Add existing Info buffers, whose
files may not be in Info-directory-list, to the completion.
(info--manual-names): New helper function.
Stefan Monnier [Tue, 4 Dec 2012 21:17:30 +0000 (16:17 -0500)]
* leim/quail/latin-ltx.el: Avoid deprecated chars for \langle and \rangle.
Remove \rightparengtr and \leftparengtr for lack of consensus.
Suggested by Mattias Engdegård <mattiase@bredband.net>.
Jambunathan K [Tue, 4 Dec 2012 21:13:47 +0000 (16:13 -0500)]
* lisp/hi-lock.el (hi-lock-auto-select-face): New user variable.
(hi-lock-auto-select-face-defaults): New buffer local variable.
(hi-lock-read-face-name): Honor `hi-lock-auto-select-face'.
(hi-lock-unface-buffer): Prompt user with useful defaults.
With prefix arg, unhighlight all hi-lock patterns in buffer.
Paul Eggert [Tue, 4 Dec 2012 20:42:29 +0000 (12:42 -0800)]
Include <config.h> uniformly in oldXMenu sources.
* Activate.c, AddPane.c, AddSel.c, ChgPane.c, ChgSel.c, Create.c:
* InsPane.c, InsSel.c, Internal.c, XMakeAssoc.c:
Do not include <config.h>, since XMenuInt.h does that now.
* XLookAssoc.c, XMenuInt.h: Include <config.h>.
This avoids a build failure when configuring on Fedora 17
--with-x-toolkit=no, reported by Dmitry Andropov in
<http://lists.gnu.org/archive/html/emacs-devel/2012-12/msg00078.html>.
Eli Zaretskii [Tue, 4 Dec 2012 18:48:01 +0000 (20:48 +0200)]
Fix another instance of bug #12933 with non-ASCII file names on Windows.
src/fileio.c (file_name_as_directory, directory_file_name) [DOS_NT]:
Encode the file name before passing it to dostounix_filename, in
case it will downcase it (under w32-downcase-file-names).
Paul Eggert [Mon, 3 Dec 2012 21:42:12 +0000 (13:42 -0800)]
Don't let call-process be a zombie factory.
Fixing this bug required some cleanup of the signal-handling code.
As a side effect, this change also fixes a longstanding rare race
condition whereby Emacs could mistakenly kill unrelated processes,
and it fixes a bug where a second C-g does not kill a recalcitrant
synchronous process in GNU/Linux and similar platforms.
The patch should also fix the last vestiges of Bug#9488,
a bug which has mostly been fixed on the trunk by other changes.
* callproc.c, process.h (synch_process_alive, synch_process_death)
(synch_process_termsig, sync_process_retcode):
Remove. All uses removed, to simplify analysis and so that
less consing is done inside critical sections.
* callproc.c (call_process_exited): Remove. All uses replaced
with !synch_process_pid.
* callproc.c (synch_process_pid, synch_process_fd): New static vars.
These take the role of what used to be in unwind-protect arg.
All uses changed.
(block_child_signal, unblock_child_signal):
New functions, to avoid races that could kill innocent-victim processes.
(call_process_kill, call_process_cleanup, Fcall_process): Use them.
(call_process_kill): Record killed processes as deleted, so that
zombies do not clutter up the system. Do this inside a critical
section, to avoid a race that would allow the clutter.
(call_process_cleanup): Fix code so that the second C-g works again
on common platforms such as GNU/Linux.
(Fcall_process): Create the child process in a critical section,
to fix a race condition. If creating an asynchronous process,
record it as deleted so that zombies do not clutter up the system.
Do unwind-protect for WINDOWSNT too, as that's simpler in the
light of these changes. Omit unnecessary call to emacs_close
before failure, as the unwind-protect code does that.
* callproc.c (call_process_cleanup):
* w32proc.c (waitpid): Simplify now that synch_process_alive is gone.
* process.c (record_deleted_pid): New function, containing
code refactored out of Fdelete_process.
(Fdelete_process): Use it.
(process_status_retrieved): Remove. All callers changed to use
child_status_change.
(record_child_status_change): Remove, folding its contents into ...
(handle_child_signal): ... this signal handler. Now, this
function is purely a handler for SIGCHLD, and is not called after
a synchronous waitpid returns; the synchronous code is moved to
wait_for_termination. There is no need to worry about reaping
more than one child now.
* sysdep.c (get_child_status, child_status_changed): New functions.
(wait_for_termination): Now takes int * status and bool
interruptible arguments, too. Do not record child status change;
that's now the caller's responsibility. All callers changed.
Reimplement in terms of get_child_status.
(wait_for_termination_1, interruptible_wait_for_termination):
Remove. All callers changed to use wait_for_termination.
* syswait.h: Include <stdbool.h>, for bool.
(record_child_status_change, interruptible_wait_for_termination):
Remove decls.
(record_deleted_pid, child_status_changed): New decls.
(wait_for_termination): Adjust to API changes noted above.
Agustín Martín [Mon, 3 Dec 2012 17:15:32 +0000 (18:15 +0100)]
ispell.el: Use expanded values of personal dictionary for process restart checks.
(ispell-internal-change-dictionary):
Improve ispell process restart checks by using expanded values for ispell
personal dictionary and for related restart check.
(ispell-start-process):
* Remove apparently redundant code that seems better handled from
(ispell-internal-change-dictionary)
* No longer need to expand ispell personal dictionary, it is already
expanded.
Agustín Martín [Mon, 3 Dec 2012 16:08:23 +0000 (17:08 +0100)]
ispell.el: Fix ispell personal dictionary name expansion.
textmodes/ispell.el (ispell-init-process, ispell-start-process):
Make sure ispell personal dictionary name is expanded after initial
`default-directory' value (Bug#13019).
Dmitry Antipov [Mon, 3 Dec 2012 14:13:06 +0000 (18:13 +0400)]
* lisp.h (modify_region): Rename to...
(modify_region_1): ...new prototype.
* textprop.c (modify_region): Now static. Adjust users.
* insdel.c (modify_region): Rename to...
(modify_region_1): ...new function to work with current buffer.
Adjust comment and users. Use true and false for boolean arg.
Dmitry Antipov [Mon, 3 Dec 2012 08:06:02 +0000 (12:06 +0400)]
* alloc.c (free_save_value): New function.
(safe_alloca_unwind): Use it.
* lisp.h (free_save_value): New prototype.
* editfns.c (save_excursion_save): Use Lisp_Misc_Save_Value.
Add comment.
(save_excursion_restore): Adjust to match saved data structure.
Use free_save_value to offload some work from GC. Drop obsolete
#if 0 code.
Jay Belanger [Mon, 3 Dec 2012 00:54:11 +0000 (18:54 -0600)]
* lisp/calc/calc-forms.el (math-absolute-from-iso-dt)
(math-date-to-iso-dt, math-parse-iso-date-validate)
(math-iso-dt-to-date): New functions.
(math-fd-iso-dt, math-fd-isoyear, math-fd-isoweek)
(math-fd-isoweekday): New variables.
(calc-date-notation, math-parse-standard-date, math-format-date)
(math-format-date-part): Add support for more formatting codes.
Paul Eggert [Sun, 2 Dec 2012 23:11:42 +0000 (15:11 -0800)]
Fix xpalloc confusion after memory is exhausted.
* alloc.c (xpalloc): Comment fix.
* charset.c (Fdefine_charset_internal): If xpalloc exhausts memory
and signals an error, do not clear charset_table_size, as
charset_table is still valid.
* doprnt.c (evxprintf): Clear *BUF after freeing it.
Paul Eggert [Sun, 2 Dec 2012 19:16:45 +0000 (11:16 -0800)]
Use execve to avoid need to munge environ.
* callproc.c (Fcall_process):
* process.c (create_process):
Don't save and restore environ; no longer needed.
* callproc.c (child_setup):
Use execve, not execvp, to preserve environ.
* doc/lispref/lists.texi (Property Lists): Move here from symbols.texi.
(Plist Access): Rename from Other Plists.
* doc/lispref/symbols.texi (Symbol Properties): New node.
(Symbol Plists): Make it a subsection under Symbol Properties.
(Standard Properties): New node.
Kevin Ryde [Sun, 2 Dec 2012 01:47:56 +0000 (09:47 +0800)]
* lib-src/etags.c (Lisp_functions): Skip (defvar foo) declarations
unless the --declarations flag is enabled.
(Lisp_help): Update.
(skip_name): New function.
* doc/emacs/maintaining.texi (Tag Syntax): Mention (defvar foo) handling.
* doc/man/etags.1: Mention effect of --declarations in Lisp.