[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master b5f1401 3/5: Merge from origin/emacs-26
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] master b5f1401 3/5: Merge from origin/emacs-26 |
Date: |
Wed, 20 Dec 2017 21:15:55 -0500 (EST) |
branch: master
commit b5f140166ab9057b9e9dd56fd332e6b2937388c4
Merge: 5bf3ab2 4122d54
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>
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
---
lisp/emacs-lisp/derived.el | 2 +-
lisp/mouse.el | 337 ++++++++++++++++++++++++++++------
lisp/net/gnutls.el | 58 +++---
lisp/net/shr.el | 9 +-
lisp/progmodes/python.el | 13 +-
lisp/subr.el | 12 +-
src/gnutls.c | 14 +-
src/gtkutil.c | 8 +-
test/lisp/emacs-lisp/derived-tests.el | 43 +++++
9 files changed, 390 insertions(+), 106 deletions(-)
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 751291a..c0ef199 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.
(run-mode-hooks ',hook)
,@(when after-hook
`((if delay-mode-hooks
- (push ',after-hook delayed-after-hook-forms)
+ (push (lambda () ,after-hook) delayed-after-hook-functions)
,after-hook)))))))
;; PUBLIC: find the ultimate class of a derived mode.
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 17d1732..bbcc5c5 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -2345,10 +2345,10 @@ choose a font."
;; Drag and drop support.
(defcustom mouse-drag-and-drop-region nil
- "If non-nil, dragging the mouse drags the region, if that exists.
-If the value is a modifier, such as `control' or `shift' or `meta',
-then if that modifier key is pressed when dropping the region, region
-text is copied instead of being cut."
+ "If non-nil, dragging the mouse drags the region, if it exists.
+If the value is a modifier, such as `control' or `shift' or
+`meta', then if that modifier key is pressed when dropping the
+region, text is copied instead of being cut."
:type `(choice
(const :tag "Disable dragging the region" nil)
,@(mapcar
@@ -2361,6 +2361,45 @@ text is copied instead of being cut."
:version "26.1"
:group 'mouse)
+(defcustom mouse-drag-and-drop-region-cut-when-buffers-differ nil
+ "If non-nil, cut text also when source and destination buffers differ.
+If this option is nil, `mouse-drag-and-drop-region' will leave
+the text in the source buffer alone when dropping it in a
+different buffer. If this is non-nil, it will cut the text just
+as it does when dropping text in the source buffer."
+ :type 'boolean
+ :version "26.1"
+ :group 'mouse)
+
+(defcustom mouse-drag-and-drop-region-show-tooltip 256
+ "If non-nil, text is shown by a tooltip in a graphic display.
+If this option is nil, `mouse-drag-and-drop-region' does not show
+tooltips. If this is t, it shows the entire text dragged in a
+tooltip. If this is an integer (as with the default value of
+256), it will show that many characters of the dragged text in
+a tooltip."
+ :type 'integer
+ :version "26.1"
+ :group 'mouse)
+
+(defcustom mouse-drag-and-drop-region-show-cursor t
+ "If non-nil, move point with mouse cursor during dragging.
+If this is nil, `mouse-drag-and-drop-region' leaves point alone.
+Otherwise, it will move point together with the mouse cursor and,
+in addition, temporarily highlight the original region with the
+`mouse-drag-and-drop-region' face."
+ :type 'boolean
+ :version "26.1"
+ :group 'mouse)
+
+(defface mouse-drag-and-drop-region '((t :inherit region))
+ "Face to highlight original text during dragging.
+This face is used by `mouse-drag-and-drop-region' to temporarily
+highlight the original region when
+`mouse-drag-and-drop-region-show-cursor' is non-nil."
+ :version "26.1"
+ :group 'mouse)
+
(defun mouse-drag-and-drop-region (event)
"Move text in the region to point where mouse is dragged to.
The 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
variable `mouse-drag-and-drop-region' is that modifier, the text
is copied instead of being cut."
(interactive "e")
- (require 'tooltip)
- (let ((start (region-beginning))
- (end (region-end))
- (point (point))
- (buffer (current-buffer))
- (window (selected-window))
- value-selection)
- (track-mouse
- ;; When event was click instead of drag, skip loop
- (while (progn
- (setq event (read-event))
- (or (mouse-movement-p event)
- ;; Handle `mouse-autoselect-window'.
- (eq (car-safe event) 'select-window)))
- (unless value-selection ; initialization
- (delete-overlay mouse-secondary-overlay)
- (setq value-selection (buffer-substring start end))
- (move-overlay mouse-secondary-overlay start end)) ; (deactivate-mark)
- (ignore-errors (deactivate-mark) ; care existing region in other window
- (mouse-set-point event)
- (tooltip-show value-selection)))
- (tooltip-hide))
- ;; Do not modify buffer under mouse when "event was click",
- ;; "drag negligible", or
- ;; "drag to read-only".
- (if (or (equal (mouse-posn-property (event-end event) 'face) 'region) ;
"event was click"
- (member 'secondary-selection ; "drag negligible"
- (mapcar (lambda (xxx) (overlay-get xxx 'face))
- (overlays-at (posn-point (event-end event)))))
- buffer-read-only)
- ;; Do not modify buffer under mouse.
+ (let* ((mouse-button (event-basic-type last-input-event))
+ (mouse-drag-and-drop-region-show-tooltip
+ (when (and mouse-drag-and-drop-region-show-tooltip
+ (display-multi-frame-p)
+ (require 'tooltip))
+ mouse-drag-and-drop-region-show-tooltip))
+ (start (region-beginning))
+ (end (region-end))
+ (point (point))
+ (buffer (current-buffer))
+ (window (selected-window))
+ (text-from-read-only buffer-read-only)
+ (mouse-drag-and-drop-overlay (make-overlay start end))
+ point-to-paste
+ point-to-paste-read-only
+ window-to-paste
+ buffer-to-paste
+ cursor-in-text-area
+ no-modifier-on-drop
+ drag-but-negligible
+ clicked
+ value-selection ; This remains nil when event was "click".
+ text-tooltip
+ states
+ window-exempt)
+
+ ;; STATES stores for each window on this frame its start and point
+ ;; positions so we can restore them on all windows but for the one
+ ;; where the drop occurs. For inter-frame drags we'll have to do
+ ;; this for all windows on all visible frames. In addition we save
+ ;; also the cursor type for the window's buffer so we can restore it
+ ;; in case we modified it.
+ ;; https://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00090.html
+ (walk-window-tree
+ (lambda (window)
+ (setq states
+ (cons
+ (list
+ window
+ (copy-marker (window-start window))
+ (copy-marker (window-point window))
+ (with-current-buffer (window-buffer window)
+ cursor-type))
+ states))))
+
+ (ignore-errors
+ (track-mouse
+ ;; When event was "click" instead of "drag", skip loop.
+ (while (progn
+ (setq event (read-key)) ; read-event or read-key
+ (or (mouse-movement-p event)
+ ;; Handle `mouse-autoselect-window'.
+ (eq (car-safe event) 'select-window)))
+ ;; Obtain the dragged text in region. When the loop was
+ ;; skipped, value-selection remains nil.
+ (unless value-selection
+ (setq value-selection (buffer-substring start end))
+ (when mouse-drag-and-drop-region-show-tooltip
+ (let ((text-size mouse-drag-and-drop-region-show-tooltip))
+ (setq text-tooltip
+ (if (and (integerp text-size)
+ (> (length value-selection) text-size))
+ (concat
+ (substring value-selection 0 (/ text-size 2))
+ "\n...\n"
+ (substring value-selection (- (/ text-size 2)) -1))
+ value-selection))))
+
+ ;; Check if selected text is read-only.
+ (setq text-from-read-only (or text-from-read-only
+ (get-text-property start 'read-only)
+ (not (equal
+
(next-single-char-property-change
+ start 'read-only nil end)
+ end)))))
+ (setq window-to-paste (posn-window (event-end event)))
+ (setq point-to-paste (posn-point (event-end event)))
+ ;; Set nil when target buffer is minibuffer.
+ (setq buffer-to-paste (let (buf)
+ (when (windowp window-to-paste)
+ (setq buf (window-buffer window-to-paste))
+ (when (not (minibufferp buf))
+ buf))))
+ (setq cursor-in-text-area (and window-to-paste
+ point-to-paste
+ buffer-to-paste))
+
+ (when cursor-in-text-area
+ ;; Check if point under mouse is read-only.
+ (save-window-excursion
+ (select-window window-to-paste)
+ (setq point-to-paste-read-only
+ (or buffer-read-only
+ (get-text-property point-to-paste 'read-only))))
+
+ ;; Check if "drag but negligible". Operation "drag but
+ ;; negligible" is defined as drag-and-drop the text to
+ ;; the original region. When modifier is pressed, the
+ ;; text will be inserted to inside of the original
+ ;; region.
+ (setq drag-but-negligible
+ (and (eq (overlay-buffer mouse-drag-and-drop-overlay)
+ buffer-to-paste)
+ (< (overlay-start mouse-drag-and-drop-overlay)
+ point-to-paste)
+ (< point-to-paste
+ (overlay-end mouse-drag-and-drop-overlay)))))
+
+ ;; Show a tooltip.
+ (if mouse-drag-and-drop-region-show-tooltip
+ (tooltip-show text-tooltip)
+ (tooltip-hide))
+
+ ;; Show cursor and highlight the original region.
+ (when mouse-drag-and-drop-region-show-cursor
+ ;; Modify cursor even when point is out of frame.
+ (setq cursor-type (cond
+ ((not cursor-in-text-area)
+ nil)
+ ((or point-to-paste-read-only
+ drag-but-negligible)
+ 'hollow)
+ (t
+ 'bar)))
+ (when cursor-in-text-area
+ (overlay-put mouse-drag-and-drop-overlay
+ 'face 'mouse-drag-and-drop-region)
+ (deactivate-mark) ; Maintain region in other window.
+ (mouse-set-point event)))))
+
+ ;; Hide a tooltip.
+ (when mouse-drag-and-drop-region-show-tooltip (tooltip-hide))
+
+ ;; Check if modifier was pressed on drop.
+ (setq no-modifier-on-drop
+ (not (member mouse-drag-and-drop-region (event-modifiers event))))
+
+ ;; Check if event was "click".
+ (setq clicked (not value-selection))
+
+ ;; Restore status on drag to outside of text-area or non-mouse input.
+ (when (or (not cursor-in-text-area)
+ (not (equal (event-basic-type event) mouse-button)))
+ (setq drag-but-negligible t
+ no-modifier-on-drop t))
+
+ ;; Do not modify any buffers when event is "click",
+ ;; "drag but negligible", or "drag to read-only".
+ (let* ((mouse-drag-and-drop-region-cut-when-buffers-differ
+ (if no-modifier-on-drop
+ mouse-drag-and-drop-region-cut-when-buffers-differ
+ (not mouse-drag-and-drop-region-cut-when-buffers-differ)))
+ (wanna-paste-to-same-buffer (equal buffer-to-paste buffer))
+ (wanna-cut-on-same-buffer (and wanna-paste-to-same-buffer
+ no-modifier-on-drop))
+ (wanna-cut-on-other-buffer
+ (and (not wanna-paste-to-same-buffer)
+ mouse-drag-and-drop-region-cut-when-buffers-differ))
+ (cannot-paste (or point-to-paste-read-only
+ (when (or wanna-cut-on-same-buffer
+ wanna-cut-on-other-buffer)
+ text-from-read-only))))
+
(cond
- ;; "drag negligible" or "drag to read-only", restore region.
- (value-selection
- (select-window window) ; In case miss drag to other window
+ ;; Move point within region.
+ (clicked
+ (deactivate-mark)
+ (mouse-set-point event))
+ ;; Undo operation. Set back the original text as region.
+ ((or (and drag-but-negligible
+ no-modifier-on-drop)
+ cannot-paste)
+ ;; Inform user either source or destination buffer cannot be
modified.
+ (when (and (not drag-but-negligible)
+ cannot-paste)
+ (message "Buffer is read-only"))
+
+ ;; Select source window back and restore region.
+ ;; (set-window-point window point)
+ (select-window window)
(goto-char point)
(setq deactivate-mark nil)
(activate-mark))
- ;; "event was click"
+ ;; Modify buffers.
(t
- (deactivate-mark)
- (mouse-set-point event)))
- ;; Modify buffer under mouse by inserting text.
- (push-mark)
- (insert value-selection)
- (when (not (equal (mark) (point))) ; on success insert
- (setq deactivate-mark nil)
- (activate-mark)) ; have region on destination
- ;; Take care of initial region on source.
- (if (equal (current-buffer) buffer) ; when same buffer
- (let (deactivate-mark) ; remove text
- (unless (member mouse-drag-and-drop-region (event-modifiers event))
- (kill-region (overlay-start mouse-secondary-overlay)
- (overlay-end mouse-secondary-overlay))))
- (let ((window1 (selected-window))) ; when beyond buffer
- (select-window window)
- (goto-char point) ; restore point on source window
- (activate-mark) ; restore region
- (select-window window1))))
- (delete-overlay mouse-secondary-overlay)))
+ ;; * DESTINATION BUFFER::
+ ;; Insert the text to destination buffer under mouse.
+ (select-window window-to-paste)
+ (setq window-exempt window-to-paste)
+ (goto-char point-to-paste)
+ (push-mark)
+ (insert value-selection)
+ ;; On success, set the text as region on destination buffer.
+ (when (not (equal (mark) (point)))
+ (setq deactivate-mark nil)
+ (activate-mark))
+
+ ;; * SOURCE BUFFER::
+ ;; Set back the original text as region or delete the original
+ ;; text, on source buffer.
+ (if wanna-paste-to-same-buffer
+ ;; When source buffer and destination buffer are the same,
+ ;; remove the original text.
+ (when no-modifier-on-drop
+ (let (deactivate-mark)
+ (delete-region (overlay-start mouse-drag-and-drop-overlay)
+ (overlay-end mouse-drag-and-drop-overlay))))
+ ;; When source buffer and destination buffer are different,
+ ;; keep (set back the original text as region) or remove the
+ ;; original text.
+ (select-window window) ; Select window with source buffer.
+ (goto-char point) ; Move point to the original text on source
buffer.
+
+ (if mouse-drag-and-drop-region-cut-when-buffers-differ
+ ;; Remove the dragged text from source buffer like
+ ;; operation `cut'.
+ (delete-region (overlay-start mouse-drag-and-drop-overlay)
+ (overlay-end mouse-drag-and-drop-overlay))
+ ;; Set back the dragged text as region on source buffer
+ ;; like operation `copy'.
+ (activate-mark))
+ (select-window window-to-paste))))))
+
+ ;; Clean up.
+ (delete-overlay mouse-drag-and-drop-overlay)
+
+ ;; Restore old states but for the window where the drop
+ ;; occurred. Restore cursor types for all windows.
+ (dolist (state states)
+ (let ((window (car state)))
+ (when (and window-exempt
+ (not (eq window window-exempt)))
+ (set-window-start window (nth 1 state) 'noforce)
+ (set-marker (nth 1 state) nil)
+ ;; If window is selected, the following automatically sets
+ ;; point for that window's buffer.
+ (set-window-point window (nth 2 state))
+ (set-marker (nth 2 state) nil))
+ (with-current-buffer (window-buffer window)
+ (setq cursor-type (nth 3 state)))))))
;;; Bindings for mouse commands.
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el
index a406b0b..608b6cf 100644
--- a/lisp/net/gnutls.el
+++ b/lisp/net/gnutls.el
@@ -261,33 +261,37 @@ here's a recent version of the list.
It must be omitted, a number, or nil; if omitted or nil it
defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT."
- (let ((trustfiles (or trustfiles (gnutls-trustfiles)))
- (priority-string (or priority-string
- (cond
- ((eq type 'gnutls-anon)
- "NORMAL:+ANON-DH:!ARCFOUR-128:%DUMBFW")
- ((eq type 'gnutls-x509pki)
- (if gnutls-algorithm-priority
- (upcase gnutls-algorithm-priority)
- "NORMAL:%DUMBFW")))))
- (verify-error (or verify-error
- ;; this uses the value of `gnutls-verify-error'
- (cond
- ;; if t, pass it on
- ((eq gnutls-verify-error t)
- t)
- ;; if a list, look for hostname matches
- ((listp gnutls-verify-error)
- (apply 'append
- (mapcar
- (lambda (check)
- (when (string-match (nth 0 check)
- hostname)
- (nth 1 check)))
- gnutls-verify-error)))
- ;; else it's nil
- (t nil))))
- (min-prime-bits (or min-prime-bits gnutls-min-prime-bits)))
+ (let* ((trustfiles (or trustfiles (gnutls-trustfiles)))
+ (maybe-dumbfw (if (memq 'ClientHello\ Padding (gnutls-available-p))
+ ":%DUMBFW"
+ ""))
+ (priority-string (or priority-string
+ (cond
+ ((eq type 'gnutls-anon)
+ (concat "NORMAL:+ANON-DH:!ARCFOUR-128"
+ maybe-dumbfw))
+ ((eq type 'gnutls-x509pki)
+ (if gnutls-algorithm-priority
+ (upcase gnutls-algorithm-priority)
+ (concat "NORMAL" maybe-dumbfw))))))
+ (verify-error (or verify-error
+ ;; this uses the value of `gnutls-verify-error'
+ (cond
+ ;; if t, pass it on
+ ((eq gnutls-verify-error t)
+ t)
+ ;; if a list, look for hostname matches
+ ((listp gnutls-verify-error)
+ (apply 'append
+ (mapcar
+ (lambda (check)
+ (when (string-match (nth 0 check)
+ hostname)
+ (nth 1 check)))
+ gnutls-verify-error)))
+ ;; else it's nil
+ (t nil))))
+ (min-prime-bits (or min-prime-bits gnutls-min-prime-bits)))
(when verify-hostname-error
(push :hostname verify-error))
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index c505f25..23f2ff7 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -595,10 +595,11 @@ size, and full-buffer size."
;; shr-pixel-column uses save-window-excursion, which can reset
;; point to 1.
(let ((pt (point)))
- (with-temp-buffer
- (insert string)
- (shr-pixel-column))
- (goto-char pt))))
+ (prog1
+ (with-temp-buffer
+ (insert string)
+ (shr-pixel-column))
+ (goto-char pt)))))
(defsubst shr--translate-insertion-chars ()
;; Remove soft hyphens.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 2de40c4..035d93f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2451,7 +2451,7 @@ the `buffer-name'."
Optional argument TIMEOUT is the timeout argument to
`accept-process-output' calls. Optional argument REGEXP
overrides the regexp to match the end of output, defaults to
-`comint-prompt-regexp.'. Returns non-nil when output was
+`comint-prompt-regexp'. Returns non-nil when output was
properly captured.
This utility is useful in situations where the output may be
@@ -2469,7 +2469,7 @@ banner and the initial prompt are received separately."
(throw 'found t))))))
(defun python-shell-comint-end-of-output-p (output)
- "Return non-nil if OUTPUT is ends with input prompt."
+ "Return non-nil if OUTPUT ends with input prompt."
(string-match
;; XXX: It seems on macOS an extra carriage return is attached
;; at the end of output, this handles that too.
@@ -2674,10 +2674,9 @@ With argument MSG show activation/deactivation message."
"Hook run upon first (non-pdb) shell prompt detection.
This is the place for shell setup functions that need to wait for
output. Since the first prompt is ensured, this helps the
-current process to not hang waiting for output by safeguarding
-interactive actions can be performed. This is useful to safely
-attach setup code for long-running processes that eventually
-provide a shell."
+current process to not hang while waiting. This is useful to
+safely attach setup code for long-running processes that
+eventually provide a shell."
:version "25.1"
:type 'hook
:group 'python)
@@ -4826,7 +4825,7 @@ With optional argument LINE-NUMBER, check that line
instead."
(point-marker)))))
(defun python-info-beginning-of-backslash (&optional line-number)
- "Return the point where the backslashed line start.
+ "Return the point where the backslashed line starts.
Optional argument LINE-NUMBER forces the line number to check against."
(save-excursion
(save-restriction
diff --git a/lisp/subr.el b/lisp/subr.el
index eca8dfd..e97ae54 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1844,10 +1844,10 @@ if it is empty or a duplicate."
(make-variable-buffer-local 'delayed-mode-hooks)
(put 'delay-mode-hooks 'permanent-local t)
-(defvar delayed-after-hook-forms nil
+(defvar delayed-after-hook-functions nil
"List of delayed :after-hook forms waiting to be run.
These forms come from `define-derived-mode'.")
-(make-variable-buffer-local 'delayed-after-hook-forms)
+(make-variable-buffer-local 'delayed-after-hook-functions)
(defvar change-major-mode-after-body-hook nil
"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'.
Otherwise, runs hooks in the sequence: `change-major-mode-after-body-hook',
`delayed-mode-hooks' (in reverse order), HOOKS, then runs
`hack-local-variables', runs the hook `after-change-major-mode-hook', and
-finally evaluates the forms in `delayed-after-hook-forms' (see
+finally evaluates the functions in `delayed-after-hook-functions' (see
`define-derived-mode').
Major mode functions should use this instead of `run-hooks' when
@@ -1889,9 +1889,9 @@ running their FOO-mode-hook."
(with-demoted-errors "File local-variables error: %s"
(hack-local-variables 'no-mode)))
(run-hooks 'after-change-major-mode-hook)
- (dolist (form (nreverse delayed-after-hook-forms))
- (eval form))
- (setq delayed-after-hook-forms nil)))
+ (dolist (fun (nreverse delayed-after-hook-functions))
+ (funcall fun))
+ (setq delayed-after-hook-functions nil)))
(defmacro delay-mode-hooks (&rest body)
"Execute BODY, but delay any `run-mode-hooks'.
diff --git a/src/gnutls.c b/src/gnutls.c
index 4622011..8db201a 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2415,7 +2415,10 @@ GnuTLS 3 or higher : the list will contain
`gnutls3'.
GnuTLS MACs : the list will contain `macs'.
GnuTLS digests : the list will contain `digests'.
GnuTLS symmetric ciphers: the list will contain `ciphers'.
-GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. */)
+GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'.
+%DUMBFW : the list will contain `ClientHello\ Padding'.
+Any GnuTLS extension with ID up to 100
+ : the list will contain its name. */)
(void)
{
Lisp_Object capabilities = Qnil;
@@ -2436,6 +2439,15 @@ GnuTLS AEAD ciphers : the list will contain
`AEAD-ciphers'. */)
capabilities = Fcons (intern("macs"), capabilities);
# endif /* HAVE_GNUTLS3 */
+ for (unsigned int ext=0; ext < 100; ext++)
+ {
+ const char* name = gnutls_ext_get_name(ext);
+ if (name != NULL)
+ {
+ capabilities = Fcons (intern(name), capabilities);
+ }
+ }
+
# ifdef WINDOWSNT
Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache);
if (CONSP (found))
diff --git a/src/gtkutil.c b/src/gtkutil.c
index c279f1d..ecb4028 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3899,7 +3899,7 @@ xg_update_scrollbar_pos (struct frame *f,
top /= scale;
left /= scale;
height /= scale;
- left -= (scale - 1) * ((width / scale) >> 1);
+ width /= scale;
/* Clear out old position. */
int oldx = -1, oldy = -1, oldw, oldh;
@@ -3975,6 +3975,12 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
GtkWidget *wfixed = f->output_data.x->edit_widget;
GtkWidget *wparent = gtk_widget_get_parent (wscroll);
gint msl;
+ int scale = xg_get_scale (f);
+
+ top /= scale;
+ left /= scale;
+ height /= scale;
+ width /= scale;
/* Clear out old position. */
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 0000000..8f65091
--- /dev/null
+++ b/test/lisp/emacs-lisp/derived-tests.el
@@ -0,0 +1,43 @@
+;;; derived-tests.el --- tests for derived.el -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2017 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+
+(define-derived-mode derived-tests--parent-mode prog-mode "P"
+ :after-hook
+ (let ((f (let ((x "S")) (lambda () x))))
+ (insert (format "AFP=%s " (let ((x "D")) (funcall f)))))
+ (insert "PB "))
+
+(define-derived-mode derived-tests--child-mode derived-tests--parent-mode "C"
+ :after-hook
+ (let ((f (let ((x "S")) (lambda () x))))
+ (insert (format "AFC=%s " (let ((x "D")) (funcall f)))))
+ (insert "CB "))
+
+(ert-deftest derived-tests-after-hook-lexical ()
+ (with-temp-buffer
+ (let ((derived-tests--child-mode-hook
+ (lambda () (insert "MH "))))
+ (derived-tests--child-mode)
+ (should (equal (buffer-string) "PB CB MH AFP=S AFC=S ")))))
+
+;;; derived-tests.el ends here