[வியாழன் ஜனவரி 09, 2025] Ihor Radchenko wrote: Thanks for the review, and sorry for getting back so late.
>> +(defvar-local org-mouse--old-mouse-map (copy-keymap org-mouse-map)) >> ... >> + (when org-mouse-minor-mode >> + ;; Without `copy-keymap', later `org-defkey' calls modify the >> + ;; value of keymap `org-mouse--old-mouse-map' holds. >> + (setq org-mouse--old-mouse-map (copy-keymap org-mouse-map))) >> + (setq org-mouse-map (copy-keymap org-mouse--old-mouse-map)) >> + (org-defkey org-mouse-minor-mode-map [S-mouse-2] nil) >> + (org-defkey org-mouse-minor-mode-map [drag-mouse-3] nil) >> + (when org-mouse-minor-mode >> + (when (memq 'context-menu org-mouse-features) >> + (org-defkey org-mouse-map [mouse-3] nil) >> + (org-defkey org-mouse-map [C-drag-mouse-1] #'org-mouse-move-tree) >> + (org-defkey org-mouse-map [C-down-mouse-1] >> #'org-mouse-move-tree-start)) >> ... > > `org-mouse--old-mouse-map' is awkward. > May we use :enable + menu item instead? Hmm looking closely at the modifications org-mouse does to org-mouse-map, I see a severe interdependence between all the features in org-mouse-features. There's no way C-mouse-1 will move the trees with context-menu in the list [*] or drag-mouse-3 if move-tree is in the list if activate-stars is not enabled. This is making me rethink if it is worth changing the org-mouse-map and why not just do (when (memq 'activate-stars org-mouse-features) (funcall fl-fun nil `((,org-outline-regexp 0 `(face org-link mouse-face highlight keymap ,(let ((map (make-sparse-keymap))) (set-keymap-parent map org-mouse-map) (when (memq 'move-tree org-mouse-features) (define-key map [C-drag-mouse-1] #'org-mouse-move-tree) ...))) 'prepend)))) and so on for the rest? This would avoid the need for the org-mouse--old-mouse-map stub.