unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* `ibuffer-saved-filter-groups` case sensitive?
@ 2016-10-24 17:06 zimoun
  2017-04-07  9:37 ` zimoun
  0 siblings, 1 reply; 6+ messages in thread
From: zimoun @ 2016-10-24 17:06 UTC (permalink / raw)
  To: help-gnu-emacs

Dear,

I do not know if this behavior is expected or I perhaps miss a point.
Ah, I am running Emacs 24.5.1 packaged by Debian (testing) and I have
not tried Emacs 25 yet.

I would like to filter IBuffer in Gnus-style grouping. Then, I am not
able to split the buffer names between Upper-case and lower-case.

If I understand well, in this case the regexp is case insensitive.

Using this minimal snippet (saved in `ibuf.el`):

(setq ibuffer-saved-filter-groups
      (quote (("default"
               ("lower" (name . "[:lower:]"))
               ("Upper" (name . "[:upper]"))))))
(add-hook 'ibuffer-mode-hook
         (lambda ()
           (ibuffer-switch-to-saved-filter-groups "default")))

Then, running `emacs -Q -l ibuf.el`, for example, the buffer
*Messages* is in the lower-group.

(note that if you switch the "filters", then *scratch* appears in Upper-group)

To be concrete, I do not know to locally turn `case-fold-search` to
`nil`, or something in this flavor I guess.


Thank you in advance to any suggestion.

--simon



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: `ibuffer-saved-filter-groups` case sensitive?
  2016-10-24 17:06 `ibuffer-saved-filter-groups` case sensitive? zimoun
@ 2017-04-07  9:37 ` zimoun
  2017-04-07 11:06   ` hector
  0 siblings, 1 reply; 6+ messages in thread
From: zimoun @ 2017-04-07  9:37 UTC (permalink / raw)
  To: help-gnu-emacs

Dear community,

Ping.


Is it a bug ?
Or do I miss a point ?


Thank you for any suggestion.

All the best,
-simon

On 24 October 2016 at 19:06, zimoun <zimon.toutoune@gmail.com> wrote:
> Dear,
>
> I do not know if this behavior is expected or I perhaps miss a point.
> Ah, I am running Emacs 24.5.1 packaged by Debian (testing) and I have
> not tried Emacs 25 yet.
>
> I would like to filter IBuffer in Gnus-style grouping. Then, I am not
> able to split the buffer names between Upper-case and lower-case.
>
> If I understand well, in this case the regexp is case insensitive.
>
> Using this minimal snippet (saved in `ibuf.el`):
>
> (setq ibuffer-saved-filter-groups
>       (quote (("default"
>                ("lower" (name . "[:lower:]"))
>                ("Upper" (name . "[:upper]"))))))
> (add-hook 'ibuffer-mode-hook
>          (lambda ()
>            (ibuffer-switch-to-saved-filter-groups "default")))
>
> Then, running `emacs -Q -l ibuf.el`, for example, the buffer
> *Messages* is in the lower-group.
>
> (note that if you switch the "filters", then *scratch* appears in Upper-group)
>
> To be concrete, I do not know to locally turn `case-fold-search` to
> `nil`, or something in this flavor I guess.
>
>
> Thank you in advance to any suggestion.
>
> --simon



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: `ibuffer-saved-filter-groups` case sensitive?
  2017-04-07  9:37 ` zimoun
@ 2017-04-07 11:06   ` hector
  2017-04-07 12:47     ` zimoun
  0 siblings, 1 reply; 6+ messages in thread
From: hector @ 2017-04-07 11:06 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: zimon.toutoune

On Fri, Apr 07, 2017 at 11:37:15AM +0200, zimoun wrote:
> Dear community,
> 
> Ping.

Pong :-)

On 24 October 2016 at 19:06, zimoun <zimon.toutoune@gmail.com> wrote:
> Dear,
>
> I do not know if this behavior is expected or I perhaps miss a point.
> Ah, I am running Emacs 24.5.1 packaged by Debian (testing) and I have
> not tried Emacs 25 yet.
>
> I would like to filter IBuffer in Gnus-style grouping. Then, I am not
> able to split the buffer names between Upper-case and lower-case.
>
> If I understand well, in this case the regexp is case insensitive.

If it uses string-match it depends on the value of case-fold-search.
Try adding:

(make-local-variable 'case-fold-search)
(setq case-fold-search nil)

> Using this minimal snippet (saved in `ibuf.el`):
>
> (setq ibuffer-saved-filter-groups
>       (quote (("default"
>                ("lower" (name . "[:lower:]"))
>                ("Upper" (name . "[:upper]"))))))
> (add-hook 'ibuffer-mode-hook
>          (lambda ()
>            (ibuffer-switch-to-saved-filter-groups "default")))
>

The regexps are not anchored. "[[:lower:]]" would match any buffer with
a lower case letter.
If I'm not wrong, the right syntax would be: "[[:lower:]]" and "[[:upper:]]".

> Then, running `emacs -Q -l ibuf.el`, for example, the buffer
> *Messages* is in the lower-group.
>
> (note that if you switch the "filters", then *scratch* appears in Upper-group)
>
> To be concrete, I do not know to locally turn `case-fold-search` to
> `nil`, or something in this flavor I guess.
>
>
> Thank you in advance to any suggestion.

I hope that helps.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: `ibuffer-saved-filter-groups` case sensitive?
  2017-04-07 11:06   ` hector
@ 2017-04-07 12:47     ` zimoun
  2017-04-07 17:03       ` Michael Heerdegen
  0 siblings, 1 reply; 6+ messages in thread
From: zimoun @ 2017-04-07 12:47 UTC (permalink / raw)
  To: hector; +Cc: help-gnu-emacs

Thank you for the quick pong reply. ;-)


>> I would like to filter IBuffer in Gnus-style grouping. Then, I am not
>> able to split the buffer names between Upper-case and lower-case.
>>
>> If I understand well, in this case the regexp is case insensitive.
>
> If it uses string-match it depends on the value of case-fold-search.
> Try adding:
>
> (make-local-variable 'case-fold-search)
> (setq case-fold-search nil)

Thank you for the tip.
However, I have tried different  ways to use it and no one works.
Any advice ?

>> Using this minimal snippet (saved in `ibuf.el`):
>>
>> (setq ibuffer-saved-filter-groups
>>       (quote (("default"
>>                ("lower" (name . "[:lower:]"))
>>                ("Upper" (name . "[:upper]"))))))
>> (add-hook 'ibuffer-mode-hook
>>          (lambda ()
>>            (ibuffer-switch-to-saved-filter-groups "default")))
>>
>
> The regexps are not anchored. "[[:lower:]]" would match any buffer with
> a lower case letter.
> If I'm not wrong, the right syntax would be: "[[:lower:]]" and "[[:upper:]]".

Hum?
ok, but it does not change anything.


> I hope that helps.

Thank you for your suggestions and I have learned
`make-local-variable' that I did not know.


All the best
-simon



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: `ibuffer-saved-filter-groups` case sensitive?
  2017-04-07 12:47     ` zimoun
@ 2017-04-07 17:03       ` Michael Heerdegen
  2017-04-08 11:03         ` zimoun
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2017-04-07 17:03 UTC (permalink / raw)
  To: zimoun; +Cc: help-gnu-emacs, hector

zimoun <zimon.toutoune@gmail.com> writes:

> Thank you for the tip.
> However, I have tried different  ways to use it and no one works.
> Any advice ?

This works for me:

#+begin_src emacs-lisp
 (setq ibuffer-saved-filter-groups
       (quote (("default"
                ("lower" (name . "\\`[^[:upper:]]*\\'"))
                ("Upper" (name . "[[:upper:]]"))))))
 (add-hook 'ibuffer-mode-hook
          (lambda ()
            (setq-local case-fold-search nil)
            (ibuffer-switch-to-saved-filter-groups "default")))
#+end_src

"[[:lower:]]" would match names containing at least one lowercase
letter.  That's not what you want.  The regexp used above for "lower"
matches any string not containing any uppercase letter.


Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: `ibuffer-saved-filter-groups` case sensitive?
  2017-04-07 17:03       ` Michael Heerdegen
@ 2017-04-08 11:03         ` zimoun
  0 siblings, 0 replies; 6+ messages in thread
From: zimoun @ 2017-04-08 11:03 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs, hector

Hi!

Thank you !
Both of you did my week-end :-)

Ah, I have missed this point about `[[:lower::]'. Thank you for the
explanations.


All the best,
-simon

On 7 April 2017 at 19:03, Michael Heerdegen <michael_heerdegen@web.de> wrote:
> zimoun <zimon.toutoune@gmail.com> writes:
>
>> Thank you for the tip.
>> However, I have tried different  ways to use it and no one works.
>> Any advice ?
>
> This works for me:
>
> #+begin_src emacs-lisp
>  (setq ibuffer-saved-filter-groups
>        (quote (("default"
>                 ("lower" (name . "\\`[^[:upper:]]*\\'"))
>                 ("Upper" (name . "[[:upper:]]"))))))
>  (add-hook 'ibuffer-mode-hook
>           (lambda ()
>             (setq-local case-fold-search nil)
>             (ibuffer-switch-to-saved-filter-groups "default")))
> #+end_src
>
> "[[:lower:]]" would match names containing at least one lowercase
> letter.  That's not what you want.  The regexp used above for "lower"
> matches any string not containing any uppercase letter.
>
>
> Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-08 11:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-24 17:06 `ibuffer-saved-filter-groups` case sensitive? zimoun
2017-04-07  9:37 ` zimoun
2017-04-07 11:06   ` hector
2017-04-07 12:47     ` zimoun
2017-04-07 17:03       ` Michael Heerdegen
2017-04-08 11:03         ` zimoun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).