-
-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add two editor variables to line-numbers, line-number-format and current-line-value #1684
Conversation
…ent-line-value with these editor variables, the user can customize line-format and current-line value. for example : ``` (setf (variable-value 'line-number-format :global) "~2D ") (setf (variable-value 'relative-line-numbers-current-line-value :global) 0) ``` this will make the line numbers narrow and make the current line show up as '0' in the line-number column
src/ext/line-numbers.lisp
Outdated
(define-editor-variable relative-line-numbers-current-line-value | ||
'(line-number-at-point (current-point)) | ||
"Set to desired current-line value when relative line numbers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to make this a function rather than eval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before that, it seems like the API that specifies this behavior from the outside is not a good idea.
@@ -15,7 +17,15 @@ | |||
(defvar *previous-relative-line* nil) | |||
|
|||
(defvar *initialized* nil) | |||
(defvar *line-number-format* nil) | |||
|
|||
(define-editor-variable line-number-format "~6D " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good.
this patch adds two editor variables to line-numbers, `line-format` and `current-line-display-function`. this allows the user to change the width/format of the line numbers and to set the current-line display in relative numbers. for example : ``` (setf (variable-value 'line-number-format :global) "~2D ") (setf (variable-value 'current-line-display-function :global) (lambda () 0)) ``` now the line-numbers will be narrower and the current-line will always be 0.
this patch adds two editor variables to line-numbers, `line-format` and `current-line-display-function`. this allows the user to change the width/format of the line numbers and to set the current-line display in relative numbers. for example : ``` (setf (variable-value 'line-number-format :global) "~2D ") (setf (variable-value 'current-line-display-function :global) (lambda () 0)) ``` now the line-numbers will be narrower and the current-line will always be 0.
sorry for the poor style, purely bad habits. and thank you for the patience i have changed it for the variable to be assigned inside the let with |
and sorry about changing the attribute style indentations. i yanked in the file from outside, and LEM did it automatically. it was unintentional. |
src/ext/line-numbers.lisp
Outdated
two-character line-number column.") | ||
|
||
(define-editor-variable current-line-display-function | ||
(lambda () (line-number-at-point (current-point))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compute-line holds the point variable.
Wouldn't it be better to take that as an argument?
It seems to me that using what is passed as an argument is a better style than thinking about what position the current-point is actually in.
#'line-number-at-point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, i think i see what you mean. the thing is i want to be able to set the value to 0
or ->
, etc. so i'm guessing you mean make a variable like custom-current-line-indicator
and set it to nil, and if it is defined, then compute-line
will call that. otherwise, show the current line number.
that does make sense. am i understanding that correctly ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I understand your intention.
add two editor variables to line-numbers, `line-format` and `custom-current-line`. they allow the user to set the line format and choose a custom current line if they want. for example : `(setf (variable-value 'line-number-format :global) "~2D ")` for a narrow line-number column. and `(setf (variable-value 'custom-current-line :global) "->")` for a current-line indicator of `->`
alright, i think it's much better now. |
add two editor variables to line-numbers, `line-format` and `custom-current-line`. they allow the user to set the line format and choose a custom current line if they want. for example : `(setf (variable-value 'line-number-format :global) "~2D ")` for a narrow line-number column. and `(setf (variable-value 'custom-current-line :global) "->")` for a current-line indicator of `->`
…nt-line-value add two editor variables to line-numbers, `line-format` and `custom-current-line`. they allow the user to set the line format and choose a custom current line if they want. for example : `(setf (variable-value 'line-number-format :global) "~2D ")` for a narrow line-number column. and `(setf (variable-value 'custom-current-line :global) "->")` for a current-line indicator of `->`
one more change. i put everything in the let to make it cleaner and proper |
Thank you for the PR, I will merge it. |
with these editor variables, the user can customize line-format and current-line value. for example :
this will make the line numbers narrow and make the current line show up as '0' in the line-number column