I am a 4th year bachelor student composition who recently came across the GitHub repositories of Prof. Orm Finnendahl. I was wondering if anyone could help me setup Common Music 2.12.0 with Emacs on Windows 7, 64 bit. I’m embarrassed to say I have been trying on and off now for a couple of months and just can’t figure it out! I’ve read CM’s documentation, but it simply doesn’t seem to work.
I’ve tried following the instructions on the older website dedicated to CM2 (prior to CM3). Specifically these two links: "Installing Common Music", and "Running Common Music in Emacs". I did get the Emacs part right, I think, but Bash gives an error trying to load anything.
(I put the cm-master without the -master, and other repositories in C:/Users/XI-USER/lispmusic)
My Emacs is, I believe properly setup, as follows in the init file (the last lines are from the "Running Common Music in Emacs" website):
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl")
(global-linum-mode t)
(add-hook 'prog-mode-hook 'highlight-numbers-mode)
(add-hook 'emacs-lisp-mode-hook 'highlight-quoted-mode)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(add-hook 'emacs-lisp-mode-hook 'highlight-defined-mode)
(use-package kaolin-themes
:config
(load-theme 'kaolin-galaxy t))
;; If t, enable italic style in comments.
(setq kaolin-themes-italic-comments t)
;; When t, will display colored hl-line style instead monochrome.
(setq kaolin-themes-hl-line-colored t)
;; Enable distinct background for fringe and line numbers.
(setq kaolin-themes-distinct-fringe t)
;; Enable distinct colors for company popup scrollbar.
(setq kaolin-themes-distinct-company-scrollbar t)
;; Show git-gutter indicators as solid lines
(setq kaolin-themes-git-gutter-solid t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages (quote (use-package)))
'(tool-bar-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:family "Victor Mono" :foundry "outline" :slant normal :weight bold :height 120 :width normal)))))
(add-to-list 'load-path "C:/Users/XI-USER/.slime/")
(add-to-list 'load-path "C:/Users/XI-USER/lispmusic/cm/")
(load "etc/emacs/cm.el")
(enable-cm-commands)
I have both Git Bash and cygwin64 installed (I believe Bash is 64 bit too, should it matter)
When I load cm/bin/cm.sh via Emacs shell, I get this error message in Bash:
debugger invoked on a SB-INT:SIMPLE-FILE-ERROR in thread
#<THREAD "main thread" RUNNING {10027900C3}>:
Couldn't load "/c/Users/XI-USER/lispmusic/cm/bin/../src/cm.lisp": file does
not exist.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE] Ignore runtime option --eval "(progn (load \"/c/Users/XI-USER/lispmusic/cm/bin/../src/cm.lisp\" :verbose nil) (cm))".
1: [ABORT ] Skip rest of --eval and --load options.
2: Skip to toplevel READ/EVAL/PRINT loop.
3: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(LOAD "/c/Users/XI-USER/lispmusic/cm/bin/../src/cm.lisp" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)
0]
And nothing via cygwin64 (black DOS screen starts up and closes immediately)
I get these type of errors trying to load CM in Emacs:
M-x cm -> "Wrong type argument: stringp, nil"
and CL-USER> (in-package :cm) -> "The name "CM" does not designate any package.
[Condition of type SB-KERNEL:SIMPLE-PACKAGE-ERROR]"
Interestingly, when (and only when) I start up slime, and then type C-c C-d c the CM find dictionary does work!
Related
I'm trying to work with inline images (e.g. for plotting data by gnuplot), and have the problem: images always inserted as links by default. I need to do some keypresses to "force" emacs to show actual image inline, instead of just file link.
E.g. I start with gnuplot code:
#+BEGIN_SRC gnuplot :file plot.png
plot sin(x)
#+END_SRC
When I press C-c C-c on this code block, it runs, and shows me results as link to image file:
#+RESULTS:
[[file:plot.png]]
If I press C-c C-x C-v (org-toggle-inline-images) twice -- link does replaced with inline image
If I run M-x org-redisplay-inline-images -- again, link does replaced with image
If I run (org-display-inline-images t t) -- again, image is shown
and so on (those options were taken from Emacs org-display-inline-images and Inline images in org-mode questions)
But I don't want to press anything special: I want images to be displayed inline by default. I've found and tried following variables:
(setq org-startup-with-inline-images t) in .emacs config
#+STARTUP: inlineimages header
(setq org-display-inline-images t)
But neither got me the behavior I want. I'm puzzled -- do I want something so unnatural?
P.S. Im' using GNU Emacs v26.1 on MacOS X, org mode v9.1.9-65, if it matters
P.P.S. Although it seems like a bug in my emacs/orgmode version, and I'm yet to report it, but meanwhile I've found following trick: (add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append) (thanks to ob-ipython authors) -- it fixes issue for me right now. Maybe will be useful for somebody else
I can reproduce the problem with:
Org mode version 9.1.9 (release_9.1.9-65-g5e4542 # /home/xyz/.emacs.d/elpa/org-plus-contrib-20190415/)
Reproduction:
Start Emacs 26.3 with emacs -Q.
M-x load-library RET org RET
Add Gnuplot to org-babel-load-languages via M-x customize-option.
Load gnuplot.el
Open the Org file with the following content and press C-c C-c on the source block.
#+STARTUP: inlineimages
Some text.
#+BEGIN_SRC gnuplot :file plot.png :results graphics
plot sin(x)
#+END_SRC
I have a similar solution as you suggested in your question, but a bit more differentiated.
Re-displaying images in large Org documents can take some time. So I do it only if the source block has the results-parameter graphics:
(require 'subr-x)
(defun org+-babel-after-execute ()
"Redisplay inline images after executing source blocks with graphics results."
(when-let ((info (org-babel-get-src-block-info t))
(params (org-babel-process-params (nth 2 info)))
(result-params (cdr (assq :result-params params)))
((member "graphics" result-params)))
(org-display-inline-images)))
(add-hook 'org-babel-after-execute-hook #'org+-babel-after-execute)
#Tobias is the best answer. I have tweaked the #Tobias code to further optimize by bounding the re-display to the current subtree and setting the REFRESH parameter to t to redisplay only if necessary.
(require 'subr-x)
(defun org+-babel-after-execute ()
"Redisplay inline images in subtree if cursor in source block with :result graphics."
(when (org-in-src-block-p)
(let (beg end)
(save-excursion
(org-mark-subtree)
(setq beg (point))
(setq end (mark)))
(when-let ((info (org-babel-get-src-block-info t))
(params (org-babel-process-params (nth 2 info)))
(result-params (cdr (assq :result-params params)))
((member "graphics" result-params)))
(org-display-inline-images nil t beg end)))))
(add-hook 'org-babel-after-execute-hook #'org+-babel-after-execute)
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.
I've been trying to configure Emacs so that it insert a 'tab' instead of a series of 'spaces' when indenting Ruby code.
So far, I've tried setting the var ruby-indent-tabs-mode to t so that, as per the documentation, it would "insert tabs in ruby mode if this is non-nil.". But so far, no dice.
I've also tried customising it via Easy customisation, which inserted the following into my init.el:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ruby-indent-tabs-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
And after inspecting the variable via C-h v, it reports the variable is set to t, but pressing TAB keeps on inserting spaces.
I even tried editing the .el file for ruby-mode and re-compiling it to no effect.
Help would be appreciated.
----- EDIT -----
Here's the minor modes reported active via C-h m:
Enabled minor modes: Abbrev Auto-Complete Auto-Composition
Auto-Compression Auto-Encryption File-Name-Shadow Font-Lock
Global-Auto-Complete Global-Font-Lock Inf-Ruby Line-Number Menu-Bar
Show-Smartparens Show-Smartparens-Global Smartparens
Smartparens-Global Transient-Mark
The init.el file currently has:
(require 'cask "/Users/snowingheart/.cask/cask.el")
(cask-initialize)
(require 'pallet)
(add-to-list 'load-path "~/elisp")
(load "php-mode")
(add-to-list 'auto-mode-alist
'("\\.php[34]?\\'\\|\\.phtml\\'" . php-mode))
(global-set-key (kbd "C-x <up>") 'windmove-up)
(global-set-key (kbd "C-x <down>") 'windmove-down)
(global-set-key (kbd "C-x <right>") 'windmove-right)
(global-set-key (kbd "C-x <left>") 'windmove-left)
(require 'package)
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/"))
(package-initialize)
(global-set-key (kbd "C-x >") 'mc/mark-next-like-this)
(global-set-key (kbd "C-x <") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(require 'smartparens-config)
(require 'smartparens-ruby)
(require 'smartparens-erb)
(smartparens-global-mode)
(show-smartparens-global-mode t)
(sp-with-modes '(rhtml-mode)
(sp-local-pair "<%=" "%>")
(sp-local-pair "<%-" "%>"))
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories
"~/.emacs.d/.cask/24.3.50.1/elpa/auto-complete-20130724.1750/dict")
(ac-config-default)
(setq ac-ignore-case nil)
(add-to-list 'ac-modes 'enh-ruby-mode)
(add-to-list 'ac-modes 'web-mode)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(indent-tabs-mode t)
'(ruby-indent-tabs-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(setq-default indent-tabs-mode t)
(setq enh-ruby-indent-tabs-mode t)
(smart-tabs-insinuate 'ruby)
(smart-tabs-advice ruby-indent-line ruby-indent-level)
(setq ruby-indent-tabs-mode t)
Try adding the following to your init.el (below the customizations you already have):
(setq-default indent-tabs-mode t)
From the documentation for indent-tabs-mode:
Indentation can insert tabs if this is non-nil.
I don't use ruby-mode so I don't know about possible interactions between indent-tabs-mode and ruby-indent-tabs-mode. It might just be enough to set indent-tabs-mode to t (and erase the customizations you made to ruby-indent-tabs-mode). But when you add the snippet above to your configuration, the default behavior for Emacs will be to insert tabs for indentation.
EDIT
As can be seen here, enh-ruby-mode defines a customizable variable called enh-ruby-indent-tabs-mode with a default value of nil. Later on the value of this variable is used to override the value of indent-tabs-mode, which is why setting indent-tabs-mode to t has no effect on buffers with enh-ruby-mode enabled.
So unless you enable any other modes besides ruby-mode and enh-ruby-mode that might be modifying the indent-tabs-mode variable, adding
(setq enh-ruby-indent-tabs-mode t)
to your init.el should fix your problem.
Another EDIT (working solution)
(Credits: This answer put me on the right track.)
Using
Emacs 24.3.1
ruby-mode version 1.2 (built-in)
enh-ruby-mode version 20140406.252 (installed via M-x package-install ...)
I was able to make it work by adding the following to an otherwise completely empty init.el file:
(package-initialize)
(setq-default tab-width 2)
(setq enh-ruby-indent-tabs-mode t)
(defvaralias 'enh-ruby-indent-level 'tab-width)
(defvaralias 'enh-ruby-hanging-indent-level 'tab-width)
This solution works for both the GUI and the console version of Emacs. It will probably integrate fine with your other customizations but you will need to remove the custom-set-variables section and everything below it from the version of your init.el you posted above.
Note also that if you do come across a situation in which Emacs inserts a space instead of a tab you can always delete it and force insertion of a tab by quoting it via C-q TAB.
Wrapping up
Turns out there is a bug in enh-ruby-mode which causes indentation to fail for blocks starting from the second level when enh-ruby-indent-tabs-mode is set to t. The author/maintainer of enh-ruby-mode has no plans of fixing it, but the bug report includes a patch that supposedly fixes the issue.
Updated answer au goût du jour (Emacs 28.2):
Set the indent-tabs-mode and ruby-indent-tabs-mode to t.
Globally, in your ~/.emacs.el:
(setq indent-tabs-mode t)
(setq ruby-indent-tabs-mode t)
(setq tab-width 2)
(setq ruby-indent-level 2)
Or better, limited to a particular project, in a ~/src/your-project/.dir-locals.el (for example) file:
((ruby-mode . ((indent-tabs-mode . t)
(ruby-indent-tabs-mode . t)
(tab-width . 2)
(ruby-indent-level . 2))))
I tried a solution shown here which did not work for me. Even just disabling decoration mode did not work. So now I am wondering exactly what these lines above my text are, and how I can disable them. Maybe it's not even semantic? I'm not really sure...
Here's my dotfile:
(add-to-list 'load-path "~/.emacs.d/")
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(package-initialize)
;; auto-complete stuff
;;(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
(auto-complete-mode 1)
(semantic-mode 1)
(global-ede-mode 1)
(require 'semantic/ia)
;; Semantic
(global-semantic-idle-completions-mode t)
(global-semantic-decoration-mode t)
(global-semantic-highlight-func-mode t)
(global-semantic-show-unmatched-syntax-mode t)
(add-hook 'c-mode-common-hook '(lambda ()
;; ac-omni-completion-sources is made buffer local so
;; you need to add it to a mode hook to activate on
;; whatever buffer you want to use it with. This
;; example uses C mode (as you probably surmised).
;; auto-complete.el expects ac-omni-completion-sources to be
;; a list of cons cells where each cell's car is a regex
;; that describes the syntactical bits you want AutoComplete
;; to be aware of. The cdr of each cell is the source that will
;; supply the completion data. The following tells autocomplete
;; to begin completion when you type in a . or a ->
(add-to-list 'ac-omni-completion-sources
(cons "\\." '(ac-source-semantic)))
(add-to-list 'ac-omni-completion-sources
(cons "->" '(ac-source-semantic)))
;; ac-sources was also made buffer local in new versions of
;; autocomplete. In my case, I want AutoComplete to use
;; semantic and yasnippet (order matters, if reversed snippets
;; will appear before semantic tag completions).
(setq ac-sources '(ac-source-semantic ac-source-yasnippet))
))
(require 'semantic/scope)
(require 'xcscope)
(require 'semantic/symref)
;(semanticdb-enable-cscope-databases) ;;This is causing problems
;;C mode
;(require 'cc-mode)
;; ;;Color theme
;; (require 'color-theme)
;; (setq color-theme-is-global t)
;; (add-to-list 'load-path "/home/bob/.emacs.d/theme/ample-theme/ample-theme.el")
;; ;;(require 'ample-theme)
;; (eval-after-load "color-theme"
;; '(progn
;; (color-theme-initialize)
;; (color-theme-jsc-dark)))
;;set font
(set-face-attribute 'default nil :family "Anonymous Pro" :height 140)
;;line numbers
(global-linum-mode 1)
(custom-set-variables '(linum-format (quote "%4d ")))
;;treat .h files at C++
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
;; use F5 as compile
(global-set-key [(f5)] 'compile)
;; make compilation window smaller
(setq compilation-window-height 8)
I was able to solve my problem by disabling one of the overlays. I looked at the properties of one of the lines with underline using C-u C-x = and disabled one of the syntax check overlays. I'm not really sure why the syntax overlay was underlining everything especially since my code compiled fine.
At least when working with C++11/14 code, "semantic-show-unmatched-syntax-mode" shows too many false positive.
Besides that, it sometimes enters a buggy state where warnings are still shown after you fixed the syntax error. It may help to disable and renable the minor mode (M-x semantic-show-unmatched-syntax-mode).
To disable the syntax check globally, change your ~/.emacs:
(global-semantic-show-unmatched-syntax-mode 0)
;;; if you need it, you can use a shortcut to enable/disable it again, e.g.:
(global-set-key [f12] 'semantic-show-unmatched-syntax-mode)
I am receiving this error.
Error (flymake): Flymake: Failed to launch syntax check process 'php' with args (-f test_flymake.php -l): Searching for program: no such file or directory, php. Flymake will be switched OFF
I am on windows 7 with emacs 24 GNU Emacs 24.1.1 (i386-mingw-nt6.1.7601)
There is an article which highlights this error but it is referring to checking /etc in linux however I am on windows. http://sachachua.com
This is the currently relevant part of my .emacs, what can I do to get it working.
(add-to-list 'load-path "C:/Users/renshaw family/AppData/Roaming/.emacs.d/elpa/flymake-0.4.11")
(require 'flymake)
(global-set-key [f3] 'flymake-display-err-menu-for-current-line)
(global-set-key [f4] 'flymake-goto-next-error)
;;(require 'flymake-php)
(require 'zencoding-mode)
(add-hook 'sgml-mode-hook 'zencoding-mode) ;; Auto-start on any markup modes
(defun flymake-php-init ()
"Use php to check the syntax of the current file."
(let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))
(local (file-relative-name temp (file-name-directory buffer-file-name))))
(list "php" (list "-f" local "-l"))))
(add-to-list 'flymake-err-line-patterns
'("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))
(add-to-list 'flymake-allowed-file-name-masks '("\\.php$" flymake-php-init))
;; Drupal-type extensions
(add-to-list 'flymake-allowed-file-name-masks '("\\.module$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.install$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.inc$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.engine$" flymake-php-init))
(add-hook 'php-mode-hook (lambda () (flymake-mode 1)))
(define-key php-mode-map '[M-S-up] 'flymake-goto-prev-error)
(define-key php-mode-map '[M-S-down] 'flymake-goto-next-error)
Edit:
I have now tried this in ubuntu 12.04 as well and receive the same error.
It looks like flymake can't find the PHP interpreter. Try adding an explicit hint about where to find PHP.
One way you could do this is by adding the following defun to your .emacs:
(defun my-flymake-get-php-cmdline (source base-dir)
"Gets the command line invocation needed for running a flymake
session in a PHP buffer. This gets called by flymake itself."
(list "C:\Path\to\PHP\php.exe"
;; Or the path to the PHP CLI executable on the Ubuntu machine you mentioned.
(list "-f" source "-l")))
Then modifying the flymate-php-init you're using now into this:
(defun flymake-php-init ()
"Use php to check the syntax of the current file."
(let* (
(temp
(flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))
(local
(file-relative-name temp (file-name-directory buffer-file-name))))
(get-cmdline-f 'my-flymake-get-php-cmdline)))
This advice is heavily based on this answer from someone else using flymake on Windows for PHP. You might also find that answer helpful, since their situation is similar to yours.