aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2017-12-20 21:14:19 -0500
committerGlenn Morris2017-12-20 21:14:19 -0500
commitb5f140166ab9057b9e9dd56fd332e6b2937388c4 (patch)
treeaba8c8cc99db410ccec64d1fab7c55d2ed43b6f8
parent5bf3ab291c90b4976e70694982db55dad3fa84cd (diff)
parent4122d54067c61bbdff5aab7ddf5dfe5b5797b218 (diff)
downloademacs-b5f140166ab9057b9e9dd56fd332e6b2937388c4.tar.gz
emacs-b5f140166ab9057b9e9dd56fd332e6b2937388c4.zip
Merge from origin/emacs-26
4122d54 Fix updating scrollbar sizes when scaling is in effect 21a212f Collect GnuTLS extensions and use them to set %DUMBFW if supp... 936136e * test/lisp/emacs-lisp/derived-tests.el: Fix copy&paste lefto... 07b7fb9 * lisp/subr.el (delayed-after-hook-functions): Rename from ..... a5b0a4e * lisp/net/shr.el (shr-string-pixel-width): Return pixel-widt... c51e797 python.el doc fixes c62ced5 Make 'mouse-drag-and-drop-region' more robust and customizable
-rw-r--r--lisp/emacs-lisp/derived.el2
-rw-r--r--lisp/mouse.el337
-rw-r--r--lisp/net/gnutls.el58
-rw-r--r--lisp/net/shr.el9
-rw-r--r--lisp/progmodes/python.el13
-rw-r--r--lisp/subr.el12
-rw-r--r--src/gnutls.c14
-rw-r--r--src/gtkutil.c8
-rw-r--r--test/lisp/emacs-lisp/derived-tests.el43
9 files changed, 390 insertions, 106 deletions
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 751291afa88..c0ef199424b 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -285,7 +285,7 @@ No problems result if this variable is not bound.
285 (run-mode-hooks ',hook) 285 (run-mode-hooks ',hook)
286 ,@(when after-hook 286 ,@(when after-hook
287 `((if delay-mode-hooks 287 `((if delay-mode-hooks
288 (push ',after-hook delayed-after-hook-forms) 288 (push (lambda () ,after-hook) delayed-after-hook-functions)
289 ,after-hook))))))) 289 ,after-hook)))))))
290 290
291;; PUBLIC: find the ultimate class of a derived mode. 291;; PUBLIC: find the ultimate class of a derived mode.
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 17d1732e501..bbcc5c5ba01 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -2345,10 +2345,10 @@ choose a font."
2345 2345
2346;; Drag and drop support. 2346;; Drag and drop support.
2347(defcustom mouse-drag-and-drop-region nil 2347(defcustom mouse-drag-and-drop-region nil
2348 "If non-nil, dragging the mouse drags the region, if that exists. 2348 "If non-nil, dragging the mouse drags the region, if it exists.
2349If the value is a modifier, such as `control' or `shift' or `meta', 2349If the value is a modifier, such as `control' or `shift' or
2350then if that modifier key is pressed when dropping the region, region 2350`meta', then if that modifier key is pressed when dropping the
2351text is copied instead of being cut." 2351region, text is copied instead of being cut."
2352 :type `(choice 2352 :type `(choice
2353 (const :tag "Disable dragging the region" nil) 2353 (const :tag "Disable dragging the region" nil)
2354 ,@(mapcar 2354 ,@(mapcar
@@ -2361,6 +2361,45 @@ text is copied instead of being cut."
2361 :version "26.1" 2361 :version "26.1"
2362 :group 'mouse) 2362 :group 'mouse)
2363 2363
2364(defcustom mouse-drag-and-drop-region-cut-when-buffers-differ nil
2365 "If non-nil, cut text also when source and destination buffers differ.
2366If this option is nil, `mouse-drag-and-drop-region' will leave
2367the text in the source buffer alone when dropping it in a
2368different buffer. If this is non-nil, it will cut the text just
2369as it does when dropping text in the source buffer."
2370 :type 'boolean
2371 :version "26.1"
2372 :group 'mouse)
2373
2374(defcustom mouse-drag-and-drop-region-show-tooltip 256
2375 "If non-nil, text is shown by a tooltip in a graphic display.
2376If this option is nil, `mouse-drag-and-drop-region' does not show
2377tooltips. If this is t, it shows the entire text dragged in a
2378tooltip. If this is an integer (as with the default value of
2379256), it will show that many characters of the dragged text in
2380a tooltip."
2381 :type 'integer
2382 :version "26.1"
2383 :group 'mouse)
2384
2385(defcustom mouse-drag-and-drop-region-show-cursor t
2386 "If non-nil, move point with mouse cursor during dragging.
2387If this is nil, `mouse-drag-and-drop-region' leaves point alone.
2388Otherwise, it will move point together with the mouse cursor and,
2389in addition, temporarily highlight the original region with the
2390`mouse-drag-and-drop-region' face."
2391 :type 'boolean
2392 :version "26.1"
2393 :group 'mouse)
2394
2395(defface mouse-drag-and-drop-region '((t :inherit region))
2396 "Face to highlight original text during dragging.
2397This face is used by `mouse-drag-and-drop-region' to temporarily
2398highlight the original region when
2399`mouse-drag-and-drop-region-show-cursor' is non-nil."
2400 :version "26.1"
2401 :group 'mouse)
2402
2364(defun mouse-drag-and-drop-region (event) 2403(defun mouse-drag-and-drop-region (event)
2365 "Move text in the region to point where mouse is dragged to. 2404 "Move text in the region to point where mouse is dragged to.
2366The transportation of text is also referred as `drag and drop'. 2405The transportation of text is also referred as `drag and drop'.
@@ -2369,66 +2408,246 @@ modifier key was pressed when dropping, and the value of the
2369variable `mouse-drag-and-drop-region' is that modifier, the text 2408variable `mouse-drag-and-drop-region' is that modifier, the text
2370is copied instead of being cut." 2409is copied instead of being cut."
2371 (interactive "e") 2410 (interactive "e")
2372 (require 'tooltip) 2411 (let* ((mouse-button (event-basic-type last-input-event))
2373 (let ((start (region-beginning)) 2412 (mouse-drag-and-drop-region-show-tooltip
2374 (end (region-end)) 2413 (when (and mouse-drag-and-drop-region-show-tooltip
2375 (point (point)) 2414 (display-multi-frame-p)
2376 (buffer (current-buffer)) 2415 (require 'tooltip))
2377 (window (selected-window)) 2416 mouse-drag-and-drop-region-show-tooltip))
2378 value-selection) 2417 (start (region-beginning))
2379 (track-mouse 2418 (end (region-end))
2380 ;; When event was click instead of drag, skip loop 2419 (point (point))
2381 (while (progn 2420 (buffer (current-buffer))
2382 (setq event (read-event)) 2421 (window (selected-window))
2383 (or (mouse-movement-p event) 2422 (text-from-read-only buffer-read-only)
2384 ;; Handle `mouse-autoselect-window'. 2423 (mouse-drag-and-drop-overlay (make-overlay start end))
2385 (eq (car-safe event) 'select-window))) 2424 point-to-paste
2386 (unless value-selection ; initialization 2425 point-to-paste-read-only
2387 (delete-overlay mouse-secondary-overlay) 2426 window-to-paste
2388 (setq value-selection (buffer-substring start end)) 2427 buffer-to-paste
2389 (move-overlay mouse-secondary-overlay start end)) ; (deactivate-mark) 2428 cursor-in-text-area
2390 (ignore-errors (deactivate-mark) ; care existing region in other window 2429 no-modifier-on-drop
2391 (mouse-set-point event) 2430 drag-but-negligible
2392 (tooltip-show value-selection))) 2431 clicked
2393 (tooltip-hide)) 2432 value-selection ; This remains nil when event was "click".
2394 ;; Do not modify buffer under mouse when "event was click", 2433 text-tooltip
2395 ;; "drag negligible", or 2434 states
2396 ;; "drag to read-only". 2435 window-exempt)
2397 (if (or (equal (mouse-posn-property (event-end event) 'face) 'region) ; "event was click" 2436
2398 (member 'secondary-selection ; "drag negligible" 2437 ;; STATES stores for each window on this frame its start and point
2399 (mapcar (lambda (xxx) (overlay-get xxx 'face)) 2438 ;; positions so we can restore them on all windows but for the one
2400 (overlays-at (posn-point (event-end event))))) 2439 ;; where the drop occurs. For inter-frame drags we'll have to do
2401 buffer-read-only) 2440 ;; this for all windows on all visible frames. In addition we save
2402 ;; Do not modify buffer under mouse. 2441 ;; also the cursor type for the window's buffer so we can restore it
2442 ;; in case we modified it.
2443 ;; https://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00090.html
2444 (walk-window-tree
2445 (lambda (window)
2446 (setq states
2447 (cons
2448 (list
2449 window
2450 (copy-marker (window-start window))
2451 (copy-marker (window-point window))
2452 (with-current-buffer (window-buffer window)
2453 cursor-type))
2454 states))))
2455
2456 (ignore-errors
2457 (track-mouse
2458 ;; When event was "click" instead of "drag", skip loop.
2459 (while (progn
2460 (setq event (read-key)) ; read-event or read-key
2461 (or (mouse-movement-p event)
2462 ;; Handle `mouse-autoselect-window'.
2463 (eq (car-safe event) 'select-window)))
2464 ;; Obtain the dragged text in region. When the loop was
2465 ;; skipped, value-selection remains nil.
2466 (unless value-selection
2467 (setq value-selection (buffer-substring start end))
2468 (when mouse-drag-and-drop-region-show-tooltip
2469 (let ((text-size mouse-drag-and-drop-region-show-tooltip))
2470 (setq text-tooltip
2471 (if (and (integerp text-size)
2472 (> (length value-selection) text-size))
2473 (concat
2474 (substring value-selection 0 (/ text-size 2))
2475 "\n...\n"
2476 (substring value-selection (- (/ text-size 2)) -1))
2477 value-selection))))
2478
2479 ;; Check if selected text is read-only.
2480 (setq text-from-read-only (or text-from-read-only
2481 (get-text-property start 'read-only)
2482 (not (equal
2483 (next-single-char-property-change
2484 start 'read-only nil end)
2485 end)))))
2486 (setq window-to-paste (posn-window (event-end event)))
2487 (setq point-to-paste (posn-point (event-end event)))
2488 ;; Set nil when target buffer is minibuffer.
2489 (setq buffer-to-paste (let (buf)
2490 (when (windowp window-to-paste)
2491 (setq buf (window-buffer window-to-paste))
2492 (when (not (minibufferp buf))
2493 buf))))
2494 (setq cursor-in-text-area (and window-to-paste
2495 point-to-paste
2496 buffer-to-paste))
2497
2498 (when cursor-in-text-area
2499 ;; Check if point under mouse is read-only.
2500 (save-window-excursion
2501 (select-window window-to-paste)
2502 (setq point-to-paste-read-only
2503 (or buffer-read-only
2504 (get-text-property point-to-paste 'read-only))))
2505
2506 ;; Check if "drag but negligible". Operation "drag but
2507 ;; negligible" is defined as drag-and-drop the text to
2508 ;; the original region. When modifier is pressed, the
2509 ;; text will be inserted to inside of the original
2510 ;; region.
2511 (setq drag-but-negligible
2512 (and (eq (overlay-buffer mouse-drag-and-drop-overlay)
2513 buffer-to-paste)
2514 (< (overlay-start mouse-drag-and-drop-overlay)
2515 point-to-paste)
2516 (< point-to-paste
2517 (overlay-end mouse-drag-and-drop-overlay)))))
2518
2519 ;; Show a tooltip.
2520 (if mouse-drag-and-drop-region-show-tooltip
2521 (tooltip-show text-tooltip)
2522 (tooltip-hide))
2523
2524 ;; Show cursor and highlight the original region.
2525 (when mouse-drag-and-drop-region-show-cursor
2526 ;; Modify cursor even when point is out of frame.
2527 (setq cursor-type (cond
2528 ((not cursor-in-text-area)
2529 nil)
2530 ((or point-to-paste-read-only
2531 drag-but-negligible)
2532 'hollow)
2533 (t
2534 'bar)))
2535 (when cursor-in-text-area
2536 (overlay-put mouse-drag-and-drop-overlay
2537 'face 'mouse-drag-and-drop-region)
2538 (deactivate-mark) ; Maintain region in other window.
2539 (mouse-set-point event)))))
2540
2541 ;; Hide a tooltip.
2542 (when mouse-drag-and-drop-region-show-tooltip (tooltip-hide))
2543
2544 ;; Check if modifier was pressed on drop.
2545 (setq no-modifier-on-drop
2546 (not (member mouse-drag-and-drop-region (event-modifiers event))))
2547
2548 ;; Check if event was "click".
2549 (setq clicked (not value-selection))
2550
2551 ;; Restore status on drag to outside of text-area or non-mouse input.
2552 (when (or (not cursor-in-text-area)
2553 (not (equal (event-basic-type event) mouse-button)))
2554 (setq drag-but-negligible t
2555 no-modifier-on-drop t))
2556
2557 ;; Do not modify any buffers when event is "click",
2558 ;; "drag but negligible", or "drag to read-only".
2559 (let* ((mouse-drag-and-drop-region-cut-when-buffers-differ
2560 (if no-modifier-on-drop
2561 mouse-drag-and-drop-region-cut-when-buffers-differ
2562 (not mouse-drag-and-drop-region-cut-when-buffers-differ)))
2563 (wanna-paste-to-same-buffer (equal buffer-to-paste buffer))
2564 (wanna-cut-on-same-buffer (and wanna-paste-to-same-buffer
2565 no-modifier-on-drop))
2566 (wanna-cut-on-other-buffer
2567 (and (not wanna-paste-to-same-buffer)
2568 mouse-drag-and-drop-region-cut-when-buffers-differ))
2569 (cannot-paste (or point-to-paste-read-only
2570 (when (or wanna-cut-on-same-buffer
2571 wanna-cut-on-other-buffer)
2572 text-from-read-only))))
2573
2403 (cond 2574 (cond
2404 ;; "drag negligible" or "drag to read-only", restore region. 2575 ;; Move point within region.
2405 (value-selection 2576 (clicked
2406 (select-window window) ; In case miss drag to other window 2577 (deactivate-mark)
2578 (mouse-set-point event))
2579 ;; Undo operation. Set back the original text as region.
2580 ((or (and drag-but-negligible
2581 no-modifier-on-drop)
2582 cannot-paste)
2583 ;; Inform user either source or destination buffer cannot be modified.
2584 (when (and (not drag-but-negligible)
2585 cannot-paste)
2586 (message "Buffer is read-only"))
2587
2588 ;; Select source window back and restore region.
2589 ;; (set-window-point window point)
2590 (select-window window)
2407 (goto-char point) 2591 (goto-char point)
2408 (setq deactivate-mark nil) 2592 (setq deactivate-mark nil)
2409 (activate-mark)) 2593 (activate-mark))
2410 ;; "event was click" 2594 ;; Modify buffers.
2411 (t 2595 (t
2412 (deactivate-mark) 2596 ;; * DESTINATION BUFFER::
2413 (mouse-set-point event))) 2597 ;; Insert the text to destination buffer under mouse.
2414 ;; Modify buffer under mouse by inserting text. 2598 (select-window window-to-paste)
2415 (push-mark) 2599 (setq window-exempt window-to-paste)
2416 (insert value-selection) 2600 (goto-char point-to-paste)
2417 (when (not (equal (mark) (point))) ; on success insert 2601 (push-mark)
2418 (setq deactivate-mark nil) 2602 (insert value-selection)
2419 (activate-mark)) ; have region on destination 2603 ;; On success, set the text as region on destination buffer.
2420 ;; Take care of initial region on source. 2604 (when (not (equal (mark) (point)))
2421 (if (equal (current-buffer) buffer) ; when same buffer 2605 (setq deactivate-mark nil)
2422 (let (deactivate-mark) ; remove text 2606 (activate-mark))
2423 (unless (member mouse-drag-and-drop-region (event-modifiers event)) 2607
2424 (kill-region (overlay-start mouse-secondary-overlay) 2608 ;; * SOURCE BUFFER::
2425 (overlay-end mouse-secondary-overlay)))) 2609 ;; Set back the original text as region or delete the original
2426 (let ((window1 (selected-window))) ; when beyond buffer 2610 ;; text, on source buffer.
2427 (select-window window) 2611 (if wanna-paste-to-same-buffer
2428 (goto-char point) ; restore point on source window 2612 ;; When source buffer and destination buffer are the same,
2429 (activate-mark) ; restore region 2613 ;; remove the original text.
2430 (select-window window1)))) 2614 (when no-modifier-on-drop
2431 (delete-overlay mouse-secondary-overlay))) 2615 (let (deactivate-mark)
2616 (delete-region (overlay-start mouse-drag-and-drop-overlay)
2617 (overlay-end mouse-drag-and-drop-overlay))))
2618 ;; When source buffer and destination buffer are different,
2619 ;; keep (set back the original text as region) or remove the
2620 ;; original text.
2621 (select-window window) ; Select window with source buffer.
2622 (goto-char point) ; Move point to the original text on source buffer.
2623
2624 (if mouse-drag-and-drop-region-cut-when-buffers-differ
2625 ;; Remove the dragged text from source buffer like
2626 ;; operation `cut'.
2627 (delete-region (overlay-start mouse-drag-and-drop-overlay)
2628 (overlay-end mouse-drag-and-drop-overlay))
2629 ;; Set back the dragged text as region on source buffer
2630 ;; like operation `copy'.
2631 (activate-mark))
2632 (select-window window-to-paste))))))
2633
2634 ;; Clean up.
2635 (delete-overlay mouse-drag-and-drop-overlay)
2636
2637 ;; Restore old states but for the window where the drop
2638 ;; occurred. Restore cursor types for all windows.
2639 (dolist (state states)
2640 (let ((window (car state)))
2641 (when (and window-exempt
2642 (not (eq window window-exempt)))
2643 (set-window-start window (nth 1 state) 'noforce)
2644 (set-marker (nth 1 state) nil)
2645 ;; If window is selected, the following automatically sets
2646 ;; point for that window's buffer.
2647 (set-window-point window (nth 2 state))
2648 (set-marker (nth 2 state) nil))
2649 (with-current-buffer (window-buffer window)
2650 (setq cursor-type (nth 3 state)))))))
2432 2651
2433 2652
2434;;; Bindings for mouse commands. 2653;;; Bindings for mouse commands.
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el
index a406b0b07fd..608b6cfe9e8 100644
--- a/lisp/net/gnutls.el
+++ b/lisp/net/gnutls.el
@@ -261,33 +261,37 @@ here's a recent version of the list.
261 261
262It must be omitted, a number, or nil; if omitted or nil it 262It must be omitted, a number, or nil; if omitted or nil it
263defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." 263defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT."
264 (let ((trustfiles (or trustfiles (gnutls-trustfiles))) 264 (let* ((trustfiles (or trustfiles (gnutls-trustfiles)))
265 (priority-string (or priority-string 265 (maybe-dumbfw (if (memq 'ClientHello\ Padding (gnutls-available-p))
266 (cond 266 ":%DUMBFW"
267 ((eq type 'gnutls-anon) 267 ""))
268 "NORMAL:+ANON-DH:!ARCFOUR-128:%DUMBFW") 268 (priority-string (or priority-string
269 ((eq type 'gnutls-x509pki) 269 (cond
270 (if gnutls-algorithm-priority 270 ((eq type 'gnutls-anon)
271 (upcase gnutls-algorithm-priority) 271 (concat "NORMAL:+ANON-DH:!ARCFOUR-128"
272 "NORMAL:%DUMBFW"))))) 272 maybe-dumbfw))
273 (verify-error (or verify-error 273 ((eq type 'gnutls-x509pki)
274 ;; this uses the value of `gnutls-verify-error' 274 (if gnutls-algorithm-priority
275 (cond 275 (upcase gnutls-algorithm-priority)
276 ;; if t, pass it on 276 (concat "NORMAL" maybe-dumbfw))))))
277 ((eq gnutls-verify-error t) 277 (verify-error (or verify-error
278 t) 278 ;; this uses the value of `gnutls-verify-error'
279 ;; if a list, look for hostname matches 279 (cond
280 ((listp gnutls-verify-error) 280 ;; if t, pass it on
281 (apply 'append 281 ((eq gnutls-verify-error t)
282 (mapcar 282 t)
283 (lambda (check) 283 ;; if a list, look for hostname matches
284 (when (string-match (nth 0 check) 284 ((listp gnutls-verify-error)
285 hostname) 285 (apply 'append
286 (nth 1 check))) 286 (mapcar
287 gnutls-verify-error))) 287 (lambda (check)
288 ;; else it's nil 288 (when (string-match (nth 0 check)
289 (t nil)))) 289 hostname)
290 (min-prime-bits (or min-prime-bits gnutls-min-prime-bits))) 290 (nth 1 check)))
291 gnutls-verify-error)))
292 ;; else it's nil
293 (t nil))))
294 (min-prime-bits (or min-prime-bits gnutls-min-prime-bits)))
291 295
292 (when verify-hostname-error 296 (when verify-hostname-error
293 (push :hostname verify-error)) 297 (push :hostname verify-error))
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index c505f25a5a9..23f2ff75fab 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -595,10 +595,11 @@ size, and full-buffer size."
595 ;; shr-pixel-column uses save-window-excursion, which can reset 595 ;; shr-pixel-column uses save-window-excursion, which can reset
596 ;; point to 1. 596 ;; point to 1.
597 (let ((pt (point))) 597 (let ((pt (point)))
598 (with-temp-buffer 598 (prog1
599 (insert string) 599 (with-temp-buffer
600 (shr-pixel-column)) 600 (insert string)
601 (goto-char pt)))) 601 (shr-pixel-column))
602 (goto-char pt)))))
602 603
603(defsubst shr--translate-insertion-chars () 604(defsubst shr--translate-insertion-chars ()
604 ;; Remove soft hyphens. 605 ;; Remove soft hyphens.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 2de40c4ab88..035d93f7b99 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2451,7 +2451,7 @@ the `buffer-name'."
2451Optional argument TIMEOUT is the timeout argument to 2451Optional argument TIMEOUT is the timeout argument to
2452`accept-process-output' calls. Optional argument REGEXP 2452`accept-process-output' calls. Optional argument REGEXP
2453overrides the regexp to match the end of output, defaults to 2453overrides the regexp to match the end of output, defaults to
2454`comint-prompt-regexp.'. Returns non-nil when output was 2454`comint-prompt-regexp'. Returns non-nil when output was
2455properly captured. 2455properly captured.
2456 2456
2457This utility is useful in situations where the output may be 2457This utility is useful in situations where the output may be
@@ -2469,7 +2469,7 @@ banner and the initial prompt are received separately."
2469 (throw 'found t)))))) 2469 (throw 'found t))))))
2470 2470
2471(defun python-shell-comint-end-of-output-p (output) 2471(defun python-shell-comint-end-of-output-p (output)
2472 "Return non-nil if OUTPUT is ends with input prompt." 2472 "Return non-nil if OUTPUT ends with input prompt."
2473 (string-match 2473 (string-match
2474 ;; XXX: It seems on macOS an extra carriage return is attached 2474 ;; XXX: It seems on macOS an extra carriage return is attached
2475 ;; at the end of output, this handles that too. 2475 ;; at the end of output, this handles that too.
@@ -2674,10 +2674,9 @@ With argument MSG show activation/deactivation message."
2674 "Hook run upon first (non-pdb) shell prompt detection. 2674 "Hook run upon first (non-pdb) shell prompt detection.
2675This is the place for shell setup functions that need to wait for 2675This is the place for shell setup functions that need to wait for
2676output. Since the first prompt is ensured, this helps the 2676output. Since the first prompt is ensured, this helps the
2677current process to not hang waiting for output by safeguarding 2677current process to not hang while waiting. This is useful to
2678interactive actions can be performed. This is useful to safely 2678safely attach setup code for long-running processes that
2679attach setup code for long-running processes that eventually 2679eventually provide a shell."
2680provide a shell."
2681 :version "25.1" 2680 :version "25.1"
2682 :type 'hook 2681 :type 'hook
2683 :group 'python) 2682 :group 'python)
@@ -4826,7 +4825,7 @@ With optional argument LINE-NUMBER, check that line instead."
4826 (point-marker))))) 4825 (point-marker)))))
4827 4826
4828(defun python-info-beginning-of-backslash (&optional line-number) 4827(defun python-info-beginning-of-backslash (&optional line-number)
4829 "Return the point where the backslashed line start. 4828 "Return the point where the backslashed line starts.
4830Optional argument LINE-NUMBER forces the line number to check against." 4829Optional argument LINE-NUMBER forces the line number to check against."
4831 (save-excursion 4830 (save-excursion
4832 (save-restriction 4831 (save-restriction
diff --git a/lisp/subr.el b/lisp/subr.el
index eca8dfdb857..e97ae54462c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1844,10 +1844,10 @@ if it is empty or a duplicate."
1844(make-variable-buffer-local 'delayed-mode-hooks) 1844(make-variable-buffer-local 'delayed-mode-hooks)
1845(put 'delay-mode-hooks 'permanent-local t) 1845(put 'delay-mode-hooks 'permanent-local t)
1846 1846
1847(defvar delayed-after-hook-forms nil 1847(defvar delayed-after-hook-functions nil
1848 "List of delayed :after-hook forms waiting to be run. 1848 "List of delayed :after-hook forms waiting to be run.
1849These forms come from `define-derived-mode'.") 1849These forms come from `define-derived-mode'.")
1850(make-variable-buffer-local 'delayed-after-hook-forms) 1850(make-variable-buffer-local 'delayed-after-hook-functions)
1851 1851
1852(defvar change-major-mode-after-body-hook nil 1852(defvar change-major-mode-after-body-hook nil
1853 "Normal hook run in major mode functions, before the mode hooks.") 1853 "Normal hook run in major mode functions, before the mode hooks.")
@@ -1865,7 +1865,7 @@ just adds the HOOKS to the list `delayed-mode-hooks'.
1865Otherwise, runs hooks in the sequence: `change-major-mode-after-body-hook', 1865Otherwise, runs hooks in the sequence: `change-major-mode-after-body-hook',
1866`delayed-mode-hooks' (in reverse order), HOOKS, then runs 1866`delayed-mode-hooks' (in reverse order), HOOKS, then runs
1867`hack-local-variables', runs the hook `after-change-major-mode-hook', and 1867`hack-local-variables', runs the hook `after-change-major-mode-hook', and
1868finally evaluates the forms in `delayed-after-hook-forms' (see 1868finally evaluates the functions in `delayed-after-hook-functions' (see
1869`define-derived-mode'). 1869`define-derived-mode').
1870 1870
1871Major mode functions should use this instead of `run-hooks' when 1871Major mode functions should use this instead of `run-hooks' when
@@ -1889,9 +1889,9 @@ running their FOO-mode-hook."
1889 (with-demoted-errors "File local-variables error: %s" 1889 (with-demoted-errors "File local-variables error: %s"
1890 (hack-local-variables 'no-mode))) 1890 (hack-local-variables 'no-mode)))
1891 (run-hooks 'after-change-major-mode-hook) 1891 (run-hooks 'after-change-major-mode-hook)
1892 (dolist (form (nreverse delayed-after-hook-forms)) 1892 (dolist (fun (nreverse delayed-after-hook-functions))
1893 (eval form)) 1893 (funcall fun))
1894 (setq delayed-after-hook-forms nil))) 1894 (setq delayed-after-hook-functions nil)))
1895 1895
1896(defmacro delay-mode-hooks (&rest body) 1896(defmacro delay-mode-hooks (&rest body)
1897 "Execute BODY, but delay any `run-mode-hooks'. 1897 "Execute BODY, but delay any `run-mode-hooks'.
diff --git a/src/gnutls.c b/src/gnutls.c
index 4622011bc10..8db201ae834 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2415,7 +2415,10 @@ GnuTLS 3 or higher : the list will contain `gnutls3'.
2415GnuTLS MACs : the list will contain `macs'. 2415GnuTLS MACs : the list will contain `macs'.
2416GnuTLS digests : the list will contain `digests'. 2416GnuTLS digests : the list will contain `digests'.
2417GnuTLS symmetric ciphers: the list will contain `ciphers'. 2417GnuTLS symmetric ciphers: the list will contain `ciphers'.
2418GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. */) 2418GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'.
2419%DUMBFW : the list will contain `ClientHello\ Padding'.
2420Any GnuTLS extension with ID up to 100
2421 : the list will contain its name. */)
2419 (void) 2422 (void)
2420{ 2423{
2421 Lisp_Object capabilities = Qnil; 2424 Lisp_Object capabilities = Qnil;
@@ -2436,6 +2439,15 @@ GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. */)
2436 capabilities = Fcons (intern("macs"), capabilities); 2439 capabilities = Fcons (intern("macs"), capabilities);
2437# endif /* HAVE_GNUTLS3 */ 2440# endif /* HAVE_GNUTLS3 */
2438 2441
2442 for (unsigned int ext=0; ext < 100; ext++)
2443 {
2444 const char* name = gnutls_ext_get_name(ext);
2445 if (name != NULL)
2446 {
2447 capabilities = Fcons (intern(name), capabilities);
2448 }
2449 }
2450
2439# ifdef WINDOWSNT 2451# ifdef WINDOWSNT
2440 Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); 2452 Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache);
2441 if (CONSP (found)) 2453 if (CONSP (found))
diff --git a/src/gtkutil.c b/src/gtkutil.c
index c279f1d2bcd..ecb40285853 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3899,7 +3899,7 @@ xg_update_scrollbar_pos (struct frame *f,
3899 top /= scale; 3899 top /= scale;
3900 left /= scale; 3900 left /= scale;
3901 height /= scale; 3901 height /= scale;
3902 left -= (scale - 1) * ((width / scale) >> 1); 3902 width /= scale;
3903 3903
3904 /* Clear out old position. */ 3904 /* Clear out old position. */
3905 int oldx = -1, oldy = -1, oldw, oldh; 3905 int oldx = -1, oldy = -1, oldw, oldh;
@@ -3975,6 +3975,12 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
3975 GtkWidget *wfixed = f->output_data.x->edit_widget; 3975 GtkWidget *wfixed = f->output_data.x->edit_widget;
3976 GtkWidget *wparent = gtk_widget_get_parent (wscroll); 3976 GtkWidget *wparent = gtk_widget_get_parent (wscroll);
3977 gint msl; 3977 gint msl;
3978 int scale = xg_get_scale (f);
3979
3980 top /= scale;
3981 left /= scale;
3982 height /= scale;
3983 width /= scale;
3978 3984
3979 /* Clear out old position. */ 3985 /* Clear out old position. */
3980 int oldx = -1, oldy = -1, oldw, oldh; 3986 int oldx = -1, oldy = -1, oldw, oldh;
diff --git a/test/lisp/emacs-lisp/derived-tests.el b/test/lisp/emacs-lisp/derived-tests.el
new file mode 100644
index 00000000000..8f650916946
--- /dev/null
+++ b/test/lisp/emacs-lisp/derived-tests.el
@@ -0,0 +1,43 @@
1;;; derived-tests.el --- tests for derived.el -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2017 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'ert)
23
24(define-derived-mode derived-tests--parent-mode prog-mode "P"
25 :after-hook
26 (let ((f (let ((x "S")) (lambda () x))))
27 (insert (format "AFP=%s " (let ((x "D")) (funcall f)))))
28 (insert "PB "))
29
30(define-derived-mode derived-tests--child-mode derived-tests--parent-mode "C"
31 :after-hook
32 (let ((f (let ((x "S")) (lambda () x))))
33 (insert (format "AFC=%s " (let ((x "D")) (funcall f)))))
34 (insert "CB "))
35
36(ert-deftest derived-tests-after-hook-lexical ()
37 (with-temp-buffer
38 (let ((derived-tests--child-mode-hook
39 (lambda () (insert "MH "))))
40 (derived-tests--child-mode)
41 (should (equal (buffer-string) "PB CB MH AFP=S AFC=S ")))))
42
43;;; derived-tests.el ends here