I use project-root to setup root directory of the project as:
(setq project-roots
`(("Git Project"
:root-contains-files (".gitignore"))))
Then I go into my git project directory (e.g ~/.emacs.d), and press M-x ag-project-files and enter some search string. It shows the files which contains the string. But when I push enter key on top of the file (in order to jump into that file), it shows error message like:
Find this error in (default File: lisp/ag.el): ~/.emacs.d/
I don't know how this error come out? It is all right when I use emacs in Linux, but no good in Mac. Have you ever met this problem?
I ran into this same problem using projectile-ag. It turned out that setting the "--nogroup" parameter for ag was causing this break (but only on macOS). To work around this I just set ag-arguments to not include the "--nogroup" param:
(setq ag-arguments (list "--smart-case" "--column"))
Related
How can I set RStudio to use Ctrl+R (in addition to Ctrl+Enter) to execute commands?
https://community.rstudio.com/t/bring-ctrl-r-back/1846 suggests editing the "rstudio_bindings.json" file, but I can't find the file.
https://support.rstudio.com/hc/en-us/articles/206382178-Customizing-Keyboard-Shortcuts gives instructions to add using from the menu options. I tried to add "Ctrl+Enter|Ctrl+R" as suggested in the first link but this is not accepted. At the bottom of the page it describes how the bindings are saved at ~/.R/rstudio/keybindings/rstudio_commands.json or ~/.R/rstudio/keybindings/editor_commands.json. I cannot find either of these files.
How can I do this?
R version 3.4.2
RStudio Version 1.1.383
Windows 7
Following advice from https://community.rstudio.com/t/bring-ctrl-r-back/1846,
you have to edit the file ~/.R/rstudio/keybindings/rstudio_bindings.json with
{
"executeCode" : "Ctrl+Enter|Ctrl+R"
}
These directories and file already existed on Ubuntu, however, neither the file nor any of the directories existed on my Windows partition. So needed to create the nested directories .R/rstudio/keybindings, and then create the json file shown above, and save it as rstudio_bindings.json.
(aside: Windows didn't like trying to name a new folder of .R (the leading dot gave problems), but you can get round this by naming .R. , as the trailing dot is removed from here )
I want to save the result of any programming run on GNU/scheme. In order to do this I prepared the following test file(please see below). I was thinking that by running this, a scm file which just contains the word "01234" would be saved in the relevant directory under the name "testfile" but I couldn't find any file although GNU scheme says "done" after running this program. Could anybody kindly tell me what is wrong with this? I am running GNU scheme on windows (downloaded from; http://www.gnu.org/software/mit-scheme/ "I installed windows binary"
) and the directory on my pc where i think the file will be saved is;
C:\Program Files (x86)\MIT-GNU Scheme
Below is the content of the test program
(define outport (open-output-file "testfile"))
(display "abcde" outport)
(newline outport)
(display "01234" outport)
(newline outport)
(close-output-port outport)
Thank you.
Uselpa's explanation is spot on.
The manual has the following to say:
15.2 Working Directory
When MIT/GNU Scheme is started, the current working directory (or simply,
working directory) is initialized in an operating-system
dependent manner; usually, it is the directory in which Scheme was
invoked. The working directory can be determined from within Scheme by
calling the pwd procedure, and changed by calling the cd procedure.
Each REP loop has its own working directory, and inferior REP loops
initialize their working directory from the value in effect in their
superior at the time they are created.
This means that you can use
(pwd)
in the Scheme repl to see where your file is saved.
I was testing https://github.com/skwp/dotfiles) and unfortunately it did install a lot of things I do not want.
For example, right now (with empty .vimrc) when I open vim I get
" ============================================================================
" Netrw Directory Listing (netrw v149)
" /Users/user/.vim/bundle
" Sorted by name
" Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$
" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec
" ============================================================================
thing. I am in the beginning of my journey with VIM so I don't know what is new and right now I don't want to use it.
I am on OSX Mavericks with home-brew installed. Still, I cannot find where is this coming from and how to remove it.
Look at the first few lines of $VIMRUNTIME/plugin/netrwPlugin.vim:
" Load Once: {{{1
if &cp || exists("g:loaded_netrwPlugin")
finish
endif
If you want to disable it, just add
let loaded_netrwPlugin = 1
to your vimrc file.
You can remove the commented section by adding let g:netrw_banner=0 to your .vimrc
Since netrw's pages recommend removing older versions of netrw before updating it, I wound up finding a different way from the answers posted here. This might be especially useful for those of you looking to remove netrw (that is, uninstall netrw) before upgrading:
Download https://www.drchip.org/astronaut/vim/vbafiles/netrwclean.vba.gz, which can also be found under the netrw heading at https://www.drchip.org/astronaut./vim/index.html#NETRW
Open vim and do :so netrwclean.vba.gz, giving the full path to wherever you saved the file if necessary.
:NetrwClean to remove user-local copies or :NetrwClean! to remove both user-local and centrally-installed copies of netrw. Note of course that you'll need the right system-privileges to touch the files that will be removed, so you may wish to start vim as root.
(Optional) download the new version of the netrw vimball and :so netrw.vba.gz to update.
I don’t think that this installed Netrw — it comes bundled with Vim. You can learn more about Netrw on its page at vim.org.
What you’re getting now is (as it says) Netrw’s directory listing, which enables you to navigate within a directory from inside Vim.
Just remove these files (from your vim installation e.g. /usr/share/vim/vim74) and it will be gone
plugin/netrwPlugin.vim
syntax/netrw.vim
autoload/netrw.vim
autoload/netrwSettings.vim
autoload/netrwFileHandlers.vim
nvim:
share/nvim/runtime/autoload/netrw_gitignore.vim
share/nvim/runtime/autoload/netrw.vim
share/nvim/runtime/autoload/netrwFileHandlers.vim
share/nvim/runtime/autoload/netrwSettings.vim
share/nvim/runtime/syntax/netrw.vim
share/nvim/runtime/doc/pi_netrw.txt
share/nvim/runtime/plugin/netrwPlugin.vim
I'm trying to load hunchentoot via quicklisp in slime, and getting the following error:
READ error during COMPILE-FILE:
:ASCII stream decoding error on
#<SB-SYS:FD-STREAM
for "file [redacted]/dists/quicklisp/software/rfc2388-20120107-http/rfc2388.asd"
{100607B723}>:
the octet sequence #(196) cannot be decoded.
(in form starting at line: 29, column: 29,
file-position: 1615)
[Condition of type ASDF:LOAD-SYSTEM-DEFINITION-ERROR]
I get this when trying to run either:
(ql:quickload "hunchentoot")
Or simply:
(ql:quickload "rfc2388")
It seems that others are getting this too. I found one hint at a possible answer, saying:
The system file is encoded as UTF-8.
I'm not sure how to configure things so that SBCL on Windows starts with
UTF-8 as its default encoding for loading sources, but that's what you
need to do.
From there, I've tried (based on e.g. [this] adding the following to my emacs config:
(set-language-environment "UTF-8")
(setq slime-lisp-implementations
'((sbcl ("/opt/local/bin/sbcl") :coding-system utf-8-unix)))
(setq slime-net-coding-system 'utf-8-unix)
But... I still get the same error, even after completely re-starting emacs, to make sure I had a fresh Slime that was reading the above config.
So, what am I missing, and/or otherwise how can I get this to load?
Thanks in advance! (More thanks to come for a successful answer. ;)
Have you checked your locale settings? Emacs configuration only tells it what coding systems to set for communication between SLIME and SWANK.
You can check for locale settings with /usr/bin/locale, for example:
navi ~ » locale
LANG=pl_PL.UTF-8
LC_CTYPE=pl_PL.UTF-8
LC_NUMERIC=pl_PL.UTF-8
LC_TIME=pl_PL.UTF-8
LC_COLLATE="pl_PL.UTF-8"
LC_MONETARY=pl_PL.UTF-8
LC_MESSAGES=C
LC_PAPER=pl_PL.UTF-8
LC_NAME="pl_PL.UTF-8"
LC_ADDRESS="pl_PL.UTF-8"
LC_TELEPHONE="pl_PL.UTF-8"
LC_MEASUREMENT=pl_PL.UTF-8
LC_IDENTIFICATION=pl_PL.UTF-8
LC_ALL=
navi ~ »
Mine is setup for UTF-8 everywhere, as you can see, except for displaying 'C' messages.
Try this:
change into the .../quicklisp/dists/quicklisp/software/rfc2388* directory and load rfc2388.asd into a text editor.
Move down to the :author parameter of the defsystem form. Replace the author's name by the name given at the top of the file.
Store file using ASCII encoding.
Of course, when a new version of the library is published, the workaround gets lost. Or else store the modified project in local-projects.
With the original UTF-8 encoding still in effect, the DEBUGGER should present an INPUT-REPLACEMENT option to replace offending input characters by a replacement string. Choose that option, type "?" or "x" or any string you like at the prompt and then ENTER. The load then completes. Of course, that is not something you would like to do every time.
So the best idea is probably to send an email to the author and ask to provide an ascii version for quicklisp.
There should be a .cache directory in your HOME that contains all the fasl files. Sometimes removing those old fasl files seems to work for me when something goes wrong with compilation.
I tried the instructions - I am using Firefox on Lubuntu (Openbox). But I get the error
"Firefox doesn't know how to open this address, because the protocol (org-protocol) isn't associated with any program".
How should I fix this?
The following steps for setting up org-protocol work with Ubuntu 16.04 (Xenial Xerus) and presumably later versions. Org-mode is assumed to have already been set-up (and installed using apt-get install org-mode or via the ELPA repository).
Set-up
Add .desktop file
Create and save a file called org-protocol.desktop to ~/.local/share/applications containing:
[Desktop Entry]
Name=org-protocol
Exec=emacsclient %u
Type=Application
Terminal=false
Categories=System;
MimeType=x-scheme-handler/org-protocol;
Then run:
$ update-desktop-database ~/.local/share/applications/
This step makes Firefox aware that "org-protocol" is a valid scheme-handler or protocol (by updating ~/.local/share/applications/mimeinfo.cache), and causes Firefox to prompt for a program to use when opening these kinds of links.
Add config settings to ~/.emacs.d/init.el (or ~/.emacs) file
Have the following settings in your Emacs configuration file:
(server-start)
(require 'org-protocol)
Also add some template definitions to the configuration file, for example:
(setq org-protocol-default-template-key "l")
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "/path/to/notes.org" "Tasks")
"* TODO %?\n %i\n %a")
("l" "Link" entry (file+olp "/path/to/notes.org" "Web Links")
"* %a\n %?\n %i")
("j" "Journal" entry (file+datetree "/path/to/journal.org")
"* %?\nEntered on %U\n %i\n %a")))
Now run Emacs.
Create your notes.org file
Assuming you use the capture templates defined in step 2, you will need to prepare a notes.org file at the location you specified in step 2. You must create this file -- if it is not created along with the headlines specified in step 2, org-mode will just give a warning when you try to capture web-pages. So, given the capture templates from step 2, notes.org should contain the following:
* Tasks
* Web Links
Add bookmarklet(s) to Firefox
Save bookmark to toolbar containing something like the following as the location:
javascript:location.href='org-protocol://capture?template=l&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection())
If you are using an older version of org-mode, you may need to use the following instead:
javascript:location.href='org-protocol://capture://l/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())
Notice the 'l' (lowercase L) in the above URL -- this is what chooses the capture template (automatically) -- it is the key one would normally have to press when capturing with org-mode via C-c c.
When you click on this bookmarklet, Firefox will ask what program to use to handle the "org-protocol" protocol. You can simply choose the default program that appears ("org-protocol").
Using it
(Optionally) select some text on a webpage you're viewing in Firefox. When you click on the bookmarklet, the link and selected text will be placed in the Emacs capture buffer. Go to Emacs, modify the capture buffer as desired, and press C-c C-c to save it.
Add protocol handler
Create file ~/.local/share/applications/org-protocol.desktop containing:
[Desktop Entry]
Name=org-protocol
Exec=emacsclient %u
Type=Application
Terminal=false
Categories=System;
MimeType=x-scheme-handler/org-protocol;
Note: Each line's key must be capitalized exactly as displayed, or it will be an invalid .desktop file.
Then update ~/.local/share/applications/mimeinfo.cache by running:
On GNOME:
update-desktop-database ~/.local/share/applications/
On KDE:
kbuildsycoca4
Configure Emacs
Init file
Add to your Emacs init file:
(server-start)
(require 'org-protocol)
Capture template
You'll probably want to add a capture template something like this:
("w" "Web site"
entry
(file+olp "/path/to/inbox.org" "Web")
"* %c :website:\n%U %?%:initial")
Note: Using %:initial instead of %i seems to handle multi-line content better.
This will result in a capture like this:
\* [[http://orgmode.org/worg/org-contrib/org-protocol.html][org-protocol.el – Intercept calls from emacsclient to trigger custom actions]] :website:
[2015-09-29 Tue 11:09] About org-protocol.el
org-protocol.el is based on code and ideas from org-annotation-helper.el and org-browser-url.el.
Configure Firefox
Expose protocol-handler
On some versions of Firefox, it may be necessary to add this setting. You may skip this step and come back to it if you get an error saying that Firefox doesn't know how to handle org-protocol links.
Open about:config and create a new boolean value named network.protocol-handler.expose.org-protocol and set it to true.
Note: If you do skip this step, and you do encounter the error, Firefox may replace all open tabs in the window with the error message, making it difficult or impossible to recover those tabs. It's best to use a new window with a throwaway tab to test this setup until you know it's working.
Make bookmarklet
Make a bookmarklet with the location:
javascript:location.href='org-protocol://capture://w/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())
Note: The w in the URL chooses the corresponding capture template. You can leave it out if you want to be prompted for the template.
When you click on this bookmarklet for the first time, Firefox will ask what program to use to handle the org-protocol protocol. If you are using Ubuntu 12.04 (Precise Pangolin), you must add the /usr/bin/emacsclient program, and choose it. With Ubuntu 12.10 (Quantal Quetzal) or later, you can simply choose the default program that appears (org-protocol).
You can select text in the page when you capture and it will be copied into the template, or you can just capture the page title and URL.
Tridactyl
If you're using Tridactyl, you can map key sequences something like this:
bind cc js location.href='org-protocol://capture://w/'+encodeURIComponent(content.location.href)+'/'+encodeURIComponent(content.document.title)+'/'+encodeURIComponent(content.document.getSelection())
You might also want to add one for the `store-link` sub-protocol, like:
bind cl js location.href='org-protocol://store-link://'+encodeURIComponent(content.location.href)+'/'+encodeURIComponent(content.document.title)
Capture script
You may want to use this script to capture input from a terminal, either as an argument or piped in:
#!/bin/bash
if [[ $# ]]
then
data="$#"
else
data=$(cat)
fi
if [[ -z $data ]]
then
exit 1
fi
encoded=$(python -c "import sys, urllib; print urllib.quote(' '.join(sys.argv[1:]), safe='')" "${data[#]}")
# "link" and "title" are not used, but seem to be necessary to get
# $encoded to be captured
emacsclient "org-protocol://capture://link/title/$encoded"
Then you can capture input from the shell like this:
tail /var/log/syslog | org-capture
org-capture "I can capture from a terminal!"
These instructions are more up-to-date than the ones in Mark's answer.