How to enable NASM syntax highlighting in emacs? - macos

I'm using the nasm assembler and writing code in intel syntax and want to turn on syntax highlighting permanently. How can I do this?
I'm using OSX 10.8.5 and emacs 23.9.
I've tried following this tutorial and added the following to my ~/.emacs file:
(autoload 'nasm-mode "~/.emacs.d/nasm-mode.el" "" t)
(add-to-list 'auto-mode-alist '("\\.\\(asm\\|s\\)$" . nasm-mode))
But I'm still not able to get syntax highlighting.

Since the extension you are using is .nasm, you need to add this line also:
(add-to-list 'auto-mode-alist '("\\.nasm\\'" . nasm-mode))
The tutorial does not work for you because it assumes the extensions ".s" and ".asm". With the line above, the extension ".nasm" is also considered.

Related

Run emacs lisp script

I found the script and i need run it.
I tried to run it like this (i used eval-buffer command):
(require 'subr-x)
(require 's)
(load-file "~/git-graph.el")
(require 'git-graph)
(git-graph/to-graphviz-pretty
"git"
(git-graph/git-graph-head
"E:/GitStack/repositories/gitRepo.git"
"master"))
But get an error:
Loading e:/emHome/git-graph.el (source)...done
let*: Symbol’s function definition is void: first
picture
Please tell me what is wrong. And how i can run this script?
I'm new to this.
Why are you loading library git-graph twice?
What happens if you just remove either the load-library line or the require line -- do you still get an error?
With your original code, insert this line after the load-library line:
(message "After load-library")
And insert this line after the require line:
(message "After require")
See which message(s) you get: check buffer *Messages*. That should tell you which attempt to load the library (if either) led to the error. Maybe look for the text first in the library, to see if you notice anything funny.
If it doesn't look like the problem comes from loading that library then it likely comes from the expression after your require.
Do M-x toggle-debug-on-error, then do your M-x eval-buffer, and post the *Backtrace* output here. That will show us just where the error is raised.
You can also try M-x debug-on-entry git-graph/to-graphviz-pretty and step through the debugger using d (or c to skip details of a given step). That will eventually show you which code raised the error.

Enabling org-latex in emacs24.5

I am complete beginner trying to set up emacs to work with latex in org mode to generate latex enabled pdfs.
I followed this link to add latex but i am getting following error on start of my emacs.
This happened after adding the code in the "1.2 Org-mode LaTeX export setup" in my init.el
Debugger entered--Lisp error: (file-error "Cannot open load file" "no such file or directory" "org-latex")
require(org-latex)
eval-buffer(#<buffer *load*> nil "/Users/prabhath/.emacs.d/init.el" nil t) ; Reading at buffer position 14780
load-with-code-conversion("/Users/prabhath/.emacs.d/init.el" "/Users/prabhath/.emacs.d/init.el" t t)
load("/Users/prabhath/.emacs.d/init" t t)
#[0 "\205\262 \306=\203\307\310Q\202; \311=\204\307\312Q\202;\313\307\314\315#\203*\316\202;\313\307\314\317#\203:\320\nB\321\202;\316\322\323\322\211#\210\322=\203a\324\325\326\307\327Q!\"\323\322\211#\210\322=\203`\210\203\243\330!\331\232\203\243\332!\211\333P\334!\203}\211\202\210\334!\203\207\202\210\314\262\203\241\335\"\203\237\336\337#\210\340\341!\210\266\f?\205\260\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
command-line()
normal-top-level()
Any suggestions are helpful.
I am using emacs 24.5, org mode > 8.
The link is outdated: there is no such thing as org-latex.el any longer. It is also the case that you do not need what that link describes at all.
To export an org file to latex (and thence to PDF), all you need to do is
C-c C-e l o
The LaTeX exporter is already loaded by default.

Emacs company-mode completion not working

I just began using emacs a few days ago and I've been having trouble setting up company-mode. I installed company-mode using package-install and added the following in my .emacs file :-
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
Yet, when I go over to haskell-mode, company-mode completion doesn't pop up at all (likewise with racket-mode) when I wait for a few seconds on a keyword. Could I have installed something that could have been messing up or conflicting with company-mode?
Also, when I try to invoke company-complete manually, it just says "no completion found".
Edit: Tried out auto-complete as an alternative and code completion does not work when I press tab, but when i invoke auto-complete on a word, it works.
Edit2: got auto-complete to work.
https://i.imgur.com/Vn4f2GX.png
It looks like flyspell-mode was conflicting with auto-complete. But, No luck with getting company mode to work.
Really appreciate any help.
I got completion to work for company-mode in haskell without much hassle.
All I had to do was add company backends to my .emacs :-
(add-to-list 'company-backends 'company-dabbrev-code)
(add-to-list 'company-backends 'company-yasnippet)
(add-to-list 'company-backends 'company-files)
And get the package intero which adds company-mode support for haskell. Like so :-
(add-hook 'haskell-mode-hook 'company-mode)
(add-hook 'haskell-mode-hook 'intero-mode))
As for racket-mode, I add this in my .emacs :-
(defun my-racket-mode-hook ()
(set (make-local-variable 'company-backends)
'((company-capf company-dabbrev-code)))
(company-quickhelp-mode 0))
(add-hook 'racket-mode-hook 'my-racket-mode-hook)
(add-hook 'racket-mode-hook 'company-mode)
(add-hook 'racket-repl-mode-hook 'my-racket-mode-hook)
(add-hook 'racket-repl-mode-hook 'company-mode)

Emacs: cmdproxy.exe has encountered an issue and needs to close

I opened up emacs today and I got an error when I started typing into the #include:
This only happens when I start typing. At first I thought it had something to do with my ~/.emacs file so I opened it up and commented certain things. Eventually I found that when I comment the following line the problem goes away:
(ac-config-default)
I'm using yasnippet and auto-complete packages in my lisp file for my editor. The problem seems to be the above line when using auto-complete This is the full script of my ~/.emacs up to that point:
(require 'cc-mode)
(load (expand-file-name "~/quicklisp/slime-helper.el"))
;; Replace "sbcl" with the path to your implementation
(setq inferior-lisp-program "sbcl")
(setq-default c-basic-offset 4 c-default-style "linux")
(setq-default tab-width 4 indent-tabs-mode t)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
; start package.el with emacs
(require 'package)
; add MELPA to repository list
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
; initialize package.el
(package-initialize)
; start auto-complete with emacs
(require 'auto-complete)
; do default config for auto config
(require 'auto-complete-config)
; THIS LINE IS THE PROBLEM:
(ac-config-default)
Is there something wrong I've done here? Something I may have forgotten to do?
First try running emacs as admin and see if the problem goes away, I've had trouble with permissions issues in windows before similar to this.
The error is almost certainly caused by the gtags autocomplete source for C.
If you are not using gtags, you can likely fix the problem by removing the source from autocomplete.
(add-hook 'c-mode-common-hook
(lambda () (remove-from-list 'ac-sources 'ac-source-gtags)) t t)
Not a perfect solution, but a possible one.

In Emacs irb (inferior-ruby-mode), how to make Autocomplete honor words from Ruby mode buffers?

While setting up autocomplete in Emacs irb (inferior-ruby-mode), I ran into a problem of not being able to add only Ruby mode buffers as AC sources. I can eg. add files in the current directory by
(setq ac-sources '(ac-source-files-in-current-dir))
or I can add all buffers (which I resorted to in the end) by
(setq ac-sources '(ac-source-words-in-all-buffer))
but what I would really like is to only add Ruby mode buffers. ^^
look to ac-source-words-in-same-mode-buffers... We can re-use this approach to build our own completion sources, for example:
(ac-define-source words-in-ruby-buffers
'((init . ac-update-word-index)
(candidates . (ac-word-candidates
(lambda (buffer)
(eq (buffer-local-value 'major-mode buffer) 'ruby-mode))))))
will give us ac-source-words-in-ruby-buffers completion source.
P.S. I hadn't tested it, but it should work ;-)

Resources