[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50067: Context menus
From: |
Juri Linkov |
Subject: |
bug#50067: Context menus |
Date: |
Wed, 01 Sep 2021 10:12:54 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> >>> ** no multiple horizontal lines
>> >>>
>> >>> Sometimes I see double lines on the context menu. I think that there is
>> >>> no useful case to have double lines. To allow only one horizontal line
>> >>> would look cool.
>> >>
>> >> Right, double separators should be removed.
>> >
>> > OK.
>>
>> This is not easy to do. Because there are menu-items
>> that use the filter :visible, e.g.:
>
> Can I ask why do we need the separators in the context menus? Why not
> remove them all, unconditionally?
The separators are of great help to provide visual cues for groups
of objects. All menus on the menu-bar in Emacs use separators.
Anyway, this is implemented now:
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 7d3ed9a0e4..8ac22a07c9 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -315,7 +315,14 @@ context-menu-map
(lambda (fun)
(setq menu (funcall fun menu))
nil))))
- ;; TODO: remove double separators
+ ;; Remove double separators
+ (let ((l menu))
+ (while l
+ (when (and (equal (cdr-safe (car l)) menu-bar-separator)
+ (equal (cdr-safe (cadr l)) menu-bar-separator))
+ (setcdr l (cddr l)))
+ (setq l (cdr l))))
+
(when (functionp context-menu-filter-function)
(setq menu (funcall context-menu-filter-function menu)))
menu))