Coder Social home page Coder Social logo

dylan-emacs-support's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dylan-emacs-support's Issues

swank:buffer-first-change is not present as a key

M-x dime
open strings
build
,change-package strings
C-x C-f strings.dylan
C-o

Evaluation aborted on Error:
swank:buffer-first-change is not present as a key for
#[(swank:set-package -> {method ( ())}),
(swank:dylan-subclasses -> {method ( ())}), (swank:connection-info -> {method ()}),
(swank:describe-symbol -> {method ( ())}), (swank:default-directory -> {method ()}),
(swank:dylan-superclasses -> {method ( ())}),
(swank:create-repl -> {method ( ())}),
(swank:find-definitions-for-emacs -> {method ( ())}),
(swank:set-default-directory -> {method ( ())}), (swank:quit-lisp -> {method ()}),
(swank:listener-eval -> {method ( ())}),
(swank:compile-file-for-emacs -> {method ( ())}),
(swank:list-all-package-names -> {method ( ())}),
(swank:xref -> {method ( (, ))}),
(swank:operator-arglist -> {method ( (, ))}),
(swank:compiler-notes-for-emacs -> {method ()})].
.

identifier highlighting is broken

in the expression let foo-bar = 24; foo gets highlighted, but -bar doesn't. It works fine if you write let foo-bar :: <integer> = 24. A similar issue appears in slots:

define class <foo> (<object>)
  slot foo-bar
end;

vs

define class <foo> (<object>)
  slot foo-bar :: <integer>
end;

de-indent for Newline immediately following "("

What we have now:

let foo = really-long-function-name(
                                    long-argument-1(),
                                    long-argument-2())

What I want:

let foo = really-long-function-name(
             long-argument-1(),
             long-argument-2())

Note, never this:

let foo = really-long-function-name(argument-0-on-same-line(),
             long-argument-1(),
             long-argument-2())

If there's an argument immediately following the open paren then subsequent args should line up under the first (as they do currently):

let foo = really-long-function-name(long-argument-1(),
                                    long-argument-2())

Parameter lists not being displayed

The OD DIME docs say that parameter lists should be displayed when you type ( and when you type , inside a parameter list. This isn't happening for me despite that M-. works, so I know the connection is good and the project compiled correctly.

I didn't see any errors, nor any messages that looked relevant in *inferior-dylan*.

  • version: 9d2891e
  • macOS Sonoma 14.4
  • emacs 29.2

Line after "define test" indents badly

The body of define test should all indent 2 spaces. Instead, the first body line indents 4 spaces.

define test test-foo ()
    assert-equal(...);
  assert-equal(...);

This is probably my biggest dylan-mode annoyance.

Fix warnings in dime.el

Using DIME @ version 9d2891e these warnings appear in the *Messages* buffer:

Loading /Users/cgay/dylan/workspaces/dylan-emacs-support/dylan.el (source)...done
dime.el: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode' [5 times]
dime.el: Warning: Obsolete calling convention for 'sit-for'
dime-repl.el: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode' [2 times]

Incorrect symbol name used: dime-destructuring-case

In the recent commit 127bead, destructure-case was renamed to dime--destructuring-case everywhere except for its definition where it was called dime-destructuring-case. The definition should be changed to match the uses (that symbol should not be accessed externally, so the double-dash is correct)
definition:
https://github.com/dylan-lang/dylan-mode/blob/127bead9241060bbfb0a0e5dac6e7cfe32708919/dime.el#L614
example of use:
https://github.com/dylan-lang/dylan-mode/blob/127bead9241060bbfb0a0e5dac6e7cfe32708919/dime.el#L1991

License and copyright

Files with Dime prefix

  • dime-browse.el -- good authorship info, GPL version 2 or later.
  • dime-note-tree.el -- who wrote this? GPL version 2 or later.
  • dime-repl.el -- file says main author is Helmut Eller, GPL version 2 or later.
  • dime.el -- file lists several authors, GPL version 2 or later.

Files with Dylan prefix

  • dylan-lid.el -- file says it's written by Erik Charlebois, GPL version 1 or later.
  • dylan-mode.el -- good authorship info, GPL version 1 or later.
  • dylan-optimization-coloring.el -- no license info at all, git log shows it's mainly Hannes Mehnert's work.

Using module prefix defeats colorization

dylan-mode highlights macros like with-open-file. If you import file-system with prefix "fs/" (or probably anything else) the highlighting of fs/with-open-file doesn't happen. To solve this I suppose we need a standard module prefix separator. I actually don't like "/" as in "fs/", but it's the one that sucks less than the other available options, in my opinion.

Splitting the MELPA package into two packages

Currently we have two sets of files: dylan-*.el and dime-*.el. There seems to be a somewhat clean separation between Dime and the other Dylan stuff. The Dime stuff depends on the Dylan stuff, but the Dylan stuff can also be used standalone.

In light of this division, I think we should split into two different Melpa packages: dylan and dime, with dylan as a dependency for dime. Both package names are available so there is no conflict with existing packages.

We can still keep both packages in the same git repo. A Melpa recipe can be written to only pick files matching a shell glob from a repo.

DIME incorrectly claims that inferior-dylan-program isn't set

So I set up DIME with this code

;;; Dylan
(add-to-list 'load-path "~/dylan-mode")
(setq inferior-dylan-program "dswank")
(require 'dime)
(dime-setup '(dime-dylan dime-repl))
(setenv "OPEN_DYLAN_USER_REGISTRIES" "/home/rage/Downloads/opendylan-2014.1/sources/registry")

but when I try to run DIME it claims that I never set inferior-dylan-program. Am I doing something wrong or is the plugin broken somehow.

Only works with Emacs 24.3

Ubuntu 12.10 ships with Emacs 24.1.1, and DIME/dylan-mode does not work. The issues I'm looking at right now include:

  • defvar-local does not exist
  • cl-find-if does not (appear to) exist

I'm fixing these in my fork and will make a pull request once things are copacetic.

Incorrect symbol name used

In the recent commit 127bead, destructure-case was renamed to dime--destructuring-case everywhere except for its definition where it was called dime-destructuring-case. The definition should be changed to match the uses (that symbol should not be accessed externally, so the double-dash is correct)
definition:
https://github.com/dylan-lang/dylan-mode/blob/127bead9241060bbfb0a0e5dac6e7cfe32708919/dime.el#L614
example of use:
https://github.com/dylan-lang/dylan-mode/blob/127bead9241060bbfb0a0e5dac6e7cfe32708919/dime.el#L1991

Multiple issues around Emacs package conventions

This package was an early submission to MELPA and doesn't follow modern packaging conventions. Do you accept PRs to fix that?

The main issue is namespace hygiene. Most urgently, dime.el defines its own versions of common macros without using a dime- namespace prefix for them. Of those, at least when-let is incompatible with the standard definition of that macro and breaks other Emacs packages.

DIME also defines some things using a sldb- prefix; that prefix belongs to the SLIME debugger and DIME should use something else.

Would you be willing to raise the minimum required Emacs version to 25.1 which is four years old? That would get us common macros like when-let via (require 'subr-x).

Other issues:

  • Lexical binding should be used throughout.
  • Package metadata should be added as headers into the .el files.
  • Files and functions/macros/variables should be renamed such that the definition prefixes correspond to the filenames in which they are defined.

I have several packages in MELPA and am happy to assist with all of this stuff if welcome. To not break other packages, at least the namespace hygiene should be fixed.

dylan-mode should never re-indent multiple lines without explicit request.

Sometimes, when I type a semicolon, dylan-mode re-indents multiple lines of code. Now, if it were able to always get the indentation exactly right I might consider this correct behavior, but it doesn't and I don't. I personally would prefer not to have it do any indentation except when I press the Tab key. (Auto-indent after pressing Enter would be okay too, but not my preference.)

Here's a specific and particularly egregious instance of the problem. Given the following chunk of code...

define method parse-file
    (parser :: <coil-parser>, struct :: <struct-prototype>) => (struct :: <struct-prototype>)
  local method fail ()
          parse-error(parser, "Target of @file keyword must be a filename or a "
                        "list of the form [ 'filename' 'path.to.struct' ].");
        end;
  let target = parse-any(parser);
  let path = "@root";
  select (target by instance?)
    <string> => #f;
    <sequence> =>
      if (target.size ~= 2
            | ~every?(rcurry(instance?, <string>), target))
        fail();
      else
        path := target[1];
        target := target[0];
      end
    otherwise => fail();
  end;

if I put the cursor at the end of the otherwise => fail(); line, erase the semicolon and type it again, the code ends up like this:

define method parse-file
    (parser :: <coil-parser>, struct :: <struct-prototype>) => (struct :: <struct-prototype>)
  local method fail ()
          parse-error(parser, "Target of @file keyword must be a filename or a "
                        "list of the form [ 'filename' 'path.to.struct' ].");
        end;
  let target = parse-any(parser);
  let path = "@root";
  select (target by instance?)
    <string> => #f;
    <sequence> =>
    if (target.size ~= 2
          | ~every?(rcurry(instance?, <string>), target))
      fail();
    else
      path := target[1];
      target := target[0];
    end
      otherwise => fail();
  end;

Note that code all the way up to the "if" has been re-indented and it has been moved flush with the <sequence> => line. The only way I could get a semicolon there was to cut and paste it since that didn't invoke the indent behavior.

Compiler warnings with dime

Compiling dime-20210319.1414 on Emacs 27.1 I get these warnings:

In dime-repl-mode:
dime-repl.el:414:9:Warning: assignment to free variable
    ‘dime-write-string-function’
dime-repl.el:1488:7:Warning: assignment to free variable
    ‘dime-output-target-to-marker-function’

In end of data:
dime-repl.el:1496:1:Warning: the function ‘dime-emit-to-target’ is not known
    to be defined.

Not sure if this impacts the functionality, I haven't found anything yet.

Rename SLDB symbols

Ref #41

DIME was forked from SLIME, and DIME currently defines symbols using SLIME's sldb- prefix. We should change the prefix.

In fact, SLIME itself is not following current Emacs Lisp namespace conventions since it uses sldb instead of slime as the prefix. Since we can start afresh with DIME we should follow the convetions.

I suggest changing sldb to dime-debug. The following would be the list of the new symbol names. Does it look reasonable?

  • dime-debug-insert-frame-call-to-repl
  • dime-debug-hook
  • dime-debug-initial-restart-limit
  • dime-debug-condition
  • dime-debug-restarts
  • dime-debug-level
  • dime-debug-backtrace-start-marker
  • dime-debug-restart-list-start-marker
  • dime-debug-continuations
  • dime-debug-mode-syntax-table
  • dime-debug-mode
  • dime-debug-buffers
  • dime-debug-find-buffer
  • dime-debug-get-default-buffer
  • dime-debug-get-buffer
  • dime-debug-debugged-continuations
  • dime-debug-setup
  • dime-debug-activate
  • dime-debug-reinitialize
  • dime-debug-exit
  • dime-debug-close-step-buffer
  • dime-debug-insert-condition
  • dime-debug-extras-hooks
  • dime-debug-dispatch-extras
  • dime-debug-insert-restarts
  • dime-debug-insert-more-restarts
  • dime-debug-frame-string
  • dime-debug-frame-number
  • dime-debug-frame-plist
  • dime-debug-frame-restartable-p
  • dime-debug-prune-initial-frames
  • dime-debug-insert-frames
  • dime-debug-compute-frame-face
  • dime-debug-insert-frame
  • dime-debug-fetch-more-frames
  • dime-debug-restart-at-point
  • dime-debug-frame-number-at-point
  • dime-debug-var-number-at-point
  • dime-debug-previous-frame-number
  • dime-debug-frame-details-visible-p
  • dime-debug-frame-region
  • dime-debug-forward-frame
  • dime-debug-backward-frame
  • dime-debug-goto-last-frame
  • dime-debug-beginning-of-backtrace
  • dime-debug-recenter-region
  • dime-debug-default-action
  • dime-debug-default-action/mouse
  • dime-debug-cycle
  • dime-debug-end-of-backtrace
  • dime-debug-fetch-all-frames
  • dime-debug-show-source
  • dime-debug-show-frame-source
  • dime-debug-toggle-details
  • dime-debug-show-frame-details
  • dime-debug-frame-details
  • dime-debug-insert-frame-variable-value-function
  • dime-debug-insert-locals
  • dime-debug-insert-frame-variable-value
  • dime-debug-hide-frame-details
  • dime-debug-disassemble
  • dime-debug-eval-in-frame
  • dime-debug-pprint-eval-in-frame
  • dime-debug-inspect-in-frame
  • dime-debug-inspect-var
  • dime-debug-inspect-condition
  • dime-debug-down
  • dime-debug-up
  • dime-debug-sugar-move
  • dime-debug-details-up
  • dime-debug-details-down
  • dime-debug-quit
  • dime-debug-continue
  • dime-debug-abort
  • dime-debug-invoke-restart
  • dime-debug-invoke-restart-by-name
  • dime-debug-break-with-default-debugger
  • dime-debug-break-with-system-debugger
  • dime-debug-step
  • dime-debug-next
  • dime-debug-out
  • dime-debug-break-on-return
  • dime-debug-break
  • dime-debug-return-from-frame
  • dime-debug-restart-frame
  • dime-debug-recompile-frame-source

Bad indentation for string with URL in it.

The second line doesn't indent correctly (or at all):

  if (starts-with?(url, "https://github.com"))
make(<git-transport>)

If I change "https://github.com" to the empty string dylan-mode indents the second line correctly.

Bugs/todo from dylan-mode.el comments

Bugs / to-do list

  • Don't highlight macro variables (e.g., "?x:" in ?x:name) as keywords.
    Just highlight the "x" as a variable binding.

  • Customize fill-column to some acceptable value so that auto-filled
    comments are filled at a standard place > 70. I use 89 myself.

  • It appears as though some code matches only some of the graphic-character
    BNF when it should match all graphic chars.

Turn optimization-coloring into a minor mode

Quoting @housel from #41 (comment)

The dylan-optimization-coloring.el code isn't directly integrated; it can be used on its own to read files generated using the compiler's -dispatch-coloring elisp option.

and #41 (comment)

With optimization-coloring-mode, two files are involved. The main file is the Dylan source file, which starts out using dylan-mode. If you compile using the -dispatch-coloring elisp option, for each source file you get an output file (using elisp syntax) that contains annotations for dispatch coloring (described, in the IDE case, in https://opendylan.org/documentation/getting-started-ide/coloring.html#about-dispatch-optimizations). The dylan-optimization-coloring.el code can be run on an existing dylan-mode buffer to replace the major mode's coloring with coloring based on the output from the compiler.

So yes, there should be a dylan-optimization-coloring-mode, it's just that nobody has ever spent the time to restructure the code as a minor mode.

DIME: #f is not of type <project-object>

File compilation through dime fails with an error,

Evaluation aborted on {<type-error> : #f is not of type {<class>: <project-object>}}.

I've tried importing, opening and building all through the repl and that is working perfectly, but I can't compile a file from the buffer with C-c C-k without hitting this error.

I've created a Vagrant environment (Ubuntu, Emacs 24.3.1) where this can be reproduced, https://github.com/danmidwood/dime-error-repro

define not-inline method doesn't colorize correctly

Adding any of these adjectives, other than "inline" causes syntax coloring to fail. (It stops coloring the word "define".)

    #"default-inline" => 0;
    #"inline"         => 1;
    #"inline-only"    => 2;
    #"may-inline"     => 3;
    #"not-inline"     => 4;

DIME protocol lacks information

SLIME transmits always the current package over the wire -- so does DIME.

But Dylan has the concept of both libraries (unit of compilation), modules (namespace); and additionally Open Dylan imposes an "active project" (the one we're interested in).

These 3 things make sense to a certain extend: names are mangled regarding the project, library and module. Unfortunately both the emacs and dylan side only transmit a single piece of information - the module. This should be modified so that the full information is transmitted for each request. This would minimize state on one of the sides, and therefore less stuff can get out of sync.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.