unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Fwd: flymake-start-syntax-check-process ignores dir setting
       [not found] <2D75B365-730A-4827-90A9-04C5DE907731@duncf.ca>
@ 2011-04-07 14:42 ` David Reitter
  2011-04-20 18:08   ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: David Reitter @ 2011-04-07 14:42 UTC (permalink / raw)
  To: Emacs-Devel devel; +Cc: duncan

[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]

Here's a patch from someone regarding flymake.el.
I think that if this is good, it should be applied upstream.

Begin forwarded message:

> From: Duncan Findlay <duncan@duncf.ca>
> Date: April 5, 2011 9:13:36 PM EDT
> To: aquamacs-bugs@aquamacs.org
> Subject: [Aquamacs-bugs] 23.3; flymake-start-syntax-check-process ignores dir setting
> Reply-To: Bug reports for Aquamacs Emacs <aquamacs-bugs@aquamacs.org>
> 
> Hi,
> 
> I'm having trouble using flymake in Aquamacs 2.2. I want to run "pyflakes" on my local host while editing remote Python (.py) files. This worked in Aquamacs 2.1, but it looks like 2.2 now has support for running commands on remote hosts. This is a good thing, but unfortunately, I don't want pyflakes running remotely.
> 
> (The relavent change is here: https://github.com/davidswelt/aquamacs-emacs/commit/7a542acd40a722a556dcadc039aa8e00645dfd00#lisp/progmodes/flymake.el)
> 
> From looking through the source, it looks like flymake-start-syntax-check-process takes a dir argument, so that one can customize what directory the flymake syntax checking process starts in. Now that this function calls start-file-process instead of start-process, this dir argument also ought to control what host the process starts on, so I can use it to make sure it starts locally.
> 
> Unfortunately this dir variable seems to be pretty much ignored. I'm not competent in Emacs Lisp, but I did come up with this ugly patch (attached) that seems to work. I'm sure there's a much simpler and more elegant way to do what I'm trying to do, but hopefully you get the idea.
> 
> The relevant section of my Preferences.el used to set up flymake to run pyflakes on Python files is also attached. 
> 
> Thanks
> 
> Duncan
> 
> 
> 
> 

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 925 bytes --]

--- /Users/duncan/tmp/flymake.el.new	2011-04-05 17:02:54.000000000 -0700
+++ /Users/duncan/Library/Preferences/Aquamacs Emacs/flymake.el	2011-04-05 17:50:08.000000000 -0700
@@ -1149,11 +1149,13 @@
   (let* ((process nil))
     (condition-case err
 	(progn
-	  (when dir
+	  (if dir
 	    (let ((default-directory dir))
-	      (flymake-log 3 "starting process on dir %s" default-directory)))
-	  (setq process (apply 'start-file-process
-			       "flymake-proc" (current-buffer) cmd args))
+	      (flymake-log 3 "starting process on dir %s" default-directory)
+	      (setq process (apply 'start-file-process
+				   "flymake-proc" (current-buffer) cmd args)))
+	    ((setq process (apply 'start-file-process
+				  "flymake-proc" (current-buffer) cmd args))))
 	  (set-process-sentinel process 'flymake-process-sentinel)
 	  (set-process-filter process 'flymake-process-filter)
           (push process flymake-processes)

[-- Attachment #3: Preferences.el --]
[-- Type: application/octet-stream, Size: 1805 bytes --]

;; pyflakes
;; from http://plope.com/Members/chrism/flymake-mode
;; and http://www.emacswiki.org/emacs/FlymakeRuby

(setq flymake-log-level 3)

(defun flymake-create-temp-intemp (file-name prefix)
  "Return file name in temporary directory for checking FILE-NAME.
This is a replacement for `flymake-create-temp-inplace'. The
difference is that it gives a file name in
`temporary-file-directory' instead of the same directory as
FILE-NAME.

For the use of PREFIX see that function.

Note that not making the temporary file in another directory
\(like here) will not if the file you are checking depends on
relative paths to other files \(for the type of checks flymake
makes)."
  (unless (stringp file-name)
    (error "Invalid file-name"))
  (or prefix
      (setq prefix "flymake"))
  (let* ((name (concat
                (file-name-nondirectory
                 (file-name-sans-extension file-name))
                "_" prefix))
         (ext  (concat "." (file-name-extension file-name)))
         (temp-name (make-temp-file name nil ext))
         )
    (flymake-log 3 "create-temp-intemp: file=%s temp=%s" file-name temp-name)
    temp-name))

(when (load "flymake" t)
  (defun flymake-pyflakes-init ()
    (let* ((temp-file (flymake-init-create-temp-buffer-copy
                       'flymake-create-temp-intemp))
           (local-file (file-relative-name
                        temp-file
                        (file-name-directory buffer-file-name))))
      (flymake-log 3 "flymake-pyflakes-init: temp=%s dir=%s" buffer-file-name (file-name-directory temp-file))
      (list "pyflakes" (list local-file) (file-name-directory temp-file))))

  (add-to-list 'flymake-allowed-file-name-masks
               '("\\.py\\'" flymake-pyflakes-init)))

(add-hook 'find-file-hook 'flymake-find-file-hook)

[-- Attachment #4: Type: text/plain, Size: 4 bytes --]

> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fwd: flymake-start-syntax-check-process ignores dir setting
  2011-04-07 14:42 ` Fwd: flymake-start-syntax-check-process ignores dir setting David Reitter
@ 2011-04-20 18:08   ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2011-04-20 18:08 UTC (permalink / raw)
  To: duncan; +Cc: Emacs-Devel devel

> Here's a patch from someone regarding flymake.el.
> I think that if this is good, it should be applied upstream.

I've installed a similar change, thank you,


        Stefan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-20 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2D75B365-730A-4827-90A9-04C5DE907731@duncf.ca>
2011-04-07 14:42 ` Fwd: flymake-start-syntax-check-process ignores dir setting David Reitter
2011-04-20 18:08   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).