How to enable indentation on Emacs in web-mode? - emacs

I'm currently using GNU Emacs 24.3.1 with web-mode enabled. Everything works just fine but Tab key doesn't work like the way it used to. Indentation feature of web-mode also doesn't work perfectly. How can I configure my Emacs to enable Tab key work it just like before?

I am the author of web-mode.
Could give examples of indentation issues ?
Moreover "Tab key doesn't work like the way it used to" does not mean anything. Could you elaborate ?

Related

How to customize vrapper block indentation?

I know it is possible to increase or decrease indentation of a block using n>> like in Vim. This used to work on Vrapper in my environment until recently, but now it is no longer smart, converting tabs to spaces, and not respecting my default tab width.
I have tried uninstalling and reinstalling the plugin, and making .vrapperrc look similar to my .vimrc. Neither attempts made any difference.
A friend helped out with a suggestion that worked. It had nothing to do with smartindent, or shiftwidth. Apparently :set expandtab is the default setting. Using :set noexpandtab took care of this for me.
(I use tabs, not spaces, let us not do that war. :-)
I have found similar behaviour with vrapper. As #romainl suggested, I took a look at the issue tracker and found this issue.
Using set sw=4 resolved my indenting issue.
I also use Eclipse + pydev + vrapper, set sw=4 is the perfect solution to the problem. And tabs is not recommended by python.

Some standard Emacs keybindings don't work on my Linux box

On my macbook everything worked nicely, but on my Archlinux box, with dwm as a window manager, the following keybindings don't work:
M-m
M-<
M->
It is kind of a pain to work without these bindings. I should note that many other Meta key bindings work fine.
Does anyone know how to fix this?
They're probably being intercepted by your window manager. I don't know dwm, but I'd try googling "dwm resetting keyboard shortcuts".
(A quick read of the results suggests dwm may need to be recompiled to do this, see http://dwm.suckless.org/)

How to change the meta key in Emacs?

I've just started to put in the time to get to learn emacs. By default my meta key is bound to Esc, and I'm finding that really inconvenient. I read somewhere however that it's not a good idea to change the binding to Alt. Is that true? If not, how could I go about doing that?
It's bound to Alt by default for me, and I have no problems with that. Are you on a Mac perhaps? There it is bound to one of the other keys like option.
If you are on a mac, the way to change the key will probably vary based on which version of Emacs you're using--e.g., I think changing it in the terminal would be different than changing it on one of the windowed varieties.
Another thing to try: http://www.jwz.org/xkeycaps/
Look through the keyboard layout with this and see if any key is assigned to Meta. If not, try assigning it; otherwise try changing it. I haven't actually tried this, but it looks promising.
If you are using a Mac, you can follow the directions from here:
"If you do not want to use the Esc key, you can specify a key to use as Meta. To specify a Meta key, select the Emulation tab of the Editor Preferences dialog."
You can then select to use Alt or Command as your Meta key.
I'm guessing that you're on Mac, because I had the same problem. This is how I fixed it:
Open Terminal
Open up the preferences
Open up the "Profiles" tab and choose the "Keyboard" tab with your current profile selected
Below the long scroll box are a couple check boxes. Check "Use Option as Meta key."
I'm using OS X 10.11.5, so I don't know about older versions of Terminal. I imagine that it would be similar.
For me, on my mac, it was bound to Alt by default, but I found it anoying because Alt is used for some special characters on Mac.
I added these lines on my .emacs
(setq mac-function-modifier 'meta)
(setq mac-option-modifier nil)
Thus in your case, you would have to add this in your .emacs (I tried this solution, and it worked for me)
(setq mac-option-modifier 'meta) ; set alt-key to meta
(setq mac-escape-modifier nil) ; set esc-key to nil
I had to do this for emacs while remotely connected to my raspberry pi.
Go to terminal.
type:
xmodmap -e "keysym Alt_L = Meta_L Alt_L"
This was suggested in xmodmap's manual
man xmodmap
Hope that helps :) I'm pretty new to this though so someone else may want to comment.

Icons in dired mode for Emacs

I would like to use the dired mode of emacs as my file browser. I am very much addicted to see an icon for file/folder rather that to see the extension and color. The icons give me a very quick visual feedback. I have searched the web for display of icons in dired but found none. So I wonder whether it is even possible to do this and if yes how?
To put my question clearly
How can I display icons for files and folders in dired mode of Emacs?
all-the-icons-dired is a more current solution. Another option that looks quite nice is to use treemacs-icons-dired
I just switched to treemacs-icons-dired and recommend it. Simply install the package and add a mode hook like:
(add-hook 'dired-mode-hook 'treemacs-icons-dired-mode)
If you are using Windows, you can try dired-dispicon.el.
Get the relevant files from here.
See http://wiki.gohome.org/teranisi/?EmacsOnWindows for what it looks like. Note that you will probably need a version of emacs that supports images (e.g. for Windows you could try EmacsW32).
Use the dired-icon extension, which works for GTK (on Linux).
Disclaimer: I'm the author of the extension.

Mac OS X Emacs Does Not Highlight Comments Correctly

I'm pretty old school sometimes and I like working with Emacs in my terminal. (I work with IDEs all the time. But sometimes, when in the privacy of my own home, I just like a text editor a terminal and a beer)
However, the default Emacs that comes with OS X does not seem to highlight the comments in font-lock-mode. I've seen this behavior in both Python and C mode.
I've already searched some forums and I found one post where the person was having the same problem as me:
http://forums.macosxhints.com/showthread.php?p=512361
Is is there any way to fix this problem?
I had this exact same problem. The solution is to change the color used for the comment face as follows:
(set-face-foreground 'font-lock-comment-face "red")
Or, if you only want to do this for certain modes:
;;; Only do this for the common C mode (C, C++, Objective-C)
(add-hook 'c-mode-common-hook #'(lambda () (set-face-foreground 'font-lock-comment-face "red")))
For more information on faces, see http://www.gnu.org/software/emacs/manual/html_node/emacs/Faces.html.
I'm not sure exactly how to fix it, but I'm fairly certain there's something you can put in the .emacs file. In fact, I think I've done that before. I'll look for my file and let you know what I can find.
I'll try and get you my .emacs file when I get home from work tonight.
[edit] I've looked and looked, and can't find a .emacs file on either system that I use, and on my OS X install (Leopard default), it looks like it does it correctly by default. I did some research here, and it looks like the default installations no longer use .emacs files, because there's folks like me that mess around with them and break things, and they got tired of having to help us fix it. But, there is a set of menus that will let you tweak things. Start by typing "M-x customize RET", where M is the meta character (on my OSX install, this is the esc key. Don't hold it down, just type it like a regular character. That'll get you into a menu of stuff you can change. I didn't poke around too much, so I'm not sure where in the menu you'll find what you're looking for. Sorry I couldn't be more help.
In my experience this is usually related to a unpaired quote (single-, double-, or otherwise) somewhere in an existing comment.
Hunt those occurences down and eradicate them in your source code (or if you are more ambitious, see if you can update the fontlock code in your major modes' emacs source code)
When I have encountered this in editting Perl in emacs, I often switch major modes to cperl-mode as it typically handles parsing the perl better than the default perl-mode.