commit 0a2aedfe6d650e825a50f25f972bac20d669f5cb (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sat Jul 9 11:01:17 2016 +0300 Minor tweaks of copying text properties when padding strings * src/editfns.c (styled_format): Don't include padding on the left in the properties at the beginning of the string. (Bug#23897) * test/src/editfns-tests.el (format-properties): Add tests for faces when the string is padded on the left or on the right. diff --git a/src/editfns.c b/src/editfns.c index 73f0244..4c8336b 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4175,13 +4175,13 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) convbytes += padding; if (convbytes <= buf + bufsize - p) { - info[n].start = nchars; if (! minus_flag) { memset (p, ' ', padding); p += padding; nchars += padding; } + info[n].start = nchars; if (p > buf && multibyte diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 62d7bc4..507ceef 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -54,7 +54,7 @@ ;; Bug #23859 (should (ert-equal-including-properties (format "%4s" (propertize "hi" 'face 'bold)) - #(" hi" 0 4 (face bold)))) + #(" hi" 2 4 (face bold)))) ;; Bug #23897 (should (ert-equal-including-properties @@ -64,4 +64,28 @@ (format "%s" (concat (propertize "01" 'face 'bold) (propertize "23" 'face 'underline) "45")) - #("012345" 0 2 (face bold) 2 4 (face underline))))) + #("012345" 0 2 (face bold) 2 4 (face underline)))) + ;; The last property range is extended to include padding on the + ;; right, but the first range is not extended to the left to include + ;; padding on the left! + (should (ert-equal-including-properties + (format "%12s" (concat (propertize "01234" 'face 'bold) "56789")) + #(" 0123456789" 2 7 (face bold)))) + (should (ert-equal-including-properties + (format "%-12s" (concat (propertize "01234" 'face 'bold) "56789")) + #("0123456789 " 0 5 (face bold)))) + (should (ert-equal-including-properties + (format "%10s" (concat (propertize "01" 'face 'bold) + (propertize "23" 'face 'underline) + "45")) + #(" 012345" 4 6 (face bold) 6 8 (face underline)))) + (should (ert-equal-including-properties + (format "%-10s" (concat (propertize "01" 'face 'bold) + (propertize "23" 'face 'underline) + "45")) + #("012345 " 0 2 (face bold) 2 4 (face underline)))) + (should (ert-equal-including-properties + (format "%-10s" (concat (propertize "01" 'face 'bold) + (propertize "23" 'face 'underline) + (propertize "45" 'face 'italic))) + #("012345 " 0 2 (face bold) 2 4 (face underline) 4 10 (face italic))))) commit e52ad7fdfc7148a75897c92588712169894f7a5c Merge: 47f6336 316bbd9 Author: Mario Lang Date: Sat Jul 9 07:06:53 2016 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 47f6336e6a9954a06fe8a88eb7a822ad5b4aedac Author: Mario Lang Date: Sat Jul 9 07:05:50 2016 +0200 No need to require the same feature twice. * lisp/dired-aux.el (require 'cl-lib): Remove. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 8d6f665..1a4efdf 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -39,7 +39,6 @@ ;; We need macros in dired.el to compile properly, ;; and we call subroutines in it too. (require 'dired) -(require 'cl-lib) ; for cl-mapcan (defvar dired-create-files-failures nil "Variable where `dired-create-files' records failing file names. commit 316bbd956e8ce9f5cbbc750fda61eb570276ceea Author: Mark Oteiza Date: Fri Jul 8 21:49:52 2016 -0400 Turn on lexical binding * lisp/net/secrets.el (secrets-collection-handler): Use cl-pushnew. (secrets-search-items, secrets-create-item): Use append. (secrets-show-secrets): Remove unused binding. (secrets-expand-item, secrets-tree-widget-after-toggle-function): Ignore unused arguments. diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index 82c886d..ea26a52 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el @@ -1,4 +1,4 @@ -;;; secrets.el --- Client interface to gnome-keyring and kwallet. +;;; secrets.el --- Client interface to gnome-keyring and kwallet. -*- lexical-binding: t -*- ;; Copyright (C) 2010-2016 Free Software Foundation, Inc. @@ -433,7 +433,7 @@ returned, and it will be stored in `secrets-session-path'." "Handler for signals emitted by `secrets-interface-service'." (cond ((string-equal (dbus-event-member-name last-input-event) "CollectionCreated") - (add-to-list 'secrets-collection-paths (car args))) + (cl-pushnew (car args) secrets-collection-paths)) ((string-equal (dbus-event-member-name last-input-event) "CollectionDeleted") (setq secrets-collection-paths (delete (car args) secrets-collection-paths))))) @@ -610,12 +610,11 @@ The object labels of the found items are returned as list." (error 'wrong-type-argument (car attributes))) (unless (stringp (cadr attributes)) (error 'wrong-type-argument (cadr attributes))) - (setq props (add-to-list - 'props + (setq props (append + props (list :dict-entry (substring (symbol-name (car attributes)) 1) - (cadr attributes)) - 'append) + (cadr attributes))) attributes (cddr attributes))) ;; Search. The result is a list of object paths. (setq result @@ -649,12 +648,11 @@ The object path of the created item is returned." (error 'wrong-type-argument (car attributes))) (unless (stringp (cadr attributes)) (error 'wrong-type-argument (cadr attributes))) - (setq props (add-to-list - 'props + (setq props (append + props (list :dict-entry (substring (symbol-name (car attributes)) 1) - (cadr attributes)) - 'append) + (cadr attributes))) attributes (cddr attributes))) ;; Create the item. (setq result @@ -782,8 +780,7 @@ to their attributes." (defun secrets-show-collections (&optional _ignore _noconfirm) "Show all available collections." - (let ((inhibit-read-only t) - (alias (secrets-get-alias "default"))) + (let ((inhibit-read-only t)) (erase-buffer) (tree-widget-set-theme "folder") (dolist (coll (secrets-list-collections)) @@ -852,7 +849,7 @@ to their attributes." "%v\n")))) attributes)))) -(defun secrets-tree-widget-after-toggle-function (widget &rest ignore) +(defun secrets-tree-widget-after-toggle-function (widget &rest _ignore) "Add a temporary widget to show the password." (dolist (child (widget-get widget :children)) (when (widget-member child :secret) @@ -864,7 +861,7 @@ to their attributes." "Show password"))) (widget-setup)) -(defun secrets-tree-widget-show-password (widget &rest ignore) +(defun secrets-tree-widget-show-password (widget &rest _ignore) "Show password, and remove temporary widget." (let ((parent (widget-get widget :parent))) (widget-put parent :secret nil) commit 7095596ac3ece75b7fb98be7a47e4715a54842c2 Author: Mark Oteiza Date: Fri Jul 8 21:10:32 2016 -0400 Derive secrets-mode from special-mode * lisp/net/secrets.el: Remove top-level secrets-mode hack. (secrets-mode-map): New variable. Add key bindings to n and p for navigating lines. (secrets-mode): Derive from special-mode. Remove keymap code and initialization code. Do not record undo information. Make secrets-show-collections the local revert-buffer-function. (secrets-show-collections): Change signature to satisfy revert-buffer. diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index 55d5f00..82c886d 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el @@ -734,33 +734,30 @@ If there is no such item, or the item doesn't own this attribute, return nil." ;;; Visualization. -(define-derived-mode secrets-mode nil "Secrets" +(defvar secrets-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map (make-composed-keymap special-mode-map widget-keymap)) + (define-key map "n" 'next-line) + (define-key map "p" 'previous-line) + (define-key map "z" 'kill-this-buffer) + map) + "Keymap used in `secrets-mode' buffers.") + +(define-derived-mode secrets-mode special-mode "Secrets" "Major mode for presenting password entries retrieved by Security Service. In this mode, widgets represent the search results. \\{secrets-mode-map}" - ;; Keymap. - (setq secrets-mode-map (copy-keymap special-mode-map)) - (set-keymap-parent secrets-mode-map widget-keymap) - (define-key secrets-mode-map "z" 'kill-this-buffer) - + (setq buffer-undo-list t) + (set (make-local-variable 'revert-buffer-function) + #'secrets-show-collections) ;; When we toggle, we must set temporary widgets. (set (make-local-variable 'tree-widget-after-toggle-functions) - '(secrets-tree-widget-after-toggle-function)) - - (when (not (called-interactively-p 'interactive)) - ;; Initialize buffer. - (setq buffer-read-only t) - (let ((inhibit-read-only t)) - (erase-buffer)))) + '(secrets-tree-widget-after-toggle-function))) ;; It doesn't make sense to call it interactively. (put 'secrets-mode 'disabled t) -;; The very first buffer created with `secrets-mode' does not have the -;; keymap etc. So we create a dummy buffer. Stupid. -(with-temp-buffer (secrets-mode)) - ;; We autoload `secrets-show-secrets' only on systems with D-Bus support. ;;;###autoload(when (featurep 'dbusbind) ;;;###autoload (autoload 'secrets-show-secrets "secrets" nil t)) @@ -783,7 +780,7 @@ to their attributes." (secrets-mode) (secrets-show-collections)))) -(defun secrets-show-collections () +(defun secrets-show-collections (&optional _ignore _noconfirm) "Show all available collections." (let ((inhibit-read-only t) (alias (secrets-get-alias "default"))) commit bdda4855c635ecf4135e23321bdba023e9ae65c9 Author: Mark Oteiza Date: Fri Jul 8 17:12:54 2016 -0400 Add a couple cells to lisp-prettify-symbols-alist * lisp/emacs-lisp/lisp-mode.el (lisp-prettify-symbols-alist): Add "sqrt" and "not". diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index a277d7a..ee3bda9 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -168,7 +168,10 @@ (defvar lisp-doc-string-elt-property 'doc-string-elt "The symbol property that holds the docstring position info.") -(defconst lisp-prettify-symbols-alist '(("lambda" . ?λ)) +(defconst lisp-prettify-symbols-alist + '(("lambda" . ?λ) + ("sqrt" . ?√) + ("not" . ?¬)) "Alist of symbol/\"pretty\" characters to be displayed.") ;;;; Font-lock support. commit 5deebc3c914c86e84d11661a7877c00b2d7fddd1 Author: Michael Albinus Date: Fri Jul 8 22:44:11 2016 +0200 Detect remote uid and gid in tramp-gvfs.el * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name) (tramp-gvfs-handler-mounted-unmounted) (tramp-gvfs-connection-mounted-p): Make "default-location" a connection property. (tramp-gvfs-get-remote-uid, tramp-gvfs-get-remote-gid): New defuns. (tramp-gvfs-maybe-open-connection): Use them. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 5afd290..038bb53 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -803,7 +803,7 @@ file names." (tramp-gvfs-maybe-open-connection (vector method user host "/" hop))) (setq localname (replace-match - (tramp-get-file-property v "/" "default-location" "~") + (tramp-get-connection-property v "default-location" "~") nil t localname 1))) ;; Tilde expansion is not possible. (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) @@ -1418,8 +1418,8 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"." (unless (string-equal prefix "/") (tramp-set-file-property v "/" "prefix" prefix)) (tramp-set-file-property v "/" "fuse-mountpoint" fuse-mountpoint) - (tramp-set-file-property - v "/" "default-location" default-location))))))) + (tramp-set-connection-property + v "default-location" default-location))))))) (when tramp-gvfs-enabled (dbus-register-signal @@ -1505,7 +1505,8 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"." (unless (string-equal prefix "/") (tramp-set-file-property vec "/" "prefix" prefix)) (tramp-set-file-property vec "/" "fuse-mountpoint" fuse-mountpoint) - (tramp-set-file-property vec "/" "default-location" default-location) + (tramp-set-connection-property + vec "default-location" default-location) (throw 'mounted t))))))) (defun tramp-gvfs-mount-spec-entry (key value) @@ -1571,6 +1572,41 @@ It was \"a(say)\", but has changed to \"a{sv})\"." ;; Connection functions. +(defun tramp-gvfs-get-remote-uid (vec id-format) + "The uid of the remote connection VEC, in ID-FORMAT. +ID-FORMAT valid values are `string' and `integer'." + (with-tramp-connection-property vec (format "uid-%s" id-format) + (let ((method (tramp-file-name-method vec)) + (user (tramp-file-name-user vec)) + (host (tramp-file-name-host vec)) + (localname + (tramp-get-connection-property vec "default-location" nil))) + (cond + ((and user (equal id-format 'string)) user) + (localname + (nth 2 (file-attributes + (tramp-make-tramp-file-name method user host localname) + id-format))) + ((equal id-format 'integer) tramp-unknown-id-integer) + ((equal id-format 'string) tramp-unknown-id-string))))) + +(defun tramp-gvfs-get-remote-gid (vec id-format) + "The gid of the remote connection VEC, in ID-FORMAT. +ID-FORMAT valid values are `string' and `integer'." + (with-tramp-connection-property vec (format "gid-%s" id-format) + (let ((method (tramp-file-name-method vec)) + (user (tramp-file-name-user vec)) + (host (tramp-file-name-host vec)) + (localname + (tramp-get-connection-property vec "default-location" nil))) + (cond + (localname + (nth 3 (file-attributes + (tramp-make-tramp-file-name method user host localname) + id-format))) + ((equal id-format 'integer) tramp-unknown-id-integer) + ((equal id-format 'string) tramp-unknown-id-string))))) + (defun tramp-gvfs-maybe-open-connection (vec) "Maybe open a connection VEC. Does not do anything if a connection is already open, but re-opens the @@ -1600,14 +1636,14 @@ connection if a previous connection has died for some reason." (tramp-gvfs-object-path (tramp-make-tramp-file-name method user host "")))) - (when (and (string-equal method "smb") - (string-equal localname "/")) - (tramp-error vec 'file-error "Filename must contain a Windows share")) - (when (and (string-equal method "afp") (string-equal localname "/")) (tramp-error vec 'file-error "Filename must contain an AFP volume")) + (when (and (string-equal method "smb") + (string-equal localname "/")) + (tramp-error vec 'file-error "Filename must contain a Windows share")) + (with-tramp-progress-reporter vec 3 (if (zerop (length user)) @@ -1680,16 +1716,15 @@ connection if a previous connection has died for some reason." (tramp-get-connection-process vec) "connected" t)))) ;; In `tramp-check-cached-permissions', the connection properties - ;; {uig,gid}-{integer,string} are used. We set them to their local - ;; counterparts. - (with-tramp-connection-property - vec "uid-integer" (tramp-get-local-uid 'integer)) - (with-tramp-connection-property - vec "gid-integer" (tramp-get-local-gid 'integer)) - (with-tramp-connection-property - vec "uid-string" (tramp-get-local-uid 'string)) - (with-tramp-connection-property - vec "gid-string" (tramp-get-local-gid 'string))) + ;; {uig,gid}-{integer,string} are used. We set them to proper values. + (unless (tramp-get-connection-property vec "uid-integer" nil) + (tramp-gvfs-get-remote-uid vec 'integer)) + (unless (tramp-get-connection-property vec "gid-integer" nil) + (tramp-gvfs-get-remote-gid vec 'integer)) + (unless (tramp-get-connection-property vec "uid-string" nil) + (tramp-gvfs-get-remote-uid vec 'string)) + (unless (tramp-get-connection-property vec "gid-string" nil) + (tramp-gvfs-get-remote-gid vec 'string))) (defun tramp-gvfs-send-command (vec command &rest args) "Send the COMMAND with its ARGS to connection VEC. commit d8a9c450cf4c575d21297885d6823920aec0482f Author: Eli Zaretskii Date: Fri Jul 8 22:34:34 2016 +0300 Yet another fix for copying properties by 'format' * src/textprop.c (extend_property_ranges): Accept an additional argument OLD_END, and only extend the end of a property range if its original end is at OLD_END; all the other ranges are left intact. (Bug#23897) * src/editfns.c (styled_format): Pass the original length of the string to 'extend_property_ranges'. * src/intervals.h (extend_property_ranges): Adjust prototype. * test/src/editfns-tests.el (format-properties): Add tests for bug#23897. diff --git a/src/editfns.c b/src/editfns.c index 0c01c74..73f0244 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4631,7 +4631,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) len = make_number (SCHARS (args[i])); Lisp_Object new_len = make_number (info[i].end - info[i].start); props = text_property_list (args[i], make_number (0), len, Qnil); - props = extend_property_ranges (props, new_len); + props = extend_property_ranges (props, len, new_len); /* If successive arguments have properties, be sure that the value of `composition' property be the copy. */ if (1 < i && info[i - 1].end) diff --git a/src/intervals.h b/src/intervals.h index 6a5a412..9a38d84 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -285,7 +285,7 @@ extern void set_text_properties_1 (Lisp_Object, Lisp_Object, Lisp_Object text_property_list (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); void add_text_properties_from_list (Lisp_Object, Lisp_Object, Lisp_Object); -Lisp_Object extend_property_ranges (Lisp_Object, Lisp_Object); +Lisp_Object extend_property_ranges (Lisp_Object, Lisp_Object, Lisp_Object); Lisp_Object get_char_property_and_overlay (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object*); extern int text_property_stickiness (Lisp_Object prop, Lisp_Object pos, diff --git a/src/textprop.c b/src/textprop.c index aabd567..7af8c69 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -2043,18 +2043,19 @@ add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object end-points to NEW_END. */ Lisp_Object -extend_property_ranges (Lisp_Object list, Lisp_Object new_end) +extend_property_ranges (Lisp_Object list, Lisp_Object old_end, Lisp_Object new_end) { Lisp_Object prev = Qnil, head = list; ptrdiff_t max = XINT (new_end); for (; CONSP (list); prev = list, list = XCDR (list)) { - Lisp_Object item, beg, end; + Lisp_Object item, beg; + ptrdiff_t end; item = XCAR (list); beg = XCAR (item); - end = XCAR (XCDR (item)); + end = XINT (XCAR (XCDR (item))); if (XINT (beg) >= max) { @@ -2065,12 +2066,14 @@ extend_property_ranges (Lisp_Object list, Lisp_Object new_end) else XSETCDR (prev, XCDR (list)); } - else if (XINT (end) != max) + else if ((end == XINT (old_end) && end != max) + || end > max) { /* Either the end-point is past the end of the new string, and we need to discard the properties past the new end, or the caller is extending the property range, and we - should update the end-point to reflect that. */ + should update all end-points that are on the old end of + the range to reflect that. */ XSETCAR (XCDR (item), new_end); } } diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index c515927..62d7bc4 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -54,4 +54,14 @@ ;; Bug #23859 (should (ert-equal-including-properties (format "%4s" (propertize "hi" 'face 'bold)) - #(" hi" 0 4 (face bold))))) + #(" hi" 0 4 (face bold)))) + + ;; Bug #23897 + (should (ert-equal-including-properties + (format "%s" (concat (propertize "01234" 'face 'bold) "56789")) + #("0123456789" 0 5 (face bold)))) + (should (ert-equal-including-properties + (format "%s" (concat (propertize "01" 'face 'bold) + (propertize "23" 'face 'underline) + "45")) + #("012345" 0 2 (face bold) 2 4 (face underline))))) commit d0c0b71d889ff223d2e5073b733f4047d541343b Author: Stephen Berman Date: Fri Jul 8 17:36:55 2016 +0200 Allow selecting region with mouse to move point to beginning * etc/NEWS: Mention new user option `mouse-select-region-move-to-beginning'. * doc/emacs/frames.texi (Mouse Commands): Add cross-reference to the following. (Word and Line Mouse): Describe how double-clicking mouse-1 to activate region and `mouse-select-region-move-to-beginning' affect point. * lisp/mouse.el (mouse-select-region-move-to-beginning): New defcustom. (mouse-set-point): Use it. (Bug#23478) diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 7e60062..03172b6 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -97,7 +97,8 @@ ring; on a second click, kill it (@code{mouse-save-then-kill}). invoked by clicking with the left mouse button, @kbd{mouse-1}, in the text area of a window. This moves point to the position where you clicked. If that window was not the selected window, it becomes the -selected window. +selected window. You can also activate a region by double-clicking +mouse-1 (@pxref{Word and Line Mouse}). @vindex x-mouse-click-focus-ignore-position Normally, if the frame you clicked in was not the selected frame, it @@ -215,7 +216,7 @@ also copied to the kill ring. @table @kbd @item Double-mouse-1 -Select the text around the word which you click on. +Select the text around the word or character which you click on. Double-clicking on a character with symbol syntax (such as underscore, in C mode) selects the symbol surrounding that character. @@ -226,6 +227,17 @@ ends. Double-clicking on a character with string-delimiter syntax constant (Emacs uses heuristics to figure out whether that character is the beginning or the end of it). +Double-clicking on the beginning of a parenthetical grouping or +beginning string-delimiter moves point to the end of the region, +scrolling the buffer display forward if necessary to show the new +location of point. Double-clicking on the end of a parenthetical +grouping or end string-delimiter keeps point at the end of the region +by default, so the beginning of the region will not be visible if it +is above the top of the window; setting the user option +@code{mouse-select-region-move-to-beginning} to non-nil changes this +to move point to the beginning of the region, scrolling the display +backward if necessary. + @item Double-Drag-mouse-1 Select the text you drag across, in the form of whole words. diff --git a/etc/NEWS b/etc/NEWS index 54b62f0..5472dd8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -56,6 +56,13 @@ affected by this, as SGI stopped supporting IRIX in December 2013. * Changes in Emacs 25.2 ++++ +** The new user option 'mouse-select-region-move-to-beginning' +controls the position of point when double-clicking mouse-1 on the end +of a parenthetical grouping or string-delimiter: the default value nil +keeps point at the end of the region, setting it to non-nil moves +point to the beginning of the region. + --- ** 'find-library-name' will now fall back on looking at 'load-history' to try to locate libraries that have been loaded with an explicit path diff --git a/lisp/mouse.el b/lisp/mouse.el index 53d5a22..135e1f5 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -538,15 +538,28 @@ must be one of the symbols `header', `mode', or `vertical'." (interactive "e") (mouse-drag-line start-event 'vertical)) +(defcustom mouse-select-region-move-to-beginning nil + "Effect of selecting a region extending backward from double click. +Nil means keep point at the position clicked (region end); +non-nil means move point to beginning of region." + :version "25.2" + :type '(choice (const :tag "Don't move point" nil) + (const :tag "Move point to beginning of region" t))) + (defun mouse-set-point (event &optional promote-to-region) "Move point to the position clicked on with the mouse. This should be bound to a mouse click event type. -If PROMOTE-TO-REGION is non-nil and event is a multiple-click, -select the corresponding element around point." +If PROMOTE-TO-REGION is non-nil and event is a multiple-click, select +the corresponding element around point, with the resulting position of +point determined by `mouse-select-region-move-to-beginning'." (interactive "e\np") (mouse-minibuffer-check event) (if (and promote-to-region (> (event-click-count event) 1)) - (mouse-set-region event) + (progn + (mouse-set-region event) + (when mouse-select-region-move-to-beginning + (when (> (posn-point (event-start event)) (region-beginning)) + (exchange-point-and-mark)))) ;; Use event-end in case called from mouse-drag-region. ;; If EVENT is a click, event-end and event-start give same value. (posn-set-point (event-end event)))) commit 381c6bbfb3eaa69ece0fce8dd92ccd3a1ef2729f Author: Stephen Berman Date: Fri Jul 8 17:22:14 2016 +0200 Fix menu bar breakage * lisp/menu-bar.el (menu-bar-showhide-scroll-bar-menu): Use backquoting to prevent void variable errors, and fix typo (bug#23918). diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index c4f094a..9f3156d 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -993,39 +993,39 @@ The selected font will be the default on both the existing and future frames." (vsb (frame-parameter nil 'vertical-scroll-bars)) (hsb (frame-parameter nil 'horizontal-scroll-bars))) (bindings--define-key menu [horizontal] - '(menu-item "Horizontal" + `(menu-item "Horizontal" menu-bar-horizontal-scroll-bar :help "Horizontal scroll bar" :visible (horizontal-scroll-bars-available-p) - :button (:radio . hsb))) + :button (:radio . ,hsb))) (bindings--define-key menu [none-horizontal] - '(menu-item "None-horizontal" + `(menu-item "None-horizontal" menu-bar-no-horizontal-scroll-bar :help "Turn off horizontal scroll bars" :visible (horizontal-scroll-bars-available-p) - :button (:radio . (not hsb)))) + :button (:radio . (not ,hsb)))) (bindings--define-key menu [right] - '(menu-item "On the Right" + `(menu-item "On the Right" menu-bar-right-scroll-bar :help "Scroll-bar on the right side" :visible (display-graphic-p) - :button (:radio . (eq vsb 'right)))) + :button (:radio . (eq ,vsb 'right)))) (bindings--define-key menu [left] - '(menu-item "On the Left" + `(menu-item "On the Left" menu-bar-left-scroll-bar :help "Scroll-bar on the left side" :visible (display-graphic-p) - :button (:radio . (eq vsb 'left)))) + :button (:radio . (eq ,vsb 'left)))) (bindings--define-key menu [none] - '(menu-item "None" + `(menu-item "None" menu-bar-no-scroll-bar :help "Turn off scroll-bar" :visible (display-graphic-p) - :button (:radio . (nilp vsb)))) + :button (:radio . (not ,vsb)))) menu)) (defun menu-bar-frame-for-menubar ()