Edit remote files in Emacs with Tramp mode

https://www.gnu.org/software/tramp/ TRAMP stands for “Transparent Remote (file) Access, Multiple Protocol”. A remote file name always looks like /method:user@host:/path/to/file. Examples: Opening a remote file via ssh C-x C-f /ssh:user@host:/path/to/file Use sudo to open a file with root permissions C-x C-f /sudo:root:/path/to/file sudo uses root as the default user name, therefore it can also be opened as /sudo::/path/to/file Access a remote file using the SMB protocol C-x C-f /smb:user%domain@host:/path/to/file

June 3, 2024 · Fernando Costa Bertoldi

whitespace-mode

TIL: use whitespace-mode from emacs to check trailing whitespace in files. Useful in some situations, i.e. in shell scripts to guarantee that line continuation (backslash) don’t have trailing whitespace, which is a problem.

April 12, 2022 · Fernando Costa Bertoldi

Programatically change the programs associated with a file extension in Windows

https://ss64.com/nt/ftype.html https://ss64.com/nt/assoc.html https://www.emacswiki.org/emacs/WThirtyTwoFileAssociations To use the emacs client as the editor associated with certain file extension, use the ftype and assoc commands. Run the followin as admin: ftype Emacs.org=<emacs-path>\emacsclientw -na runemacs "%1" ftype Emacs.el=<emacs-path>\emacsclientw -na runemacs "%1" rem ftype txtfile=<emacs-path>\emacsclientw -na runemacs "%1" assoc .txt=txtfile assoc .org=Emacs.org assoc .el=Emacs.el To add the option to open a file with emacs, edit the following registry file, substituting the .el extension with one you want to open with Emacs, and import in regedit:...

Fernando Costa Bertoldi

Run emacs server in Windows

We can also run the emacs server as a daemon on user init in Windows. We take advantage of the user startup folder, where you can put a batch script or shortcut which will be executed on user login. Go to the Roaming startup folder by either opening Run Command (Win+R) and typing shell:startup, or opening the Windows Explorer (Win+E) and typing shell:startup in the address bar Create a shortcup by right-clicking, new->shortcut....

Fernando Costa Bertoldi