emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pcase-memoize: equal first branch, yet different


From: Michael Heerdegen
Subject: pcase-memoize: equal first branch, yet different
Date: Fri, 01 Mar 2013 16:17:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi,

I get a not so useful message using `pcase' in the following scenario
using trunk:

I want to control "dired-sort-menu.el" from the mode-line in dired
buffers.  I want the mode-line to display diverse "ls" flags, the
enabled flags are highlighted, and clicking on a flag turns the sort
order.

I added this expression to the mode-line:

        '("D["
          (:eval (my-dired-flags-in-ml-flag-string "-"))
          (:eval (my-dired-flags-in-ml-flag-string "t"))
          (:eval (my-dired-flags-in-ml-flag-string "S"))
          "|"
          (:eval (my-dired-flags-in-ml-flag-string "r"))
          "]")

("D" stands for "dired") whereby

--8<---------------cut here---------------start------------->8---
(defun my-dired-flags-in-ml-flag-string (flag)
  "FLAG is a string of one char."
  `(:propertize ,flag
                face ,(if (pcase flag
                            (`"-" (not (dired-sort-menu-switch-p "[tSXUuc]")))
                            (_ (string-match-p flag dired-actual-switches)))
                          'mode-line-bold nil)
                help-echo ,(pcase flag
                             (`"-" "Sort by name")
                             (`"t" "Sort by time")
                             (`"S" "Sort by size")
                             (`"r" "Reverse sort order"))
                keymap ,(make-mode-line-mouse-map
                         'mouse-2
                         `(lambda (_event)
                            (interactive "e")
                            (pcase ,flag
                              (`"-" (dired-sort-menu-set-switches ""))
                              ((or `"t" `"S")
                               (dired-sort-menu-set-switches ,flag))
                              (`"r"
                              (dired-sort-menu-toggle-reverse)))))))
--8<---------------cut here---------------end--------------->8---


This works well, but every time I click on a flag, I get this message:

| pcase-memoize: equal first branch, yet different

What does that mean?  It's annoying.


Thanks,

Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]