I seem to have a problem with [:upper:] [:lower:] and Unicode characters.

This test fails:

(ert-deftest haskell-upper ()
  (set-buffer (get-buffer-create "*haskell-mode-buffer*"))
  (insert "Ż")
  (goto-char (point-min))
  (should (looking-at "[[:upper:]]")))

This one (surprisingly) succeeds:

(ert-deftest haskell-upper ()
  (set-buffer (get-buffer-create "*haskell-mode-buffer*"))
  (insert "Ż")
  (goto-char (point-min))
  (should (looking-at "[[:lower:]]")))

Note that

(message "%c" (char-table-range (current-case-table) ?Ż))

correctly returns


So case table seems to be setup correctly but regexp machinery does not pick this up. Note that this is a problem only when running in batch mode, in interactive mode it works as expected.

Is there some initialization code that needs to be called before using looking-at, char classes and Unicode?

My version of Emacs: Aquamacs 3.2 GNU Emacs (x86_64-apple-darwin14.0.0, NS apple-appkit-1343.14) of 2014-11-07 (Aquamacs-3.2) on watson.local

It also fails in the same way on Emacs 23.3.1 and Emacs

  • Where are these characters inserted ? – politza Jun 13 '15 at 11:52
  • Added the answer in the code: in temporary buffers created just for a test. – Gracjan Polak Jun 13 '15 at 18:10
  • Of course this'll only work if this buffer is indeed empty. – politza Jun 13 '15 at 18:44
  • It seems that case-fold-search has an effect on [:upper:]. – politza Jun 13 '15 at 18:51
  • case-fold-search is the problem. @politza if you make an answer I can accept it. – Gracjan Polak Jun 14 '15 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.