diff options
| author | Joakim Verona | 2013-01-26 00:03:40 +0100 |
|---|---|---|
| committer | Joakim Verona | 2013-01-26 00:03:40 +0100 |
| commit | 271290a75b0c93d887b591e7082bd1e7daf322ef (patch) | |
| tree | 7a130afd6de80b79ae43885c19dc73e06afe262b | |
| parent | 25520166464418c67a8b4ae9fb7174c949e40d6b (diff) | |
| parent | b7aea0ffb633e0787654d2c570a8a2fa63703f18 (diff) | |
| download | emacs-271290a75b0c93d887b591e7082bd1e7daf322ef.tar.gz emacs-271290a75b0c93d887b591e7082bd1e7daf322ef.zip | |
auto upstream
| -rw-r--r-- | lisp/ChangeLog | 64 | ||||
| -rw-r--r-- | lisp/autorevert.el | 178 | ||||
| -rw-r--r-- | lisp/imenu.el | 2 | ||||
| -rw-r--r-- | lisp/net/socks.el | 2 | ||||
| -rw-r--r-- | lisp/profiler.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 128 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 5 | ||||
| -rw-r--r-- | lisp/xml.el | 2 | ||||
| -rw-r--r-- | src/ChangeLog | 31 | ||||
| -rw-r--r-- | src/coding.c | 29 | ||||
| -rw-r--r-- | src/font.c | 14 | ||||
| -rw-r--r-- | src/insdel.c | 11 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/w32.c | 106 | ||||
| -rw-r--r-- | src/w32heap.c | 6 | ||||
| -rw-r--r-- | src/w32notify.c | 12 | ||||
| -rw-r--r-- | src/xdisp.c | 7 |
17 files changed, 416 insertions, 184 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5efa7810ad2..eb9f254a5a8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,67 @@ | |||
| 1 | 2013-01-25 Alan Mackenzie <acm@muc.de> | ||
| 2 | |||
| 3 | AWK Mode: Fix indentation bug at top level. Bug #12274. | ||
| 4 | |||
| 5 | * progmodes/cc-engine.el (c-guess-basic-syntax): Move CASE 5P to | ||
| 6 | just before CASE 5D. | ||
| 7 | |||
| 8 | 2013-01-25 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 9 | |||
| 10 | * net/socks.el (socks-nslookup-host): Use string-to-number. | ||
| 11 | |||
| 12 | 2013-01-25 Michael Albinus <michael.albinus@gmx.de> | ||
| 13 | |||
| 14 | * autorevert.el (auto-revert-remote-files) | ||
| 15 | (auto-revert-notify-exclude-dir-regexp): New defcustoms. | ||
| 16 | (auto-revert-notify-enabled, auto-revert-use-notify) | ||
| 17 | (auto-revert-notify-watch-descriptor-hash-list) | ||
| 18 | (auto-revert-notify-modified-p, auto-revert-notify-event-p) | ||
| 19 | (auto-revert-notify-event-descriptor) | ||
| 20 | (auto-revert-notify-event-action) | ||
| 21 | (auto-revert-notify-event-file-name): Doc fix. | ||
| 22 | (global-auto-revert-mode): Reorder checks. | ||
| 23 | (auto-revert-notify-rm-watch): Respect changed values of | ||
| 24 | `auto-revert-notify-watch-descriptor-hash-list'. | ||
| 25 | (auto-revert-notify-add-watch): Check for | ||
| 26 | `auto-revert-notify-exclude-dir-regexp'. Adapt filters for | ||
| 27 | `inotify-add-watch'. Watch `default-directory' instead of | ||
| 28 | `buffer-file-name'. `auto-revert-notify-watch-descriptor-hash-list' | ||
| 29 | has a changed meaning now. (Bug#13540) | ||
| 30 | (auto-revert-notify-handler): Change implementation wrt events | ||
| 31 | returning from a directory. | ||
| 32 | (auto-revert-handler): Reorder implementation for checks of remote | ||
| 33 | files. | ||
| 34 | (auto-revert-buffers): Fix parentheses error. | ||
| 35 | |||
| 36 | 2013-01-25 Fabián Ezequiel Gallina <fgallina@cuca> | ||
| 37 | |||
| 38 | * progmodes/python.el: Enhancements to header documentation about | ||
| 39 | skeletons. (Bug#5716) | ||
| 40 | |||
| 41 | * imenu.el (imenu-default-create-index-function): Remove useless | ||
| 42 | infinite loop check. (Bug#13438) | ||
| 43 | |||
| 44 | 2013-01-25 Alan Mackenzie <acm@muc.de> | ||
| 45 | |||
| 46 | Fix a bug in the state cache mechanism. Refactor this a bit. | ||
| 47 | |||
| 48 | * progmodes/cc-engine.el (c-parse-state-get-strategy): Remove the | ||
| 49 | `cache-pos' element from the return value. | ||
| 50 | (c-append-lower-brace-pair-to-state-cache): "Narrow" to end of | ||
| 51 | buffer to enable proper searching from beyond HERE. Amend the | ||
| 52 | test for detecting the sought brace pair. Amend the value written | ||
| 53 | to the "brace desert cache" when the brace isn't found. | ||
| 54 | (c-remove-stale-state-cache): Rename `good-pos' to `start-point', | ||
| 55 | and several other variables analogously. | ||
| 56 | (c-remove-stale-state-cache-backwards): Change `cache-pos' from a | ||
| 57 | parameter to a locally calculated variable. | ||
| 58 | (c-parse-state-1): Change the calling conventions to the two | ||
| 59 | defuns involving `cache-pos'. | ||
| 60 | |||
| 61 | 2013-01-25 Chong Yidong <cyd@gnu.org> | ||
| 62 | |||
| 63 | * xml.el (xml-entity-or-char-ref-re): Fix regexp. | ||
| 64 | |||
| 1 | 2013-01-24 Aaron Ecay <aaronecay@gmail.com> (tiny change) | 65 | 2013-01-24 Aaron Ecay <aaronecay@gmail.com> (tiny change) |
| 2 | 66 | ||
| 3 | * paren.el (show-paren-function): Make sure to set 'priority and | 67 | * paren.el (show-paren-function): Make sure to set 'priority and |
diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 1b5460ff2cf..25a953e1719 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el | |||
| @@ -39,8 +39,11 @@ | |||
| 39 | ;; Auto-Revert Mode applies to all file buffers. (If the user option | 39 | ;; Auto-Revert Mode applies to all file buffers. (If the user option |
| 40 | ;; `global-auto-revert-non-file-buffers' is non-nil, it also applies | 40 | ;; `global-auto-revert-non-file-buffers' is non-nil, it also applies |
| 41 | ;; to some non-file buffers. This option is disabled by default.) | 41 | ;; to some non-file buffers. This option is disabled by default.) |
| 42 | ;; Since checking a remote file is too slow, these modes do not check | 42 | ;; |
| 43 | ;; or revert remote files. | 43 | ;; Since checking a remote file is slow, these modes check or revert |
| 44 | ;; remote files only if the user option `auto-revert-remote-files' is | ||
| 45 | ;; non-nil. It is recommended to disable version control for remote | ||
| 46 | ;; files. | ||
| 44 | ;; | 47 | ;; |
| 45 | ;; Both modes operate by checking the time stamp of all files at | 48 | ;; Both modes operate by checking the time stamp of all files at |
| 46 | ;; intervals of `auto-revert-interval'. The default is every five | 49 | ;; intervals of `auto-revert-interval'. The default is every five |
| @@ -48,10 +51,12 @@ | |||
| 48 | ;; Emacs. You should never even notice that this package is active | 51 | ;; Emacs. You should never even notice that this package is active |
| 49 | ;; (except that your buffers will be reverted, of course). | 52 | ;; (except that your buffers will be reverted, of course). |
| 50 | ;; | 53 | ;; |
| 51 | ;; If Emacs is compiled with file watch support, notifications are | 54 | ;; If Emacs is compiled with file notification support, notifications |
| 52 | ;; used instead of checking the time stamp of the files. You can | 55 | ;; are used instead of checking the time stamp of the files. You can |
| 53 | ;; disable this by setting the user option `auto-revert-use-notify' to | 56 | ;; disable this by setting the user option `auto-revert-use-notify' to |
| 54 | ;; nil. | 57 | ;; nil. Alternatively, a regular expression of directories to be |
| 58 | ;; excluded from file notifications can be specified by | ||
| 59 | ;; `auto-revert-notify-exclude-dir-regexp'. | ||
| 55 | ;; | 60 | ;; |
| 56 | ;; After reverting a file buffer, Auto Revert Mode normally puts point | 61 | ;; After reverting a file buffer, Auto Revert Mode normally puts point |
| 57 | ;; at the same position that a regular manual revert would. However, | 62 | ;; at the same position that a regular manual revert would. However, |
| @@ -70,7 +75,6 @@ | |||
| 70 | ;; change by growing at the end. It only appends the new output, | 75 | ;; change by growing at the end. It only appends the new output, |
| 71 | ;; instead of reverting the entire buffer. It does so even if the | 76 | ;; instead of reverting the entire buffer. It does so even if the |
| 72 | ;; buffer contains unsaved changes. (Because they will not be lost.) | 77 | ;; buffer contains unsaved changes. (Because they will not be lost.) |
| 73 | ;; Auto Revert Tail Mode works also for remote files. | ||
| 74 | 78 | ||
| 75 | ;; Usage: | 79 | ;; Usage: |
| 76 | ;; | 80 | ;; |
| @@ -260,15 +264,21 @@ buffers. CPU usage depends on the version control system." | |||
| 260 | This variable becomes buffer local when set in any fashion.") | 264 | This variable becomes buffer local when set in any fashion.") |
| 261 | (make-variable-buffer-local 'global-auto-revert-ignore-buffer) | 265 | (make-variable-buffer-local 'global-auto-revert-ignore-buffer) |
| 262 | 266 | ||
| 267 | (defcustom auto-revert-remote-files nil | ||
| 268 | "If non-nil remote files are also reverted." | ||
| 269 | :group 'auto-revert | ||
| 270 | :type 'boolean | ||
| 271 | :version "24.4") | ||
| 272 | |||
| 263 | (defconst auto-revert-notify-enabled | 273 | (defconst auto-revert-notify-enabled |
| 264 | (or (featurep 'inotify) (featurep 'w32notify)) | 274 | (or (featurep 'inotify) (featurep 'w32notify)) |
| 265 | "Non-nil when Emacs has been compiled with file watch support.") | 275 | "Non-nil when Emacs has been compiled with file notification support.") |
| 266 | 276 | ||
| 267 | (defcustom auto-revert-use-notify auto-revert-notify-enabled | 277 | (defcustom auto-revert-use-notify auto-revert-notify-enabled |
| 268 | "If non-nil Auto Revert Mode uses file watch functions. | 278 | "If non-nil Auto Revert Mode uses file notification functions. |
| 269 | This requires Emacs being compiled with file watch support (see | 279 | This requires Emacs being compiled with file notification |
| 270 | `auto-revert-notify-enabled'). You should set this variable | 280 | support (see `auto-revert-notify-enabled'). You should set this |
| 271 | through Custom only." | 281 | variable through Custom only." |
| 272 | :group 'auto-revert | 282 | :group 'auto-revert |
| 273 | :type 'boolean | 283 | :type 'boolean |
| 274 | :set (lambda (variable value) | 284 | :set (lambda (variable value) |
| @@ -281,6 +291,17 @@ through Custom only." | |||
| 281 | (auto-revert-notify-rm-watch))))))) | 291 | (auto-revert-notify-rm-watch))))))) |
| 282 | :version "24.4") | 292 | :version "24.4") |
| 283 | 293 | ||
| 294 | (defcustom auto-revert-notify-exclude-dir-regexp | ||
| 295 | (concat | ||
| 296 | ;; No mounted file systems. | ||
| 297 | "^" (regexp-opt '("/afs/" "/media/" "/mnt" "/net/" "/tmp_mnt/")) | ||
| 298 | ;; No remote files. | ||
| 299 | (unless auto-revert-remote-files "\\|^/[^/|:][^/|]+:")) | ||
| 300 | "Regular expression of directories to be excluded from file notifications." | ||
| 301 | :group 'auto-revert | ||
| 302 | :type 'regexp | ||
| 303 | :version "24.4") | ||
| 304 | |||
| 284 | ;; Internal variables: | 305 | ;; Internal variables: |
| 285 | 306 | ||
| 286 | (defvar auto-revert-buffer-list () | 307 | (defvar auto-revert-buffer-list () |
| @@ -306,7 +327,9 @@ the list of old buffers.") | |||
| 306 | (defvar auto-revert-notify-watch-descriptor-hash-list | 327 | (defvar auto-revert-notify-watch-descriptor-hash-list |
| 307 | (make-hash-table :test 'equal) | 328 | (make-hash-table :test 'equal) |
| 308 | "A hash table collecting all file watch descriptors. | 329 | "A hash table collecting all file watch descriptors. |
| 309 | Hash key is a watch descriptor, hash value is the corresponding buffer.") | 330 | Hash key is a watch descriptor, hash value is a list of buffers |
| 331 | which are related to files being watched and carrying the same | ||
| 332 | default directory.") | ||
| 310 | 333 | ||
| 311 | (defvar auto-revert-notify-watch-descriptor nil | 334 | (defvar auto-revert-notify-watch-descriptor nil |
| 312 | "The file watch descriptor active for the current buffer.") | 335 | "The file watch descriptor active for the current buffer.") |
| @@ -315,7 +338,7 @@ Hash key is a watch descriptor, hash value is the corresponding buffer.") | |||
| 315 | 338 | ||
| 316 | (defvar auto-revert-notify-modified-p nil | 339 | (defvar auto-revert-notify-modified-p nil |
| 317 | "Non-nil when file has been modified on the file system. | 340 | "Non-nil when file has been modified on the file system. |
| 318 | This has been reported by a file watch event.") | 341 | This has been reported by a file notification event.") |
| 319 | (make-variable-buffer-local 'auto-revert-notify-modified-p) | 342 | (make-variable-buffer-local 'auto-revert-notify-modified-p) |
| 320 | 343 | ||
| 321 | ;; Functions: | 344 | ;; Functions: |
| @@ -444,9 +467,9 @@ specifies in the mode line." | |||
| 444 | (auto-revert-set-timer) | 467 | (auto-revert-set-timer) |
| 445 | (if global-auto-revert-mode | 468 | (if global-auto-revert-mode |
| 446 | (auto-revert-buffers) | 469 | (auto-revert-buffers) |
| 447 | (when auto-revert-use-notify | 470 | (dolist (buf (buffer-list)) |
| 448 | (dolist (buf (buffer-list)) | 471 | (with-current-buffer buf |
| 449 | (with-current-buffer buf | 472 | (when auto-revert-use-notify |
| 450 | (auto-revert-notify-rm-watch)))))) | 473 | (auto-revert-notify-rm-watch)))))) |
| 451 | 474 | ||
| 452 | (defun auto-revert-set-timer () | 475 | (defun auto-revert-set-timer () |
| @@ -465,85 +488,106 @@ will use an up-to-date value of `auto-revert-interval'" | |||
| 465 | 'auto-revert-buffers)))) | 488 | 'auto-revert-buffers)))) |
| 466 | 489 | ||
| 467 | (defun auto-revert-notify-rm-watch () | 490 | (defun auto-revert-notify-rm-watch () |
| 468 | "Disable file watch for current buffer's associated file." | 491 | "Disable file notification for current buffer's associated file." |
| 469 | (when auto-revert-notify-watch-descriptor | 492 | (when auto-revert-notify-watch-descriptor |
| 470 | (ignore-errors | 493 | (maphash |
| 471 | (funcall (if (fboundp 'inotify-rm-watch) | 494 | (lambda (key value) |
| 472 | 'inotify-rm-watch 'w32notify-rm-watch) | 495 | (when (equal key auto-revert-notify-watch-descriptor) |
| 473 | auto-revert-notify-watch-descriptor)) | 496 | (setq value (delete (current-buffer) value)) |
| 474 | (remhash auto-revert-notify-watch-descriptor | 497 | (if value |
| 475 | auto-revert-notify-watch-descriptor-hash-list) | 498 | (puthash key value auto-revert-notify-watch-descriptor-hash-list) |
| 499 | (remhash key auto-revert-notify-watch-descriptor-hash-list) | ||
| 500 | (ignore-errors | ||
| 501 | (funcall (if (fboundp 'inotify-rm-watch) | ||
| 502 | 'inotify-rm-watch 'w32notify-rm-watch) | ||
| 503 | auto-revert-notify-watch-descriptor))))) | ||
| 504 | auto-revert-notify-watch-descriptor-hash-list) | ||
| 476 | (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)) | 505 | (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)) |
| 477 | (setq auto-revert-notify-watch-descriptor nil | 506 | (setq auto-revert-notify-watch-descriptor nil |
| 478 | auto-revert-notify-modified-p nil)) | 507 | auto-revert-notify-modified-p nil)) |
| 479 | 508 | ||
| 480 | (defun auto-revert-notify-add-watch () | 509 | (defun auto-revert-notify-add-watch () |
| 481 | "Enable file watch for current buffer's associated file." | 510 | "Enable file notification for current buffer's associated file." |
| 511 | (when (string-match auto-revert-notify-exclude-dir-regexp | ||
| 512 | (expand-file-name default-directory)) | ||
| 513 | ;; Fallback to file checks. | ||
| 514 | (set (make-local-variable 'auto-revert-use-notify) nil)) | ||
| 515 | |||
| 482 | (when (and buffer-file-name auto-revert-use-notify | 516 | (when (and buffer-file-name auto-revert-use-notify |
| 483 | (not auto-revert-notify-watch-descriptor)) | 517 | (not auto-revert-notify-watch-descriptor)) |
| 484 | (let ((func (if (fboundp 'inotify-add-watch) | 518 | (let ((func (if (fboundp 'inotify-add-watch) |
| 485 | 'inotify-add-watch 'w32notify-add-watch)) | 519 | 'inotify-add-watch 'w32notify-add-watch)) |
| 486 | (aspect (if (fboundp 'inotify-add-watch) | 520 | (aspect (if (fboundp 'inotify-add-watch) |
| 487 | '(modify) '(size last-write-time)))) | 521 | '(create modify moved-to) '(size last-write-time)))) |
| 488 | (setq auto-revert-notify-watch-descriptor | 522 | (setq auto-revert-notify-watch-descriptor |
| 489 | (ignore-errors | 523 | (ignore-errors |
| 490 | (funcall | 524 | (funcall |
| 491 | func buffer-file-name aspect 'auto-revert-notify-handler))) | 525 | func (directory-file-name (expand-file-name default-directory)) |
| 526 | aspect 'auto-revert-notify-handler))) | ||
| 492 | (if auto-revert-notify-watch-descriptor | 527 | (if auto-revert-notify-watch-descriptor |
| 493 | (progn | 528 | (progn |
| 494 | (puthash auto-revert-notify-watch-descriptor | 529 | (puthash |
| 495 | (current-buffer) | 530 | auto-revert-notify-watch-descriptor |
| 496 | auto-revert-notify-watch-descriptor-hash-list) | 531 | (cons (current-buffer) |
| 532 | (gethash auto-revert-notify-watch-descriptor | ||
| 533 | auto-revert-notify-watch-descriptor-hash-list)) | ||
| 534 | auto-revert-notify-watch-descriptor-hash-list) | ||
| 497 | (add-hook (make-local-variable 'kill-buffer-hook) | 535 | (add-hook (make-local-variable 'kill-buffer-hook) |
| 498 | 'auto-revert-notify-rm-watch)) | 536 | 'auto-revert-notify-rm-watch)) |
| 499 | ;; Fallback to file checks. | 537 | ;; Fallback to file checks. |
| 500 | (set (make-local-variable 'auto-revert-use-notify) nil))))) | 538 | (set (make-local-variable 'auto-revert-use-notify) nil))))) |
| 501 | 539 | ||
| 502 | (defun auto-revert-notify-event-p (event) | 540 | (defun auto-revert-notify-event-p (event) |
| 503 | "Check that event is a file watch event." | 541 | "Check that event is a file notification event." |
| 504 | (cond ((featurep 'inotify) | 542 | (cond ((featurep 'inotify) |
| 505 | (and (listp event) (= (length event) 4))) | 543 | (and (listp event) (= (length event) 4))) |
| 506 | ((featurep 'w32notify) | 544 | ((featurep 'w32notify) |
| 507 | (and (listp event) (= (length event) 3) (stringp (nth 2 event)))))) | 545 | (and (listp event) (= (length event) 3) (stringp (nth 2 event)))))) |
| 508 | 546 | ||
| 509 | (defun auto-revert-notify-event-descriptor (event) | 547 | (defun auto-revert-notify-event-descriptor (event) |
| 510 | "Return watch descriptor of notification event, or nil." | 548 | "Return watch descriptor of file notification event, or nil." |
| 511 | (and (auto-revert-notify-event-p event) (car event))) | 549 | (and (auto-revert-notify-event-p event) (car event))) |
| 512 | 550 | ||
| 513 | (defun auto-revert-notify-event-action (event) | 551 | (defun auto-revert-notify-event-action (event) |
| 514 | "Return action of notification event, or nil." | 552 | "Return action of file notification event, or nil." |
| 515 | (and (auto-revert-notify-event-p event) (nth 1 event))) | 553 | (and (auto-revert-notify-event-p event) (nth 1 event))) |
| 516 | 554 | ||
| 517 | (defun auto-revert-notify-event-file-name (event) | 555 | (defun auto-revert-notify-event-file-name (event) |
| 518 | "Return file name of notification event, or nil." | 556 | "Return file name of file notification event, or nil." |
| 519 | (and (auto-revert-notify-event-p event) | 557 | (and (auto-revert-notify-event-p event) |
| 520 | (cond ((featurep 'inotify) (nth 3 event)) | 558 | (cond ((featurep 'inotify) (nth 3 event)) |
| 521 | ((featurep 'w32notify) (nth 2 event))))) | 559 | ((featurep 'w32notify) (nth 2 event))))) |
| 522 | 560 | ||
| 523 | (defun auto-revert-notify-handler (event) | 561 | (defun auto-revert-notify-handler (event) |
| 524 | "Handle an event returned from file watch." | 562 | "Handle an event returned from file notification." |
| 525 | (when (auto-revert-notify-event-p event) | 563 | (when (auto-revert-notify-event-p event) |
| 526 | (let* ((descriptor (auto-revert-notify-event-descriptor event)) | 564 | (let* ((descriptor (auto-revert-notify-event-descriptor event)) |
| 527 | (action (auto-revert-notify-event-action event)) | 565 | (action (auto-revert-notify-event-action event)) |
| 528 | (file (auto-revert-notify-event-file-name event)) | 566 | (file (auto-revert-notify-event-file-name event)) |
| 529 | (buffer (gethash descriptor | 567 | (buffers (gethash descriptor |
| 530 | auto-revert-notify-watch-descriptor-hash-list))) | 568 | auto-revert-notify-watch-descriptor-hash-list))) |
| 531 | (ignore-errors | 569 | (ignore-errors |
| 532 | ;; Check, that event is meant for us. | 570 | ;; Check, that event is meant for us. |
| 533 | ;; TODO: Filter events which stop watching, like `move' or `removed'. | 571 | ;; TODO: Filter events which stop watching, like `move' or `removed'. |
| 534 | (cl-assert descriptor) | 572 | (cl-assert descriptor) |
| 535 | (when (featurep 'inotify) (cl-assert (memq 'modify action))) | 573 | (when (featurep 'inotify) |
| 574 | (cl-assert (or (memq 'create action) | ||
| 575 | (memq 'modify action) | ||
| 576 | (memq 'moved-to action)))) | ||
| 536 | (when (featurep 'w32notify) (cl-assert (eq 'modified action))) | 577 | (when (featurep 'w32notify) (cl-assert (eq 'modified action))) |
| 537 | (cl-assert (bufferp buffer)) | 578 | ;; Since we watch a directory, a file name must be returned. |
| 538 | (with-current-buffer buffer | 579 | (cl-assert (stringp file)) |
| 539 | (when (and (stringp file) (stringp buffer-file-name)) | 580 | (dolist (buffer buffers) |
| 540 | ;; w32notify returns the basename of the file without its | 581 | (when (buffer-live-p buffer) |
| 541 | ;; leading directories; inotify returns its full absolute | 582 | (with-current-buffer buffer |
| 542 | ;; file name. | 583 | (when (and (stringp buffer-file-name) |
| 543 | (cl-assert (file-equal-p file buffer-file-name))) | 584 | (string-equal |
| 544 | 585 | (file-name-nondirectory file) | |
| 545 | ;; Mark buffer modified. | 586 | (file-name-nondirectory buffer-file-name))) |
| 546 | (setq auto-revert-notify-modified-p t)))))) | 587 | ;; Mark buffer modified. |
| 588 | (setq auto-revert-notify-modified-p t) | ||
| 589 | ;; No need to check other buffers. | ||
| 590 | (cl-return))))))))) | ||
| 547 | 591 | ||
| 548 | (defun auto-revert-active-p () | 592 | (defun auto-revert-active-p () |
| 549 | "Check if auto-revert is active (in current buffer or globally)." | 593 | "Check if auto-revert is active (in current buffer or globally)." |
| @@ -560,23 +604,29 @@ will use an up-to-date value of `auto-revert-interval'" | |||
| 560 | This is an internal function used by Auto-Revert Mode." | 604 | This is an internal function used by Auto-Revert Mode." |
| 561 | (when (or auto-revert-tail-mode (not (buffer-modified-p))) | 605 | (when (or auto-revert-tail-mode (not (buffer-modified-p))) |
| 562 | (let* ((buffer (current-buffer)) size | 606 | (let* ((buffer (current-buffer)) size |
| 607 | ;; Tramp caches the file attributes. Setting | ||
| 608 | ;; `remote-file-name-inhibit-cache' forces Tramp to reread | ||
| 609 | ;; the values. | ||
| 610 | (remote-file-name-inhibit-cache t) | ||
| 563 | (revert | 611 | (revert |
| 564 | (or (and buffer-file-name | 612 | (or (and buffer-file-name |
| 565 | (or (not auto-revert-use-notify) | 613 | (or auto-revert-remote-files |
| 566 | auto-revert-notify-modified-p) | 614 | (not (file-remote-p buffer-file-name))) |
| 567 | (if auto-revert-tail-mode | 615 | (if auto-revert-tail-mode |
| 568 | ;; Tramp caches the file attributes. Setting | 616 | (and (or (not auto-revert-use-notify) |
| 569 | ;; `remote-file-name-inhibit-cache' forces Tramp | 617 | auto-revert-notify-modified-p) |
| 570 | ;; to reread the values. | 618 | (file-readable-p buffer-file-name) |
| 571 | (let ((remote-file-name-inhibit-cache t)) | 619 | (/= auto-revert-tail-pos |
| 572 | (and (file-readable-p buffer-file-name) | 620 | (setq size |
| 573 | (/= auto-revert-tail-pos | 621 | (nth 7 (file-attributes |
| 574 | (setq size | 622 | buffer-file-name))))) |
| 575 | (nth 7 (file-attributes | 623 | ;; When `auto-revert-use-notify' is set, we do |
| 576 | buffer-file-name)))))) | 624 | ;; not apply further checks for performance |
| 577 | (and (not (file-remote-p buffer-file-name)) | 625 | ;; reasons. |
| 578 | (file-readable-p buffer-file-name) | 626 | (if auto-revert-use-notify |
| 579 | (not (verify-visited-file-modtime buffer))))) | 627 | auto-revert-notify-modified-p |
| 628 | (and (file-readable-p buffer-file-name) | ||
| 629 | (not (verify-visited-file-modtime buffer)))))) | ||
| 580 | (and (or auto-revert-mode | 630 | (and (or auto-revert-mode |
| 581 | global-auto-revert-non-file-buffers) | 631 | global-auto-revert-non-file-buffers) |
| 582 | revert-buffer-function | 632 | revert-buffer-function |
| @@ -692,10 +742,10 @@ the timer when no buffers need to be checked." | |||
| 692 | (setq auto-revert-buffer-list | 742 | (setq auto-revert-buffer-list |
| 693 | (delq buf auto-revert-buffer-list))) | 743 | (delq buf auto-revert-buffer-list))) |
| 694 | (when (auto-revert-active-p) | 744 | (when (auto-revert-active-p) |
| 695 | ;; Enable file watches. | 745 | ;; Enable file notification. |
| 696 | (when (and auto-revert-use-notify buffer-file-name | 746 | (when (and auto-revert-use-notify buffer-file-name |
| 697 | (not auto-revert-notify-watch-descriptor) | 747 | (not auto-revert-notify-watch-descriptor)) |
| 698 | (auto-revert-notify-add-watch))) | 748 | (auto-revert-notify-add-watch)) |
| 699 | (auto-revert-handler))) | 749 | (auto-revert-handler))) |
| 700 | ;; Remove dead buffer from `auto-revert-buffer-list'. | 750 | ;; Remove dead buffer from `auto-revert-buffer-list'. |
| 701 | (setq auto-revert-buffer-list | 751 | (setq auto-revert-buffer-list |
diff --git a/lisp/imenu.el b/lisp/imenu.el index f64d1afe951..ba0275099a1 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el | |||
| @@ -683,8 +683,6 @@ The alternate method, which is the one most often used, is to call | |||
| 683 | (goto-char (point-max)) | 683 | (goto-char (point-max)) |
| 684 | ;; Search for the function | 684 | ;; Search for the function |
| 685 | (while (funcall imenu-prev-index-position-function) | 685 | (while (funcall imenu-prev-index-position-function) |
| 686 | (when (= pos (point)) | ||
| 687 | (error "Infinite loop at %s:%d: imenu-prev-index-position-function does not move point" (buffer-name) pos)) | ||
| 688 | (setq pos (point)) | 686 | (setq pos (point)) |
| 689 | (save-excursion | 687 | (save-excursion |
| 690 | (setq name (funcall imenu-extract-index-name-function))) | 688 | (setq name (funcall imenu-extract-index-name-function))) |
diff --git a/lisp/net/socks.el b/lisp/net/socks.el index 75b0ebe55ff..415397c4171 100644 --- a/lisp/net/socks.el +++ b/lisp/net/socks.el | |||
| @@ -648,7 +648,7 @@ version.") | |||
| 648 | (progn | 648 | (progn |
| 649 | (setq res (buffer-substring (match-beginning 2) | 649 | (setq res (buffer-substring (match-beginning 2) |
| 650 | (match-end 2)) | 650 | (match-end 2)) |
| 651 | res (mapcar 'string-to-int (split-string res "\\."))))) | 651 | res (mapcar 'string-to-number (split-string res "\\."))))) |
| 652 | (kill-buffer (current-buffer))) | 652 | (kill-buffer (current-buffer))) |
| 653 | res) | 653 | res) |
| 654 | host)) | 654 | host)) |
diff --git a/lisp/profiler.el b/lisp/profiler.el index 9c73fc6e590..73b751c3fcd 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | ;;; Commentary: | 21 | ;;; Commentary: |
| 22 | 22 | ||
| 23 | ;; | 23 | ;; See Info node `(elisp)Profiling'. |
| 24 | 24 | ||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | 26 | ||
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 560b66bf3b0..d4e4d6de483 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -2545,14 +2545,12 @@ comment at the start of cc-engine.el for more info." | |||
| 2545 | ;; | 2545 | ;; |
| 2546 | ;; The return value is a list, one of the following: | 2546 | ;; The return value is a list, one of the following: |
| 2547 | ;; | 2547 | ;; |
| 2548 | ;; o - ('forward CACHE-POS START-POINT) - scan forward from START-POINT, | 2548 | ;; o - ('forward START-POINT) - scan forward from START-POINT, |
| 2549 | ;; which is not less than CACHE-POS. | 2549 | ;; which is not less than the highest position in `c-state-cache' below here. |
| 2550 | ;; o - ('backward CACHE-POS nil) - scan backwards (from HERE). | 2550 | ;; o - ('backward nil) - scan backwards (from HERE). |
| 2551 | ;; o - ('BOD nil START-POINT) - scan forwards from START-POINT, which is at the | 2551 | ;; o - ('BOD START-POINT) - scan forwards from START-POINT, which is at the |
| 2552 | ;; top level. | 2552 | ;; top level. |
| 2553 | ;; o - ('IN-LIT nil nil) - point is inside the literal containing point-min. | 2553 | ;; o - ('IN-LIT nil) - point is inside the literal containing point-min. |
| 2554 | ;; , where CACHE-POS is the highest position recorded in `c-state-cache' at | ||
| 2555 | ;; or below HERE. | ||
| 2556 | (let ((cache-pos (c-get-cache-scan-pos here)) ; highest position below HERE in cache (or 1) | 2554 | (let ((cache-pos (c-get-cache-scan-pos here)) ; highest position below HERE in cache (or 1) |
| 2557 | BOD-pos ; position of 2nd BOD before HERE. | 2555 | BOD-pos ; position of 2nd BOD before HERE. |
| 2558 | strategy ; 'forward, 'backward, 'BOD, or 'IN-LIT. | 2556 | strategy ; 'forward, 'backward, 'BOD, or 'IN-LIT. |
| @@ -2590,7 +2588,6 @@ comment at the start of cc-engine.el for more info." | |||
| 2590 | 2588 | ||
| 2591 | (list | 2589 | (list |
| 2592 | strategy | 2590 | strategy |
| 2593 | (and (memq strategy '(forward backward)) cache-pos) | ||
| 2594 | (and (memq strategy '(forward BOD)) start-point)))) | 2591 | (and (memq strategy '(forward BOD)) start-point)))) |
| 2595 | 2592 | ||
| 2596 | 2593 | ||
| @@ -2657,7 +2654,8 @@ comment at the start of cc-engine.el for more info." | |||
| 2657 | ;; reduce the time wasted in repeated fruitless searches in brace deserts. | 2654 | ;; reduce the time wasted in repeated fruitless searches in brace deserts. |
| 2658 | (save-excursion | 2655 | (save-excursion |
| 2659 | (save-restriction | 2656 | (save-restriction |
| 2660 | (let* (new-cons | 2657 | (let* ((here (point-max)) |
| 2658 | new-cons | ||
| 2661 | (cache-pos (c-state-cache-top-lparen)) ; might be nil. | 2659 | (cache-pos (c-state-cache-top-lparen)) ; might be nil. |
| 2662 | (macro-start-or-from | 2660 | (macro-start-or-from |
| 2663 | (progn (goto-char from) | 2661 | (progn (goto-char from) |
| @@ -2692,6 +2690,7 @@ comment at the start of cc-engine.el for more info." | |||
| 2692 | ;; search bound, even though the algorithm below would skip | 2690 | ;; search bound, even though the algorithm below would skip |
| 2693 | ;; over the new paren pair. | 2691 | ;; over the new paren pair. |
| 2694 | (cache-lim (and cache-pos (< cache-pos from) cache-pos))) | 2692 | (cache-lim (and cache-pos (< cache-pos from) cache-pos))) |
| 2693 | (widen) | ||
| 2695 | (narrow-to-region | 2694 | (narrow-to-region |
| 2696 | (cond | 2695 | (cond |
| 2697 | ((and desert-lim cache-lim) | 2696 | ((and desert-lim cache-lim) |
| @@ -2711,16 +2710,18 @@ comment at the start of cc-engine.el for more info." | |||
| 2711 | (while | 2710 | (while |
| 2712 | (and (setq ce (scan-lists bra -1 -1)) ; back past )/]/}; might signal | 2711 | (and (setq ce (scan-lists bra -1 -1)) ; back past )/]/}; might signal |
| 2713 | (setq bra (scan-lists ce -1 1)) ; back past (/[/{; might signal | 2712 | (setq bra (scan-lists ce -1 1)) ; back past (/[/{; might signal |
| 2714 | (or (> ce upper-lim) | 2713 | (or (> bra here) ;(> ce here) |
| 2715 | (not (eq (char-after bra) ?\{)) | 2714 | (and |
| 2716 | (and (goto-char bra) | 2715 | (< ce here) |
| 2717 | (c-beginning-of-macro) | 2716 | (or (not (eq (char-after bra) ?\{)) |
| 2718 | (< (point) macro-start-or-from)))))) | 2717 | (and (goto-char bra) |
| 2718 | (c-beginning-of-macro) | ||
| 2719 | (< (point) macro-start-or-from)))))))) | ||
| 2719 | (and ce (< ce bra))) | 2720 | (and ce (< ce bra))) |
| 2720 | (setq bra ce)) ; If we just backed over an unbalanced closing | 2721 | (setq bra ce)) ; If we just backed over an unbalanced closing |
| 2721 | ; brace, ignore it. | 2722 | ; brace, ignore it. |
| 2722 | 2723 | ||
| 2723 | (if (and ce (< bra ce) (eq (char-after bra) ?\{)) | 2724 | (if (and ce (< ce here) (< bra ce) (eq (char-after bra) ?\{)) |
| 2724 | ;; We've found the desired brace-pair. | 2725 | ;; We've found the desired brace-pair. |
| 2725 | (progn | 2726 | (progn |
| 2726 | (setq new-cons (cons bra (1+ ce))) | 2727 | (setq new-cons (cons bra (1+ ce))) |
| @@ -2734,7 +2735,11 @@ comment at the start of cc-engine.el for more info." | |||
| 2734 | (t (setq c-state-cache (cons new-cons c-state-cache))))) | 2735 | (t (setq c-state-cache (cons new-cons c-state-cache))))) |
| 2735 | 2736 | ||
| 2736 | ;; We haven't found a brace pair. Record this in the cache. | 2737 | ;; We haven't found a brace pair. Record this in the cache. |
| 2737 | (setq c-state-brace-pair-desert (cons cache-pos from)))))))) | 2738 | (setq c-state-brace-pair-desert |
| 2739 | (cons (if (and ce (< bra ce) (> ce here)) ; {..} straddling HERE? | ||
| 2740 | bra | ||
| 2741 | (point-min)) | ||
| 2742 | (min here from))))))))) | ||
| 2738 | 2743 | ||
| 2739 | (defsubst c-state-push-any-brace-pair (bra+1 macro-start-or-here) | 2744 | (defsubst c-state-push-any-brace-pair (bra+1 macro-start-or-here) |
| 2740 | ;; If BRA+1 is nil, do nothing. Otherwise, BRA+1 is the buffer position | 2745 | ;; If BRA+1 is nil, do nothing. Otherwise, BRA+1 is the buffer position |
| @@ -2852,19 +2857,19 @@ comment at the start of cc-engine.el for more info." | |||
| 2852 | (paren+1) | 2857 | (paren+1) |
| 2853 | (t from))))) | 2858 | (t from))))) |
| 2854 | 2859 | ||
| 2855 | (defun c-remove-stale-state-cache (good-pos pps-point) | 2860 | (defun c-remove-stale-state-cache (start-point pps-point) |
| 2856 | ;; Remove stale entries from the `c-cache-state', i.e. those which will | 2861 | ;; Remove stale entries from the `c-cache-state', i.e. those which will |
| 2857 | ;; not be in it when it is amended for position (point-max). | 2862 | ;; not be in it when it is amended for position (point-max). |
| 2858 | ;; Additionally, the "outermost" open-brace entry before (point-max) | 2863 | ;; Additionally, the "outermost" open-brace entry before (point-max) |
| 2859 | ;; will be converted to a cons if the matching close-brace is scanned. | 2864 | ;; will be converted to a cons if the matching close-brace is scanned. |
| 2860 | ;; | 2865 | ;; |
| 2861 | ;; GOOD-POS is a "maximal" "safe position" - there must be no open | 2866 | ;; START-POINT is a "maximal" "safe position" - there must be no open |
| 2862 | ;; parens/braces/brackets between GOOD-POS and (point-max). | 2867 | ;; parens/braces/brackets between START-POINT and (point-max). |
| 2863 | ;; | 2868 | ;; |
| 2864 | ;; As a second thing, calculate the result of parse-partial-sexp at | 2869 | ;; As a second thing, calculate the result of parse-partial-sexp at |
| 2865 | ;; PPS-POINT, w.r.t. GOOD-POS. The motivation here is that | 2870 | ;; PPS-POINT, w.r.t. START-POINT. The motivation here is that |
| 2866 | ;; `c-state-cache-good-pos' may become PPS-POINT, but the caller may need to | 2871 | ;; `c-state-cache-good-pos' may become PPS-POINT, but the caller may need to |
| 2867 | ;; adjust it to get outside a string/comment. (Sorry about this! The code | 2872 | ;; adjust it to get outside a string/comment. (Sorry about this! The code |
| 2868 | ;; needs to be FAST). | 2873 | ;; needs to be FAST). |
| 2869 | ;; | 2874 | ;; |
| 2870 | ;; Return a list (GOOD-POS SCAN-BACK-POS PPS-STATE), where | 2875 | ;; Return a list (GOOD-POS SCAN-BACK-POS PPS-STATE), where |
| @@ -2872,7 +2877,9 @@ comment at the start of cc-engine.el for more info." | |||
| 2872 | ;; to be good (we aim for this to be as high as possible); | 2877 | ;; to be good (we aim for this to be as high as possible); |
| 2873 | ;; o - SCAN-BACK-POS, if not nil, indicates there may be a brace pair | 2878 | ;; o - SCAN-BACK-POS, if not nil, indicates there may be a brace pair |
| 2874 | ;; preceding POS which needs to be recorded in `c-state-cache'. It is a | 2879 | ;; preceding POS which needs to be recorded in `c-state-cache'. It is a |
| 2875 | ;; position to scan backwards from. | 2880 | ;; position to scan backwards from. It is the position of the "{" of the |
| 2881 | ;; last element to be removed from `c-state-cache', when that elt is a | ||
| 2882 | ;; cons, otherwise nil. | ||
| 2876 | ;; o - PPS-STATE is the parse-partial-sexp state at PPS-POINT. | 2883 | ;; o - PPS-STATE is the parse-partial-sexp state at PPS-POINT. |
| 2877 | (save-restriction | 2884 | (save-restriction |
| 2878 | (narrow-to-region 1 (point-max)) | 2885 | (narrow-to-region 1 (point-max)) |
| @@ -2882,21 +2889,21 @@ comment at the start of cc-engine.el for more info." | |||
| 2882 | (goto-char (point-max)) | 2889 | (goto-char (point-max)) |
| 2883 | (and (c-beginning-of-macro) | 2890 | (and (c-beginning-of-macro) |
| 2884 | (point)))) | 2891 | (point)))) |
| 2885 | (good-pos-actual-macro-start ; Start of macro containing good-pos | 2892 | (start-point-actual-macro-start ; Start of macro containing |
| 2886 | ; or nil | 2893 | ; start-point or nil |
| 2887 | (and (< good-pos (point-max)) | 2894 | (and (< start-point (point-max)) |
| 2888 | (save-excursion | 2895 | (save-excursion |
| 2889 | (goto-char good-pos) | 2896 | (goto-char start-point) |
| 2890 | (and (c-beginning-of-macro) | 2897 | (and (c-beginning-of-macro) |
| 2891 | (point))))) | 2898 | (point))))) |
| 2892 | (good-pos-actual-macro-end ; End of this macro, (maybe | 2899 | (start-point-actual-macro-end ; End of this macro, (maybe |
| 2893 | ; (point-max)), or nil. | 2900 | ; (point-max)), or nil. |
| 2894 | (and good-pos-actual-macro-start | 2901 | (and start-point-actual-macro-start |
| 2895 | (save-excursion | 2902 | (save-excursion |
| 2896 | (goto-char good-pos-actual-macro-start) | 2903 | (goto-char start-point-actual-macro-start) |
| 2897 | (c-end-of-macro) | 2904 | (c-end-of-macro) |
| 2898 | (point)))) | 2905 | (point)))) |
| 2899 | pps-state ; Will be 9 or 10 elements long. | 2906 | pps-state ; Will be 9 or 10 elements long. |
| 2900 | pos | 2907 | pos |
| 2901 | upper-lim ; ,beyond which `c-state-cache' entries are removed | 2908 | upper-lim ; ,beyond which `c-state-cache' entries are removed |
| 2902 | scan-back-pos | 2909 | scan-back-pos |
| @@ -2926,15 +2933,15 @@ comment at the start of cc-engine.el for more info." | |||
| 2926 | ;; The next loop jumps forward out of a nested level of parens each | 2933 | ;; The next loop jumps forward out of a nested level of parens each |
| 2927 | ;; time round; the corresponding elements in `c-state-cache' are | 2934 | ;; time round; the corresponding elements in `c-state-cache' are |
| 2928 | ;; removed. `pos' is just after the brace-pair or the open paren at | 2935 | ;; removed. `pos' is just after the brace-pair or the open paren at |
| 2929 | ;; (car c-state-cache). There can be no open parens/braces/brackets | 2936 | ;; (car c-state-cache). There can be no open parens/braces/brackets |
| 2930 | ;; between `good-pos'/`good-pos-actual-macro-start' and (point-max), | 2937 | ;; between `start-point'/`start-point-actual-macro-start' and (point-max), |
| 2931 | ;; due to the interface spec to this function. | 2938 | ;; due to the interface spec to this function. |
| 2932 | (setq pos (if (and good-pos-actual-macro-end | 2939 | (setq pos (if (and start-point-actual-macro-end |
| 2933 | (not (eq good-pos-actual-macro-start | 2940 | (not (eq start-point-actual-macro-start |
| 2934 | in-macro-start))) | 2941 | in-macro-start))) |
| 2935 | (1+ good-pos-actual-macro-end) ; get outside the macro as | 2942 | (1+ start-point-actual-macro-end) ; get outside the macro as |
| 2936 | ; marked by a `category' text property. | 2943 | ; marked by a `category' text property. |
| 2937 | good-pos)) | 2944 | start-point)) |
| 2938 | (goto-char pos) | 2945 | (goto-char pos) |
| 2939 | (while (and c-state-cache | 2946 | (while (and c-state-cache |
| 2940 | (< (point) (point-max))) | 2947 | (< (point) (point-max))) |
| @@ -2993,14 +3000,14 @@ comment at the start of cc-engine.el for more info." | |||
| 2993 | 3000 | ||
| 2994 | (list pos scan-back-pos pps-state))))) | 3001 | (list pos scan-back-pos pps-state))))) |
| 2995 | 3002 | ||
| 2996 | (defun c-remove-stale-state-cache-backwards (here cache-pos) | 3003 | (defun c-remove-stale-state-cache-backwards (here) |
| 2997 | ;; Strip stale elements of `c-state-cache' by moving backwards through the | 3004 | ;; Strip stale elements of `c-state-cache' by moving backwards through the |
| 2998 | ;; buffer, and inform the caller of the scenario detected. | 3005 | ;; buffer, and inform the caller of the scenario detected. |
| 2999 | ;; | 3006 | ;; |
| 3000 | ;; HERE is the position we're setting `c-state-cache' for. | 3007 | ;; HERE is the position we're setting `c-state-cache' for. |
| 3001 | ;; CACHE-POS is just after the latest recorded position in `c-state-cache' | 3008 | ;; CACHE-POS (a locally bound variable) is just after the latest recorded |
| 3002 | ;; before HERE, or a position at or near point-min which isn't in a | 3009 | ;; position in `c-state-cache' before HERE, or a position at or near |
| 3003 | ;; literal. | 3010 | ;; point-min which isn't in a literal. |
| 3004 | ;; | 3011 | ;; |
| 3005 | ;; This function must only be called only when (> `c-state-cache-good-pos' | 3012 | ;; This function must only be called only when (> `c-state-cache-good-pos' |
| 3006 | ;; HERE). Usually the gap between CACHE-POS and HERE is large. It is thus | 3013 | ;; HERE). Usually the gap between CACHE-POS and HERE is large. It is thus |
| @@ -3023,10 +3030,11 @@ comment at the start of cc-engine.el for more info." | |||
| 3023 | ;; The comments in this defun use "paren" to mean parenthesis or square | 3030 | ;; The comments in this defun use "paren" to mean parenthesis or square |
| 3024 | ;; bracket (as contrasted with a brace), and "(" and ")" likewise. | 3031 | ;; bracket (as contrasted with a brace), and "(" and ")" likewise. |
| 3025 | ;; | 3032 | ;; |
| 3026 | ;; . {..} (..) (..) ( .. { } ) (...) ( .... . ..) | 3033 | ;; . {..} (..) (..) ( .. { } ) (...) ( .... . ..) |
| 3027 | ;; | | | | | | | 3034 | ;; | | | | | | |
| 3028 | ;; CP E here D C good | 3035 | ;; CP E here D C good |
| 3029 | (let ((pos c-state-cache-good-pos) | 3036 | (let ((cache-pos (c-get-cache-scan-pos here)) ; highest position below HERE in cache (or 1) |
| 3037 | (pos c-state-cache-good-pos) | ||
| 3030 | pa ren ; positions of "(" and ")" | 3038 | pa ren ; positions of "(" and ")" |
| 3031 | dropped-cons ; whether the last element dropped from `c-state-cache' | 3039 | dropped-cons ; whether the last element dropped from `c-state-cache' |
| 3032 | ; was a cons (representing a brace-pair) | 3040 | ; was a cons (representing a brace-pair) |
| @@ -3263,7 +3271,8 @@ comment at the start of cc-engine.el for more info." | |||
| 3263 | cache-pos ; highest position below HERE already existing in | 3271 | cache-pos ; highest position below HERE already existing in |
| 3264 | ; cache (or 1). | 3272 | ; cache (or 1). |
| 3265 | good-pos | 3273 | good-pos |
| 3266 | start-point | 3274 | start-point ; (when scanning forward) a place below HERE where there |
| 3275 | ; are no open parens/braces between it and HERE. | ||
| 3267 | bopl-state | 3276 | bopl-state |
| 3268 | res | 3277 | res |
| 3269 | scan-backward-pos scan-forward-p) ; used for 'backward. | 3278 | scan-backward-pos scan-forward-p) ; used for 'backward. |
| @@ -3274,8 +3283,7 @@ comment at the start of cc-engine.el for more info." | |||
| 3274 | ;; Strategy? | 3283 | ;; Strategy? |
| 3275 | (setq res (c-parse-state-get-strategy here c-state-cache-good-pos) | 3284 | (setq res (c-parse-state-get-strategy here c-state-cache-good-pos) |
| 3276 | strategy (car res) | 3285 | strategy (car res) |
| 3277 | cache-pos (cadr res) | 3286 | start-point (cadr res)) |
| 3278 | start-point (nth 2 res)) | ||
| 3279 | 3287 | ||
| 3280 | (when (eq strategy 'BOD) | 3288 | (when (eq strategy 'BOD) |
| 3281 | (setq c-state-cache nil | 3289 | (setq c-state-cache nil |
| @@ -3302,7 +3310,7 @@ comment at the start of cc-engine.el for more info." | |||
| 3302 | good-pos))) | 3310 | good-pos))) |
| 3303 | 3311 | ||
| 3304 | ((eq strategy 'backward) | 3312 | ((eq strategy 'backward) |
| 3305 | (setq res (c-remove-stale-state-cache-backwards here cache-pos) | 3313 | (setq res (c-remove-stale-state-cache-backwards here) |
| 3306 | good-pos (car res) | 3314 | good-pos (car res) |
| 3307 | scan-backward-pos (cadr res) | 3315 | scan-backward-pos (cadr res) |
| 3308 | scan-forward-p (car (cddr res))) | 3316 | scan-forward-p (car (cddr res))) |
| @@ -9834,6 +9842,18 @@ comment at the start of cc-engine.el for more info." | |||
| 9834 | ;; contains any class offset | 9842 | ;; contains any class offset |
| 9835 | ))) | 9843 | ))) |
| 9836 | 9844 | ||
| 9845 | ;; CASE 5P: AWK pattern or function or continuation | ||
| 9846 | ;; thereof. | ||
| 9847 | ((c-major-mode-is 'awk-mode) | ||
| 9848 | (setq placeholder (point)) | ||
| 9849 | (c-add-stmt-syntax | ||
| 9850 | (if (and (eq (c-beginning-of-statement-1) 'same) | ||
| 9851 | (/= (point) placeholder)) | ||
| 9852 | 'topmost-intro-cont | ||
| 9853 | 'topmost-intro) | ||
| 9854 | nil nil | ||
| 9855 | containing-sexp paren-state)) | ||
| 9856 | |||
| 9837 | ;; CASE 5D: this could be a top-level initialization, a | 9857 | ;; CASE 5D: this could be a top-level initialization, a |
| 9838 | ;; member init list continuation, or a template argument | 9858 | ;; member init list continuation, or a template argument |
| 9839 | ;; list continuation. | 9859 | ;; list continuation. |
| @@ -9993,18 +10013,6 @@ comment at the start of cc-engine.el for more info." | |||
| 9993 | (goto-char (point-min))) | 10013 | (goto-char (point-min))) |
| 9994 | (c-add-syntax 'objc-method-intro (c-point 'boi))) | 10014 | (c-add-syntax 'objc-method-intro (c-point 'boi))) |
| 9995 | 10015 | ||
| 9996 | ;; CASE 5P: AWK pattern or function or continuation | ||
| 9997 | ;; thereof. | ||
| 9998 | ((c-major-mode-is 'awk-mode) | ||
| 9999 | (setq placeholder (point)) | ||
| 10000 | (c-add-stmt-syntax | ||
| 10001 | (if (and (eq (c-beginning-of-statement-1) 'same) | ||
| 10002 | (/= (point) placeholder)) | ||
| 10003 | 'topmost-intro-cont | ||
| 10004 | 'topmost-intro) | ||
| 10005 | nil nil | ||
| 10006 | containing-sexp paren-state)) | ||
| 10007 | |||
| 10008 | ;; CASE 5N: At a variable declaration that follows a class | 10016 | ;; CASE 5N: At a variable declaration that follows a class |
| 10009 | ;; definition or some other block declaration that doesn't | 10017 | ;; definition or some other block declaration that doesn't |
| 10010 | ;; end at the closing '}'. C.f. case 5D.5. | 10018 | ;; end at the closing '}'. C.f. case 5D.5. |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 0e5f4c82090..2f353feb323 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -155,7 +155,10 @@ | |||
| 155 | ;; dabbrev. If you have `dabbrev-mode' activated and | 155 | ;; dabbrev. If you have `dabbrev-mode' activated and |
| 156 | ;; `python-skeleton-autoinsert' is set to t, then whenever you type | 156 | ;; `python-skeleton-autoinsert' is set to t, then whenever you type |
| 157 | ;; the name of any of those defined and hit SPC, they will be | 157 | ;; the name of any of those defined and hit SPC, they will be |
| 158 | ;; automatically expanded. | 158 | ;; automatically expanded. As an alternative you can use the defined |
| 159 | ;; skeleton commands: `python-skeleton-class', `python-skeleton-def' | ||
| 160 | ;; `python-skeleton-for', `python-skeleton-if', `python-skeleton-try' | ||
| 161 | ;; and `python-skeleton-while'. | ||
| 159 | 162 | ||
| 160 | ;; FFAP: You can find the filename for a given module when using ffap | 163 | ;; FFAP: You can find the filename for a given module when using ffap |
| 161 | ;; out of the box. This feature needs an inferior python shell | 164 | ;; out of the box. This feature needs an inferior python shell |
diff --git a/lisp/xml.el b/lisp/xml.el index b6c37612ab3..2232746f02a 100644 --- a/lisp/xml.el +++ b/lisp/xml.el | |||
| @@ -200,7 +200,7 @@ See also `xml-get-attribute-or-nil'." | |||
| 200 | ;; [68] EntityRef ::= '&' Name ';' | 200 | ;; [68] EntityRef ::= '&' Name ';' |
| 201 | (defconst xml-entity-ref (concat "&" xml-name-re ";")) | 201 | (defconst xml-entity-ref (concat "&" xml-name-re ";")) |
| 202 | 202 | ||
| 203 | (defconst xml-entity-or-char-ref-re (concat "&\\(?:#\\(x\\)?\\([0-9]+\\)\\|\\(" | 203 | (defconst xml-entity-or-char-ref-re (concat "&\\(?:#\\(x\\)?\\([0-9a-fA-F]+\\)\\|\\(" |
| 204 | xml-name-re "\\)\\);")) | 204 | xml-name-re "\\)\\);")) |
| 205 | 205 | ||
| 206 | ;; [69] PEReference ::= '%' Name ';' | 206 | ;; [69] PEReference ::= '%' Name ';' |
diff --git a/src/ChangeLog b/src/ChangeLog index ffa4bdf927f..e147889f796 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,32 @@ | |||
| 1 | 2013-01-25 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32notify.c (Fw32notify_add_watch): Doc fix. (Bug#13540) | ||
| 4 | |||
| 5 | 2013-01-25 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 6 | |||
| 7 | * font.c (num_fonts): Remove the leftover from old | ||
| 8 | debugging code. Adjust comment style here and there. | ||
| 9 | * insdel.c (insert_1): Remove. | ||
| 10 | * lisp.h (insert_1): Remove prototype. | ||
| 11 | * xdisp.c (message_dolog): Adjust users to call insert_1_both. | ||
| 12 | |||
| 13 | 2013-01-25 Eli Zaretskii <eliz@gnu.org> | ||
| 14 | |||
| 15 | * w32.c (max_filename_mbslen): New function. | ||
| 16 | (normalize_filename, readdir): Use it to detect locales where ANSI | ||
| 17 | encoding of file names uses a double-byte character set (DBCS). | ||
| 18 | If a DBCS encoding is used, advance by characters using | ||
| 19 | CharNextExA, instead of incrementing a 'char *' pointer. Use | ||
| 20 | _mbslwr instead of _strlwr. (Bug#13515) | ||
| 21 | |||
| 22 | * w32heap.c (allocate_heap) [!_WIN64]: Decrease the initial | ||
| 23 | request of memory reservation to 1.7GB. (Bug#13065) | ||
| 24 | |||
| 25 | 2013-01-25 Andreas Schwab <schwab@linux-m68k.org> | ||
| 26 | |||
| 27 | * coding.c (detect_coding_iso_2022): Move back mis-reordered code | ||
| 28 | at check_extra_latin label. (Bug#13505) | ||
| 29 | |||
| 1 | 2013-01-24 Dmitry Antipov <dmantipov@yandex.ru> | 30 | 2013-01-24 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 31 | ||
| 3 | * nsfont.m (ns_escape_name, ns_unescape_name, ns_registry_to_script): | 32 | * nsfont.m (ns_escape_name, ns_unescape_name, ns_registry_to_script): |
| @@ -19,7 +48,7 @@ | |||
| 19 | (w32_read_socket): Save iconified state to generate DEICONIFY_EVENT | 48 | (w32_read_socket): Save iconified state to generate DEICONIFY_EVENT |
| 20 | properly. Likewise for obscured. | 49 | properly. Likewise for obscured. |
| 21 | * xterm.c: Ditto. | 50 | * xterm.c: Ditto. |
| 22 | (handle_one_xevent): Save visible state go generate ICONIFY_EVENT | 51 | (handle_one_xevent): Save visible state to generate ICONIFY_EVENT |
| 23 | properly. | 52 | properly. |
| 24 | * nsterm.m: Ditto. | 53 | * nsterm.m: Ditto. |
| 25 | (windowDidDeminiaturize): Generate DEICONIFY_EVENT. | 54 | (windowDidDeminiaturize): Generate DEICONIFY_EVENT. |
diff --git a/src/coding.c b/src/coding.c index a9bf9032a69..93da9db0d36 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -3057,20 +3057,7 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3057 | } | 3057 | } |
| 3058 | if (single_shifting) | 3058 | if (single_shifting) |
| 3059 | break; | 3059 | break; |
| 3060 | check_extra_latin: | 3060 | goto check_extra_latin; |
| 3061 | if (! VECTORP (Vlatin_extra_code_table) | ||
| 3062 | || NILP (AREF (Vlatin_extra_code_table, c))) | ||
| 3063 | { | ||
| 3064 | rejected = CATEGORY_MASK_ISO; | ||
| 3065 | break; | ||
| 3066 | } | ||
| 3067 | if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) | ||
| 3068 | & CODING_ISO_FLAG_LATIN_EXTRA) | ||
| 3069 | found |= CATEGORY_MASK_ISO_8_1; | ||
| 3070 | else | ||
| 3071 | rejected |= CATEGORY_MASK_ISO_8_1; | ||
| 3072 | rejected |= CATEGORY_MASK_ISO_8_2; | ||
| 3073 | break; | ||
| 3074 | 3061 | ||
| 3075 | default: | 3062 | default: |
| 3076 | if (c < 0) | 3063 | if (c < 0) |
| @@ -3121,6 +3108,20 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3121 | } | 3108 | } |
| 3122 | break; | 3109 | break; |
| 3123 | } | 3110 | } |
| 3111 | check_extra_latin: | ||
| 3112 | if (! VECTORP (Vlatin_extra_code_table) | ||
| 3113 | || NILP (AREF (Vlatin_extra_code_table, c))) | ||
| 3114 | { | ||
| 3115 | rejected = CATEGORY_MASK_ISO; | ||
| 3116 | break; | ||
| 3117 | } | ||
| 3118 | if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) | ||
| 3119 | & CODING_ISO_FLAG_LATIN_EXTRA) | ||
| 3120 | found |= CATEGORY_MASK_ISO_8_1; | ||
| 3121 | else | ||
| 3122 | rejected |= CATEGORY_MASK_ISO_8_1; | ||
| 3123 | rejected |= CATEGORY_MASK_ISO_8_2; | ||
| 3124 | break; | ||
| 3124 | } | 3125 | } |
| 3125 | } | 3126 | } |
| 3126 | detect_info->rejected |= CATEGORY_MASK_ISO; | 3127 | detect_info->rejected |= CATEGORY_MASK_ISO; |
diff --git a/src/font.c b/src/font.c index 18caf751643..3cffe2558ae 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -717,7 +717,7 @@ font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val) | |||
| 717 | } | 717 | } |
| 718 | 718 | ||
| 719 | 719 | ||
| 720 | /* Font name parser and unparser */ | 720 | /* Font name parser and unparser. */ |
| 721 | 721 | ||
| 722 | static int parse_matrix (const char *); | 722 | static int parse_matrix (const char *); |
| 723 | static int font_expand_wildcards (Lisp_Object *, int); | 723 | static int font_expand_wildcards (Lisp_Object *, int); |
| @@ -1746,7 +1746,7 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec | |||
| 1746 | /* This part (through the next ^L) is still experimental and not | 1746 | /* This part (through the next ^L) is still experimental and not |
| 1747 | tested much. We may drastically change codes. */ | 1747 | tested much. We may drastically change codes. */ |
| 1748 | 1748 | ||
| 1749 | /* OTF handler */ | 1749 | /* OTF handler. */ |
| 1750 | 1750 | ||
| 1751 | #if 0 | 1751 | #if 0 |
| 1752 | 1752 | ||
| @@ -2035,7 +2035,7 @@ font_otf_Anchor (OTF_Anchor *anchor) | |||
| 2035 | #endif /* 0 */ | 2035 | #endif /* 0 */ |
| 2036 | 2036 | ||
| 2037 | 2037 | ||
| 2038 | /* Font sorting */ | 2038 | /* Font sorting. */ |
| 2039 | 2039 | ||
| 2040 | static unsigned font_score (Lisp_Object, Lisp_Object *); | 2040 | static unsigned font_score (Lisp_Object, Lisp_Object *); |
| 2041 | static int font_compare (const void *, const void *); | 2041 | static int font_compare (const void *, const void *); |
| @@ -2565,7 +2565,6 @@ font_get_cache (FRAME_PTR f, struct font_driver *driver) | |||
| 2565 | return val; | 2565 | return val; |
| 2566 | } | 2566 | } |
| 2567 | 2567 | ||
| 2568 | static int num_fonts; | ||
| 2569 | 2568 | ||
| 2570 | static void | 2569 | static void |
| 2571 | font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver) | 2570 | font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver) |
| @@ -2598,7 +2597,6 @@ font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver) | |||
| 2598 | { | 2597 | { |
| 2599 | eassert (font && driver == font->driver); | 2598 | eassert (font && driver == font->driver); |
| 2600 | driver->close (f, font); | 2599 | driver->close (f, font); |
| 2601 | num_fonts--; | ||
| 2602 | } | 2600 | } |
| 2603 | } | 2601 | } |
| 2604 | if (driver->free_entity) | 2602 | if (driver->free_entity) |
| @@ -2856,7 +2854,6 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 2856 | return Qnil; | 2854 | return Qnil; |
| 2857 | ASET (entity, FONT_OBJLIST_INDEX, | 2855 | ASET (entity, FONT_OBJLIST_INDEX, |
| 2858 | Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); | 2856 | Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); |
| 2859 | num_fonts++; | ||
| 2860 | 2857 | ||
| 2861 | font = XFONT_OBJECT (font_object); | 2858 | font = XFONT_OBJECT (font_object); |
| 2862 | min_width = (font->min_width ? font->min_width | 2859 | min_width = (font->min_width ? font->min_width |
| @@ -2901,7 +2898,6 @@ font_close_object (FRAME_PTR f, Lisp_Object font_object) | |||
| 2901 | eassert (FRAME_X_DISPLAY_INFO (f)->n_fonts); | 2898 | eassert (FRAME_X_DISPLAY_INFO (f)->n_fonts); |
| 2902 | FRAME_X_DISPLAY_INFO (f)->n_fonts--; | 2899 | FRAME_X_DISPLAY_INFO (f)->n_fonts--; |
| 2903 | #endif | 2900 | #endif |
| 2904 | num_fonts--; | ||
| 2905 | } | 2901 | } |
| 2906 | 2902 | ||
| 2907 | 2903 | ||
| @@ -3578,7 +3574,7 @@ font_filter_properties (Lisp_Object font, | |||
| 3578 | Lisp_Object it; | 3574 | Lisp_Object it; |
| 3579 | int i; | 3575 | int i; |
| 3580 | 3576 | ||
| 3581 | /* Set boolean values to Qt or Qnil */ | 3577 | /* Set boolean values to Qt or Qnil. */ |
| 3582 | for (i = 0; boolean_properties[i] != NULL; ++i) | 3578 | for (i = 0; boolean_properties[i] != NULL; ++i) |
| 3583 | for (it = alist; ! NILP (it); it = XCDR (it)) | 3579 | for (it = alist; ! NILP (it); it = XCDR (it)) |
| 3584 | { | 3580 | { |
| @@ -3757,7 +3753,7 @@ font_range (ptrdiff_t pos, ptrdiff_t *limit, struct window *w, struct face *face | |||
| 3757 | #endif | 3753 | #endif |
| 3758 | 3754 | ||
| 3759 | 3755 | ||
| 3760 | /* Lisp API */ | 3756 | /* Lisp API. */ |
| 3761 | 3757 | ||
| 3762 | DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0, | 3758 | DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0, |
| 3763 | doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. | 3759 | doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. |
diff --git a/src/insdel.c b/src/insdel.c index 303247816ca..4cf4e6452a1 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -658,17 +658,6 @@ insert_before_markers_and_inherit (const char *string, | |||
| 658 | } | 658 | } |
| 659 | } | 659 | } |
| 660 | 660 | ||
| 661 | /* Subroutine used by the insert functions above. */ | ||
| 662 | |||
| 663 | void | ||
| 664 | insert_1 (const char *string, ptrdiff_t nbytes, | ||
| 665 | bool inherit, bool prepare, bool before_markers) | ||
| 666 | { | ||
| 667 | insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes), | ||
| 668 | nbytes, inherit, prepare, before_markers); | ||
| 669 | } | ||
| 670 | |||
| 671 | |||
| 672 | #ifdef BYTE_COMBINING_DEBUG | 661 | #ifdef BYTE_COMBINING_DEBUG |
| 673 | 662 | ||
| 674 | /* See if the bytes before POS/POS_BYTE combine with bytes | 663 | /* See if the bytes before POS/POS_BYTE combine with bytes |
diff --git a/src/lisp.h b/src/lisp.h index 718c970006c..7128c3d4b18 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2879,7 +2879,6 @@ extern int count_combining_after (const unsigned char *, | |||
| 2879 | ptrdiff_t, ptrdiff_t, ptrdiff_t); | 2879 | ptrdiff_t, ptrdiff_t, ptrdiff_t); |
| 2880 | extern void insert (const char *, ptrdiff_t); | 2880 | extern void insert (const char *, ptrdiff_t); |
| 2881 | extern void insert_and_inherit (const char *, ptrdiff_t); | 2881 | extern void insert_and_inherit (const char *, ptrdiff_t); |
| 2882 | extern void insert_1 (const char *, ptrdiff_t, bool, bool, bool); | ||
| 2883 | extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t, | 2882 | extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t, |
| 2884 | bool, bool, bool); | 2883 | bool, bool, bool); |
| 2885 | extern void insert_from_gap (ptrdiff_t, ptrdiff_t); | 2884 | extern void insert_from_gap (ptrdiff_t, ptrdiff_t); |
| @@ -37,7 +37,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 37 | /* must include CRT headers *before* config.h */ | 37 | /* must include CRT headers *before* config.h */ |
| 38 | 38 | ||
| 39 | #include <config.h> | 39 | #include <config.h> |
| 40 | #include <mbstring.h> /* for _mbspbrk */ | 40 | #include <mbstring.h> /* for _mbspbrk and _mbslwr */ |
| 41 | 41 | ||
| 42 | #undef access | 42 | #undef access |
| 43 | #undef chdir | 43 | #undef chdir |
| @@ -1531,6 +1531,67 @@ srandom (int seed) | |||
| 1531 | srand (seed); | 1531 | srand (seed); |
| 1532 | } | 1532 | } |
| 1533 | 1533 | ||
| 1534 | /* Current codepage for encoding file names. */ | ||
| 1535 | static int file_name_codepage; | ||
| 1536 | |||
| 1537 | /* Return the maximum length in bytes of a multibyte character | ||
| 1538 | sequence encoded in the current ANSI codepage. This is required to | ||
| 1539 | correctly walk the encoded file names one character at a time. */ | ||
| 1540 | static int | ||
| 1541 | max_filename_mbslen (void) | ||
| 1542 | { | ||
| 1543 | /* A simple cache to avoid calling GetCPInfo every time we need to | ||
| 1544 | normalize a file name. The file-name encoding is not supposed to | ||
| 1545 | be changed too frequently, if ever. */ | ||
| 1546 | static Lisp_Object last_file_name_encoding; | ||
| 1547 | static int last_max_mbslen; | ||
| 1548 | Lisp_Object current_encoding; | ||
| 1549 | |||
| 1550 | current_encoding = Vfile_name_coding_system; | ||
| 1551 | if (NILP (current_encoding)) | ||
| 1552 | current_encoding = Vdefault_file_name_coding_system; | ||
| 1553 | |||
| 1554 | if (!EQ (last_file_name_encoding, current_encoding)) | ||
| 1555 | { | ||
| 1556 | CPINFO cp_info; | ||
| 1557 | |||
| 1558 | last_file_name_encoding = current_encoding; | ||
| 1559 | /* Default to the current ANSI codepage. */ | ||
| 1560 | file_name_codepage = w32_ansi_code_page; | ||
| 1561 | if (!NILP (current_encoding)) | ||
| 1562 | { | ||
| 1563 | char *cpname = SDATA (SYMBOL_NAME (current_encoding)); | ||
| 1564 | char *cp = NULL, *end; | ||
| 1565 | int cpnum; | ||
| 1566 | |||
| 1567 | if (strncmp (cpname, "cp", 2) == 0) | ||
| 1568 | cp = cpname + 2; | ||
| 1569 | else if (strncmp (cpname, "windows-", 8) == 0) | ||
| 1570 | cp = cpname + 8; | ||
| 1571 | |||
| 1572 | if (cp) | ||
| 1573 | { | ||
| 1574 | end = cp; | ||
| 1575 | cpnum = strtol (cp, &end, 10); | ||
| 1576 | if (cpnum && *end == '\0' && end - cp >= 2) | ||
| 1577 | file_name_codepage = cpnum; | ||
| 1578 | } | ||
| 1579 | } | ||
| 1580 | |||
| 1581 | if (!file_name_codepage) | ||
| 1582 | file_name_codepage = CP_ACP; /* CP_ACP = 0, but let's not assume that */ | ||
| 1583 | |||
| 1584 | if (!GetCPInfo (file_name_codepage, &cp_info)) | ||
| 1585 | { | ||
| 1586 | file_name_codepage = CP_ACP; | ||
| 1587 | if (!GetCPInfo (file_name_codepage, &cp_info)) | ||
| 1588 | emacs_abort (); | ||
| 1589 | } | ||
| 1590 | last_max_mbslen = cp_info.MaxCharSize; | ||
| 1591 | } | ||
| 1592 | |||
| 1593 | return last_max_mbslen; | ||
| 1594 | } | ||
| 1534 | 1595 | ||
| 1535 | /* Normalize filename by converting all path separators to | 1596 | /* Normalize filename by converting all path separators to |
| 1536 | the specified separator. Also conditionally convert upper | 1597 | the specified separator. Also conditionally convert upper |
| @@ -1540,14 +1601,20 @@ static void | |||
| 1540 | normalize_filename (register char *fp, char path_sep) | 1601 | normalize_filename (register char *fp, char path_sep) |
| 1541 | { | 1602 | { |
| 1542 | char sep; | 1603 | char sep; |
| 1543 | char *elem; | 1604 | char *elem, *p2; |
| 1605 | int dbcs_p = max_filename_mbslen () > 1; | ||
| 1544 | 1606 | ||
| 1545 | /* Always lower-case drive letters a-z, even if the filesystem | 1607 | /* Always lower-case drive letters a-z, even if the filesystem |
| 1546 | preserves case in filenames. | 1608 | preserves case in filenames. |
| 1547 | This is so filenames can be compared by string comparison | 1609 | This is so filenames can be compared by string comparison |
| 1548 | functions that are case-sensitive. Even case-preserving filesystems | 1610 | functions that are case-sensitive. Even case-preserving filesystems |
| 1549 | do not distinguish case in drive letters. */ | 1611 | do not distinguish case in drive letters. */ |
| 1550 | if (fp[1] == ':' && *fp >= 'A' && *fp <= 'Z') | 1612 | if (dbcs_p) |
| 1613 | p2 = CharNextExA (file_name_codepage, fp, 0); | ||
| 1614 | else | ||
| 1615 | p2 = fp + 1; | ||
| 1616 | |||
| 1617 | if (*p2 == ':' && *fp >= 'A' && *fp <= 'Z') | ||
| 1551 | { | 1618 | { |
| 1552 | *fp += 'a' - 'A'; | 1619 | *fp += 'a' - 'A'; |
| 1553 | fp += 2; | 1620 | fp += 2; |
| @@ -1559,7 +1626,10 @@ normalize_filename (register char *fp, char path_sep) | |||
| 1559 | { | 1626 | { |
| 1560 | if (*fp == '/' || *fp == '\\') | 1627 | if (*fp == '/' || *fp == '\\') |
| 1561 | *fp = path_sep; | 1628 | *fp = path_sep; |
| 1562 | fp++; | 1629 | if (!dbcs_p) |
| 1630 | fp++; | ||
| 1631 | else | ||
| 1632 | fp = CharNextExA (file_name_codepage, fp, 0); | ||
| 1563 | } | 1633 | } |
| 1564 | return; | 1634 | return; |
| 1565 | } | 1635 | } |
| @@ -1582,13 +1652,20 @@ normalize_filename (register char *fp, char path_sep) | |||
| 1582 | if (elem && elem != fp) | 1652 | if (elem && elem != fp) |
| 1583 | { | 1653 | { |
| 1584 | *fp = 0; /* temporary end of string */ | 1654 | *fp = 0; /* temporary end of string */ |
| 1585 | _strlwr (elem); /* while we convert to lower case */ | 1655 | _mbslwr (elem); /* while we convert to lower case */ |
| 1586 | } | 1656 | } |
| 1587 | *fp = sep; /* convert (or restore) path separator */ | 1657 | *fp = sep; /* convert (or restore) path separator */ |
| 1588 | elem = fp + 1; /* next element starts after separator */ | 1658 | elem = fp + 1; /* next element starts after separator */ |
| 1589 | sep = path_sep; | 1659 | sep = path_sep; |
| 1590 | } | 1660 | } |
| 1591 | } while (*fp++); | 1661 | if (*fp) |
| 1662 | { | ||
| 1663 | if (!dbcs_p) | ||
| 1664 | fp++; | ||
| 1665 | else | ||
| 1666 | fp = CharNextExA (file_name_codepage, fp, 0); | ||
| 1667 | } | ||
| 1668 | } while (*fp); | ||
| 1592 | } | 1669 | } |
| 1593 | 1670 | ||
| 1594 | /* Destructively turn backslashes into slashes. */ | 1671 | /* Destructively turn backslashes into slashes. */ |
| @@ -2860,15 +2937,22 @@ readdir (DIR *dirp) | |||
| 2860 | strcpy (dir_static.d_name, dir_find_data.cFileName); | 2937 | strcpy (dir_static.d_name, dir_find_data.cFileName); |
| 2861 | dir_static.d_namlen = strlen (dir_static.d_name); | 2938 | dir_static.d_namlen = strlen (dir_static.d_name); |
| 2862 | if (dir_is_fat) | 2939 | if (dir_is_fat) |
| 2863 | _strlwr (dir_static.d_name); | 2940 | _mbslwr (dir_static.d_name); |
| 2864 | else if (downcase) | 2941 | else if (downcase) |
| 2865 | { | 2942 | { |
| 2866 | register char *p; | 2943 | register char *p; |
| 2867 | for (p = dir_static.d_name; *p; p++) | 2944 | int dbcs_p = max_filename_mbslen () > 1; |
| 2868 | if (*p >= 'a' && *p <= 'z') | 2945 | for (p = dir_static.d_name; *p; ) |
| 2869 | break; | 2946 | { |
| 2947 | if (*p >= 'a' && *p <= 'z') | ||
| 2948 | break; | ||
| 2949 | if (dbcs_p) | ||
| 2950 | p = CharNextExA (file_name_codepage, p, 0); | ||
| 2951 | else | ||
| 2952 | p++; | ||
| 2953 | } | ||
| 2870 | if (!*p) | 2954 | if (!*p) |
| 2871 | _strlwr (dir_static.d_name); | 2955 | _mbslwr (dir_static.d_name); |
| 2872 | } | 2956 | } |
| 2873 | 2957 | ||
| 2874 | return &dir_static; | 2958 | return &dir_static; |
diff --git a/src/w32heap.c b/src/w32heap.c index 9c189dbda6d..81206ce2834 100644 --- a/src/w32heap.c +++ b/src/w32heap.c | |||
| @@ -98,7 +98,11 @@ allocate_heap (void) | |||
| 98 | #ifdef _WIN64 | 98 | #ifdef _WIN64 |
| 99 | size_t size = 0x4000000000i64; /* start by asking for 32GB */ | 99 | size_t size = 0x4000000000i64; /* start by asking for 32GB */ |
| 100 | #else | 100 | #else |
| 101 | size_t size = 0x80000000; /* start by asking for 2GB */ | 101 | /* We used to start with 2GB here, but on Windows 7 that would leave |
| 102 | too little room in the address space for threads started by | ||
| 103 | Windows on our behalf, e.g. when we pop up the file selection | ||
| 104 | dialog. */ | ||
| 105 | size_t size = 0x68000000; /* start by asking for 1.7GB */ | ||
| 102 | #endif | 106 | #endif |
| 103 | void *ptr = NULL; | 107 | void *ptr = NULL; |
| 104 | 108 | ||
diff --git a/src/w32notify.c b/src/w32notify.c index d78e55f43ed..1bcaa794565 100644 --- a/src/w32notify.c +++ b/src/w32notify.c | |||
| @@ -442,8 +442,8 @@ DEFUN ("w32notify-add-watch", Fw32notify_add_watch, | |||
| 442 | This arranges for filesystem events pertaining to FILE to be reported | 442 | This arranges for filesystem events pertaining to FILE to be reported |
| 443 | to Emacs. Use `w32notify-rm-watch' to cancel the watch. | 443 | to Emacs. Use `w32notify-rm-watch' to cancel the watch. |
| 444 | 444 | ||
| 445 | Value is a descriptor for the added watch, or nil if the file | 445 | Value is a descriptor for the added watch. If the file cannot be |
| 446 | cannot be watched. | 446 | watched for some reason, this function signals a `file-error' error. |
| 447 | 447 | ||
| 448 | FILTER is a list of conditions for reporting an event. It can include | 448 | FILTER is a list of conditions for reporting an event. It can include |
| 449 | the following symbols: | 449 | the following symbols: |
| @@ -476,7 +476,13 @@ following: | |||
| 476 | 'renamed-from' -- a file was renamed whose old name was FILE | 476 | 'renamed-from' -- a file was renamed whose old name was FILE |
| 477 | 'renamed-to' -- a file was renamed and its new name is FILE | 477 | 'renamed-to' -- a file was renamed and its new name is FILE |
| 478 | 478 | ||
| 479 | FILE is the name of the file whose event is being reported. */) | 479 | FILE is the name of the file whose event is being reported. |
| 480 | |||
| 481 | Note that some networked filesystems, such as Samba-mounted Unix | ||
| 482 | volumes, might not send notifications about file changes. In these | ||
| 483 | cases, this function will return a valid descriptor, but notifications | ||
| 484 | will never come in. Volumes shared from remote Windows machines do | ||
| 485 | generate notifications correctly, though. */) | ||
| 480 | (Lisp_Object file, Lisp_Object filter, Lisp_Object callback) | 486 | (Lisp_Object file, Lisp_Object filter, Lisp_Object callback) |
| 481 | { | 487 | { |
| 482 | Lisp_Object encoded_file, watch_object, watch_descriptor; | 488 | Lisp_Object encoded_file, watch_object, watch_descriptor; |
diff --git a/src/xdisp.c b/src/xdisp.c index c7ee0d37f47..9fb9487732f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9516,13 +9516,14 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte) | |||
| 9516 | } | 9516 | } |
| 9517 | } | 9517 | } |
| 9518 | else if (nbytes) | 9518 | else if (nbytes) |
| 9519 | insert_1 (m, nbytes, 1, 0, 0); | 9519 | insert_1_both (m, chars_in_text (msg, nbytes), nbytes, 1, 0, 0); |
| 9520 | 9520 | ||
| 9521 | if (nlflag) | 9521 | if (nlflag) |
| 9522 | { | 9522 | { |
| 9523 | ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte; | 9523 | ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte; |
| 9524 | printmax_t dups; | 9524 | printmax_t dups; |
| 9525 | insert_1 ("\n", 1, 1, 0, 0); | 9525 | |
| 9526 | insert_1_both ("\n", 1, 1, 1, 0, 0); | ||
| 9526 | 9527 | ||
| 9527 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); | 9528 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); |
| 9528 | this_bol = PT; | 9529 | this_bol = PT; |
| @@ -9551,7 +9552,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte) | |||
| 9551 | change message_log_check_duplicate. */ | 9552 | change message_log_check_duplicate. */ |
| 9552 | int duplen = sprintf (dupstr, " [%"pMd" times]", dups); | 9553 | int duplen = sprintf (dupstr, " [%"pMd" times]", dups); |
| 9553 | TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); | 9554 | TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); |
| 9554 | insert_1 (dupstr, duplen, 1, 0, 1); | 9555 | insert_1_both (dupstr, duplen, duplen, 1, 0, 1); |
| 9555 | } | 9556 | } |
| 9556 | } | 9557 | } |
| 9557 | } | 9558 | } |