Skip to content

Programming sorting (psort) #3

@rememberYou

Description

@rememberYou

Description

The project is to create a new GNU Emacs package that will sort a buffer
depending on the programming language used. The ultimate goal is that a user
will be able to add a hook to the created mode in different languages
(preferably non-procedural), wishing to be sorted according to their functions,
classes, imports, etc.

The issue with the current sorting functions is that the user has to select the
corresponding regions himself, and these sortings do not always work according
to the formatting of the function documentation and the intermediate lines.

Functions

This package will include the following functions [0/7]:

  • psort-count-not-sorted-classes: gets the number of classes that need to be
    sorted. Defaults to 0.

  • psort-count-not-sorted-functions: gets the number of functions that need to be
    sorted. Defaults to 0.

  • psort-count-not-sorted-imports: gets the number of imports that need to be
    sorted. Defaults to 0.

  • psort-highlight-not-sorted: allows using a background color, things that need to
    be sorted. Defaults to nil.

  • psort-mode: launch of the mode. Defaults to nil.

  • psort-get-sorted-language: get the name of the buffer language being sorted
    (e.g. Python, Java, Lisp, etc.). Defaults to nil.

  • psort-sort-buffer: sort the buffer according to the user
    configuration. Defaults to nil.

Variables

This package will include the following variables [0/8]:

  • psort-highlight-color: background color for detecting things to sort with
    hightlight-not-sorted. Defaults to "red".

  • psort-not-sorting-functions: a list of special functions that should not be
    sorted as the constructors (e.g. init.py in python).

  • psort-sort-method: defined the method used to sort (e.g. alphabetically, by
    length, etc). Defaults to "alphabetically".

  • psort-sort-with-classes: make it possible to know whether sorting should be
    done by considering classes or not (practical if several classes are defined
    in a file). Defaults to t.

  • psort-sort-with-imports: make it possible to know whether sorting should be
    done by considering imports or not. Defaults to t.

  • psort-sorting-time: Time of last sorting. Defauls to 0.

  • psort-verbose: if t, display text each time the psort-sort-buffer is
    called. Display example : "Sorted functions: 5". Defaults to t.

  • psort-verbose-format: formatting verbose bode. Useful if you prefer to
    display the time it took to sort the functions, or display a different message
    than the one initially provided.

Things to Implement [0/2]

  • Use imenu with completing-read replacement that sorts candidates by length.
  • Improve imenu's quality widly depending on the major mode.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions