Open christophe-gouel opened 3 months ago
Since I primarily use Windows systems, I have very little understanding of the situation with GAMS on other platforms or the issues that might arise with GAMS mode.
I think your suggestion is a very good idea.
However, the following command
(find-name-directory gams-process-command-name)
will actually be the following command:
(file-name-directory gams-process-command-name)
Changing the topic a bit, one of the issues with GAMS mode is that the program file (gams-mode.el) is too large.
Emacs Lisp packages of a certain size are usually created by splitting the program into multiple files, typically divided by functionality. This approach makes the program easier to understand and manage.
However, since I have developed almost all parts of GAMS mode by myself, there hasn’t been much need to enhance readability for others, leading to the inclusion of everything in a single file.
While there may be some advantages to including everything in one file, the current gams-mode.el exceeds 17,000 lines, making it quite difficult to understand. Even I find it challenging to keep track of where I wrote what.
Ideally, GAMS mode should also be divided into files by functionality. However, it is not easy to do this effectively, so that task has remained untouched.
If there is anything you don't understand in the program, please feel free to ask.
Changing the topic a bit, one of the issues with GAMS mode is that the program file (gams-mode.el) is too large.
Emacs Lisp packages of a certain size are usually created by splitting the program into multiple files, typically divided by functionality. This approach makes the program easier to understand and manage.
However, since I have developed almost all parts of GAMS mode by myself, there hasn’t been much need to enhance readability for others, leading to the inclusion of everything in a single file.
While there may be some advantages to including everything in one file, the current gams-mode.el exceeds 17,000 lines, making it quite difficult to understand. Even I find it challenging to keep track of where I wrote what.
Ideally, GAMS mode should also be divided into files by functionality. However, it is not easy to do this effectively, so that task has remained untouched.
Yes, gams-mode.el is too large, but I don't think anything should be done about this. GAMS mode is stable at this point. I am just contributing minor enhancements, which I am able to do even with this large file. I don't think it is worth anyone's time to break it down into smaller files.
The only thing I would suggest is to change the comments to follow the outline-minor-mode standards. This would make code navigation much easier in the file (org-like). In lisp-mode, sections starts by ;;;
, subsections by ;;;;
, ;;;;;
, ...
So a code block such as
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Define variables.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
could be changed in
;;;; Define variables
and it would be a subsection inside the ;;; Code:
section.
Alternatively, it could be
;;; Define variables
if one wants it to be a section (this is the convention in Magit for example).
Hi @ShiroTakeda,
I have done the adjustments required for GAMS mode to behave better on all platforms. The changes are in the develop branch. They should not be merged in master right now. Some testing is required first, which I will do in the following weeks, but I encourage you to try it too.
I have also to edit the README to update the configuration instructions to the changes. I will also do this soon.
There are a lot of changes in the file, but those are mostly small fixes to compilation warnings/notes. The substantial changes are limited and described in the CHANGELOG.md. I have taken the liberty to update the version number to 7.0 since some of the changes can break backward compatibility in minor ways.
Best, Christophe
Hi @ShiroTakeda,
Thanks for giving me the right to push to the repositories.
I will soon leave on vacation, so I won't do anything else before September. In September, I would like to make some small changes for gams-mode to be easier to work with out of the box and to work better on various platforms. I have just moved my desktop computer to Linux, and I was surprised that the extraction from the gams library failed on this platform. More generally, it is quite a pain to have to maintain different emacs configs for different platforms, where GAMS will have different locations, and I am sure we can ease this.
I have the following ideas to simplify things:
gams-process-command-name
default to(executable-find "gams")
: this provides the complete path to the executable as long as it is in the PATH (on my Windows laptop, I get "c:/GAMS/47/gams.exe"; on my Linux desktop, I get "/usr/bin/gams"))(find-name-directory gams-process-command-name)
to fillgams-system-directory
defaultgams-gamslib-command
accordinglyWith these changes in place, people would not see any difference if they had customized the variables. But this should streamline the gams-mode config since there won't be any path to set if the GAMS folder is in the PATH.
What do you think?