I am using Emacs 24.3.1 to edit a .cpp file and when I activate M-x flycheck-mode, it shows the state being (C++/l FlyC- Abbrev), where FlyC- means it did not find a suitable syntax checker.
I can't see anything looking like a C++ checher in the list I get from flycheck-select-checker:
Possible completions are:
bash coffee-coffeelint css-csslint
emacs-lisp emacs-lisp-checkdoc go-build
go-gofmt go-test haml
html-tidy javascript-jshint json-jsonlint
lua perl php
php-phpcs python-flake8 python-pyflakes
python-pylint rst ruby
rust-rustc sass scss
sh tex-chktex tex-lacheck
xml-xmlstarlet zsh
Any ideas what might be missing?
I have both c/c++-clang and c/c++-cppcheck when I run flycheck-select-checker. Perhaps you're using an out of date flycheck?
Related
I'm new to Ubuntu and Linux, so I'm sorry if this question seems to be too stupid. I hoped to have a function that can automatically format my C++ codes, so I installed clang-format by the following terminal command:
sudo aptitude install clang-format
To make it work with Emacs, I searched on the Internet for a solution and modified my "~/.emacs" file, adding the following line:
(setq clang-format-executable "/usr/bin/clang-format-6.0")
Now in Emacs, when I used the command M-x clang-format-buffer or similar commands on a C++ file, it succeeded, but the source code didn't seem to be formatted at all (sorry that I can't directly post images for some reason):
https://i.stack.imgur.com/gNIvn.png
https://i.stack.imgur.com/eKLXl.png
Is there anything else I'm missing in setting up clang-format, or what's the proper way to set it up?
I appreciate any help!
I got it.
First, installing Clang-format this way was unnecessary. The proper way to do it was by using Emacs' package-install command.
package-install clang-format
Then I did this in the .emacs file:
(load "/usr/share/emacs/site-lisp/clang-format-6.0/clang-format.el")
Hope this helps anyone facing the same problem.
I'm trying to convert this pattern in files
Insert 18333fig0101.png
Figure 1-1. Local version control diagram.
to
![Figure 1-1. Local version control diagram.](../figures/18333fig0101-tn.png)
This is the perl command:
perl -i -0pe 's/^Insert\s*(.*)\.png\s*\n([^\n]*)$/!\[\2](..\/figures\/\1-tn.png)/mg' */*.markdown
This works fine on Mac OS X, but it doesn't work on Windows 10.
I installed perl using pacman -S perl from MSYS2.
This is also not a \r\n issue as I checked there is no \r in the document.
Is this a known issue on Windows? Or, is there something different option needed for Windows?
When I run the same command (after changing single quotes to double quotes), I get the following error message:
Can't do inplace edit without backup.
This is documented in perldiag:
You're on a system such as MS-DOS that gets confused if you try
reading from a deleted (but still opened) file. You have to say -i.bak, or some such.
When I change the command to perl -i.bak ..., it works.
I just installed vim-autoformat and astyle to format my c/c++ code inside vim. Everything seems to work, but it puts a newline to the end of the file everytime I run it. Even if there is one (or multiple). I tried to find the option in astyle -h and search the web, but didn't find anything. What do I do?
It looks like it's a bug in astyle that's been fixed. See http://astyle.sourceforge.net/subversion.html for help getting the latest development version. I'm using version 2.05 beta and it seems to be working correctly now.
I am using Tuareg mode for Emacs.
I am also using lwt. lwt has some syntax extension, but Tuareg cannot recognize them and it is ugly without indention and coloring.
I found this:
https://github.com/skydeck/lwt/blob/master/utils/tuareg-2.0.4.patch
It is a patch for tuareg-2.0.4 to enable lwt coloring.
However, I am using Tuareg-2.0.5 and I tried the patch directly, it failed.
I am not sure how to downgrade Tuareg, so I just downloaded the files of tuareg-2.0.4 and copy them to the elpa/tuareg-2.0.5 folder and then I did the patch again.
This was successfully patched as it said, but still my emacs cannot recognize lwt.
Can anyone tell me how?
IMHO, you don't have to replace your stock tuareg.el.
1. Place your patched tuareg.el to ~/.emacs.d/ directory
2. Add the following lines to your ~/.emacs config
(add-to-list 'load-path "~/.emacs.d/")
(load "tuareg")
3. (Optional) byte-compile your custom tuareg.el
M-x byte-compile-file
Stock tuareg mode
Tuareg mode with lwt patch
I have installed clang and clang_complete on a Linux system.
I added the following lines to my .vimrc:
let g:clang_user_options='|| exit 0'
set completeopt-=preview
Auto-completion works for my own code. However, it doesn't work with STL container. Even when I just type std::, I see a "user defined completion - pattern not found" at the bottom of the screen. What is the problem?
I use Vim 7.3 and clang_complete 1.8
The workaround is to tell clang_complete to use the clang library (instead of binary) for parsing. This is done by adding the following line to .vimrc:
let g:clang_use_library=1