New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't get untabify on save to work #345
Comments
Original Redmine Comment The emacs docs say the variable name changed, try this - note the nil. (add-hook 'verilog-mode-hook '(lambda () |
Original Redmine Comment Yay! That works! |
Original Redmine Comment As per the recent discussion on this debbugs thread ( https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21492 ). @before-save-hook@ (a normal hook) is probably a better candidate than @write-file-functions@ (which is an abnormal hook and will abort the saving if any of the functions added to this hook returns a non-nil value). In this case, the untabify function does not return a nil value and will causing problem with file saving. And so that extra @nil@ had to be added. To simplify this, @before-save-hook@ can be used instead. I have also used a coding convention of NOT using lambdas and creating mini functions instead so that it is easier to remove hooks if needed and to review the hook values using @describe-variable@ function (Example: @c-h v before-save-hook@)
NOTE: The @my/untabify-buffer@ function is added locally to the @before-save-hook@ so that untabification does not happen for all the major modes. If you happen to add this to the @before-save-hook@ globally and edit Makefiles, it can mess up those as Makefiles need the TAB characters. |
Original Redmine Comment Wow - I just ran into the problem Kaushal mentioned of the previous solution affecting all modes and messing up makefiles. I did a google search on this and it brought me here - to my own question from 4 years ago. Can't beat that! Thanks, David |
Author Name: David Rogoff
Original Redmine Issue: 345 from https://www.veripool.org
Original Date: 2011-05-10
To follow my groups coding standard, I need to make sure I remove tabs from my code. I tried the following from the FAQ at verilog.com:
(add-hook 'verilog-mode-hook '(lambda ()
(add-hook 'local-write-file-hooks
(lambda() (untabify (point-min) (point-max))))))
However, it doesn't seem to work. I'm using "gnu" emacs 23.3 on Linux and I'm not that fluent in elisp and add-hook.
Any suggestions?
The text was updated successfully, but these errors were encountered: