[cmake-developers] syntax of '_' should be treated as symbol
Guillaume Papin
guillaume.papin at parrot.com
Wed Nov 12 04:25:02 EST 2014
I tested your patch and that is indeed how I expect cmake-mode to work. The current behavior has always been surprising compared to other Emacs modes.
I hope this get added to CMake,
Guillaume
________________________________________
From: cmake-developers [cmake-developers-bounces at cmake.org] on behalf of Syohei Yoshida [syohex at gmail.com]
Sent: 12 November 2014 08:27
To: cmake-developers at cmake.org
Subject: Re: [cmake-developers] syntax of '_' should be treated as symbol
I created git animations about this patch. Please see them.
Original version does not stop at underscore by word commands such as
forward-word. On the other hands, fixed version stops at underscore.
This behavior is same as other major-modes.
[Original]
https://gist.github.com/syohex/a8a3899b3cd861584e2d#file-cmake-before-gif
[Apply this patch]
https://gist.github.com/syohex/a8a3899b3cd861584e2d#file-cmake-after-gif
2014-11-12 16:17 GMT+09:00 Syohei YOSHIDA <syohex at gmail.com>:
> Word commands, such as foward-word(M-f), backward-kill-word(M-backspace),
> don't work well like other major-modes if syntax of '_' is treated as "word".
> ---
> Auxiliary/cmake-mode.el | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
> index c8b9f8b..f1470f3 100644
> --- a/Auxiliary/cmake-mode.el
> +++ b/Auxiliary/cmake-mode.el
> @@ -202,7 +202,7 @@ the indentation. Otherwise it retains the same position on the line"
> ;; Keyword highlighting regex-to-face map.
> ;;
> (defconst cmake-font-lock-keywords
> - (list '("^[ \t]*\\(\\w+\\)[ \t]*(" 1 font-lock-function-name-face))
> + (list '("^[ \t]*\\([[:word:]_]+\\)[ \t]*(" 1 font-lock-function-name-face))
> "Highlighting expressions for CMAKE mode."
> )
>
> @@ -241,7 +241,6 @@ the indentation. Otherwise it retains the same position on the line"
> ; Create the syntax table
> (setq cmake-mode-syntax-table (make-syntax-table))
> (set-syntax-table cmake-mode-syntax-table)
> - (modify-syntax-entry ?_ "w" cmake-mode-syntax-table)
> (modify-syntax-entry ?\( "()" cmake-mode-syntax-table)
> (modify-syntax-entry ?\) ")(" cmake-mode-syntax-table)
> (modify-syntax-entry ?# "<" cmake-mode-syntax-table)
> --
> 2.1.0
>
--
Syohei YOSHIDA(syohex at gmail.com)
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers
More information about the cmake-developers
mailing list