indentation

How to change indentation in text-mode for emacs

时光毁灭记忆、已成空白 提交于 2019-12-21 04:21:12
问题 I'm in text mode and want my tab key to indent a line to two spaces. The file looks like this: Line one Line two The cursor is situated before the 'L' : "Line two", and I hit TAB and it gets indented 6 spaces as opposed to the desired 2 spaces. Actions I've tried: I've tried updating the variable: tab-stop-list (setq tab-stop-list '(2 4 6 8 10 12 14 16)) I've tried adding a text-mode-hook (add-hook 'text-mode-hook '(lambda () (setq tab-width 2))) 回答1: Add this to your .emacs : (add-hook 'text

How to change indentation in text-mode for emacs

半腔热情 提交于 2019-12-21 04:21:03
问题 I'm in text mode and want my tab key to indent a line to two spaces. The file looks like this: Line one Line two The cursor is situated before the 'L' : "Line two", and I hit TAB and it gets indented 6 spaces as opposed to the desired 2 spaces. Actions I've tried: I've tried updating the variable: tab-stop-list (setq tab-stop-list '(2 4 6 8 10 12 14 16)) I've tried adding a text-mode-hook (add-hook 'text-mode-hook '(lambda () (setq tab-width 2))) 回答1: Add this to your .emacs : (add-hook 'text

UITableViewCell in ios7 now has gaps on left and right

寵の児 提交于 2019-12-21 03:58:13
问题 I have a UITableView where, in ios6, my custom cell stretched completely to the left and right sides of the screen. So my square image on the left of the cell was hard up against the phone screen. However, now in ios7, there is a small gap appearing on the left hand side so the image is now away from the side and slightly overlaps my text within the cell. This also seems to be happening in other apps I have that I am now viewing in ios7 - all have a gap on the left and perhaps the right as

Eclipse: Lining up function arguments vertically

陌路散爱 提交于 2019-12-21 03:14:20
问题 I'm running Eclipse 3.7.2 on Windows 7 professional. If I type a method declaration like this: private void processCode(String codename, boolean doSomethingElse, int num_of_repeats){ } Then hit Ctrl + I with the whole file selected, Eclipse will mess up the alignment of the function arguments like this private void processCode(String codename, boolean doSomethingElse, int num_of_repeats){ } How can I get Eclipse to stop doing that? 回答1: Follow these steps to achieve what you want: Open the

Vim formatting using gg=G with xml

可紊 提交于 2019-12-20 13:59:09
问题 I have a correctly formatted xml file, and following the command given as an answer here: How can I autoformat/indent C code in vim? I am trying to auto indent my file to display correct nesting. Before I tried to use this command I set the file type to xml using :set ft=xml as the file I started with has an extension of .mm , and also :set nowrap . Here is my ~/.vimrc file: syntax on set history=1000 set smartindent set tabstop=2 set shiftwidth=2 set expandtab How come when I issue gg=G , I

Vim formatting using gg=G with xml

独自空忆成欢 提交于 2019-12-20 13:59:07
问题 I have a correctly formatted xml file, and following the command given as an answer here: How can I autoformat/indent C code in vim? I am trying to auto indent my file to display correct nesting. Before I tried to use this command I set the file type to xml using :set ft=xml as the file I started with has an extension of .mm , and also :set nowrap . Here is my ~/.vimrc file: syntax on set history=1000 set smartindent set tabstop=2 set shiftwidth=2 set expandtab How come when I issue gg=G , I

emacs 23 python.el auto-indent style — can this be configured?

自作多情 提交于 2019-12-20 10:37:05
问题 I have been using emacs 23 (python.el) for just over a month now and I'm unhappy with the default auto-indentation settings. Currently, my Python files are auto-indented as follows: x = a_function_with_dict_parameter({ 'test' : 'Here is a value', 'second' : 'Another value', }) a_function_with_multiline_parameters(on='First', line='Line', now_on='Second', next_line='Line', next='Third', finally='Line') I would prefer if I could set the auto-indentation settings so the same code could easily be

Improved tab in Emacs

折月煮酒 提交于 2019-12-20 10:27:13
问题 I want to override the bad default tabbing scheme in emacs so that it will work like most other editors (eclipse, notepad++). I want to set it so that regardless of mode, tab will insert a tab, and pressing enter will keep me at my current tab depth. I tried this, but it does nothing: (global-set-key (kbd "TAB") 'tab-to-tab-stop) (setq default-tab-width 4) ;; 8 is way too many 回答1: To make the Enter key take you to the next line and indent it automatically, you can put (global-set-key (kbd

Why is indentation in empty lines bad?

巧了我就是萌 提交于 2019-12-20 10:18:50
问题 Every FOSS project I know has rules against trailing whitespace in code. But I think it's very natural to continue the current indentation on the next line: int main() { ....int a = 42; .... ....return a; } But git for instance throws warnings anyway. So my question is: Why are those tabs inside the current indentation bad? I'm not looking for answers like "It's always done this way". Let's assume indentation is done consistently in the whole project in question. 回答1: It is probably because

Is it bad style to use return at the beginning of a function to avoid doing unnecessary work? [closed]

狂风中的少年 提交于 2019-12-20 05:52:14
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Say we have a function foo(), and a bool bar. The work foo does is of no use if bar is false. What is the most proper way to write foo