commit e29c904a0a3125e624d35f99cccb9cc0a47c47de (HEAD, refs/remotes/origin/master) Author: Stefan Kangas Date: Sun Dec 12 09:04:11 2021 +0100 ; * lisp/emacs-lisp/shortdoc.el (keymaps): Fix typo. diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 5c51e257eb..b9e000cc05 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -1232,7 +1232,7 @@ There can be any number of :example/:result elements." (define-keymap :no-eval (define-keymap "C-c C-c" #'quit-buffer)) (defvar-keymap - :no-eval (defvar-keymap my-keymap "C-c C-c" map #'quit-buffer)) + :no-eval (defvar-keymap my-keymap "C-c C-c" #'quit-buffer)) "Setting keys" (keymap-set :no-eval (keymap-set map "C-c C-c" #'quit-buffer)) commit e52739c32fb6c6611ed690b9daf856925d8a1cf5 Author: Lars Ingebrigtsen Date: Sun Dec 12 07:22:44 2021 +0100 Make with-sqlite-transaction mode code efficient * lisp/sqlite.el (with-sqlite-transaction): Rewrite to only include BODY once. diff --git a/lisp/sqlite.el b/lisp/sqlite.el index dccdda16ac..6d32a0468f 100644 --- a/lisp/sqlite.el +++ b/lisp/sqlite.el @@ -26,16 +26,17 @@ (defmacro with-sqlite-transaction (db &rest body) "Execute BODY while holding a transaction for DB." (declare (indent 1) (debug (form body))) - (let ((db-var (gensym))) - `(let ((,db-var ,db)) + (let ((db-var (gensym)) + (func-var (gensym))) + `(let ((,db-var ,db) + (,func-var (lambda () ,@body))) (if (sqlite-available-p) (unwind-protect (progn (sqlite-transaction ,db-var) - ,@body) + (funcall ,func-var)) (sqlite-commit ,db-var)) - (progn - ,@body))))) + (funcall ,func-var))))) (provide 'sqlite) commit 11b2dfca287dee4b4520d07e3ad6432870059100 Author: Po Lu Date: Sun Dec 12 14:20:18 2021 +0800 * src/xterm.c (x_detect_focus_change): Fix XI2 focus on GTK builds. diff --git a/src/xterm.c b/src/xterm.c index 3d9dce27e8..0dc944fd81 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5144,13 +5144,13 @@ x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, int focus_state = focus_frame ? focus_frame->output_data.x->focus_state : 0; - if (!((((xi_event->evtype == XI_Enter - || xi_event->evtype == XI_Leave) - && (((XIEnterEvent *) xi_event)->detail - != XINotifyInferior) - && !(focus_state & FOCUS_EXPLICIT)) - || xi_event->evtype == XI_FocusIn - || xi_event->evtype == XI_FocusOut))) + if (((((xi_event->evtype == XI_Enter + || xi_event->evtype == XI_Leave) + && (((XIEnterEvent *) xi_event)->detail + != XINotifyInferior) + && !(focus_state & FOCUS_EXPLICIT)) + || xi_event->evtype == XI_FocusIn + || xi_event->evtype == XI_FocusOut))) x_focus_changed ((xi_event->evtype == XI_Enter || xi_event->evtype == XI_FocusIn ? FocusIn : FocusOut), commit 4f987e189d129523a93b21427c24f761e7fb4c00 Author: Po Lu Date: Sun Dec 12 14:13:05 2021 +0800 Fix last change * src/xterm.c (x_detect_focus_change): Test against FOCUS_EXPLICIT. diff --git a/src/xterm.c b/src/xterm.c index 676de57455..3d9dce27e8 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5148,7 +5148,7 @@ x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, || xi_event->evtype == XI_Leave) && (((XIEnterEvent *) xi_event)->detail != XINotifyInferior) - && (focus_state & FOCUS_EXPLICIT)) + && !(focus_state & FOCUS_EXPLICIT)) || xi_event->evtype == XI_FocusIn || xi_event->evtype == XI_FocusOut))) x_focus_changed ((xi_event->evtype == XI_Enter commit 8e948ab97ebc74245064fdb8467342abb7fe2bb3 Author: dick r. chiang Date: Sun Dec 12 07:13:37 2021 +0100 Fix some compilation warnings in sqlite-less builds * test/src/sqlite-tests.el: * lisp/sqlite-mode.el: Avoid compilation warnings in builds without libsqlite (bug#52440). diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 834a802213..43d76c4fd7 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -25,6 +25,14 @@ (require 'cl-lib) +(declare-function sqlite-execute "sqlite.c") +(declare-function sqlite-more-p "sqlite.c") +(declare-function sqlite-next "sqlite.c") +(declare-function sqlite-columns "sqlite.c") +(declare-function sqlite-finalize "sqlite.c") +(declare-function sqlite-select "sqlite.c") +(declare-function sqlite-open "sqlite.c") + (defvar-keymap sqlite-mode-map "g" #'sqlite-mode-list-tables "c" #'sqlite-mode-list-columns diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el index 7ccea1c2a5..6a88f0fd6c 100644 --- a/test/src/sqlite-tests.el +++ b/test/src/sqlite-tests.el @@ -26,6 +26,16 @@ (require 'ert) (require 'ert-x) +(declare-function sqlite-execute "sqlite.c") +(declare-function sqlite-close "sqlite.c") +(declare-function sqlitep "sqlite.c") +(declare-function sqlite-available-p "sqlite.c") +(declare-function sqlite-finalize "sqlite.c") +(declare-function sqlite-next "sqlite.c") +(declare-function sqlite-more-p "sqlite.c") +(declare-function sqlite-select "sqlite.c") +(declare-function sqlite-open "sqlite.c") + (ert-deftest sqlite-select () (skip-unless (sqlite-available-p)) (let ((db (sqlite-open))) commit eff1bb78bd3bfa60cbf4982e90217d00887ea0c8 Author: Po Lu Date: Sun Dec 12 14:00:09 2021 +0800 Fix frame focus on X Toolkit builds with XInput 2 * src/xterm.c (x_detect_focus_change): Allow focus_state to not be FOCUS_EXPLICIT when handling FocusIn and FocusOut events. diff --git a/src/xterm.c b/src/xterm.c index f2129458e1..676de57455 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5144,9 +5144,13 @@ x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, int focus_state = focus_frame ? focus_frame->output_data.x->focus_state : 0; - if (!((xi_event->evtype == XI_Enter - || xi_event->evtype == XI_Leave) - && (focus_state & FOCUS_EXPLICIT))) + if (!((((xi_event->evtype == XI_Enter + || xi_event->evtype == XI_Leave) + && (((XIEnterEvent *) xi_event)->detail + != XINotifyInferior) + && (focus_state & FOCUS_EXPLICIT)) + || xi_event->evtype == XI_FocusIn + || xi_event->evtype == XI_FocusOut))) x_focus_changed ((xi_event->evtype == XI_Enter || xi_event->evtype == XI_FocusIn ? FocusIn : FocusOut), commit 95d7a794cc48312c41a34ef9cdc0e5c95f35d2ac Author: Lars Ingebrigtsen Date: Sun Dec 12 06:57:02 2021 +0100 Update bovine/gcc-tests for newer Macos versions * test/lisp/cedet/semantic/bovine/gcc-tests.el (semantic-gcc-test-output-parser-this-machine): Update gcc->llvm detection to Macos Monterey. diff --git a/test/lisp/cedet/semantic/bovine/gcc-tests.el b/test/lisp/cedet/semantic/bovine/gcc-tests.el index d049f95b4c..ba84ce4d81 100644 --- a/test/lisp/cedet/semantic/bovine/gcc-tests.el +++ b/test/lisp/cedet/semantic/bovine/gcc-tests.el @@ -127,8 +127,9 @@ gcc version 2.95.2 19991024 (release)" ;; Some macOS machines run llvm when you type gcc. (!) ;; We can't even check if it's a symlink; it's a binary placed in ;; "/usr/bin/gcc". So check the output and just skip this test if - ;; it says "Apple LLVM". - (unless (string-match "Apple LLVM" (car semantic-gcc-test-strings)) + ;; it looks like that's the case. + (unless (string-match "Apple LLVM\\|Xcode.app" + (car semantic-gcc-test-strings)) (semantic-gcc-test-output-parser)))) ;;; gcc-tests.el ends here commit 2d116c432d2a561fac69916d78b7a70dd6144ac7 Merge: 4b29468dbe 8a0734329a Author: Stefan Kangas Date: Sun Dec 12 06:31:07 2021 +0100 Merge from origin/emacs-28 8a0734329a Avoid undefined behavior in 'send-process-region' (Bug#523... 30dd5c9acc Update to Org 9.5.1-25-g9ca3bc a374849926 Fix the DJGPP port commit 4b29468dbef63f2befd7f67663a11cd5a3009b79 Author: Lars Ingebrigtsen Date: Sun Dec 12 05:55:35 2021 +0100 Tweak erroring in sqlite-mode-delete * lisp/sqlite-mode.el (sqlite-mode-delete): Use user-error instead of error for user-level stuff. diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 6b5c32234a..834a802213 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -188,7 +188,7 @@ (not (eq (car table) 'row))) (user-error "No row under point")) (unless (yes-or-no-p "Really delete the row under point? ") - (error "Not deleting")) + (user-error "Not deleting")) (sqlite-execute sqlite--db (format "delete from %s where %s" commit 6656a4d161027cbea3ac21c0d2882eaa357034b0 Author: Lars Ingebrigtsen Date: Sun Dec 12 05:41:07 2021 +0100 Make sqlite-mode-list-tables work on older sqlite versions * lisp/sqlite-mode.el (sqlite-mode-list-tables): Use sqlite_master instead of sqlite_schema, since the former name is the historical name and is available in all sqlite3 versions: https://sqlite.org/schematab.html diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 9306bd85dc..6b5c32234a 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -57,7 +57,7 @@ (db sqlite--db) (entries nil)) (erase-buffer) - (dolist (table (sqlite-select db "select name from sqlite_schema where type = 'table' and name not like 'sqlite_%' order by name")) + (dolist (table (sqlite-select db "select name from sqlite_master where type = 'table' and name not like 'sqlite_%' order by name")) (push (list (car table) (caar (sqlite-select db (format "select count(*) from %s" (car table))))) commit ff9360f4da351d25f1f9fb1ed9a78ce9db321ac4 Author: Po Lu Date: Sun Dec 12 10:54:50 2021 +0800 Clear precision scroll interpolation when direction changes * lisp/pixel-scroll.el (pixel-scroll-precision-interpolate): Clear scroll interpolation when direction changes. diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index 336b555e77..0e22ef2a6a 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -542,35 +542,43 @@ animation." (< (- (float-time) time) 1.0) (eq (< delta 0) (< rem 0))) (setq delta (+ delta rem))) - (while-no-input - (unwind-protect - (while (< percentage 1) - (redisplay t) - (sleep-for between-scroll) - (setq time-elapsed (+ time-elapsed - (- (float-time) last-time)) - percentage (/ time-elapsed total-time)) - (let ((throw-on-input nil)) - (if (< delta 0) - (pixel-scroll-precision-scroll-down - (ceiling (abs (* (* delta factor) - (/ between-scroll total-time))))) - (pixel-scroll-precision-scroll-up - (ceiling (* (* delta factor) - (/ between-scroll total-time)))))) - (setq last-time (float-time))) - (if (< percentage 1) - (progn - (set-window-parameter nil 'interpolated-scroll-remainder - (* delta (- 1 percentage))) - (set-window-parameter nil 'interpolated-scroll-remainder-time - (float-time))) - (set-window-parameter nil - 'interpolated-scroll-remainder - nil) - (set-window-parameter nil - 'interpolated-scroll-remainder-time - nil)))))) + (if (or (null rem) + (eq (< delta 0) (< rem 0))) + (while-no-input + (unwind-protect + (while (< percentage 1) + (redisplay t) + (sleep-for between-scroll) + (setq time-elapsed (+ time-elapsed + (- (float-time) last-time)) + percentage (/ time-elapsed total-time)) + (let ((throw-on-input nil)) + (if (< delta 0) + (pixel-scroll-precision-scroll-down + (ceiling (abs (* (* delta factor) + (/ between-scroll total-time))))) + (pixel-scroll-precision-scroll-up + (ceiling (* (* delta factor) + (/ between-scroll total-time)))))) + (setq last-time (float-time))) + (if (< percentage 1) + (progn + (set-window-parameter nil 'interpolated-scroll-remainder + (* delta (- 1 percentage))) + (set-window-parameter nil 'interpolated-scroll-remainder-time + (float-time))) + (set-window-parameter nil + 'interpolated-scroll-remainder + nil) + (set-window-parameter nil + 'interpolated-scroll-remainder-time + nil)))) + (set-window-parameter nil + 'interpolated-scroll-remainder + nil) + (set-window-parameter nil + 'interpolated-scroll-remainder-time + nil)))) (defun pixel-scroll-precision-scroll-up (delta) "Scroll the current window up by DELTA pixels." commit c6cf446894a3d1eb1679de2a278fba9d4804952a Author: Po Lu Date: Sun Dec 12 01:17:00 2021 +0000 Fix drawing overlines on top of stretch glyphs when there is a box * src/haikuterm.c (haiku_draw_string_box): Also draw text decorations if the clipping is to be set. (haiku_draw_glyph_string): Only draw text decorations if the box will not be drawn with clipping. diff --git a/src/haikuterm.c b/src/haikuterm.c index f3c37b0258..f95a013867 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -535,162 +535,6 @@ haiku_draw_relief_rect (struct glyph_string *s, BView_EndClip (view); } -static void -haiku_draw_string_box (struct glyph_string *s, int clip_p) -{ - int hwidth, vwidth, left_x, right_x, top_y, bottom_y, last_x; - bool raised_p, left_p, right_p; - struct glyph *last_glyph; - struct haiku_rect clip_rect; - - struct face *face = s->face; - - last_x = ((s->row->full_width_p && !s->w->pseudo_window_p) - ? WINDOW_RIGHT_EDGE_X (s->w) - : window_box_right (s->w, s->area)); - - /* The glyph that may have a right box line. For static - compositions and images, the right-box flag is on the first glyph - of the glyph string; for other types it's on the last glyph. */ - if (s->cmp || s->img) - last_glyph = s->first_glyph; - else if (s->first_glyph->type == COMPOSITE_GLYPH - && s->first_glyph->u.cmp.automatic) - { - /* For automatic compositions, we need to look up the last glyph - in the composition. */ - struct glyph *end = s->row->glyphs[s->area] + s->row->used[s->area]; - struct glyph *g = s->first_glyph; - for (last_glyph = g++; - g < end && g->u.cmp.automatic && g->u.cmp.id == s->cmp_id - && g->slice.cmp.to < s->cmp_to; - last_glyph = g++) - ; - } - else - last_glyph = s->first_glyph + s->nchars - 1; - - vwidth = eabs (face->box_vertical_line_width); - hwidth = eabs (face->box_horizontal_line_width); - raised_p = face->box == FACE_RAISED_BOX; - left_x = s->x; - right_x = (s->row->full_width_p && s->extends_to_end_of_line_p - ? last_x - 1 - : min (last_x, s->x + s->background_width) - 1); - - top_y = s->y; - bottom_y = top_y + s->height - 1; - - left_p = (s->first_glyph->left_box_line_p - || (s->hl == DRAW_MOUSE_FACE - && (s->prev == NULL - || s->prev->hl != s->hl))); - right_p = (last_glyph->right_box_line_p - || (s->hl == DRAW_MOUSE_FACE - && (s->next == NULL - || s->next->hl != s->hl))); - - get_glyph_string_clip_rect (s, &clip_rect); - - if (face->box == FACE_SIMPLE_BOX) - haiku_draw_box_rect (s, left_x, top_y, right_x, bottom_y, hwidth, - vwidth, left_p, right_p, &clip_rect); - else - haiku_draw_relief_rect (s, left_x, top_y, right_x, bottom_y, hwidth, - vwidth, raised_p, true, true, left_p, right_p, - &clip_rect, 1); - - if (clip_p) - { - void *view = FRAME_HAIKU_VIEW (s->f); - BView_ClipToInverseRect (view, left_x, top_y, right_x - left_x + 1, hwidth); - if (left_p) - BView_ClipToInverseRect (view, left_x, top_y, vwidth, bottom_y - top_y + 1); - BView_ClipToInverseRect (view, left_x, bottom_y - hwidth + 1, - right_x - left_x + 1, hwidth); - if (right_p) - BView_ClipToInverseRect (view, right_x - vwidth + 1, - top_y, vwidth, bottom_y - top_y + 1); - } -} - -static void -haiku_draw_plain_background (struct glyph_string *s, struct face *face, - int box_line_hwidth, int box_line_vwidth) -{ - void *view = FRAME_HAIKU_VIEW (s->f); - BView_StartClip (view); - if (s->hl == DRAW_CURSOR) - BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel); - else - BView_SetHighColor (view, face->background_defaulted_p ? - FRAME_BACKGROUND_PIXEL (s->f) : - face->background); - - BView_FillRectangle (view, s->x, - s->y + box_line_hwidth, - s->background_width, - s->height - 2 * box_line_hwidth); - BView_EndClip (view); -} - -static void -haiku_draw_stipple_background (struct glyph_string *s, struct face *face, - int box_line_hwidth, int box_line_vwidth) -{ -} - -static void -haiku_maybe_draw_background (struct glyph_string *s, int force_p) -{ - if ((s->first_glyph->type != IMAGE_GLYPH) && !s->background_filled_p) - { - struct face *face = s->face; - int box_line_width = max (face->box_horizontal_line_width, 0); - int box_vline_width = max (face->box_vertical_line_width, 0); - - if (FONT_HEIGHT (s->font) < s->height - 2 * box_vline_width - || FONT_TOO_HIGH (s->font) - || s->font_not_found_p || s->extends_to_end_of_line_p || force_p) - { - if (!face->stipple) - haiku_draw_plain_background (s, face, box_line_width, - box_vline_width); - else - haiku_draw_stipple_background (s, face, box_line_width, - box_vline_width); - s->background_filled_p = 1; - } - } -} - -static void -haiku_mouse_face_colors (struct glyph_string *s, uint32_t *fg, - uint32_t *bg) -{ - int face_id; - struct face *face; - - /* What face has to be used last for the mouse face? */ - face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id; - face = FACE_FROM_ID_OR_NULL (s->f, face_id); - if (face == NULL) - face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); - - if (s->first_glyph->type == CHAR_GLYPH) - face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch, -1, Qnil); - else - face_id = FACE_FOR_CHAR (s->f, face, 0, -1, Qnil); - - face = FACE_FROM_ID (s->f, face_id); - prepare_face_for_display (s->f, s->face); - - if (fg) - *fg = face->foreground; - if (bg) - *bg = face->background; -} - static void haiku_draw_underwave (struct glyph_string *s, int width, int x) { @@ -875,6 +719,164 @@ haiku_draw_text_decoration (struct glyph_string *s, struct face *face, BView_draw_unlock (view); } +static void +haiku_draw_string_box (struct glyph_string *s, int clip_p) +{ + int hwidth, vwidth, left_x, right_x, top_y, bottom_y, last_x; + bool raised_p, left_p, right_p; + struct glyph *last_glyph; + struct haiku_rect clip_rect; + + struct face *face = s->face; + + last_x = ((s->row->full_width_p && !s->w->pseudo_window_p) + ? WINDOW_RIGHT_EDGE_X (s->w) + : window_box_right (s->w, s->area)); + + /* The glyph that may have a right box line. For static + compositions and images, the right-box flag is on the first glyph + of the glyph string; for other types it's on the last glyph. */ + if (s->cmp || s->img) + last_glyph = s->first_glyph; + else if (s->first_glyph->type == COMPOSITE_GLYPH + && s->first_glyph->u.cmp.automatic) + { + /* For automatic compositions, we need to look up the last glyph + in the composition. */ + struct glyph *end = s->row->glyphs[s->area] + s->row->used[s->area]; + struct glyph *g = s->first_glyph; + for (last_glyph = g++; + g < end && g->u.cmp.automatic && g->u.cmp.id == s->cmp_id + && g->slice.cmp.to < s->cmp_to; + last_glyph = g++) + ; + } + else + last_glyph = s->first_glyph + s->nchars - 1; + + vwidth = eabs (face->box_vertical_line_width); + hwidth = eabs (face->box_horizontal_line_width); + raised_p = face->box == FACE_RAISED_BOX; + left_x = s->x; + right_x = (s->row->full_width_p && s->extends_to_end_of_line_p + ? last_x - 1 + : min (last_x, s->x + s->background_width) - 1); + + top_y = s->y; + bottom_y = top_y + s->height - 1; + + left_p = (s->first_glyph->left_box_line_p + || (s->hl == DRAW_MOUSE_FACE + && (s->prev == NULL + || s->prev->hl != s->hl))); + right_p = (last_glyph->right_box_line_p + || (s->hl == DRAW_MOUSE_FACE + && (s->next == NULL + || s->next->hl != s->hl))); + + get_glyph_string_clip_rect (s, &clip_rect); + + if (face->box == FACE_SIMPLE_BOX) + haiku_draw_box_rect (s, left_x, top_y, right_x, bottom_y, hwidth, + vwidth, left_p, right_p, &clip_rect); + else + haiku_draw_relief_rect (s, left_x, top_y, right_x, bottom_y, hwidth, + vwidth, raised_p, true, true, left_p, right_p, + &clip_rect, 1); + + if (clip_p) + { + void *view = FRAME_HAIKU_VIEW (s->f); + + haiku_draw_text_decoration (s, face, face->foreground, s->width, s->x); + BView_ClipToInverseRect (view, left_x, top_y, right_x - left_x + 1, hwidth); + if (left_p) + BView_ClipToInverseRect (view, left_x, top_y, vwidth, bottom_y - top_y + 1); + BView_ClipToInverseRect (view, left_x, bottom_y - hwidth + 1, + right_x - left_x + 1, hwidth); + if (right_p) + BView_ClipToInverseRect (view, right_x - vwidth + 1, + top_y, vwidth, bottom_y - top_y + 1); + } +} + +static void +haiku_draw_plain_background (struct glyph_string *s, struct face *face, + int box_line_hwidth, int box_line_vwidth) +{ + void *view = FRAME_HAIKU_VIEW (s->f); + BView_StartClip (view); + if (s->hl == DRAW_CURSOR) + BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel); + else + BView_SetHighColor (view, face->background_defaulted_p ? + FRAME_BACKGROUND_PIXEL (s->f) : + face->background); + + BView_FillRectangle (view, s->x, + s->y + box_line_hwidth, + s->background_width, + s->height - 2 * box_line_hwidth); + BView_EndClip (view); +} + +static void +haiku_draw_stipple_background (struct glyph_string *s, struct face *face, + int box_line_hwidth, int box_line_vwidth) +{ +} + +static void +haiku_maybe_draw_background (struct glyph_string *s, int force_p) +{ + if ((s->first_glyph->type != IMAGE_GLYPH) && !s->background_filled_p) + { + struct face *face = s->face; + int box_line_width = max (face->box_horizontal_line_width, 0); + int box_vline_width = max (face->box_vertical_line_width, 0); + + if (FONT_HEIGHT (s->font) < s->height - 2 * box_vline_width + || FONT_TOO_HIGH (s->font) + || s->font_not_found_p || s->extends_to_end_of_line_p || force_p) + { + if (!face->stipple) + haiku_draw_plain_background (s, face, box_line_width, + box_vline_width); + else + haiku_draw_stipple_background (s, face, box_line_width, + box_vline_width); + s->background_filled_p = 1; + } + } +} + +static void +haiku_mouse_face_colors (struct glyph_string *s, uint32_t *fg, + uint32_t *bg) +{ + int face_id; + struct face *face; + + /* What face has to be used last for the mouse face? */ + face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id; + face = FACE_FROM_ID_OR_NULL (s->f, face_id); + if (face == NULL) + face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); + + if (s->first_glyph->type == CHAR_GLYPH) + face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch, -1, Qnil); + else + face_id = FACE_FOR_CHAR (s->f, face, 0, -1, Qnil); + + face = FACE_FROM_ID (s->f, face_id); + prepare_face_for_display (s->f, s->face); + + if (fg) + *fg = face->foreground; + if (bg) + *bg = face->background; +} + static void haiku_draw_glyph_string_foreground (struct glyph_string *s) { @@ -1557,14 +1559,11 @@ haiku_draw_glyph_string (struct glyph_string *s) if (!box_filled_p && face->box != FACE_NO_BOX) haiku_draw_string_box (s, 1); + else + haiku_draw_text_decoration (s, face, face->foreground, s->width, s->x); if (!s->for_overlaps) { - uint32_t dcol; - dcol = face->foreground; - - haiku_draw_text_decoration (s, face, dcol, s->width, s->x); - if (s->prev) { struct glyph_string *prev; commit 8716f21d94bfda0072843e087833fedb38dcf13e Author: Mattias EngdegÄrd Date: Sat Dec 11 22:11:08 2021 +0100 Constant-propagate access to captured variables * lisp/emacs-lisp/byte-opt.el (byte-optimize--substitutable-p): Treat (internal-get-closed-var N) as constants for propagation purposes, because that is effectively what such forms will be compiled to. This allows for the elimination of some lexical variables. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index f6db803b78..2bdf1f5511 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -342,8 +342,12 @@ for speeding up processing.") (numberp expr) (stringp expr) (and (consp expr) - (memq (car expr) '(quote function)) - (symbolp (cadr expr))) + (or (and (memq (car expr) '(quote function)) + (symbolp (cadr expr))) + ;; (internal-get-closed-var N) can be considered constant for + ;; const-prop purposes. + (and (eq (car expr) 'internal-get-closed-var) + (integerp (cadr expr))))) (keywordp expr))) (defmacro byte-optimize--pcase (exp &rest cases) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 7e51f820b7..a442eb473b 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -686,6 +686,12 @@ inner loops respectively." (let* ((x 'a)) (list x (funcall g) (funcall h))))))) (funcall (funcall f 'b))) + + ;; Test constant-propagation of access to captured variables. + (let* ((x 2) + (f (lambda () + (let ((y x)) (list y 3 y))))) + (funcall f)) ) "List of expressions for cross-testing interpreted and compiled code.") commit 36cd4f5d81c3c19e5719e25daa1a8e08c88cc1a7 Author: Mattias EngdegÄrd Date: Sat Dec 11 21:59:13 2021 +0100 Reimplement gnus-thread-header in Lisp * lisp/gnus/gnus-sum.el (gnus-thread-header): Replace lovingly hand-crafted assembler code with plain Lisp. With lexical binding the difference is unlikely to be detectable. diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index ba61658600..1bd0e8847e 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -5001,23 +5001,13 @@ If LINE, insert the rebuilt thread starting on line LINE." gnus-article-sort-functions))) (gnus-message 7 "Sorting articles...done")))) -;; Written by Hallvard B Furuseth . -(defmacro gnus-thread-header (thread) - "Return header of first article in THREAD. -Note that THREAD must never, ever be anything else than a variable - -using some other form will lead to serious barfage." - (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread))) - ;; (8% speedup to gnus-summary-prepare, just for fun :-) - (cond - ((and (boundp 'lexical-binding) lexical-binding) - ;; FIXME: This version could be a "defsubst" rather than a macro. - `(#[257 "\211:\203\16\0\211@;\203\15\0A@@\207" - [] 2] - ,thread)) - (t - ;; Not sure how XEmacs handles these things, so let's keep the old code. - (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" - (vector thread) 2)))) +(defsubst gnus-thread-header (thread) + "Return header of first article in THREAD." + (if (consp thread) + (car (if (stringp (car thread)) + (cadr thread) + thread)) + thread)) (defsubst gnus-article-sort-by-number (h1 h2) "Sort articles by article number." commit d56b0b4e6b5be1c27d7f3667bc3caaa63269d465 Author: Philipp Stephani Date: Sat Dec 11 19:33:50 2021 +0100 ; * lisp/subr.el (start-process-shell-command): Add missing period. diff --git a/lisp/subr.el b/lisp/subr.el index d224f761e1..9c07606100 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4057,7 +4057,7 @@ BUFFER is the buffer (or buffer name) to associate with the process. Process output goes at end of that buffer, unless you specify an output stream or filter function to handle the output. BUFFER may be also nil, meaning that this process is not associated - with any buffer + with any buffer. COMMAND is the shell command to run." ;; We used to use `exec' to replace the shell with the command, ;; but that failed to handle (...) and semicolon, etc. commit a81669c69fda1a2d0d4238b8440145fb2aeb959f Author: Eli Zaretskii Date: Sat Dec 11 20:15:53 2021 +0200 Fix hang when deleting a pipe process * src/w32.h (FILE_DONT_CLOSE): New flag. * src/w32.c (sys_close): Don't close descriptors used to read from the pipe process. Leave the FILE_DONT_CLOSE flag set in the descriptor's info. (register_aux_fd): Set the FILE_DONT_CLOSE flag in the descriptor's info. * src/w32proc.c (reader_thread): When exiting normally, close the file descriptor used to read from a pipe process. (Bug#52414) diff --git a/src/w32.c b/src/w32.c index 2b2f8aadf6..1de148f034 100644 --- a/src/w32.c +++ b/src/w32.c @@ -8548,7 +8548,7 @@ fcntl (int s, int cmd, int options) int sys_close (int fd) { - int rc; + int rc = -1; if (fd < 0) { @@ -8603,14 +8603,31 @@ sys_close (int fd) } } - if (fd >= 0 && fd < MAXDESC) - fd_info[fd].flags = 0; - /* Note that sockets do not need special treatment here (at least on NT and Windows 95 using the standard tcp/ip stacks) - it appears that closesocket is equivalent to CloseHandle, which is to be expected because socket handles are fully fledged kernel handles. */ - rc = _close (fd); + if (fd < MAXDESC) + { + if ((fd_info[fd].flags & FILE_DONT_CLOSE) == 0) + { + fd_info[fd].flags = 0; + rc = _close (fd); + } + else + { + /* We don't close here descriptors open by pipe processes + for reading from the pipe, because the reader thread + might be stuck in _sys_read_ahead, and then we will hang + here. If the reader thread exits normally, it will close + the descriptor; otherwise we will leave a zombie thread + hanging around. */ + rc = 0; + /* Leave the flag set for the reader thread to close the + descriptor. */ + fd_info[fd].flags = FILE_DONT_CLOSE; + } + } return rc; } @@ -10898,6 +10915,7 @@ register_aux_fd (int infd) } fd_info[ infd ].cp = cp; fd_info[ infd ].hnd = (HANDLE) _get_osfhandle (infd); + fd_info[ infd ].flags |= FILE_DONT_CLOSE; } #ifdef HAVE_GNUTLS diff --git a/src/w32.h b/src/w32.h index b31d66646c..bb3ec40324 100644 --- a/src/w32.h +++ b/src/w32.h @@ -135,6 +135,7 @@ extern filedesc fd_info [ MAXDESC ]; #define FILE_SOCKET 0x0200 #define FILE_NDELAY 0x0400 #define FILE_SERIAL 0x0800 +#define FILE_DONT_CLOSE 0x1000 extern child_process * new_child (void); extern void delete_child (child_process *cp); diff --git a/src/w32proc.c b/src/w32proc.c index 360f45e9e1..bfe720eb62 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -1206,6 +1206,7 @@ static DWORD WINAPI reader_thread (void *arg) { child_process *cp; + int fd; /* Our identity */ cp = (child_process *)arg; @@ -1220,12 +1221,13 @@ reader_thread (void *arg) { int rc; - if (cp->fd >= 0 && (fd_info[cp->fd].flags & FILE_CONNECT) != 0) - rc = _sys_wait_connect (cp->fd); - else if (cp->fd >= 0 && (fd_info[cp->fd].flags & FILE_LISTEN) != 0) - rc = _sys_wait_accept (cp->fd); + fd = cp->fd; + if (fd >= 0 && (fd_info[fd].flags & FILE_CONNECT) != 0) + rc = _sys_wait_connect (fd); + else if (fd >= 0 && (fd_info[fd].flags & FILE_LISTEN) != 0) + rc = _sys_wait_accept (fd); else - rc = _sys_read_ahead (cp->fd); + rc = _sys_read_ahead (fd); /* Don't bother waiting for the event if we already have been told to exit by delete_child. */ @@ -1238,7 +1240,7 @@ reader_thread (void *arg) { DebPrint (("reader_thread.SetEvent(0x%x) failed with %lu for fd %ld (PID %d)\n", (DWORD_PTR)cp->char_avail, GetLastError (), - cp->fd, cp->pid)); + fd, cp->pid)); return 1; } @@ -1266,6 +1268,13 @@ reader_thread (void *arg) if (cp->status == STATUS_READ_ERROR) break; } + /* If this thread was reading from a pipe process, close the + descriptor used for reading, as sys_close doesn't in that case. */ + if (fd_info[fd].flags == FILE_DONT_CLOSE) + { + fd_info[fd].flags = 0; + _close (fd); + } return 0; } commit 8a0734329a4faf0b45627763af74222bdd0ec143 Author: Philipp Stephani Date: Sat Dec 11 13:51:34 2021 +0100 Avoid undefined behavior in 'send-process-region' (Bug#52369). * src/process.c (send_process): Signal an error if the file descriptor has already been closed. diff --git a/src/process.c b/src/process.c index 75ba191fa1..1d307d5242 100644 --- a/src/process.c +++ b/src/process.c @@ -6520,6 +6520,9 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, /* Send this batch, using one or more write calls. */ ptrdiff_t written = 0; int outfd = p->outfd; + if (outfd < 0) + error ("Output file descriptor of %s is closed", + SDATA (p->name)); eassert (0 <= outfd && outfd < FD_SETSIZE); #ifdef DATAGRAM_SOCKETS if (DATAGRAM_CHAN_P (outfd)) commit 30dd5c9acc3b3b95ef784549b5e3ff8136a23854 Author: Kyle Meyer Date: Sat Dec 11 12:31:13 2021 -0500 Update to Org 9.5.1-25-g9ca3bc diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index 7b09db5f8b..7c83bdc27c 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -68,6 +68,7 @@ (require 'bibtex) (require 'json) +(require 'map) (require 'oc) (require 'seq) @@ -704,11 +705,18 @@ Return chosen style as a string." (defun org-cite-basic--key-completion-table () "Return completion table for cite keys, as a hash table. -In this hash table, keys are a strings with author, date, and title of the -reference. Values are the cite key." - (let ((cache-key (mapcar #'car org-cite-basic--bibliography-cache))) - (if (gethash cache-key org-cite-basic--completion-cache) - org-cite-basic--completion-cache + +In this hash table, keys are a strings with author, date, and +title of the reference. Values are the cite keys. + +Return nil if there are no bibliography files or no entries." + ;; Populate bibliography cache. + (let ((entries (org-cite-basic--parse-bibliography))) + (cond + ((null entries) nil) ;no bibliography files + ((gethash entries org-cite-basic--completion-cache) + org-cite-basic--completion-cache) + (t (clrhash org-cite-basic--completion-cache) (dolist (key (org-cite-basic--all-keys)) (let ((completion @@ -725,14 +733,16 @@ reference. Values are the cite key." org-cite-basic-column-separator (org-cite-basic--get-field 'title key nil t)))) (puthash completion key org-cite-basic--completion-cache))) - (puthash cache-key t org-cite-basic--completion-cache) - org-cite-basic--completion-cache))) + (unless (map-empty-p org-cite-basic--completion-cache) ;no key + (puthash entries t org-cite-basic--completion-cache) + org-cite-basic--completion-cache))))) (defun org-cite-basic--complete-key (&optional multiple) "Prompt for a reference key and return a citation reference string. -When optional argument MULTIPLE is non-nil, prompt for multiple keys, until one -of them is nil. Then return the list of reference strings selected. +When optional argument MULTIPLE is non-nil, prompt for multiple +keys, until one of them is nil. Then return the list of +reference strings selected. Raise an error when no bibliography is set in the buffer." (let* ((table @@ -748,9 +758,9 @@ Raise an error when no bibliography is set in the buffer." (build-prompt (lambda () (if keys - (format "Key (\"\" to exit) %s: " + (format "Key (empty input exits) %s: " (mapconcat #'identity (reverse keys) ";")) - "Key (\"\" to exit): ")))) + "Key (empty input exits): ")))) (let ((key (funcall prompt (funcall build-prompt)))) (while (org-string-nw-p key) (push (gethash key table) keys) diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index 7f078d139b..a92ea8a63e 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -605,10 +605,10 @@ property list." (with-temp-buffer (save-excursion (insert output)) (when (search-forward "\\begin{document}" nil t) - ;; Ensure that \citeprocitem is defined for citeproc-el + (goto-char (match-beginning 0)) + ;; Ensure that \citeprocitem is defined for citeproc-el. (insert "\\makeatletter\n\\newcommand{\\citeprocitem}[2]{\\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\\hyper@linkend}\n\\makeatother\n\n") ;; Ensure there is a \usepackage{hanging} somewhere or add one. - (goto-char (match-beginning 0)) (let ((re (rx "\\usepackage" (opt "[" (*? nonl) "]") "{hanging}"))) (unless (re-search-backward re nil t) (insert "\\usepackage[notquote]{hanging}\n")))) diff --git a/lisp/org/oc.el b/lisp/org/oc.el index 427c087c03..a77daa7e12 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -1540,7 +1540,7 @@ The generated function inserts or edit a citation at point. More specifically, On a citation reference: - - on the prefix or right before th \"@\" character, insert a new reference + - on the prefix or right before the \"@\" character, insert a new reference before the current one, - on the suffix, insert it after the reference, - otherwise, update the cite key, preserving both affixes. diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el index a10db7e666..a3d9576827 100644 --- a/lisp/org/org-keys.el +++ b/lisp/org/org-keys.el @@ -444,7 +444,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." ;;;; TAB key with modifiers (org-defkey org-mode-map (kbd "TAB") #'org-cycle) -(org-defkey org-mode-map (kbd "C-c C-TAB") #'org-force-cycle-archived) +(org-defkey org-mode-map (kbd "C-c C-") #'org-force-cycle-archived) ;; Override text-mode binding to expose `complete-symbol' for ;; pcomplete functionality. (org-defkey org-mode-map (kbd "M-TAB") nil) diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el index c38a07b69a..c0287a25a5 100644 --- a/lisp/org/org-macro.el +++ b/lisp/org/org-macro.el @@ -368,7 +368,7 @@ Return value as a string." date) (unwind-protect (progn - (vc-call print-log file buf nil nil 1) + (vc-call print-log (list file) buf nil nil 1) (with-current-buffer buf (vc-exec-after (lambda () diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index de75519ec6..b009b9691f 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made." (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.5.1-15-gdb4805")) + (let ((org-git-version "release_9.5.1-25-g9ca3bc")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index df79d57f2c..00bbc07688 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -11323,13 +11323,14 @@ or a character." (setq new (if nump - (let ((msg (format "Priority %s-%s, SPC to remove: " - (number-to-string org-priority-highest) - (number-to-string org-priority-lowest)))) - (if (< 9 org-priority-lowest) - (string-to-number (read-string msg)) - (message msg) - (string-to-number (char-to-string (read-char-exclusive))))) + (let* ((msg (format "Priority %s-%s, SPC to remove: " + (number-to-string org-priority-highest) + (number-to-string org-priority-lowest))) + (s (if (< 9 org-priority-lowest) + (read-string msg) + (message msg) + (char-to-string (read-char-exclusive))))) + (if (equal s " ") ?\s (string-to-number s))) (progn (message "Priority %c-%c, SPC to remove: " org-priority-highest org-priority-lowest) (save-match-data diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el index ca0f1c71ab..77de0aa5bf 100644 --- a/lisp/org/ox-beamer.el +++ b/lisp/org/ox-beamer.el @@ -1059,7 +1059,7 @@ Return PDF file's name." (let ((file (org-export-output-file-name ".tex" subtreep))) (org-export-to-file 'beamer file async subtreep visible-only body-only ext-plist - (lambda (file) (org-latex-compile file))))) + #'org-latex-compile))) ;;;###autoload (defun org-beamer-select-environment () diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el index 081a28317f..16c3dc9a02 100644 --- a/lisp/org/ox-icalendar.el +++ b/lisp/org/ox-icalendar.el @@ -888,8 +888,8 @@ Return ICS file name." (org-export-to-file 'icalendar outfile async subtreep visible-only body-only '(:ascii-charset utf-8 :ascii-links-to-notes nil) - (lambda (file) - (run-hook-with-args 'org-icalendar-after-save-hook file) nil)))) + '(lambda (file) + (run-hook-with-args 'org-icalendar-after-save-hook file) nil)))) ;;;###autoload (defun org-icalendar-export-agenda-files (&optional async) diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el index 6a895a6a24..978e4e41f5 100644 --- a/lisp/org/ox-koma-letter.el +++ b/lisp/org/ox-koma-letter.el @@ -982,7 +982,7 @@ Return PDF file's name." (org-koma-letter-special-contents)) (org-export-to-file 'koma-letter file async subtreep visible-only body-only ext-plist - (lambda (file) (org-latex-compile file))))) + #'org-latex-compile))) (provide 'ox-koma-letter) diff --git a/lisp/org/ox-man.el b/lisp/org/ox-man.el index 6d3476cdae..9a1f00f352 100644 --- a/lisp/org/ox-man.el +++ b/lisp/org/ox-man.el @@ -1117,7 +1117,7 @@ Return PDF file's name." (let ((outfile (org-export-output-file-name ".man" subtreep))) (org-export-to-file 'man outfile async subtreep visible-only body-only ext-plist - (lambda (file) (org-latex-compile file))))) + #'org-latex-compile))) (defun org-man-compile (file) "Compile a Groff file. diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el index 8b949b361a..46077ece4b 100644 --- a/lisp/org/ox-texinfo.el +++ b/lisp/org/ox-texinfo.el @@ -1701,7 +1701,7 @@ Return INFO file's name." (org-export-coding-system org-texinfo-coding-system)) (org-export-to-file 'texinfo outfile async subtreep visible-only body-only ext-plist - (lambda (file) (org-texinfo-compile file))))) + #'org-texinfo-compile))) ;;;###autoload (defun org-texinfo-publish-to-texinfo (plist filename pub-dir) diff --git a/lisp/org/ox.el b/lisp/org/ox.el index b27ec56c08..80202b0850 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el @@ -6373,7 +6373,11 @@ use it to set a major mode there, e.g, (&optional async subtreep visible-only body-only ext-plist) (interactive) (org-export-to-buffer \\='latex \"*Org LATEX Export*\" - async subtreep visible-only body-only ext-plist (lambda () (LaTeX-mode)))) + async subtreep visible-only body-only ext-plist + #'LaTeX-mode)) + +When expressed as an anonymous function, using `lambda', +POST-PROCESS needs to be quoted. This function returns BUFFER." (declare (indent 2)) @@ -6436,7 +6440,10 @@ to send the output file through additional processing, e.g, (let ((outfile (org-export-output-file-name \".tex\" subtreep))) (org-export-to-file \\='latex outfile async subtreep visible-only body-only ext-plist - (lambda (file) (org-latex-compile file))) + #'org-latex-compile))) + +When expressed as an anonymous function, using `lambda', +POST-PROCESS needs to be quoted. The function returns either a file name returned by POST-PROCESS, or FILE." commit a37484992651fa6bdee9d5181fb6b096dbf41426 Author: Po Lu Date: Fri Dec 10 21:36:59 2021 +0800 Fix the DJGPP port * config.bat: * msdos/sed1v2.inp: * msdos/sed2v2.inp: * msdos/sed3v2.inp: * msdos/sedlibmk.inp: Update for Emacs 28. * msdos/langinfo.h: New file. * lisp/loadup.el: Use correct path to temacs when dumping on MS-DOS. * src/callproc.c (environ) [MSDOS]: New declaration. (child_setup, emacs_spawn): Update MS-DOS parts for Emacs 28. * src/fileio.c (Fcopy_file): Don't use copy_file_range on MS-DOS. * src/msdos.c (initialize_msdos_display): Add `defined_color_hook'. (openat, fchmodat, futimens, utimensat): New functions. * src/msdos.h (FRAME_X_DISPLAY): New macro. * src/process.c: Make some more things conditional on subprocess support. (PIPECONN_P, PIPECONN1_P) [!subprocesses]: New placeholder macros. (Fnum_processors): Return 1 on MSDOS. (open_channel_for_module): Avoid subprocess specific code on MSDOS. diff --git a/config.bat b/config.bat index cba7336099..e4332cd326 100644 --- a/config.bat +++ b/config.bat @@ -283,6 +283,7 @@ If Exist execinfo.in.h update execinfo.in.h execinfo.in-h If Exist fcntl.in.h update fcntl.in.h fcntl.in-h If Exist getopt.in.h update getopt.in.h getopt.in-h If Exist getopt-cdefs.in.h update getopt-cdefs.in.h getopt-cdefs.in-h +If Exist ieee754.in.h update ieee754.in.h ieee754.in-h If Exist inttypes.in.h update inttypes.in.h inttypes.in-h If Exist limits.in.h update limits.in.h limits.in-h If Exist signal.in.h update signal.in.h signal.in-h @@ -293,6 +294,7 @@ If Exist stdint.in.h update stdint.in.h stdint.in-h If Exist stdio.in.h update stdio.in.h stdio.in-h If Exist stdlib.in.h update stdlib.in.h stdlib.in-h If Exist string.in.h update string.in.h string.in-h +If Exist sys_random.in.h update sys_random.in.h sys_random.in-h If Exist sys_select.in.h update sys_select.in.h sys_select.in-h If Exist sys_stat.in.h update sys_stat.in.h sys_stat.in-h If Exist sys_time.in.h update sys_time.in.h sys_time.in-h @@ -308,10 +310,13 @@ rm -f makefile.tmp sed -f ../msdos/sedlibcf.inp < gnulib.mk-in > gnulib.tmp sed -f ../msdos/sedlibmk.inp < gnulib.tmp > gnulib.mk rm -f gnulib.tmp -Rem Create .d files for new files in lib/ +Rem Create .d files for new files in lib/ and lib/malloc/ If Not Exist deps\stamp mkdir deps for %%f in (*.c) do @call ..\msdos\depfiles.bat %%f echo deps-stamp > deps\stamp +If Not Exist deps\malloc\stamp mkdir deps\malloc +for %%f in (malloc\*.c) do @call ..\msdos\depfiles.bat %%f +echo deps-stamp > deps\malloc\stamp cd .. rem ---------------------------------------------------------------------- Echo Configuring the lisp directory... diff --git a/lisp/loadup.el b/lisp/loadup.el index e8ecb67d56..4da0ff7385 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -549,7 +549,9 @@ lost after dumping"))) (lexical-binding nil)) (if (member tmp-dump-mode '("pdump" "pbootstrap")) (dump-emacs-portable (expand-file-name output invocation-directory)) - (dump-emacs output "temacs") + (dump-emacs output (if (eq system-type 'ms-dos) + "temacs.exe" + "temacs")) (message "%d pure bytes used" pure-bytes-used)) (setq success t)) (unless success diff --git a/msdos/langinfo.h b/msdos/langinfo.h new file mode 100644 index 0000000000..a74c3f7f8e --- /dev/null +++ b/msdos/langinfo.h @@ -0,0 +1,20 @@ +/* Replacement langinfo.h file for building GNU Emacs on MS-DOS with DJGPP. + +Copyright (C) 2021 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +#define nl_langinfo(ignore) "cp437" diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp index 5d82af66d9..60f67e4303 100644 --- a/msdos/sed1v2.inp +++ b/msdos/sed1v2.inp @@ -55,6 +55,10 @@ s/ *@LIBJPEG@// s/ *@LIBPNG@// s/ *@LIBGIF@// s/ *@LIBXPM@// +/^HAVE_NATIVE_COMP *=/s/@HAVE_NATIVE_COMP@/no/ +/^HAVE_PDUMPER *=/s/@HAVE_PDUMPER@/no/ +/^CHECK_STRUCTS *=/s/@CHECK_STRUCTS@// +/^RUN_TEMACS \=/s/temacs/temacs.exe/ /^XFT_LIBS *=/s/@XFT_LIBS@// /^XCB_LIBS *=/s/@XCB_LIBS@// /^FONTCONFIG_CFLAGS *=/s/@FONTCONFIG_CFLAGS@// @@ -150,6 +154,18 @@ s/ *@LIBXPM@// /^CANNOT_DUMP *=/s/@CANNOT_DUMP@/no/ /^W32_OBJ *=/s/@W32_OBJ@// /^W32_LIBS *=/s/@W32_LIBS@// +/^JSON_OBJ *=/s/@JSON_OBJ@// +/^JSON_CFLAGS *=/s/@JSON_CFLAGS@// +/^JSON_LIBS *=/s/@JSON_LIBS@// +/^LIBGCCJIT_OBJ *=/s/@LIBGCCJIT_OBJ@// +/^LIBGCCJIT_CFLAGS *=/s/@LIBGCCJIT_CFLAGS@// +/^LIBGCCJIT_LIBS *=/s/@LIBGCCJIT_LIBS@// +/^HARFBUZZ_CFLAGS *=/s/@HARFBUZZ_CFLAGS@// +/^HARFBUZZ_LIBS *=/s/@HARFBUZZ_LIBS@// +/^LCMS2_CFLAGS *=/s/@LCMS2_CFLAGS@// +/^LCMS2_LIBS *=/s/@LCMS2_LIBS@// +/^LIBGMP *=/s/@LIBGMP@// +/^DYNLIB_OBJ *=/s/@DYNLIB_OBJ@// /^version *=/s/@[^@\n]*@// /^EMACSRES *=/s/@EMACSRES@// /^W32_RES_LINK *=/s/@W32_RES_LINK@// @@ -162,6 +178,7 @@ s/ *@LIBXPM@// /^AUTO_DEPEND *=/s/@AUTO_DEPEND@/yes/ /^PAXCTL_dumped *=/s/=.*$/=/ /^PAXCTL_notdumped *=/s/=.*$/=/ +/^DUMPING *=/s/@DUMPING@/unexec/ /^lisp\.mk:/,/^$/c\ lisp.mk: $(lispsource)/loadup.el\ @rm -f $@\ @@ -183,6 +200,7 @@ lisp.mk: $(lispsource)/loadup.el\ /^ *ifneq (\$(PAXCTL_dumped),)/,/^ *endif/d /^ *ln /s/ln /cp / /^ fi/d +/ifeq (\$(HAVE_NATIVE_COMP):\$(NATIVE_DISABLED),yes:)/,/endif/d /^ *\$(RUN_TEMACS) /i\ stubedit temacs.exe minstack=1024k /^ *LC_ALL=C \$(RUN_TEMACS)/i\ @@ -214,8 +232,8 @@ s/echo.*buildobj.lst/dj&/ /^ -\{0,1\}rm -f/s/\\#/#/ /^ echo.* buildobj.h/s|echo |djecho | /^buildobj\.h:/,/^ *\$(AM_V_at)mv /{ - /^ *\$(AM_V_GEN)for /,/^ *done /c\ - djecho "$(ALLOBJS)" | sed -e 's/^ */"/' -e 's/ *$$/"/' -e 's/ */", "/g' >>$@.tmp + /^ *\$(AM_V_GEN)for /,/mv \$@.tmp \$@/c\ + djecho "$(ALLOBJS)" | sed -e 's/^ */"/' -e 's/ *$$/"/' -e 's/ */", "/g' >>$@ } # Remove or replace dependencies we cannot have /^\.PRECIOUS: /s!\.\./config.status !! @@ -236,3 +254,5 @@ s| -I\$(srcdir)/\.\./lib|| s| -I\$(top_srcdir)/lib|| s| -I\. -I\$(srcdir)| -I.| /^ *test "X/d +/\$(CC) -o \$@.tmp/s/\$@.tmp/\$@/ +/mv \$@.tmp \$@/d \ No newline at end of file diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index 5238f2dfc6..ae5d46fe86 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -37,6 +37,7 @@ /^#undef HAVE_STRUCT_UTIMBUF *$/s/^.*$/#define HAVE_STRUCT_UTIMBUF 1/ /^#undef LOCALTIME_CACHE *$/s/^.*$/#define LOCALTIME_CACHE 1/ /^#undef HAVE_TZSET *$/s/^.*$/#define HAVE_TZSET 1/ +/^#undef HAVE_UNEXEC *$/s/^.*$/#define HAVE_UNEXEC 1/ /^#undef HAVE_RINT *$/s/^.*$/#define HAVE_RINT 1/ /^#undef HAVE_C99_STRTOLD *$/s/^.*$/#define HAVE_C99_STRTOLD 1/ /^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/ diff --git a/msdos/sed3v2.inp b/msdos/sed3v2.inp index 8b9bb0679b..f7c9eb05ba 100644 --- a/msdos/sed3v2.inp +++ b/msdos/sed3v2.inp @@ -34,6 +34,7 @@ /^LIBS_SYSTEM *=/s/@[^@\n]*@//g /^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g /^LIB_TIMER_TIME *=/s/@[^@\n]*@//g +/^LIB_GETRANDOM *=/s/@[^@\n]*@//g /^CFLAGS *=/s!=.*$!=-O2 -g! /^CPPFLAGS *=/s/@CPPFLAGS@// /^LDFLAGS *=/s/@LDFLAGS@// diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp index 825be84968..b3b94297d6 100644 --- a/msdos/sedlibmk.inp +++ b/msdos/sedlibmk.inp @@ -144,7 +144,7 @@ s/@PACKAGE@/emacs/ /^CPP *=/s/@[^@\n]*@/gcc -e/ /^CPPFLAGS *=/s/@[^@\n]*@// /^CCDEPMODE *=/s/@[^@\n]*@/depmode=gcc3/ -/^CFLAGS *=/s/@[^@\n]*@/-g -O2/ +/^CFLAGS *=/s/@[^@\n]*@/-g -O2 -I$\(srcdir\)\/..\/msdos/ /^CYGPATH_W *=/s/@[^@\n]*@// /^CYGWIN_OBJ *=/s/@[^@\n]*@// /^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@// @@ -170,28 +170,28 @@ s/@PACKAGE@/emacs/ /^BITSIZEOF_WCHAR_T *=/s/@BITSIZEOF_WCHAR_T@/16/ /^BITSIZEOF_WINT_T *=/s/@BITSIZEOF_WINT_T@/32/ /^APPLE_UNIVERSAL_BUILD *=/s/@APPLE_UNIVERSAL_BUILD@/0/ -# -# Most GNULIB_* are replaced with zero even though DJGPP does not have -# these features. That's because the gnulib replacements cannot +# Most GL_GNULIB_* are replaced with zero even though DJGPP does not +# have these features. That's because the gnulib replacements cannot # possibly work for DJGPP, so we prefer to fail the link than have a # subtly botched executable. Those replacements that _are_ needed # should be before the last catch-all rule. -/^GNULIB_ATOLL *=/s/@GNULIB_ATOLL@/1/ -/^GNULIB_DUP3 *=/s/@GNULIB_DUP3@/1/ -/^GNULIB_ENVIRON *=/s/@GNULIB_ENVIRON@/1/ -/^GNULIB_FDATASYNC *=/s/@GNULIB_FDATASYNC@/1/ -/^GNULIB_GETLOADAVG *=/s/@GNULIB_GETLOADAVG@/1/ -/^GNULIB_GL_UNISTD_H_GETOPT *=/s/@GNULIB_GL_UNISTD_H_GETOPT@/1/ -/^GNULIB_MEMRCHR *=/s/@GNULIB_MEMRCHR@/1/ -/^GNULIB_MKOSTEMP *=/s/@GNULIB_MKOSTEMP@/1/ -/^GNULIB_MKTIME *=/s/@GNULIB_MKTIME@/1/ -/^GNULIB_TIME_R *=/s/@GNULIB_TIME_R@/1/ -/^GNULIB_TIMEGM *=/s/@GNULIB_TIMEGM@/1/ -/^GNULIB_TIME_RZ *=/s/@GNULIB_TIME_RZ@/1/ -/^GNULIB_UNSETENV *=/s/@GNULIB_UNSETENV@/1/ -/^GNULIB_[^ =]* *= *@/s/@[^@\n]*@/0/ -/^GSETTINGS_CFLAGS *=/s/@[^@\n]*@// -/^GSETTINGS_LIBS *=/s/@[^@\n]*@// +/^GL_GNULIB_ATOLL *=/s/@GL_GNULIB_ATOLL@/1/ +/^GL_GNULIB_DUP3 *=/s/@GL_GNULIB_DUP3@/1/ +/^GL_GNULIB_ENVIRON *=/s/@GL_GNULIB_ENVIRON@/1/ +/^GL_GNULIB_FDATASYNC *=/s/@GL_GNULIB_FDATASYNC@/1/ +/^GL_GNULIB_GETLOADAVG *=/s/@GL_GNULIB_GETLOADAVG@/1/ +/^GL_GNULIB_UNISTD_H_GETOPT *=/s/@GL_GNULIB_UNISTD_H_GETOPT@/1/ +/^GL_GNULIB_MEMRCHR *=/s/@GL_GNULIB_MEMRCHR@/1/ +/^GL_GNULIB_MEMPCPY *=/s/@GL_GNULIB_MEMPCPY@/1/ +/^GL_GNULIB_MKOSTEMP *=/s/@GL_GNULIB_MKOSTEMP@/1/ +/^GL_GNULIB_MKTIME *=/s/@GL_GNULIB_MKTIME@/1/ +/^GL_GNULIB_TIME_R *=/s/@GL_GNULIB_TIME_R@/1/ +/^GL_GNULIB_TIMEGM *=/s/@GL_GNULIB_TIMEGM@/1/ +/^GL_GNULIB_TIME_RZ *=/s/@GL_GNULIB_TIME_RZ@/1/ +/^GL_GNULIB_UNSETENV *=/s/@GL_GNULIB_UNSETENV@/1/ +/^GL_GNULIB_[^ =]* *= *@/s/@[^@\n]*@/0/ +/^GL_GSETTINGS_CFLAGS *=/s/@[^@\n]*@// +/^GL_GSETTINGS_LIBS *=/s/@[^@\n]*@// # # Edit the HAVE_foo variables /^HAVE_ATOLL *=/s/@HAVE_ATOLL@/0/ @@ -253,6 +253,7 @@ s/@PACKAGE@/emacs/ /^HAVE_USLEEP *=/s/@HAVE_USLEEP@/1/ /^HAVE_WCHAR_H *=/s/@HAVE_WCHAR_H@/1/ /^HAVE_WCHAR_T *=/s/@HAVE_WCHAR_T@/1/ +/^HAVE_LIBGMP *=/s/@HAVE_LIBGMP@/0/ /^HAVE__BOOL *=/s/@HAVE__BOOL@/1/ /^HAVE__EXIT *=/s/@HAVE__EXIT@/1/ /^HAVE_[^ =]* *= *@/s/@[^@\n]*@/0/ @@ -265,7 +266,9 @@ s/@PACKAGE@/emacs/ /^LIBS *=/s/@[^@\n]*@// /^MAKEINFO *=/s/@MAKEINFO@/makeinfo/ # MKDIR_P lines are edited further below -/^MKDIR_P *=/s/@MKDIR_P@// +# MKDIR_P is only used to create lib/malloc, and the folder is +# already present in the distribution, so this should work fine. +/^MKDIR_P *=/s/@MKDIR_P@/echo/ /^NEXT_AS_FIRST_DIRECTIVE_DIRENT_H *=/s/@[^@\n]*@// /^NEXT_AS_FIRST_DIRECTIVE_ERRNO_H *=/s/@[^@\n]*@// /^NEXT_AS_FIRST_DIRECTIVE_FCNTL_H *=/s/@[^@\n]*@// @@ -309,6 +312,7 @@ s/@PACKAGE@/emacs/ /^REPLACE_MKTIME *=/s/@[^@\n]*@/1/ # We don't want any other gnulib replacement functions /^REPLACE_[^ =]* *= *@/s/@[^@\n]*@/0/ +/^LIB_GETRANDOM[^ =]* *= *@/s/@[^@\n]*@// /^SIG_ATOMIC_T_SUFFIX *=/s/@SIG_ATOMIC_T_SUFFIX@// /^SIZE_T_SUFFIX *=/s/@SIZE_T_SUFFIX@/u/ /^ALLOCA_H *=/s/@[^@\n]*@/alloca.h/ @@ -317,18 +321,23 @@ s/@PACKAGE@/emacs/ /^ERRNO_H *=/s/@[^@\n]*@// /^EXECINFO_H *=/s/@[^@\n]*@/execinfo.h/ /^GETOPT_CDEFS_H *=/s/@[^@\n]*@/getopt-cdefs.h/ +/^GMP_H *=/s/@[^@\n]*@/gmp.h/ /^LIMITS_H *=/s/@[^@\n]*@/limits.h/ +/^IEEE754_H *=/s/@[^@\n]*@/ieee754.h/ /^STDALIGN_H *=/s/@[^@\n]*@/stdalign.h/ /^STDDEF_H *=/s/@[^@\n]*@/stddef.h/ /^STDINT_H *=/s/@[^@\n]*@/stdint.h/ /^SYS_TIME_H_DEFINES_STRUCT_TIMESPEC *=/s/@[^@\n]*@/0/ /^TIME_H_DEFINES_STRUCT_TIMESPEC *=/s/@[^@\n]*@/0/ +/^TIME_H_DEFINES_TIME_UTC *=/s/@[^@\n]*@/0/ +/^UNISTD_H_HAVE_SYS_RANDOM_H *=/s/@[^@\n]*@/0/ /^UNISTD_H_HAVE_WINSOCK2_H *=/s/@[^@\n]*@/0/ /^UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS *=/s/@[^@\n]*@/0/ /^UNISTD_H_DEFINES_STRUCT_TIMESPEC *=/s/@[^@\n]*@/0/ /^UNDEFINE_STRTOK_R *=/s/@UNDEFINE_STRTOK_R@/0/ /^WCHAR_T_SUFFIX *=/s/@WCHAR_T_SUFFIX@/h/ /^WINT_T_SUFFIX *=/s/@WINT_T_SUFFIX@// +/^GNULIBHEADERS_OVERRIDE_WINT_T *=/s/@[^@\n]*@/0/ /^WINDOWS_64_BIT_OFF_T *=/s/@WINDOWS_64_BIT_OFF_T@/0/ /^WINDOWS_64_BIT_ST_SIZE *=/s/@WINDOWS_64_BIT_ST_SIZE@/0/ /^WINDOWS_STAT_INODES *=/s/@WINDOWS_STAT_INODES@/0/ @@ -337,7 +346,7 @@ s/@PACKAGE@/emacs/ /am__append_[1-9][0-9]* *=.*gettext\.h/s/@[^@\n]*@/\#/ /am__append_2 *=.*verify\.h/s/@[^@\n]*@// /^@gl_GNULIB_ENABLED_tempname_TRUE@/s/@[^@\n]*@// -/^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o memrchr.o sig2str.o time_r.o time_rz.o timegm.o mktime.o getloadavg.o pthread_sigmask.o mkostemp.o fpending.o fdatasync.o execinfo.o/ +/^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o getrandom.o memrchr.o mempcpy.o regex.o memmem.o sig2str.o sigdescr_np.o time_r.o time_rz.o timegm.o mktime.o mini-gmp-gnulib.o getloadavg.o pthread_sigmask.o mkostemp.o fpending.o execinfo.o tempname.o/ /^am__append_[1-9][0-9]* *=/,/^[^ ]/{ s/ *inttypes\.h// s| *sys/select\.h|| @@ -394,15 +403,19 @@ s/^ -*test -z.*|| rm/ -rm/ s/@echo /@djecho / # # Determine which headers to generate -s/= @GL_GENERATE_ALLOCA_H@/= 1/ +s/= @GL_GENERATE_ALLOCA_H_TRUE@/= 1/ s/= @GL_GENERATE_BYTESWAP_H@/= 1/ s/= @GL_GENERATE_EXECINFO_H@/= 1/ +s/= @GL_GENERATE_IEEE754_H@/= 1/ s/= @GL_GENERATE_STDALIGN_H@/= 1/ s/= @GL_GENERATE_STDDEF_H@/= 1/ s/= @GL_GENERATE_STDINT_H@/= 1/ s/= @GL_GENERATE_LIMITS_H@/= 1/ s/= @GL_GENERATE_ERRNO_H@/= / s/= @GL_GENERATE_LIMITS_H@/= / +s/= @GL_GENERATE_GMP_GMP_H@/= 1/ +s/= @GL_GENERATE_MINI_GMP_H@/= 1/ +s/\$\(MKDIR_P\) malloc// # # Determine which modules to build and which to omit /^noinst_LIBRARIES /a\ @@ -413,6 +426,7 @@ OMIT_GNULIB_MODULE_careadlinkat = true\ OMIT_GNULIB_MODULE_cloexec = true\ OMIT_GNULIB_MODULE_dirent = true\ OMIT_GNULIB_MODULE_dirfd = true\ +OMIT_GNULIB_MODULE_scratch_buffer = true\ OMIT_GNULIB_MODULE_dup2 = true\ OMIT_GNULIB_MODULE_errno = true\ OMIT_GNULIB_MODULE_euidaccess = true\ @@ -439,7 +453,8 @@ OMIT_GNULIB_MODULE_strtoimax = true\ OMIT_GNULIB_MODULE_strtoll = true\ OMIT_GNULIB_MODULE_symlink = true\ OMIT_GNULIB_MODULE_sys_select = true\ -OMIT_GNULIB_MODULE_sys_time = true +OMIT_GNULIB_MODULE_sys_time = true\ +OMIT_GNULIB_MODULE_crypto\/md5 = true /^arg-nonnull\.h:/,/^[ ][ ]*mv /c\ arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h\ sed -n -e '/GL_ARG_NONNULL/,$$p' < $(top_srcdir)/build-aux/snippet/arg-nonnull.h > $@ diff --git a/src/callproc.c b/src/callproc.c index fad81694b0..f7c55d0486 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -25,6 +25,10 @@ along with GNU Emacs. If not, see . */ #include #include +#ifdef MSDOS +extern char **environ; +#endif + #include #include @@ -1200,6 +1204,11 @@ static CHILD_SETUP_TYPE child_setup (int in, int out, int err, char **new_argv, char **env, const char *current_dir) { +#ifdef MSDOS + char *pwd_var; + char *temp; + ptrdiff_t i; +#endif #ifdef WINDOWSNT int cpid; HANDLE handles[3]; @@ -1252,6 +1261,22 @@ child_setup (int in, int out, int err, char **new_argv, char **env, exec_failed (new_argv[0], errnum); #else /* MSDOS */ + i = strlen (current_dir); + pwd_var = xmalloc (i + 5); + temp = pwd_var + 4; + memcpy (pwd_var, "PWD=", 4); + stpcpy (temp, current_dir); + + if (i > 2 && IS_DEVICE_SEP (temp[1]) && IS_DIRECTORY_SEP (temp[2])) + { + temp += 2; + i -= 2; + } + + /* Strip trailing slashes for PWD, but leave "/" and "//" alone. */ + while (i > 2 && IS_DIRECTORY_SEP (temp[i - 1])) + temp[--i] = 0; + pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); xfree (pwd_var); if (pid == -1) @@ -1583,11 +1608,13 @@ emacs_spawn (pid_t *newpid, int std_in, int std_out, int std_err, signal (SIGPROF, SIG_DFL); #endif +#ifdef subprocesses /* Stop blocking SIGCHLD in the child. */ unblock_child_signal (oldset); if (pty_flag) child_setup_tty (std_out); +#endif if (std_err < 0) std_err = std_out; diff --git a/src/fileio.c b/src/fileio.c index 7e3bebca9e..b1f464cf98 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2286,6 +2286,7 @@ permissions. */) off_t insize = st.st_size; ssize_t copied; +#ifndef MSDOS for (newsize = 0; newsize < insize; newsize += copied) { /* Copy at most COPY_MAX bytes at a time; this is min @@ -2300,6 +2301,7 @@ permissions. */) break; maybe_quit (); } +#endif /* MSDOS */ /* Fall back on read+write if copy_file_range failed, or if the input is empty and so could be a /proc file. read+write will diff --git a/src/msdos.c b/src/msdos.c index 5da01c9e7c..a6deea710f 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1874,6 +1874,7 @@ initialize_msdos_display (struct terminal *term) term->redeem_scroll_bar_hook = 0; term->judge_scroll_bars_hook = 0; term->read_socket_hook = &tty_read_avail_input; /* from keyboard.c */ + term->defined_color_hook = &tty_defined_color; /* from xfaces.c */ } int @@ -3915,6 +3916,50 @@ readlinkat (int fd, char const *name, char *buffer, size_t buffer_size) return readlink (name, buffer, buffer_size); } + +int +openat (int fd, const char * path, int oflag, int mode) +{ + /* Rely on a hack: an open directory is modeled as file descriptor 0, + as in fstatat. FIXME: Add proper support for openat. */ + char fullname[MAXPATHLEN]; + + if (fd != AT_FDCWD) + { + if (strlen (dir_pathname) + strlen (path) + 1 >= MAXPATHLEN) + { + errno = ENAMETOOLONG; + return -1; + } + sprintf (fullname, "%s/%s", dir_pathname, path); + path = fullname; + } + + return open (path, oflag, mode); +} + +int +fchmodat (int fd, const char *path, mode_t mode, int flags) +{ + /* Rely on a hack: an open directory is modeled as file descriptor 0, + as in fstatat. FIXME: Add proper support for openat. */ + char fullname[MAXPATHLEN]; + + if (fd != AT_FDCWD) + { + if (strlen (dir_pathname) + strlen (path) + 1 >= MAXPATHLEN) + { + errno = ENAMETOOLONG; + return -1; + } + + sprintf (fullname, "%s/%s", dir_pathname, path); + path = fullname; + } + + return chmod (path, mode); +} + char * careadlinkat (int fd, char const *filename, char *buffer, size_t buffer_size, @@ -3942,6 +3987,63 @@ careadlinkat (int fd, char const *filename, return buffer; } +int +futimens (int fd, const struct timespec times[2]) +{ + struct tm *tm; + struct ftime ft; + time_t t; + + block_input (); + if (times[1].tv_sec == UTIME_NOW) + t = time (NULL); + else + t = times[1].tv_sec; + + tm = localtime (&t); + ft.ft_tsec = min (29, tm->tm_sec / 2); + ft.ft_min = tm->tm_min; + ft.ft_hour = tm->tm_hour; + ft.ft_day = tm->tm_mday; + ft.ft_month = tm->tm_mon + 1; + ft.ft_year = max (0, tm->tm_year - 80); + unblock_input (); + + return setftime (fd, &ft); +} + +int +utimensat (int dirfd, const char *pathname, + const struct timespec times[2], int flags) +{ + int fd, ret; + char fullname[MAXPATHLEN]; + + /* Rely on a hack: dirfd in its current usage in Emacs is always + AT_FDCWD. */ + + if (dirfd != AT_FDCWD) + { + if (strlen (dir_pathname) + strlen (pathname) + 1 >= MAXPATHLEN) + { + errno = ENAMETOOLONG; + return -1; + } + sprintf (fullname, "%s/%s", dir_pathname, pathname); + pathname = fullname; + } + + fd = open (pathname, O_WRONLY); + + if (fd < 0) + return -1; + + ret = futimens (fd, times); + close (fd); + + return ret; +} + /* Emulate faccessat(2). */ int faccessat (int dirfd, const char * path, int mode, int flags) diff --git a/src/msdos.h b/src/msdos.h index f7d3b0d702..d58b60ef5d 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -86,6 +86,8 @@ typedef int GC; typedef int Pixmap; typedef int Display; typedef int Window; + +#define FRAME_X_DISPLAY(ignored) NULL #define PIX_TYPE unsigned long #define XDISPLAY diff --git a/src/process.c b/src/process.c index 6731f8808f..75ba191fa1 100644 --- a/src/process.c +++ b/src/process.c @@ -40,7 +40,10 @@ along with GNU Emacs. If not, see . */ #include #include -#endif /* subprocesses */ +#else +#define PIPECONN_P(p) false +#define PIPECONN1_P(p) false +#endif #ifdef HAVE_SETRLIMIT # include @@ -152,6 +155,7 @@ static bool kbd_is_on_hold; when exiting. */ bool inhibit_sentinels; +#ifdef subprocesses union u_sockaddr { struct sockaddr sa; @@ -164,8 +168,6 @@ union u_sockaddr #endif }; -#ifdef subprocesses - #ifndef SOCK_CLOEXEC # define SOCK_CLOEXEC 0 #endif @@ -8238,9 +8240,13 @@ If optional argument QUERY is `current', ignore OMP_NUM_THREADS. If QUERY is `all', also count processors not available. */) (Lisp_Object query) { +#ifndef MSDOS return make_uint (num_processors (EQ (query, Qall) ? NPROC_ALL : EQ (query, Qcurrent) ? NPROC_CURRENT : NPROC_CURRENT_OVERRIDABLE)); +#else + return make_fixnum (1); +#endif } #ifdef subprocesses @@ -8285,10 +8291,15 @@ open_channel_for_module (Lisp_Object process) { CHECK_PROCESS (process); CHECK_TYPE (PIPECONN_P (process), Qpipe_process_p, process); +#ifndef MSDOS int fd = dup (XPROCESS (process)->open_fd[SUBPROCESS_STDOUT]); if (fd == -1) report_file_error ("Cannot duplicate file descriptor", Qnil); return fd; +#else + /* PIPECONN_P returning true shouldn't be possible on MSDOS. */ + emacs_abort (); +#endif } diff --git a/src/thread.h b/src/thread.h index cf3ce922c4..b316e916d1 100644 --- a/src/thread.h +++ b/src/thread.h @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ #endif #ifdef MSDOS +#include /* struct rpl_timespec */ #include /* sigset_t */ #endif commit 8c50016b100ec2c548ec90131e0f5fb5f4ebb5c1 Author: Eli Zaretskii Date: Sat Dec 11 13:04:55 2021 +0200 Improve documentation of sqlite3 support * lisp/sqlite-mode.el (sqlite-mode-list-data): * configure.ac (HAVE_SQLITE3): Fix typos. * doc/lispref/text.texi (Database): Improve and clarify wording, add index entries, mention all the function arguments. * etc/NEWS: Minor wording changes of the sqlite entries. diff --git a/configure.ac b/configure.ac index 8d15c70d84..0debc85214 100644 --- a/configure.ac +++ b/configure.ac @@ -2691,7 +2691,7 @@ if test "${with_sqlite3}" != "no"; then AC_SUBST(SQLITE3_LIBS) LIBS="$SQLITE3_LIBS $LIBS" AC_DEFINE(HAVE_SQLITE3, 1, [Define to 1 if you have the libsqlite3 library (-lsqlite).]) - # Windows loads libwebp dynamically + # Windows loads libsqlite dynamically if test "${opsys}" = "mingw32"; then SQLITE3_LIBS= fi diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index e964d7b53c..b8d92f7fdc 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -5138,8 +5138,11 @@ IV used. @node Database @section Database +@cindex database access, SQLite - Emacs can be compiled with built-in SQLite support. + Emacs can be compiled with built-in support for accessing SQLite +databases. This section describes the facilities available for +accessing SQLite databases from Lisp programs. @defun sqlite-available-p The function returns non-@code{nil} if built-in SQLite support is @@ -5148,20 +5151,21 @@ available in this Emacs session. When SQLite support is available, the following functions can be used. +@cindex database object @defun sqlite-open &optional file -This function opens @var{file} as a database file. If it doesn't -exist, a new database will be created and stored there. If this -argument is missing or @code{nil}, a new in-memory database is created -instead. +This function opens @var{file} as an SQLite database file. If +@var{file} doesn't exist, a new database will be created and stored in +that file. If @var{file} is omitted or @code{nil}, a new in-memory +database is created instead. The return value is a @dfn{database object} that can be used as the -argument to most of the subsequent functions in this section of the -manual. +argument to most of the subsequent functions described below. @end defun -@defun sqlitep -The database object returned by the @code{sqlite-open} function -satisfies this predicate. +@defun sqlitep object +This predicate returns non-@code{nil} if @var{object} is an SQLite +database object. The database object returned by the +@code{sqlite-open} function satisfies this predicate. @end defun @defun sqlite-close db @@ -5185,13 +5189,13 @@ For instance: (sqlite-execute db "insert into foo values (?, ?)" '("bar" 2)) @end lisp -This has exactly the same effect as the first form, but is more +This has exactly the same effect as the previous example, but is more efficient and safer (because it doesn't involve any string parsing or interpolation). -The number of affected rows is returned. For instance, an -@samp{insert} statement will return @samp{1}, but an @samp{update} -statement may return zero or a higher number. +@code{sqlite-execute} returns the number of affected rows. For +instance, an @samp{insert} statement will return @samp{1}, whereas an +@samp{update} statement may return zero or a higher number. @end defun @defun sqlite-select db query &optional values result-type @@ -5202,33 +5206,36 @@ Select some data from @var{db} and return them. For instance: @result{} (("bar" 2)) @end lisp -As with the @code{sqlite-execute} command, you can pass in a list or a -vector of values that will be bound before executing the select: +As with the @code{sqlite-execute}, you can optionally pass in a list +or a vector of values that will be bound before executing the select: @lisp (sqlite-select db "select * from foo where key = ?" [2]) @result{} (("bar" 2)) @end lisp -This is usually more efficient and safer than the first method. +This is usually more efficient and safer than the method used by the +previous example. -This function, by default, returns a list of matching rows, where each +By default, this function returns a list of matching rows, where each row is a list of column values. If @var{return-type} is @code{full}, the names of the columns (as a list of strings) will be returned as the first element in the return value. +@cindex statement object If @var{return-type} is @code{set}, this function will return a -@dfn{statement object} instead. This object can be interrogated by +@dfn{statement object} instead. This object can be examined by using the @code{sqlite-next}, @code{sqlite-columns} and @code{sqlite-more-p} functions. If the result set is small, it's often more convenient to just return the data directly, but if the result set is large (or if you won't be using all the data from the set), using the @code{set} -method will allocate a lot less data, and therefore be more efficient. +method will allocate a lot less memory, and is therefore more +memory-efficient. @end defun @defun sqlite-next statement -This function returns the next row in the result set returned by -@code{sqlite-select}. +This function returns the next row in the result set @var{statement}, +typically an object returned by @code{sqlite-select}. @lisp (sqlite-next stmt) @@ -5237,8 +5244,8 @@ This function returns the next row in the result set returned by @end defun @defun sqlite-columns statement -This function returns the column names of the result set returned by -@code{sqlite-select}. +This function returns the column names of the result set +@var{statement}, typically an object returned by @code{sqlite-select}. @lisp (sqlite-columns stmt) @@ -5247,38 +5254,42 @@ This function returns the column names of the result set returned by @end defun @defun sqlite-more-p statement -This predicate says whether there is more data to be fetched in the -result set returned by @code{sqlite-select}. +This predicate says whether there is more data to be fetched from the +result set @var{statement}, typically an object returned by +@code{sqlite-select}. @end defun @defun sqlite-finalize statement If @var{statement} is not going to be used any more, calling this -function will free the resources bound by @var{statement}. This is -usually not necessary---when the statement object is -garbage-collected, this will happen automatically. +function will free the resources used by @var{statement}. This is +usually not necessary---when the @var{statement} object is +garbage-collected, Emacs will automatically free its resources. @end defun @defun sqlite-transaction db Start a transaction in @var{db}. When in a transaction, other readers of the database won't access the results until the transaction has -been committed. +been committed by @code{sqlite-commit}. @end defun @defun sqlite-commit db -End a transaction and write the data out to file. +End a transaction in @var{db} and write the data out to its file. @end defun @defun sqlite-rollback db -End a transaction and discard any changes that have been made. +End a transaction in @var{db} and discard any changes that have been +made by the transaction. @end defun -@defmac with-sqlite-transaction db &body body -Like @code{progn}, but executes @var{body} with a transaction held, -and do a commit at the end. +@defmac with-sqlite-transaction db body@dots{} +Like @code{progn} (@pxref{Sequencing}), but executes @var{body} with a +transaction held, and commits the transaction at the end. @end defmac @defun sqlite-load-extension db module -Load an extension into @var{db}. Extensions are usually @file{.so} files. +Load the named extension @var{module} into the database @var{db}. +Extensions are usually shared-library files; on GNU and Unix systems, +they have the @file{.so} file-name extension. @end defun @node Parsing HTML/XML diff --git a/etc/NEWS b/etc/NEWS index b0dfa301d3..807751ae12 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -24,6 +24,11 @@ applies, and please also update docstrings as needed. * Installation Changes in Emacs 29.1 ++++ +** Emacs can be built with built-in support for accessing SQLite databases. +This uses the popular sqlite3 library, and can be disabled by using +the '--without-sqlite3' option to the 'configure' script. + ** Emacs has been ported to the Haiku operating system. The configuration process should automatically detect and build for Haiku. There is also an optional window-system port to Haiku, which @@ -91,13 +96,10 @@ the 'variable-pitch' face, or add this to your "~/.emacs": * Changes in Emacs 29.1 -+++ -** Emacs now comes with optional built-in support for sqlite3. -This allows you to examine and manipulate sqlite3 databases. - ** New command 'sqlite-mode-open-file' for examining an sqlite3 file. -This uses the new 'sqlite-mode' which allows listing the tables -in a file, the columns, and the contents of the tables. +This uses the new 'sqlite-mode' which allows listing the tables in a +DB file, and examining and modifying the columns and the contents of +those tables. --- ** 'write-file' will now copy some file mode bits. diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 61398c180f..9306bd85dc 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -130,7 +130,7 @@ (split-string (replace-regexp-in-string "^.*(\\|)$" "" sql) ",")))) (defun sqlite-mode-list-data () - "List the data from the table under poing." + "List the data from the table under point." (interactive nil sqlite-mode) (let ((row (and (eq (get-text-property (point) 'sqlite--type) 'table) (get-text-property (point) 'sqlite--row)))) commit d90be279958c093c4d3023ef553ea20508cf4c28 Author: Po Lu Date: Sat Dec 11 18:30:01 2021 +0800 Use window height to determine wheel event pixel deltas on XInput 2 * src/xterm.c (handle_one_xevent): Use window height instead of frame height to determine the height of a scroll unit. diff --git a/src/xterm.c b/src/xterm.c index 41aa2b268c..f2129458e1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9990,6 +9990,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, { struct xi_scroll_valuator_t *val; double delta, scroll_unit; + int scroll_height; + Lisp_Object window; /* See the comment on top of @@ -10056,7 +10058,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, xev->mods.effective); } - scroll_unit = pow (FRAME_PIXEL_HEIGHT (f), 2.0 / 3.0); + window = window_from_coordinates (f, xev->event_x, + xev->event_y, NULL, + false, false); + + if (WINDOWP (window)) + scroll_height = XWINDOW (window)->pixel_height; + else + /* EVENT_X and EVENT_Y can be outside the + frame if F holds the input grab, so fall + back to the height of the frame instead. */ + scroll_height = FRAME_PIXEL_HEIGHT (f); + + scroll_unit = pow (scroll_height, 2.0 / 3.0); if (NUMBERP (Vx_scroll_event_delta_factor)) scroll_unit *= XFLOATINT (Vx_scroll_event_delta_factor); commit 607dee1a7192d77546bb30561296b46e35d67019 Author: Po Lu Date: Sat Dec 11 10:07:48 2021 +0000 Prevent hang when exiting Emacs on Haiku * src/haiku_support.cc (be_app_quit): Don't wait for app thread to also quit. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index d6d7967524..b8f6e84d2c 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -2663,10 +2663,8 @@ be_app_quit (void) { if (be_app) { - status_t e; while (!be_app->Lock ()); be_app->Quit (); - wait_for_thread (app_thread, &e); } } commit facddfc8036fa81dd2ad3a0ec2227ef8790f28eb Author: Eli Zaretskii Date: Sat Dec 11 12:05:54 2021 +0200 * src/sqlite.c (row_to_value): Call 'make_unibyte_string'. diff --git a/src/sqlite.c b/src/sqlite.c index 87cebb1686..d92dcf723c 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -428,8 +428,8 @@ row_to_value (sqlite3_stmt *stmt) case SQLITE_BLOB: v = code_convert_string_norecord - (make_string (sqlite3_column_blob (stmt, i), - sqlite3_column_bytes (stmt, i)), + (make_unibyte_string (sqlite3_column_blob (stmt, i), + sqlite3_column_bytes (stmt, i)), Qutf_8, false); break; @@ -440,8 +440,8 @@ row_to_value (sqlite3_stmt *stmt) case SQLITE_TEXT: v = code_convert_string_norecord - (make_string ((const char*)sqlite3_column_text (stmt, i), - sqlite3_column_bytes (stmt, i)), + (make_unibyte_string ((const char *)sqlite3_column_text (stmt, i), + sqlite3_column_bytes (stmt, i)), Qutf_8, false); break; } commit 815a8a7db21640633b1615044838c73e2451ac86 Author: Basil L. Contovounesios Date: Sat Dec 11 11:47:55 2021 +0200 Pacify unused variable warning in xterm.c * src/xterm.c (handle_one_xevent) [HAVE_XINPUT2]: The variable any_stop_p is used only when HAVE_XWIDGETS, so guard its declaration accordingly to pacify GCC's -Wunused-variable warning. diff --git a/src/xterm.c b/src/xterm.c index ae0daa79f3..41aa2b268c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9851,7 +9851,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, XIValuatorState *states; double *values; bool found_valuator = false; +#ifdef HAVE_XWIDGETS bool any_stop_p = false; +#endif /* HAVE_XWIDGETS */ /* A fake XMotionEvent for x_note_mouse_movement. */ XMotionEvent ev; commit 4cdc59f33a0759a238184e67d59ea8e5143b7cc2 Author: Eli Zaretskii Date: Sat Dec 11 11:54:44 2021 +0200 Minor cleanups in sqlite.c * src/sqlite.c (Fsqlite_open): Signal an error if 'init_sqlite_functions' fails. Encode FILE using UTF-8. (Fsqlite_close, Fsqlite_execute, Fsqlite_select) (Fsqlite_load_extension): Doc fixes. (Fsqlite_load_extension): Encode MODULE using UTF-8. diff --git a/src/sqlite.c b/src/sqlite.c index 47829cbdf7..87cebb1686 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -241,12 +241,14 @@ If FILE is nil, an in-memory database will be opened instead. */) (Lisp_Object file) { char *name; - init_sqlite_functions (); + if (!init_sqlite_functions ()) + xsignal1 (Qerror, build_string ("sqlite support is not available")); if (!NILP (file)) { CHECK_STRING (file); - name = xstrdup (SSDATA (Fexpand_file_name (file, Qnil))); + file = encode_string (Fexpand_file_name (file, Qnil)); + name = xstrdup (SSDATA (file)); } else /* In-memory database. These have to have different names to @@ -273,7 +275,7 @@ If FILE is nil, an in-memory database will be opened instead. */) } DEFUN ("sqlite-close", Fsqlite_close, Ssqlite_close, 1, 1, 0, - doc: /* Close the database DB. */) + doc: /* Close the sqlite database DB. */) (Lisp_Object db) { check_sqlite (db, false); @@ -341,12 +343,12 @@ bind_values (sqlite3 *db, sqlite3_stmt *stmt, Lisp_Object values) DEFUN ("sqlite-execute", Fsqlite_execute, Ssqlite_execute, 2, 3, 0, doc: /* Execute a non-select SQL statement. -If VALUES is non-nil, it should be a list of values to bind when -executing a statement like +If VALUES is non-nil, it should be a vector or a list of values +to bind when executing a statement like insert into foo values (?, ?, ...) -The number of affected rows is returned. */) +Value is the number of affected rows. */) (Lisp_Object db, Lisp_Object query, Lisp_Object values) { check_sqlite (db, false); @@ -463,8 +465,8 @@ column_names (sqlite3_stmt *stmt) DEFUN ("sqlite-select", Fsqlite_select, Ssqlite_select, 2, 4, 0, doc: /* Select data from the database DB that matches QUERY. -If VALUES is non-nil, they are values that will be interpolated into a -parametrised statement. +If VALUES is non-nil, it should be a list or a vector specifying the +values that will be interpolated into a parameterized statement. By default, the return value is a list where the first element is a list of column names, and the rest of the elements are the matching data. @@ -573,16 +575,18 @@ DEFUN ("sqlite-rollback", Fsqlite_rollback, Ssqlite_rollback, 1, 1, 0, #ifdef HAVE_SQLITE3_LOAD_EXTENSION DEFUN ("sqlite-load-extension", Fsqlite_load_extension, Ssqlite_load_extension, 2, 2, 0, - doc: /* Load an SQlite module into DB. -MODULE should be the file name of an SQlite module .so file. */) + doc: /* Load an SQlite MODULE into DB. +MODULE should be the name of an SQlite module's file, a +shared library in the system-dependent format and having a +system-dependent file-name extension. */) (Lisp_Object db, Lisp_Object module) { check_sqlite (db, false); CHECK_STRING (module); + Lisp_Object module_encoded = encode_string (Fexpand_file_name (module, Qnil)); sqlite3 *sdb = XSQLITE (db)->db; - int result = sqlite3_load_extension (sdb, - SSDATA (Fexpand_file_name (module, Qnil)), + int result = sqlite3_load_extension (sdb, SSDATA (module_encoded), NULL, NULL); if (result == SQLITE_OK) return Qt; commit 628306c299923551cdc8cf09c874744ae7b74216 Author: Eli Zaretskii Date: Sat Dec 11 11:26:04 2021 +0200 Minor cleanups of sqlite3 code on MS-Windows * src/sqlite.c (sqlite_loaded_p): Function deleted: not used anymore. (init_sqlite_functions) [WINDOWSNT]: Use a static 'bool' variable to indicate if sqlite3 DLL was successfully loaded. (Fsqlite_available_p) [WINDOWSNT]: Just call 'init_sqlite_functions' if Vlibrary_cache doesn't mention 'sqlite3'. diff --git a/src/sqlite.c b/src/sqlite.c index aea79406aa..47829cbdf7 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -151,43 +151,32 @@ load_dll_functions (HMODULE library) LOAD_DLL_FN (library, sqlite3_prepare_v2); return true; } - -static bool -sqlite_loaded_p (void) -{ - Lisp_Object found = Fassq (Qsqlite3, Vlibrary_cache); - - return CONSP (found) && EQ (XCDR (found), Qt); -} #endif /* WINDOWSNT */ static bool init_sqlite_functions (void) { #ifdef WINDOWSNT - if (sqlite_loaded_p ()) - return true; - else + static bool sqlite3_initialized; + + if (!sqlite3_initialized) { - HMODULE library; + HMODULE library = w32_delayed_load (Qsqlite3); - if (!(library = w32_delayed_load (Qsqlite3))) + if (!library) + message1 ("sqlite3 library was not found"); + else if (load_dll_functions (library)) { - message1 ("sqlite3 library not found"); - return false; + sqlite3_initialized = true; + Vlibrary_cache = Fcons (Fcons (Qsqlite3, Qt), Vlibrary_cache); + } + else + { + message1 ("sqlite3 library was found, but could not be loaded successfully"); + Vlibrary_cache = Fcons (Fcons (Qsqlite3, Qnil), Vlibrary_cache); } - - if (! load_dll_functions (library)) - goto bad_library; - - Vlibrary_cache = Fcons (Fcons (Qsqlite3, Qt), Vlibrary_cache); - return true; } - - bad_library: - Vlibrary_cache = Fcons (Fcons (Qsqlite3, Qnil), Vlibrary_cache); - - return false; + return sqlite3_initialized; #else /* !WINDOWSNT */ return true; #endif /* !WINDOWSNT */ @@ -674,12 +663,7 @@ DEFUN ("sqlite-available-p", Fsqlite_available_p, Ssqlite_available_p, 0, 0, 0, if (CONSP (found)) return XCDR (found); else - { - Lisp_Object status; - status = init_sqlite_functions () ? Qt : Qnil; - Vlibrary_cache = Fcons (Fcons (Qsqlite3, status), Vlibrary_cache); - return status; - } + return init_sqlite_functions () ? Qt : Qnil; # else return Qt; #endif commit 6c81683a2791a1a08e4abe9b670f47b2b4037eff Author: Eli Zaretskii Date: Sat Dec 11 10:51:09 2021 +0200 Fix a typo in sqlite.c * src/sqlite.c (Fsqlite_select): Fix a typo in arguments to make_sqlite. diff --git a/src/sqlite.c b/src/sqlite.c index c1f3e7b599..aea79406aa 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -525,7 +525,7 @@ which means that we return a set object that can be queried with /* Return a handle to get the data. */ if (EQ (return_type, Qset)) { - retval = make_sqlite (true, db, stmt, XSQLITE (db)->name); + retval = make_sqlite (true, sdb, stmt, XSQLITE (db)->name); goto exit; } commit cabb049a5000c62d31628af031b7fb8ae76c9e57 Author: Lars Ingebrigtsen Date: Sat Dec 11 09:28:57 2021 +0100 Add confirmation to sqlite-mode-delete * lisp/sqlite-mode.el (sqlite-mode-delete): Add confirmation. diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 6714f41f6f..61398c180f 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -187,6 +187,8 @@ (when (or (not (consp table)) (not (eq (car table) 'row))) (user-error "No row under point")) + (unless (yes-or-no-p "Really delete the row under point? ") + (error "Not deleting")) (sqlite-execute sqlite--db (format "delete from %s where %s"