w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » EMACS » Page 1
elisp - Get path to file relative to script
Use load-file-name variable. (defconst path-of-foo (file-name-directory load-file-name)) (defun foo () (shell-command-to-string (format "echo '%s' | %s" (buffer-substring-no-properties (point-min) (point-max)) (expand-file-name "./bin/executable" path-of-foo))))

Categories : Emacs

Want to replace the underscore and following char with uppercase char in emacs lisp
The reason is that is an escape character in elisp strings. So, if you want to create a regexp containing a backslash, you will have to write \. Secondly, the , construct is not available when calling the function. (let ((s "abc_def_ghi_2_") (pos 0)) (while (string-match "_\(.\)" s pos) (setq pos (match-end 0)) (setq s (replace-match (capitalize (match-string 1 s)) nil nil s 1))

Categories : Emacs

How to create a new, unnamed file in emacs?
You can create a new buffer with: C-xb and type in the buffer name and it will create a new buffer with a name that you choose. If you want to save that buffer, just hit C-x w to create the file with its contents to a desired location. My recommendation is that you give org-mode a try. It will do what want among a million other things.

Categories : Emacs

How to use SLIME indentation with editorconfig in emacs
There was a bug in editorconfig for emacs. It is now fixed. In order for it to work you should have something like the following in your .editorconfig file: [*.{lisp,asd,el}] indent_style = space indent_size = none tab_width = none

Categories : Emacs

how to import a hash-table into an org-mode in emacs?
I have stolen you all the fun;-). The output is a bit different to what you suggested. I do not indent the headers of the leaves so that org recognizes the structure. (defun org-import-hash (title hash &optional level noindent) "Import HASH table into an org buffer. Put TITLE into the first heading. The hash table starts with LEVEL where LEVEL defaults to 1. Indent inserted region by org-mo

Categories : Emacs

How to terminate the process in cider-repl?
The key combination C-c C-c will break from a loop at the top level of the cider repl, while leaving emacs and the repl running. In a regular terminal repl, the equivalent is C-c.

Categories : Emacs

Markdown-preview does't work in emacs markdown mode
If you inspect the backtrace you'll see that this has nothing to do with your Markdown file. markdown-preview needs an external markdown command that can generate HTML. It looks like whatever Markdown processor you are using is trying to call bash.exe (not bash) when converting your file. You might have installed some Windows-centric Markdown converter. You might have customized markdown-comman

Categories : Emacs

How to get emacs grep to search based on project root?
This does not answer directly your grep question but especially when working with projects, I always find projectile to be a great tool. Projectile, amongst other things, provides a grep, ack and ag search on a project level which is probably what you are looking for. E.g. C-c p s g runs grep on the files in the project.

Categories : Emacs

org-babel, ruby and encoding
I found the problem. On my mac, Emacs with a GUI default environment encoding is C. In my init file, I specified an environment encoding with (setenv "LANG" "fr_FR.UTF-8") (setenv "LC_ALL" "fr_FR.UTF-8") and org-babel picks it up correctly

Categories : Emacs

Emacs: new line and automatic indentation in Java mode
do you have the latest version of emacs? according to this article auto-indentation is default http://emacsredux.com/blog/2014/01/19/a-peek-at-emacs-24-dot-4-auto-indentation-by-default/ if not perhaps this will help: How to get auto indent (not smart indent) in emacs in all modes

Categories : Emacs

emacs autocomplete for C++
You've got ac-complete-clang bound to C-`, not to C--; it should work if you trigger it with the correct bindng. As explained in the troubleshooting section of auto-complete-clang's README, you may have to manually point auto-complete-clang at your system libraries: clang fails to find the standard inlcude files? It is because clang’s include file search path is not correct. Here is

Categories : Emacs

Is it possible to have a specific org-mode file use a custom theme or face?
To my knowledge, color themes are global, for the whole Emacs session running. The same applies for background color which I'd like dark for shell buffers, and light otherwise; not possible ATM. If you like light backgrounds, you can have a look at my color theme "Leuven" (in Emacs 24.4, in MELPA or on GitHub) and report improvements you'd find useful.

Categories : Emacs

Emacs won't run certain commands on startup
This mode appears to be buffer-local. If you always want this mode enabled, EmacsWiki suggests doing this: (auto-indent-global-mode) You can also enable it for certain modes, e.g. (add-hook 'emacs-lisp-mode-hook #'auto-indent-mode)

Categories : Emacs

emacs org-mode: completing a multi-line task
The text at issue in the question of the original poster is what I generally refer to as the notes section of a task. By design, org-mode does not assign a particular highlighting of the notes section -- i.e., the default font for text will be used. However, all is not lost. It is possible to change the default font for a particular buffer using the face-remapping-alist and setting it as a loca

Categories : Emacs

How do I bind keys in emacs for a particular mode?
latex-mode is an alias for tex-mode. You also need to escape the I think what you want to do is the following: (eval-after-load 'tex-mode '(define-key latex-mode-map (kbd "C-{") "\begingroup"))

Categories : Emacs

Replaces lines in buffer with each line wrapped in a block of text?
If the lines are not too long the following works (note the &-tick that expands to the full match as it is described in the help of query-replace-regexp): Set the cursor to the beginning of the first line. Press M-: Paste the following text into the minibuffer and press enter: (query-replace-regexp "^.*$" "<tr> <td style="text-align: center;"> \& </td> <td style="

Categories : Emacs

Emacs Keyboard Shortcuts in Atmel Studio
To install Visual Studio vsix extensions into Atmel Studio, open the vsix in your favourite zip program, and edit the 'extension.vsixmanifest' file inside it. Under the tag, add the following element (change version to fit your need). <IsolatedShell Version="6.1">AtmelStudio</IsolatedShell> See for instance the AStyle extension manifest for the structure: https://code.google.com/p/

Categories : Emacs

How to fix corrupted text in *Backtrace* buffer (emacs)
That's not text in any human language, but Emacs byte code, compiled from Emacs Lisp. (I'm not sure why this is displayed in the backtrace buffer — it might as well be hidden by default, since it's unlikely to help in resolving any problems.) What you can read from the above is that the function helm-mp-highlight-region is calling re-search-forward with a nil argument, but re-search-forward ex

Categories : Emacs

Overriding buffer-read-only in a region
There's no simple way to do what you need in Emacs 24 and earlier. I agree with your solution to mark everything with the read-only property except the parts that you want to be editable. Emacs 25 will have the inhibit-read-only property, which does exactly what you want. It was implemented by larsi on 16 November, and is used by eww.

Categories : Emacs

export from Emacs in rtf using current font-lock?
I think you're looking for M-x htmlfontify-buffer. You can also take a look at http://www.emacswiki.org/emacs/Htmlize

Categories : Emacs

How can I input line-sparator in Emacs?
This character is called "form feed", shown in Emacs as ^L, represented in files as byte 12 (decimal) / 0C (hex). Its function is to separate pages; when sent to a printer, it will usually make the printer output the current page and restart output at the top of a new page. You can input it with C-q C-l. C-q is bound to quoted-insert, which can insert almost anything into the buffer literally.

Categories : Emacs

how to replace the second occurrent in emacs evil?
I'm assuming you want to do that in an regular emacs buffer. I'm also assuming you want to have the second string always replaced with the same value. Then you can use the replace-regexp command in emacs as follows: M-x replace-regexp <RET> (tset "[^"]*") "[^"]*" <RET> 1 "replaced" <RET> <RET> represents the Enter/Return key on your keyboard. This command searches for

Categories : Emacs

Emacs: Is it possible to assign a number-key kb shortcut to a buffer?
If you use Bookmark+ then you can use desktop bookmarks. "Jumping" to such a bookmark restores the saved desktop - each bookmark refers to a particular desktop file. Bookmarks are persistent. A bookmark name can use any characters - it could be 1 or 9 or 312. You can bind a single key (including a digit key, if you like) to the command that jumps to a bookmark whose name you enter (with complet

Categories : Emacs

Paragraph filling for org-mode inside latex environment
The problem disappears if you use an org block instead of a latex environment: #+BEGIN_proof ... #+END_proof This gets exported as egin{proof}...end{proof}. It also lets you use org syntax inside the block, and fill paragraph works. if you don't want to do that, maybe try visual-line-mode as a workaround. Edit: change fill-paragraph behaviour If you want fill paragraph to work in latex en

Categories : Emacs

Narrow buffer, using org-match-sparse-tree?
The search regexp used by the original poster is probably incorrect. The sub-function used by org-occur to set the boundaries for the highlighted result is rather simple -- (while (re-search-forward regexp nil t) . . .) The beginning and ending of the matched pattern determine the boundaries of the highlighted area -- i.e., (match-beginning 0), and (match-end 0). To search for headlines containin

Categories : Emacs

Emacs: Set writeroom mode as default
If write-room mode is a globalized minor mode, then just turn it on in your init file. If write-room mode is a minor mode and there is no globalized version of it, you can use define-globalized-minor-mode to define such a globalized mode. Then turn that on in your init file. If write-room is a major mode then you can customize option auto-mode-alist to turn it on for any number of file-name exten

Categories : Emacs

Orgmode - get completion on tags from current file when buffer is narrowed to a subtree
The solution comes from an answer by Tobias here (thanks Tobias!). Save this code somewhere in your search path (init.el, .emacs, etc.) and Org-mode will now search your entire file for tags to choose from: (defadvice org-set-tags (around search-all activate) "Widen for search with org-set-tags" (save-restriction (widen) ad-do-it )) Good luck!

Categories : Emacs

[Ocaml]: Build lexer.mll
You failed to describe what you tried here... I guess that you did not compile Lexer before compiling main.ml, though it depends on Lexer. What you should do is: Convert lexer.mll to lexer.ml with ocamllex: ocamllex lexer.mll Compile lexer.ml: ocamlc lexer.ml Then compile main.ml To automate this process, you should use some build tool such as make, ocamlbuild, omake, etc. In any case, you sho

Categories : Emacs

Change default save folder in LispBox
I know nothing about Lisp Box, and not all of what you describe is clear to me. But here goes. It sounds like you are looking for a way to make c:/work/lisp the default directory when you start Emacs. For that, using an MS Windows shortcut, putting that folder in the Start in field does indeed accomplish that. But you speak of a LispBox shortcut's Start in. If by that you just mean an Emacs sho

Categories : Emacs

Pry in Emacs "Completion aborted: Not at a top-level prompt"
The prompt may indeed be not a the top level (if it's a continuation prompt). Then finish the expression (without leaving any unclosed parens, etc) press RET and try again. If you always get this message when trying to complete, file an issue. Include your version of inf-ruby, your OS details, and the contents of the inf-ruby buffer, including the prompts.

Categories : Emacs

Hide/change Emacs fringe bent arrows due to word wrapping?
First, some quick context. From Emacs Fringe Bitmaps: "Fringe indicators are tiny icons displayed in the window fringe to indicate truncated or continued lines, buffer boundaries, etc." You cannot replace the curly arrow with arbitrary text. According to lunaryorn's answer to "Is It Possible To Replace Fringe Bitmaps With Text in Emacs?": No, it is not. Fringe “bitmaps” are really bitmaps

Categories : Emacs

Emacs GDB split window for every new visited file in resolution 2880x1800
Put this in your .emacs: (setq split-height-threshold 1200) (setq split-width-threshold 2000) Credit goes to the article HOWTO: prevent Emacs from splitting windows by Maciej Pacula

Categories : Emacs

Narrow to subtree with org-velocity
I am writing a partial answer for part (2) of the question since the following does not fit nicely into a comment. Note, that I do not use org-velocity. So, the following is not really tested. save-restriction saves the current narrowing to the org-subtree and widen removes this narrowing temporarily during the search. To see exactly how it works read the help for the functions save-restriction an

Categories : Emacs

Installing auto-complete in emacs
Put (setq debug-on-error t) at the beginning of your init file. Or better yet, append --debug-init to the command line you use to invoke Emacs. That will open the debugger when the error occurs. But it seems that the file that has (provide 'autocomplete) in it, or that file's directory, is not in your load-path. When the debugger opens, use C-h v load-path, and see whether it is correct. And try

Categories : Emacs

How to avoid error message in mini-buffer (helm-mode, emacs24.4)
FWIW, it may very well be that this error in helm-mp-highlight-match-internal happened also in 24.3: one of the difference in 24.4 is that errors in timers are not silently ignored any more but are instead reported as messages in the minibuffer. You should probably report this problem to Thierry Volpiatto (maintainer/author of Helm).

Categories : Emacs

Emacs calc minibuffer blank face---how to debug?
Good question. The answer is simple: recursively bisect your init file. Do that by commenting out 1/2 of it, then 3/4, then 7/8,... This is a binary search, and it is very quick, even though it might not seem that way at first. It is systematic, and essentially blind (thoughtless). To comment out a block of text, use command comment-region. To uncomment a block of text, use C-u with the same com

Categories : Emacs

Is there a default binding, or func for 'format to 80 columns a region' in emacs?
The keybinding is M-q, the function is called fill-paragraph, and the mode is called auto-fill-mode ! so to enable it for markdown buffers: (add-hook 'markdown-mode-hook 'auto-fill-mode) Now you'll ask… where is the unfill-paragraph ?? Well (how embarassing), it doesn't exist (maybe in recent version of emacs ?). I picked it on xahlee's blog, here it is: (defun unfill-paragraph () "Replac

Categories : Emacs

How can I disable emacs delete-selection-mode
delete-selection-mode is set by default when CUA mode is enabled, but it can be disabled via M-x customize. CUA settings are a subgroup of the "Editing Basics" subgroup of the top-level "Editing" group. To disable delete-selection mode, use the Value Menu of the "Cua Delete Selection" item and change the setting to Disabled. This will place the following line among the custom-set-variables defin

Categories : Emacs

Is there a specification for Emacs?
Software and Specs Some software is defined by a standard and have many implementations (e.g., Common Lisp, Scheme, C, C++ &c), and some software is defined by its unique implementation and the documentation is secondary to it (e.g., Emacs, Python, Ruby, Perl). There is an intermediate case of Java which is defined by an evolving standard and has a reference implementation which is tracked by

Categories : Emacs




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.