FAQ
Type the following into a new go-mode buffer, and save. After Gofmt
reports the error on line 28 (trailing comma on the 1st test), it appears
as though emacs will no longer save the buffer to disk until the error is
corrected. That seems like odd behavior to me, I'd always expect save to
at least write the current file to disk even if it complains about syntax
errors.

package lexrec

import (
"fmt"
"strings"
"testing"
)

const (
ItemIgnore ItemType = ItemEOF + 1 + iota
ItemAorB
)

type lexTest struct {
name string
input string
record Record
expect []Item
}

var (
tItemEOF = Item{ItemEOF, 0, ""}
)

var parseA = Record{Buflen: 1, ErrorFn: SkipPast("\n"), States:
[]Binding{{ItemA, AcceptRun("a"), true}}}

var lexTests = []lexTest{
{"empty", "", parseA, []Item[tItemEOF]},
}

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Dominik Honnef at Feb 22, 2013 at 6:07 pm
    I cannot reproduce this. the gofmt-before-save hook does open the error
    buffer, but the file also gets saved. Can you reproduce this with a
    vanilla emacs (emacs -Q) that just loads go-mode and adds the hook?
    Without any other customizations or scripts.

    Jim Robinson <jim.robinson@gmail.com> writes:
    Type the following into a new go-mode buffer, and save. After Gofmt
    reports the error on line 28 (trailing comma on the 1st test), it appears
    as though emacs will no longer save the buffer to disk until the error is
    corrected. That seems like odd behavior to me, I'd always expect save to
    at least write the current file to disk even if it complains about syntax
    errors.

    package lexrec

    import (
    "fmt"
    "strings"
    "testing"
    )

    const (
    ItemIgnore ItemType = ItemEOF + 1 + iota
    ItemAorB
    )

    type lexTest struct {
    name string
    input string
    record Record
    expect []Item
    }

    var (
    tItemEOF = Item{ItemEOF, 0, ""}
    )

    var parseA = Record{Buflen: 1, ErrorFn: SkipPast("\n"), States:
    []Binding{{ItemA, AcceptRun("a"), true}}}

    var lexTests = []lexTest{
    {"empty", "", parseA, []Item[tItemEOF]},
    }
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jim Robinson at Feb 22, 2013 at 6:25 pm

    On Friday, February 22, 2013 10:07:45 AM UTC-8, Dominik Honnef wrote:

    I cannot reproduce this. the gofmt-before-save hook does open the error
    buffer, but the file also gets saved. Can you reproduce this with a
    vanilla emacs (emacs -Q) that just loads go-mode and adds the hook?
    Without any other customizations or scripts.

    Hrmm, my apologies you are correct: if I disable everything else there's no
    problem.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jim Robinson at Feb 22, 2013 at 6:37 pm

    On Friday, February 22, 2013 10:25:43 AM UTC-8, Jim Robinson wrote:
    On Friday, February 22, 2013 10:07:45 AM UTC-8, Dominik Honnef wrote:

    I cannot reproduce this. the gofmt-before-save hook does open the error
    buffer, but the file also gets saved. Can you reproduce this with a
    vanilla emacs (emacs -Q) that just loads go-mode and adds the hook?
    Without any other customizations or scripts.

    Hrmm, my apologies you are correct: if I disable everything else there's
    no problem.
    It appears this is coming from gofmt-before-save. When I have it enabled:

    (add-to-list 'load-path "/usr/local/src/go/misc/emacs" t)
    (require 'go-mode-loads)
    (add-hook 'before-save-hook #'gofmt-before-save)

    I get the error behavior. If I comment out the gofmt-before-save hook, I
    don't.

    Jim


    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dominik Honnef at Feb 22, 2013 at 6:43 pm

    Jim Robinson writes:

    It appears this is coming from gofmt-before-save. When I have it enabled:

    (add-to-list 'load-path "/usr/local/src/go/misc/emacs" t)
    (require 'go-mode-loads)
    (add-hook 'before-save-hook #'gofmt-before-save)

    I get the error behavior. If I comment out the gofmt-before-save hook, I
    don't.
    I did want you to keep that hook. That's the part that's actually
    responsible for running gofmt before trying to save a buffer. But even
    with that hook I fail to reproduce the problem. It still saves, despite
    the errors.
    (add-to-list 'load-path "/usr/local/src/go/misc/emacs" t)
    Did you put the revised go-mode.el at that location? I'd assume the
    original, current go-mode at that location, especially because it's a
    system path.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jim Robinson at Feb 22, 2013 at 6:58 pm

    On Friday, February 22, 2013 10:43:10 AM UTC-8, Dominik Honnef wrote:

    I did want you to keep that hook. That's the part that's actually
    responsible for running gofmt before trying to save a buffer. But even
    with that hook I fail to reproduce the problem. It still saves, despite
    the errors.
    (add-to-list 'load-path "/usr/local/src/go/misc/emacs" t)
    Did you put the revised go-mode.el at that location? I'd assume the
    original, current go-mode at that location, especially because it's a
    system path.
    It is the go-mode.el from the links Rob Pike posted at the beginning of
    this thread,
    pulled on the 19th:

    $ ls -l go-mode*
    -rw-r--r-- 1 jimr admin 2411 Feb 19 16:22 go-mode-loads.el
    -rw-r--r-- 1 jimr admin 28370 Feb 19 16:22 go-mode.el

    $ wc -l go-mode*
    81 go-mode-loads.el
    715 go-mode.el
    796 total

    $ md5sum go-mode-loads.el go-mode.el
    24889f1bcacfdc8108a7b9dd4d799060 go-mode-loads.el
    48d6d781c4874502f2688c760a57e7e3 go-mode.el

    I'm going to download https://codereview.appspot.com/7314113/ to see if
    they are different.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jim Robinson at Feb 22, 2013 at 7:19 pm
    Looking back at what I've written I'm not sure it was clear what I was
    reporting. The *initial* save works, but if I make a subsequent
    modification to the file, I can't save those changes.

    So

    (a) open file w/ typo
    (b) try to save, get a gofmt error, but it does save
    (c) type a few more random characters into the buffer and try to save
    (d) get an error "Buffer is read-only: #<buffer *Gofmt Errors*>

    This is in Aquamacs, which has always claimed to be GNU Emacs with a few
    standard libraries bundled (it currently says it is GNU Emacs 23.3.50.1).

    Downloading the patches and applying them to the original code nets me a
    3rd set of elisp files... At this point I'm not sure what the proper set
    is. :(

    (1) http://highwire.stanford.edu/~jimr/go-misc-emacs/orig/go-mode.el
    (2) http://highwire.stanford.edu/~jimr/go-misc-emacs/feb19/go-mode.el
    (3) http://highwire.stanford.edu/~jimr/go-misc-emacs/feb22/go-mode.el

    #1 was what I got from mercurial. #2 was what I downloaded from
    http://play.golang.org/p/w8jWpq_umz on the 19th. And #3 is what I just
    produced by applying the patches in the CL on
    https://codereview.appspot.com/7314113/ to my original go-mode.el.

    I seem to get the error if I have gofmt enabled with #2 and #3. With #1 I
    get the gofmt error each time I hit save,but the file does save.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dominik Honnef at Feb 22, 2013 at 7:38 pm

    Jim Robinson writes:

    Looking back at what I've written I'm not sure it was clear what I was
    reporting. The *initial* save works, but if I make a subsequent
    modification to the file, I can't save those changes.

    So

    (a) open file w/ typo
    (b) try to save, get a gofmt error, but it does save
    (c) type a few more random characters into the buffer and try to save
    (d) get an error "Buffer is read-only: #<buffer *Gofmt Errors*>
    Ah! Yes, that I can reproduce. I skipped step c before. I'll fix this
    shortly, I already know what's causing that.

    Cheers,
    Dominik

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Bryanturley at Feb 22, 2013 at 8:42 pm
    indention of labels and syntax highlighting of labels with _ is broken I
    believe.

    here is some example code http://play.golang.org/p/mnc6QwCVOZ

    labels should be back one indention and you possibly already fixed the _
    problem.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Bryanturley at Feb 22, 2013 at 8:50 pm

    On Friday, February 22, 2013 2:42:47 PM UTC-6, bryanturley wrote:
    indention of labels and syntax highlighting of labels with _ is broken I
    believe.

    here is some example code http://play.golang.org/p/mnc6QwCVOZ

    labels should be back one indention and you possibly already fixed the _
    problem.
    that is indention of any labels (with or without _)

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dominik Honnef at Feb 22, 2013 at 9:54 pm

    bryanturley writes:
    On Friday, February 22, 2013 2:42:47 PM UTC-6, bryanturley wrote:

    indention of labels and syntax highlighting of labels with _ is broken I
    believe.

    here is some example code http://play.golang.org/p/mnc6QwCVOZ

    labels should be back one indention and you possibly already fixed the _
    problem.
    that is indention of any labels (with or without _)
    Fixed. We already did outindent labels correctly, but we didn't allow _,
    or any unicode, in them. That's fixed now.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dominik Honnef at Feb 22, 2013 at 9:54 pm

    Dominik Honnef writes:

    Jim Robinson <jim.robinson@gmail.com> writes:
    Looking back at what I've written I'm not sure it was clear what I was
    reporting. The *initial* save works, but if I make a subsequent
    modification to the file, I can't save those changes.

    So

    (a) open file w/ typo
    (b) try to save, get a gofmt error, but it does save
    (c) type a few more random characters into the buffer and try to save
    (d) get an error "Buffer is read-only: #<buffer *Gofmt Errors*>
    Ah! Yes, that I can reproduce. I skipped step c before. I'll fix this
    shortly, I already know what's causing that.

    Cheers,
    Dominik
    Fixed.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dominik Honnef at Feb 22, 2013 at 10:03 pm

    Rob Pike writes:

    In a CL at https://codereview.appspot.com/7314113/, Dominik Honnef has
    been working on emacs support for Go. I hope that this work leads to a
    single improved emacs setup for all our emacs-oriented gophers. I
    would like to be sure that we actually achieve that before we check in
    this CL. To that end, if you use emacs to write Go I encourage you to
    try out this setup and see if it works for you. To make that easy, in
    an unprecedented step I have loaded some elisp into the playground;
    you can grab the files there without hg clpatch etc. Please let us
    know what you discover.

    go-mode-load.el: http://play.golang.org/p/w8jWpq_umz (the file comment
    there calls it go-mode-loads.el)
    go-mode.el: http://play.golang.org/p/nCHi65PVCS

    Thanks.

    -rob
    I would suggest moving on with the CL. All "critical" bugs should be
    eliminated by now and the CL is getting a bit unwieldy (which is not
    made easier by rietveld failing to properly render some diffs).

    I have more adjustments to the mode planned, but they would greatly
    benefit from being adressed in new, way smaller CLs, instead of trying
    to push them into the existing CL.

    Apart from that, there are way too many versions of the mode now, so
    some people try the one you initially uploaded, some use mine, some use
    the latest from the CL and it makes diagnosing problems a lot harder.
    I'd like future bug reports to be based on one single source.

    I think the consensus is that there are way too many changes to read the
    code, but that it works better than before :)

    Yours,
    Dominik

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Robert Zaremba at Mar 4, 2013 at 10:17 pm
    I've updated go-mode and make pul-request to Dominiks github. Changes:

    - Compatibility with Emacs Lisp header conventions. Now it can be used
    by *package.el*
    - Proper definition of *go-mode* mode
    - definition of *go-mode-hook*
    - Installation instrucions

    I encourage to delete "go-mode-load.el" end relay on *package.el* It
    delivers all we need to automatic handling new packages, and generating
    autoloads.
    So the installation now is as simple as package-install-file go-mode.el

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tong Sun at Mar 5, 2013 at 2:34 am
    How to install this go-mode?
    I went through all Dominik's posts but didn't find it.

    Please advice.

    Thanks

    On Monday, March 4, 2013 5:17:05 PM UTC-5, Robert Zaremba wrote:

    I encourage to delete "go-mode-load.el" end relay on *package.el* It
    delivers all we need to automatic handling new packages, and generating
    autoloads.
    So the installation now is as simple as package-install-file go-mode.el
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Brad Fitzpatrick at Mar 5, 2013 at 2:35 am
    See https://code.google.com/p/go-wiki/wiki/IDEsAndTextEditorPlugins
    On Mon, Mar 4, 2013 at 6:34 PM, Tong Sun wrote:

    How to install this go-mode?
    I went through all Dominik's posts but didn't find it.

    Please advice.

    Thanks

    On Monday, March 4, 2013 5:17:05 PM UTC-5, Robert Zaremba wrote:

    I encourage to delete "go-mode-load.el" end relay on *package.el* It
    delivers all we need to automatic handling new packages, and generating
    autoloads.
    So the installation now is as simple as package-install-file go-mode.el
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tong Sun at Mar 5, 2013 at 2:42 am
    Alright, one question answered, as where is the latest code. Thanks.
    However, Is there a installation doc somewhere?
    What does the "I encourage to delete "go-mode-load.el" end relay on
    package.el " and "So the installation now is as simple as
    package-install-file go-mode.el" mean? They are still Greek to me.

    Thanks


    On Mon, Mar 4, 2013 at 9:35 PM, Brad Fitzpatrick wrote:

    See https://code.google.com/p/go-wiki/wiki/IDEsAndTextEditorPlugins
    On Mon, Mar 4, 2013 at 6:34 PM, Tong Sun wrote:

    How to install this go-mode?
    I went through all Dominik's posts but didn't find it.

    Please advice.

    Thanks

    On Monday, March 4, 2013 5:17:05 PM UTC-5, Robert Zaremba wrote:

    I encourage to delete "go-mode-load.el" end relay on *package.el* It
    delivers all we need to automatic handling new packages, and generating
    autoloads.
    So the installation now is as simple as package-install-file go-mode.el
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tong Sun at Mar 5, 2013 at 3:41 am

    On Mon, Mar 4, 2013 at 10:23 PM, Dominik Honnef wrote:

    The installation guide is in the go-mode-load.el file, at the very top.
    Thanks,

    so go-mode-load.el shall be put at a place defined by the

    (add-to-list 'load-path "PATH CONTAINING go-mode-load.el" t)

    line.

    Now, how about the go-mode.el and it compiled binary, where should I put
    them?
    Shall I replace my /usr/share/emacs/site-lisp/golang-mode/go-mode.el, or
    put it somewhere else?
    Is it suggested to put go-mode-load.el
    into /usr/share/emacs/site-lisp/golang-mode/ as well?

    Thanks

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Bryanturley at Mar 5, 2013 at 4:07 am

    On Monday, March 4, 2013 9:41:13 PM UTC-6, Tong Sun wrote:

    On Mon, Mar 4, 2013 at 10:23 PM, Dominik Honnef <domi...@fork-bomb.org<javascript:>
    wrote:
    The installation guide is in the go-mode-load.el file, at the very top.
    Thanks,

    so go-mode-load.el shall be put at a place defined by the

    (add-to-list 'load-path "PATH CONTAINING go-mode-load.el" t)
    notice the "PATH CONTAINING" bit there?

    /some/place/on/your/fs/go-mode-load.el

    line.
    Now, how about the go-mode.el and it compiled binary, where should I put
    them?
    Shall I replace my /usr/share/emacs/site-lisp/golang-mode/go-mode.el, or
    put it somewhere else?
    Is it suggested to put go-mode-load.el
    into /usr/share/emacs/site-lisp/golang-mode/ as well?

    Thanks
    See above comment.
    I have also just symlinked it into site-lisp from where i put the hg repo,
    but that is probably a bit of a dirty solution.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tong Sun at Mar 5, 2013 at 4:38 am

    On Mon, Mar 4, 2013 at 11:07 PM, bryanturley wrote:

    See above comment.
    Sorry, you lost me.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Bryanturley at Mar 6, 2013 at 1:03 am

    On Tuesday, March 5, 2013 6:57:15 PM UTC-6, Robert Zaremba wrote:
    How much time takes your Emacs startup?
    Not sure, never bothers me ;)
    Appears to be (visual measurement only) 1/4 to 1/2 second.
    Slightly more than 1 second on first run after boot or file cache clearing.

    I said "never expected emacs to be blazingly fast" doesn't mean I would
    tolerate a slow editor.
    Baring remote connection latency and other external slowness.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Bryanturley at Mar 6, 2013 at 1:07 am

    On Tuesday, March 5, 2013 7:03:49 PM UTC-6, bryanturley wrote:
    On Tuesday, March 5, 2013 6:57:15 PM UTC-6, Robert Zaremba wrote:

    How much time takes your Emacs startup?
    Not sure, never bothers me ;)
    Appears to be (visual measurement only) 1/4 to 1/2 second.
    Slightly more than 1 second on first run after boot or file cache clearing.
    I only ever run it in a terminal, don't like it making it's own windows
    that might have something to do with startup time as well.

    I said "never expected emacs to be blazingly fast" doesn't mean I would
    tolerate a slow editor.
    Baring remote connection latency and other external slowness.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 22, '13 at 5:56p
activeMar 6, '13 at 1:07a
posts22
users6
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase