How to disable flycheck warning while editing emacs lisp scripts? - emacs

I am now engaged with emacs prelude and find everything nice. But
A lot of flycheck warnings are displayed while editing el file
and syntax coloring is overrided
Warnings like "the first line shoud be of form package --- summary"
How to turn off those warnings?

These are Checkdoc warnings. To disable these, add emacs-lisp-checkdoc to the option flycheck-disabled-checkers, either with the following code in your init file
(with-eval-after-load 'flycheck
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
or via the customize interface with M-x customize-variable RET flycheck-disabled-checkers.

If you wish to disable a particular Flycheck just for this one file, you can also use a file-local variable definition.
You can do this interactively while in the file's buffer by typing
M-x add-file-local-variable flycheck-disabled-checkers RET
(emacs-lisp-checkdoc)
which will add a local variables section to the end of the file.
;; Local Variables:
;; flycheck-disabled-checkers: (emacs-lisp-checkdoc)
;; End:
This is like customizing flycheck-disabled-checkers but only for the file.
This can also be customized on the level of the directory. http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Directory-Variables

Related

Emacs openfile in terminal don't load configuration correctly. But open file in emacs do load configuration correctly

Emacs openfile in terminal don't load configuration correctly. But open file in emacs do load configuration correctly.
I have tried several emacs configuration for cpp:
(eval-after-load "cc-vars" '(lambda() (c-set-style "linux")))
Another one
(add-hook 'c-mode-hook '(lambda() (c-set-style "linux")))
Another one
(eval-after-load "cc-vars" '(setq c-default-style "linux")))
If I type emacs filename they can't be loaded. It seems the emacs always load the default gnu style.
After I type M-x c-mode They can be load correctly. Or I open emacs in terminal and then C-x C-f load the file, those configuration will also be loaded.
Is there any reason for this?
I also tried putting
(c-set-style "linux")
in configuration directly.
They work with emacs filename. But when I open non cpp file there will be an error says can't apply c-set-style on that file.
From the CC-mode manual:
When you create a new buffer, its style will be set from c-default-style.
From the Emacs manual
You can also set the variable c-default-style to specify the default style for various major modes
From the documentation of the c-set-style function:
Set the current buffer to use the style STYLENAME.
This means that any call to c-set-style must ensure that the current buffer is the one you want to set the style for; placing such a call at the toplevel in your init file is then definitely a bad idea.
The simplest fix is just to put (setq c-default-style "linux") at the top level, and then wrap it up in an eval-after-load if you really need one. The variable is intended for this, and hooks should be reserved to control more precisely the style of the current file if you need it (as is suggested by c-default-style documentation).
It seems that for me, (eval-after-load "cc-vars" '(setq c-default-style "linux")) works fine: if I open any file covered by CC-mode, the Linux style is applied. Note that c-mode and CC modes are different things, that there exist the c-mode-hook, c++-mode-hook, c-mode-common-hook and they are all different and will run at different times.

Change emacs comment markers from ;; to //

When I am using Emacs to edit a ".s" file, I want to change the comment from ";;" to "//". I can't seem to find out how to change the comment identifiers?
For example, when I comment-region.
More information:
I appear to be in ASM-MODE which is the default mode for editing assembler files. I made sure that I was in asm-mode by
(setq auto-mode-alist
(append '(("\\.s$" . asm-mode)auto-mode-alist))
Because assembly programs typically use ; as the comment indicator, asm-mode uses this. However, for some reason I cannot figure the GNU assembler (GNU Binutils for Raspbian) 2.35.2 uses // or # or # for comments NOT a ;
Therefore, I would like to change the behaviour such that when I select a region and M-X comment-region it uses either // or # for comments. I cannot use the default comment character, I need to change it to either double-slashes // or an at symbol #
The question is really how do I go about changing the default comment character for in a mode?
Assuming that the major mode of the .s file is asm-mode, you can use the mode hook to tweak the comment start string:
(defun my/asm-comment-tweak ()
(setq-local comment-start "// "))
(eval-after-load "asm"
(add-hook 'asm-mode-hook #'my/asm-comment-tweak))
Adding the above to your init file should let you open a .s file, which will be in asm-mode. The last thing that is done by asm-mode is to run the mode hook which will call the function my/asm-comment-tweak: the function will set the buffer-local variable comment-start to the string you specified.
This pattern is very common: many problems in customizing emacs are solved in exactly the same way. You define a function that tweaks a variable and you arrange for the function to be called by the appropriate mode hook.

Emacs: auto-complete-mode on but no auto-suggestions showing (Emacs lisp mode)

I'm puzzled as to why nothing pops up (in Emacs lisp mode) when I begin typing a function name. For example, after typing (def on a new line, I would assume that auto-complete should be showing me a alist of options which includes defun. Am not sure how long the default delay is, but I waited for a few seconds and nothing happened. Any suggestions?
Details regarding my installation process:
Installed using package-install via Melpa
Added the following two lines to my init.el file:
(require 'auto-complete-config)
(ac-config-default)
Confirmed that load-path includes the folder containing the .el files associated with auto-complete. (I have it set-up to recursively add all folders under path/to/my/.emacs.d/.)
Confirmed (via describe-variable) that ac-dictionary-directories includes the correct directories when Emacs starts up. As reference, it includes the following two directories:
ac-dictionary-directories is a variable defined in 'auto-complete.el'.
Its value is ("/home/dchaudh/Dropbox/dchaudhUbuntu/emacs/.emacs.d/elpa/auto-complete-20140824.1658/dict")
Confirmed that auto-complete-mode is on when I open my init.el file, which obviously triggers emacs-lisp-mode (I can see Emacs Lisp in my mode line). The following is included in the summary of active modes (i.e., via describe-mode):
Global-Auto-Complete minor mode (no indicator)
Toggle Auto-Complete mode in all buffers.
With prefix ARG, enable Global-Auto-Complete mode if ARG is positive;
otherwise, disable it. If called from Lisp, enable the mode if
ARG is omitted or nil.
Not a direct answer, but company works fine out of the box in emacs-lisp-mode, so you might want to try that one.
In my experience, other modes (e.g. flyspell) can interfere with auto-complete operation. (There is a workaround for slyspell built into auto-complete but you have to activate it in your. emacs file.)
I'd suggest trying it with an empty. emacs and then gradually adding parts of your configuration back in. You should be able to find the problem that way.

Emacs org-mode export markdown

I have some weird behavior, I don't actually know if it's a bug or something else.
When I do C-c C-e the option to convert to markdown doesn't appear. Nonetheless I can type the option M-x org-md-export-as-markdown and after I do that, the option export to markdown appears in the C-c C-e menu.
Any Ideas?
If you are using Org-mode version 8.0 or later (check with M-x org-version), the export framework is broken up into several libraries that are not necessarily loaded by default.
Something like this in your Emacs configuration can load the Markdown exporter automatically with Org-mode:
(eval-after-load "org"
'(require 'ox-md nil t))
After emacs 25,you just need add a line in your emacs configuration file: .emacs
(require 'ox-md nil t)
M-x customize-variable <Ret> org-export-backends <Ret>
check option 'md', then save.

Emacs - how to install and use dired+?

I'm using GNU Emacs 24.2.1 on Windows 7.
I want to use the dired+ features, but I am not able to load them appropriately.
The file dired+.el exists in my lisp path.
I added the line (require 'dired+) in my configuration file which is loaded during Emacs' startup.
But when I type C-x d, it seems to me that the "normal" dired is loaded, not dired+.
How can I tell if I'm using dired+ or dired?
it looks like that:
I can use commands that start with diredp- however, so it seems that dired+ is somehow loaded, but e. g. I do not see the additional commands in the context menu available by right-clicking with the mouse which should allow me to open a directory in Windows explorer e. g. (like described here in the dired+ wiki: http://www.emacswiki.org/emacs/DiredPlus )
What am I doing wrong?
Judging by the comments in the header of dired+.el, dired+ does not augment the usual dired-mode display, instead you have to use dired+ specific entry points to enter the dired+ buffer.
;; Additional suggested key bindings:
;;
;; (define-key ctl-x-map "d" 'diredp-dired-files)
;; (define-key ctl-x-4-map "d" 'diredp-dired-files-other-window)
So you are overriding the usual C-x d key binding (dired) with one for diredp-dired-files.