FAQ
I'm using Emacs for Mac (http://emacsformacosx.com/, Version 24.2) and seem
to be having some issues knowing how to use the gofmt properly.

If I run M-x gofmt, a split window appears at the bottom which shows the
proper diff for the file I am working on. Now I have really no idea how to
apply the diff, or is it suppose to apply on its own? To note, the file I
am working on exists and I am *not* working on a temporary buffer.

At the echo area, I get something like so:
Use file /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525:
/var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525

If I hit ENTER, I get put into another location on my file system. If I hit
TAB, I get "No match found"


I've tried also adding the save-hook and the same (problem?) appears.

Anyone else using emacs in go mode and know how to use the M-x gofmt
properly?





--

Search Discussions

  • Sameer Ajmani at Oct 22, 2012 at 3:12 am
    The diff is supposed to apply on its own, and the split window should
    disappear immediately.
    On Oct 21, 2012 9:03 PM, "paprika" wrote:

    I'm using Emacs for Mac (http://emacsformacosx.com/, Version 24.2) and
    seem to be having some issues knowing how to use the gofmt properly.

    If I run M-x gofmt, a split window appears at the bottom which shows the
    proper diff for the file I am working on. Now I have really no idea how to
    apply the diff, or is it suppose to apply on its own? To note, the file I
    am working on exists and I am *not* working on a temporary buffer.

    At the echo area, I get something like so:
    Use file
    /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525:
    /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525

    If I hit ENTER, I get put into another location on my file system. If I
    hit TAB, I get "No match found"


    I've tried also adding the save-hook and the same (problem?) appears.

    Anyone else using emacs in go mode and know how to use the M-x gofmt
    properly?





    --

    --
  • Rafrombrc at Oct 23, 2012 at 10:38 am
    I was having the same problem. I took a peek at the gofmt stuff in the
    go-mode.el file and noticed the following line in the `gofmt-apply-patch`
    function:

    (replace-regexp "^--- /tmp/gofmt[0-9]*" (concat "--- " filename)

    The hard-coded /tmp path seemed suspicious, since clearly that's not where
    OSX is putting its temporary files these days. I changed this to:

    (replace-regexp "^--- /var/folders/.*/gofmt[0-9]*" (concat "--- "
    filename)

    and it now seems to be working.

    Hope this helps!

    -r

    On Sunday, 21 October 2012 17:45:05 UTC-7, paprika wrote:

    I'm using Emacs for Mac (http://emacsformacosx.com/, Version 24.2) and
    seem to be having some issues knowing how to use the gofmt properly.

    If I run M-x gofmt, a split window appears at the bottom which shows the
    proper diff for the file I am working on. Now I have really no idea how to
    apply the diff, or is it suppose to apply on its own? To note, the file I
    am working on exists and I am *not* working on a temporary buffer.

    At the echo area, I get something like so:
    Use file
    /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525:
    /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525

    If I hit ENTER, I get put into another location on my file system. If I
    hit TAB, I get "No match found"


    I've tried also adding the save-hook and the same (problem?) appears.

    Anyone else using emacs in go mode and know how to use the M-x gofmt
    properly?




    --
  • Arianit at Oct 23, 2012 at 4:56 pm
    Yup, that fixed the issue. Thanks!

    I thought it didn't work at the start, but realized I still had byte
    compiled files. I re-compiled and it's fine now!
    On Tuesday, October 23, 2012 3:30:08 AM UTC-4, rafr...@gmail.com wrote:

    I was having the same problem. I took a peek at the gofmt stuff in the
    go-mode.el file and noticed the following line in the `gofmt-apply-patch`
    function:

    (replace-regexp "^--- /tmp/gofmt[0-9]*" (concat "--- " filename)

    The hard-coded /tmp path seemed suspicious, since clearly that's not where
    OSX is putting its temporary files these days. I changed this to:

    (replace-regexp "^--- /var/folders/.*/gofmt[0-9]*" (concat "--- "
    filename)

    and it now seems to be working.

    Hope this helps!

    -r

    On Sunday, 21 October 2012 17:45:05 UTC-7, paprika wrote:

    I'm using Emacs for Mac (http://emacsformacosx.com/, Version 24.2) and
    seem to be having some issues knowing how to use the gofmt properly.

    If I run M-x gofmt, a split window appears at the bottom which shows the
    proper diff for the file I am working on. Now I have really no idea how to
    apply the diff, or is it suppose to apply on its own? To note, the file I
    am working on exists and I am *not* working on a temporary buffer.

    At the echo area, I get something like so:
    Use file
    /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525:
    /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525

    If I hit ENTER, I get put into another location on my file system. If I
    hit TAB, I get "No match found"


    I've tried also adding the save-hook and the same (problem?) appears.

    Anyone else using emacs in go mode and know how to use the M-x gofmt
    properly?




    --
  • Dustin at Oct 25, 2012 at 1:30 am

    On Tuesday, October 23, 2012 12:30:08 AM UTC-7, rafr...@gmail.com wrote:
    I was having the same problem. I took a peek at the gofmt stuff in the
    go-mode.el file and noticed the following line in the `gofmt-apply-patch`
    function:

    (replace-regexp "^--- /tmp/gofmt[0-9]*" (concat "--- " filename)

    The hard-coded /tmp path seemed suspicious, since clearly that's not where
    OSX is putting its temporary files these days. I changed this to:

    (replace-regexp "^--- /var/folders/.*/gofmt[0-9]*" (concat "--- "
    filename)

    and it now seems to be working.
    At the echo area, I get something like so:

    Ah, this has been bugging me for a while... The correct answer there is
    to use 'temporary-file-directory -- I'll see if I can get a patch for this.
    I haven't actually tried to solve the problem, just been annoyed. Thanks
    for the pointer. :)

    --
  • Dustin at Oct 25, 2012 at 1:36 am
    BTW, this was already fixed in tip a while back (I haven't tried it, just
    my fix as mentioned at the bottom.

    http://code.google.com/p/go/issues/detail?id=3782

    On Tuesday, October 23, 2012 12:30:08 AM UTC-7, rafr...@gmail.com wrote:

    I was having the same problem. I took a peek at the gofmt stuff in the
    go-mode.el file and noticed the following line in the `gofmt-apply-patch`
    function:

    (replace-regexp "^--- /tmp/gofmt[0-9]*" (concat "--- " filename)

    The hard-coded /tmp path seemed suspicious, since clearly that's not where
    OSX is putting its temporary files these days. I changed this to:

    (replace-regexp "^--- /var/folders/.*/gofmt[0-9]*" (concat "--- "
    filename)

    and it now seems to be working.

    Hope this helps!

    -r

    On Sunday, 21 October 2012 17:45:05 UTC-7, paprika wrote:

    I'm using Emacs for Mac (http://emacsformacosx.com/, Version 24.2) and
    seem to be having some issues knowing how to use the gofmt properly.

    If I run M-x gofmt, a split window appears at the bottom which shows the
    proper diff for the file I am working on. Now I have really no idea how to
    apply the diff, or is it suppose to apply on its own? To note, the file I
    am working on exists and I am *not* working on a temporary buffer.

    At the echo area, I get something like so:
    Use file
    /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525:
    /var/folders/44/_d6_t5zj2kbc6qzdm21xzz0m0000gn/T/gofmt153427525

    If I hit ENTER, I get put into another location on my file system. If I
    hit TAB, I get "No match found"


    I've tried also adding the save-hook and the same (problem?) appears.

    Anyone else using emacs in go mode and know how to use the M-x gofmt
    properly?




    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 22, '12 at 1:03a
activeOct 25, '12 at 1:36a
posts6
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase