Browse files

Merge pull request #112 from DarwinAwardWinner/patch-3

Prevent ido-find-file from suggesting "/******" when run on a C comment
  • Loading branch information...
2 parents 86ba11b + 930544b commit 421d7a39f09b9e0f98d44188227a301858597181 @technomancy technomancy committed Nov 26, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 starter-kit-misc.el
View
16 starter-kit-misc.el
@@ -89,6 +89,22 @@
ido-handle-duplicate-virtual-buffers 2
ido-max-prospects 10)
+(require 'ffap)
+(defvar ffap-c-commment-regexp "^/\\*+"
+ "Matches an opening C-style comment, like \"/***\".")
+
+(defadvice ffap-guesser (after avoid-c-comments activate)
+ "Don't return paths like \"/******\" unless they actually exist.
+
+This fixes the bug where ido would try to suggest a C-style
+comment as a filename."
+ (ignore-errors
+ (when (and ad-return-value
+ (string-match-p ffap-c-commment-regexp
+ ad-return-value)
+ (not (ffap-file-exists-string ad-return-value)))
+ (setq ad-return-value nil))))
+
(set-default 'indent-tabs-mode nil)
(set-default 'indicate-empty-lines t)
(set-default 'imenu-auto-rescan t)

0 comments on commit 421d7a3

Please sign in to comment.