setting emacs default Frame issue - emacs

Trying to set a custom Frame size using .emacs file. However when I open emacs, it goes to that size then immediately defaults back to the standard smaller Frame.
Is this just a live with bug, or is there something that overrides the .emacs file after the .emacs file is read.
here is my current .emacs file:
(custom-set-variables
'(custom-enabled-themes (quote (wheatgrass)))
'(global-linum-mode t)
'(line-number-mode t)
'(show-paren-mode t))
(custom-set-faces
)
(setq inhibit-startup-message t)
(add-to-list 'default-frame-alist '(height . 52))
(add-to-list 'default-frame-alist '(width . 140))

Related

(define-error (quote gv-invalid-place) "%S is not a valid place expression")

When I load emacs, it gives me this error using --debug-init after adding cl-lib.el:
Debugger entered--Lisp error: (void-function gv-define-simple-setter)
(gv-define-simple-setter buffer-file-name set-visited-file-name t)
eval-buffer(#<buffer *load*<2>> nil "d:/Tools/Emacs-24.3/cl-lib/cl-lib.el" nil t) ; Reading at buffer position 23391
load-with-code-conversion("d:/Tools/Emacs-24.3/cl-lib/cl-lib.el" "d:/Tools/Emacs-24.3/cl-lib/cl-lib.el" nil nil)
load("d:/Tools/Emacs-24.3/cl-lib/cl-lib.el")
mapc(load ("d:/Tools/Emacs-24.3/cl-lib/cl-lib.el"))
eval-buffer(#<buffer *load*> nil "c:/Users/Psalm3_3/.emacs" nil t) ; Reading at buffer position 76
load-with-code-conversion("c:/Users/Psalm3_3/.emacs" "c:/Users/Psalm3_3/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
This is the gv.el file I am using:
https://github.com/emacs-mirror/emacs/blob/master/lisp/emacs-lisp/gv.el
Does anyone have any suggestions? TIA.
UPDATE:
Here is the original error I was getting:
Debugger entered--Lisp error: (file-error "Cannot open load file" "cl-lib")
require(cl-lib)
eval-buffer(#<buffer *load*<2>> nil "d:/Tools/emacs-24.3/site-lisp/desktop.el" nil t) ; Reading at buffer position 5870
load-with-code-conversion("d:/Tools/emacs-24.3/site-lisp/desktop.el" "d:/Tools/emacs-24.3/site-lisp/desktop.el" nil nil)
load("d:/Tools/emacs-24.3/site-lisp/desktop.el")
mapc(load ("d:/Tools/emacs-24.3/site-lisp/desktop.el"))
eval-buffer(#<buffer *load*> nil "c:/Users/Psalm3_3/.emacs" nil t) ; Reading at buffer position 549
load-with-code-conversion("c:/Users/Psalm3_3/.emacs" "c:/Users/Psalm3_3/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
Here is my .emacs file:
(mapc 'load (file-expand-wildcards "D:/Tools/Emacs-24.3/cl-lib/cl-lib.el"))
;; Require Common Lisp. (cl in <=24.2, cl-lib in >=24.3.)
(if (require 'cl-lib nil t)
(progn
(defalias 'cl-block-wrapper 'identity)
(defalias 'member* 'cl-member)
(defalias 'adjoin 'cl-adjoin))
;; Else we're on an older version so require cl.
(require 'cl))
;; Load lisp files on start
(mapc 'load (file-expand-wildcards "D:/Tools/emacs-24.3/site-lisp/flymake.el"))
(mapc 'load (file-expand-wildcards "D:/Tools/emacs-24.3/site-lisp/csharp-mode.el"))
(mapc 'load (file-expand-wildcards "D:/Tools/emacs-24.3/site-lisp/desktop.el"))
(mapc 'load (file-expand-wildcards "D:/Tools/emacs-24.3/site-lisp/session.el"))
;; setup load-path
(add-to-list 'load-path "D:/Tools/emacs-24.3/site-lisp")
;; TABS for C
(setq-default c-indent-tabs-mode t ; Pressing TAB should cause indentation
c-indent-level 4 ; A TAB is equivilent to four spaces
c-argdecl-indent 0 ; Do not indent argument decl's extra
c-tab-always-indent t
backward-delete-function nil) ; DO NOT expand tabs when deleting
(c-add-style "my-c-style" '((c-continued-statement-offset 4))) ; If a statement continues on the next line, indent the continuation by 4
(defun my-c-mode-hook ()
(c-set-style "my-c-style")
(c-set-offset 'substatement-open '0) ; brackets should be at same indentation level as the statements they open
(c-set-offset 'inline-open '+)
(c-set-offset 'block-open '+)
(c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level
(c-set-offset 'case-label '+)) ; indent case labels by c-indent-level, too
(require 'csharp-mode)
(setq auto-mode-alist
(append '(("\\.cs$" . csharp-mode)) auto-mode-alist))
(defun my-csharp-mode-fn ()
"function that runs when csharp-mode is initialized for a buffer."
(setq default-tab-width 4)
; Set indentation level to 4 spaces (instead of 2)
(setq c-basic-offset 4)
; Set the extra indentation before a substatement (e.g. the opening brace in
; the consequent block of an if statement) to 0 (instead of '+)
(c-set-offset 'substatement-open 0)
(setq-default c-basic-offset 4)
)
(add-hook 'csharp-mode-hook 'my-csharp-mode-fn t)
(add-hook 'c-mode-hook 'my-c-mode-hook)
(add-hook 'c++-mode-hook 'my-c-mode-hook)
(global-set-key "\C-cg" 'goto-line)
(global-set-key "\C-cy" '(lambda ()
(interactive)
(popup-menu 'yank-menu)))
(put 'upcase-region 'disabled nil)
;; Always use spaces instead of tabs
(setq-default indent-tabs-mode nil)
(defun FindNextDbl ()
"move to next doubled word, ignoring <...> tags" (interactive)
(re-search-forward "\\<\\([z-z]+\\)\\([\\n \\t]\\|<[^>]+>\\)+\\1\\?"))
(define-key global-map "\C-x\C-d" 'FindNextDbl)
;; Search all open buffers
(defun my-multi-occur-in-matching-buffers (regexp &optional allbufs)
"Show all lines matching REGEXP in all buffers."
(interactive (occur-read-primary-args))
(multi-occur-in-matching-buffers ".*" regexp))
(global-set-key (kbd "M-s /") 'my-multi-occur-in-matching-buffers)
(setq x-select-enable-clipboard t)
;; Copy list of all open buffers to clipboard: see http://stackoverflow.com/questions/10537265/emacs-save-current-buffer-list-to-a-text-file
(defun copy-open-files ()
"Add paths to all open files to kill ring"
(interactive)
(kill-new (mapconcat 'identity
(delq nil (mapcar 'buffer-file-name (buffer-list)))
"\n"))
(message "List of files copied to kill ring"))
;; save my desktop
(desktop-save-mode 1)
;; auto-reload modified files
(global-auto-revert-mode t)
;; put save files in back dir (see http://www.emacswiki.org/emacs/BackupDirectory)
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.saves")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; use versioned backups
;; move to window based on arrow keys
(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)
;; incremental completion
(require 'helm-config)
(helm-mode 1)
;; http://stackoverflow.com/questions/275842/is-there-a-repeat-last-command-in-emacs
(defun describe-last-function()
(interactive)
(describe-function last-command))
;; get path of present buffer, see http://stackoverflow.com/questions/3669511/the-function-to-show-current-files-full-path-in-mini-buffer
(defun show-file-name ()
"Show the full path file name in the minibuffer."
(interactive)
(message (buffer-file-name)))
(global-set-key [C-f1] 'show-file-name) ; Or any other key you want
;; generate guids
(require 'guid)
UPDATE 2:
Thank you for the excellent post, #Thomas. This is what I've updated the start of my .emacs file to:
;; setup load-path
(add-to-list 'load-path "C:/Tools/emacs-24.3/site-lisp/gv.el")
(require 'gv)
(add-to-list 'load-path "D:/Tools/Emacs-24.3/cl-lib")
(add-to-list 'load-path "C:/Tools/emacs-24.3/site-lisp")
;; Load lisp files on start
(mapc 'load (file-expand-wildcards "C:/Tools/emacs-24.3/site-lisp/flymake.el"))
(mapc 'load (file-expand-wildcards "C:/Tools/emacs-24.3/site-lisp/csharp-mode.el"))
(mapc 'load (file-expand-wildcards "C:/Tools/emacs-24.3/site-lisp/desktop.el"))
(mapc 'load (file-expand-wildcards "C:/Tools/emacs-24.3/site-lisp/session.el"))
Now this is the error I'm getting:
Debugger entered--Lisp error: (void-variable defun-declarations-alist)
(assq (quote gv-expander) defun-declarations-alist)
(or (assq (quote gv-expander) defun-declarations-alist) (let ((x (\` (gv-expander (\, (apply-partially ... ...)))))) (push x macro-declarations-alist) (push x defun-declarations-alist)))
eval-buffer(#<buffer *load*<2>> nil "d:/Tools/Emacs-24.3/site-lisp/gv.el" nil t) ; Reading at buffer position 8332
load-with-code-conversion("d:/Tools/Emacs-24.3/site-lisp/gv.el" "d:/Tools/Emacs-24.3/site-lisp/gv.el" nil t)
require(gv)
eval-buffer(#<buffer *load*> nil "c:/Users/Psalm3_3/.emacs" nil t) ; Reading at buffer position 96
load-with-code-conversion("c:/Users/Psalm3_3/.emacs" "c:/Users/Psalm3_3/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
Sorry, I'm pretty new at LISP.
The code you have for cl-lib looks very weird. If you have Emacsā‰„24.3 then you already have cl-lib builtin. And if you have something older then you can't use Emacs-24.3's cl-lib (you have to use GNU ELPA's cl-lib instead, but if it's sufficiently older you won't have GNU ELPA support builtin either, so all in all you're better up upgrading your Emacs to 24.3 or more recent).
If your Emacs is 24,1 or 24.2, then I recommend you just install cl-lib via M-x package-install RET and then add
(package-initialize)
at the beginning of your ~/.emacs which will properly setup autoloads for those packages you install via package.el (such as cl-lib above).
The block that starts with (if (require 'cl-lib ...) ...) looks like an ugly hack to work around a problem you mis-understood. Just remove it.
Also, remove flymake.el and desktop.el from your site-lisp, the version that comes with Emacs is probably more up-to-date.
The error stems from Emacs not being able to load the right files. You're trying to load a bunch of single files manually here. However, this is not the way the underlying packages are supposed to be loaded.
Usually, packages come with installation instructions that typically require you to add some lines to your init file: amending the load-path, setting up conditions for when to load the package, and adding a command how to load the package. Hardly ever does any of this ever involve a direct call of the load function which is quite low-level.
If you look at your original error, the stack trace tells you that it's thrown by (require cl-lib). require is one of the mechanisms by which Emacs loads files when necessary. For it to work, you don't need to load the file in question directly. All you have to do is set up your load-path so that Emacs can find the file that is referred to.
For instance, for your cl-lib.el file, you could do this like so:
(add-to-list 'load-path "D:/Tools/Emacs-24.3/cl-lib")
You add this line to your init file (and of course at a point before Emacs tries to load cl-lib).
The counter-part to require is provide. If you look at source code for gv.el and scroll all the way to the bottom, you'll find as the last line:
(provide 'gv)
This means that his file provides the "feature" gv, and whenever you write (require 'gv) you're telling Emacs that you need that feature. If Emacs already knows about it, all is fine and dandy; if not, Emacs will try to load that feature. So, to load the contents of the gv.el file, all you have to do is add the following to your init file:
(add-to-list 'load-path "/path/to/directory/containing/gv.el")
(require 'gv)
See the Emacs Manual for more information on require and provide.
But let me reiterate one point from above: usually, packages come with specific installation instructions, often somewhat "hidden" in a long comment-section at the top of the source code file. So, make sure to check for such instructions whenever you want to manually add a package to your setup.
On a side note:
(mapc 'load <something>)
only really makes sense if <something> expands into a list of files. If, like in your case, <something> is just a single file, you might as well just write:
(load <something>)
But again, load is a low-level function that you hardly ever need as an end-user.

If desktop previously saved, then switch from *scratch* to last viewed file

Could someone please give me a hand switching to the last viewed file from the desktop save when opening Emacs, taking into consideration that my *scratch* buffer is also an existing file?
The *scratch* buffer always trumps the desktop save in terms of the initial buffer choice.
(setq initial-scratch-message nil)
;; (setq initial-buffer-choice "~/.0.data/.0.emacs/*scratch*")
(defun kill-default-scratch ()
"Avoid having a buffer named `*scratch*<2>` when Emacs loads
my preferred *scratch* file from a specified location -- however,
yield to the last viewed file if it exists from desktop-save."
(kill-buffer "*scratch*")
(find-file "~/.0.data/.0.emacs/*scratch*") )
(add-hook 'after-init-hook 'kill-default-scratch)
(require 'saveplace)
(setq-default save-place t)
(setq save-place-file "~/.0.data/.0.emacs/.saved-places")
(desktop-save-mode 1)
(setq desktop-dirname "~/.0.data/.0.emacs/"
desktop-base-file-name ".emacs.desktop"
desktop-base-lock-name ".lock"
desktop-path (list desktop-dirname)
desktop-save t
desktop-files-not-to-save "[*]bbdb[*]\\|[*]BBDB[*]\\|[*]TODO[*]" ;; "^$" reload tramp paths
desktop-load-locked-desktop nil )
(setq desktop-buffers-not-to-save
(concat "\\("
"^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS"
"\\|\\.emacs.*\\|\\.diary\\|\\.newsrc-dribble"
"\\)$"))
(add-to-list 'desktop-modes-not-to-save 'dired-mode)
(add-to-list 'desktop-modes-not-to-save 'Info-mode)
(add-to-list 'desktop-modes-not-to-save 'info-lookup-mode)
(add-to-list 'desktop-modes-not-to-save 'fundamental-mode)
EDIT: Based upon the answer provided by #juanleon, I decided to just let nature run its course and deal with it using the emacs-startup-hook (which loads subsequent to the after-init-hook). The scratch buffer wants to trump desktop.el, so let it and then bury it. To deal with the situation when there is no last viewed file saved by desktop.el (i.e., because they were all closed before exiting), I bury the *Messages* buffer (if it has focus) so the result is that the custom *scratch* buffer has focus again. To remove the custom *scratch* file from the desktop.el save feature, I added [*]scratch[*] to the list of desktop-files-not-to-save. I am using auto-save-buffers-enhanced to automatically save my custom *scratch* file (set to occur 1 second after every modification) and that utility lets me exclude user-defined file types with (setq auto-save-buffers-enhanced-exclude-regexps . . .): https://github.com/kentaro/auto-save-buffers-enhanced/blob/master/auto-save-buffers-enhanced.el [NOTE: The reference to flet therein would need to be changed to cl-flet if using a recent version of Emacs.]
(setq initial-scratch-message nil)
(setq initial-buffer-choice t)
(require 'auto-save-buffers-enhanced)
(auto-save-buffers-enhanced t)
(setq auto-save-buffers-enhanced-save-scratch-buffer-to-file-p 1)
(setq auto-save-buffers-enhanced-exclude-regexps '("^not-save-file" "\\.ignore$" "\\.txt" "[*]TODO[*]" "\\.yasnippet" "\\.tex" "\\user_pref" "\\.org_archive" "\\.org" "\\.ppet"))
(require 'saveplace)
(setq-default save-place t)
(setq save-place-file "~/.0.data/.0.emacs/.saved-places")
(desktop-save-mode 1) ;; uses the after-init-hook
(setq desktop-dirname "~/.0.data/.0.emacs/"
desktop-base-file-name ".emacs.desktop"
desktop-base-lock-name ".lock"
desktop-path (list desktop-dirname)
desktop-save t
desktop-files-not-to-save "[*]scratch[*]\\|[*]bbdb[*]\\|[*]BBDB[*]\\|[*]TODO[*]" ;; "^$" reload tramp paths
desktop-load-locked-desktop nil )
(setq desktop-buffers-not-to-save
(concat "\\("
"^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS"
"\\|\\.emacs.*\\|\\.diary\\|\\.newsrc-dribble"
"\\)$"))
(add-to-list 'desktop-modes-not-to-save 'dired-mode)
(add-to-list 'desktop-modes-not-to-save 'Info-mode)
(add-to-list 'desktop-modes-not-to-save 'info-lookup-mode)
(add-to-list 'desktop-modes-not-to-save 'fundamental-mode)
(defun custom-scratch-setup ()
"Avoid having a buffer named `*scratch*<2>` when Emacs loads
my preferred *scratch* file from a specified location -- however,
yield to the last viewed file if it exists from desktop-save."
(kill-buffer "*scratch*")
(message "The default `*scratch*` buffer has been killed.")
(find-file "~/.0.data/.0.emacs/*scratch*")
(message "Finished loading the custom `*scratch*` file.")
(bury-buffer)
(message "The buffer *scratch* has been buried.")
(if (eq (current-buffer)
(get-buffer "*Messages*") )
(progn (bury-buffer)
(message "The buffer *Messages* has been buried."))) )
(add-hook 'emacs-startup-hook 'custom-scratch-setup)
My guess would be that after-init-hook runs after desktop has finished loading its stuff (desktop uses that hook)
So, the find-file will run at the end of everything, and find-file happens to "unbury" the buffer of a file, if already loaded. You may add a (bury-buffer) at the end of your kill-default-scratch if you don't want it to taking over initial buffer choice, nor being the initial buffer choice.
Another option would be to swap the order the hooks in after-init-hook are run. You can do that by playing with the moment desktop.el is "required" and/or using the arg APPEND of add-hook. If your function is run before desktop's function, (desktop-read) will take precedence over your find-file

Emacs override background color from color-theme in init file

I installed emacs, created a .emacs.d directory and made an init.el file:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar my-packages
'(starter-kit
starter-kit-bindings
starter-kit-lisp
clojure-mode
color-theme
nrepl))
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
(require 'color-theme)
(color-theme-initialize)
(color-theme-charcoal-black)
(color-theme-install-frame-params '((background-color . "black")))
When I open emacs, I end up with the color-theme-charcoal-black colors, with its default gray background. If I open init.el and eval-buffer, the background goes black as desired.
How can I get that affect without needing to eval-buffer?
I also tried:
(add-hook 'after-init-hook
'(lambda () (color-theme-install-frame-params
'((background-color . "black"))))
Similar to this question:
https://superuser.com/questions/481793/permanently-override-background-colour-of-emacs-theme
Well, that's not the way to set up a theme in Emacs 24, but you could patch the old one to work like the new one.
Here's an example of a theme I've made for myself, but you could just take the one that you like and replace the values. I've not finished this one yet, but it is close to be finished :)
After you've done, save the file into ~/.emacs.d/themes/charcoal-black-theme.el
and in your .emacs:
(add-to-list 'custom-theme-load-path (expand-file-name "~/.emacs.d/themes/"))
(setq custom-enabled-themes '(charcoal-black))
after you've done so, Emacs will ask you whether you want to permanently add the themes directory and the theme to enabled themes. If you answer positively, it will append some code to the (custom-set-variables ...)
The example theme follows:
http://pastebin.com/S2BHmd5s

Emacs: Get new-frame and emacsclient -c to use set frame size?

I am new to StackOverflow and I have a question about an issue that has been virtually the only thing to irk me in my quest to master Emacs.
I configured my .emacs file to set the default frame size for Emacs to 70 rows and 80 columns like so:
(add-to-list 'default-frame-alist '(left . 0))
(add-to-list 'default-frame-alist '(top . 0))
(add-to-list 'default-frame-alist '(height . 70))
(add-to-list 'default-frame-alist '(width . 80))
This works fine when starting Emacs, the problem is that when I launch a new frame using new-frame or emacsclient -c these settings are not respected. Is there a way to force emacsclient and new-frame to read the settings in the .emacs file when they are executed?
Edit:
Here is my .emacs file:
;;This setting is meant to force emacs to read size settings before make-frame.
(add-hook 'before-make-frame-hook
#'(lambda ()
(add-to-list 'default-frame-alist '(left . 0))
(add-to-list 'default-frame-alist '(top . 0))
(add-to-list 'default-frame-alist '(height . 70))
(add-to-list 'default-frame-alist '(width . 80))))
;;disable annoying welcome screen.
(setq inhibit-splash-screen t)
(setq inferior-lisp-program "/usr/bin/abcl")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime/")
(require 'slime)
(slime-setup)
(add-to-list 'auto-mode-alist '("\\.lisp$" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.cl$" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.asd$" . lisp-mode))
(require 'slime)
(slime-setup)
(eval-after-load "slime"
'(progn
(setq slime-complete-symbol*-fancy t
slime-complete-symbol-function 'slime-fuzzy-complete-symbol
slime-when-complete-filename-expand t
slime-truncate-lines nil
slime-autodoc-use-multiline-p t)
(slime-setup '(slime-fancy slime-asdf))
(define-key slime-repl-mode-map (kbd "C-c ;")
'slime-insert-balanced-comments)
(define-key slime-repl-mode-map (kbd "C-c M-;")
'slime-remove-balanced-comments)
(define-key slime-mode-map (kbd "C-c ;")
'slime-insert-balanced-comments)
(define-key slime-mode-map (kbd "C-c M-;")
'slime-remove-balanced-comments)
(define-key slime-mode-map (kbd "RET") 'newline-and-indent)
(define-key slime-mode-map (kbd "C-j") 'newline)))
(add-to-list 'default-frame-alist '(left . 0))
(add-to-list 'default-frame-alist '(top . 0))
(add-to-list 'default-frame-alist '(height . 70))
(add-to-list 'default-frame-alist '(width . 80))
(normal-erase-is-backspace-mode 0)
(tool-bar-mode -1) ;;method for disabling changed in 24. can not nil, most negative
(scroll-bar-mode -1)
;;for loading cedet.
(load-file "/usr/share/emacs/site-lisp/cedet/common/cedet.el")
You might try adding the following hook to your Emacs start-up file (normally, ~/.emacs), i.e.:
(add-hook 'before-make-frame-hook
#'(lambda ()
(add-to-list 'default-frame-alist '(left . 0))
(add-to-list 'default-frame-alist '(top . 0))
(add-to-list 'default-frame-alist '(height . 70))
(add-to-list 'default-frame-alist '(width . 80))))
Or, if you want to reload the whole .emacs file:
(add-hook 'before-make-frame-hook #'(lambda () (load-file "~/.emacs")))
The former hook is almost certainly preferable, as reloading the entire .emacs file is probably not only unnecessary and wasteful of resources, but also has the potential to cause errors or weird behavior (depending on the file's contents).
To elaborate, hooks are variables which define lists of commands that are executed when specific events happen within your Emacs session, e.g., the loading of a major editing mode, or, as in this case, the creation of a new frame. See the relevant Emacs manual page on hooks for more information. Generally speaking, if you want some function to be executed every time a particular event occurs within Emacs, adding said function to the right pre-existing hook is probably the best way to go about it.

Emacs: Tab completion of file name appends an extra i:\cygwin

I am facing some strange behavior with file-name completion in emacs. C-x C-f to find file opens up the minibuffer with i:/cygwin/home/rrajagop/StockScreener/working_copy/master_repo/stock_screener/. Hitting a TAB makes it i:/cygwini:/cygwin/home/rrajagop/StockScreener/working_copy/master_repo/stock_screener/. A couple of interesting things I've noticed:
When the minibuffer opens up, i:/cygwin is greyed out and the path seems to start from /home. A C-a (go to begining of line) takes me to /home and not to i:/cygwin. So it looks like something in emacs is parsing the path to start from /home and not from i:/cygwin.
I checked that TAB runs minibuffer-complete from minibuffer.el (by doing a describe-key for TAB), so it looks like minibuffer-complete is doing some translation for cygwin and appending the extra i:/cygwin.
How would I go about figuring this out/fixing it?
EDIT: Extra Information
I tried opening up emacs with -Q and this problem doesn't happen. So this is something I'm loading in my .emacs. This is what I have in my .emacs
(require 'cl)
; Needed to see how fast Emacs loads. Loading time is printed at the
; and of the execution of .emacs file.
(defvar *emacs-load-start* (current-time))
; I really like this font. I also tried Monaco which you can
; see on lot of Railscasts but I couldn't find the one which
; supports Serbian Cyrillic and Latin letters.
(set-default-font "-outline-Courier New-normal-r-normal-normal-19-142-96-96-c-*-iso8859-1")
;; Don't show that splash screen
(setq inhibit-startup-message t)
; This should allegedly speed up Emacs starting by preventing
; some requests from the window manager back to the Emacs. Frankly
; speaking I didn't notice some speed up but I still keep it:(
(modify-frame-parameters nil '((wait-for-wm . nil)))
;Allows syntax highlighting to work, among other things
(global-font-lock-mode 1)
; Sets initial window position
(set-frame-position (selected-frame) 0 0)
; Sets initial window size to 85 columns and 47 rows
(set-frame-size (selected-frame) 88 32)
; Makes last line ends in carriage return
(setq requre-final-newline t)
; Sets Ctrl-x / key combination for easy commenting
; out of selected lines.
(global-set-key "\C-x/" 'comment-or-uncomment-region)
; Allow resizing of the mini-buffer when necessary
(setq resize-minibuffer-mode t)
; Auto magically read compressed files
(auto-compression-mode 1)
; Set standard indent to 2 rather then 4
(setq standard-indent 2)
; This tells Emacs to create backup files.
(setq make-backup-files t)
; And this will enable versioning with default values.
(setq version-control t)
; Remove annoying message about deleting excess backup of .recentf
; which is list of recent files used
(setq delete-old-versions t)
; Finally do not spread backups all over the disk.
; Just save all backup files in this directory.
(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))
;; Directory to put various el files.
(add-to-list 'load-path "~/.emacs.d/includes")
(require 'ascii-table)
;; Loading collection of generic modes for different languages
(require 'generic-x)
;; Recent files
(require 'recentf)
(recentf-mode 1)
;; Loads ruby mode when a ruby file is opened.
(autoload 'ruby-mode "ruby-mode" "Major mode for editing ruby scripts." t)
(setq auto-mode-alist (cons '(".rb$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '(".rhtml$" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '(".html.erb$" . html-mode) auto-mode-alist))
;; Turn on ruby electric (auto completion of parenthesis, etc.)
(add-hook 'ruby-mode-hook
(lambda()
(add-hook 'local-write-file-hooks
'(lambda()
(save-excursion
(untabify (point-min) (point-max))
(delete-trailing-whitespace) )))
(set (make-local-variable 'indent-tabs-mode) 'nil)
(set (make-local-variable 'tab-width) 2)
(imenu-add-to-menubar "IMENU")
(define-key ruby-mode-map "\C-m" 'newline-and-indent)
(require 'ruby-electric)
(ruby-electric-mode t) ))
;; Ruby debugging.
(add-to-list 'load-path "~/.emacs.d/plugins/rdebug")
(autoload 'rdebug "rdebug" "Ruby debugging support." t)
(global-set-key [f9] 'gud-step)
(global-set-key [f10] 'gud-next)
(global-set-key [f11] 'gud-cont)
(global-set-key "\C-c\C-d" 'rdebug)
;; set compile command based on current major mode
(autoload 'mode-compile "mode-compile"
"Command to compile current buffer file based on the major mode" t)
(global-set-key "\C-cc" 'mode-compile)
(autoload 'mode-compile-kill "mode-compile"
"Command to kill a compilation launched by `mode-compile'" t)
(global-set-key "\C-ck" 'mode-compile-kill)
;; yasnippet - adding code snippet insertion
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets")
;; Use CYGWIN bash
(require 'setup-cygwin)
;; Subversion integration via psvn - not gonna use svn anymore
;; (require 'psvn)
;; add some elisp tutorials to the info directory
(let ((info-root (concat usb-drive-letter "cygwin/usr/local/bin/emacs/info/")))
(setq Info-directory-list (list info-root
(concat info-root "elisp-tutorial-2.04/")
(concat info-root "emacs-lisp-intro-2.14")) )
)
;; Load time for .emacs - this should be the last line in .emacs for accurate load time
(message "ido and org-install took: %ds"
(destructuring-bind (hi lo ms) (current-time)
(- (+ hi lo) (+ (first *emacs-load-start*) (second *emacs-load-start*)) )))
I think my answer to your previous question on finding the package loading tramp will help you out here.
you can control tramp by changing the variable tramp-mode.
Side note, you would probably find it useful to use customize to customize emacs.
I did a customize-apropos with tramp and it found the tramp group. Clicking there showed all the ways to configure tramp, including turning it off.
File-name-shadow-mode greys out the c: in the file name..... so when cygwin-mount-substitute-longest-mount-name runs it does no see the c: and adds another
M-x find-file
c:/home/
> a
c:/home/a ; but the c: is greyed
> TAB
c:c:/home/anything