* Patch: ERC italic text support
@ 2020-04-07 15:27 Barna Zsombor
2020-04-07 16:20 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Barna Zsombor @ 2020-04-07 15:27 UTC (permalink / raw)
To: emacs-devel, emacs-erc
[-- Attachment #1: Type: text/plain, Size: 296 bytes --]
Hi,
It was a major discomfort for me that ERC had no support for italic text
( \C-] ), so I "scratched that itch". I attached the patch as requested
in CONTRIBUTE.
I am a first-time contributor to Emacs so I'd like to request a copy of
the copyright assignment.
Best wishes,
Zsombor Barna
[-- Attachment #2: 0001-Add-ERC-support-for-italic-control-characters.patch --]
[-- Type: text/x-patch, Size: 4700 bytes --]
From fab65a75b71d2800e5d549f01a746b3be98a0444 Mon Sep 17 00:00:00 2001
From: Barna Zsombor <unibro@mailo.com>
Date: Tue, 7 Apr 2020 16:46:51 +0200
Subject: [PATCH] Add ERC support for italic control characters
ERC lacked support for the ']' control character, it didn't
display italic text as italic.
- Added erc-italic-face
- Updated the regexes
- Added cond branches and extended the let expressions
---
lisp/erc/erc-goodies.el | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 94d5de280c..0e9b9384b3 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -241,6 +241,10 @@ erc-underline-face
"ERC underline face."
:group 'erc-faces)
+(defface erc-italic-face '((t :slant italic))
+ "ERC italic face."
+ :group 'erc-faces)
+
(defface fg:erc-color-face0 '((t :foreground "White"))
"ERC face."
:group 'erc-faces)
@@ -385,6 +389,7 @@ erc-controls-interpret
(let ((boldp nil)
(inversep nil)
(underlinep nil)
+ (italicp nil)
(fg nil)
(bg nil))
(while (string-match erc-controls-highlight-regexp s)
@@ -405,6 +410,8 @@ erc-controls-interpret
(setq inversep (not inversep)))
((string= control "\C-_")
(setq underlinep (not underlinep)))
+ ((string= control "\C-]")
+ (setq italicp (not italicp)))
((string= control "\C-c")
(setq fg nil
bg nil))
@@ -419,7 +426,7 @@ erc-controls-interpret
bg nil))
(t nil))
(erc-controls-propertize
- start end boldp inversep underlinep fg bg s)))
+ start end boldp inversep underlinep italicp fg bg s)))
s))
(t s)))))
@@ -432,11 +439,11 @@ erc-controls-strip
s)))
(defvar erc-controls-remove-regexp
- "\C-b\\|\C-_\\|\C-v\\|\C-g\\|\C-o\\|\C-c[0-9]?[0-9]?\\(,[0-9][0-9]?\\)?"
+ "\C-b\\|\C-_\\|\C-]\\|\C-v\\|\C-g\\|\C-o\\|\C-c[0-9]?[0-9]?\\(,[0-9][0-9]?\\)?"
"Regular expression which matches control characters to remove.")
(defvar erc-controls-highlight-regexp
- (concat "\\(\C-b\\|\C-v\\|\C-_\\|\C-g\\|\C-o\\|"
+ (concat "\\(\C-b\\|\C-v\\|\C-_\\|\C-]\\|\C-g\\|\C-o\\|"
"\C-c\\([0-9][0-9]?\\)?\\(,\\([0-9][0-9]?\\)\\)?\\)"
"\\([^\C-b\C-v\C-_\C-c\C-g\C-o\n]*\\)")
"Regular expression which matches control chars and the text to highlight.")
@@ -453,6 +460,7 @@ erc-controls-highlight
(let ((boldp nil)
(inversep nil)
(underlinep nil)
+ (italicp nil)
(fg nil)
(bg nil))
(while (re-search-forward erc-controls-highlight-regexp nil t)
@@ -471,6 +479,8 @@ erc-controls-highlight
(setq inversep (not inversep)))
((string= control "\C-_")
(setq underlinep (not underlinep)))
+ ((string= control "\C-]")
+ (setq italicp (not italicp)))
((string= control "\C-c")
(setq fg nil
bg nil))
@@ -481,14 +491,15 @@ erc-controls-highlight
(setq boldp nil
inversep nil
underlinep nil
+ italicp nil
fg nil
bg nil))
(t nil))
(erc-controls-propertize start end
- boldp inversep underlinep fg bg)))))
+ boldp inversep underlinep italicp fg bg)))))
(t nil)))
-(defun erc-controls-propertize (from to boldp inversep underlinep fg bg
+(defun erc-controls-propertize (from to boldp inversep underlinep italicp fg bg
&optional str)
"Prepend properties from IRC control characters between FROM and TO.
If optional argument STR is provided, apply to STR, otherwise prepend properties
@@ -506,6 +517,9 @@ erc-controls-propertize
(if underlinep
'(erc-underline-face)
nil)
+ (if italicp
+ '(erc-italic-face)
+ nil)
(if fg
(list (erc-get-fg-color-face fg))
nil)
--
2.26.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Patch: ERC italic text support
2020-04-07 15:27 Patch: ERC italic text support Barna Zsombor
@ 2020-04-07 16:20 ` Eli Zaretskii
2020-04-07 16:35 ` copyright assignment (Re: Patch: ERC italic text support) Emanuel Berg via Emacs development discussions.
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2020-04-07 16:20 UTC (permalink / raw)
To: Barna Zsombor; +Cc: emacs-erc, emacs-devel
> From: Barna Zsombor <unibro@mailo.com>
> Date: Tue, 7 Apr 2020 17:27:01 +0200
>
> I am a first-time contributor to Emacs so I'd like to request a copy of
> the copyright assignment.
Form sent off-list.
^ permalink raw reply [flat|nested] 5+ messages in thread
* copyright assignment (Re: Patch: ERC italic text support)
2020-04-07 16:20 ` Eli Zaretskii
@ 2020-04-07 16:35 ` Emanuel Berg via Emacs development discussions.
2020-04-07 18:58 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Emanuel Berg via Emacs development discussions. @ 2020-04-07 16:35 UTC (permalink / raw)
To: emacs-devel; +Cc: emacs-erc
Eli Zaretskii wrote:
>> I am a first-time contributor to Emacs so I'd like to
>> request a copy of the copyright assignment.
>
> Form sent off-list.
What does this mean? I don't know if I contributed to
Emacs, not directly to the end product for sure, to
Emacs culture perhaps and indirectly by helping the OP
once in a while on gmane.emacs.help ... but regardless
of whatever, what is "the copyright assignment" and why
does it have to be sent off-list?
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: copyright assignment (Re: Patch: ERC italic text support)
2020-04-07 16:35 ` copyright assignment (Re: Patch: ERC italic text support) Emanuel Berg via Emacs development discussions.
@ 2020-04-07 18:58 ` Eli Zaretskii
2020-04-07 21:15 ` Emanuel Berg via Emacs development discussions.
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2020-04-07 18:58 UTC (permalink / raw)
To: Emanuel Berg; +Cc: emacs-devel
> Date: Tue, 07 Apr 2020 18:35:17 +0200
> Cc: emacs-erc@gnu.org
> From: Emanuel Berg via "Emacs development discussions." <emacs-devel@gnu.org>
>
> Eli Zaretskii wrote:
>
> >> I am a first-time contributor to Emacs so I'd like to
> >> request a copy of the copyright assignment.
> >
> > Form sent off-list.
>
> What does this mean? I don't know if I contributed to
> Emacs, not directly to the end product for sure, to
> Emacs culture perhaps and indirectly by helping the OP
> once in a while on gmane.emacs.help ... but regardless
> of whatever, what is "the copyright assignment"
https://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html
> and why does it have to be sent off-list?
Because it is of no interest to the list, and OTOH I'd like people to
know I sent it so others won't (thinking no one did).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: copyright assignment (Re: Patch: ERC italic text support)
2020-04-07 18:58 ` Eli Zaretskii
@ 2020-04-07 21:15 ` Emanuel Berg via Emacs development discussions.
0 siblings, 0 replies; 5+ messages in thread
From: Emanuel Berg via Emacs development discussions. @ 2020-04-07 21:15 UTC (permalink / raw)
To: emacs-devel
Eli Zaretskii wrote:
> https://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html
OK, thanks. Maybe something to page thru during the
pending summer vacation...
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-07 21:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-07 15:27 Patch: ERC italic text support Barna Zsombor
2020-04-07 16:20 ` Eli Zaretskii
2020-04-07 16:35 ` copyright assignment (Re: Patch: ERC italic text support) Emanuel Berg via Emacs development discussions.
2020-04-07 18:58 ` Eli Zaretskii
2020-04-07 21:15 ` Emanuel Berg via Emacs development discussions.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).